/* ============================================================
   Shared base: tokens, fonts, reset, the white page and the
   frame every page sits inside. Loaded first on every page.

   The look: a white sheet, one centered column held between two
   full-height hairlines, and content set in sharp 1px boxes with
   a short dark tick at each corner. Labels in the mono face, set
   small and uppercase; everything else in the display face.
   ============================================================ */

@font-face {
  font-family: 'Funnel Display';
  src: url('fonts/funnel-display.woff2') format('woff2');
  font-weight: 300 800;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('fonts/geist-mono.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --ink: #09090b;
  --muted: #6b6f75;
  --faint: #c9cbcf;
  --icon: #8a8d93;
  --icon-hover: var(--ink);
  --hairline: rgba(9, 9, 11, .16);
  --accent: #2b59c3;
  --tick: 9px;          /* length of the corner marks on a box */
  --frame: 46rem;       /* width of the central column */
  --pad: 32px;          /* horizontal inset inside the frame */
  --display: 'Funnel Display', 'Avenir Next', 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --ease: cubic-bezier(.4, 0, .2, 1);
}

/* the lamp off: same sheet, dark. Set by theme.js and remembered. */
html[data-theme="dark"] {
  --bg: #0e0e10;
  --ink: #ececee;
  --muted: #9a9ea6;
  --faint: #3a3c41;
  --icon: #7a7d84;
  --hairline: rgba(236, 236, 238, .16);
  --accent: #7fa2f0;
  color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { background: var(--bg); color-scheme: light; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--display);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------- the frame: one column between two hairlines ---------- */

.frame {
  max-width: var(--frame);
  min-height: 100svh;
  margin: 0 auto;
  border-left: 1px solid var(--hairline);
  border-right: 1px solid var(--hairline);
  display: flex; flex-direction: column;
}

/* header and footer rows sit flush against the frame edges and are
   closed off by a hairline */
.bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 14px var(--pad);
  border-bottom: 1px solid var(--hairline);
}
.bar.foot { border-bottom: 0; border-top: 1px solid var(--hairline); margin-top: auto; }
.bar > :first-child { margin-right: auto; }

/* ---------- the lamp: a banker's lamp that is the light switch ---------- */

/* Lit, the page is white. Pull the chain and the shade dims, the glow
   goes out and the page goes dark. Brass stays brass on both. */
.lamp {
  display: inline-flex; align-items: center;
  padding: 3px; margin: -3px;
  background: none; border: 0; border-radius: 2px;
  cursor: pointer; line-height: 0; color: inherit;
}
.lamp svg { width: 28px; height: 24.5px; overflow: visible; display: block; }
.lamp .brass { fill: #b8924c; }
.lamp .chain { stroke: #b8924c; stroke-width: .8; stroke-linecap: round; }
.lamp .rim   { stroke: #8f6d33; stroke-width: 1.2; }
.lamp .shade { fill: #1f8f4e; transition: fill .25s var(--ease); }
.lamp .sheen { fill: #ffffff; opacity: .22; transition: opacity .25s var(--ease); }
.lamp .glow  { transition: opacity .25s var(--ease); }
.lamp:hover .shade, .lamp:focus-visible .shade { fill: #26a05a; }
.lamp:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }
html[data-theme="dark"] .lamp .shade { fill: #2a5a3d; }
html[data-theme="dark"] .lamp:hover .shade, html[data-theme="dark"] .lamp:focus-visible .shade { fill: #326a48; }
html[data-theme="dark"] .lamp .sheen { opacity: .08; }
html[data-theme="dark"] .lamp .glow  { opacity: 0; }

/* ---------- labels: the mono face, small and uppercase ---------- */

.label {
  font-family: var(--mono);
  font-size: 11.5px; font-weight: 500;
  letter-spacing: .06em; text-transform: uppercase;
  line-height: 1.4;
  color: var(--ink);
  hyphens: none;
}
.label.muted { color: var(--muted); }
a.label { text-decoration: none; transition: color .15s var(--ease); }
a.label:hover, a.label:focus-visible { color: var(--accent); }

/* ---------- the box ---------- */

/* A 1px hairline outline with a short solid tick at each corner. The
   ticks are eight background layers painted over the border, so no
   extra markup is needed and nesting works. */
.box {
  position: relative;
  border: 1px solid var(--hairline);
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--ink), var(--ink)), linear-gradient(var(--ink), var(--ink)),
    linear-gradient(var(--ink), var(--ink)), linear-gradient(var(--ink), var(--ink)),
    linear-gradient(var(--ink), var(--ink)), linear-gradient(var(--ink), var(--ink)),
    linear-gradient(var(--ink), var(--ink)), linear-gradient(var(--ink), var(--ink));
  background-position:
    0 0,       0 0,
    100% 0,    100% 0,
    0 100%,    0 100%,
    100% 100%, 100% 100%;
  background-size:
    var(--tick) 1px, 1px var(--tick),
    var(--tick) 1px, 1px var(--tick),
    var(--tick) 1px, 1px var(--tick),
    var(--tick) 1px, 1px var(--tick);
  background-repeat: no-repeat;
  background-origin: border-box;
  background-clip: border-box;
}

/* ---------- small screens ---------- */

@media (max-width: 600px) {
  :root { --pad: 16px; }
  .frame { border-left: 0; border-right: 0; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
