/* ==========================================================================
   Aldahir Labs — Design System v1.1
   Dark Minimalist Tech · Electric Blue · Space Grotesk + Inter + JetBrains Mono
   ========================================================================== */

:root {
  /* Paleta Obsidian */
  --obsidian: #0b0b0d;
  --graphite: #151519;
  --elevated: #222228;
  --white: #f5f5f5;
  --silver: #a1a1aa;
  --muted: #8b8b96;

  /* Acento */
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.12);
  --accent-line: rgba(56, 189, 248, 0.35);

  /* Líneas */
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);

  /* Superficies y efectos que cambian con el tema */
  --nav-bg: rgba(11, 11, 13, 0.78);
  --hover: rgba(255, 255, 255, 0.06);
  --chip-bg: rgba(255, 255, 255, 0.02);
  --scroll-thumb-hover: #33333b;
  --logo-filter: none;
  --glint: #fff;
  --glint-glow: rgba(255, 255, 255, 0.8);
  --net-line: 161, 161, 170;
  --net-hot: 56, 189, 248;

  /* Tipografía */
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* Layout */
  --max: 1200px;
  --gutter: clamp(16px, 4vw, 32px);
  --radius: 14px;
  --radius-sm: 10px;
  --section-y: clamp(88px, 11vw, 144px);

  /* Movimiento */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --t: 240ms;
}

/* Modo claro: la misma identidad sobre fondo claro. El acento se oscurece
   para cumplir contraste AA sobre blanco. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --obsidian: #f7f7f8;
    --graphite: #ffffff;
    --elevated: #ececef;
    --white: #111114;
    --silver: #52525b;
    --muted: #6b6b76;
    --accent: #0272b0;
    --accent-soft: rgba(2, 114, 176, 0.1);
    --accent-line: rgba(2, 114, 176, 0.35);
    --line: rgba(17, 17, 20, 0.09);
    --line-strong: rgba(17, 17, 20, 0.16);
    --nav-bg: rgba(247, 247, 248, 0.82);
    --hover: rgba(17, 17, 20, 0.05);
    --chip-bg: rgba(17, 17, 20, 0.02);
    --scroll-thumb-hover: #c9c9cf;
    --logo-filter: invert(1) brightness(0.85);
    --glint: #0272b0;
    --glint-glow: rgba(2, 114, 176, 0.45);
    --net-line: 82, 82, 91;
    --net-hot: 2, 114, 176;
  }
}
:root[data-theme="light"] {
  --obsidian: #f7f7f8;
  --graphite: #ffffff;
  --elevated: #ececef;
  --white: #111114;
  --silver: #52525b;
  --muted: #6b6b76;
  --accent: #0272b0;
  --accent-soft: rgba(2, 114, 176, 0.1);
  --accent-line: rgba(2, 114, 176, 0.35);
  --line: rgba(17, 17, 20, 0.09);
  --line-strong: rgba(17, 17, 20, 0.16);
  --nav-bg: rgba(247, 247, 248, 0.82);
  --hover: rgba(17, 17, 20, 0.05);
  --chip-bg: rgba(17, 17, 20, 0.02);
  --scroll-thumb-hover: #c9c9cf;
  --logo-filter: invert(1) brightness(0.85);
  --glint: #0272b0;
  --glint-glow: rgba(2, 114, 176, 0.45);
  --net-line: 82, 82, 91;
  --net-hot: 2, 114, 176;
}
:root { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }
@media (prefers-color-scheme: light) { :root:not([data-theme]) { color-scheme: light; } }

/* ---------- Reset y superficies del navegador ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--elevated) var(--obsidian);
  scrollbar-width: thin;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--obsidian); }
::-webkit-scrollbar-thumb { background: var(--elevated); border-radius: 10px; border: 2px solid var(--obsidian); }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); }

body {
  margin: 0;
  background: var(--obsidian);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  caret-color: var(--accent);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; text-underline-offset: 0.22em; text-decoration-thickness: 1px; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

::selection { background: var(--accent); color: var(--obsidian); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--obsidian);
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: top var(--t) var(--ease);
}
.skip-link:focus { top: 16px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: calc(var(--max) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--section-y); position: relative; }
.section + .section { border-top: 1px solid var(--line); }

.section-head {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
  align-items: end;
  margin-bottom: clamp(40px, 6vw, 72px);
}
.section-head > h2 { grid-column: span 7; }
.section-head > p { grid-column: 9 / span 4; color: var(--silver); }

.h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.03em;
}
.h2 .dim { color: var(--muted); }

.h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(20px, 2.2vw, 24px);
  line-height: 1.25;
  letter-spacing: -0.015em;
}

/* ---------- Iconos ---------- */
.icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.icon-lg { width: 22px; height: 22px; }

/* ---------- Botones y enlaces ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 48px;
  padding-inline: 22px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 15px;
  white-space: nowrap;
  transition: background var(--t) var(--ease), color var(--t) var(--ease),
    border-color var(--t) var(--ease), transform var(--t) var(--ease);
}
.btn .icon { transition: transform var(--t) var(--ease); }
.btn:hover .icon-arrow { transform: translate(2px, -2px); }
.btn:active { transform: scale(0.98); }
.btn-sm { height: 40px; padding-inline: 18px; font-size: 14px; }

.btn-primary { background: var(--white); color: var(--obsidian); }
.btn-primary:hover { background: var(--accent); }

.btn-ghost { border: 1px solid var(--line-strong); color: var(--white); }
.btn-ghost:hover { border-color: var(--accent-line); background: var(--accent-soft); }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--white);
  font-weight: 500;
  font-size: 15px;
  transition: color var(--t) var(--ease);
}
.link-arrow .icon { width: 16px; height: 16px; transition: transform var(--t) var(--ease); }
.link-arrow:hover { color: var(--accent); }
.link-arrow:hover .icon { transform: translate(2px, -2px); }

/* ---------- Chips y estados ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--chip-bg);
  color: var(--silver);
  white-space: nowrap;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--silver);
  white-space: nowrap;
}
.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.status.is-done::before { background: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.12); }

/* ==========================================================================
   Navbar
   ========================================================================== */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  border-bottom: 1px solid transparent;
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease);
}
.nav.is-scrolled {
  background: var(--nav-bg);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom-color: var(--line);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { height: 34px; width: auto; filter: var(--logo-filter); }

/* Marca: destello metálico sobre el isotipo (enmascarado con su propia forma)
   y la estrella del logo que titila */
.brand-mark { position: relative; display: block; width: 48px; height: 34px; }
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 36%, rgba(56, 189, 248, 0.75) 45%, #fff 50%, rgba(56, 189, 248, 0.75) 55%, transparent 64%) no-repeat;
  background-size: 260% 100%;
  background-position: 130% 0;
  -webkit-mask: url("../brand/isotipo.webp") center / contain no-repeat;
  mask: url("../brand/isotipo.webp") center / contain no-repeat;
  opacity: 0;
  pointer-events: none;
}
.brand-glint {
  position: absolute;
  left: 45.4%;
  top: 58.5%;
  width: 13px;
  height: 13px;
  margin: -6.5px 0 0 -6.5px;
  fill: var(--glint);
  filter: drop-shadow(0 0 3px var(--glint-glow));
  opacity: 0;
  transform: scale(0) rotate(-45deg);
  pointer-events: none;
}
.brand.is-shining .brand-mark::after,
.brand:hover .brand-mark::after,
.brand:focus-visible .brand-mark::after { animation: brand-sheen 1300ms cubic-bezier(0.45, 0, 0.25, 1) both; }
.brand.is-shining .brand-glint,
.brand:hover .brand-glint,
.brand:focus-visible .brand-glint { animation: brand-glint 900ms var(--ease-expo) 560ms both; }
@keyframes brand-sheen {
  0% { background-position: 130% 0; opacity: 0; }
  12%, 85% { opacity: 1; }
  100% { background-position: -30% 0; opacity: 0; }
}
@keyframes brand-glint {
  0% { opacity: 0; transform: scale(0) rotate(-45deg); }
  45% { opacity: 1; transform: scale(1) rotate(0deg); }
  100% { opacity: 0; transform: scale(0.2) rotate(45deg); }
}
.brand-name span { transition: color var(--t) var(--ease); }
.brand:hover .brand-name span { color: var(--silver); }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 18px; letter-spacing: -0.02em; }
.brand-name span { color: var(--muted); font-weight: 500; }

.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
  padding: 8px 14px;
  font-size: 14px;
  color: var(--silver);
  border-radius: 999px;
  transition: color var(--t) var(--ease), background var(--t) var(--ease);
}
.nav-links a:hover { color: var(--white); }
.nav-links a.is-active { color: var(--white); background: var(--hover); }

.nav-actions { display: flex; align-items: center; gap: 10px; }
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--silver);
  transition: color var(--t) var(--ease), border-color var(--t) var(--ease), background var(--t) var(--ease);
}
.theme-toggle:hover { color: var(--white); border-color: var(--line-strong); background: var(--hover); }
.theme-toggle .icon { grid-area: 1 / 1; transition: transform 500ms var(--ease-expo), opacity 300ms var(--ease); }
.theme-toggle .icon-moon { opacity: 0; transform: rotate(-90deg) scale(0.5); }
:root[data-theme="light"] .theme-toggle .icon-sun { opacity: 0; transform: rotate(90deg) scale(0.5); }
:root[data-theme="light"] .theme-toggle .icon-moon { opacity: 1; transform: none; }

/* Cambio de tema con fundido (View Transitions) */
::view-transition-old(root),
::view-transition-new(root) { animation-duration: 450ms; animation-timing-function: var(--ease); }

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.mobile-menu {
  position: fixed;
  inset: 72px 0 0 0;
  z-index: 49;
  background: var(--obsidian);
  padding: 16px var(--gutter) 40px;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease), visibility var(--t);
}
.mobile-menu.is-open { opacity: 1; visibility: visible; transform: none; }
.mobile-menu .m-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.mobile-menu .m-link .icon { color: var(--muted); }
.mobile-menu .btn { margin-top: auto; }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  position: relative;
  padding-top: clamp(124px, 15vh, 168px);
  padding-bottom: clamp(72px, 9vw, 112px);
  overflow: hidden;
}
/* Fondo: red de nodos que se conectan y siguen al cursor (dibujada en main.js) */
.node-net {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1600ms var(--ease);
}
.node-net.is-ready { opacity: 1; }
.hero-net {
  -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent);
  mask-image: linear-gradient(to bottom, #000 70%, transparent);
}
.hero > .container { position: relative; z-index: 1; }

.hero-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(42px, 6.6vw, 88px);
  line-height: 1;
  letter-spacing: -0.04em;
  max-width: 15.5em;
}
.hero-title .dim { color: var(--muted); }
.hero-title .accent { color: var(--accent); }

/* Frase rotativa: lo que construyo. Todas ocupan la misma celda,
   así el titular no salta de línea al cambiar. */
.rotator {
  position: relative;
  display: inline-grid;
  color: var(--white);
  clip-path: inset(-0.15em -0.5em -0.18em -0.5em);
}
/* Temporizador: se llena mientras la frase está visible */
.rotator::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.04em;
  height: max(2px, 0.04em);
  border-radius: 2px;
  background: var(--accent-line);
  transform: scaleX(0);
  transform-origin: left;
  opacity: 0;
}
.rotator.is-timing::after { opacity: 1; animation: rot-timer var(--rot-hold, 2600ms) linear both; }
@keyframes rot-timer { to { transform: scaleX(1); } }
.rot-item { grid-area: 1 / 1; justify-self: start; }
.motion .rotator.is-sized { transition: width 700ms var(--ease-expo); }
.motion .rotator.is-sized .rot-item { white-space: nowrap; }
.rot-item:not(.is-current) { visibility: hidden; }
.motion .rot-item {
  visibility: visible;
  opacity: 0;
  transform: translateY(120%);
  transition: transform 750ms var(--ease-expo), opacity 450ms var(--ease);
}
.motion .rot-item.is-current { opacity: 1; transform: none; }
.motion .rot-item.is-leaving { opacity: 0; transform: translateY(-120%); }

.hero-row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
  margin-top: clamp(48px, 7vw, 88px);
  align-items: start;
}
.hero-intro { grid-column: span 5; }
.hero-lead { font-size: clamp(17px, 1.5vw, 19px); color: var(--silver); max-width: 34em; margin-bottom: 32px; }
.hero-lead strong { color: var(--white); font-weight: 500; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* Índice de proyectos: el trabajo visible desde el primer vistazo */
.work-index { grid-column: 7 / span 6; }
.work-index-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 14px;
  font-size: 14px;
  color: var(--muted);
}
.work-index-head a { color: var(--silver); transition: color var(--t) var(--ease); }
.work-index-head a:hover { color: var(--accent); }

.idx-row {
  display: grid;
  grid-template-columns: 48px 1fr auto 20px;
  gap: 18px;
  align-items: center;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.idx-row:last-child { border-bottom: 1px solid var(--line); }
.idx-row:hover .idx-name { color: var(--accent); }
.idx-name { transition: color var(--t) var(--ease); }
.idx-thumb {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  transition: transform var(--t) var(--ease);
}
.idx-thumb img { width: 100%; height: 100%; object-fit: cover; }
.idx-row:hover .idx-thumb { transform: scale(1.06); }
.idx-mono {
  display: grid;
  place-items: center;
  background: var(--elevated);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.01em;
  color: var(--white);
}
.idx-name { display: block; font-family: var(--font-display); font-weight: 600; font-size: 18px; letter-spacing: -0.015em; line-height: 1.3; }
.idx-desc { display: block; font-size: 14px; color: var(--silver); line-height: 1.45; }
.idx-meta { font-size: 13px; color: var(--muted); text-align: right; white-space: nowrap; }
.idx-row > .icon { color: var(--muted); transition: transform var(--t) var(--ease), color var(--t) var(--ease); }
.idx-row:hover > .icon { color: var(--accent); transform: translate(2px, -2px); }

/* Momento de entrada: un solo gesto, en el hero */
@media (prefers-reduced-motion: no-preference) {
  .hero-title { animation: title-in 1100ms var(--ease-expo) both; }
  .hero-intro { animation: fade-up 900ms var(--ease-expo) 220ms both; }
  .idx-row { animation: fade-up 800ms var(--ease-expo) both; animation-delay: calc(360ms + var(--i, 0) * 70ms); }
  .work-index-head { animation: fade-up 800ms var(--ease-expo) 300ms both; }
}
@keyframes title-in {
  from { clip-path: inset(0 0 100% 0); transform: translateY(28px); }
  to { clip-path: inset(0 0 -10% 0); transform: none; }
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* ==========================================================================
   Proyectos
   ========================================================================== */
.case-list { display: grid; }
.case-row {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
  padding: clamp(28px, 3.5vw, 40px) 0;
  border-top: 1px solid var(--line);
}
.case-row:last-child { border-bottom: 1px solid var(--line); }

.case-visual {
  position: relative;
  aspect-ratio: 2 / 1;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.case-visual > img { transition: scale 700ms var(--ease-expo); }
.case-row:hover .case-visual > img { scale: 1.04; }

/* CarniApp: su propia identidad (hueso, vino, bronce) */
.visual-carni { background: #f2e8d6; border-color: transparent; }
.visual-carni > img { width: 44%; max-width: 360px; }

/* EDI 301: su logo sobre el azul institucional */
.visual-edi-logo { background: #07476f; border-color: transparent; }
.visual-edi-logo > img { width: 44%; max-width: 360px; }

/* Portada con captura real del producto */
.visual-shot { background: var(--elevated); }
.visual-shot > img { width: 100%; height: 100%; object-fit: cover; object-position: top left; }

/* multiApp: el gráfico destacado de la tienda */
.visual-multi { background: #1f1832; }
.visual-multi > img { width: 100%; height: 100%; object-fit: cover; }

/* EDI 301: diagrama de arquitectura */
.visual-edi {
  background:
    radial-gradient(ellipse 80% 70% at 50% 0%, rgba(56, 189, 248, 0.07), transparent 70%),
    var(--obsidian);
  padding: 24px;
}

.platforms {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.platforms span {
  font-size: 12px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--graphite);
  color: var(--silver);
}

.case-body { min-width: 0; }
.case-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.case-kind { font-size: 13px; color: var(--muted); }
.case-title { font-family: var(--font-display); font-weight: 600; font-size: clamp(24px, 2.6vw, 32px); line-height: 1.15; letter-spacing: -0.025em; margin-bottom: 10px; }
.case-title a { transition: color var(--t) var(--ease); }
.case-row:hover .case-title a { color: var(--accent); }
.case-desc { color: var(--silver); max-width: 56ch; margin-bottom: 20px; }

.points { display: grid; gap: 10px; }
.points li { display: flex; gap: 12px; font-size: 15px; color: var(--silver); }
.points li::before {
  content: "";
  flex-shrink: 0;
  width: 5px;
  height: 5px;
  margin-top: 10px;
  border-radius: 50%;
  background: var(--accent);
}
.points strong { color: var(--white); font-weight: 500; }

.case-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.case-foot .chips { flex: 1; }

/* Diagrama de arquitectura */
.arch { display: flex; align-items: center; width: 100%; max-width: 480px; }
.arch-node {
  flex: 1;
  text-align: center;
  padding: 18px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--graphite);
}
.arch-node .icon { margin: 0 auto 10px; color: var(--accent); width: 22px; height: 22px; }
.arch-node b { display: block; font-family: var(--font-display); font-weight: 600; font-size: 14px; }
.arch-node small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.arch-link { position: relative; flex: 0 0 36px; height: 1px; background: var(--accent-line); }
.arch-link::after {
  content: "";
  position: absolute;
  top: -2px;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
}
/* Flujo de datos solo al interactuar: nada de animaciones constantes */
.case-row:hover .arch-link::after, .case-figure:hover .arch-link::after { animation: packet 1.6s var(--ease) infinite; }
@keyframes packet {
  0% { left: 0; opacity: 0; }
  20%, 80% { opacity: 1; }
  100% { left: calc(100% - 5px); opacity: 0; }
}

/* Otros proyectos: filas compactas */
.more { margin-top: clamp(56px, 7vw, 88px); }
.more-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 20px; }
.more-head p { font-size: 14px; color: var(--muted); }
.more-row {
  display: grid;
  grid-template-columns: 3fr 5fr 3fr 1fr;
  gap: 24px;
  align-items: baseline;
  padding: 22px 0;
  border-top: 1px solid var(--line);
}
.more-row:last-child { border-bottom: 1px solid var(--line); }
.more-row .h3 { font-size: 22px; }
.more-row p { color: var(--silver); font-size: 15px; }
.more-row .year { font-size: 13px; color: var(--muted); text-align: right; }

/* ==========================================================================
   Servicios: cada oferta respaldada por un proyecto
   ========================================================================== */
.offer-row {
  display: grid;
  grid-template-columns: 4fr 5fr 3fr;
  gap: 24px;
  align-items: baseline;
  padding: 30px 0;
  border-top: 1px solid var(--line);
}
.offer-row:last-child { border-bottom: 1px solid var(--line); }
.offer-row .h3 { font-size: clamp(22px, 2.4vw, 28px); letter-spacing: -0.02em; }
.offer-row > p { color: var(--silver); }
.proof { font-size: 14px; color: var(--muted); }
.proof a { color: var(--white); text-decoration: underline; text-decoration-color: var(--line-strong); transition: color var(--t) var(--ease), text-decoration-color var(--t) var(--ease); }
.proof a:hover { color: var(--accent); text-decoration-color: var(--accent-line); }

/* ==========================================================================
   Tecnologías
   ========================================================================== */
.stack-row {
  display: grid;
  grid-template-columns: 3fr 9fr;
  gap: 24px;
  padding: 24px 0;
  border-top: 1px solid var(--line);
}
.stack-row:last-of-type { border-bottom: 1px solid var(--line); }
.stack-row h3 { font-family: var(--font-display); font-weight: 500; font-size: 22px; color: var(--silver); letter-spacing: -0.01em; }
.stack-items { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 28px; }
.stack-items li { display: inline-flex; align-items: center; gap: 10px; font-size: 17px; line-height: 1.5; color: var(--muted); }
.stack-items li.core { color: var(--white); }
.stack-items li.core::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: var(--accent); }
.stack-note { margin-top: 18px; font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.stack-note i { width: 6px; height: 6px; border-radius: 2px; background: var(--accent); }

/* ==========================================================================
   Trayectoria
   ========================================================================== */
.tl-item {
  display: grid;
  grid-template-columns: 2fr 6fr 4fr;
  gap: 24px;
  padding: 36px 0;
  border-top: 1px solid var(--line);
}
.tl-item:last-child { border-bottom: 1px solid var(--line); }
.tl-date { font-family: var(--font-mono); font-size: 13px; color: var(--accent); padding-top: 5px; }
.tl-org { display: block; font-size: 14px; color: var(--muted); margin-top: 6px; }
.tl-main p { color: var(--silver); margin-top: 14px; max-width: 60ch; }
.tl-main ul { display: grid; gap: 8px; margin-top: 14px; }
.tl-main li { display: flex; gap: 12px; color: var(--silver); font-size: 15px; }
.tl-main li::before { content: ""; flex-shrink: 0; width: 10px; height: 1px; margin-top: 12px; background: var(--muted); }
.tl-side { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.tl-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--silver);
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.tl-tag .icon { width: 15px; height: 15px; color: var(--accent); }

/* ==========================================================================
   Sobre mí
   ========================================================================== */
.about { display: grid; grid-template-columns: repeat(12, 1fr); gap: 24px; }
.about-copy { grid-column: 1 / span 7; grid-row: 1 / span 2; }
.about-copy .h2 { margin-bottom: 32px; }
.about-copy p { color: var(--silver); font-size: 17px; margin-bottom: 18px; max-width: 62ch; }
.about-copy p strong { color: var(--white); font-weight: 500; }
.about-side { grid-column: 9 / span 4; grid-row: 2; display: grid; gap: 0; align-content: start; }

/* Foto: acompaña la historia, no compite con los proyectos del hero */
.about-photo {
  grid-column: 9 / span 4;
  grid-row: 1;
  margin-bottom: 8px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--elevated);
  aspect-ratio: 4 / 5;
}
.about-photo img { width: 100%; height: 100%; object-fit: cover; transition: scale 900ms var(--ease-expo); }
.about-photo:hover img { scale: 1.03; }
.fact { padding: 20px 0; border-top: 1px solid var(--line); }
.fact:last-child { border-bottom: 1px solid var(--line); }
.fact-label { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.fact-label .icon { width: 15px; height: 15px; color: var(--accent); }
.fact-value { font-size: 16px; color: var(--white); }
.fact-value small { display: block; color: var(--silver); font-size: 14px; }
.lang { display: flex; justify-content: space-between; align-items: center; font-size: 16px; padding: 2px 0; }
.lang span:last-child { font-size: 14px; color: var(--silver); }

.principle {
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  max-width: 62ch;
}
.principle p { margin: 0 !important; color: var(--white) !important; font-family: var(--font-display); font-size: clamp(24px, 3vw, 34px) !important; letter-spacing: -0.02em; line-height: 1.3; }
.principle p::before { content: "“"; color: var(--accent); margin-right: 2px; }
.principle p::after { content: "”"; color: var(--accent); margin-left: 2px; }

/* ==========================================================================
   Contacto
   ========================================================================== */
.contact-card {
  position: relative;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  padding: clamp(32px, 6vw, 80px);
  background:
    radial-gradient(ellipse 60% 80% at 100% 0%, rgba(56, 189, 248, 0.09), transparent 60%),
    var(--graphite);
  overflow: hidden;
}
.contact-card::after {
  content: "";
  position: absolute;
  right: -40px;
  bottom: -60px;
  width: 340px;
  height: 260px;
  background: url("../brand/isotipo.webp") no-repeat center / contain;
  opacity: 0.05;
  filter: var(--logo-filter);
  pointer-events: none;
}
.contact-grid { position: relative; z-index: 1; display: grid; grid-template-columns: 7fr 5fr; gap: 48px; align-items: end; }
.contact-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(40px, 6.4vw, 80px);
  line-height: 1;
  letter-spacing: -0.04em;
  margin-bottom: 24px;
}
.contact-title .dim { color: var(--muted); }
.contact-lead { color: var(--silver); font-size: 18px; max-width: 30em; margin-bottom: 36px; }
.contact-link {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 4px;
  border-top: 1px solid var(--line);
  transition: color var(--t) var(--ease), padding var(--t) var(--ease);
}
.contact-link:last-child { border-bottom: 1px solid var(--line); }
.contact-link .icon { color: var(--muted); transition: color var(--t) var(--ease), transform var(--t) var(--ease); }
.contact-link .cl-text { flex: 1; min-width: 0; }
.contact-link .cl-label { display: block; font-size: 13px; color: var(--muted); }
.contact-link .cl-value { display: block; font-size: 16px; overflow: hidden; text-overflow: ellipsis; }
.contact-link:hover { color: var(--accent); padding-left: 10px; }
.contact-link:hover .icon { color: var(--accent); }
.contact-link:hover .icon-arrow { transform: translate(2px, -2px); }

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding-inline: 18px;
  font-size: 14px;
  color: var(--silver);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: color var(--t) var(--ease), border-color var(--t) var(--ease);
}
.copy-btn:hover { color: var(--white); border-color: var(--line-strong); }
.copy-btn.is-copied { color: var(--accent); border-color: var(--accent-line); }
.copy-btn .icon { width: 15px; height: 15px; }

/* ==========================================================================
   Footer
   ========================================================================== */
.footer { padding: 56px 0 40px; border-top: 1px solid var(--line); }
.footer-top { display: flex; justify-content: space-between; align-items: center; gap: 32px; flex-wrap: wrap; }
.footer-top img { height: 48px; width: auto; filter: var(--logo-filter); }
.footer-nav { display: flex; flex-wrap: wrap; gap: 4px 24px; }
.footer-nav a { font-size: 14px; color: var(--silver); transition: color var(--t) var(--ease); }
.footer-nav a:hover { color: var(--white); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}
.footer-slim .footer-bottom { margin-top: 0; padding-top: 0; border-top: 0; }

/* ==========================================================================
   Páginas de caso de estudio
   ========================================================================== */
.cs-hero { padding: 132px 0 64px; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); margin-bottom: 40px; }
.crumbs a { color: var(--silver); display: inline-flex; align-items: center; gap: 8px; transition: color var(--t) var(--ease); }
.crumbs a:hover { color: var(--accent); }
.crumbs .icon { width: 16px; height: 16px; }
.cs-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(38px, 6vw, 76px);
  line-height: 1.02;
  letter-spacing: -0.04em;
  max-width: 14em;
  margin-bottom: 24px;
}
.cs-lead { font-size: clamp(17px, 1.6vw, 20px); color: var(--silver); max-width: 40em; }
.cs-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 32px; }
.cs-actions-note { font-size: 14px; color: var(--muted); max-width: 34em; }
.cs-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.cs-meta dt { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.cs-meta dd { font-size: 15px; }

.case-figure { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.case-figure .case-visual { border: 0; border-radius: 0; aspect-ratio: 21 / 9; }
.case-figure .visual-carni,
.case-figure .visual-edi-logo { aspect-ratio: 21 / 8; }
.case-figure .visual-carni > img,
.case-figure .visual-edi-logo > img { width: min(40%, 340px); }
.case-figure .visual-shot { aspect-ratio: 1600 / 1005; }
.case-figure .visual-multi { aspect-ratio: 1024 / 500; }

.cs-body { display: grid; grid-template-columns: 3fr 9fr; gap: 48px; }
.cs-body > * { min-width: 0; }
.cs-toc { position: sticky; top: 104px; align-self: start; display: grid; gap: 2px; }
.cs-toc a {
  font-size: 14px;
  color: var(--muted);
  padding: 8px 0 8px 14px;
  border-left: 1px solid var(--line);
  transition: color var(--t) var(--ease), border-color var(--t) var(--ease);
}
.cs-toc a:hover, .cs-toc a.is-active { color: var(--white); border-left-color: var(--accent); }

.cs-section { padding-bottom: 56px; margin-bottom: 56px; border-bottom: 1px solid var(--line); }
.cs-section:last-of-type { border-bottom: 0; margin-bottom: 0; }
.cs-section h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(26px, 3vw, 34px);
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin-bottom: 18px;
}
.cs-section h2 .dim { color: var(--muted); }
.cs-section > p { color: var(--silver); font-size: 17px; max-width: 62ch; }
.cs-section > p + p { margin-top: 16px; }
.cs-section .points { margin-top: 20px; }
.cs-section > p.follow { margin-top: 24px; }
.cs-chips { margin-top: 24px; }
.arch-figure { margin-top: 8px; }
.arch-figure .case-visual { aspect-ratio: auto; padding: 40px 24px; }
.cs-section .points li { font-size: 16px; }
.cs-section code, .data-table code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  color: var(--white);
  background: var(--elevated);
  padding: 2px 6px;
  border-radius: 5px;
}

/* Capas de Clean Architecture */
.layers { display: grid; gap: 8px; margin-top: 24px; max-width: 720px; }
.layer {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  align-items: baseline;
  padding: 16px 20px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--graphite);
}
.layer:nth-child(1) { margin-inline: 0; }
.layer:nth-child(2) { margin-inline: 4%; }
.layer:nth-child(3) { margin-inline: 8%; }
.layer:nth-child(4) { margin-inline: 12%; border-color: var(--accent-line); }
.layer b { font-family: var(--font-mono); font-weight: 500; font-size: 13px; color: var(--white); }
.layer span { font-size: 15px; color: var(--silver); }
.layers-note { margin-top: 12px; font-size: 14px; color: var(--muted); }

/* Tablas de datos (módulos, endpoints, hardware) */
.table-wrap { margin-top: 24px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.data-table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 560px; }
.data-table th, .data-table td { text-align: left; padding: 14px 18px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table th { font-weight: 500; font-size: 13px; color: var(--muted); background: var(--graphite); }
.data-table td { color: var(--silver); }
.data-table td:first-child { color: var(--white); font-weight: 500; white-space: nowrap; }

/* Lista de capacidades en dos columnas */
.feature-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; margin-top: 24px; }
.feature-list li { padding: 16px 0; border-top: 1px solid var(--line); }
.feature-list b { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 16px; color: var(--white); margin-bottom: 4px; }
.feature-list b .icon { width: 16px; height: 16px; color: var(--accent); }
.feature-list span { display: block; font-size: 15px; color: var(--silver); }

.shots { display: grid; gap: 24px 20px; margin-top: 24px; }
.shots-desktop { grid-template-columns: 1fr 1fr; }
.shots-desktop .shot:first-child { grid-column: 1 / -1; }
.shots-phone { grid-template-columns: repeat(4, 1fr); }
.shots-phone.shots-3 { grid-template-columns: repeat(3, 1fr); max-width: 760px; }
.shot a {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--elevated);
  transition: border-color var(--t) var(--ease);
}
.shots-phone .shot a { border-radius: 22px; }
.shot a:hover { border-color: var(--accent-line); }
.shot img { width: 100%; height: auto; transition: scale 700ms var(--ease-expo); }
.shot a:hover img { scale: 1.02; }
.shot figcaption { margin-top: 10px; font-size: 14px; line-height: 1.45; color: var(--muted); }

.pub-list { display: grid; gap: 0; margin-top: 24px; }
.pub { display: flex; gap: 16px; padding: 18px 0; border-top: 1px solid var(--line); }
.pub:last-child { border-bottom: 1px solid var(--line); }
.pub .icon { color: var(--accent); margin-top: 3px; }
.pub b { display: block; font-weight: 500; font-size: 15px; }
.pub span { display: block; font-size: 14px; color: var(--silver); margin-top: 4px; }

.note {
  margin-top: 20px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--silver);
  max-width: 62ch;
}

.next-case {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
  margin-top: 56px;
  padding: 28px 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--graphite);
  transition: border-color var(--t) var(--ease);
}
.next-case:hover { border-color: var(--line-strong); }
.next-case small { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.next-case b { font-family: var(--font-display); font-weight: 600; font-size: clamp(22px, 2.4vw, 28px); letter-spacing: -0.02em; }
.next-case .icon { width: 24px; height: 24px; color: var(--muted); transition: transform var(--t) var(--ease), color var(--t) var(--ease); }
.next-case:hover .icon { color: var(--accent); transform: translateX(4px); }

/* ==========================================================================
   404
   ========================================================================== */
.notfound {
  min-height: 100svh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 120px var(--gutter) 60px;
}
.notfound img { width: 120px; margin: 0 auto 32px; opacity: 0.9; filter: var(--logo-filter); }
.notfound .code-404 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(96px, 20vw, 200px);
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--white);
}
.notfound .code-404 span { color: var(--accent); }
.notfound p { color: var(--silver); font-size: 18px; margin: 20px auto 36px; max-width: 26em; }
.notfound .mono { display: block; font-family: var(--font-mono); color: var(--muted); font-size: 13px; margin-bottom: 8px; }

/* ==========================================================================
   Movimiento al leer
   Solo con JS (html.motion) y sin "reducir movimiento": sin script,
   todo el contenido queda visible desde el principio.
   ========================================================================== */

/* Títulos: suben desde una máscara */
.motion [data-reveal="title"] {
  clip-path: inset(0 0 100% 0);
  transform: translateY(0.35em);
  transition: clip-path 900ms var(--ease-expo), transform 900ms var(--ease-expo);
}
.motion [data-reveal="title"].in { clip-path: inset(-10% -5% -20% -5%); transform: none; }

/* Texto de apoyo */
.motion [data-reveal="fade"] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 800ms var(--ease-expo) var(--d, 0ms), transform 800ms var(--ease-expo) var(--d, 0ms);
}
.motion [data-reveal="fade"].in { opacity: 1; transform: none; }

/* Proyectos: la imagen se enciende como una pantalla y el texto la sigue */
.motion [data-reveal="case"] .case-visual {
  clip-path: inset(10% 14% 10% 14% round 14px);
  opacity: 0;
  transition: clip-path 1100ms var(--ease-expo), opacity 500ms var(--ease-expo);
}
.motion [data-reveal="case"] .case-visual > img { transform: scale(1.12); transition: transform 1300ms var(--ease-expo), scale 700ms var(--ease-expo); }
.motion [data-reveal="case"].in .case-visual { clip-path: inset(0 0 0 0 round 14px); opacity: 1; }
.motion [data-reveal="case"].in .case-visual > img { transform: none; }
.motion [data-reveal="case"] .case-body > * {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 700ms var(--ease-expo), transform 700ms var(--ease-expo);
}
.motion [data-reveal="case"].in .case-body > * { opacity: 1; transform: none; }
.motion [data-reveal="case"].in .case-body > :nth-child(1) { transition-delay: 200ms; }
.motion [data-reveal="case"].in .case-body > :nth-child(2) { transition-delay: 270ms; }
.motion [data-reveal="case"].in .case-body > :nth-child(3) { transition-delay: 340ms; }
.motion [data-reveal="case"].in .case-body > :nth-child(4) { transition-delay: 410ms; }

/* El diagrama envía datos una vez al aparecer */
.motion .in .arch-link::after { animation: packet 1.4s var(--ease) 700ms 2; }
.case-row:hover .arch-link::after, .case-figure:hover .arch-link::after { animation: packet 1.6s var(--ease) infinite; }

/* Filas de servicios y proyectos: primero se dibuja la línea */
.motion [data-reveal="line"] { position: relative; border-top-color: transparent; }
.motion [data-reveal="line"]::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--line-strong);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1000ms var(--ease-expo), background 1200ms var(--ease);
}
.motion [data-reveal="line"].in::before { transform: scaleX(1); background: var(--line); }
.motion [data-reveal="line"] > * {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 700ms var(--ease-expo), transform 700ms var(--ease-expo);
}
.motion [data-reveal="line"].in > * { opacity: 1; transform: none; }
.motion [data-reveal="line"].in > :nth-child(1) { transition-delay: 150ms; }
.motion [data-reveal="line"].in > :nth-child(2) { transition-delay: 230ms; }
.motion [data-reveal="line"].in > :nth-child(3) { transition-delay: 310ms; }
.motion [data-reveal="line"].in > :nth-child(4) { transition-delay: 390ms; }

/* Listas: los elementos entran en cascada */
.motion [data-reveal="list"] > * {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 650ms var(--ease-expo), transform 650ms var(--ease-expo);
  transition-delay: calc(min(var(--i, 0), 8) * 60ms);
}
.motion [data-reveal="list"].in > * { opacity: 1; transform: none; }

/* Stack: la categoría y luego cada tecnología */
.motion [data-reveal="stack"] h3,
.motion [data-reveal="stack"] li {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 600ms var(--ease-expo), transform 600ms var(--ease-expo);
  transition-delay: calc(var(--i, 0) * 45ms + 80ms);
}
.motion [data-reveal="stack"] h3 { transition-delay: 0ms; }
.motion [data-reveal="stack"].in h3,
.motion [data-reveal="stack"].in li { opacity: 1; transform: none; }
.motion [data-reveal="stack"] li.core::before { transform: scale(0); transition: transform 500ms var(--ease-expo); transition-delay: calc(var(--i, 0) * 45ms + 300ms); }
.motion [data-reveal="stack"].in li.core::before { transform: scale(1); }

/* Capas de la arquitectura: se arman de afuera hacia adentro */
.motion [data-reveal="layers"] .layer {
  opacity: 0;
  transform: translateX(-24px);
  transition: opacity 700ms var(--ease-expo), transform 700ms var(--ease-expo);
  transition-delay: calc(var(--i, 0) * 120ms);
}
.motion [data-reveal="layers"].in .layer { opacity: 1; transform: none; }

/* Figura principal de los casos de estudio */
.motion [data-reveal="figure"] {
  clip-path: inset(6% 8% 6% 8% round 14px);
  opacity: 0;
  transition: clip-path 1200ms var(--ease-expo), opacity 600ms var(--ease-expo);
}
.motion [data-reveal="figure"].in { clip-path: inset(0 round 14px); opacity: 1; }

/* Trayectoria: la línea avanza con la lectura */
.timeline { position: relative; padding-left: 36px; }
.timeline::before,
.timeline::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line-strong);
}
.timeline::after { background: var(--accent); transform-origin: top; transform: scaleY(var(--p, 1)); }
.tl-item { position: relative; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -36px;
  top: 40px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--obsidian);
  transition: background 400ms var(--ease), transform 500ms var(--ease-expo);
}
.motion .tl-item::before { background: var(--elevated); transform: scale(0.7); }
.motion .tl-item.is-reached::before { background: var(--accent); transform: none; }
.motion .tl-item .tl-date { color: var(--muted); transition: color 400ms var(--ease); }
.motion .tl-item.is-reached .tl-date { color: var(--accent); }

/* Frase de Sobre mí: se ilumina palabra por palabra al leerla */
.motion .principle .w { color: color-mix(in srgb, var(--white) 22%, transparent); transition: color 350ms var(--ease); }
.motion .principle .w.lit { color: var(--white); }

/* Barra de progreso de lectura (casos de estudio) */
.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  height: 2px;
  background: var(--accent);
  transform: scaleX(var(--read, 0));
  transform-origin: left;
  pointer-events: none;
}

/* Entrada del encabezado de los casos de estudio */
@media (prefers-reduced-motion: no-preference) {
  .cs-title { animation: title-in 1100ms var(--ease-expo) both; }
  .cs-lead { animation: fade-up 900ms var(--ease-expo) 200ms both; }
  .cs-actions { animation: fade-up 900ms var(--ease-expo) 260ms both; }
  .cs-meta { animation: fade-up 900ms var(--ease-expo) 320ms both; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1080px) {
  .hero-intro { grid-column: span 12; }
  .work-index { grid-column: span 12; margin-top: 16px; }
  .hero-intro .hero-lead { max-width: 40em; }
  .offer-row { grid-template-columns: 1fr 2fr; }
  .offer-row .proof { grid-column: 2; }
}

@media (max-width: 900px) {
  .nav-links, .nav-cta { display: none; }
  .nav-toggle { display: inline-flex; }

  .section-head > h2, .section-head > p { grid-column: span 12; }

  .case-row { grid-template-columns: 1fr; gap: 20px; }

  .more-row { grid-template-columns: 1fr auto; gap: 8px 16px; }
  .more-row p, .more-row .chips { grid-column: 1 / -1; }
  .more-row .year { grid-row: 1; grid-column: 2; }

  .offer-row { grid-template-columns: 1fr; gap: 8px; }
  .offer-row .proof { grid-column: 1; }

  .stack-row { grid-template-columns: 1fr; gap: 12px; }

  .tl-item { grid-template-columns: 1fr; gap: 12px; }
  .tl-side { flex-direction: row; flex-wrap: wrap; }

  /* La foto flota a la derecha y el texto la rodea */
  .about { display: block; }
  /* Se reduce de forma continua con la pantalla: empata con el ancho de la columna
     de escritorio (~264px a 900px) y baja hasta 128px en celular */
  .about-photo { float: right; width: clamp(128px, 34vw, 264px); margin: 6px 0 16px clamp(16px, 4vw, 28px); }
  .about-side { clear: both; padding-top: 24px; }

  .contact-grid { grid-template-columns: 1fr; gap: 40px; }

  .cs-body { grid-template-columns: 1fr; }
  .cs-toc { display: none; }
  .cs-meta { grid-template-columns: repeat(2, 1fr); }
  .feature-list { grid-template-columns: 1fr; }
  .layer { grid-template-columns: 1fr; gap: 4px; }
  .layer:nth-child(n) { margin-inline: 0; }
}

@media (max-width: 560px) {
  body { font-size: 15px; }
  .brand-name { display: none; }
  .hero { padding-top: 112px; }
  .hero-actions .btn { flex: 1 1 auto; }
  .idx-row { grid-template-columns: 44px 1fr 18px; gap: 14px; }
  .idx-thumb { width: 44px; height: 44px; }
  .idx-meta { display: none; }

  .case-visual { aspect-ratio: 16 / 10; }
  .case-foot { flex-direction: column; align-items: flex-start; }
  .timeline { padding-left: 26px; }
  .tl-item::before { left: -26px; }
  .case-figure .visual-carni { aspect-ratio: 4 / 3; }
  .case-figure .visual-carni > img { width: 56%; }
  .visual-edi { padding: 20px 12px; }
  .case-figure .visual-edi { padding-bottom: 56px; }
  .arch-node { padding: 14px 6px; }
  .arch-node b { font-size: 12px; }
  .arch-node small { font-size: 11px; }
  .arch-link { flex-basis: 16px; }

  .contact-card { border-radius: 16px; }
  .footer-top { flex-direction: column; align-items: flex-start; }

  .shots-desktop { grid-template-columns: 1fr; }
  .shots-phone, .shots-phone.shots-3 { grid-template-columns: repeat(2, 1fr); }
  .next-case { padding: 22px; }
}

/* ==========================================================================
   Impresión — versión clara del logotipo
   ========================================================================== */
@media print {
  :root { --obsidian: #fff; --graphite: #fff; --white: #111; --silver: #333; --muted: #666; --line: #ddd; --line-strong: #ccc; --elevated: #eee; --accent: #0369a1; }
  .btn-primary { background: #111; color: #fff; }
  .nav, .mobile-menu { display: none !important; }
  img[src*="brand/"] { filter: invert(1) grayscale(1); }
}
