/* ==========================================================================
   Darth Cosmos v2 - base: reset, typography, layout primitives, utilities
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

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

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

img, svg, video, picture { display: block; max-width: 100%; }
img, video { height: auto; }
svg { flex-shrink: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
ul[role="list"], ol[role="list"] { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
table { border-collapse: collapse; width: 100%; }
[hidden] { display: none !important; }

h1, h2, h3, h4, .h1, .h2, .h3, .h4, .display {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: var(--lh-snug);
  letter-spacing: -.03em;
  color: inherit;
  text-wrap: balance;
}
.display, h1, .h1 { font-size: var(--fs-h1); line-height: 1.02; letter-spacing: var(--tracking-h1); }
h2, .h2 { font-size: var(--fs-h2); line-height: 1.1; letter-spacing: var(--tracking-h2); }
h3, .h3 { font-size: var(--fs-h3); line-height: 1.12; letter-spacing: var(--tracking-h3); }
h4, .h4 { font-size: var(--fs-h4); letter-spacing: -.03em; }
h1 em, h2 em, h3 em, .hl { font-style: normal; color: var(--lime); }
h2 .soft, h1 .soft { color: var(--muted); }
p { text-wrap: pretty; }
strong { font-weight: 600; color: var(--text); }

.lead { font-size: var(--fs-lg); line-height: 1.65; color: var(--text-2); }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.accent { color: var(--lime); }
.text-mint { color: var(--good); }

::selection { background: var(--lime); color: var(--lime-ink); }

/* Focus */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; border-radius: 4px; }
.band-lime :focus-visible { outline-color: var(--lime-ink); }

/* Layout */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--narrow { max-width: calc(920px + var(--gutter) * 2); }

.section { padding-block: var(--section-y); position: relative; }
.section--paper, .section--alt { background: var(--bg-2); }
.section--dark { background: var(--bg); }
.section--line { border-top: 1px solid var(--line); }
.section--paper + .section--paper, .section--dark + .section--dark, .section:not([class*="section--"]) + .section:not([class*="section--"]) { border-top: 1px solid var(--line); }
.section--tight { padding-block: clamp(3rem, 2rem + 3vw, 4.5rem); }

.stack > * + * { margin-top: var(--stack, 1rem); }

/* Utilities */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: -100px;
  z-index: 100;
  background: var(--lime); color: var(--lime-ink);
  padding: 12px 18px; border-radius: var(--r-xs);
  font-weight: 650;
  transition: top var(--t-fast);
}
.skip-link:focus { top: 16px; }

.icon { width: 1.25em; height: 1.25em; }
.icon--sm { width: 1em; height: 1em; }

/* Reveal on scroll (JS adds .is-visible; without JS everything shows) */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .8s var(--ease-out), transform .8s var(--ease-out);
  transition-delay: var(--reveal-delay, 0s);
}
.js [data-reveal].is-visible { opacity: 1; transform: none; }
.js [data-reveal="fade"] { transform: none; }
.js [data-reveal="scale"] { transform: scale(.97); }

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