/* Chaintag launch site. Palette, type and rules from docs/site/BRIEF.md. */

:root {
  --paper: #f5efe3;
  --paper-glow: #fbf6ec;
  --surface: #fffbf3;
  --sunken: #ede4d3;
  --ink: #1f1b16;
  --ink-muted: #5f574b;
  --rule: #ddd2bf;
  --rule-strong: #b9ab93;
  --accent: #c2410c;
  --accent-hover: #a3360a;
  --accent-ink: #ffffff;
  --accent-soft: #fde6d6;
  --tag: #ecd9b0;
  --tag-edge: #c9b07c;
  --focus: #1d4ed8;
  --ok-tint: #d9eed2;
  --ok-ink: #2a611e;
  --wait-tint: #ebe1f6;
  --wait-ink: #57308a;
  --quote-tint: #fbedc9;
  --quote-ink: #774700;

  --band: var(--ink);
  --band-ink: var(--paper);
  --grain: 0.035;

  --display: "Archivo", system-ui, sans-serif;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --gap: clamp(5rem, 11vw, 9rem);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16130f;
    --paper-glow: #1f1a14;
    --surface: #201c17;
    --sunken: #1a1612;
    --ink: #f3ece0;
    --ink-muted: #b5ab9a;
    --rule: #3b342b;
    --rule-strong: #5a5044;
    --accent: #ff7a2f;
    --accent-hover: #ff9152;
    --accent-ink: #1a0d04;
    --accent-soft: #3d2414;
    --tag: #3a3022;
    --tag-edge: #6b5838;
    --focus: #8ab4ff;
    --ok-tint: #1d3519;
    --ok-ink: #a6dc96;
    --wait-tint: #2f2342;
    --wait-ink: #cfb6f0;
    --quote-tint: #3d3016;
    --quote-ink: #f5cf7a;

    --band: #0e0c09;
    --band-ink: var(--ink);
    --grain: 0;
  }
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(70rem 40rem at 70% -10rem, var(--paper-glow), transparent 70%) no-repeat,
    var(--paper);
  -webkit-font-smoothing: antialiased;
}

/* Paper grain, light theme only. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1,
h2,
h3,
p,
ol,
ul {
  margin: 0;
}

ol,
ul {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
}

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

main:focus {
  outline: none;
}

.defs {
  position: absolute;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 200;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  font-weight: 600;
}

.skip:focus {
  top: 1rem;
}

.wrap {
  width: 100%;
  max-width: calc(72rem + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.display {
  font-family: var(--display);
  font-stretch: 118%;
  font-weight: 800;
  letter-spacing: -0.025em;
  font-size: clamp(2.5rem, 6.2vw, 5rem);
  line-height: 1;
  text-wrap: balance;
}

.h2 {
  font-family: var(--display);
  font-stretch: 118%;
  font-weight: 700;
  letter-spacing: -0.025em;
  font-size: clamp(1.75rem, 3.6vw, 2.75rem);
  line-height: 1.1;
  text-wrap: balance;
}

.h3 {
  font-family: var(--display);
  font-stretch: 112%;
  font-weight: 700;
  letter-spacing: -0.015em;
  font-size: 1.25rem;
  line-height: 1.25;
}

.center {
  text-align: center;
}

.lead {
  font-size: clamp(1.125rem, 1.6vw, 1.3125rem);
  line-height: 1.5;
}

.small {
  font-size: 0.875rem;
}

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

.label,
.eyebrow {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

.eyebrow::before {
  content: "";
  width: 24px;
  height: 2px;
  background: var(--accent);
}

.mono,
.money,
.code,
.stamp,
.quote {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums slashed-zero;
}

.money {
  font-weight: 600;
  white-space: nowrap;
}

.code,
.stamp {
  letter-spacing: 0.08em;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- Buttons and links ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 160ms var(--ease);
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  min-height: 52px;
  padding: 0 1.5rem;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 1.0625rem;
  box-shadow:
    inset 0 -2px 0 rgb(0 0 0 / 0.18),
    0 6px 16px -6px color-mix(in srgb, var(--accent) 45%, transparent);
}

.btn--primary:hover {
  background: var(--accent-hover);
}

.btn--ghost,
.btn--small {
  min-height: 40px;
  padding: 0 1rem;
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.9375rem;
}

.btn--ghost:hover,
.btn--small:hover {
  background: var(--surface);
}

.btn--small {
  min-height: 44px;
  border-color: var(--rule-strong);
}

.btn--small[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--surface);
  box-shadow: inset 0 -2px 0 var(--ink);
}

.textlink {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  gap: 0.35rem;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--rule-strong);
  text-underline-offset: 0.25em;
  text-decoration-thickness: 1.5px;
}

.textlink:hover {
  text-decoration-color: var(--accent);
}

/* ---------- Header ---------- */

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  position: relative;
}

.site-header__inner::after {
  content: "";
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: 0;
  height: 1px;
  background: var(--rule);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  text-decoration: none;
}

.logo__word {
  font-family: var(--display);
  font-stretch: 118%;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 1.25rem;
  line-height: 1;
}

.mark {
  flex: none;
  overflow: visible;
}

.m-body {
  fill: var(--tag);
  stroke: var(--ink);
  stroke-width: 1.75;
  stroke-linejoin: round;
}

.m-hole {
  fill: var(--paper);
  stroke: var(--accent);
  stroke-width: 1.5;
}

.m-string {
  fill: none;
  stroke: var(--tag-edge);
  stroke-width: 1.5;
  stroke-linecap: round;
}

.m-tick {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.site-nav__link {
  font-weight: 500;
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.site-nav__link:hover {
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

/* ---------- The service tag ---------- */

.tag {
  --cut: 22px;
  position: relative;
  padding: 1px;
  background: var(--tag-edge);
  border-radius: 14px;
  clip-path: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%, 0 var(--cut));
}

.tag__face {
  position: relative;
  background: var(--tag);
  border-radius: 13px;
  clip-path: polygon(
    calc(var(--cut) - 0.4px) 0,
    calc(100% - var(--cut) + 0.4px) 0,
    100% calc(var(--cut) - 0.4px),
    100% 100%,
    0 100%,
    0 calc(var(--cut) - 0.4px)
  );
  padding: 3.5rem 1.75rem 1.75rem;
  color: var(--ink);
}

.swing {
  filter: drop-shadow(0 1px 0 rgb(0 0 0 / 0.06)) drop-shadow(0 18px 20px rgb(60 40 10 / 0.3));
}

.tag__hole {
  position: absolute;
  top: 1.1rem;
  left: 50%;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  border-radius: 50%;
  background: var(--paper);
  border: 3px solid var(--tag-edge);
  box-shadow:
    0 0 0 4px var(--tag),
    0 0 0 5.5px var(--tag-edge);
}

.tag__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.tag .label {
  display: block;
  color: var(--ink-muted);
  font-size: 0.75rem;
  margin-bottom: 0.3rem;
}

.stamp {
  display: inline-block;
  font-size: 2.5rem;
  line-height: 1;
  padding: 0.3rem 0.55rem;
  border: 2px dashed var(--accent);
  border-radius: 6px;
  color: var(--ink);
}

.tag__who {
  margin-top: 1rem;
  font-weight: 500;
}

.tear {
  border: 0;
  border-top: 1.5px dashed var(--rule-strong);
  margin: 1rem -0.25rem;
}

.faults {
  display: grid;
  gap: 0.45rem;
}

.faults li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  line-height: 1.3;
}

.box {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 4px;
  background: var(--accent);
}

.box svg {
  width: 0.95rem;
  height: 0.95rem;
  fill: none;
  stroke: var(--accent-ink);
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 16;
}

.quote {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  font-weight: 500;
}

.quote td,
.quote th {
  padding: 0.22rem 0;
  vertical-align: baseline;
  text-align: left;
}

.quote tbody td:nth-child(2) {
  color: var(--ink-muted);
  padding-inline: 0.6rem;
  white-space: nowrap;
}

.quote td:last-child {
  text-align: right;
}

.quote tfoot th,
.quote tfoot td {
  border-top: 2px solid var(--ink);
  padding-top: 0.5rem;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.75rem;
  padding: 0 0.7rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface);
  color: var(--ink);
}

.badge--ok {
  background: var(--ok-tint);
  color: var(--ok-ink);
}

.badge--wait {
  background: var(--wait-tint);
  color: var(--wait-ink);
}

.badge--quote {
  background: var(--quote-tint);
  color: var(--quote-ink);
}

.badge--work {
  background: var(--accent-soft);
  color: var(--ink);
}

.empty {
  display: grid;
  place-items: center;
  min-height: 4.5rem;
  border: 1.5px dashed var(--rule-strong);
  border-radius: 8px;
  color: var(--ink-muted);
  font-size: 0.875rem;
}

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

.hero {
  overflow: clip;
  padding-bottom: var(--gap);
}

.hero__grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 1.5rem;
  align-items: start;
}

.hero__copy {
  grid-column: 1 / span 7;
  padding-top: clamp(4rem, 9vw, 7.5rem);
}

.hero__copy .display {
  font-size: clamp(2.5rem, 4vw, 3.25rem);
  margin-bottom: 1.5rem;
}

.hero__copy .lead {
  max-width: 34ch;
  color: var(--ink-muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  margin: 2rem 0 1rem;
}

.hero__art {
  grid-column: 8 / span 5;
  display: flex;
  justify-content: center;
}

.hang {
  --rest: 3deg;
  position: relative;
  width: min(26rem, 100%);
  padding-top: 5.5rem;
}

.hang__string {
  position: absolute;
  top: 0;
  left: calc(50% - 2rem);
  width: 4rem;
  /* Reaches from the top edge of the hero down to the centre of the punched hole. */
  height: calc(5.5rem + 1.1rem + 9px);
  overflow: visible;
  z-index: 2;
}

.hang__string path {
  fill: none;
  stroke: var(--tag-edge);
  stroke-width: 2;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1;
}

.tilt,
.swing {
  transform-origin: 50% calc(1.1rem + 10px);
}

.hero .swing {
  transform: rotate(var(--rest));
}

.tag--hero {
  min-height: 30rem;
}

.tag--hero .tag__face {
  min-height: calc(30rem - 2px);
}

.desk {
  display: inline;
}

/* ---------- Problem ---------- */

.problem {
  overflow: clip;
  padding-bottom: var(--gap);
}

.problem__grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 1.5rem;
  align-items: center;
}

.problem__copy {
  grid-column: 2 / span 6;
  max-width: 40rem;
}

.problem__copy .h2 {
  margin-bottom: 1.25rem;
}

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

.notes {
  grid-column: 8 / span 5;
  position: relative;
  min-height: 15rem;
}

.note {
  position: absolute;
  width: 11rem;
  padding: 1rem 1.1rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 3px 10px 4px 12px;
  font-family: var(--mono);
  font-size: 0.9375rem;
  color: color-mix(in srgb, var(--ink) 70%, transparent);
  box-shadow: 0 10px 20px -14px rgb(60 40 10 / 0.4);
  transform: rotate(var(--r));
}

.note:nth-child(1) {
  left: 0;
  top: 0.5rem;
}

.note:nth-child(2) {
  left: 38%;
  top: 2.5rem;
  background: var(--tag);
}

.note:nth-child(3) {
  left: 14%;
  top: 8.5rem;
}

/* ---------- How it works ---------- */

.how {
  overflow: clip;
  padding-bottom: var(--gap);
}

.how__head {
  max-width: 40rem;
  margin-bottom: 3rem;
}

.how__head .lead {
  margin-top: 0.75rem;
  color: var(--ink-muted);
}

/* Default (phone, reduced motion, no JS): four static snapshots. */
.stage {
  display: none;
}

.beats {
  display: grid;
  gap: 4rem;
}

.beat {
  position: relative;
}

.beat__copy {
  max-width: 34rem;
}

.beat__copy .h3 {
  font-size: clamp(1.375rem, 2.2vw, 1.75rem);
  margin-bottom: 0.6rem;
}

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

.cue--a,
.cue--b,
.cue--c {
  position: absolute;
  left: 0;
  width: 1px;
  height: 1px;
}

.cue--a {
  top: 20%;
}

.cue--b {
  top: 50%;
}

.cue--c {
  top: 80%;
}

.snap {
  margin-top: 1.75rem;
  max-width: 26rem;
}

.tag--snap {
  transform: rotate(-1.5deg);
  margin: 0 0.5rem;
}

.tag--snap .stamp {
  font-size: 1.75rem;
}

.tag__total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-top: 2px solid var(--ink);
  padding-top: 0.5rem;
  font-size: 1.5rem;
  font-weight: 600;
}

.tag__total .money {
  font-size: 1.5rem;
}

.history {
  display: grid;
  gap: 0.2rem;
  font-size: 0.875rem;
}

.history .mono {
  color: var(--ink-muted);
  margin-right: 0.35rem;
}

.bubble {
  margin-top: 1.25rem;
  max-width: 22rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 18px 18px 18px 4px;
  font-size: 0.9375rem;
  line-height: 1.45;
  box-shadow: 0 12px 24px -16px rgb(60 40 10 / 0.45);
}

/* The six-step track, as the app draws it. */
.track {
  --p: 0;
  position: relative;
  margin-top: 1.5rem;
}

.track ol {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  position: relative;
}

.track li {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.4rem;
  font-size: 0.6875rem;
  line-height: 1.25;
  color: var(--ink-muted);
}

.track__line {
  position: absolute;
  top: 7px;
  left: calc(100% / 12);
  right: calc(100% / 12);
  height: 2px;
  background: var(--rule-strong);
}

.track__fill {
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform-origin: left;
  transform: scaleX(var(--p));
  transition: transform 500ms var(--ease);
}

.dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--rule-strong);
  display: grid;
  place-items: center;
}

.track__note {
  display: none;
  color: var(--wait-ink);
  font-weight: 600;
}

/* Track states from data-at (snapshots) or the stage's data-step. */
.track[data-at="2"],
.stage[data-step="2"] .track {
  --p: 0.2;
}

.track[data-at="4"],
.stage[data-step="3"] .track {
  --p: 0.6;
}

.track[data-at="5"],
.stage[data-step="4"] .track {
  --p: 0.8;
}

:is(.track[data-at="2"], .stage[data-step="2"] .track) li:nth-child(-n + 1) .dot,
:is(.track[data-at="4"], .stage[data-step="3"] .track) li:nth-child(-n + 3) .dot,
:is(.track[data-at="5"], .stage[data-step="4"] .track) li:nth-child(-n + 4) .dot {
  border-color: var(--accent);
  background: var(--accent)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5 5-5.5' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / 12px no-repeat;
}

:is(.track[data-at="1"], .stage[data-step="1"] .track) li:nth-child(1),
:is(.track[data-at="2"], .stage[data-step="2"] .track) li:nth-child(2),
:is(.track[data-at="4"], .stage[data-step="3"] .track) li:nth-child(4),
:is(.track[data-at="5"], .stage[data-step="4"] .track) li:nth-child(5) {
  color: var(--ink);
  font-weight: 600;
}

:is(.track[data-at="1"], .stage[data-step="1"] .track) li:nth-child(1) .dot,
:is(.track[data-at="2"], .stage[data-step="2"] .track) li:nth-child(2) .dot,
:is(.track[data-at="4"], .stage[data-step="3"] .track) li:nth-child(4) .dot,
:is(.track[data-at="5"], .stage[data-step="4"] .track) li:nth-child(5) .dot {
  border-color: var(--accent);
  box-shadow:
    0 0 0 2px var(--paper),
    0 0 0 4px var(--accent);
}

/* Scrolly stage, desktop with motion allowed and JS running. */
@media (min-width: 820px) and (prefers-reduced-motion: no-preference) {
  .js .scrolly {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: clamp(2rem, 5vw, 5rem);
  }

  .js .stage {
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: sticky;
    top: 12vh;
    height: 76vh;
    min-height: 34rem;
  }

  .js .beats {
    gap: 0;
  }

  .js .beat {
    min-height: 70vh;
    display: flex;
    align-items: center;
  }

  /* Only the body text dims, so the four headings always read as a list. */
  .js .beat .beat__copy p {
    opacity: 0.5;
    transition: opacity 300ms var(--ease);
  }

  .js .beat.is-active .beat__copy p {
    opacity: 1;
  }

  .js .snap {
    display: none;
  }
}

.stage__tag {
  position: relative;
  width: min(22rem, 100%);
  margin-inline: auto;
}

.tag--stage .tag__face {
  padding: 3rem 1.4rem 1.4rem;
  font-size: 0.9375rem;
}

.tag--stage .quote {
  font-size: 0.75rem;
}

.tag--stage .stamp {
  font-size: 1.875rem;
}

.badges {
  display: grid;
  justify-items: end;
}

.badges .badge {
  grid-area: 1 / 1;
  opacity: 0;
  transition: opacity 200ms linear;
}

.stage[data-badge="in"] [data-b="in"],
.stage[data-badge="quote"] [data-b="quote"],
.stage[data-badge="approved"] [data-b="approved"],
.stage[data-badge="progress"] [data-b="progress"],
.stage[data-badge="wait"] [data-b="wait"],
.stage[data-badge="ready"] [data-b="ready"] {
  opacity: 1;
}

.quote-area {
  display: grid;
}

.quote-area > * {
  grid-area: 1 / 1;
}

.quote-area .empty {
  align-self: start;
  opacity: 0;
  transition: opacity 200ms linear;
}

.stage[data-step="1"] .quote-area .empty {
  opacity: 1;
}

.stage .quote tr {
  transition:
    opacity 260ms var(--ease),
    transform 260ms var(--ease);
  transition-delay: calc(var(--i, 5) * 90ms);
}

.stage[data-step="1"] .quote tr {
  opacity: 0;
  transform: translateY(8px);
  transition-delay: 0ms;
}

.stage .history,
.stage .bubble {
  position: absolute;
  right: -7rem;
  bottom: 2.5rem;
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 300ms var(--ease),
    transform 300ms var(--ease);
  pointer-events: none;
}

.stage .history {
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: 0 12px 24px -16px rgb(60 40 10 / 0.45);
}

.stage .bubble {
  max-width: 19rem;
}

.stage[data-step="3"] .history,
.stage[data-step="4"] .bubble {
  opacity: 1;
  transform: none;
}

.stage[data-badge="wait"] .track li:nth-child(4) .track__note,
.track[data-at="4"] li:nth-child(4) .track__note {
  display: block;
}

/* ---------- Features ---------- */

.features {
  background: var(--sunken);
  padding-block: var(--gap);
  margin-bottom: var(--gap);
}

.features .h2 {
  margin-bottom: 3rem;
}

.bento {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1.25rem;
}

.card {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.75rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 14px;
  transition:
    transform 240ms var(--ease),
    opacity 400ms var(--ease);
}

.card--wide {
  grid-column: span 3;
}

.card:hover {
  border-color: var(--rule-strong);
  transform: translateY(-2px);
}

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

.icon {
  width: 40px;
  height: 40px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon .accent {
  stroke: var(--accent);
}

.icon circle.accent:not([r="2"]) {
  fill: var(--accent);
}

.codes {
  margin-top: auto;
  padding-top: 0.75rem;
  display: grid;
  gap: 0.5rem;
}

.codes__right {
  font-size: 2.25rem;
  line-height: 1;
}

.codes__wrong {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
}

.codes__wrong .code {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
  color: var(--ink-muted);
  opacity: 0.75;
  transition:
    transform 240ms var(--ease),
    opacity 240ms var(--ease);
}

.codes__wrong svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .card--codes:hover .codes__wrong .code {
    opacity: 0;
    transform: translateY(-1.6rem);
  }
}

.quote--mini {
  margin-top: auto;
  font-size: 0.875rem;
}

.quote--mini tfoot th,
.quote--mini tfoot td {
  font-size: 1.125rem;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
}

/* ---------- Try it ---------- */

.try {
  padding-bottom: var(--gap);
  overflow: clip;
}

.try__grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 1.5rem;
  align-items: center;
}

.try__frame {
  grid-column: 1 / span 8;
  grid-row: 1;
  position: relative;
}

.try__copy {
  grid-column: 9 / span 4;
  grid-row: 1;
}

/* Wide enough for the app's own desktop shell (sidebar from 768px) inside the frame. */
@media (min-width: 1180px) {
  .try__grid {
    grid-template-columns: minmax(0, 1fr) 20rem;
    column-gap: 3rem;
  }

  .try__frame {
    grid-column: 1;
  }

  .try__copy {
    grid-column: 2;
  }
}

.try__copy .h2 {
  margin-bottom: 1rem;
}

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

.steps {
  counter-reset: s;
  display: grid;
  gap: 0.6rem;
  margin: 1.5rem 0;
}

.steps li {
  counter-increment: s;
  position: relative;
  padding-left: 1.6rem;
  font-size: 0.9375rem;
}

.steps li::before {
  content: counter(s);
  position: absolute;
  left: 0;
  font-family: var(--mono);
  font-weight: 600;
  color: var(--accent);
}

.steer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.ghost-tag {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: translate(24px, 24px) rotate(2deg);
  fill: none;
  stroke: var(--rule);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.frame {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 2px 0 rgb(0 0 0 / 0.04),
    0 30px 60px -30px rgb(60 40 10 / 0.35);
}

.frame__bar {
  position: relative;
  display: flex;
  align-items: center;
  height: 36px;
  padding: 0 0.85rem;
  border-bottom: 1px solid var(--rule);
}

.frame__dots {
  display: flex;
  gap: 6px;
}

.frame__dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--rule-strong);
}

.frame__label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-muted);
  white-space: nowrap;
}

.frame iframe {
  display: block;
  width: 100%;
  height: 640px;
  border: 0;
  background: var(--paper);
}

/* ---------- Closing ---------- */

.close {
  position: relative;
  overflow: clip;
  background: var(--band);
  color: var(--band-ink);
  padding-block: clamp(5rem, 10vw, 8rem);
  text-align: center;
  --paper: var(--band);
  --focus: #8ab4ff;
}

.close__inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.close__title {
  max-width: 14ch;
}

.close .lead {
  max-width: 38rem;
  opacity: 0.85;
}

.close .btn--primary {
  margin-top: 0.75rem;
}

.close .small {
  opacity: 0.8;
}

.close__art {
  position: absolute;
  right: -3rem;
  top: -2rem;
  width: 18rem;
  --rest: -6deg;
}

.close__swing {
  transform: rotate(var(--rest));
  transform-origin: 50% calc(1.1rem + 10px);
}

.tag--close .tag__face {
  display: grid;
  justify-items: start;
  gap: 0.6rem;
  min-height: 20rem;
  text-align: left;
  --paper: var(--band);
}

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

.site-footer {
  color: var(--ink-muted);
  font-size: 0.875rem;
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 2rem;
  min-height: 6rem;
  padding-block: 1.5rem;
}

.site-footer__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--ink);
  font-weight: 600;
}

.site-footer__links {
  display: flex;
  gap: 1.25rem;
  margin-left: auto;
}

.site-footer__links a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* ---------- Motion ---------- */

@keyframes draw {
  from {
    stroke-dashoffset: 1;
  }
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes tick {
  from {
    stroke-dashoffset: 16;
  }
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes swing {
  0% {
    transform: rotate(calc(var(--rest) - 12deg));
  }
  40% {
    transform: rotate(calc(var(--rest) + 3deg));
  }
  70% {
    transform: rotate(calc(var(--rest) - 1.5deg));
  }
  100% {
    transform: rotate(var(--rest));
  }
}

@keyframes swing-small {
  0% {
    transform: rotate(calc(var(--rest) - 7.2deg));
  }
  40% {
    transform: rotate(calc(var(--rest) + 1.8deg));
  }
  70% {
    transform: rotate(calc(var(--rest) - 0.9deg));
  }
  100% {
    transform: rotate(var(--rest));
  }
}

@keyframes nudge-a {
  0%,
  100% {
    transform: rotate(0);
  }
  35% {
    transform: rotate(1.5deg);
  }
  70% {
    transform: rotate(-0.6deg);
  }
}

@keyframes nudge-b {
  0%,
  100% {
    transform: rotate(0);
  }
  35% {
    transform: rotate(1.5deg);
  }
  70% {
    transform: rotate(-0.6deg);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .hang__string path {
    animation: draw 600ms var(--ease) both;
  }

  .hero .swing {
    animation: swing 1.4s var(--ease) 600ms both;
  }

  .tag--hero .box svg {
    animation: tick 280ms var(--ease) both;
    animation-delay: 2000ms;
  }

  .tag--hero li:nth-child(2) .box svg {
    animation-delay: 2120ms;
  }

  .tag--hero li:nth-child(3) .box svg {
    animation-delay: 2240ms;
  }

  .stage .swing[data-n="a"] {
    animation: nudge-a 700ms var(--ease);
  }

  .stage .swing[data-n="b"] {
    animation: nudge-b 700ms var(--ease);
  }

  .js .close.in .close__swing {
    animation: swing-small 1.4s var(--ease) both;
  }

  .js .rise {
    opacity: 0;
    transform: translateY(6px);
    transition:
      opacity 500ms var(--ease),
      transform 500ms var(--ease);
    transition-delay: calc(var(--i, 0) * 60ms);
  }

  .js .note.rise {
    transform: translateY(6px) rotate(var(--r));
  }

  .js .rise.in {
    opacity: 1;
    transform: none;
  }

  .js .note.rise.in {
    transform: rotate(var(--r));
  }

  .js .snap.rise {
    transform: translateY(16px);
  }

  .js .snap.rise.in {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0ms !important;
    transition-delay: 0ms !important;
  }
}

/* ---------- Phone ---------- */

@media (max-width: 819.98px) {
  body {
    font-size: 1rem;
  }

  .site-nav__link {
    display: none;
  }

  .btn--ghost {
    min-height: 44px;
  }

  .desk {
    display: none;
  }

  .hero__copy,
  .hero__art,
  .problem__copy,
  .notes,
  .try__copy,
  .try__frame {
    grid-column: 1 / -1;
  }

  .hero__copy {
    padding-top: 3rem;
  }

  .hero__art {
    margin-top: 1rem;
  }

  .hang {
    --rest: -2deg;
    width: 100%;
    padding-top: 3rem;
  }

  .hang__string {
    height: calc(3rem + 1.1rem + 9px);
  }

  .tag--hero,
  .tag--hero .tag__face {
    min-height: 0;
  }

  .tag__face {
    padding: 3.25rem 1.25rem 1.4rem;
  }

  .stamp {
    font-size: 2rem;
  }

  .quote tbody td:nth-child(2) {
    padding-inline: 0.4rem;
  }

  .notes {
    display: flex;
    min-height: 0;
    margin-top: 2rem;
    gap: 0.5rem;
    padding-inline: 0.25rem;
    justify-content: center;
  }

  .note {
    position: static;
    width: auto;
    flex: 1 1 0;
    min-width: 0;
    font-size: 0.8125rem;
    padding: 0.75rem 0.6rem 0.9rem;
  }

  .bento {
    grid-template-columns: 1fr;
  }

  .card,
  .card--wide {
    grid-column: 1;
  }

  .try__copy {
    grid-row: 1;
    margin-bottom: 2.5rem;
  }

  .try__frame {
    grid-row: 2;
  }

  .ghost-tag {
    transform: translate(10px, 14px) rotate(2deg);
  }

  .frame iframe {
    height: 600px;
  }

  .close__art {
    position: relative;
    right: auto;
    top: auto;
    width: 11rem;
    margin: 0 auto 1.5rem;
    scale: none;
  }

  .tag--close .tag__face {
    min-height: 0;
    padding: 2.75rem 1rem 1rem;
  }

  .tag--close .stamp {
    font-size: 1.5rem;
  }

  .site-footer__inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-footer__links {
    margin-left: 0;
  }
}
