feat(inicio): sesión 2, logo, hero con video, industrias y pie nuevo
- Cabecera: logotipo en SVG (src/assets/logo.svg) y favicon nuevo; barra de vidrio con subrayado que se dibuja de izquierda a derecha y separadores "/". - Hero: video de fondo optimizado (MP4 + WebM, póster webp de escritorio y móvil), velo para contraste AA, botón de pausa discreto, título "Collina Systems", altura 94svh y botón "Contacto" de vidrio blanco. - Banda marino "Construimos los sistemas con los que opera tu negocio." con enlace a /firma en celeste. - Sección de tarjetas por industria (fondo papel) en lugar de las cifras y el bloque de proyectos: fotos con <Picture> (avif/webp, 400/800/1200), alt y recorte en src/content/inicio/industrias.yaml publicados como /css/industrias.css (CSP sin estilos en línea); panel blanco al señalar con cursor, enlaces con subrayado animado. Enlaces a fichas por slug. - Nueva ficha "Cobranza al día" con diagrama; lo no documentado queda en TODO. - Eliminados Stat, la colección cifras y sus datos; verificar-metricas solo revisa fichas. - Pie nuevo portado de referencia/collina-footer: eslogan rotativo, correo, sedes con reloj por zona horaria, redes y copyright; estilos bajo .footer, colores como tokens, alineado a la retícula del sitio y eslogan mayor en teléfono. Sin la línea legal ni los enlaces del pie anterior. - CI movido a .gitea/workflows (Gitea Actions). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4c555f1c6f
commit
3042561115
44 files changed
+2114
-255
No files matched your search
+206
-38
@@ -1,46 +1,214 @@
|
||||
---
|
||||
import { SITIO } from '../lib/sitio';
|
||||
/* Pie de página del sitio. Portado de referencia/collina-footer (diseño
|
||||
aprobado): eslogan con palabra rotativa, correo, sedes con reloj analógico
|
||||
por zona horaria, redes y copyright. Textos en src/lib/sitio.ts (PIE);
|
||||
estilos en src/styles/footer.css, todos bajo .footer. */
|
||||
import '../styles/footer.css';
|
||||
import { PIE, SITIO } from '../lib/sitio';
|
||||
|
||||
const anio = new Date().getFullYear();
|
||||
---
|
||||
|
||||
<footer class="pie">
|
||||
<div class="wrap">
|
||||
<div>
|
||||
<span>{SITIO.nombre} · {SITIO.anio}</span>
|
||||
<span class="sep" aria-hidden="true">·</span>
|
||||
<span>Nombre comercial de Collina LLC (Wyoming), con operación en Puebla, México</span>
|
||||
<footer class="footer" aria-labelledby="footer-slogan">
|
||||
<div class="footer__inner">
|
||||
<div class="footer__top">
|
||||
<div class="footer__col footer__col--left">
|
||||
<p class="footer__slogan" id="footer-slogan">
|
||||
<span class="sr-only">{PIE.eslogan.accesible}</span>
|
||||
{
|
||||
PIE.eslogan.antes.map((linea) => (
|
||||
<span class="footer__slogan-line" aria-hidden="true">
|
||||
{linea}
|
||||
</span>
|
||||
))
|
||||
}
|
||||
<span class="footer__slogan-words" aria-hidden="true">
|
||||
{
|
||||
PIE.eslogan.rotativas.map((palabra, i) => (
|
||||
<span class="footer__slogan-word" data-active={i === 0 ? 'true' : undefined}>
|
||||
{palabra}
|
||||
</span>
|
||||
))
|
||||
}
|
||||
</span>
|
||||
<span class="footer__slogan-line" aria-hidden="true">{PIE.eslogan.despues}</span>
|
||||
</p>
|
||||
|
||||
<div class="footer__contact">
|
||||
<p class="footer__label">{PIE.etiquetaContacto}</p>
|
||||
<a class="footer__contact-link link-slide" href={`mailto:${SITIO.correo}`}>{SITIO.correo}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="footer__col footer__col--right">
|
||||
{
|
||||
PIE.sedes.map((sede) => (
|
||||
<div class="footer__branch" data-tz={sede.zona}>
|
||||
<div class="footer__clock" aria-hidden="true">
|
||||
<span class="footer__clock-hand footer__clock-hand--hour" />
|
||||
<span class="footer__clock-hand footer__clock-hand--minute" />
|
||||
<span class="footer__clock-pin" />
|
||||
</div>
|
||||
<div class="footer__branch-info">
|
||||
<p class="footer__branch-country">{sede.pais}</p>
|
||||
<address class="footer__branch-address">
|
||||
{sede.direccion[0]}
|
||||
<br />
|
||||
{sede.direccion[1]}
|
||||
</address>
|
||||
<p class="footer__branch-phone">
|
||||
<a href={`tel:${sede.tel}`}>{sede.telefono}</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="footer__bottom">
|
||||
<ul class="footer__socials">
|
||||
{
|
||||
PIE.redes.map((red) => (
|
||||
<li>
|
||||
<a class="link-slide" href={red.href} target="_blank" rel="noopener noreferrer">
|
||||
{red.nombre}
|
||||
</a>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
</ul>
|
||||
<p class="footer__copyright">
|
||||
© <span data-footer-year>{anio}</span> {SITIO.nombre}. {PIE.derechos}
|
||||
</p>
|
||||
</div>
|
||||
<ul>
|
||||
<li><a href="/curriculum">Currículum empresarial</a></li>
|
||||
<li><a href="/contacto">Contacto</a></li>
|
||||
<li><a href={`mailto:${SITIO.correo}`} class="mono">{SITIO.correo}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<style>
|
||||
.pie {
|
||||
border-top: 1px solid var(--line);
|
||||
padding-block: 2.5rem;
|
||||
padding-bottom: calc(2.5rem + env(safe-area-inset-bottom, 0px));
|
||||
font-size: 0.85rem;
|
||||
color: var(--fg-3);
|
||||
<script>
|
||||
/* Comportamiento del pie (portado de referencia/collina-footer/footer.js):
|
||||
1) Palabra rotativa del eslogan con auto-ajuste de tamaño. Se pausa fuera
|
||||
de pantalla y en pestañas ocultas; con movimiento reducido no rota.
|
||||
2) Relojes analógicos por zona horaria.
|
||||
3) Año del copyright (el build ya lo escribe; aquí solo se actualiza).
|
||||
Los estilos se aplican por CSSOM (element.style), compatible con la CSP. */
|
||||
const footer = document.querySelector<HTMLElement>('.footer');
|
||||
|
||||
if (footer) {
|
||||
const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)');
|
||||
|
||||
/* ── 1. Eslogan ── */
|
||||
const box = footer.querySelector<HTMLElement>('.footer__slogan-words');
|
||||
const words = box ? Array.from(box.querySelectorAll<HTMLElement>('.footer__slogan-word')) : [];
|
||||
const line = footer.querySelector<HTMLElement>('.footer__slogan-line');
|
||||
|
||||
const fitWords = () => {
|
||||
if (!box) return;
|
||||
const width = box.clientWidth;
|
||||
if (!width) return;
|
||||
const REF = 200;
|
||||
let widest = 0;
|
||||
words.forEach((w) => {
|
||||
const prev = w.style.fontSize;
|
||||
w.style.fontSize = REF + 'px';
|
||||
widest = Math.max(widest, w.scrollWidth);
|
||||
w.style.fontSize = prev;
|
||||
});
|
||||
if (!widest) return;
|
||||
const lineSize = line ? parseFloat(getComputedStyle(line).fontSize) : Infinity;
|
||||
const size = Math.min((width / widest) * REF, lineSize); // nunca más grande que CREAREMOS
|
||||
words.forEach((w) => {
|
||||
w.style.fontSize = size + 'px';
|
||||
});
|
||||
box.style.height = size + 'px';
|
||||
};
|
||||
|
||||
if (box && words.length > 1) {
|
||||
fitWords();
|
||||
if (typeof ResizeObserver !== 'undefined') new ResizeObserver(fitWords).observe(box);
|
||||
else window.addEventListener('resize', fitWords);
|
||||
if (document.fonts && document.fonts.ready) document.fonts.ready.then(fitWords);
|
||||
|
||||
const INTERVAL = 2400;
|
||||
const TRANSITION = 600;
|
||||
let idx = 0;
|
||||
let timer: number | null = null;
|
||||
let visible = false;
|
||||
|
||||
const next = () => {
|
||||
const current = words[idx];
|
||||
idx = (idx + 1) % words.length;
|
||||
const upcoming = words[idx];
|
||||
current.removeAttribute('data-active');
|
||||
current.setAttribute('data-leaving', 'true');
|
||||
upcoming.removeAttribute('data-leaving');
|
||||
void upcoming.offsetWidth;
|
||||
upcoming.setAttribute('data-active', 'true');
|
||||
window.setTimeout(() => current.removeAttribute('data-leaving'), TRANSITION + 50);
|
||||
};
|
||||
const sync = () => {
|
||||
const run = visible && !document.hidden && !reduceMotion.matches;
|
||||
if (run && !timer) timer = window.setInterval(next, INTERVAL);
|
||||
if (!run && timer) {
|
||||
window.clearInterval(timer);
|
||||
timer = null;
|
||||
}
|
||||
};
|
||||
|
||||
if (typeof IntersectionObserver !== 'undefined') {
|
||||
new IntersectionObserver((entries) => {
|
||||
visible = entries[0].isIntersecting;
|
||||
sync();
|
||||
}).observe(box);
|
||||
} else {
|
||||
visible = true;
|
||||
}
|
||||
document.addEventListener('visibilitychange', sync);
|
||||
reduceMotion.addEventListener('change', sync);
|
||||
sync();
|
||||
}
|
||||
|
||||
/* ── 2. Relojes ── */
|
||||
const branches = Array.from(footer.querySelectorAll<HTMLElement>('.footer__branch[data-tz]'));
|
||||
|
||||
const timeIn = (tz: string) => {
|
||||
try {
|
||||
const parts = new Intl.DateTimeFormat('en-US', {
|
||||
timeZone: tz,
|
||||
hour12: false,
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
second: '2-digit',
|
||||
}).formatToParts(new Date());
|
||||
const t = { h: 0, m: 0, s: 0 };
|
||||
parts.forEach((p) => {
|
||||
if (p.type === 'hour') t.h = parseInt(p.value, 10) % 24;
|
||||
if (p.type === 'minute') t.m = parseInt(p.value, 10);
|
||||
if (p.type === 'second') t.s = parseInt(p.value, 10);
|
||||
});
|
||||
return t;
|
||||
} catch {
|
||||
const d = new Date();
|
||||
return { h: d.getHours(), m: d.getMinutes(), s: d.getSeconds() };
|
||||
}
|
||||
};
|
||||
|
||||
const tick = () => {
|
||||
branches.forEach((b) => {
|
||||
const t = timeIn(b.dataset.tz ?? '');
|
||||
const hour = b.querySelector<HTMLElement>('.footer__clock-hand--hour');
|
||||
const minute = b.querySelector<HTMLElement>('.footer__clock-hand--minute');
|
||||
if (hour) hour.style.transform = 'rotate(' + (((t.h % 12) + t.m / 60) * 30).toFixed(2) + 'deg)';
|
||||
if (minute) minute.style.transform = 'rotate(' + ((t.m + t.s / 60) * 6).toFixed(2) + 'deg)';
|
||||
});
|
||||
};
|
||||
if (branches.length) {
|
||||
tick();
|
||||
window.setInterval(tick, 15000);
|
||||
}
|
||||
|
||||
/* ── 3. Año ── */
|
||||
const year = footer.querySelector<HTMLElement>('[data-footer-year]');
|
||||
if (year) year.textContent = String(new Date().getFullYear());
|
||||
}
|
||||
.pie .wrap {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 1rem 2rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.sep {
|
||||
margin-inline: 0.5rem;
|
||||
}
|
||||
ul {
|
||||
display: flex;
|
||||
gap: 1.4rem;
|
||||
flex-wrap: wrap;
|
||||
list-style: none;
|
||||
}
|
||||
.pie a:hover {
|
||||
color: var(--accent);
|
||||
}
|
||||
</style>
|
||||
</script>
|
||||
+76
-22
@@ -1,11 +1,14 @@
|
||||
---
|
||||
import { NAV, SITIO, esActual } from '../lib/sitio';
|
||||
import Logo from '../assets/logo.svg';
|
||||
const ruta = Astro.url.pathname;
|
||||
---
|
||||
|
||||
<header class="cabecera">
|
||||
<div class="wrap nav">
|
||||
<a class="marca" href="/" aria-label={`${SITIO.nombre}, inicio`}>Collina <small>Systems</small></a>
|
||||
<a class="marca" href="/" aria-label={`${SITIO.nombre}, inicio`}>
|
||||
<Logo class="logo" aria-hidden="true" focusable="false" />
|
||||
</a>
|
||||
<button class="burger" type="button" aria-expanded="false" aria-controls="menu" data-burger>Menú</button>
|
||||
<nav aria-label="Principal">
|
||||
<ul class="menu" id="menu" data-menu>
|
||||
@@ -13,7 +16,7 @@ const ruta = Astro.url.pathname;
|
||||
NAV.map((item) => (
|
||||
<li>
|
||||
<a href={item.href} aria-current={esActual(item.href, ruta) ? 'page' : undefined}>
|
||||
{item.texto}
|
||||
<span class="texto">{item.texto}</span>
|
||||
</a>
|
||||
</li>
|
||||
))
|
||||
@@ -24,14 +27,26 @@ const ruta = Astro.url.pathname;
|
||||
</header>
|
||||
|
||||
<style>
|
||||
/* Vidrio: fondo translúcido, desenfoque y saturación de lo que pasa por debajo,
|
||||
con un filo de luz arriba y una sombra suave abajo. */
|
||||
.cabecera {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 9;
|
||||
background: var(--bg);
|
||||
border-bottom: 1px solid var(--line);
|
||||
background: var(--glass-bg);
|
||||
-webkit-backdrop-filter: blur(18px) saturate(180%);
|
||||
backdrop-filter: blur(18px) saturate(180%);
|
||||
border-bottom: 1px solid var(--glass-borde);
|
||||
box-shadow:
|
||||
inset 0 1px 0 var(--glass-brillo),
|
||||
0 8px 24px -16px var(--glass-sombra);
|
||||
padding-top: env(safe-area-inset-top, 0px);
|
||||
}
|
||||
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
|
||||
.cabecera {
|
||||
background: var(--bg);
|
||||
}
|
||||
}
|
||||
.nav {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -41,35 +56,67 @@ const ruta = Astro.url.pathname;
|
||||
position: relative;
|
||||
}
|
||||
.marca {
|
||||
font-family: var(--font-display);
|
||||
font-weight: 700;
|
||||
font-size: 1.3rem;
|
||||
letter-spacing: 0.02em;
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 0.5rem;
|
||||
font-variation-settings: 'opsz' 48;
|
||||
color: var(--logo);
|
||||
}
|
||||
.marca small {
|
||||
font-family: var(--font-body);
|
||||
font-weight: 600;
|
||||
font-size: 0.62rem;
|
||||
letter-spacing: 0.2em;
|
||||
text-transform: uppercase;
|
||||
color: var(--fg-3);
|
||||
.logo {
|
||||
display: block;
|
||||
height: 3.25rem;
|
||||
width: auto;
|
||||
}
|
||||
@media (max-width: 759px) {
|
||||
.logo {
|
||||
height: 2.75rem;
|
||||
}
|
||||
}
|
||||
.menu {
|
||||
display: flex;
|
||||
gap: 1.6rem;
|
||||
align-items: center;
|
||||
gap: 0.85rem;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-size: 0.95rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
.menu a[aria-current='page'] {
|
||||
color: var(--accent);
|
||||
box-shadow: inset 0 -2px 0 var(--accent);
|
||||
.menu li {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.85rem;
|
||||
}
|
||||
/* Separador entre secciones; el texto alternativo vacío lo oculta a lectores de pantalla. */
|
||||
.menu li + li::before {
|
||||
content: '/' / '';
|
||||
color: var(--fg-3);
|
||||
font-weight: 400;
|
||||
}
|
||||
/* Sin cambio de color: la sección actual y la que se señala llevan una línea
|
||||
que se dibuja de izquierda a derecha (y se retira hacia la derecha). */
|
||||
.menu a,
|
||||
.menu a:hover {
|
||||
color: var(--fg);
|
||||
}
|
||||
.texto {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
.texto::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: -4px;
|
||||
height: 2px;
|
||||
background: currentColor;
|
||||
transform: scaleX(0);
|
||||
transform-origin: right center;
|
||||
transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
|
||||
}
|
||||
.menu a:hover .texto::after,
|
||||
.menu a:focus-visible .texto::after,
|
||||
.menu a[aria-current='page'] .texto::after {
|
||||
transform: scaleX(1);
|
||||
transform-origin: left center;
|
||||
}
|
||||
.burger {
|
||||
display: none;
|
||||
@@ -91,12 +138,19 @@ const ruta = Astro.url.pathname;
|
||||
background: var(--bg);
|
||||
border-bottom: 1px solid var(--line);
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 0;
|
||||
padding: 0.5rem var(--gutter-r) 0.5rem var(--gutter-l);
|
||||
}
|
||||
.menu.abierto {
|
||||
display: flex;
|
||||
}
|
||||
.menu li {
|
||||
display: block;
|
||||
}
|
||||
.menu li + li::before {
|
||||
content: none;
|
||||
}
|
||||
.menu li a {
|
||||
display: block;
|
||||
padding: 0.75rem 0;
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
---
|
||||
/* Cifra con método. Nunca se muestra un valor sin su método; un valor null se
|
||||
presenta como "por medir". */
|
||||
interface Props {
|
||||
valor: string | null;
|
||||
texto: string;
|
||||
metodo: string;
|
||||
periodo?: string | null;
|
||||
}
|
||||
const { valor, texto, metodo, periodo = null } = Astro.props;
|
||||
---
|
||||
|
||||
<div class="stat">
|
||||
<strong class="mono">{valor ?? 'por medir'}</strong>
|
||||
<span>{texto}</span>
|
||||
<small>{metodo}{periodo && <> · {periodo}</>}</small>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.stat {
|
||||
border-top: 2px solid var(--fg);
|
||||
padding-top: 1rem;
|
||||
}
|
||||
.stat strong {
|
||||
display: block;
|
||||
font-family: var(--font-mono);
|
||||
font-size: clamp(2rem, 4vw, 3rem);
|
||||
font-weight: 500;
|
||||
line-height: 1;
|
||||
font-variant-numeric: tabular-nums;
|
||||
letter-spacing: -0.02em;
|
||||
}
|
||||
.stat span {
|
||||
display: block;
|
||||
margin-top: 0.5rem;
|
||||
color: var(--fg-2);
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
.stat small {
|
||||
display: block;
|
||||
margin-top: 0.35rem;
|
||||
color: var(--fg-3);
|
||||
font-size: 0.8rem;
|
||||
line-height: 1.4;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,149 @@
|
||||
---
|
||||
/* Tarjeta de una industria: imagen 4:3, regla superior, nombre de la industria
|
||||
(h3), texto y la lista de proyectos que la atienden, enlazados a su ficha.
|
||||
La tarjeta no es un enlace: solo los nombres de proyecto lo son.
|
||||
|
||||
Imagen siempre a color y regla siempre en el color del texto. Solo con cursor
|
||||
(hover: hover): al señalar la tarjeta o enfocar uno de sus enlaces, la tarjeta
|
||||
se vuelve un panel blanco y la imagen se acerca ligeramente. Los enlaces van
|
||||
en el color del texto, sin flecha, con un subrayado que se dibuja de izquierda
|
||||
a derecha. El recorte (object-position) llega de /css/industrias.css. */
|
||||
import { Picture } from 'astro:assets';
|
||||
import type { ImageMetadata } from 'astro';
|
||||
|
||||
interface Props {
|
||||
id: string;
|
||||
industria: string;
|
||||
texto: string;
|
||||
imagen: { src: ImageMetadata; alt: string };
|
||||
proyectos: { nombre: string; href: string }[];
|
||||
}
|
||||
const { id, industria, texto, imagen, proyectos } = Astro.props;
|
||||
---
|
||||
|
||||
<article class="tarjeta" data-industria={id}>
|
||||
<div class="foto">
|
||||
<Picture
|
||||
src={imagen.src}
|
||||
alt={imagen.alt}
|
||||
formats={['avif', 'webp']}
|
||||
widths={[400, 800, 1200]}
|
||||
sizes="(min-width:1024px) 25vw, (min-width:640px) 50vw, 100vw"
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
/>
|
||||
</div>
|
||||
<div class="regla"></div>
|
||||
<h3>{industria}</h3>
|
||||
<p class="texto">{texto}</p>
|
||||
<ul class="proyectos">
|
||||
{
|
||||
proyectos.map((p) => (
|
||||
<li>
|
||||
<a class="enlace" href={p.href}>
|
||||
{p.nombre}
|
||||
</a>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
</ul>
|
||||
</article>
|
||||
|
||||
<style>
|
||||
.foto {
|
||||
aspect-ratio: 4 / 3;
|
||||
overflow: hidden;
|
||||
}
|
||||
.foto :global(picture) {
|
||||
display: block;
|
||||
height: 100%;
|
||||
}
|
||||
.foto :global(img) {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
/* Regla de 2 px, siempre en el color del texto. */
|
||||
.regla {
|
||||
height: 2px;
|
||||
margin-top: 1rem;
|
||||
background: var(--fg);
|
||||
}
|
||||
h3 {
|
||||
margin-top: 1rem;
|
||||
font-family: var(--font-display);
|
||||
font-size: 1.35rem;
|
||||
line-height: 1.2;
|
||||
}
|
||||
.texto {
|
||||
margin-top: 0.75rem;
|
||||
color: var(--fg-2);
|
||||
font-family: var(--font-body);
|
||||
font-size: 0.95rem;
|
||||
line-height: 1.55;
|
||||
}
|
||||
.proyectos {
|
||||
list-style: none;
|
||||
margin: 1rem 0 0;
|
||||
padding: 0;
|
||||
display: grid;
|
||||
gap: 0.45rem;
|
||||
}
|
||||
/* Subrayado de 1 px que crece de izquierda a derecha (fondo en degradado:
|
||||
funciona también si el nombre ocupa dos líneas). */
|
||||
.enlace {
|
||||
color: var(--fg);
|
||||
font-size: 0.95rem;
|
||||
font-weight: 500;
|
||||
text-decoration: none;
|
||||
background-image: linear-gradient(currentColor, currentColor);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 100%;
|
||||
background-size: 0 1px;
|
||||
padding-bottom: 2px;
|
||||
-webkit-box-decoration-break: clone;
|
||||
box-decoration-break: clone;
|
||||
transition: background-size 250ms ease-out;
|
||||
}
|
||||
.enlace:hover,
|
||||
.enlace:focus-visible {
|
||||
background-size: 100% 1px;
|
||||
}
|
||||
|
||||
/* Panel al señalar: solo con cursor. El padding de 16 px compensado con
|
||||
margin -16 px separa el texto del borde del panel sin mover la retícula. */
|
||||
@media (hover: hover) {
|
||||
.tarjeta {
|
||||
padding: 16px;
|
||||
margin: -16px;
|
||||
transition:
|
||||
background-color 250ms ease-out,
|
||||
box-shadow 250ms ease-out;
|
||||
}
|
||||
.foto :global(img) {
|
||||
transition: transform 250ms ease-out;
|
||||
}
|
||||
.tarjeta:hover,
|
||||
.tarjeta:focus-within {
|
||||
background-color: var(--tarjeta-panel);
|
||||
box-shadow: 0 18px 40px -18px var(--tarjeta-sombra);
|
||||
}
|
||||
.tarjeta:hover .foto :global(img),
|
||||
.tarjeta:focus-within .foto :global(img) {
|
||||
transform: scale(1.03);
|
||||
}
|
||||
}
|
||||
/* Movimiento reducido: sin escala ni subrayado animado; cambios inmediatos. */
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.tarjeta,
|
||||
.foto :global(img),
|
||||
.enlace {
|
||||
transition: none;
|
||||
}
|
||||
.tarjeta:hover .foto :global(img),
|
||||
.tarjeta:focus-within .foto :global(img) {
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
+129
-4
@@ -5,11 +5,17 @@
|
||||
- captura: MP4 corto en lugar de GIF; carga diferida al entrar en pantalla;
|
||||
controles visibles; sin autoplay con prefers-reduced-motion.
|
||||
- externo: demostración alojada fuera; solo se carga el iframe al pulsar.
|
||||
Nunca audio automático. Una sola instancia de `fondo` por página. */
|
||||
Nunca audio automático. Una sola instancia de `fondo` por página.
|
||||
En `fondo` el poster es un <img> debajo del video (prioridad alta, versión
|
||||
propia para celular) y, si hay video, un botón permite pausarlo (WCAG 2.2.2). */
|
||||
interface Props {
|
||||
modo: 'fondo' | 'captura' | 'externo';
|
||||
/** Imagen fija que se muestra antes del video o en su lugar. */
|
||||
poster: string;
|
||||
/** Poster para pantallas de menos de 760 px (modo fondo). */
|
||||
posterMovil?: string;
|
||||
/** Modo fondo: ocupa todo el contenedor posicionado y lleva un velo para el texto encima. */
|
||||
cubrir?: boolean;
|
||||
/** Descripción del contenido para lectores de pantalla (vacía si es decorativo). */
|
||||
descripcion: string;
|
||||
mp4?: string;
|
||||
@@ -24,6 +30,8 @@ interface Props {
|
||||
const {
|
||||
modo,
|
||||
poster,
|
||||
posterMovil,
|
||||
cubrir = false,
|
||||
descripcion,
|
||||
mp4,
|
||||
webm,
|
||||
@@ -33,11 +41,46 @@ const {
|
||||
} = Astro.props;
|
||||
const decorativo = descripcion.trim() === '';
|
||||
const hayFuente = Boolean(mp4 || webm);
|
||||
const llenar = modo === 'fondo' && cubrir;
|
||||
---
|
||||
|
||||
<figure class:list={['video', `video--${modo}`]} style={`aspect-ratio:${aspecto}`}>
|
||||
<figure
|
||||
class:list={['video', `video--${modo}`, { 'video--cubrir': llenar }]}
|
||||
style={llenar ? undefined : `aspect-ratio:${aspecto}`}
|
||||
>
|
||||
{
|
||||
modo === 'externo' ? (
|
||||
modo === 'fondo' ? (
|
||||
<>
|
||||
<picture>
|
||||
{posterMovil && <source media="(max-width: 759px)" srcset={posterMovil} />}
|
||||
<img src={poster} alt={descripcion} fetchpriority="high" decoding="async" />
|
||||
</picture>
|
||||
<video
|
||||
data-video="fondo"
|
||||
data-mp4={mp4}
|
||||
data-webm={webm}
|
||||
muted
|
||||
playsinline
|
||||
loop
|
||||
preload="none"
|
||||
disablepictureinpicture
|
||||
aria-hidden="true"
|
||||
tabindex="-1"
|
||||
/>
|
||||
{llenar && <span class="velo" aria-hidden="true" />}
|
||||
{hayFuente && (
|
||||
<button type="button" class="pausa" data-pausa aria-label="Pausar video" hidden>
|
||||
<svg class="icono" data-icono="pausa" viewBox="0 0 10 12" aria-hidden="true" focusable="false">
|
||||
<rect x="0.5" y="0" width="3" height="12" rx="0.8" />
|
||||
<rect x="6.5" y="0" width="3" height="12" rx="0.8" />
|
||||
</svg>
|
||||
<svg class="icono" data-icono="reproducir" viewBox="0 0 10 12" aria-hidden="true" focusable="false" data-oculto>
|
||||
<path d="M1 0.9v10.2a.6.6 0 0 0 .9.5l7.6-5.1a.6.6 0 0 0 0-1L1.9.4a.6.6 0 0 0-.9.5z" />
|
||||
</svg>
|
||||
</button>
|
||||
)}
|
||||
</>
|
||||
) : modo === 'externo' ? (
|
||||
<div class="externo" data-video="externo" data-src={src}>
|
||||
<img src={poster} alt={descripcion} loading="lazy" decoding="async" />
|
||||
<button type="button" class="reproducir" data-reproducir>
|
||||
@@ -88,6 +131,73 @@ const hayFuente = Boolean(mp4 || webm);
|
||||
border: 0;
|
||||
background: var(--bg-2);
|
||||
}
|
||||
.video--fondo img,
|
||||
.video--fondo video {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
}
|
||||
.video--fondo video {
|
||||
background: transparent;
|
||||
}
|
||||
/* Ocupa todo el contenedor (que debe estar posicionado). Sin z-index propio:
|
||||
el texto de la página va encima con position: relative y el botón de pausa,
|
||||
encima del texto. */
|
||||
.video--cubrir {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
border: 0;
|
||||
background: var(--video-velo);
|
||||
}
|
||||
.velo {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: color-mix(in srgb, var(--video-velo) 72%, transparent);
|
||||
}
|
||||
@media (min-width: 1100px) {
|
||||
/* El texto ocupa como máximo el 60 % izquierdo: el velo se aclara a la derecha. */
|
||||
.velo {
|
||||
background: linear-gradient(
|
||||
90deg,
|
||||
color-mix(in srgb, var(--video-velo) 72%, transparent) 60%,
|
||||
color-mix(in srgb, var(--video-velo) 40%, transparent)
|
||||
);
|
||||
}
|
||||
}
|
||||
/* Botón de pausa: solo el símbolo, sin fondo ni borde; se aviva al señalarlo.
|
||||
La sombra lo separa de los cuadros claros. 32 px de área táctil
|
||||
(WCAG 2.5.8 pide al menos 24). */
|
||||
.pausa {
|
||||
position: absolute;
|
||||
right: var(--gutter-r);
|
||||
bottom: 1rem;
|
||||
z-index: 2;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
padding: 0;
|
||||
color: var(--sobre-video);
|
||||
background: none;
|
||||
border: 0;
|
||||
border-radius: 4px;
|
||||
filter: drop-shadow(0 1px 2px var(--video-velo));
|
||||
opacity: 0.7;
|
||||
cursor: pointer;
|
||||
transition: opacity 0.2s;
|
||||
}
|
||||
.pausa:hover,
|
||||
.pausa:focus-visible {
|
||||
opacity: 1;
|
||||
}
|
||||
.icono {
|
||||
width: 10px;
|
||||
height: 12px;
|
||||
fill: currentColor;
|
||||
}
|
||||
.pausa[hidden],
|
||||
.icono[data-oculto] {
|
||||
display: none;
|
||||
}
|
||||
.externo {
|
||||
position: relative;
|
||||
height: 100%;
|
||||
@@ -150,7 +260,8 @@ const hayFuente = Boolean(mp4 || webm);
|
||||
const video = e.target as HTMLVideoElement;
|
||||
if (e.isIntersecting) {
|
||||
if (!montarFuentes(video)) continue;
|
||||
if (!reduceMovimiento) video.play().catch(() => {});
|
||||
video.parentElement?.querySelector<HTMLButtonElement>('[data-pausa]')?.removeAttribute('hidden');
|
||||
if (!reduceMovimiento && video.dataset.pausado !== '1') video.play().catch(() => {});
|
||||
} else if (!video.paused) {
|
||||
video.pause();
|
||||
}
|
||||
@@ -164,6 +275,20 @@ const hayFuente = Boolean(mp4 || webm);
|
||||
if (esCelular || ahorroDatos || reduceMovimiento) continue;
|
||||
observador.observe(video);
|
||||
}
|
||||
// Botón de pausa del fondo: la decisión del visitante se respeta al volver a la pantalla.
|
||||
for (const boton of document.querySelectorAll<HTMLButtonElement>('[data-pausa]')) {
|
||||
const video = boton.parentElement?.querySelector('video');
|
||||
boton.addEventListener('click', () => {
|
||||
if (!video) return;
|
||||
const pausar = !video.paused;
|
||||
video.dataset.pausado = pausar ? '1' : '';
|
||||
if (pausar) video.pause();
|
||||
else video.play().catch(() => {});
|
||||
boton.setAttribute('aria-label', pausar ? 'Reproducir video' : 'Pausar video');
|
||||
boton.querySelector('[data-icono="pausa"]')?.toggleAttribute('data-oculto', pausar);
|
||||
boton.querySelector('[data-icono="reproducir"]')?.toggleAttribute('data-oculto', !pausar);
|
||||
});
|
||||
}
|
||||
for (const video of document.querySelectorAll<HTMLVideoElement>('video[data-video="captura"]')) {
|
||||
if (ahorroDatos) continue;
|
||||
observador.observe(video);
|
||||
|
||||
Reference in new issue
Block a user