/* styles.css — shared stylesheet for index.html, work.html, case-study.html.
 *
 * Owns three things:
 *   1. The base reset + interaction affordances (was a duplicated <style> block per page).
 *   2. The design tokens (petrol palette, type, spacing) on #siteRoot — one place to re-theme.
 *   3. All responsive LAYOUT via media queries. These rules replace the old JS resize
 *      handlers (wireNavResponsive / wireResponsiveGrids), so layout no longer flashes on
 *      load, stays correct if JS fails, and breakpoints live next to the rules they change.
 *
 * Everything else (component-level visual styling) remains inline in the markup by design —
 * it is static per element and doesn't vary by viewport. Only what CHANGES lives here.
 */

/* ---- 1. Reset + interaction base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { margin: 0; }
::selection { background: #0E4C5A; color: #fff; }
img, svg { display: block; max-width: 100%; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent-bright, #42879A);
  outline-offset: 3px;
}
a, button {
  transition: transform 0.12s ease, filter 0.15s ease, opacity 0.15s ease,
              color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
a:active, button:active { transform: translateY(2px) scale(0.97); filter: brightness(0.86); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  a:active, button:active { transform: none; }
}
@keyframes rd-marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---- 2. Design tokens + page shell ---- */
#siteRoot {
  --display: 'Newsreader', Georgia, serif;
  --body: 'Public Sans', system-ui, sans-serif;
  --ink: #181315;
  --ink-deep: #100C0E;
  --paper: #F4EFEA;
  --paper-mid: #EBE3DB;
  --accent: #0E4C5A;          /* deep petrol */
  --accent-bright: #42879A;   /* mid petrol */
  --accent-on-paper: #0E4C5A;
  --btn-text: #F4EFEA;
  --grey: #3A322F;
  --muted-ink: #C4B7AD;
  --err: #F08C8C;
  --wordmark: rgba(66, 135, 154, 0.13);
  --pad-x: clamp(1.25rem, 6vw, 7rem);
  --pad-y: clamp(3.5rem, 8vw, 8rem);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--body);
  overflow-x: hidden;
  min-height: 100vh;
}

/* ---- 3. Responsive layout (replaces the JS resize handlers) ---- */

/* Nav: desktop link row vs. mobile hamburger (all pages) */
#navLinks { display: flex; }
#navToggle { display: none; }
@media (max-width: 640px) {
  #navLinks { display: none; }
  #navToggle { display: flex; }
}

/* index.html — About / stat band / Writing grids */
#statBand { grid-template-columns: repeat(4, 1fr); }
#aboutGrid { grid-template-columns: 200px 1fr 1fr; }
#aboutStats { flex-direction: column; }
#aboutPhotoWrap { position: sticky; top: 6rem; }
#writingInner { grid-template-columns: 1fr 1fr; }

@media (max-width: 900px) {
  /* 4-up stat band overflows on narrow screens: go 2x2 */
  #statBand { grid-template-columns: 1fr 1fr; }
  #aboutGrid { grid-template-columns: 140px 1fr; }
  #aboutStats { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
  #aboutPhotoWrap { position: static; }
  #writingInner { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  #aboutGrid { grid-template-columns: 1fr; }
  #aboutStats { flex-direction: column; flex-wrap: nowrap; }
  #aboutPhotoWrap { max-width: 180px; margin: 0 auto 1.5rem; }
}

/* ---- Hero scroll cue: dotted track + descending node ----
 * Same visual grammar as the hero graph's dotted links: the page itself is
 * one more connection in the system. Reduced motion: dot rests at the foot
 * of the track (direction still implied, nothing moves). */
#scrollCue {
  position: absolute;
  bottom: 1.6rem;
  left: var(--pad-x);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  z-index: 1;
}
#scrollCueTrack {
  position: relative;
  display: block;
  width: 1px;
  height: 48px;
  background-image: repeating-linear-gradient(
    to bottom, rgba(244, 239, 234, 0.45) 0, rgba(244, 239, 234, 0.45) 1px, transparent 1px, transparent 6px);
}
#scrollCueDot {
  position: absolute;
  left: -2px;
  top: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-bright);
  box-shadow: 0 0 6px var(--accent-bright);
  animation: rd-scroll-dot 2.4s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}
#scrollCueLabel {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--paper);
  opacity: 0.55;
}
@keyframes rd-scroll-dot {
  0%   { transform: translateY(0);    opacity: 0; }
  12%  { opacity: 1; }
  78%  { opacity: 1; }
  100% { transform: translateY(44px); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  #scrollCueDot { animation: none; top: auto; bottom: -2px; opacity: 1; }
}
