/* ============================================================
   Shared design tokens + chrome for rachelawhite.com
   Loaded by index.html, calcs.html, swirler.html
   ============================================================ */

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --bg:            #ffffff;
  --bg-subtle:     #f8fafc;
  --surface:       #ffffff;
  --surface-hover: #f1f5f9;

  --text:          #0f172a;
  --text-muted:    #64748b;
  --text-faint:    #94a3b8;

  --border:        #e2e8f0;
  --border-strong: #cbd5e1;

  --accent:        #2563eb;
  --accent-hover:  #1d4ed8;
  --accent-soft:   #eff6ff;
  --accent-border: #bfdbfe;

  /* Chart / data series — distinguishable in both themes and
     for the most common forms of color vision deficiency. */
  --series-1:      #2563eb;  /* blue   — swirl number S */
  --series-2:      #ea580c;  /* orange — Reynolds number */

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgb(15 23 42 / 0.06);
  --shadow:    0 4px 12px -2px rgb(15 23 42 / 0.08), 0 2px 6px -2px rgb(15 23 42 / 0.04);
  --shadow-lg: 0 20px 40px -12px rgb(15 23 42 / 0.16);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;

  --measure: 840px;
  --nav-h: 52px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:            #0b1120;
    --bg-subtle:     #0f172a;
    --surface:       #131c2f;
    --surface-hover: #1c2740;

    --text:          #e6edf7;
    --text-muted:    #94a3b8;
    --text-faint:    #64748b;

    --border:        #1e293b;
    --border-strong: #334155;

    --accent:        #60a5fa;
    --accent-hover:  #93c5fd;
    --accent-soft:   rgb(96 165 250 / 0.12);
    --accent-border: rgb(96 165 250 / 0.30);

    --series-1:      #60a5fa;
    --series-2:      #fb923c;

    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow:    0 4px 12px -2px rgb(0 0 0 / 0.5), 0 2px 6px -2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 20px 40px -12px rgb(0 0 0 / 0.6);
  }
}

/* ── Base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); }

/* One visible focus treatment everywhere, keyboard-only. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ── Shared header ──────────────────────────────────────── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--nav-h);
  padding: 0 clamp(16px, 5vw, 40px);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-nav-inner {
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-nav-brand {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.site-nav-brand .mark {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

@media (max-width: 560px) {
  .site-nav { height: 48px; }
}

/* ── Project sub-nav ────────────────────────────────────
   Second level, used by the three flow-loop pages. Pages set
   their own --measure so this lines up with their container. */
.project-nav {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 26px clamp(16px, 5vw, 40px) 0;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.project-nav .project-nav-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-right: 10px;
}

.project-nav a {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 5px 12px;
  border-radius: 100px;
  border: 1px solid transparent;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.project-nav a:hover { color: var(--text); background: var(--surface-hover); }

.project-nav a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.project-nav .ext::after {
  content: ' \2197';
  font-size: 0.85em;
  opacity: 0.7;
}

@media (max-width: 560px) {
  .project-nav { padding-top: 18px; }
  .project-nav .project-nav-label { width: 100%; margin-bottom: 4px; }
}

/* ── Shared footer ──────────────────────────────────────── */
.site-footer {
  max-width: var(--measure);
  margin: 80px auto 0;
  padding: 24px clamp(16px, 5vw, 40px) 48px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
}

.site-footer a:hover { color: var(--text); }

/* ── Motion ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
