/**
 * In for service — the stupidwat.ch under-construction page.
 *
 * Register's tokens, so the page reads as the same institution with its doors
 * shut. Paper and ink by day, lume by night. The rubies on the pallet fork and
 * the impulse pin stay ruby in both, because they are.
 */

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("fonts/serif.woff2") format("woff2-variations");
}

@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url("fonts/serif-italic.woff2") format("woff2-variations");
}

@font-face {
  font-family: "Public Sans";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/sans.woff2") format("woff2-variations");
}

:root {
  color-scheme: light dark;

  --paper: #f7f6f1;
  --ink: #171713;
  --ink-2: #4a4944;
  --ink-3: #6e6c63;
  --rule: #d9d6cc;
  --rule-strong: #171713;
  --accent: #b42318;
  --metal: #ebe7db;
  --metal-2: #e0dbcc;
  --jewel: #b42318;
  --select: rgb(180 35 24 / 0.14);

  --serif: "Source Serif 4", Georgia, serif;
  --sans: "Public Sans", system-ui, sans-serif;

  --page: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121310;
    --ink: #ebe8de;
    --ink-2: #bcb9ad;
    --ink-3: #8f8c80;
    --rule: #2d2e28;
    --rule-strong: #ebe8de;
    --accent: #c9dfa4;
    --metal: #1c1d18;
    --metal-2: #24251f;
    --jewel: #e0604c;
    --select: rgb(201 223 164 / 0.22);
  }
}

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

html {
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.5;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--select);
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.shell {
  box-sizing: content-box;
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.label,
.kicker,
.ticket dt,
.readout dt,
.reserve-head span:first-child {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
}

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

/* ── Masthead ─────────────────────────────────────────────────────────────*/

.masthead {
  border-top: 4px solid var(--rule-strong);
}

.masthead-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px 32px;
  padding-block: 24px 18px;
}

.wordmark {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.015em;
}

.wordmark .dot {
  color: var(--accent);
}

/* Driven by the escapement in movement.js: it flips once a second, on the
   beat, and stops wherever it was when the balance stops. */
.wordmark .dot.off {
  opacity: 0.15;
}

.wordmark-small {
  font-size: 22px;
}

.masthead-note {
  font-family: var(--sans);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink-2);
}

.dateline {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 24px;
  padding-block: 8px 9px;
  border-block: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--ink-3);
}

/* ── Lead ─────────────────────────────────────────────────────────────────*/

.lead {
  padding-block: 72px 44px;
}

.kicker {
  margin: 0 0 18px;
  color: var(--accent);
}

.statement {
  margin: 0;
  font-size: clamp(56px, 9.4vw, 124px);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.035em;
}

@media (prefers-color-scheme: dark) {
  .statement {
    font-weight: 360;
  }
}

/* Sized so the sentence sits on one line at desktop width; it wraps only when
   the screen is too narrow to hold it. */
.dek {
  margin: 26px 0 0;
  font-style: italic;
  font-size: clamp(19px, 1.8vw, 24px);
  line-height: 1.42;
  color: var(--ink-2);
  text-wrap: pretty;
}

/* The service ticket: the same form head every file opens on. */
.ticket {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  border-top: 2px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule);
}

.ticket > div {
  padding: 10px 24px 11px 0;
  margin-right: 24px;
  border-right: 1px solid var(--rule);
}

.ticket > div:last-child {
  margin-right: 0;
  border-right: 0;
}

.ticket dd {
  margin: 3px 0 0;
  font-family: var(--sans);
  font-size: 14.5px;
  font-variant-numeric: tabular-nums;
}

/* ── The bench ────────────────────────────────────────────────────────────*/

.bench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 40px 64px;
  align-items: start;
  margin-top: 48px;
}

.movement {
  margin: 0;
}

.movement svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.movement figcaption {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
  font-style: italic;
  font-size: 15px;
  color: var(--ink-2);
}

.noscript {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink-2);
}

/* Drawing: a plate-and-wheel line drawing, ink on brass-coloured paper. */
.part {
  fill: var(--metal);
  stroke: var(--ink);
  stroke-width: 1.3;
  stroke-linejoin: round;
}

.part-2 {
  fill: var(--metal-2);
  stroke: var(--ink);
  stroke-width: 1.3;
}

.line {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.3;
  stroke-linecap: round;
}

.spring {
  fill: none;
  stroke: var(--ink);
  stroke-width: 0.9;
}

.jewel {
  fill: var(--jewel);
  stroke: var(--ink);
  stroke-width: 0.8;
}

.screw {
  fill: var(--paper);
  stroke: var(--ink);
  stroke-width: 1;
}

.callout {
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  fill: var(--ink-3);
}

.leader {
  stroke: var(--ink-3);
  stroke-width: 0.8;
  stroke-dasharray: 2 3;
  fill: none;
}

/* ── Controls ─────────────────────────────────────────────────────────────*/

.controls {
  border-top: 2px solid var(--rule-strong);
  padding-top: 18px;
}

.crown-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
}

.crown {
  width: 96px;
  height: 150px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: ns-resize;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.crown svg {
  display: block;
  width: 100%;
  height: 100%;
}

.crown.stopped-hard {
  animation: refuse 0.18s linear;
}

@keyframes refuse {
  25% { transform: translateY(-2px); }
  75% { transform: translateY(2px); }
}

.help {
  margin: 0;
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-2);
}

.reserve {
  margin-top: 26px;
}

.reserve-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.reserve-head span:last-child {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
  font-variant-numeric: tabular-nums lining-nums;
}

.gauge {
  position: relative;
  height: 20px;
  border-bottom: 1px solid var(--ink-3);
}

.gauge i {
  position: absolute;
  bottom: 0;
  width: 1px;
  height: 5px;
  margin-left: -0.5px;
  background: var(--ink-3);
}

.gauge i.major {
  height: 10px;
}

.gauge-fill {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 0;
  background: var(--accent);
}

.gauge-fill::after {
  content: "";
  position: absolute;
  right: -1px;
  bottom: 0;
  width: 2px;
  height: 20px;
  background: var(--accent);
}

.gauge-figures {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-family: var(--sans);
  font-size: 10.5px;
  color: var(--ink-3);
}

.readout {
  margin: 24px 0 0;
  border-top: 1px solid var(--rule);
}

.readout > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding-block: 9px 8px;
  border-bottom: 1px solid var(--rule);
}

.readout dd {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.sound {
  margin-top: 18px;
  padding: 7px 12px;
  border: 1px solid var(--rule-strong);
  background: none;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.sound[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

/* ── Colophon ─────────────────────────────────────────────────────────────*/

.colophon {
  margin-top: 112px;
  border-top: 4px solid var(--rule-strong);
}

.colophon-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 28px 48px;
  padding-block: 28px 56px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink-2);
}

.colophon-grid p {
  margin: 6px 0 0;
}

.colophon-grid .label {
  display: block;
}

.tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
}

/* ── Narrower ─────────────────────────────────────────────────────────────*/

@media (max-width: 980px) {
  .bench {
    grid-template-columns: minmax(0, 1fr);
  }

  .controls {
    max-width: 520px;
  }
}

@media (max-width: 760px) {
  .lead {
    padding-block: 48px 32px;
  }

  .ticket {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .ticket > div,
  .ticket > div:last-child {
    margin: 0;
    padding: 9px 12px 10px 0;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .ticket > div:last-child {
    border-bottom: 0;
  }

  .bench {
    margin-top: 32px;
  }

  .colophon {
    margin-top: 80px;
  }

  .colophon-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Callouts are drawn in the SVG's own units, so on a phone they shrink below
   legibility. The caption names the parts; the labels can go. */
@media (max-width: 600px) {
  .callout,
  .leader {
    display: none;
  }
}
