/* ============================================================
   LONGEVITY STUDIO — BASE
   Reset · element typography · layout primitives · a11y
   ============================================================ */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  font-weight: 400;
  color: var(--text-body);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

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

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

/* ---- Headings: Fraunces, light weights (deck: hero 200, titles 300).
        Hierarchy via scale + space, not weight or colour. ---- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 300;
  font-variation-settings: var(--display-vary);
  line-height: var(--lh-snug);
  letter-spacing: var(--track-tight);
  text-wrap: balance;
  color: var(--text);
}
h1 { font-size: var(--fs-h1); line-height: var(--lh-tight); font-weight: 280; }
h2 { font-size: var(--fs-h2); font-weight: 300; }
h3 { font-size: var(--fs-h3); font-weight: 320; }
h4 { font-size: var(--fs-h4); line-height: var(--lh-snug); font-weight: 360; }

p { max-width: var(--maxw-text); }

strong { font-weight: 500; }
em { font-style: italic; }

/* ============================================================
   LAYOUT PRIMITIVES
   ============================================================ */

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--wide { max-width: none; padding-inline: var(--gutter); }

.section { padding-block: var(--section-y); }
.section--tight { padding-block: clamp(48px, 4vw, 96px); }

/* 12-column grid — the structural drawing grid */
.grid {
  display: grid;
  /* minmax(0,1fr) lets tracks shrink below child min-content (prevents overflow) */
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--col-gap);
  row-gap: var(--col-gap);
}

/* Column span helpers (desktop).
   Span is carried on the END line so an explicit .start-* does not
   clobber it (grid has 13 lines for 12 columns). */
.col-1{grid-column-end:span 1}.col-2{grid-column-end:span 2}.col-3{grid-column-end:span 3}
.col-4{grid-column-end:span 4}.col-5{grid-column-end:span 5}.col-6{grid-column-end:span 6}
.col-7{grid-column-end:span 7}.col-8{grid-column-end:span 8}.col-9{grid-column-end:span 9}
.col-10{grid-column-end:span 10}.col-11{grid-column-end:span 11}.col-12{grid-column-end:span 12}
.start-2{grid-column-start:2}.start-3{grid-column-start:3}.start-4{grid-column-start:4}
.start-5{grid-column-start:5}.start-6{grid-column-start:6}.start-7{grid-column-start:7}
.start-8{grid-column-start:8}.start-9{grid-column-start:9}

@media (max-width: 900px) {
  /* One rule so an explicit start-* cannot leave a col-* element 1 track wide */
  [class*="col-"], [class*="start-"] { grid-column: 1 / -1; }
}

/* ---- Architectural rule lines (plan/section/elevation logic) ---- */
.rule { border: 0; border-top: 1px solid var(--line); width: 100%; }
.rule--strong { border-top-color: var(--line-strong); }
.rule--oak { border-top: 1px solid var(--accent-rule); }
.rule--v { border-left: 1px solid var(--line); width: 0; align-self: stretch; }

/* ============================================================
   TYPOGRAPHIC UTILITIES
   ============================================================ */

/* Mono eyebrow / index labels — the "drawing annotation" voice */
.label {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  font-weight: 400;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-faint);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
}
.label--ink { color: var(--text-muted); }
.label__index { color: var(--accent); }

.lead {
  font-size: var(--fs-lead);
  line-height: 1.42;
  letter-spacing: -0.005em;
  max-width: 48ch;
  color: var(--text);
}

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.serif { font-family: var(--font-display); }
.accent-word { color: var(--accent); font-style: italic; }

.measure { max-width: var(--maxw-text); }
.measure-sm { max-width: 46ch; }

/* ---- Skip link ---- */
.skip-link {
  position: absolute; left: var(--sp-4); top: -120px;
  background: var(--ink); color: var(--bone);
  padding: var(--sp-3) var(--sp-5);
  font-family: var(--font-mono); font-size: var(--fs-xs);
  letter-spacing: var(--track-label); text-transform: uppercase;
  z-index: 1000; transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: var(--sp-4); }

/* ---- Focus visibility ---- */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

/* ---- Reveal-on-scroll (progressive enhancement).
   Only hidden when JS is confirmed running (.js on <html>); without JS
   — or if the observer never fires — content stays fully visible. ---- */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
}
.js [data-reveal].is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; transform: none; }
}

.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;
}
