/* ── Case studies · tokens alineados al index ──
   Inter (opsz) body/display · Inter labels/eyebrows · acento naranja.
   Tipografía óptica y superficies de agencia.

   Nota: --font-label apuntaba a Geist. Era el último rezago de la fuente
   anterior: el home documenta Inter como ganador de la prueba A/B/C para
   metadata/eyebrows ("decisión final"), y los :root locales de los 3 cases
   ya declaraban Inter — solo esta hoja seguía en Geist y, por orden de
   cascada, ganaba. Consolidado en Inter.
*/

:root {
  --color-bg: #FAFAF8;
  --color-surface: #FFFFFF;
  /* Escalón claro de la rampa cálida — mismo valor que en css/styles.css.
     Usos menores (hover del CTA, cabecera de .data-table, bandeja de los
     mockups); no compite con --color-surface-sunken, va un escalón arriba. */
  --color-surface-2: #F5F3EE;
  --color-ink: #101012;
  --color-panel: #0C0C0D;
  --color-panel-edge: rgba(255, 255, 255, 0.08);
  --color-panel-text: #FAFAF8;
  --color-panel-muted: #8E8E93;
  --color-body: #52525B;
  --color-caption: #71717A;
  --color-border: #E7E5E4;
  --color-border-strong: #D6D3D1;
  /* Plano hundido · panel "Acerca de". Antes #F2F1EF hardcodeado en
     case-layout: a 8/9/9 puntos de --color-bg (#FAFAF8) el ojo no lo leía
     como superficie, solo como suciedad. #EFECE6 baja ~5.5% y deja caer el
     azul más rápido que el rojo, así que oscurece hacia papel/putty en vez
     de hacia gris. Da al documento dos planos: dossier hundido (el brief)
     vs evidencia elevada (las cards blancas que vienen después).
     Escalón hondo de la rampa cálida; --color-surface-2 es el escalón claro. */
  --color-surface-sunken: #EFECE6;
  /* Ver el porqué en assets/css/styles.css: familia cálida a saturación
     contenida, y cálida a propósito porque las tres marcas son frías. */
  --color-accent: #E04A1E;
  --color-accent-ink: #C2410C;

  --font: "Inter", system-ui, -apple-system, sans-serif;
  --font-label: "Inter", system-ui, -apple-system, sans-serif;
  --font-display: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "IBM Plex Mono", monospace;

  /* Type scale · cases (un poco más de display, cuerpo legible) */
  --text-deck: clamp(1.85rem, 5vw + 0.4rem, 3rem);
  --text-h2: clamp(1.6rem, 2.35vw + 0.6rem, 2.2rem);
  --text-h3: clamp(1.125rem, 1.1vw + 0.75rem, 1.4rem);
  --text-lead: clamp(1.0625rem, 0.45vw + 0.95rem, 1.2rem);
  --text-body: clamp(1.02rem, 0.25vw + 0.95rem, 1.1rem);
  --text-small: 0.875rem;
  --text-caption: 0.8125rem;
  --text-eyebrow: 0.75rem;

  --leading-display: 1.08;
  --leading-tight: 1.2;
  --leading-body: 1.62;
  --leading-relaxed: 1.68;

  --tracking-display: -0.035em;
  --tracking-h2: -0.03em;
  --tracking-h3: -0.022em;
  --tracking-body: -0.011em;
  --tracking-eyebrow: 0.14em;

  --radius-card: 16px;
  --radius-stage: 18px;
  --radius-media: 14px;
  --radius-pill: 999px;
  --shadow-rest: 0 1px 2px rgba(16, 16, 18, 0.04), 0 4px 16px -6px rgba(16, 16, 18, 0.08);
  --shadow-hover: 0 2px 4px rgba(16, 16, 18, 0.05), 0 12px 28px -10px rgba(16, 16, 18, 0.12);
  --shadow-stage: 0 1px 2px rgba(16, 16, 18, 0.03), 0 20px 48px -28px rgba(16, 16, 18, 0.14);
  --transition-card: transform 220ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
  --ease-out-soft: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── Base optical ── */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-body);
  color: var(--color-body);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-optical-sizing: auto;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  text-rendering: optimizeLegibility;
}

::selection {
  background: rgba(224, 74, 30, 0.16);
  color: var(--color-ink);
}

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

/* Títulos de sección · más peso */
.story-section h2,
.story-hero-main > h2,
.impact-head h2,
.act-head h2,
.story-footer h2,
.split-show-head__title {
  font-size: var(--text-h2);
  font-weight: 650;
  letter-spacing: var(--tracking-h2);
  line-height: var(--leading-tight);
  color: var(--color-ink);
}

.split-show-head__title {
  font-weight: 700;
  font-variation-settings: "opsz" 36;
}

.story-section h3,
.decision h3 {
  font-size: var(--text-h3);
}

.impact-card__title {
  font-size: clamp(1rem, 1.2vw + 0.7rem, 1.125rem);
}

/* Masthead */
/* Sin !important: esta hoja es la dueña de la tipografía del masthead. Los
   competidores de igual especificidad en case-layout.css se retiraron, y el
   resto (.story-deck / .story-brand a secas) pierde por especificidad. */
.story-masthead .story-brand {
  font-family: var(--font-label);
  font-weight: 700;
  letter-spacing: 0.3em;
  font-size: clamp(0.75rem, 1.2vw, 0.875rem);
  text-transform: uppercase;
  line-height: 1.2;
  color: var(--color-ink);
  font-variation-settings: normal;
}

.story-masthead .story-deck {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: var(--tracking-display);
  font-size: var(--text-deck);
  line-height: var(--leading-display);
  color: var(--color-ink);
  font-optical-sizing: auto;
  font-variation-settings: "opsz" 36;
  text-wrap: balance;
}

/* Body copy */
.story-section p,
.decision p,
.story-lede,
.impact-card__body,
.impact-head__lead {
  text-wrap: pretty;
  font-optical-sizing: auto;
  font-variation-settings: "opsz" 18;
}

/* Especificidad elevada a propósito: ".story-section p" (0,1,1) le ganaba a
   ".story-lede" (0,1,0) y la entradilla de los tres case studies salía a
   tamaño, interlineado y tracking de cuerpo, no de entradilla. Mismo patrón
   que .act-head .act-head__eyebrow. */
.story-section .story-lede {
  font-size: var(--text-lead);
  line-height: var(--leading-relaxed);
  letter-spacing: -0.014em;
  color: var(--color-body);
  max-width: 52ch;
}

.story-section p,
.decision p {
  font-size: var(--text-body);
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-body);
}

.story-section strong,
.decision strong {
  color: var(--color-ink);
  font-weight: 600;
}

/* Captions */
/* El !important es imprescindible aquí: sin él, .figure-caption__role
   (--text-caption) acaba ganando en algunos contextos de PRESTIO. Verificado
   con el analizador de cascada: quitarlo cambia 9 valores computados. */
.figure-caption__title {
  font-size: var(--text-small) !important;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.35;
  color: var(--color-ink);
}

.figure-caption__role {
  font-size: var(--text-caption);
  line-height: 1.5;
  letter-spacing: -0.005em;
  color: var(--color-body);
}

/* Eyebrows */
.story-eyebrow,
.act-head__eyebrow,
.impact-head__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-family: var(--font-label);
  font-size: var(--text-eyebrow);
  font-weight: 400;
  line-height: 1;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--color-caption);
}

/* Punto de acento solo en el eyebrow de apertura (masthead, una vez por
   página) — en los eyebrows de sección (act-head/impact-head, se repiten
   varias veces) se quitó: el naranja pierde peso si se usa de más, y el
   número/label ya hace el trabajo de wayfinding por sí solo. */
.story-eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
  flex: none;
  box-shadow: none;
}

/* Stats · tabular */
.stat b,
.story-stats .stat b {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "kern" 1;
  letter-spacing: -0.03em;
}

/* Surfaces */
.figure-frame,
.impact-card,
.impact-takeaway,
.data-table-wrap,
.decision--compact,
.decision__stage,
.impact-stage {
  border-radius: var(--radius-card);
}

.decision__stage,
.impact-stage {
  border-radius: var(--radius-stage);
}

/* Impact cards */
.impact-card {
  box-shadow: var(--shadow-rest);
  transition: var(--transition-card);
  background: var(--color-surface);
}

@media (hover: hover) and (pointer: fine) {
  .impact-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
    border-color: var(--color-border-strong);
  }
}

/* Buttons */
.btn {
  border-radius: var(--radius-pill);
  font-family: var(--font);
  font-weight: 500;
  font-size: 0.875rem;
  letter-spacing: -0.01em;
  transition: background 0.28s var(--ease-out-soft),
    border-color 0.28s var(--ease-out-soft),
    color 0.28s var(--ease-out-soft),
    transform 0.32s var(--ease-out-soft),
    box-shadow 0.32s var(--ease-out-soft);
}

.btn--primary {
  background: var(--color-ink);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn--primary:hover {
  background: #000;
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

.btn--secondary {
  background: var(--color-surface);
  color: var(--color-ink);
  border: 1px solid var(--color-border);
}

.btn--secondary:hover {
  border-color: var(--color-ink);
  transform: translateY(-1px);
}

/* Takeaway */
.impact-takeaway {
  background: var(--color-surface);
}

.impact-takeaway blockquote {
  font-optical-sizing: auto;
  font-variation-settings: "opsz" 28;
  text-wrap: pretty;
}

.impact-takeaway blockquote em,
.story-quote blockquote em {
  color: var(--color-accent-ink);
  font-style: normal;
}

/* About panel */
.story-section.story-about {
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-rest);
}

/* Nav · sin underline (footer sí) */
.case-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.case-nav a {
  font-size: var(--text-small);
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
}

/* Hover del nav · --color-accent-ink (#E63E00) da 3.98:1 sobre --color-bg
   (#FAFAF8) — texto normal (14px) necesita 4.5:1. #C2410C da 4.96:1 sobre
   #FAFAF8 (luminancia relativa WCAG).
   El token global no se toca: solo el estado hover del nav de case. */
.case-nav a:hover {
  color: #C2410C;
}

/* Case-switcher · saltar directo a otro case sin pasar por Home */
.case-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
}

.case-switcher__dot {
  position: relative;
  display: block;
  width: 10px;
  height: 10px;
  padding: 8px;
  margin: -8px;
}

.case-switcher__dot::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--dot-color, currentColor);
  opacity: 0.35;
  transition: opacity 150ms ease, transform 150ms ease;
}

.case-switcher__dot:hover::before {
  opacity: 0.7;
  transform: scale(1.15);
}

.case-switcher__dot.is-current::before {
  opacity: 1;
}

.case-switcher__dot.is-current {
  pointer-events: none;
}

.case-switcher__dot.is-current::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 1.5px solid var(--dot-color, currentColor);
}

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

/* Tooltip visual (decorativo, aria-hidden) — el nombre del case aparece
   arriba del punto al hover/focus; el label accesible de arriba sigue
   siendo la fuente de verdad para lectores de pantalla. */
.case-switcher__tip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translate(-50%, 4px);
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--color-ink, #101012);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: -0.005em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease, transform 150ms ease;
}

.case-switcher__dot:hover .case-switcher__tip,
.case-switcher__dot:focus-visible .case-switcher__tip {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: reduce) {
  .case-switcher__tip {
    transition: opacity 1ms linear;
  }
}

/* En móvil no hay hover, así que este tooltip no puede aparecer nunca. Y como
   es `position:absolute` con `opacity:0` —invisible pero presente en el
   layout— el del último punto se salía 5px por la derecha del viewport y
   provocaba scroll horizontal en los tres cases (scrollWidth 395 vs 390).
   El label accesible de `.case-switcher__label` no se toca: esa es la fuente
   de verdad para lectores de pantalla. */
@media (max-width: 767px) {
  .case-switcher__tip {
    display: none;
  }
}
