/* The parts every page shares: the reset and page base, selected text, the
   logo, the header's right-hand group, the hatch band, corner ticks, the
   eyebrow and red rule, and the footer. Every page loads this right after
   /tokens.css and /fonts.css; a page's own stylesheet (site.css for the
   homepage and the 404; HQ's frame.css, plus the page's own CSS, for HQ)
   adds only what's particular to it, such as spacing. */

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

html,
body {
  margin: 0;
}

body {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  color: var(--ink);
  font-family: 'Bender', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Selected text: signal red with white type, on every background.
   (Tried: an inverted ice/black "negative" version.) */
::selection {
  background: var(--accent);
  color: var(--on-accent);
}

/* Hint text in an empty field, the same everywhere. (Firefox also fades
   placeholders by default; the token already has the strength.) */
::placeholder {
  color: var(--ink-placeholder);
  opacity: 1;
}

/* Keyboard focus: one outline everywhere, in the accent color and just off
   the element, so a keyboard user always sees where they are, even on a
   button that's already selected. :focus-visible means mouse clicks don't
   show it. (Text fields show focus with their red underline instead.) */
:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}

/* Text for screen readers only (a label the design shows some other way). */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---- Header parts ---- */
/* Logo: the Spec mark (W·M lattice in figure brackets), small-size variant, see /hq/brand/. */
.mark {
  display: block;
  width: clamp(76px, 9vw, 96px);
  height: auto;
}

.top-right {
  display: flex;
  align-items: center;
  gap: clamp(var(--space-4), 2.5vw, var(--space-8));
}

/* The camo dot field (field.js), behind everything on the pages that have
   it, and the glitch layer over it (glitch.js), in the same box. */
#field,
#glitch {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}
#glitch {
  z-index: 0;
  pointer-events: none;
}

/* The red-ruled link top right of a header (contact, Sign out). */
.contact-link {
  font-size: var(--text-label);
  font-weight: 700;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  padding: var(--space-2) 0;
  border-bottom: var(--rule) solid var(--accent);
  transition: color var(--dur-fade);
}

.contact-link:hover,
.contact-link:focus-visible {
  color: var(--accent-text);
}

/* The hatch band, top right of every header. */
.hatch {
  width: clamp(96px, 16vw, 200px);
  height: 14px;
  background: var(--hatch-band);
}

/* ---- Corner ticks: the drawing brackets round figures, tables and panels ---- */
.tick {
  position: absolute;
  width: var(--tick);
  height: var(--tick);
  border: 0 solid var(--ink);
}
.tick.tl { top: 0; left: 0; border-top-width: 1px; border-left-width: 1px; }
.tick.tr { top: 0; right: 0; border-top-width: 1px; border-right-width: 1px; }
.tick.bl { bottom: 0; left: 0; border-bottom-width: 1px; border-left-width: 1px; }
.tick.br { bottom: 0; right: 0; border-bottom-width: 1px; border-right-width: 1px; }

/* A panel with its own 1px border (.ticked): the ticks sit on that border,
   1px out, and are drawn at the rule weight so they read over it. */
.ticked > .tick.tl { top: -1px; left: -1px; border-top-width: var(--rule); border-left-width: var(--rule); }
.ticked > .tick.tr { top: -1px; right: -1px; border-top-width: var(--rule); border-right-width: var(--rule); }
.ticked > .tick.bl { bottom: -1px; left: -1px; border-bottom-width: var(--rule); border-left-width: var(--rule); }
.ticked > .tick.br { bottom: -1px; right: -1px; border-bottom-width: var(--rule); border-right-width: var(--rule); }

/* ---- Eyebrow and red rule (pages set their own spacing) ---- */
.eyebrow {
  font-size: var(--text-label);
  font-weight: 400;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--accent-text);
}

.rule {
  width: 3rem;
  height: 2px;
  background: var(--accent);
}

/* ---- Footer: copyright left, a title or the contact address in the middle,
   the studio's local time and version right (clock.js fills [data-clock]).
   Three equal columns, so the middle item sits at true center. ---- */
.foot {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-4);
  padding: 0 clamp(var(--gutter), 4vw, var(--space-12)) calc(var(--space-6) + env(safe-area-inset-bottom));
  font-size: var(--text-micro);
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  color: var(--ink-muted);
}

.foot > :first-child {
  justify-self: start;
}

.foot-end {
  justify-self: end;
  font-weight: 700;
}

/* The studio's local time (clock.js). */
.clock {
  font-weight: 400;
}

.clock b {
  color: var(--ink);
  font-weight: 700;
}

.clock-colon.off {
  visibility: hidden;
}

.foot-email {
  color: var(--ink-muted);
  text-decoration: none;
  transition: color var(--dur-fade);
}

.foot-email:hover,
.foot-email:focus-visible {
  color: var(--accent-text);
}

@media (max-width: 600px) {
  .foot {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: var(--space-2);
  }

  .foot > :first-child,
  .foot-end {
    justify-self: center;
  }
}

/* Print: black on white for every page. The roles switch to the print
   colors, and everything built on them follows. */
@media print {
  :root {
    --surface: var(--print-paper);
    --ink: var(--print-ink);
    --ink-muted: var(--print-muted);
  }
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  body {
    background: var(--print-paper);
    color: var(--ink);
  }
  .foot {
    display: none;
  }
}
