/* ============================================================
   AI4S-Benchmark · Base styles
   ============================================================ */

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

[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Navy behind everything: the header and footer are navy, so any
     overscroll or space past the footer stays in the brand ground. */
  background: var(--navy);
}

body {
  margin: 0;
  /* The footer always reaches the bottom of the viewport, even on short pages */
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body > main { flex: 1 0 auto; }
body > .site-footer { flex-shrink: 0; margin-top: auto; }

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-3);
  color: var(--navy);
  line-height: var(--leading-tight);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1 { font-size: var(--text-3xl); font-weight: 800; letter-spacing: -0.03em; }
h2 { font-size: var(--text-2xl); letter-spacing: -0.025em; }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-md); }

p {
  margin: 0 0 var(--space-4);
}

a {
  color: var(--electric-blue);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}
a:hover { text-decoration: underline; text-underline-offset: 3px; }

ul, ol { margin: 0 0 var(--space-4); padding-left: 1.25rem; }
li { margin-bottom: var(--space-2); }

img, svg { max-width: 100%; height: auto; }

code, kbd, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

pre {
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-4);
  overflow-x: auto;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-6) 0;
}

table {
  border-collapse: collapse;
  width: 100%;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

::selection {
  background: rgba(36, 116, 255, 0.18);
}

/* Skip link */
.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -3rem;
  z-index: 200;
  background: var(--navy);
  color: #fff;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  transition: top var(--dur-fast) var(--ease);
}
.skip-link:focus {
  top: var(--space-3);
  text-decoration: none;
}

/* Layout helpers */
.container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding-inline: var(--gutter);
}
.container--wide { max-width: var(--content-width-wide); }
.container--narrow { max-width: var(--content-width-narrow); }

.section {
  /* One rhythm for every section. Uniform spacing is what reads as tidy;
     the value is the tighter end so the page does not grow. */
  padding-block: clamp(2.25rem, 4vw, 3.5rem);
}
.section--tight { padding-block: clamp(2rem, 3.5vw, 3rem); }

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

/* Mono metadata idiom */
.mono {
  font-family: var(--font-mono);
}
.mono-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--ink-muted);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--electric-blue);
  margin-bottom: var(--space-4);
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}
/* Instrument-label tick before every eyebrow */
.eyebrow::before {
  content: "";
  width: 1.5rem;
  height: 1px;
  background: var(--electric-blue);
  flex-shrink: 0;
}

.lede {
  font-size: var(--text-md);
  color: var(--ink-secondary);
  max-width: 46rem;
}

.text-muted { color: var(--ink-muted); }
.text-secondary { color: var(--ink-secondary); }

.rule {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
}

/* ---- Blueprint textures & precision details ---- */

/* Near-subliminal line grid (light surfaces) */
.bg-grid {
  background-image:
    linear-gradient(var(--grid-line-light) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line-light) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
}

/* Dot matrix variant */
.bg-dots {
  background-image: radial-gradient(circle, rgba(13, 23, 48, 0.08) 1px, transparent 1px);
  background-size: 20px 20px;
}

/* Anchor offset below sticky header */
[id] { scroll-margin-top: calc(var(--header-height) + 1.5rem); }

/* ---- Scroll-reveal system (applied by js/motion.js) ---- */
html.js-motion [data-reveal] {
  opacity: 0;
  transform: translateY(20px);
}
html.js-motion [data-reveal].is-revealed {
  opacity: 1;
  transform: none;
  transition:
    opacity var(--dur-slow) var(--ease-out-expo),
    transform var(--dur-slow) var(--ease-out-expo);
  transition-delay: var(--reveal-delay, 0ms);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html.js-motion [data-reveal] { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
