/* Self Host Wizard — the weekly flyer (comp A, approved 2026-11-24). Tokens: web/site/design/DESIGN-PLAN.md section 9. */

@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-var.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: "Knewave";
  src: url("fonts/knewave.woff2") format("woff2");
  font-display: swap;
}

:root {
  /* Flyer stock yellow owns the ground; cobalt is the second ink; green only ever means "running". */
  --ground: oklch(0.905 0.175 98);
  --ground-2: oklch(0.87 0.172 95);
  --text: oklch(0.2 0.06 268);
  --text-2: oklch(0.34 0.075 268);
  --accent: oklch(0.4 0.19 264);
  --on-accent: oklch(0.93 0.16 98);
  --on-accent-2: oklch(0.86 0.07 98);
  --tag: oklch(0.985 0.014 98);
  --on-tag: oklch(0.2 0.06 268);
  --on-tag-2: oklch(0.4 0.06 268);
  --rule: oklch(0.2 0.06 268);
  --running: oklch(0.47 0.14 152);
  --focus: oklch(0.4 0.19 264);

  --display: "Archivo", "Arial Narrow", sans-serif;
  --body: "Archivo", system-ui, sans-serif;
  --script: "Knewave", "Archivo", cursive;

  --gutter: clamp(1rem, 3.2vw, 2.75rem);
  --rule-w: 2px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: oklch(0.21 0.075 266);
    --ground-2: oklch(0.25 0.085 266);
    --text: oklch(0.95 0.04 98);
    --text-2: oklch(0.82 0.05 98);
    --accent: oklch(0.9 0.175 98);
    --on-accent: oklch(0.2 0.07 266);
    --on-accent-2: oklch(0.33 0.08 266);
    --tag: oklch(0.29 0.09 266);
    --on-tag: oklch(0.95 0.04 98);
    --on-tag-2: oklch(0.8 0.05 98);
    --rule: oklch(0.9 0.175 98);
    --running: oklch(0.8 0.17 152);
    --focus: oklch(0.9 0.175 98);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: oklch(0.21 0.075 266);
  --ground-2: oklch(0.25 0.085 266);
  --text: oklch(0.95 0.04 98);
  --text-2: oklch(0.82 0.05 98);
  --accent: oklch(0.9 0.175 98);
  --on-accent: oklch(0.2 0.07 266);
  --on-accent-2: oklch(0.33 0.08 266);
  --tag: oklch(0.29 0.09 266);
  --on-tag: oklch(0.95 0.04 98);
  --on-tag-2: oklch(0.8 0.05 98);
  --rule: oklch(0.9 0.175 98);
  --running: oklch(0.8 0.17 152);
  --focus: oklch(0.9 0.175 98);
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
  scrollbar-color: var(--accent) var(--ground);
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font-family: var(--body);
  font-stretch: 100%;
  font-weight: 420;
  font-size: 1.0625rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums lining-nums;
  caret-color: var(--accent);
}
::selection {
  background: var(--accent);
  color: var(--on-accent);
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
a {
  color: inherit;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}
a:hover {
  text-decoration-thickness: 4px;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
dd,
figure,
table {
  margin: 0;
  padding: 0;
}
ul,
ol {
  list-style: none;
}

.cond {
  font-family: var(--display);
  font-stretch: 62%;
  font-weight: 880;
  text-transform: uppercase;
  line-height: 0.92;
  letter-spacing: -0.005em;
}

.wrap {
  max-width: 84rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip {
  position: absolute;
  left: -999rem;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  background: var(--tag);
  color: var(--on-tag);
  padding: 0.5rem 1rem;
}

/* ---------- masthead ---------- */

.status {
  background: var(--text);
  color: var(--ground);
  font-size: 0.875rem;
  font-weight: 600;
}
.status p {
  max-width: none;
}
.status .wrap {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  padding-block: 0.4rem;
}
.status a {
  white-space: nowrap;
}

.mast {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--ground);
  border-bottom: var(--rule-w) solid var(--rule);
}
.mast .wrap {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: 3.75rem;
}
.wordmark {
  font-family: var(--script);
  font-size: 1.75rem;
  line-height: 1;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  transform: rotate(-2deg);
  margin-top: 0.15rem;
}
.mast .wordmark {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.wizard-head {
  width: 2.6rem;
  height: 2.6rem;
  flex: none;
  margin-block: -0.35rem;
}

/* The mascot is drawn in the page's own inks, so the night edition reprints it with no second file:
   at night the ink is the navy stock itself and the beard stays paper-white, a cut-out on the dark page. */
:root {
  --wiz-ink: var(--text);
  --wiz-robe: var(--accent);
  --wiz-paper: var(--tag);
  --wiz-stock: var(--ground);
  --wiz-nose: var(--ground);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --wiz-ink: var(--ground);
    --wiz-paper: var(--text);
    --wiz-nose: var(--accent);
  }
}
:root[data-theme="dark"] {
  --wiz-ink: var(--ground);
  --wiz-paper: var(--text);
  --wiz-nose: var(--accent);
}
.mast .langs {
  margin-left: auto;
  display: flex;
  border: var(--rule-w) solid var(--rule);
}
.mast .langs a {
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.875rem;
  min-width: 2.75rem;
  min-height: 2.75rem;
  text-decoration: none;
}
.mast .langs a:hover {
  text-decoration: underline;
}
.mast .langs a[aria-current="page"] {
  background: var(--text);
  color: var(--ground);
}

/* ---------- front page ---------- */

.front {
  padding-block: clamp(1.25rem, 3vw, 2.5rem) 0;
}
.front h1 {
  grid-area: head;
  font-size: clamp(2.75rem, 7vw, 6.5rem);
  line-height: 0.9;
  text-wrap: balance;
  align-self: start;
}
.front h1 em {
  font-style: normal;
  color: var(--accent);
}

/* The headline and one sentence on the left; the wizard stands over the live sticker on the right. */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 2.9fr) minmax(18rem, 1fr);
  grid-template-areas:
    "head sticker"
    "pitch sticker";
  align-items: end;
  gap: clamp(1rem, 2vw, 1.5rem) clamp(1.5rem, 4vw, 4rem);
}
.pitch {
  grid-area: pitch;
  max-width: 34rem;
  font-size: 1.25rem;
  font-weight: 560;
  line-height: 1.35;
  padding-bottom: 0.75rem;
}
/* The wizard stands in the empty top of the sticker column; the sticker is pasted over his feet. */
.wizard {
  grid-area: sticker;
  align-self: start;
  justify-self: center;
  width: clamp(8rem, 12vw, 11rem);
  margin-top: -0.5rem;
}
.wizard svg {
  display: block;
  width: 100%;
  height: auto;
}
.sticker {
  position: relative;
  z-index: 1;
}

.sticker {
  grid-area: sticker;
  background: var(--tag);
  color: var(--on-tag);
  padding: 1.1rem 1.25rem 0.9rem;
  transform: rotate(1.4deg);
  box-shadow: 0 0.5rem 1.25rem -0.5rem color-mix(in oklch, var(--text) 45%, transparent);
  margin-bottom: 0.5rem;
}
:root[data-theme="dark"] .sticker,
.sticker {
  border: 1px solid color-mix(in oklch, var(--on-tag) 18%, transparent);
}
.sticker h2 {
  font-size: 1.625rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
}
.sticker dl {
  margin-top: 0.6rem;
}
.sticker dl > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding-block: 0.34rem;
  border-top: 1px solid color-mix(in oklch, var(--on-tag) 22%, transparent);
  font-size: 0.9375rem;
}
.sticker dd {
  text-align: right;
  font-weight: 700;
  white-space: nowrap;
}
/* Until the first reading lands the numbers stay hidden: swapping "—" for a value in a right-aligned
   cell would move it, and a hidden box that appears is not a layout shift. Without JS a <noscript>
   style in the head shows the dashes. */
.sticker[data-fresh="pending"] dd {
  visibility: hidden;
}
.sticker dd small {
  font-weight: 420;
  font-size: inherit;
  color: var(--on-tag-2);
}
.pulse {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-top: 0.6rem;
  color: var(--on-tag-2);
}
.lamp {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--running);
  flex: none;
}
.tick {
  flex: 1;
  height: 3px;
  background: color-mix(in oklch, var(--on-tag) 16%, transparent);
  overflow: hidden;
}
.tick i {
  display: block;
  height: 100%;
  background: var(--running);
  transform-origin: left;
  animation: tick 15s linear infinite;
}
@keyframes tick {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

/* Reading states. Colour never carries the state alone: the wording changes too. */
[data-fresh="pending"] .lamp,
[data-fresh="late"] .lamp,
[data-fresh="stale"] .lamp,
[data-fresh="unavailable"] .lamp {
  background: none;
  border: 2px solid currentColor;
}
[data-fresh="pending"] .tick i,
[data-fresh="late"] .tick i,
[data-fresh="stale"] .tick i,
[data-fresh="unavailable"] .tick i {
  animation: none;
  transform: scaleX(0);
}
/* Empty until the first reading anyway; hidden so its start moving with the label is not a shift. */
/* Fixed-width digits and a reserved width keep the bar from moving as "9 s" becomes "10 s". */
.pulse [data-stat="age"] {
  font-variant-numeric: tabular-nums;
  min-width: 8.5rem;
}
[data-fresh="pending"] .tick {
  visibility: hidden;
}
[data-fresh="stale"] [data-stat] {
  opacity: 0.5;
}
.state-note {
  display: none;
  font-size: 0.875rem;
  font-weight: 600;
  margin-top: 0.6rem;
  padding: 0.5rem 0.65rem;
  background: repeating-linear-gradient(
    -45deg,
    transparent 0 6px,
    color-mix(in oklch, currentColor 12%, transparent) 6px 8px
  );
  border: 1px solid currentColor;
}
[data-fresh="late"] .state-note.late,
[data-fresh="stale"] .state-note.stale,
[data-fresh="unavailable"] .state-note.unavailable,
.state-note.on {
  display: block;
}

/* The second claim and the code's status: the cobalt bar that closes the first screen. */
.total {
  margin-top: clamp(1.25rem, 2.5vw, 2rem);
  background: var(--accent);
  color: var(--on-accent);
}
.total .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem clamp(1.5rem, 4vw, 4rem);
  padding-block: 1.1rem 1.2rem;
}
.total :focus-visible {
  outline-color: var(--on-accent);
}
.total .result {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.1rem 0.75rem;
}
.total .result span {
  font-weight: 650;
  white-space: nowrap;
}
/* The claim is words, so it may wrap, and it balances when it does. */
.total .result strong {
  font-size: clamp(2.25rem, 4.6vw, 4rem);
  line-height: 0.95;
  text-wrap: balance;
}
.total .result small {
  flex-basis: 100%;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--on-accent-2);
  margin-top: 0.35rem;
}
/* The stamp's dashed outline at bar size. */
.notice {
  border: 2px dashed currentColor;
  padding: 0.75rem 1.1rem 0.7rem;
  max-width: 23rem;
}
.notice strong {
  display: block;
  font-size: 1.5rem;
}
.notice p {
  font-size: 0.875rem;
  font-weight: 500;
  margin-top: 0.25rem;
}

/* ---------- shelf ---------- */

.aisle {
  padding-block: clamp(2.25rem, 4.5vw, 3.5rem) 0;
}
.aisle > .wrap > h2 {
  font-size: clamp(2rem, 3.6vw, 3.25rem);
  text-wrap: balance;
}
.lede {
  max-width: 92ch;
  margin-top: 0.85rem;
}

.lede [data-shelf-count] {
  white-space: nowrap;
}

.shelf {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--rule-w);
  background: var(--rule);
  border: var(--rule-w) solid var(--rule);
  margin-top: 1.25rem;
}
.shelf > * {
  background: var(--ground);
  padding: 0.7rem 0.9rem 0.65rem;
  min-width: 0;
}
.shelf h3 {
  font-size: 1.5rem;
}
.item .meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 0.6rem;
  font-size: 0.8125rem;
  margin-top: 0.3rem;
  color: var(--text-2);
}
.stamp {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  background: var(--tag);
  color: var(--on-tag);
}
.stamp::before {
  content: "";
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--running);
}
[data-shelf="unread"] .stamp,
[data-shelf="not-installed"] .stamp,
[data-shelf="down"] .stamp {
  background: none;
  color: var(--text);
  outline: 1.5px dashed currentColor;
  outline-offset: -1.5px;
}
[data-shelf="unread"] .stamp::before,
[data-shelf="not-installed"] .stamp::before,
[data-shelf="down"] .stamp::before {
  background: none;
  border: 2px solid currentColor;
}
.stamp [data-when] {
  display: none;
}
[data-shelf="running"] .stamp [data-when="running"],
[data-shelf="down"] .stamp [data-when="down"],
[data-shelf="not-installed"] .stamp [data-when="not-installed"],
[data-shelf="unread"] .stamp [data-when="unread"] {
  display: inline;
}

.shelf .none {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1.25rem;
  background: var(--ground-2);
  background-image: repeating-linear-gradient(
    -45deg,
    transparent 0 10px,
    color-mix(in oklch, var(--rule) 9%, transparent) 10px 12px
  );
}
.shelf .none ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 1.25rem;
}
.shelf .none li {
  font-family: var(--display);
  font-stretch: 62%;
  font-weight: 880;
  text-transform: uppercase;
  font-size: 1.25rem;
  line-height: 1.1;
  text-decoration: line-through;
  text-decoration-thickness: 0.09em;
}
.shelf .none p {
  font-size: 0.9375rem;
  font-weight: 600;
}

/* ---------- small print: three caveats, kept lighter than the shelf ---------- */

.fine {
  padding-top: clamp(1.75rem, 3.5vw, 2.5rem);
}
.fine h2 {
  font-size: 1.5rem;
}
.fine ol {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem clamp(1.25rem, 3vw, 2.5rem);
  margin-top: 0.75rem;
  padding-top: 0.9rem;
  border-top: var(--rule-w) solid var(--rule);
}
.fine h3 {
  font-size: 1.25rem;
  line-height: 1;
  text-wrap: balance;
}
.fine p {
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--text-2);
  margin-top: 0.35rem;
  max-width: 46ch;
}

/* ---------- footer ---------- */

footer {
  margin-top: clamp(2rem, 4vw, 3rem);
  background: var(--text);
  color: var(--ground);
  padding-block: 2rem 2.5rem;
  font-size: 0.9375rem;
}
footer .wrap {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem 3rem;
}
footer .wordmark {
  color: inherit;
  display: inline-block;
  margin-bottom: 0.6rem;
}
footer p {
  max-width: 46ch;
}
footer li {
  padding-block: 0.15rem;
}

/* ---------- responsive ---------- */

/* Short laptop screens: the headline gives height back so the cobalt bar stays on screen one. */
@media (min-width: 68rem) and (max-height: 50rem) {
  .front h1 {
    font-size: clamp(2.75rem, min(7vw, 11.5vh), 6.5rem);
  }
}

@media (max-width: 68rem) {
  .hero {
    grid-template-columns: minmax(0, 26rem) minmax(0, 1fr);
    grid-template-areas:
      "head head"
      "pitch pitch"
      "sticker wizard";
  }
  /* Beside the sticker, which no longer fills its row. */
  .wizard {
    grid-area: wizard;
    align-self: end;
    justify-self: start;
    width: clamp(5.5rem, 18vw, 9rem);
    margin-top: 0;
  }
  .pitch {
    padding-bottom: 0;
  }
  .shelf {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .fine ol {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 44rem) {
  body {
    font-size: 1rem;
  }
  .status .wrap {
    font-size: 0.8125rem;
  }
  /* The wizard moves up beside the sentence and the sticker takes the full width. */
  .hero {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "head head"
      "pitch wizard"
      "sticker sticker";
  }
  .wizard {
    justify-self: end;
  }
  .pitch {
    font-size: 1.0625rem;
  }
  .mast .wrap {
    gap: 0.75rem;
  }
  .mast .wordmark {
    font-size: 1.5rem;
    gap: 0.25rem;
  }
  .wizard-head {
    width: 2.1rem;
    height: 2.1rem;
  }
  .sticker {
    transform: none;
  }
  .total .wrap,
  footer .wrap {
    grid-template-columns: minmax(0, 1fr);
  }
  .notice {
    max-width: none;
  }
  .shelf > * {
    padding: 0.6rem 0.7rem;
  }
  .shelf h3 {
    font-size: 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  .tick {
    display: none;
  }
}
