/* ==========================================================================
   Agencia Detective — Reset, tipografía base y utilidades
   ========================================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1.5rem);
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img,
picture,
video,
svg { display: block; max-width: 100%; }

img, video { height: auto; }

input, button, textarea, select { font: inherit; color: inherit; }

button { background: none; border: 0; cursor: pointer; }

ul, ol { list-style: none; padding: 0; }

a { color: inherit; text-decoration: none; }

/* ---- Titulares ---- */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--lh-snug);
  letter-spacing: var(--tracking-display);
  text-wrap: balance;
}

h1 { font-size: var(--fs-display-lg); }
h2 { font-size: var(--fs-display-md); }
h3 { font-size: var(--fs-h3); letter-spacing: -0.018em; }
h4 { font-size: var(--fs-h4); letter-spacing: -0.01em; }

p { text-wrap: pretty; }

strong, b { font-weight: 600; }

::selection {
  background: var(--azure);
  color: #fff;
}

/* ---- Foco visible y consistente ---- */
:focus-visible {
  outline: 2px solid var(--azure-bright);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

.on-dark :focus-visible,
.section--ink :focus-visible {
  outline-color: var(--amber);
}

/* ---- Salto al contenido ---- */
.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: -100px;
  z-index: 1000;
  padding: 0.75rem 1.25rem;
  background: var(--amber);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:focus { top: var(--sp-4); }

/* ==========================================================================
   Layout primitives
   ========================================================================== */

.container {
  width: min(100% - (var(--gutter) * 2), var(--container));
  margin-inline: auto;
}

.container--tight {
  width: min(100% - (var(--gutter) * 2), var(--container-tight));
  margin-inline: auto;
}

.section { padding-block: var(--section-y); }
.section--flush-top { padding-top: 0; }
.section--flush-bottom { padding-bottom: 0; }
.section--sm { padding-block: clamp(3rem, 2rem + 3.5vw, 4.5rem); }

.section--paper { background: var(--paper); }
.section--paper-2 { background: var(--paper-2); }
.section--white { background: var(--white); }

.section--ink {
  background: var(--ink);
  color: var(--text-invert);
}
.section--ink p { color: var(--text-invert-soft); }

.section--navy {
  background: var(--navy);
  color: var(--text-invert);
}
.section--navy p { color: var(--text-invert-soft); }

/* ==========================================================================
   Encabezado de sección — regla vertical + marca ámbar
   El tick codifica jerarquía: sólo lo llevan los bloques de primer nivel.
   ========================================================================== */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--slate);
  margin-bottom: var(--sp-4);
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 2px;
  background: var(--amber);
  flex: none;
}

/* En pantallas muy estrechas el antetítulo parte en dos y deja la marca
   descolgada: se aprieta el interletrado para que quepa en una línea. */
@media (max-width: 420px) {
  .eyebrow {
    font-size: 0.6875rem;
    letter-spacing: 0.1em;
    gap: 0.5rem;
  }
  .eyebrow::before { width: 16px; }
}

.section--ink .eyebrow,
.section--navy .eyebrow,
.on-dark .eyebrow { color: var(--text-invert-soft); }

.section-head {
  max-width: 62ch;
  margin-bottom: clamp(2.5rem, 1.8rem + 2.4vw, 4rem);
}

.section-head--center {
  margin-inline: auto;
  text-align: center;
}
.section-head--center .eyebrow { justify-content: center; }

.section-head p {
  margin-top: var(--sp-4);
  font-size: var(--fs-lead);
  color: var(--text-soft);
  max-width: 58ch;
}
.section-head--center p { margin-inline: auto; }

.section--ink .section-head p,
.section--navy .section-head p { color: var(--text-invert-soft); }

/* ==========================================================================
   Utilidades
   ========================================================================== */

.lead {
  font-size: var(--fs-lead);
  color: var(--text-soft);
  max-width: var(--measure);
}
.section--ink .lead,
.section--navy .lead { color: var(--text-invert-soft); }

.mono {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

/* ---- Justificación ----
   Sólo en bloques de texto anchos y de varias líneas. La partición de palabras
   es obligatoria aquí: justificar sin ella abre ríos de espacio en castellano,
   que tiene palabras largas. El idioma lo toma del `lang` del documento.
   En columnas estrechas se vuelve a alinear a la izquierda, porque ahí ni
   siquiera la partición evita los huecos. */

.prose p,
.legal p,
.legal ul li,
.dossier__body p,
.accordion__panel {
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
  -webkit-hyphens: auto;
}

@media (max-width: 700px) {
  .prose p,
  .legal p,
  .legal ul li,
  .dossier__body p,
  .accordion__panel {
    text-align: left;
    hyphens: manual;
    -webkit-hyphens: manual;
  }
}

.prose > * + * { margin-top: var(--sp-4); }
.prose p { color: var(--text-soft); max-width: var(--measure); }
.prose h2 { margin-top: var(--sp-8); }
.prose h3 { margin-top: var(--sp-6); }
.prose h2 + p, .prose h3 + p { margin-top: var(--sp-3); }

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

.text-center { text-align: center; }
.no-wrap { white-space: nowrap; }

/* ==========================================================================
   Revelado al hacer scroll
   ========================================================================== */

/* El estado oculto sólo se aplica si hay JavaScript para revelarlo. Sin él,
   la clase `js` no llega al documento y todo el contenido se ve de entrada. */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity var(--dur-slow) var(--ease-out),
    transform var(--dur-slow) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
