/* The site's chrome: design tokens (colours, type), the header and the footer. Served as
   /chrome.css, outside the bundle, because the Ethica edition under /ethica/ uses it too:
   its pages have their own stylesheet, written in terms of these tokens, and the
   ethica-frame integration adds this file, the header and the footer to them. So every
   rule here is either a token or scoped to the header and footer.
   Everything else is in src/styles/global.css. */

:root {
  /* Colours: dark sky by default. The light theme below applies when the visitor's
     system prefers light (and they haven't picked dark), or when they pick light. */
  color-scheme: dark;
  --bg: #0A0C11;
  --bg-deep: #07080C;
  --surface: #12151C;
  --line: #232836;
  --line-strong: #5E6678; /* 3:1 on --bg and --surface, the minimum for control borders */
  --text: #ECE9E2;
  --text-2: #CFCCC5; /* prose and panel copy */
  --muted: #A3A9B5;
  --faint: #8C93A0;
  --accent: #E2B862;
  --accent-line: rgba(226, 184, 98, .5); /* link underlines */
  --signal-ok: #6FCF97;
  --figure-ground: #FFFFFF; /* white plate behind transparent plots in notes */
  --shadow-popover: 0 12px 32px rgba(0, 0, 0, .45);
  /* Text sizes. Sans: four steps. Mono (dates, ids, labels): three. */
  --fs-lede: 19px;
  --fs-body: 17px;
  --fs-small: 15px;
  --fs-fine: 13px;
  --fs-mono: 13px;
  --fs-meta: 12px;
  --fs-label: 11px;
  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}


/* Light theme ("daylight"): same roles, re-tuned so every text colour keeps 4.5:1 on
   --bg, --bg-deep and --surface, and --line-strong keeps 3:1 on --bg and --surface.
   The gold darkens to stay readable as text. Defined twice so the toggle wins either way. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #F6F5F1;
    --bg-deep: #ECEAE4;
    --surface: #FFFFFF;
    --line: #DDDBD3;
    --line-strong: #848B98;
    --text: #15171D;
    --text-2: #363941;
    --muted: #565C67;
    --faint: #616874;
    --accent: #845F10;
    --accent-line: rgba(132, 95, 16, .45);
    --signal-ok: #1D7543;
    --shadow-popover: 0 12px 32px rgba(21, 23, 29, .14);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #F6F5F1;
  --bg-deep: #ECEAE4;
  --surface: #FFFFFF;
  --line: #DDDBD3;
  --line-strong: #848B98;
  --text: #15171D;
  --text-2: #363941;
  --muted: #565C67;
  --faint: #616874;
  --accent: #845F10;
  --accent-line: rgba(132, 95, 16, .45);
  --signal-ok: #1D7543;
  --shadow-popover: 0 12px 32px rgba(21, 23, 29, .14);
}

/* What the header and footer take from the page around them on this site (the body and
   link styles in global.css), restated for them alone so that they look the same on the
   edition's pages. */
.site-header, .site-footer, .site-header *, .site-footer * { box-sizing: border-box; }
.site-header, .site-footer { font-family: var(--sans); font-size: var(--fs-body); line-height: 1.6; color: var(--text); -webkit-font-smoothing: antialiased; }
.site-header a, .site-footer a { color: var(--text); text-decoration-color: var(--accent-line); text-underline-offset: 3px; }
.site-header a:hover, .site-footer a:hover { color: var(--accent); }
.site-header :focus-visible, .site-footer :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.site-footer .label { font-family: var(--mono); font-size: var(--fs-label); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }

.wrap { max-width: 1180px; margin: 0 auto; padding-inline: 32px; }
@media (max-width: 600px) { .wrap { padding-inline: 16px; } }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; background: var(--surface); padding: 8px 12px; z-index: 10; }

/* Header */
.site-header .wrap { padding-block: 28px; display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: baseline; justify-content: space-between; }
.wordmark { font-family: var(--serif); font-size: 28px; text-decoration: none; color: var(--text); }
.site-nav { display: flex; flex-wrap: wrap; gap: 8px 28px; font-size: var(--fs-small); letter-spacing: .04em; }
.site-nav a { text-decoration: none; color: var(--muted); }
.site-nav a[aria-current="page"] { color: var(--text); }
.site-nav a.cv { color: var(--accent); }
.site-nav a:hover { color: var(--accent); }
.theme-toggle { padding: 0; border: 0; background: none; font: inherit; letter-spacing: inherit; color: var(--muted); cursor: pointer; }
.theme-toggle:hover { color: var(--accent); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-deep); }
.site-footer .wrap { padding-block: 56px 40px; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 32px; font-size: var(--fs-small); color: var(--muted); }
.site-footer p { margin: 0; }
.site-footer .stack { display: flex; flex-direction: column; gap: 4px; }
.site-footer .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--signal-ok); margin-right: 8px; }

.site-footer .colophon { margin: 0 auto; padding-block: 0 32px; font-family: var(--mono); font-size: var(--fs-meta); color: var(--faint); }
/* Footer link list in two balanced columns (one column on very narrow screens). */
.site-footer .two-col { display: grid; grid-auto-flow: column; grid-template-columns: repeat(2, max-content); gap: 4px 48px; }
.site-footer .two-col a { width: fit-content; }
@media (max-width: 360px) { .site-footer .two-col { grid-auto-flow: row; grid-template-columns: 1fr; grid-template-rows: none !important; } }
