/* ==================================================================
   The shell
   ================================================================== */

/* Font licence and provenance: fonts/LICENSE.txt */

@font-face {
  font-family: 'Roboto Mono';
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url(../fonts/roboto-mono-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light dark;

  /* --- ink and paper --- */
  --black: #000;
  --white: #fff;
  --ink-900: #111;
  --paper-50: #fcfbfa;
  --ink-050: #f2f0ee;
  --paper-950: #0a0a0a;

  /* --- the accent ramp. Measured contrast, AA wants 4.5:1 --- */
  --accent-300: #f89;       /* 9.23:1 on #000 */
  --accent-400: #f67;       /* 7.42:1 on #000, 6.99:1 on #0a0a0a */
  --accent-600: #d24;       /* 4.79:1 on #fff, 4.63:1 on #fcfbfa */
  --accent-800: #b23;       /* 6.20:1 on #fff */

  /* --- semantic: light surface (default) --- */
  --surface: var(--paper-50);
  --surface-raised: var(--white);
  --text: var(--ink-900);
  --rule: rgba(17, 17, 17, .14);
  --link: var(--accent-600);
  --link-hover: var(--accent-800);
  --focus-ring: var(--accent-600);
  --selection: var(--accent-300);

  /* --- type --- */
  --font: 'Roboto Mono', ui-monospace, Menlo, monospace;

  /* The one small text style: readout, description, captions, field
     label, and the address box. */
  --meta-size: .75rem;
  --meta-tracking: .02em;
  --text-xs:   .75rem;
  --text-sm:   .875rem;
  --text-base: 1.0625rem;
  --text-lg:   1.25rem;
  --text-xl:   1.5625rem;
  --text-2xl:  1.953rem;
  --text-3xl:  2.441rem;
  --text-4xl:  3.052rem;
  --leading-tight: 1.15;
  --leading-snug: 1.35;
  --leading-normal: 1.75;
  --measure: 65ch;

  /* --- spacing, 4px base --- */
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;

  /* --- borders and radius --- */
  --border-width: 1px;
  --border-width-thick: 2px;
  --radius-sm: 2px;

  /* --- z-index --- */
  --z-base: 0;
  --z-raised: 10;
  --z-sticky: 100;
  --z-header: 1000;
  --z-overlay: 10000;

  /* --- motion --- */
  --duration-fast: .18s;
  --duration-slow: 1s;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);

  /* --- shell --- */
  --shell-max: 1560px;
  --shell-pad: 1rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface: var(--paper-950);
    --surface-raised: var(--black);
    --text: var(--ink-050);
    --rule: rgba(242, 240, 238, .18);
    --link: var(--accent-400);
    --link-hover: var(--accent-300);
    --focus-ring: var(--accent-400);
    --selection: var(--accent-600);
  }
}

@media (max-width: 767px) {
  :root { --shell-pad: .5rem; }
}

/* ==================================================================
   Base
   ================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-weight: 300;
  font-size: var(--meta-size);
  line-height: var(--leading-normal);
  padding-bottom: var(--space-8);
}

::selection { background: var(--selection); color: var(--ink-900); }

img, svg, video, canvas, iframe { max-width: 100%; vertical-align: middle; }

/* A video needs this said out loud, or its height attribute is taken
   as a pixel height and the frame stretches. */
img, video { height: auto; }

h1, h2, h3, h4 { font-family: var(--font); font-weight: 700; }

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: .22em;
  text-decoration-skip-ink: none;
  transition: text-decoration-thickness var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--link-hover);
  text-decoration-thickness: 3px;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==================================================================
   Skip link — first in tab order on every page
   ================================================================== */

.skip-link {
  position: absolute;
  left: var(--space-2);
  top: var(--space-2);
  z-index: var(--z-overlay);
  padding: var(--space-2) var(--space-4);
  font-size: var(--meta-size);
  letter-spacing: var(--meta-tracking);
  background: var(--surface-raised);
  color: var(--text);
  border: var(--border-width-thick) solid var(--focus-ring);
  text-decoration: none;
  transform: translateY(-250%);
  transition: transform var(--duration-fast) var(--ease-out);
}

.skip-link:focus { transform: translateY(0); }

/* Jump targets are out of the Tab order and only ever focused on
   purpose by js/jump.js, so they draw no ring. */

[tabindex="-1"]:focus { outline: none; }

/* ==================================================================
   Shell: running head, footer
   ================================================================== */

.shell {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding-left: var(--shell-pad);
  padding-right: var(--shell-pad);
}

.masthead {
  display: flex;
  align-items: center;
  gap: var(--space-4) var(--space-8);
  flex-wrap: wrap;
  padding-top: 1.1rem;
  padding-bottom: 1.3rem;
}

.masthead__home {
  display: block;
  line-height: 0;
}

.masthead__home img { width: 32px; height: 32px; }

.masthead__social { margin-inline-start: auto; }

/* Pull the 32px hit areas out so the icons line up with the shell edge. */
.masthead__social .social { margin-inline-end: -4px; }

.site-footer {
  margin-top: var(--space-8);
  padding-top: var(--space-8);
  border-top: var(--border-width) solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: center;
  justify-content: space-between;
  font-weight: 400;
}

.site-footer__place {
  margin: 0;
  font-size: .72rem;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.site-footer--center {
  flex-direction: column;
  justify-content: center;
}

/* --- social icons --------------------------------------------------
   Each link is a 32px square around a 24px mark, over the target
   floor. */

.social {
  margin: 0;
  padding: 0;
  list-style-type: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
}

.social__link {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--text);
  transition: color var(--duration-fast) var(--ease-out);
}

.social__link:hover { color: var(--link-hover); }

.social__icon {
  display: block;
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* ==================================================================
   Page head — every page after the homepage
   ================================================================== */

.sheet-head {
  padding-top: var(--space-8);
  padding-bottom: var(--space-4);
}

.sheet-head__title {
  margin: 0 0 .9rem;
  font-size: 2.2rem;
  line-height: var(--leading-tight);
  letter-spacing: -.015em;
}

.sheet-head__lede {
  margin: 0 0 1.2rem;
  font-size: 1.32rem;
  line-height: 1.62;
  max-width: var(--measure);
}

/* ==================================================================
   Section label
   ==================================================================
   Sizes and margins belong to the page that uses it. A muted gray at
   this size measures near 2.5:1 and fails AA, so it stays at full ink.
   ================================================================== */

.label {
  font-family: var(--font);
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  text-align: left;
}

/* ==================================================================
   Components — shared by the pieces and /design
   ================================================================== */

/* --- the square control --------------------------------------------
   The caption is the accessible name, since the glyph can be
   abstract. The fill hangs off .is-on rather than aria-pressed: the
   caption already flips (Play becomes Pause), and aria-pressed on top
   of that announces the state twice. */

.control {
  flex: none;
  width: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
}

.control__btn {
  width: 100%;
  height: 40px;
  padding: 0;
  border: var(--border-width-thick) solid var(--text);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}

.control__btn:hover { background: var(--text); color: var(--surface); }

.control__btn.is-on {
  background: var(--text);
  color: var(--surface);
}

.control__mark {
  display: block;
  font-family: var(--font);
  font-size: 1.2rem;
  line-height: 1;
  font-weight: 400;
}

.control__mark--align {
  text-box: trim-start cap alphabetic;
}

.control__mark svg { display: block; fill: currentColor; width: 13px; height: 14px; }

.control__caption {
  font-size: var(--meta-size);
  font-weight: 400;
  letter-spacing: var(--meta-tracking);
  text-transform: lowercase;
  text-align: center;
  white-space: nowrap;
}

@keyframes control-turn {
  from { transform: rotate(0turn); }
  to   { transform: rotate(1turn); }
}

.control__mark--turning {
  animation: control-turn .5s var(--ease-out) 1;
}

/* --- the motion gate ------------------------------------------------
   The layout hangs off [open]. A closed dialog is display: none by the
   browser's own rules, and a bare .gate { display: grid } would beat
   that and leave the warning on the screen. */

.gate {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  padding: var(--space-4);
  background: var(--surface);
  color: var(--text);
  overflow-y: auto;
}

.gate[open] {
  display: grid;
  place-items: center;
}

.gate::backdrop { background: rgb(0 0 0 / .7); }

.gate__panel {
  border: var(--border-width-thick) solid var(--text);
  padding: 1.6rem;
  max-width: 52ch;
  background: var(--surface);
}

.gate__label {
  margin: 0 0 .4rem;
  font-size: var(--meta-size);
  font-weight: 400;
  letter-spacing: var(--meta-tracking);
  text-transform: lowercase;
  color: var(--link);
}

.gate__title {
  margin: 0 0 .7rem;
  font-family: var(--font);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -.01em;
  line-height: var(--leading-snug);
}

.gate__body {
  margin: 0 0 1.2rem;
  font-size: var(--meta-size);
  letter-spacing: var(--meta-tracking);
  line-height: 1.6;
}

.gate__actions { display: flex; flex-wrap: wrap; gap: .8rem; }

.btn {
  border: var(--border-width-thick) solid var(--text);
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: var(--meta-size);
  font-weight: 400;
  letter-spacing: var(--meta-tracking);
  text-transform: lowercase;
  padding: .85rem 1.2rem;
  cursor: pointer;
}

.btn--solid { background: var(--text); color: var(--surface); }
.btn:hover { background: var(--text); color: var(--surface); }
.btn--solid:hover { background: transparent; color: var(--text); }

/* --- the source field ----------------------------------------------
   The label comes first in the source and column-reverse drops it
   under the box, so a screen reader hears the name before the box. */

.field {
  display: flex;
  flex-direction: column-reverse;
  gap: .45rem;
  flex: 0 1 22rem;
}

.field__label {
  font-size: var(--meta-size);
  font-weight: 400;
  letter-spacing: var(--meta-tracking);
  text-transform: lowercase;
  text-align: left;
}

.field__input {
  height: 40px;
  padding: 0 .7rem;
  border: var(--border-width-thick) solid var(--text);
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--meta-size);
  font-weight: 400;
  letter-spacing: var(--meta-tracking);
  text-transform: lowercase;
}

.field__input::placeholder { color: var(--text); opacity: 1; }

/* --- narrow screens ----------------------------------------------- */

@media (max-width: 599px) {
  .field { display: none; }

  .gate__panel { padding: 1.1rem; }
  .gate__actions .btn { flex: 1 1 100%; }
}

/* ==================================================================
   Motion guard
   ==================================================================
   The star carries no specificity and has to reach animations declared
   in a page's own <style> block, hence !important.
   ================================================================== */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: .001ms !important;
    transition-delay: 0ms !important;
  }

  video, canvas { animation-play-state: paused !important; }
}

/* ==================================================================
   Print
   ================================================================== */

@media print {
  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
    padding-bottom: 0;
  }

  a { color: #000; }

  .skip-link,
  .masthead,
  .field,
  .gate,
  .gate[open] { display: none; }
}

.masthead__name {
  font-family: var(--font);
  font-weight: 700;
  font-size: 1.3rem;
  line-height: 1.2;
  color: var(--text);
  text-decoration: none;
}
