/* Chalkcard launch site. Tokens from docs/site/BRIEF.md. */

:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --sunken: #ebe9e3;
  --border: #dedbd3;
  --border-strong: #c4c0b5;
  --ink: #1c1b18;
  --ink-muted: #5f5c54;
  --ink-soft: #8a867c;
  --accent: #c2410c;
  --accent-hover: #9a3412;
  --on-accent: #ffffff;
  --accent-soft: #fdeadf;
  --accent-text: #9a3412;
  --success: #166534;
  --success-soft: #e7f5ec;
  --warning-text: #6b4a00;
  --warning-soft: #fff6d6;
  --focus: #2563eb;
  --grid-line: rgba(28, 27, 24, 0.06);

  --shadow:
    0 1px 2px rgba(28, 27, 24, 0.06), 0 8px 20px -6px rgba(28, 27, 24, 0.12),
    0 24px 48px -20px rgba(28, 27, 24, 0.18);
  --shadow-deep:
    0 1px 0 rgba(0, 0, 0, 0.04), 0 12px 24px -8px rgba(28, 27, 24, 0.18),
    0 40px 80px -24px rgba(28, 27, 24, 0.22);
  --paper-shadow:
    0 1px 0 rgba(0, 0, 0, 0.04), 0 12px 24px -8px rgba(28, 27, 24, 0.18),
    0 40px 80px -24px rgba(28, 27, 24, 0.22);

  /* Printed-card artifacts: always light. */
  --paper: #ffffff;
  --paper-ink: #1c1b18;
  --paper-muted: #5f5c54;
  --paper-rule: #dedbd3;
  --paper-row: #ebe9e3;
  --paper-accent: #c2410c;

  --display: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --pad: clamp(1.25rem, 4vw, 2.5rem);
  --section-gap: clamp(5rem, 10vw, 8rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141412;
    --surface: #1d1c1a;
    --sunken: #272623;
    --border: #34322e;
    --border-strong: #4a4741;
    --ink: #f2f0ea;
    --ink-muted: #aaa69c;
    --ink-soft: #7d7970;
    --accent: #fb923c;
    --accent-hover: #fdba74;
    --on-accent: #1c1006;
    --accent-soft: #3a2314;
    --accent-text: #fdba74;
    --success: #86efac;
    --success-soft: #13291b;
    --warning-text: #f5d97a;
    --warning-soft: #33290d;
    --focus: #60a5fa;
    --grid-line: rgba(242, 240, 234, 0.05);

    --shadow:
      0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 24px -8px rgba(0, 0, 0, 0.5),
      0 28px 56px -20px rgba(0, 0, 0, 0.6);
    --shadow-deep:
      0 1px 0 rgba(0, 0, 0, 0.3), 0 14px 28px -8px rgba(0, 0, 0, 0.55),
      0 44px 88px -24px rgba(0, 0, 0, 0.7);
    --paper-shadow:
      0 1px 0 rgba(0, 0, 0, 0.3), 0 14px 28px -8px rgba(0, 0, 0, 0.6),
      0 44px 88px -24px rgba(0, 0, 0, 0.75);
  }
}

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

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
figure,
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;
}

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

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

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

.mono {
  font-family: var(--mono);
}

.display {
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 112%;
  letter-spacing: -0.03em;
  line-height: 1.02;
  text-wrap: balance;
}

.display .line {
  display: block;
}

.h2 {
  font-size: clamp(1.875rem, 3.6vw, 3rem);
  max-width: 22ch;
}

h3 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
}

.eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-text);
  margin-bottom: 0.875rem;
}

.intro {
  margin-top: 1.25rem;
  color: var(--ink-muted);
  max-width: 56ch;
}

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

.section {
  padding-top: var(--section-gap);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  min-width: 44px;
  padding: 0 1.125rem;
  border-radius: 12px;
  font: 600 1rem/1 var(--body);
  text-decoration: none;
  border: 1px solid transparent;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

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

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

.btn-quiet {
  background: transparent;
  color: var(--ink);
  border-color: var(--border-strong);
}

.btn-quiet:hover {
  background: var(--sunken);
}

.btn-lg {
  min-height: 52px;
  border-radius: 14px;
  padding: 0 1.375rem;
}

.btn-xl {
  min-height: 56px;
  border-radius: 14px;
  padding: 0 1.75rem;
  font-size: 1.0625rem;
}

.arrow {
  display: inline-block;
  transition: transform 180ms var(--ease);
}

.btn:hover .arrow {
  transform: translateX(3px);
}

/* ---------- Skip link and header ---------- */

.skip-link {
  position: absolute;
  left: 1rem;
  top: 0.75rem;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1rem;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

.top-sentinel {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 64px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: border-color 200ms ease;
}

.js .site-header:not(.is-scrolled) {
  border-bottom-color: transparent;
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  text-decoration: none;
  color: var(--ink);
}

.logo-mark {
  flex: none;
}

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

.logo-sm .logo-word {
  font-size: 1rem;
}

.main-nav {
  display: none;
  gap: 0.25rem;
}

.main-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.75rem;
  border-radius: 10px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink-muted);
  text-decoration: none;
  transition:
    color 160ms ease,
    background-color 160ms ease;
}

.main-nav a:hover {
  color: var(--ink);
  background: var(--sunken);
}

.header-cta {
  font-size: 0.9375rem;
}

.cta-long {
  display: none;
}

@media (min-width: 860px) {
  .main-nav {
    display: flex;
  }
  .cta-long {
    display: inline;
  }
  .cta-short {
    display: none;
  }
}

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

.hero {
  position: relative;
  isolation: isolate;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -64px 0 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
  background-attachment: fixed;
  -webkit-mask-image: linear-gradient(#000 0 60%, transparent);
  mask-image: linear-gradient(#000 0 60%, transparent);
  pointer-events: none;
}

.hero-grid {
  display: grid;
  gap: 3rem;
  padding-top: clamp(2.5rem, 6vw, 4rem);
  padding-bottom: 3rem;
}

.hero h1 {
  font-size: clamp(2.5rem, 6.2vw, 5.25rem);
  text-wrap: balance;
}

.accent-word {
  color: var(--accent);
  white-space: nowrap;
}

.hero .lead {
  margin-top: 1.5rem;
  font-size: 1.25rem;
  line-height: 1.55;
  color: var(--ink-muted);
  max-width: 34ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.hero .fine {
  margin-top: 1rem;
}

@media (min-width: 960px) {
  .hero-grid {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: center;
    min-height: min(88vh, 54rem);
    gap: 3rem;
  }
  /* Sized to the copy column, not the viewport: the column stops growing
     once .wrap hits its max width, and the h1 must stay at four lines. */
  .hero-copy {
    container-type: inline-size;
  }
  .hero h1 {
    font-size: clamp(2.5rem, 4vw, 4.5rem);
    font-size: clamp(2.5rem, 11cqi, 4.5rem);
  }
}

.hero-art {
  position: relative;
  min-width: 0;
  padding-bottom: 2.75rem;
}

.tilt {
  transform-style: preserve-3d;
  will-change: transform;
}

.clipboard {
  position: relative;
  background: var(--sunken);
  border-radius: 24px;
  padding: 34px 20px 20px;
  box-shadow: inset 0 0 0 1px var(--border);
}

.clip {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 20px;
  width: 120px;
  height: 28px;
  margin-left: -60px;
  border-radius: 999px;
  background: var(--border-strong);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.45),
    0 2px 4px rgba(0, 0, 0, 0.12);
}

.paper {
  background: var(--paper);
  color: var(--paper-ink);
  border: 1px solid var(--paper-rule);
  border-radius: 6px;
  box-shadow: var(--paper-shadow);
}

.program-card {
  position: relative;
  container-type: inline-size;
  padding: 1.5rem 1.125rem 0.875rem;
  transform: rotate(-1.5deg);
}

.pc-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding-bottom: 0.625rem;
  border-bottom: 1px solid var(--paper-rule);
}

.pc-name {
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 112%;
  letter-spacing: -0.02em;
  font-size: 1.375rem;
  line-height: 1.15;
}

.pc-goal {
  font-size: 0.8125rem;
  color: var(--paper-muted);
  line-height: 1.4;
}

.pc-meta {
  text-align: right;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--paper-muted);
  flex: none;
}

.pc-notes {
  margin-top: 0.625rem;
  padding: 0.375rem 0.625rem;
  background: #f4f3ef;
  border-radius: 4px;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--paper-muted);
}

.pc-days {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

/* Side by side only when both days fit at their natural width; below that
   they stack, so no exercise name or header has to wrap. */
@container (min-width: 41rem) {
  .pc-days {
    grid-template-columns: 1fr 1fr;
  }
}

.pc-day {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  line-height: 1.3;
}

.pc-day caption {
  text-align: left;
  font-weight: 700;
  font-size: 0.8125rem;
  padding-bottom: 0.25rem;
  border-bottom: 1.5px solid var(--paper-ink);
}

.pc-day th,
.pc-day td {
  text-align: left;
  padding: 0.3125rem 0.1875rem 0.3125rem 0;
  border-bottom: 1px solid var(--paper-row);
  vertical-align: top;
}

.pc-day th {
  white-space: nowrap;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--paper-muted);
}

.pc-day .col-next {
  color: var(--paper-accent);
  font-weight: 700;
  white-space: nowrap;
  padding-right: 0;
}

.pc-day th.col-next {
  color: var(--paper-accent);
  font-weight: 700;
}

.pc-day td:nth-child(2),
.pc-day td:nth-child(3),
.pc-day td:nth-child(4) {
  white-space: nowrap;
}

@media (max-width: 519.98px) {
  .col-rest {
    display: none;
  }
  .program-card {
    padding: 1.25rem 0.75rem 0.75rem;
  }
  .pc-head {
    flex-direction: column;
    gap: 0.25rem;
  }
  .pc-meta {
    text-align: left;
  }
  .pc-day {
    font-size: 0.71875rem;
  }
}

.ring-target {
  position: relative;
  display: inline-block;
}

.ring {
  position: absolute;
  left: -10px;
  right: -10px;
  top: -7px;
  bottom: -7px;
  width: calc(100% + 20px);
  height: calc(100% + 14px);
  overflow: visible;
  pointer-events: none;
}

.ring path {
  fill: none;
  stroke: var(--paper-accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

/* The note hangs just below the card. main.js draws its arrow from the
   measured ring and note boxes, and adds .at-gutter when the two day tables
   sit side by side, so the arrow can run up the gutter between them.
   Otherwise the note sits under the card's right side and the arrow rises
   along the card's right margin. .hero-art keeps room below for it. */
.ring-note {
  position: absolute;
  top: calc(100% + 0.625rem);
  right: 10px;
  margin: 0;
  padding-right: 0.75rem;
  text-align: right;
  white-space: nowrap;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
}

.ring-note.at-gutter {
  right: auto;
  left: 50%;
  padding-right: 0;
  padding-left: 0.75rem;
  text-align: left;
}

.ring-arrow {
  position: absolute;
  left: 0;
  top: 0;
  overflow: visible;
}

.ring-arrow path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .clipboard {
    animation: rise-in 500ms var(--ease) both;
  }
  .program-card {
    animation: card-settle 500ms var(--ease) both;
  }
  .ring path {
    stroke-dashoffset: 1;
    animation: draw 700ms ease-out 800ms forwards;
  }
  .ring-note {
    animation: fade-in 300ms ease-out 1300ms both;
  }
  .ring-arrow path {
    stroke-dashoffset: 1;
    animation: draw 600ms ease-out 1500ms forwards;
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes card-settle {
  from {
    opacity: 0;
    transform: translateY(16px) rotate(-4deg);
  }
  to {
    opacity: 1;
    transform: rotate(-1.5deg);
  }
}

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

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ---------- Proof strip ---------- */

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

.proof-list li {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1.25rem 1rem;
}

.proof-list li:nth-child(odd) {
  padding-left: 0;
}

.proof-list li:nth-child(n + 3) {
  border-top: 1px solid var(--border);
}

.stat {
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 75%;
  font-size: 3rem;
  line-height: 1;
  color: var(--ink);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--ink-muted);
  line-height: 1.4;
}

@media (min-width: 720px) {
  .proof-list {
    grid-template-columns: repeat(4, 1fr);
  }
  .proof-list li {
    padding: 0.5rem 1.5rem;
  }
  .proof-list li:nth-child(n + 3) {
    border-top: 0;
  }
  .proof-list li + li {
    border-left: 1px solid var(--border);
  }
  .proof-list li:first-child {
    padding-left: 0;
  }
}

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

.steps-wrap {
  position: relative;
  margin-top: 3rem;
}

.steps {
  display: grid;
  gap: 3rem;
}

.steps-line {
  position: absolute;
  left: 1.25rem;
  top: 0;
  bottom: 0;
  border-left: 1px dashed var(--border-strong);
  transform-origin: top;
}

.step {
  position: relative;
  padding-left: 3.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

.step-num {
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 75%;
  font-size: 4.5rem;
  line-height: 1;
  color: var(--ink-soft);
  background: var(--bg);
  align-self: flex-start;
  margin-left: -3.25rem;
  padding: 0.25rem 0.5rem 0.25rem 0;
}

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

@media (min-width: 900px) {
  .steps {
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
  }
  .steps-line {
    left: 0;
    right: 0;
    top: 2.5rem;
    bottom: auto;
    border-left: 0;
    border-top: 1px dashed var(--border-strong);
    transform-origin: left;
  }
  .steps {
    grid-template-rows: auto auto 1fr auto;
  }
  .step {
    display: grid;
    grid-row: span 4;
    grid-template-rows: subgrid;
    gap: 0.75rem;
    padding-left: 0;
  }
  .step-num {
    justify-self: start;
    margin-left: 0;
    padding-right: 1rem;
  }
}

.illo {
  margin-top: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  font-size: 0.8125rem;
  line-height: 1.3;
}

.editor-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.625rem;
  align-items: center;
}

.editor-name {
  font-weight: 700;
  font-size: 0.9375rem;
}

.wells {
  grid-column: 1;
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 0.375rem;
}

.well {
  display: flex;
  flex-direction: column;
  padding: 0.375rem 0.5rem;
  background: var(--sunken);
  border-radius: 8px;
  font-weight: 600;
  white-space: nowrap;
}

.well small {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--ink-muted);
}

.movers {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.mover {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.mover svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--ink-muted);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.log-title {
  font-weight: 700;
  font-size: 0.9375rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.chip {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--sunken);
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.25rem;
}

.chip svg {
  position: absolute;
  right: 3px;
  top: 3px;
  width: 12px;
  height: 12px;
  fill: none;
  stroke: var(--success);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pill-save {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 0.875rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

.toast {
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: var(--success-soft);
  color: var(--success);
  font-weight: 600;
}

.illo-share {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.75rem;
  align-items: start;
}

.thumb {
  padding: 0.5rem;
  border-radius: 4px;
  box-shadow: 0 6px 14px -6px rgba(28, 27, 24, 0.3);
  transform: rotate(-2deg);
}

.bar {
  display: block;
  height: 5px;
  border-radius: 3px;
  background: #d6d3cb;
  margin-bottom: 4px;
}

.bar-name {
  width: 60%;
  height: 7px;
  background: #1c1b18;
}

.bar-short {
  width: 40%;
}

.bar-note {
  width: 100%;
  height: 10px;
  background: #f4f3ef;
}

.thumb-days {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-top: 6px;
}

.thumb-day .row {
  display: flex;
  gap: 3px;
  padding: 3px 0;
  border-bottom: 1px solid #ebe9e3;
}

.thumb-day i {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: #d6d3cb;
}

.thumb-day b {
  width: 28%;
  height: 3px;
  border-radius: 2px;
  background: var(--paper-accent);
}

.bubble {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.625rem 0.75rem;
  background: var(--sunken);
  border-radius: 14px 14px 14px 4px;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--ink);
  min-width: 0;
  overflow-wrap: break-word;
}

@media (max-width: 519.98px) {
  .illo-share {
    grid-template-columns: 1fr;
  }
  .illo-share .thumb {
    width: 7rem;
  }
}

/* ---------- Progression rules ---------- */

.rules-grid {
  display: grid;
  gap: 2.5rem;
  margin-top: 3rem;
}

@media (min-width: 960px) {
  .rules-grid {
    grid-template-columns: 7fr 5fr;
    align-items: start;
  }
}

.sim {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 1.25rem;
  min-width: 0;
}

@media (min-width: 600px) {
  .sim {
    padding: 2rem;
  }
}

.sim-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
}

.sim-title p {
  font-size: 0.9375rem;
}

.sim-controls {
  display: grid;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.no-js .sim-controls {
  display: none;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

legend {
  padding: 0;
  margin-bottom: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.seg {
  display: inline-flex;
  flex-wrap: wrap;
  padding: 4px;
  gap: 4px;
  background: var(--sunken);
  border-radius: 14px;
}

.seg label {
  position: relative;
  display: inline-flex;
}

.seg input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.seg span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--ink-muted);
  transition:
    background-color 160ms ease,
    color 160ms ease;
}

.seg input:checked + span {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(28, 27, 24, 0.12);
}

.seg input:focus-visible + span {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.sets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.set {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 0.25rem;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.set-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.set-num {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 3.25rem;
  padding: 0.125rem 0.5rem;
  border-radius: 10px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 2.25rem;
  line-height: 1.1;
  transition:
    background-color 160ms ease,
    color 160ms ease;
}

.set-num.is-hit {
  color: var(--success);
  background: var(--success-soft);
}

.set-num.is-hit::after {
  content: "✓";
  position: absolute;
  top: 2px;
  right: 4px;
  font-family: var(--body);
  font-size: 0.75rem;
  font-weight: 700;
}

.set-num.is-short {
  color: var(--warning-text);
  background: var(--warning-soft);
}

.set-btns {
  display: flex;
  gap: 0.25rem;
}

/* Phone: one row per set, label and count left, buttons right. */
@media (max-width: 519.98px) {
  .sets {
    grid-template-columns: 1fr;
  }
  .set {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    column-gap: 0.75rem;
    padding: 0.5rem 0.75rem;
  }
  .set .set-num {
    justify-self: start;
  }
}

.step-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: 600 1.25rem/1 var(--body);
  cursor: pointer;
  transition: background-color 160ms ease;
}

.step-btn:hover {
  background: var(--sunken);
}

.step-btn[aria-disabled="true"] {
  color: var(--ink-muted);
  background: var(--sunken);
  border-color: var(--border);
  cursor: not-allowed;
}

.sim-out {
  margin-top: 1.5rem;
  padding: 0.75rem 0 0.75rem 1rem;
  border-left: 3px solid var(--ink-muted);
  transition: border-color 200ms ease;
}

.sim-out.tone-success {
  border-left-color: var(--success);
}

.sim-out.tone-warning {
  border-left-color: var(--warning-text);
}

.sim-result {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.sim-value {
  display: block;
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 112%;
  letter-spacing: -0.02em;
  font-size: clamp(2.25rem, 5vw, 3rem);
  line-height: 1.05;
}

.tone-success .sim-value {
  color: var(--success);
}

.tone-warning .sim-value {
  color: var(--warning-text);
}

.sim-reason {
  font-weight: 600;
  color: var(--ink-muted);
}

@media (prefers-reduced-motion: no-preference) {
  .sim-value.is-changing {
    animation: value-in 180ms ease-out;
  }
}

@keyframes value-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.apply {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-top: 1.25rem;
}

.apply-pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--sunken);
  color: var(--ink-muted);
  font-weight: 600;
  font-size: 0.875rem;
}

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

.ledger-list li {
  display: grid;
  grid-template-columns: 2.25rem 1fr;
  gap: 0.75rem;
  padding: 1rem 0.75rem;
  border-top: 1px solid var(--border);
  border-left: 3px solid transparent;
  transition: background-color 200ms ease;
}

.ledger-list li:last-child {
  border-bottom: 1px solid var(--border);
}

.ledger-list li[aria-current="true"] {
  background: var(--accent-soft);
  border-left-color: var(--accent);
}

.ledger-num {
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 75%;
  font-size: 2rem;
  line-height: 1;
  color: var(--ink-muted);
}

.ledger-list p {
  font-size: 0.9375rem;
  color: var(--ink-muted);
}

.ledger-list strong {
  display: block;
  color: var(--ink);
  font-size: 1rem;
}

.ledger .fine {
  margin-top: 1rem;
}

/* ---------- The card (bento) ---------- */

.bento {
  display: grid;
  gap: 1rem;
  margin-top: 3rem;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.75rem;
  min-width: 0;
}

.tile p {
  color: var(--ink-muted);
  font-size: 0.9875rem;
}

.tile > :last-child {
  margin-top: auto;
}

.tile h3 + p + * {
  margin-top: 0.75rem;
}

@media (min-width: 760px) {
  .bento {
    grid-template-columns: repeat(6, 1fr);
  }
  .tile {
    grid-column: span 2;
  }
  .tile-big {
    grid-column: span 4;
    grid-row: span 2;
  }
}

.sheet-wrap {
  display: flex;
  justify-content: center;
  padding: 1rem 0 0.5rem;
}

.sheet {
  position: relative;
  width: min(15rem, 70%);
  aspect-ratio: 1 / 1.414;
  padding: 1rem 0.875rem;
  border-radius: 4px;
  transition:
    transform 220ms var(--ease),
    box-shadow 220ms var(--ease);
}

@media (hover: hover) and (pointer: fine) {
  .tile-big:hover .sheet {
    transform: translateY(-4px);
    box-shadow:
      0 1px 0 rgba(0, 0, 0, 0.04),
      0 18px 32px -8px rgba(28, 27, 24, 0.24),
      0 52px 96px -24px rgba(28, 27, 24, 0.3);
  }
}

.sheet .bar {
  height: 6px;
  margin-bottom: 6px;
}

.sheet .bar-name {
  height: 9px;
}

.sheet .bar-note {
  height: 14px;
}

.sheet .thumb-days {
  gap: 10px 8px;
}

.sheet .thumb-day .row {
  padding: 5px 0;
}

.sheet-tag {
  position: absolute;
  top: -10px;
  right: -12px;
  padding: 0.125rem 0.5rem;
  border-radius: 6px;
  background: var(--paper-accent);
  color: #ffffff;
  font-size: 0.6875rem;
  font-weight: 700;
  transform: rotate(4deg);
}

.unit-pills {
  display: inline-flex;
  gap: 0.375rem;
}

.unit {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 1rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  font-weight: 600;
  color: var(--ink-muted);
}

.unit.is-on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 0.75rem;
  border-radius: 8px;
  background: var(--sunken);
  font-size: 0.8125rem;
  font-weight: 600;
}

.tag-new {
  background: transparent;
  border: 1px dashed var(--border-strong);
  color: var(--accent-text);
}

.measure {
  display: grid;
  grid-template-columns: 44px auto;
  grid-template-rows: auto 44px;
  gap: 6px;
  align-self: flex-start;
}

.measure-h {
  grid-column: 1;
  position: relative;
  height: 14px;
  border-left: 1px solid var(--ink-muted);
  border-right: 1px solid var(--ink-muted);
}

.measure-h::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px solid var(--ink-muted);
}

.measure-h span {
  position: absolute;
  left: 50%;
  top: -4px;
  transform: translateX(-50%);
  padding: 0 3px;
  background: var(--surface);
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
}

.measure-box {
  grid-column: 1;
  grid-row: 2;
  width: 44px;
  height: 44px;
  border: 2px solid var(--accent);
  border-radius: 12px;
}

.measure-v {
  grid-column: 2;
  grid-row: 2;
  width: 10px;
  border-top: 1px solid var(--ink-muted);
  border-bottom: 1px solid var(--ink-muted);
  background: linear-gradient(var(--ink-muted), var(--ink-muted)) center / 1px
    100% no-repeat;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  align-self: flex-start;
  max-width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  background: var(--sunken);
  font-size: 0.8125rem;
}

.file-chip .mono {
  overflow-wrap: anywhere;
}

.file-icon,
.file-check {
  flex: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.file-icon {
  stroke: var(--ink-muted);
}

.file-check {
  stroke: var(--success);
  stroke-width: 2;
}

/* ---------- The real app ---------- */

.app-block {
  margin-top: 2.5rem;
}

.app-hint {
  max-width: 68rem;
  margin: 0 auto 0.75rem;
  font-size: 0.875rem;
  color: var(--ink-muted);
}

.frame {
  max-width: 68rem;
  margin-inline: auto;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-deep);
}

.frame-bar {
  position: relative;
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 14px;
  background: var(--sunken);
  border-bottom: 1px solid var(--border);
}

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

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

.address {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.125rem 1.25rem;
  border-radius: 999px;
  background: var(--bg);
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.frame iframe {
  display: block;
  width: 100%;
  height: min(78vh, 760px);
  border: 0;
  background: var(--bg);
}

.app-cta {
  display: flex;
  justify-content: center;
  margin-top: 1.75rem;
}

@media (max-width: 719.98px) {
  .frame {
    border: 8px solid var(--ink);
    border-radius: 28px;
  }
  .frame-bar {
    display: none;
  }
  .frame iframe {
    height: 640px;
  }
  .app-cta .btn {
    width: 100%;
  }
}

/* ---------- Questions ---------- */

.faq {
  max-width: 46rem;
  margin-top: 2.5rem;
  border-bottom: 1px solid var(--border);
}

.faq details {
  border-top: 1px solid var(--border);
}

.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 56px;
  padding: 0.75rem 0;
  font-weight: 600;
  font-size: 1.0625rem;
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1;
  color: var(--accent-text);
  transition: transform 200ms var(--ease);
}

.faq details[open] summary::after {
  transform: rotate(45deg);
}

.faq details p {
  padding: 0 2.5rem 1.25rem 0;
  color: var(--ink-muted);
}

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

.closing {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-top: var(--section-gap);
  padding-block: clamp(5rem, 10vw, 8rem);
  background-color: var(--ink);
  color: var(--bg);
  --band-grid: rgba(244, 243, 239, 0.06);
  background-image:
    linear-gradient(var(--band-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--band-grid) 1px, transparent 1px);
  background-size: 32px 32px;
  text-align: center;
}

@media (prefers-color-scheme: dark) {
  .closing {
    background-color: var(--surface);
    color: var(--ink);
    --band-grid: var(--grid-line);
  }
}

.closing-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.closing-title {
  font-size: clamp(2.5rem, 5.4vw, 4.5rem);
  max-width: 20ch;
}

.closing-line {
  margin: 1.5rem auto 2rem;
  max-width: 44ch;
  font-size: 1.125rem;
  opacity: 0.85;
}

.fan {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: none;
  pointer-events: none;
}

@media (min-width: 520px) {
  .fan {
    display: block;
  }
}

.fan-card {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 15rem;
  height: 21rem;
  margin: -10.5rem 0 0 -7.5rem;
  border-radius: 6px;
  background:
    repeating-linear-gradient(transparent 0 22px, #8a867c 22px 26px) 2rem 4rem /
      70% calc(100% - 6rem) no-repeat,
    linear-gradient(#8a867c, #8a867c) 2rem 2rem / 50% 10px no-repeat,
    #ffffff;
  opacity: 0.08;
}

.fan-a {
  transform: translateX(-9rem) rotate(-8deg);
}

.fan-b {
  transform: rotate(0deg);
}

.fan-c {
  transform: translateX(9rem) rotate(7deg);
}

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .fan-a {
      animation: fan-left linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 50%;
    }
    .fan-c {
      animation: fan-right linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 50%;
    }
  }
}

@keyframes fan-left {
  from {
    transform: translateX(-9rem) rotate(-8deg);
  }
  to {
    transform: translateX(calc(-9rem - 12px)) rotate(-8deg);
  }
}

@keyframes fan-right {
  from {
    transform: translateX(9rem) rotate(7deg);
  }
  to {
    transform: translateX(calc(9rem + 12px)) rotate(7deg);
  }
}

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

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

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.site-footer .logo {
  color: var(--ink);
}

.footer-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  font-weight: 600;
  color: var(--accent-text);
  text-underline-offset: 3px;
}

@media (min-width: 760px) {
  .footer-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
  }
}

/* ---------- Scroll reveals (only with JS, only with motion) ---------- */

@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    transform: translateY(16px);
    transition:
      opacity 500ms var(--ease),
      transform 500ms var(--ease);
    transition-delay: calc(var(--i, 0) * 60ms);
  }
  .js .step.reveal {
    transform: translateY(20px);
    transition-delay: calc(var(--i, 0) * 90ms);
  }
  .js .reveal-frame {
    transform: translateY(24px) scale(0.97);
  }
  .js .reveal.is-in {
    opacity: 1;
    transform: none;
  }

  .js .steps-line {
    transform: scaleY(0);
    transition: transform 800ms var(--ease);
  }
  .js .steps-line.is-in {
    transform: none;
  }
  @media (min-width: 900px) {
    .js .steps-line {
      transform: scaleX(0);
    }
  }

  .js .stat-fade {
    opacity: 0;
    transition: opacity 600ms ease-out;
  }
  .js .is-in .stat-fade {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .arrow,
  .btn:hover .arrow {
    transition: none;
    transform: none;
  }
  .sheet,
  .tile-big:hover .sheet {
    transition: none;
    transform: none;
  }
}
