/* Shared design tokens, fonts, header and footer for every page of Beautiful Brain.
   This file is the single source of colours, type, spacing, surfaces and motion: the page
   stylesheets (styles.css, reasoning/style.css, app/me/me.css, app/globals.css) load after it
   and use these variables instead of their own values. See design-refs/design-brief.md. */

/* Fonts, all self-hosted under the SIL Open Font License (licences in /assets). */
@font-face{font-family:DM;src:url(/assets/dm-normal-400.woff);font-display:swap}
@font-face{font-family:DM;src:url(/assets/dm-normal-500.woff);font-weight:500;font-display:swap}
@font-face{font-family:DM;src:url(/assets/dm-normal-600.woff);font-weight:600;font-display:swap}
@font-face{font-family:DM;src:url(/assets/dm-normal-700.woff);font-weight:700;font-display:swap}
@font-face{font-family:Newsreader;src:url(/assets/newsreader-opsz-normal.woff2) format("woff2");font-weight:200 800;font-display:swap}
@font-face{font-family:Newsreader;src:url(/assets/newsreader-opsz-italic.woff2) format("woff2");font-weight:200 800;font-style:italic;font-display:swap}
/* Instrument Serif is kept for the "Beautiful Brain" wordmark only. */
@font-face{font-family:Instrument;src:url(/assets/instrument-normal-400.woff);font-display:swap}
@font-face{font-family:Instrument;src:url(/assets/instrument-italic-400.woff);font-style:italic;font-display:swap}

:root{
  /* Colour */
  --paper:#faf9f5;            /* page */
  --surface:#fff;             /* cards, panels, dialogs, inputs */
  --surface-sunken:#f3f1ec;   /* banded sections, footer */
  --hover-tint:#efede6;       /* quiet hover fill for icon and secondary buttons */
  --rule:#e6e3db;             /* hairlines and card borders */
  --rule-strong:#8f8a7f;      /* text fields (3:1 against white) */
  --rule-control:#cdc8bd;     /* answer options, which are also marked by a radio or letter */
  --ink:#1b1a17;
  --ink-hover:#3a3833;
  --muted:#57534b;            /* secondary text */
  --subtle:#6e6a62;           /* meta lines and captions */
  --blue:#28469d;             /* brand cobalt: highlights, selection, progress, focus */
  --blue-tint:#e9edf6;
  --orange:#dc6a43;           /* primary buttons and accents */
  --orange-hover:#e47e5a;
  --orange-ink:#a9482a;       /* orange used as text */
  --on-orange:#1b1a17;
  --on-dark:#fff;             /* text on ink and cobalt fills */
  --error:#a8321a;
  --success-tint:var(--tone-green-tint);
  --warn-tint:var(--tone-peach-tint);
  --backdrop:rgb(27 26 23 / 40%);   /* behind open dialogs */
  --focus-glow:rgb(40 70 157 / 15%); /* soft ring around a focused text field */

  /* Illustration details (hero brain and question tiles) */
  --grid-line:#5d6a6d14;      /* graph-paper lines behind the hero brain */
  --halo:#faf9f594;           /* paper-coloured ring around the callout dots */
  --tile-line:#6d6f64;        /* outline of pattern tiles in questions */
  --tile-dot:#a9aba0;         /* empty dots in pattern tiles */

  /* Type */
  --serif:Newsreader,Georgia,serif;
  --brand-serif:Instrument,Georgia,serif;
  --sans:DM,Arial,sans-serif;
  --mono:ui-monospace,"SFMono-Regular",Menlo,monospace; /* number sequences in questions */
  --text-display:clamp(3.25rem,6.4vw,5.75rem);
  --text-h1:clamp(2.6rem,4.8vw,4.25rem);
  --text-h2:clamp(2.1rem,3.4vw,3rem);
  --text-h3:1.625rem;
  --text-question:clamp(1.75rem,3.2vw,2.4rem);
  --text-lead:clamp(1.2rem,1.6vw,1.4rem);
  --text-reading:1.25rem;
  --text-body:1.0625rem;
  --text-small:.9375rem;
  --text-label:.75rem;
  --leading-tight:1.04;
  --leading-heading:1.12;
  --leading-body:1.6;
  --leading-reading:1.7;
  --tracking-display:-.025em;
  --tracking-heading:-.018em;
  --tracking-label:.1em;

  /* Space (4 px base) */
  --space-1:4px;--space-2:8px;--space-3:12px;--space-4:16px;--space-5:24px;
  --space-6:32px;--space-7:48px;--space-8:64px;--space-9:96px;--space-10:128px;
  --section-space:var(--space-9);

  /* Layout */
  --container:1200px;
  --gutter:clamp(20px,5.5vw,72px);
  --measure:680px;

  /* Surfaces */
  --radius-sm:6px;--radius-md:10px;--radius-lg:14px;--radius-xl:18px;--radius-pill:999px;
  --accent-bar:4px;
  --shadow-sm:0 1px 2px rgb(27 26 23 / 4%);
  --shadow-md:0 10px 30px -12px rgb(27 26 23 / 18%);
  --shadow-lg:0 24px 70px -20px rgb(27 26 23 / 30%);

  /* Motion */
  --ease:cubic-bezier(.2,.7,.2,1);
  --dur-fast:160ms;--dur:240ms;--dur-slow:320ms;

  /* Focus */
  --focus-ring:2px solid var(--blue);
  --focus-offset:3px;
}

/* Tones: a tint for tiles and tags, an accent for the top bar, the motif colour (--art, unchanged
   from before the redesign) and a text colour that meets AA on the tint. */
:root{
  --tone-blue-tint:#e9edf6;--tone-blue-accent:#5b74c2;--tone-blue-art:#284b9f;--tone-blue-ink:#284b9f;
  --tone-peach-tint:#f8ebe4;--tone-peach-accent:#dc6a43;--tone-peach-art:#a84e2d;--tone-peach-ink:#9a4526;
  --tone-green-tint:#e8efe5;--tone-green-accent:#6f9a7c;--tone-green-art:#4a7052;--tone-green-ink:#3f6449;
  --tone-sand-tint:#efe9dc;--tone-sand-accent:#b08a52;--tone-sand-art:#7a5a2e;--tone-sand-ink:#7a5a2e; /* reasoning "space" badge */
}
.blue{--tint:var(--tone-blue-tint);--accent:var(--tone-blue-accent);--art:var(--tone-blue-art);--tone-ink:var(--tone-blue-ink)}
.peach{--tint:var(--tone-peach-tint);--accent:var(--tone-peach-accent);--art:var(--tone-peach-art);--tone-ink:var(--tone-peach-ink)}
.green{--tint:var(--tone-green-tint);--accent:var(--tone-green-accent);--art:var(--tone-green-art);--tone-ink:var(--tone-green-ink)}

@media(max-width:960px){:root{--section-space:var(--space-8)}}
@media(max-width:720px){:root{--section-space:var(--space-7);--text-h3:1.5rem;--text-reading:1.15rem}}
@media(prefers-reduced-motion:reduce){:root{--dur-fast:0ms;--dur:0ms;--dur-slow:0ms}}

/* Layout */
.site-wrap{width:min(var(--container),100% - 2*var(--gutter));margin-inline:auto}

/* Header */
.site-header{position:relative;z-index:10;border-bottom:1px solid var(--rule);background:var(--paper);color:var(--ink);font-family:var(--sans)}
.site-bar{display:flex;align-items:center;gap:var(--space-6);height:76px}
.site-brand{display:inline-flex;align-items:center;gap:10px;margin-right:auto;color:inherit;text-decoration:none;font:500 1.9rem/.98 var(--brand-serif);letter-spacing:-.045em;white-space:nowrap}
/* The mark's 300 × 205 canvas has a transparent margin around the brain (about 10% at the sides,
   9% top, 8% bottom). Negative margins trim it from the layout so the brain sits next to the name. */
.site-brand img{display:block;width:60px;height:auto;margin:-4px -6px -3px}
.site-nav{display:flex;align-items:center;gap:var(--space-6)}
.site-nav a{color:inherit;font-size:var(--text-small);font-weight:500;text-decoration:none;text-decoration-color:transparent;text-decoration-thickness:2px;text-underline-offset:8px;transition:text-decoration-color var(--dur-fast) var(--ease)}
.site-nav a:hover,.site-nav a[aria-current]{text-decoration:underline;text-decoration-color:var(--orange)}
.site-header .site-cta{display:inline-flex;align-items:center;justify-content:center;min-height:40px;border:0;border-radius:var(--radius-md);padding:0 18px;background:var(--ink);color:var(--on-dark);font:600 .875rem/1.1 var(--sans);text-decoration:none;white-space:nowrap;cursor:pointer;transition:background var(--dur-fast) var(--ease)}
.site-header .site-cta:hover{background:var(--ink-hover)}
.site-account{display:flex;align-items:center;gap:var(--space-4);margin:0;font-size:.875rem;color:var(--subtle)}
.site-menu-button{display:none;align-items:center;justify-content:center;width:44px;height:44px;margin-right:-10px;padding:0;border:0;border-radius:var(--radius-md);background:transparent;color:inherit;cursor:pointer;transition:background var(--dur-fast) var(--ease)}
.site-menu-button:hover{background:var(--hover-tint)}
.site-menu-button svg{width:22px;height:22px}
.site-menu-button .close-icon,.site-header.is-open .site-menu-button .open-icon{display:none}
.site-header.is-open .site-menu-button .close-icon{display:block}
.site-header :focus-visible,.site-footer :focus-visible{outline:var(--focus-ring);outline-offset:var(--focus-offset);border-radius:2px}

/* Footer: one row, brand and tagline on the left, links on the right */
.site-footer{border-top:1px solid var(--rule);background:var(--surface-sunken);color:var(--ink);font-family:var(--sans)}
.site-footer-row{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-4) var(--space-7);padding-block:var(--space-7)}
.site-footer .site-brand{font-size:1.45rem}
.site-footer .site-brand img{width:46px;margin:-3px -4px -2px}
.site-tagline{color:var(--subtle)}
.site-footer-links{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-3) var(--space-6)}
.site-footer nav{display:flex;flex-wrap:wrap;gap:var(--space-3) var(--space-5)}
.site-footer a{color:inherit;text-decoration:none;transition:color var(--dur-fast) var(--ease)}
.site-footer a:hover{color:var(--orange-ink)}
.site-footer nav a{font-size:var(--text-small);font-weight:500}
.site-footer-contact{padding-left:var(--space-6);border-left:1px solid var(--rule)}
.site-footer .site-footer-contact a{color:var(--muted);font-weight:400}
.site-footer .site-footer-contact a:hover{color:var(--orange-ink)}

/* Short pages (sign-in, Philosophy, 404) keep the footer at the bottom of the window. */
body:has(> .site-footer),.me{display:flex;flex-direction:column;min-height:100vh}
body > .site-footer,.me > .site-footer{margin-top:auto}

.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}

@media(max-width:960px){.site-bar{height:72px;gap:var(--space-5)}}
@media(max-width:720px){
  .site-bar{height:64px;gap:var(--space-3)}
  .site-brand{font-size:1.65rem}
  .site-brand img{width:52px;margin:-3px -5px -3px}
  .site-header .site-cta{min-height:38px;padding:0 14px;font-size:.84rem}
  .site-account span{display:none}
  .site-menu-button{display:inline-flex}
  .site-nav{display:none;position:absolute;top:100%;left:0;right:0;flex-direction:column;align-items:stretch;gap:0;padding:var(--space-1) var(--gutter) var(--space-4);background:var(--paper);border-bottom:1px solid var(--rule);box-shadow:var(--shadow-md)}
  .site-header.is-open .site-nav{display:flex}
  .site-nav a{padding:15px 0;font-size:1.05rem;border-bottom:1px solid var(--rule)}
  .site-nav a:last-child{border-bottom:0}
  .site-footer-row{gap:var(--space-5);padding-block:var(--space-6)}
  .site-footer .site-brand{font-size:1.3rem;white-space:normal}
  .site-footer .site-brand img{width:42px;margin:-3px -4px -2px}
  .site-footer-links{display:grid;grid-template-columns:auto auto;justify-content:start;align-items:start;gap:0 var(--space-6);width:100%}
  .site-footer nav{flex-direction:column;gap:var(--space-3)}
  .site-footer-contact{padding-left:var(--space-5)}
}
