/* ═══════════════════════════════════════════════════════════════════════════
   Capa de diseño del portfolio (se aplica encima de styles.css).
   Papel cálido + tinta, un acento cobalto y un coral reservado para pequeños
   gestos (subrayado del titular, viñetas, progreso). Titulares en Bricolage
   Grotesque, texto en Manrope.
   Tema claro por defecto. El oscuro solo existe bajo [data-theme="dark"], que
   fija js/theme.js cuando la visita lo elige: ya no se sigue al sistema.
   Capas: navegación 20, skip link 30, progreso 40.
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --surface: #fffdf9;
  --surface-soft: #eeebe4;
  --ink: #16151a;
  --ink-soft: #46444d;
  --muted: #6b6873;
  --line: #e2ded4;
  --accent: #3d3df2;
  --accent-dark: #2b2bc4;
  --accent-soft: color-mix(in oklch, var(--accent) 9%, transparent);
  --on-accent: #ffffff;
  --coral: #f2603a;
  /* Fondos que siempre son oscuros (código, diagramas SVG claros sobre oscuro)
     y el bloque de contacto, que mantiene el cobalto en ambos temas. */
  --code-bg: #17161c;
  --cta-bg: #3d3df2;
  --shadow: 0 1px 2px rgb(22 21 26 / .04), 0 14px 34px -20px rgb(22 21 26 / .22);
  --dot: rgb(22 21 26 / .14);
  --display: 'Bricolage Grotesque', 'Manrope', system-ui, sans-serif;
  --sans: 'Manrope', system-ui, sans-serif;
  --shell: 1160px;
  --gutter: clamp(20px, 4vw, 56px);
  --radius: 14px;
  --radius-lg: 22px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121116;
  --surface: #1a1920;
  --surface-soft: #232129;
  --ink: #f3f1ec;
  --ink-soft: #c4c1ca;
  --muted: #9b98a4;
  --line: #2e2c35;
  --accent: #8f8fff;
  --accent-dark: #b3b3ff;
  --accent-soft: color-mix(in oklch, var(--accent) 14%, transparent);
  --on-accent: #121116;
  --coral: #ff8661;
  --code-bg: #0c0b10;
  --cta-bg: #3434d6;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 18px 40px -22px rgb(0 0 0 / .7);
  --dot: rgb(243 241 236 / .09);
}

/* ── Base ──────────────────────────────────────────────────────────────────── */
html { scroll-padding-top: 96px; }
body { position: relative; background: var(--bg); color: var(--ink); font-size: 16px; }
h1, h2 { font-family: var(--display); letter-spacing: -.035em; }
h3, h4 { font-family: var(--sans); letter-spacing: -.018em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
::selection { background: var(--accent); color: var(--on-accent); }
.skip-link { color: var(--bg); }
.scroll-progress { height: 2px; }
.scroll-progress span { background: var(--coral); }

/* Transición suave solo durante el cambio de tema (js/theme.js pone y quita la
   clase): así los hovers normales conservan sus propias transiciones. */
.theme-switching,
.theme-switching *,
.theme-switching *::before,
.theme-switching *::after {
  transition: background-color .35s ease, border-color .35s ease, color .35s ease, fill .35s ease !important;
}

/* ── Barra superior flotante ───────────────────────────────────────────────── */
.topbar { inset: 12px 0 auto; background: none; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none; pointer-events: none; }
.topbar-inner {
  position: relative;
  width: min(calc(var(--shell) + 32px), calc(100% - 24px));
  height: 60px;
  padding: 0 8px 0 10px;
  gap: 20px;
  border: 1px solid color-mix(in srgb, var(--line) 85%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  pointer-events: auto;
  transition: box-shadow .3s ease, background-color .3s ease;
}
.topbar.scrolled .topbar-inner { background: color-mix(in srgb, var(--surface) 92%, transparent); box-shadow: var(--shadow); }
.brand { gap: 10px; font-family: var(--sans); font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.brand-mark { width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: var(--bg); font-family: var(--display); font-size: 15px; font-weight: 700; transition: transform .5s var(--ease), background-color .25s ease, color .25s ease; }
.brand-mark svg { width: 16px; }
.brand:hover .brand-mark { background: var(--accent); color: var(--on-accent); transform: rotate(-12deg); }
.nav-links { gap: 2px; }
.nav-links a { padding: 8px 14px; border-radius: 999px; color: var(--ink-soft); font-size: 14px; font-weight: 500; transition: color .2s ease, background-color .2s ease; }
.nav-links a:hover { color: var(--ink); background: var(--surface-soft); }
.nav-links a.active { color: var(--ink); font-weight: 650; background: var(--surface-soft); box-shadow: none; }
.topbar-actions { gap: 2px; }
.topbar-social a { width: 38px; height: 38px; }
.lang-switch { min-width: 44px; height: 40px; padding-inline: 6px; border-radius: 999px; font-size: 12px; font-weight: 600; transition: background-color .2s ease; }
.lang-switch:hover { background: var(--surface-soft); }

.theme-toggle { position: relative; display: grid; flex: none; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--ink); cursor: pointer; transition: background-color .2s ease; }
.theme-toggle:hover { background: var(--surface-soft); }
.theme-toggle svg { grid-area: 1 / 1; width: 18px; height: 18px; transition: transform .5s var(--ease), opacity .3s ease; }
.theme-toggle .icon-sun { opacity: 0; transform: rotate(-90deg) scale(.5); }
[data-theme="dark"] .theme-toggle .icon-sun { opacity: 1; transform: none; }
[data-theme="dark"] .theme-toggle .icon-moon { opacity: 0; transform: rotate(90deg) scale(.5); }

.menu-toggle { display: none; width: 40px; height: 40px; border: 0; border-radius: 999px; background: var(--ink); cursor: pointer; }
.menu-toggle span { width: 16px; height: 1.5px; margin: 4px auto; background: var(--bg); transition: transform .3s var(--ease); }
.menu-toggle[aria-expanded="true"] span:first-child { transform: translateY(2.75px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:last-child { transform: translateY(-2.75px) rotate(-45deg); }

/* ── Botones y enlaces de acción ───────────────────────────────────────────── */
.button { gap: 8px; min-height: 46px; padding-inline: 22px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 650; transition: transform .3s var(--ease), background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .3s ease; }
.button:hover { transform: translateY(-2px); }
.button.primary { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.button.primary:hover { border-color: var(--accent); background: var(--accent); color: var(--on-accent); box-shadow: 0 12px 28px -14px color-mix(in oklch, var(--accent) 70%, transparent); }
.button.ghost { border-color: var(--line); background: transparent; }
.button.ghost:hover { border-color: var(--ink); background: var(--surface); }
.button.compact { min-height: 40px; padding-inline: 16px; font-size: 13px; }
.work-more { padding: 9px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 600; box-shadow: none; transition: border-color .2s ease; }
.work-more:hover { border-color: var(--ink); box-shadow: none; }

/* ── Portada: hero ─────────────────────────────────────────────────────────── */
.home-hero { position: relative; isolation: isolate; overflow: hidden; padding: clamp(128px, 14vw, 172px) 0 clamp(32px, 4vw, 56px); background: none; }
.home-hero::after { display: none; }
/* Trama de puntos que se desvanece hacia la izquierda, con dos luces suaves
   detrás. Sustituye a las manchas de color: da textura sin competir con el texto. */
.ambient-field {
  position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  background-image: radial-gradient(var(--dot) 1.1px, transparent 1.4px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 62% 78% at 80% 28%, #000 12%, transparent 72%);
  mask-image: radial-gradient(ellipse 62% 78% at 80% 28%, #000 12%, transparent 72%);
}
.ambient-field span { position: absolute; display: block; max-width: none; border-radius: 50%; filter: blur(24px); }
.ambient-field span:nth-child(1) { right: 8%; top: 10%; left: auto; bottom: auto; width: min(460px, 70vw); height: auto; aspect-ratio: 1; background: radial-gradient(circle, color-mix(in oklch, var(--accent) 26%, transparent), transparent 66%); }
.ambient-field span:nth-child(2) { right: 30%; top: 48%; width: 200px; height: 200px; background: radial-gradient(circle, color-mix(in oklch, var(--coral) 30%, transparent), transparent 66%); }
.ambient-field span:nth-child(3) { display: none; }

.home-identity { display: inline-flex; align-items: center; gap: 12px; margin-bottom: clamp(28px, 4vw, 44px); padding: 6px 18px 6px 6px; border: 1px solid var(--line); border-radius: 999px; background: color-mix(in oklch, var(--surface) 85%, transparent); backdrop-filter: blur(6px); }
.home-identity img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; object-position: center 30%; }
.home-identity p { margin: 0; font-size: 14px; font-weight: 700; line-height: 1.25; }
.home-identity span { display: block; margin: 0; padding: 0; border-radius: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 500; line-height: 1.35; }

.home-hero-copy { display: grid; width: 100%; max-width: none; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 32px clamp(40px, 6vw, 88px); align-items: end; }
.home-hero-copy h1 { max-width: 12ch; margin: 0; color: var(--ink); font-size: clamp(3rem, 6.6vw, 6rem); line-height: .96; font-weight: 700; letter-spacing: -.05em; }
/* Subrayado dibujado a mano bajo el titular: el gesto creativo de la portada. */
.home-hero-copy h1::after {
  content: ''; display: block;
  width: clamp(120px, 14vw, 200px); height: 16px; margin-top: clamp(14px, 1.8vw, 24px);
  background: var(--coral);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 16' fill='none'%3E%3Cpath d='M3 10c14-8 26-8 39 0s26 8 39 0 26-8 39 0 26 8 39 0 22-7 38-2' stroke='black' stroke-width='3.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 16' fill='none'%3E%3Cpath d='M3 10c14-8 26-8 39 0s26 8 39 0 26-8 39 0 26 8 39 0 22-7 38-2' stroke='black' stroke-width='3.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
}
.home-hero-summary { max-width: 44ch; padding-bottom: 6px; }
.home-hero-summary .lede { margin: 0 0 26px; color: var(--ink-soft); font-size: clamp(1rem, 1.25vw, 1.12rem); line-height: 1.65; }
.home-hero .hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.hero-contact-link { display: inline-flex; align-items: center; min-height: 46px; padding-inline: 10px; color: var(--ink-soft); font-size: 14px; font-weight: 600; box-shadow: none; text-decoration: underline; text-decoration-color: transparent; text-decoration-thickness: 2px; text-underline-offset: 6px; transition: color .2s ease, text-decoration-color .2s ease; }
.hero-contact-link:hover { color: var(--ink); box-shadow: none; text-decoration-color: var(--coral); }

/* ── Secciones de portada ──────────────────────────────────────────────────── */
main { counter-reset: section; }
#hero, #work, #writing { order: initial; }
#work, #writing { padding-block: clamp(48px, 7vw, 96px); border: 0; background: transparent; }
#writing { padding-top: clamp(24px, 3vw, 40px); }
.work-head, .writing-head,
.writing-primary .writing-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; max-width: none; margin-bottom: clamp(28px, 4vw, 44px); }
.work-head h2,
.writing-primary .writing-head h2 { margin: 0; font-size: clamp(2rem, 3.8vw, 3.2rem); line-height: 1; font-weight: 650; letter-spacing: -.04em; }
/* Numeración de sección ("—— 01"): orienta el recorrido sin añadir marcado. */
.work-head h2::before,
.writing-primary .writing-head h2::before {
  counter-increment: section;
  content: counter(section, decimal-leading-zero);
  display: block; margin-bottom: 14px; padding-left: 34px;
  background: linear-gradient(var(--accent), var(--accent)) left center / 24px 1.5px no-repeat;
  color: var(--accent); font-family: var(--sans); font-size: 12px; font-weight: 700; letter-spacing: .08em; line-height: 1.2;
}
.writing-primary .eyebrow { display: none; }
.writing-primary .writing-head-copy { max-width: 560px; }
.writing-primary .writing-head .lede { max-width: 52ch; margin: 14px 0 0; font-size: 15px; }
.writing-primary .writing-head .work-more { margin: 0; }

/* Proyectos: dos piezas grandes y el resto como filas numeradas. */
.work-scroll { counter-reset: tile; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: row; grid-auto-columns: auto; gap: 0 20px; padding: 0; overflow: visible; scroll-snap-type: none; }
.work-tile { counter-increment: tile; position: relative; display: flex; min-width: 0; flex-direction: column; gap: 10px; padding: 0; border: 0; border-radius: 0; background: transparent; transition: background-color .25s ease; }
.work-tile:hover { transform: none; border-color: transparent; }
.work-tile:nth-child(-n+2) { padding-bottom: clamp(32px, 4vw, 48px); }
.work-tile-thumb { position: relative; width: 100%; height: auto; aspect-ratio: 1.5; padding: clamp(18px, 3vw, 34px); overflow: hidden; border-radius: var(--radius-lg); background: var(--surface-soft); transition: background-color .35s ease; }
.work-tile-thumb picture { display: block; width: 100%; height: 100%; }
.work-tile-thumb img { width: 100%; height: 100%; margin-inline: auto; object-fit: contain; object-position: center; filter: drop-shadow(0 18px 24px rgb(22 21 26 / .16)); transition: transform .5s var(--ease); }
.work-tile:hover .work-tile-thumb { background: color-mix(in oklch, var(--accent) 12%, var(--surface-soft)); box-shadow: none; }
.work-tile:hover .work-tile-thumb img { transform: translateY(-6px) scale(1.02); }
.work-tile-thumb.is-diagram,
.work-tile:hover .work-tile-thumb.is-diagram { background: var(--code-bg); }
.work-tile-thumb.is-diagram img { padding: 0; filter: none; }
.work-tile-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; padding-right: 52px; }
.work-tile-top h3 { margin: 0; font-size: 1.2rem; font-weight: 700; letter-spacing: -.02em; }
.work-tile-top h3::before { content: counter(tile, decimal-leading-zero); margin-right: 10px; color: var(--muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 0; vertical-align: 2px; }
.work-tile:hover h3 { color: var(--ink); }
.work-tile-tagline { padding-right: 52px; color: var(--ink-soft); font-size: 14px; line-height: 1.55; }
.work-tile::after { content: '→'; position: absolute; right: 0; bottom: calc(clamp(32px, 4vw, 48px) + 4px); display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); font-size: 16px; line-height: 1; transform: rotate(-45deg); transition: transform .35s var(--ease), background-color .2s ease, color .2s ease, border-color .2s ease; }
.work-tile:hover::after { border-color: var(--accent); background: var(--accent); color: var(--on-accent); transform: rotate(0); }
.work-tile:nth-child(n+3) { grid-column: 1 / -1; display: grid; grid-template-columns: 96px minmax(0, 1fr); grid-template-rows: auto auto; align-items: center; gap: 2px 22px; margin-inline: -16px; padding: 16px 68px 16px 16px; border-top: 1px solid var(--line); }
.work-tile:nth-child(n+3):hover { border-radius: 16px; background: var(--surface); }
.work-tile:nth-child(n+3):hover,
.work-tile:nth-child(n+3):hover + .work-tile { border-top-color: transparent; }
.work-tile:nth-child(n+3) .work-tile-thumb { grid-row: 1 / 3; height: 64px; aspect-ratio: auto; padding: 8px; border-radius: 12px; }
.work-tile:nth-child(n+3) .work-tile-thumb img { filter: none; }
.work-tile:nth-child(n+3):hover .work-tile-thumb img { transform: scale(1.06); }
.work-tile:nth-child(n+3) .work-tile-top { align-self: end; margin: 0; padding-right: 0; }
.work-tile:nth-child(n+3) .work-tile-tagline { align-self: start; padding-right: 0; }
.work-tile:nth-child(n+3)::after { top: 50%; right: 16px; bottom: auto; margin-top: -19px; }

.badge, .work-tile .badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 11px; font-weight: 600; line-height: 1.5; }

/* Escritura: una pieza principal con imagen grande y dos compactas al lado. */
.writing-featured { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; margin-bottom: 20px; }
.writing-feature { display: flex; flex-direction: row; align-items: center; gap: 18px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .25s ease; }
.writing-feature:hover { transform: translateY(-3px); border-color: color-mix(in oklch, var(--ink) 16%, var(--line)); box-shadow: var(--shadow); }
.writing-feature:first-child { grid-row: span 2; flex-direction: column; align-items: stretch; gap: 0; padding-bottom: 8px; }
.writing-feature-thumb { flex: none; width: 132px; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 12px; box-shadow: none; }
.writing-feature:first-child .writing-feature-thumb { width: 100%; aspect-ratio: 16 / 9; }
.writing-feature:hover .writing-feature-thumb { box-shadow: none; }
.writing-feature.skel-card .writing-feature-thumb.skel { height: auto; }
.writing-feature-body { flex: 1; min-width: 0; padding: 4px 8px 4px 0; }
.writing-feature:first-child .writing-feature-body { padding: 18px 10px 12px; }
.writing-feature-meta { flex-wrap: wrap; gap: 6px 10px; margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .02em; text-transform: none; }
.writing-feature-meta span { color: var(--accent); }
.writing-feature h3 { max-width: 40ch; margin: 0 0 6px; font-size: 1.02rem; line-height: 1.35; font-weight: 700; }
.writing-feature h3::before, .writing-row h3::before { display: none; }
.writing-feature:first-child h3 { max-width: 30ch; font-family: var(--display); font-size: clamp(1.4rem, 2.2vw, 1.9rem); line-height: 1.12; font-weight: 650; letter-spacing: -.03em; }
.writing-feature p { display: -webkit-box; max-width: 60ch; overflow: hidden; color: var(--ink-soft); font-size: 13.5px; line-height: 1.55; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.writing-list { margin-top: 8px; border-top: 0; }
.writing-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; align-items: center; gap: 20px; margin-inline: -14px; padding: 16px 14px; border-bottom: 1px solid var(--line); transition: background-color .2s ease; }
.writing-row:hover { border-radius: 12px; border-bottom-color: transparent; background: var(--surface); }
.writing-row time { width: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.writing-row h3 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.45; }
.writing-row:hover h3 { color: var(--accent); text-decoration: none; }
.writing-empty { margin: 0; padding: 24px; border: 1px dashed var(--line); border-radius: var(--radius-lg); background: transparent; color: var(--ink-soft); font-size: 14px; }

/* Contacto de portada: bloque cobalto con trama y un círculo coral. */
.home-contact { position: relative; isolation: isolate; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 28px 40px; overflow: hidden; margin-top: clamp(24px, 4vw, 48px); margin-bottom: clamp(56px, 8vw, 96px); padding: clamp(32px, 5vw, 64px); border: 0; border-radius: 32px; background: var(--cta-bg); color: #fff; }
.home-contact::before { content: ''; position: absolute; inset: 0; z-index: -1; background-image: radial-gradient(rgb(255 255 255 / .24) 1.1px, transparent 1.4px); background-size: 22px 22px; -webkit-mask-image: radial-gradient(ellipse 55% 90% at 100% 0%, #000, transparent 70%); mask-image: radial-gradient(ellipse 55% 90% at 100% 0%, #000, transparent 70%); }
.home-contact::after { content: ''; position: absolute; right: -60px; bottom: -110px; z-index: -1; width: 280px; aspect-ratio: 1; border-radius: 50%; background: var(--coral); }
.home-contact h2 { margin: 0 0 14px; color: #fff; font-size: clamp(2.2rem, 5vw, 4rem); line-height: 1; font-weight: 650; letter-spacing: -.045em; }
.contact-email { display: inline-flex; align-items: center; gap: 14px; min-height: 44px; color: #fff; font-size: clamp(1.1rem, 2.4vw, 1.7rem); font-weight: 600; letter-spacing: -.02em; overflow-wrap: anywhere; }
.contact-email span { display: inline-grid; flex: none; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: #fff; color: var(--cta-bg); font-size: 18px; transition: transform .35s var(--ease); }
.contact-email:hover { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 6px; }
.contact-email:hover span { background: #fff; color: var(--cta-bg); transform: rotate(45deg); }
.home-contact .button.ghost { border-color: rgb(255 255 255 / .55); background: rgb(255 255 255 / .08); color: #fff; }
.home-contact .button.ghost:hover { border-color: #fff; background: #fff; color: var(--cta-bg); }

/* ── Pie ───────────────────────────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--line); background: transparent; }
.footer-full { padding-top: clamp(40px, 5vw, 56px); }
.footer-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px 64px; }
.footer-newsletter { grid-column: auto; }
.footer-tagline { max-width: 36ch; font-size: 14px; }
.footer-social { gap: 8px; }
.footer-social a { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 12.5px; font-weight: 600; transition: border-color .2s ease, color .2s ease; }
.footer-social a:hover { border-color: var(--ink); color: var(--ink); }
.footer-newsletter-title { font-family: var(--display); font-size: 1.45rem; letter-spacing: -.025em; }
.newsletter-form { gap: 6px; padding: 5px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); transition: border-color .2s ease; }
.newsletter-form:focus-within { border-color: var(--ink); }
.newsletter-form input { height: 42px; min-height: 42px; padding-inline: 14px; border: 0; border-radius: 999px; background: transparent; }
.newsletter-form input:focus { outline: none; }
.newsletter-form .button { min-height: 42px; }
.footer-bottom { padding-block: 20px; font-size: 12.5px; }

/* ── Páginas: blog y proyectos ─────────────────────────────────────────────── */
.blog-hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 32px; margin-bottom: 28px; padding: clamp(128px, 13vw, 160px) 0 clamp(28px, 3vw, 40px); border-bottom: 1px solid var(--line); }
.blog-kicker { display: none; }
.blog-hero h1 { max-width: none; margin: 0; font-size: clamp(2.6rem, 6vw, 4.8rem); line-height: .95; font-weight: 700; letter-spacing: -.05em; }
.blog-hero > p:last-child { max-width: 42ch; margin: 0; color: var(--ink-soft); font-size: 15px; }
.blog-toolbar { padding-bottom: 8px; border-bottom: 0; }
.blog-search { width: min(300px, 100%); }
.blog-search input { min-height: 44px; padding: 0 16px 0 40px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.blog-search input:focus { border-color: var(--ink); }
.blog-search-icon { left: 15px; }
.blog-filters { gap: 6px; }
.blog-filter { min-height: 38px; padding: 0 14px; border-radius: 999px; background: var(--surface); color: var(--ink-soft); font-weight: 600; }
.blog-featured { margin: 8px 0 32px; padding: 16px; border: 1px solid var(--line); border-radius: 28px; background: var(--surface); }
.blog-featured-media { border-radius: 18px; }
.blog-featured-copy { padding: 12px 8px 12px 20px; }
.blog-featured-tag { background: var(--accent); color: var(--on-accent); }
.blog-featured-copy h2 { font-size: clamp(1.7rem, 3.2vw, 2.6rem); line-height: 1.04; letter-spacing: -.04em; }
.blog-featured-link, .blog-row-link { border-bottom: 2px solid var(--coral); }
.blog-list { border-top: 0; }
.blog-row-thumb-wrap { border-radius: 14px; }
.blog-row-tag { background: var(--accent-soft); color: var(--accent); }
.blog-row-copy h2 { font-family: var(--sans); font-weight: 700; letter-spacing: -.02em; }
.blog-page-btn { min-width: 36px; min-height: 36px; border-radius: 999px; }

.projects-grid { counter-reset: project; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(36px, 5vw, 56px) 24px; }
.project-card { counter-increment: project; overflow: visible; border: 0; border-radius: 0; background: transparent; }
.project-card:hover { border-color: transparent; box-shadow: none; transform: none; }
.project-card-visual { height: auto; aspect-ratio: 1.5; padding: clamp(18px, 3vw, 32px); border-radius: var(--radius-lg); background: var(--surface-soft); transition: background-color .35s ease; }
.project-card-visual picture { display: block; width: 100%; height: 100%; }
.project-card-visual img { margin-inline: auto; object-fit: contain; object-position: center; filter: drop-shadow(0 18px 24px rgb(22 21 26 / .16)); transition: transform .5s var(--ease); }
.project-card:hover .project-card-visual { background: color-mix(in oklch, var(--accent) 12%, var(--surface-soft)); box-shadow: none; }
.project-card:hover .project-card-visual img { transform: translateY(-6px) scale(1.02); }
.project-card-visual-contain, .project-card:hover .project-card-visual-contain { background: var(--code-bg); }
.project-card-visual-contain img { filter: none; }
.project-card-body { padding: 20px 4px 0; }
.project-card-body .badge { margin-bottom: 12px; }
.project-card-body h2 { font-size: clamp(1.5rem, 2.4vw, 1.9rem); font-weight: 650; letter-spacing: -.035em; }
.project-card-body h2::before { content: counter(project, decimal-leading-zero); margin-right: 10px; color: var(--muted); font-family: var(--sans); font-size: 12px; font-weight: 600; letter-spacing: 0; vertical-align: 6px; }
.project-card:hover h2 { color: var(--ink); }
.project-card-tags { gap: 6px; padding-top: 6px; border-top: 0; }
.project-card-tags li { padding: 3px 10px; border-radius: 999px; background: var(--surface-soft); color: var(--ink-soft); font-size: 11.5px; font-weight: 600; }

/* ── Páginas: sobre mí y contacto ──────────────────────────────────────────── */
#about .eyebrow, #experience .eyebrow, .contact .section-head .eyebrow { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.eyebrow .idx { display: inline; }
#about > .shell > .section-head { max-width: 900px; }
#about > .shell > .section-head h2, #experience .section-head h2 { max-width: 20ch; font-size: clamp(2.2rem, 4.6vw, 4rem); line-height: 1.02; font-weight: 650; letter-spacing: -.045em; }
#experience, .case-writing { background: transparent; }
.about-grid { grid-template-columns: minmax(0, 1.3fr) minmax(240px, .7fr); gap: clamp(32px, 6vw, 80px); }
.about-copy p { margin-bottom: 22px; font-size: 16px; line-height: 1.8; }
.about-copy p:first-child { color: var(--ink); font-family: var(--display); font-size: clamp(1.3rem, 2.2vw, 1.7rem); line-height: 1.4; letter-spacing: -.02em; }
.facts { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.facts li { grid-template-columns: 1fr; gap: 4px; padding-block: 14px; }
.facts li:first-child { padding-top: 0; }
.facts li:last-child { border: 0; }
.fact-k { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.fact-v { color: var(--ink); font-size: 14px; line-height: 1.6; }
.facts-social a { width: 44px; height: 44px; }
.timeline { gap: 12px; border-top: 0; }
.tl-card { grid-template-columns: 56px 110px minmax(0, 1fr); grid-template-areas: 'logo date role' 'logo date org' '. . body'; gap: 4px 22px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); transition: transform .35s var(--ease), border-color .25s ease; }
.tl-card:hover { border-color: color-mix(in oklch, var(--ink) 18%, var(--line)); transform: translateY(-2px); }
.company-logo { width: 56px; height: 56px; border-radius: 14px; outline: 1px solid var(--line); }
.company-financenova { background: var(--code-bg); }
.company-letter { background: var(--code-bg); color: #fff; }
.tl-date { color: var(--muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tl-card h3 { font-size: 1.15rem; line-height: 1.35; font-weight: 700; }
.tl-org { color: var(--accent); font-weight: 650; }
.tl-body { margin-top: 8px; }
.education { margin-top: 56px; padding-top: 0; border-top: 0; }
.edu-title { font-family: var(--display); font-size: clamp(1.6rem, 2.6vw, 2.2rem); letter-spacing: -.035em; }
.edu-grid { gap: 12px; border-top: 0; }
.edu-card { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }

.contact .section-head { max-width: 900px; }
.contact .section-head h1 { max-width: 12ch; margin-bottom: 20px; font-size: clamp(3rem, 8vw, 6.4rem); line-height: .92; font-weight: 700; letter-spacing: -.055em; }
.contact .section-head .lede { max-width: 48ch; font-size: clamp(1rem, 1.4vw, 1.2rem); }
.contact-card { position: relative; isolation: isolate; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 24px; overflow: hidden; padding: clamp(28px, 4vw, 48px); border: 0; border-radius: 32px; background: var(--cta-bg); color: #fff; }
.contact-card::after { content: ''; position: absolute; top: -90px; right: -70px; z-index: -1; display: block; width: 240px; aspect-ratio: 1; border-radius: 50%; background: var(--coral); }
.mail-link { color: #fff; font-family: var(--display); font-size: clamp(1.4rem, 3.4vw, 2.6rem); font-weight: 650; letter-spacing: -.03em; box-shadow: none; overflow-wrap: anywhere; }
.mail-link svg { width: 28px; }
.contact-links { gap: 8px; padding-left: 0; border-left: 0; }
.contact-links a { padding: 8px 14px; border: 1px solid rgb(255 255 255 / .4); border-radius: 999px; color: #fff; font-size: 13px; font-weight: 600; box-shadow: none; transition: background-color .2s ease, color .2s ease; }
.contact-links a:hover { background: #fff; color: var(--cta-bg); box-shadow: none; }

/* ── Artículo ──────────────────────────────────────────────────────────────── */
.article-hero { padding-top: clamp(128px, 13vw, 156px); }
.article-hero h1 { line-height: 1.02; font-weight: 700; letter-spacing: -.045em; }
.article-tag { background: var(--accent); color: var(--on-accent); }
.article-cover { border-radius: var(--radius-lg); }
.article-body h2 { letter-spacing: -.03em; }
.article-body a { text-decoration-color: var(--coral); text-decoration-thickness: 1.5px; }
.article-body ul li::before, .case-copy ul li::before { background: var(--coral); }
.article-body blockquote { border-left-color: var(--accent); }
.article-callout { border-left-color: var(--accent); border-radius: 0 14px 14px 0; }
.article-body pre, .case-copy pre { border-radius: 14px; background: var(--code-bg); }
.article-body mark { color: #16151a; }
.article-project, .article-footer-cta { border-bottom: 2px solid var(--coral); }
.article-related-card { border-radius: var(--radius-lg); }

/* ── Caso de estudio ───────────────────────────────────────────────────────── */
.detail-nav { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 82%, transparent); }
.detail-nav-inner { height: 68px; }
.detail-nav-inner .brand { margin-right: 0; margin-left: auto; }
.back-link { min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 13px; font-weight: 600; }
.detail-kicker { color: var(--accent); }
.detail-title { font-weight: 700; letter-spacing: -.055em; }
.detail-summary { border-top: 1px solid var(--line); }
.detail-shot { border-radius: var(--radius-lg); }
.detail-shot.is-diagram, .detail-logo-dark, .architecture-image { background: var(--code-bg); }
.architecture-image { border-radius: var(--radius-lg); }
.detail-logo-letter { color: var(--bg); }
.case-story { background: transparent; }
.case-label { color: var(--accent); letter-spacing: .08em; }
.decision-list li > span { color: var(--accent); }
.article-card { border-radius: var(--radius-lg); }
.article-status.is-published { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.article-card-published { border-color: var(--line); box-shadow: none; }
.article-card-published:hover { border-color: var(--accent); }
.article-card-published strong { border-bottom: 2px solid var(--coral); }
.case-next { background: var(--surface-soft); }
.next-project strong { font-weight: 700; letter-spacing: -.05em; transition: color .2s ease; }
.next-project:hover strong { color: var(--accent); }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 900px) and (min-width: 761px) {
  /* styles.css pasa a menú desplegable a 900px; la píldora aún cabe entera. */
  .nav-links { position: static; display: flex; flex-direction: row; padding: 0; border: 0; background: none; }
  .menu-toggle { display: none; }
  .topbar-social { display: none; }
}
@media (max-width: 900px) {
  .home-hero-copy { grid-template-columns: 1fr; align-items: start; gap: 28px; }
  .home-hero-copy h1 { max-width: 14ch; }
  .writing-featured { grid-template-columns: 1fr; }
  .writing-feature:first-child { grid-row: auto; }
  .about-grid, .edu-grid { grid-template-columns: 1fr; }
  .blog-featured-copy { padding: 16px 8px 8px; }
}
@media (max-width: 760px) {
  .topbar-inner { gap: 8px; padding-left: 8px; }
  .topbar-social { display: none; }
  .brand-text { display: inline; }
  .menu-toggle { display: block; }
  .nav-links { position: absolute; inset: calc(100% + 8px) 0 auto; display: none; flex-direction: column; align-items: stretch; gap: 2px; padding: 8px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
  .nav-links.open { display: flex; }
  .nav-links a { width: 100%; padding: 12px 16px; font-size: 16px; }
  .home-hero { padding-top: 112px; }
  .work-scroll { grid-template-columns: 1fr; }
  .work-tile:nth-child(n+3) { grid-template-columns: 64px minmax(0, 1fr); gap: 2px 14px; margin-inline: -12px; padding: 14px 52px 14px 12px; }
  .work-tile:nth-child(n+3) .work-tile-thumb { height: 56px; padding: 6px; border-radius: 10px; }
  .work-tile:nth-child(n+3)::after { right: 12px; width: 32px; height: 32px; margin-top: -16px; }
  .work-tile:nth-child(n+3) .work-tile-top { display: flex; }
  .work-tile:nth-child(n+3) .work-tile-tagline { font-size: 13px; }
  .work-tile-top { display: flex; }
  .work-tile .badge { margin-top: 0; }
  .writing-feature-thumb { width: 88px; }
  .writing-feature p { display: none; }
  .writing-feature:first-child p { display: -webkit-box; }
  .writing-row { grid-template-columns: 1fr auto; gap: 4px 14px; }
  .writing-row time { grid-column: 1 / -1; }
  .home-contact { align-items: flex-start; border-radius: 24px; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .footer-newsletter { grid-column: auto; }
  .projects-grid { grid-template-columns: 1fr; }
  .tl-card { grid-template-columns: 48px minmax(0, 1fr); grid-template-areas: 'logo date' 'logo role' 'logo org' 'body body'; padding: 18px; }
  .company-logo { width: 48px; height: 48px; }
  .blog-featured-copy { padding: 16px 4px 4px; }
}
@media (max-width: 620px) {
  .work-head, .writing-head, .writing-primary .writing-head { flex-direction: column; align-items: flex-start; }
  /* styles.css apila el formulario; dentro de la píldora se mantiene en fila. */
  .newsletter-form { flex-direction: row; }
  .newsletter-form .button { width: auto; }
  .home-hero .hero-actions .button { width: auto; }
  .home-identity { border-radius: 20px; }
}
@media (max-width: 380px) {
  .topbar .brand-text { display: none; }
}

/* ── Movimiento ────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .home-identity, .home-hero-copy h1, .home-hero-summary { animation: rise .8s var(--ease) both; }
  .home-hero-copy { animation: none; }
  .home-hero-copy h1 { animation-delay: .06s; }
  .home-hero-summary { animation-delay: .16s; }
  .home-hero-copy h1::after { animation: draw 1.2s .55s var(--ease) both; }
  .ambient-field span:nth-child(1) { animation: float-a 18s ease-in-out infinite alternate; }
  .ambient-field span:nth-child(2) { animation: float-b 22s ease-in-out infinite alternate; }
  @keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
  @keyframes draw { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
  @keyframes float-a { to { transform: translate(-10%, 12%) scale(1.1); } }
  @keyframes float-b { to { transform: translate(30%, -20%) scale(.85); } }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
