/*
 * Pitchou's site in the world « L'onde » (docs/design/direction.md): paper by day, phosphor by night, a fine
 * graticule that carries the measure, rules between blocks and never a box. Every colour, size and duration is a
 * token here; the pages hold none of their own. Barlow for the headings and figures, Barlow Condensed for the stencil
 * labels, the system's face (San Francisco on an iPhone) for the text.
 */

:root {
  color-scheme: light dark;

  /* Day: the paper of a pen recorder. */
  --bg: #f4f6f2;
  --grid: #dfe6df;
  --grid-major: #cfd8d0;
  --ink: #111815;
  --ink-muted: #4f5e56;
  --trace: #0a814a;
  --on-trace: #f4f6f2;
  --note-do: #d9262b;

  /* The graticule: a minor line every 24 px, a major one every five. */
  --minor: 24px;
  --major: 120px;
  --hair: 1.5px;
  --rule: 2px;
  --trace-width: 3px;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-xxl: 32px;
  --space-xxxl: 48px;
  --measure: 40rem;

  --radius-control: 4px;

  /* The clock: feedback under the finger. */
  --quick: 120ms;
  --swift: cubic-bezier(0.2, 0, 0, 1);

  --face-display: "Barlow", system-ui, sans-serif;
  --face-stencil: "Barlow Condensed", "Barlow", system-ui, sans-serif;
  --face-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

/* Night: the phosphor of an oscilloscope. Same object, the other light. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f0d;
    --grid: #16211c;
    --grid-major: #22302a;
    --ink: #e8f1ec;
    --ink-muted: #9fb3a8;
    --trace: #3dff9a;
    --on-trace: #0b0f0d;
    --note-do: #ff5252;
  }
}

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

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

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--face-body);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background-color: var(--trace);
  color: var(--on-trace);
}

:focus-visible {
  outline: var(--rule) solid var(--trace);
  outline-offset: 3px;
  border-radius: 2px;
}

/* The world's one ornament: the grid the measure is read on. */
.graticule {
  background-color: var(--bg);
  background-image:
    linear-gradient(to bottom, var(--grid-major) var(--hair), transparent var(--hair)),
    linear-gradient(to right, var(--grid-major) var(--hair), transparent var(--hair)),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px),
    linear-gradient(to right, var(--grid) 1px, transparent 1px);
  background-size:
    var(--major) var(--major),
    var(--major) var(--major),
    var(--minor) var(--minor),
    var(--minor) var(--minor);
  background-position: -1px -1px;
}

.column {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--space-lg);
}

/* --- Type ---------------------------------------------------------------------------------------------------------- */

.wordmark {
  display: inline-block;
  margin: 0;
  font-family: var(--face-stencil);
  font-weight: 600;
  font-size: 13px;
  line-height: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  text-decoration: none;
}

h1 {
  margin: 0;
  font-family: var(--face-display);
  font-weight: 600;
  font-size: 34px;
  line-height: 38px;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h2 {
  margin: var(--space-xxl) 0 var(--space-sm);
  padding-top: var(--space-lg);
  border-top: var(--rule) solid var(--grid-major);
  font-family: var(--face-display);
  font-weight: 500;
  font-size: 24px;
  line-height: 28px;
  text-wrap: balance;
}

p,
ul {
  margin: 0 0 var(--space-md);
}

ul {
  padding-left: var(--space-xl);
}

li + li {
  margin-top: var(--space-sm);
}

li::marker {
  color: var(--ink-muted);
}

strong {
  font-weight: 600;
}

.muted {
  color: var(--ink-muted);
}

.stencil {
  font-family: var(--face-stencil);
  font-weight: 600;
  font-size: 13px;
  line-height: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.figures {
  font-variant-numeric: tabular-nums;
}

a {
  color: var(--ink);
  overflow-wrap: anywhere;
  text-decoration-line: underline;
  text-decoration-thickness: var(--hair);
  text-decoration-color: var(--trace);
  text-underline-offset: 3px;
  transition: opacity var(--quick) var(--swift);
}

a:active {
  opacity: 0.6;
}

@media (hover: hover) and (pointer: fine) {
  a:hover {
    text-decoration-thickness: var(--rule);
  }
}

/* --- The home page: one question, one wave, one key ----------------------------------------------------------------- */

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.stage .column {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-block: 18svh var(--space-xxl);
}

.stage h1 {
  margin-top: var(--space-xxxl);
  font-size: clamp(40px, 11vw, 64px);
  line-height: 1.05;
}

/* The do's wave, written once: what the note draws in the app. */
.wave {
  display: block;
  width: 100%;
  height: auto;
  margin: var(--space-xl) 0;
  overflow: visible;
}

.wave path {
  fill: none;
  stroke: var(--note-do);
  stroke-width: var(--trace-width);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lead {
  max-width: 34rem;
}

.push {
  margin-top: auto;
  padding-top: var(--space-xxl);
}

/* The one action: a flat key filled with the trace. */
.key {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 var(--space-xl);
  border-radius: var(--radius-control);
  background-color: var(--trace);
  color: var(--on-trace);
  font-family: var(--face-display);
  font-weight: 600;
  font-size: 17px;
  line-height: 20px;
  text-decoration: none;
  transition: transform var(--quick) var(--swift);
}

.key:active {
  transform: scale(0.97);
}

.note {
  margin-top: var(--space-md);
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-muted);
  text-align: center;
}

/* --- A text page: its head on the graticule, the text on the plain paper -------------------------------------------- */

.band {
  padding: var(--space-xxl) 0 var(--space-xl);
  border-bottom: var(--rule) solid var(--grid-major);
}

.band h1 {
  margin-top: var(--space-xxl);
}

.updated {
  margin: var(--space-sm) 0 0;
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.prose {
  padding-top: var(--space-md);
  padding-bottom: var(--space-xxxl);
}

.prose > p:first-child {
  margin-top: var(--space-xl);
}

/* --- The foot of every page ---------------------------------------------------------------------------------------- */

.foot {
  padding-top: var(--space-xl);
  padding-bottom: var(--space-xxl);
  border-top: var(--rule) solid var(--grid-major);
}

.foot ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-lg);
  margin: 0;
  padding: 0;
  list-style: none;
}

.foot li + li {
  margin-top: 0;
}

.foot a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--face-stencil);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration-color: var(--grid-major);
}

.foot p {
  margin: var(--space-md) 0 0;
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-muted);
}

@media (min-width: 720px) {
  h1 {
    font-size: 44px;
    line-height: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .key,
  a {
    transition: none;
  }

  .key:active {
    transform: none;
  }
}
