/* src.ad: a Swiss poster. Paper and ink, one action blue, highlighter yellow only behind a short link. */

@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-variable-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono-medium-latin1.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono-bold-latin1.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #f7f7f2;
  --fg: #111;
  --muted: #55565b;
  --hair: rgb(17 17 17 / 0.16);
  --ghost: rgb(17 17 17 / 0.3);
  --field: #fff;
  --blue: #2b3cff;
  --on-blue: #fff;
  --mark: #e8ff3a;
  --on-mark: #111;

  --display: "Archivo", "Arial Black", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --gutter: 20px;
  --rule: 3px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0f12;
    --fg: #f7f7f2;
    --muted: #a5a7ae;
    --hair: rgb(247 247 242 / 0.16);
    --ghost: rgb(247 247 242 / 0.3);
    --field: #17181c;
    --blue: #8d98ff;
    --on-blue: #0e0f12;
    --on-mark: #0e0f12;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0f12;
  --fg: #f7f7f2;
  --muted: #a5a7ae;
  --hair: rgb(247 247 242 / 0.16);
  --ghost: rgb(247 247 242 / 0.3);
  --field: #17181c;
  --blue: #8d98ff;
  --on-blue: #0e0f12;
  --on-mark: #0e0f12;
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 17px/1.45 var(--body);
  overflow-x: hidden;
}

h1,
h2,
h3,
p,
ol,
ul,
fieldset {
  margin: 0;
  padding: 0;
}
ol,
ul {
  list-style: none;
}
fieldset {
  border: 0;
  min-width: 0;
}

a {
  color: var(--blue);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}
a:hover {
  text-decoration-thickness: 3px;
}

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

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

.wrap {
  width: 100%;
  max-width: 1440px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Top bar ---------- */

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 14px;
}

.wordmark {
  font: 900 22px/1 var(--display);
  font-stretch: 125%;
  letter-spacing: -0.02em;
}
a.wordmark {
  color: inherit;
  text-decoration: none;
}

.theme {
  display: flex;
  border: 1.5px solid var(--fg);
}
.theme label {
  position: relative;
  display: block;
  cursor: pointer;
}
.theme label + label {
  border-left: 1.5px solid var(--fg);
}
.theme span {
  display: block;
  padding: 7px 9px 6px;
  font: 700 11px/1 var(--body);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.theme input:checked + span {
  background: var(--fg);
  color: var(--bg);
}
.theme label:hover input:not(:checked) + span {
  background: var(--hair);
}
.theme input:focus-visible + span {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

/* ---------- Hero ---------- */

.hero {
  padding-top: 20px;
}

h1 {
  container-type: inline-size;
  font-family: var(--display);
  font-weight: 900;
  font-stretch: 125%;
  letter-spacing: -0.035em;
  line-height: 0.95;
}
/* Each line is sized to run the full measure, like a poster set by hand. */
h1 span {
  display: block;
  white-space: nowrap;
}
h1 .l1 {
  font-size: 14.72cqi;
}
h1 .l2 {
  font-size: 13.08cqi;
}

.hero-row {
  margin-top: 22px;
}
.hero .stage {
  margin-top: 26px;
}
.hero .short {
  font-size: 46px;
}
html:not(.motion) .hero .short {
  font-size: 38px;
}

.lede {
  max-width: 34ch;
  font-size: 17px;
  line-height: 1.42;
}
.lede strong {
  font-weight: 700;
}

/* ---------- The squeeze stage (hero, play box, ledger rows) ---------- */

.stage {
  position: relative;
}

.meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--hair);
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.meta b {
  font-weight: 700;
  color: var(--fg);
}

.long {
  font: 500 13px/1.6 var(--mono);
  overflow-wrap: anywhere;
}

.short {
  position: relative;
  display: inline-block;
  font: 700 26px/1 var(--mono);
  letter-spacing: -0.02em;
  white-space: nowrap;
  color: var(--on-mark);
  padding: 0.16em 0.2em 0.12em;
}
.short .hl {
  position: absolute;
  inset: 0;
  background: var(--mark);
  transform-origin: 0 50%;
}
.short .short-text {
  position: relative;
  display: inline-block;
}

.arrow {
  font: 500 20px/1 var(--mono);
  color: var(--muted);
}

/* Calm layout (no JS, or reduced motion): the long link and its short form side by side. */
.pair {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "long long"
    "arrow short";
  align-items: center;
  column-gap: 12px;
  row-gap: 12px;
}
.pair .long {
  grid-area: long;
}
.pair .arrow {
  grid-area: arrow;
}
.pair .short {
  grid-area: short;
  justify-self: start;
}

/* Motion layout: one slot, where the long link types out and the short one lands. */
.motion .stage .pair {
  display: block;
  position: relative;
  min-height: var(--stage-h, 9.6em);
}
.motion .stage .arrow {
  display: none;
}
.motion .stage .short {
  position: absolute;
  left: 0;
  top: max(0px, calc((var(--stage-h, 2.6em) - 1.28em) / 2));
  visibility: hidden;
}
.motion .stage.is-landed .short {
  visibility: visible;
}
.motion .stage .long {
  perspective: 700px;
}

.long .ln {
  display: block;
  white-space: pre;
}
.long .c {
  display: inline-block;
  white-space: pre;
  backface-visibility: hidden;
}
.long .c.is-hidden {
  visibility: hidden;
}
.long .c.is-caret {
  position: relative;
}
.long .c.is-caret::after {
  content: "";
  position: absolute;
  top: 0.15em;
  bottom: 0.1em;
  right: -0.14em;
  width: 0.12em;
  background: var(--blue);
}
.long.is-gone .c {
  visibility: hidden;
}

.stamp {
  display: none;
}

/* ---------- Sections ---------- */

.play,
.ledger,
.promises {
  margin-top: 44px;
}

.sec-title {
  border-top: var(--rule) solid var(--fg);
  padding-top: 14px;
  font: 900 30px/0.95 var(--display);
  font-stretch: 125%;
  letter-spacing: -0.025em;
}
.sec-body {
  margin-top: 20px;
}
.ledger .sec-title span {
  display: block;
}

/* ---------- Play box ---------- */

.field {
  display: flex;
  border: 2px solid var(--fg);
  background: var(--field);
}
.field:has(input:focus-visible) {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}
.field input {
  flex: 1 1 auto;
  min-width: 0;
  height: 54px;
  padding: 0 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--fg);
  font: 500 16px/1 var(--mono);
  outline: none;
}
.field input::placeholder {
  color: var(--muted);
  opacity: 1;
}
.field button {
  flex: none;
  height: 54px;
  padding: 0 18px;
  border: 0;
  border-left: 2px solid var(--fg);
  border-radius: 0;
  background: var(--blue);
  color: var(--on-blue);
  font: 900 17px/1 var(--display);
  font-stretch: 125%;
  letter-spacing: -0.01em;
  cursor: pointer;
}
.field button:hover {
  filter: brightness(1.08);
}
.field button:active {
  transform: translateY(1px);
}
.field button:focus-visible {
  outline: 3px solid var(--fg);
  outline-offset: -6px;
}

.hint {
  min-height: 1.4em;
  margin-top: 8px;
  font-size: 15px;
  color: var(--muted);
}
.hint:not(:empty)::before {
  content: "↳ ";
  font-family: var(--mono);
  color: var(--blue);
}
.field:has(input[aria-invalid="true"]) {
  border-color: var(--blue);
}

.play-stage {
  margin-top: 14px;
}
.play-stage .stamp {
  position: absolute;
  left: calc(100% - 6px);
  top: -2px;
  display: inline-block;
  padding: 5px 7px 4px;
  border: 2px solid var(--fg);
  background: var(--bg);
  color: var(--fg);
  font: 900 12px/1 var(--display);
  font-stretch: 125%;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  transform: translateY(-50%) rotate(-7deg);
}
.play-stage:not(.is-done) .stamp {
  display: none;
}

/* Before the first squeeze the slot shows where the short link will land. */
.play-stage:not(.is-run) .short {
  visibility: visible;
  color: var(--muted);
  outline: 1.5px dashed var(--muted);
  outline-offset: -1.5px;
}
.play-stage:not(.is-run) .short .hl {
  display: none;
}
.motion .play-stage:not(.is-run) .short {
  position: static;
  margin-top: 12px;
}
.motion .play-stage:not(.is-run) .pair {
  min-height: 0;
}

.play-stage:not(.is-run) .meta {
  display: none;
}
.play-status {
  margin-top: 14px;
}
.play-stage.is-run + .play-status {
  min-height: 4.6em;
}
.play-note {
  max-width: 38ch;
  font-size: 15px;
  line-height: 1.45;
}

/* ---------- Ledger: paste it, print it, say it ---------- */

.rows {
  border-bottom: 1px solid var(--hair);
}
.row {
  padding-block: 18px 20px;
  border-top: 1px solid var(--hair);
}
.row:first-child {
  border-top: 0;
  padding-top: 4px;
}
.row-k {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
  font: 800 14px/1.2 var(--display);
  font-stretch: 125%;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.row-n {
  font: 500 11px/1 var(--mono);
  color: var(--muted);
  letter-spacing: 0.06em;
}
.row .long {
  font-size: 12px;
  color: var(--muted);
}
.row .short {
  margin-top: 12px;
  font-size: 22px;
}
.motion .row .short {
  visibility: hidden;
}
.motion .row.is-landed .short {
  visibility: visible;
}
.row .long.is-ghost .c {
  visibility: visible;
  color: var(--ghost);
}

/* ---------- Promises ---------- */

.promise-list {
  display: grid;
  gap: 0;
  border-top: var(--rule) solid var(--fg);
}
.promise {
  padding-block: 16px 22px;
  border-bottom: 1px solid var(--hair);
}
.promise:last-child {
  border-bottom: 0;
}
.promise h3 {
  font: 900 40px/0.95 var(--display);
  font-stretch: 125%;
  letter-spacing: -0.03em;
}
.promise p {
  margin-top: 10px;
  max-width: 32ch;
  font-size: 17px;
}

/* ---------- Footer ---------- */

.foot {
  container-type: inline-size;
  margin-top: 36px;
  padding-bottom: 28px;
}
.giant {
  container-type: inline-size;
  font: 900 26cqi/0.8 var(--display);
  font-stretch: 125%;
  letter-spacing: -0.045em;
  white-space: nowrap;
  margin-left: -0.04em;
  user-select: none;
}
.foot-line {
  margin-top: 14px;
  padding-top: 12px;
  border-top: var(--rule) solid var(--fg);
  font-size: 14px;
}

/* ---------- 404 ---------- */

.lost {
  padding-top: 28px;
}
.lost .code {
  font: 500 12px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.lost h1 {
  margin-top: 18px;
  font-size: 46px;
  line-height: 0.92;
  white-space: normal;
}
.lost .asked {
  display: inline-block;
  margin-top: 28px;
  padding: 6px 10px 5px;
  border: 1.5px dashed var(--muted);
  font: 700 22px/1.2 var(--mono);
  overflow-wrap: anywhere;
  max-width: 100%;
}
.lost .asked s {
  text-decoration-thickness: 2px;
}
.lost .back {
  margin-top: 28px;
  font-size: 17px;
}
.lost-wrap {
  min-height: calc(100svh - 260px);
}

/* ---------- Wider screens ---------- */

@media (min-width: 720px) {
  :root {
    --gutter: 32px;
  }
  .bar {
    padding-block: 22px;
  }
  .hero-row {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: 24px;
    margin-top: 36px;
  }
  .lede {
    grid-column: 1 / span 4;
    font-size: 19px;
  }
  .hero .stage {
    grid-column: 6 / -1;
    margin-top: 4px;
  }
  .hero .long {
    font-size: 16px;
  }
  .hero .short {
    font-size: 44px;
  }
  .hero .pair {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: "long arrow short";
    column-gap: 20px;
  }
  html:not(.motion) .hero .short {
    font-size: 34px;
  }
  .play,
  .ledger,
  .promises {
    margin-top: 88px;
  }
  .play,
  .ledger {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: 24px;
    border-top: var(--rule) solid var(--fg);
  }
  .sec-title {
    grid-column: 1 / span 4;
    border-top: 0;
    padding-top: 18px;
    font-size: 40px;
    padding-right: 24px;
  }
  .sec-body {
    grid-column: 6 / -1;
    margin-top: 22px;
  }
  .promise-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 24px;
  }
  .promise {
    border-bottom: 0;
    padding-block: 18px 0;
  }
  .promise h3 {
    font-size: 48px;
  }
  .lost h1 {
    font-size: 88px;
  }
  .lost .asked {
    font-size: 30px;
  }
}

@media (min-width: 1100px) {
  :root {
    --gutter: 48px;
  }
  .hero {
    padding-top: 28px;
  }
  .lede {
    font-size: 21px;
    grid-column: 1 / span 4;
  }
  .hero .stage {
    grid-column: 5 / -1;
  }
  .hero .long {
    font-size: 19px;
  }
  .hero .short {
    font-size: 64px;
  }
  html:not(.motion) .hero .short {
    font-size: 46px;
  }
  .sec-title {
    font-size: 52px;
  }
  .sec-body {
    grid-column: 5 / -1;
  }
  .play .sec-body {
    grid-column: 5 / span 7;
  }
  .play-stage .long {
    font-size: 15px;
  }
  .play-stage .short {
    font-size: 40px;
  }
  .row {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 3fr);
    column-gap: 24px;
    align-items: start;
  }
  .row-k {
    grid-column: 1 / -1;
  }
  .row .short {
    margin-top: 0;
    justify-self: start;
  }
  .row .long {
    font-size: 14px;
  }
  .row .short {
    font-size: 30px;
  }
  .promise h3 {
    font-size: 64px;
  }
  .promise p {
    font-size: 19px;
  }
  .lost h1 {
    font-size: 120px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
