/* =========================================================
   CoreWorks — "El Expediente"
   Sistema de diseño: papel contable + tinta + terminal de bóveda
   Tipografía: Fraunces (display) · Archivo (texto) · IBM Plex Mono (datos)
   ========================================================= */

:root {
  /* ---- Papel / tinta ---- */
  --paper:        #f4f1e8;   /* papel bond cálido */
  --paper-soft:   #ede9dc;
  --card:         #faf8f1;
  --ink:          #191e2a;   /* tinta principal */
  --ink-soft:     #474e62;
  --ink-faint:    #707789;
  --rule:         #d6d1bf;   /* regla de libreta */
  --rule-soft:    #e4e0d0;

  /* ---- Marca ---- */
  --teal:         #29aaab;
  --teal-deep:    #177475;   /* tinta de sello */
  --teal-bright:  #38c4c5;
  --teal-glow:    #4fe2d3;
  --alert:        #c23d63;   /* señal de riesgo (uso puntual) */

  /* ---- Bóveda (terminal oscuro) ---- */
  --vault:        #0b1016;
  --vault-2:      #101822;
  --vault-3:      #15202c;
  --vault-line:   #1f2c39;
  --vault-text:   #b4c2cf;
  --vault-faint:  #5f7080;

  /* ---- Acentos derivados ---- */
  --accent:        var(--teal);
  --accent-bright: var(--teal-bright);
  --accent-deep:   var(--teal-deep);

  /* ---- Tipografía ---- */
  --font-display: 'Fraunces', 'Georgia', serif;
  --font-body:    'Archivo', system-ui, -apple-system, sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, 'Cascadia Mono', monospace;

  /* ---- Radios / sombras ---- */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-pill: 999px;

  --sh-sm: 0 2px 8px -2px rgba(25,30,42,.10);
  --sh-md: 0 14px 30px -14px rgba(25,30,42,.20);
  --sh-lg: 0 34px 70px -28px rgba(25,30,42,.34);
  --sh-vault: 0 40px 90px -30px rgba(8,12,18,.55);

  /* ---- Layout ---- */
  --maxw: 1240px;
  --gut: clamp(20px, 5vw, 52px);
}

/* =================== Reset / base =================== */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.62;
  font-size: 16.5px;
  letter-spacing: 0.002em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  position: relative;
}
/* grano de papel */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.05'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}
main, header, footer { position: relative; z-index: 1; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
::selection { background: var(--teal); color: #fff; }
:focus-visible { outline: 2px solid var(--teal-deep); outline-offset: 3px; border-radius: 2px; }

/* =================== Layout helpers =================== */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gut); }
.section { padding-block: clamp(76px, 9vw, 132px); position: relative; }
.section--tight { padding-block: clamp(54px, 6vw, 84px); }

/* etiqueta de folio (eyebrow) */
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-size: 11.5px; font-weight: 600;
  letter-spacing: .22em; text-transform: uppercase;
  color: var(--teal-deep);
}
.eyebrow::before {
  content: ""; width: 26px; height: 1.5px;
  background: var(--teal-deep);
}
.eyebrow--center::before { display: none; }
.eyebrow--light { color: var(--teal-deep); }   /* heros ahora son papel */

.h-sec {
  font-family: var(--font-display);
  font-weight: 580;
  font-variation-settings: "opsz" 80;
  font-size: clamp(30px, 4.2vw, 50px);
  line-height: 1.04;
  letter-spacing: -0.018em;
  margin-top: 18px;
  text-wrap: balance;
}
.lead {
  font-size: clamp(16px, 1.45vw, 18.5px);
  color: var(--ink-soft);
  max-width: 58ch;
  margin-top: 18px;
  text-wrap: pretty;
}
.sec-head { max-width: 740px; }
.sec-head--center { max-width: 780px; margin-inline: auto; text-align: center; }

/* palabra destacada del h1: subrayado de auditor */
.grad-text {
  color: var(--teal-deep);
  font-style: italic;
  font-variation-settings: "opsz" 100;
  background: linear-gradient(currentColor, currentColor) no-repeat 0 96% / 100% 2px;
  padding-bottom: 2px;
}

/* sello de tinta */
.stamp {
  display: inline-block; position: relative;
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: .2em; text-transform: uppercase; line-height: 1.35;
  color: var(--teal-deep);
  border: 2px solid currentColor; border-radius: var(--r-sm);
  padding: 9px 13px;
  transform: rotate(-5deg);
  opacity: .92;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.5' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .82 .18'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23m)'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.5' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .82 .18'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23m)'/%3E%3C/svg%3E");
}
.stamp::after {
  content: ""; position: absolute; inset: 3px;
  border: 1px solid currentColor; border-radius: 3px; opacity: .5;
}
.stamp--alert { color: var(--alert); }

/* =================== Botones =================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--font-body); font-weight: 640; font-size: 15px;
  letter-spacing: .01em;
  padding: 14px 24px; border-radius: var(--r-sm);
  border: 1.5px solid transparent;
  transition: transform .22s cubic-bezier(.2,.7,.3,1), box-shadow .22s, background .22s, color .18s, border-color .18s;
  white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; transition: transform .22s; }
.btn:hover svg { transform: translateX(4px); }

/* primario: tinta sólida */
.btn--primary {
  background: var(--ink); color: var(--paper);
  box-shadow: var(--sh-sm);
}
.btn--primary:hover { background: var(--teal-deep); transform: translateY(-2px); box-shadow: var(--sh-md); }

/* "grad" histórico → sello teal sólido */
.btn--grad {
  background: var(--teal-deep); color: #fff;
  box-shadow: 0 14px 28px -14px rgba(23,116,117,.55);
}
.btn--grad:hover { background: var(--ink); transform: translateY(-2px); box-shadow: var(--sh-md); }

/* fantasma sobre papel (también cubre el viejo on-dark, ahora en heros de papel) */
.btn--ghost,
.btn--on-dark {
  background: transparent; color: var(--ink);
  border-color: var(--ink);
}
.btn--ghost:hover,
.btn--on-dark:hover { background: var(--ink); color: var(--paper); transform: translateY(-2px); }

/* variante clara para superficies de bóveda (CTA final, drawer) */
.btn--on-vault {
  background: rgba(255,255,255,.04); color: #eef3f0;
  border-color: rgba(255,255,255,.32);
}
.btn--on-vault:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.6); transform: translateY(-2px); }

.btn--lg { padding: 17px 30px; font-size: 16px; }
.btn--sm { padding: 10px 16px; font-size: 13.5px; }

/* =================== Navbar =================== */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 60;
  background: color-mix(in oklab, var(--paper) 82%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--rule);
  transition: box-shadow .3s, background .3s;
}
.nav__inner { display: flex; align-items: center; gap: 26px; height: 70px; }
.nav__logo { display: flex; align-items: center; height: 28px; }
.nav__logo img { height: 28px; width: auto; }
.nav__logo .logo-light { display: none; }
.nav__logo .logo-dark  { display: block; }

.nav__links { display: flex; align-items: center; gap: 2px; margin-left: 6px; }
.nav__link {
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-soft);
  padding: 9px 13px;
  border-radius: var(--r-sm);
  transition: color .2s, background .2s;
}
.nav__link:hover { color: var(--ink); background: rgba(25,30,42,.06); }
.nav__link--active { color: var(--teal-deep); box-shadow: inset 0 -2px 0 var(--teal-deep); border-radius: 0; }
.nav__spacer { flex: 1; }
.nav__actions { display: flex; align-items: center; gap: 12px; }

/* selector de idioma */
.lang {
  display: inline-flex; align-items: center;
  border: 1.5px solid var(--ink); border-radius: var(--r-sm);
  padding: 2px; gap: 2px;
}
.lang__btn {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 600; letter-spacing: .08em;
  color: var(--ink-faint); padding: 5px 10px; border-radius: 4px;
  transition: color .2s, background .2s;
}
.lang__btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

.nav.is-stuck { background: color-mix(in oklab, var(--card) 92%, transparent); box-shadow: 0 10px 30px -22px rgba(25,30,42,.5); }

.nav__burger { display: none; align-items: center; justify-content: center;
  width: 42px; height: 42px; border: 1.5px solid var(--ink); border-radius: var(--r-sm); }
.nav__burger svg { width: 20px; height: 20px; stroke: var(--ink); }

/* =================== Reveal =================== */
/* Visible por defecto; sólo se oculta si JS confirma que la línea de tiempo
   de animación avanza (html.anim-on). */
.fade-up { opacity: 1; transform: none; }
html.anim-on .fade-up { opacity: 0; transform: translateY(24px);
  transition: opacity .75s ease, transform .75s cubic-bezier(.2,.7,.3,1); }
html.anim-on .fade-up.in { opacity: 1; transform: none; }
html.anim-on [data-delay="1"] { transition-delay: .08s; }
html.anim-on [data-delay="2"] { transition-delay: .16s; }
html.anim-on [data-delay="3"] { transition-delay: .24s; }
html.anim-on [data-delay="4"] { transition-delay: .32s; }
html.anim-on [data-delay="5"] { transition-delay: .4s; }

@media (prefers-reduced-motion: reduce) {
  html.anim-on .fade-up { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}

/* =================== Nav responsive =================== */
@media (max-width: 980px) {
  .nav__links { display: none; }
  .nav__actions .btn--text,
  .nav__actions .btn--on-dark { display: none; }
  .nav__burger { display: inline-flex; }
}
@media (max-width: 560px) {
  .nav__inner { gap: 14px; height: 62px; }
  .nav__actions .btn--primary { display: none; }
  .nav__logo img { height: 24px; }
}
