/* Ruled launch site. Tokens from docs/site/BRIEF.md (the app's own palette plus --margin and --ink-soft). */

:root {
  color-scheme: light dark;
  --paper: #f4f1ea;
  --paper-glow: #fbf8f1;
  --card: #fffdf8;
  --ink: #1f2328;
  --ink-muted: #575d66;
  --ink-soft: #8a8f98;
  --line: #e2ddd1;
  --rule: #d5e2ef;
  --margin: #d64545;
  --accent: #3b5bdb;
  --accent-strong: #2c47b8;
  --accent-soft: #e6ebfb;
  --on-accent: #ffffff;
  --again: #b42318;
  --on-again: #ffffff;
  --hard: #f0b429;
  --on-hard: #3a2600;
  --good: #1d7a48;
  --on-good: #ffffff;
  --easy: #1d5fd1;
  --on-easy: #ffffff;
  --shadow-card: 0 1px 2px rgb(31 35 40 / 0.06), 0 12px 32px -12px rgb(31 35 40 / 0.18);
  --shadow-lift: 0 2px 4px rgb(31 35 40 / 0.08), 0 24px 48px -20px rgb(31 35 40 / 0.28);

  --font-serif: "Newsreader", "Iowan Old Style", Charter, "Palatino Linotype", Georgia, serif;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --size-hero: clamp(2.25rem, 1.2rem + 3.1vw, 3.6rem);
  --size-h2: clamp(1.875rem, 1.4rem + 2vw, 3rem);
  --size-card: clamp(1.5rem, 1.2rem + 1.5vw, 2.25rem);
  --radius: 18px;
  --radius-sm: 10px;
  --gutter: 1.25rem;
  --section-gap: clamp(5rem, 10vw, 9rem);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-flip: cubic-bezier(0.2, 0, 0, 1);
  --card-lines: repeating-linear-gradient(
    to bottom,
    transparent 0 calc(1.75rem - 1px),
    var(--rule) calc(1.75rem - 1px) 1.75rem
  );
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14161b;
    --paper-glow: #1b1e25;
    --card: #1e2128;
    --ink: #e9e7e2;
    --ink-muted: #a5aab4;
    --ink-soft: #5d626c;
    --line: #30343d;
    --rule: #2a3550;
    --margin: #e07a72;
    --accent: #93a6ff;
    --accent-strong: #b0bfff;
    --accent-soft: #262d4a;
    --on-accent: #10152a;
    --again: #f28b82;
    --on-again: #3b0906;
    --hard: #f6c453;
    --on-hard: #3a2600;
    --good: #6fcf97;
    --on-good: #0b2e1b;
    --easy: #8ab4f8;
    --on-easy: #0b1f3f;
    --shadow-card: 0 1px 2px rgb(0 0 0 / 0.4), 0 16px 40px -16px rgb(0 0 0 / 0.6);
    --shadow-lift: 0 2px 4px rgb(0 0 0 / 0.4), 0 28px 56px -20px rgb(0 0 0 / 0.7);
  }
}

/* Base */

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

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

body {
  margin: 0;
  overflow-x: clip;
  font-family: var(--font-ui);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 50% -10%, var(--paper-glow), transparent 60%) no-repeat,
    var(--paper);
  -webkit-font-smoothing: antialiased;
}

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

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

h1,
h2 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-optical-sizing: auto;
  letter-spacing: -0.025em;
  line-height: 1.08;
  text-wrap: balance;
}

h2 {
  font-size: var(--size-h2);
}

h3 {
  font-size: 1.1875rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

em {
  font-style: italic;
}

a {
  color: var(--accent);
}

a:hover {
  color: var(--accent-strong);
}

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

[hidden] {
  display: none !important;
}

.mono,
.key,
code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  font-variant-numeric: tabular-nums;
}

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

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

.skip-link {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1rem;
  border-radius: var(--radius-sm);
  background: var(--card);
  box-shadow: var(--shadow-card);
  transform: translateY(-200%);
}

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

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

.eyebrow {
  margin-bottom: 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.body-copy {
  max-width: 34rem;
  margin-top: 1.25rem;
  color: var(--ink-muted);
}

/* Buttons and links */

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0 1.25rem;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.pill:hover {
  background: var(--accent-strong);
  color: var(--on-accent);
}

.pill-large {
  min-height: 52px;
  padding: 0 1.75rem;
}

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

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

.quiet-link,
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 44px;
  font-weight: 600;
  text-decoration: none;
}

.quiet-link:hover,
.text-link:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.quiet-button {
  min-height: 44px;
  min-width: 44px;
  padding: 0 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  cursor: pointer;
}

.quiet-button:hover {
  color: var(--ink);
  background: var(--accent-soft);
}

/* Top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 64px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 85%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

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

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 100%;
  max-width: calc(72rem + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

.brand:hover {
  color: var(--ink);
}

.logo {
  flex: none;
}

.wordmark {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-links {
  display: flex;
  gap: 0.25rem;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.75rem;
  border-radius: 999px;
  color: var(--ink-muted);
  font-size: 0.9375rem;
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--ink);
  background: var(--accent-soft);
}

.label-narrow {
  display: none;
}

@media (max-width: 719px) {
  .nav-links {
    display: none;
  }

  .label-wide {
    display: none;
  }

  .label-narrow {
    display: inline;
  }
}

/* 1. Hero */

.hero {
  position: relative;
  isolation: isolate;
  padding-block: clamp(2.5rem, 6vw, 4rem);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(var(--margin), var(--margin)) 0 5.5rem / 100% 1px no-repeat,
    repeating-linear-gradient(to bottom, transparent 0 calc(2.25rem - 1px), var(--rule) calc(2.25rem - 1px) 2.25rem);
  opacity: 0.55;
  -webkit-mask-image: linear-gradient(to bottom, #000 35%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 35%, transparent 100%);
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: center;
  column-gap: 2rem;
  row-gap: 3rem;
  min-height: min(88vh, 52rem);
}

.hero-copy {
  grid-column: 1 / span 7;
}

.hero-title {
  font-size: var(--size-hero);
  line-height: 1.02;
}

/* One sentence per line; below 900 px each may wrap, but balanced. */
.hero-line {
  display: block;
  text-wrap: balance;
}

@media (min-width: 900px) {
  .hero-line {
    white-space: nowrap;
  }
}

.hero-sub {
  max-width: 32rem;
  margin-top: 1.5rem;
  font-size: 1.125rem;
  color: var(--ink-muted);
}

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

.hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0;
  margin-top: 1.5rem;
  font-size: 0.9375rem;
  color: var(--ink-muted);
}

.hero-facts li + li::before {
  content: "·";
  margin-inline: 0.6rem;
  color: var(--ink-soft);
}

/* Hero demo */

.demo {
  grid-column: 8 / span 5;
  width: 100%;
  max-width: 30rem;
  justify-self: center;
}

.stack {
  position: relative;
  aspect-ratio: 1.58;
  perspective: 1400px;
}

.stack-back,
.demo-card {
  position: absolute;
  inset: 0;
}

.stack-back,
.demo-face,
.loose-card,
.closing-card {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    linear-gradient(var(--top-rule, var(--margin)), var(--top-rule, var(--margin))) 0 3rem / 100% 2px no-repeat,
    var(--card-lines) 0 3.5rem / 100% calc(100% - 4.25rem) no-repeat,
    var(--card);
  box-shadow: var(--shadow-card);
}

.stack-back-1 {
  transform: rotate(-3deg);
}

.stack-back-2 {
  transform: rotate(2deg);
}

.demo-card {
  z-index: 1;
}

.demo-card-inner {
  position: relative;
  height: 100%;
  transform-style: preserve-3d;
}

.demo-card.is-flipped .demo-card-inner {
  transform: rotateY(180deg);
}

.demo-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 3.5rem 1.5rem 1.5rem;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.demo-back {
  transform: rotateY(180deg);
}

.demo-label {
  position: absolute;
  top: 0.85rem;
  left: 1.25rem;
  font-size: 0.875rem;
  color: var(--ink-muted);
}

.demo-text {
  font-family: var(--font-serif);
  font-size: var(--size-card);
  font-optical-sizing: auto;
  line-height: 1.2;
  text-align: center;
}

.demo-card.is-done {
  --top-rule: var(--good);
}

.demo-card.is-leaving {
  z-index: 2;
  pointer-events: none;
}

.demo-controls {
  display: grid;
  justify-items: center;
  min-height: 4rem;
  margin-top: 1.75rem;
}

.pill-show {
  min-height: 52px;
  padding: 0 1.75rem;
}

.pill-show .key {
  padding: 0.05rem 0.45rem;
  border-radius: 6px;
  background: color-mix(in srgb, var(--on-accent) 18%, transparent);
}

.grades {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  width: 100%;
}

.grade {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  min-height: 60px;
  padding: 0.4rem 0.5rem;
  border: 0;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  line-height: 1.25;
}

button.grade {
  cursor: pointer;
}

button.grade:hover {
  filter: brightness(1.06);
}

.grade-meta {
  display: inline-flex;
  gap: 0.5rem;
  font-weight: 500;
  opacity: 0.9;
}

.grade-again {
  background: var(--again);
  color: var(--on-again);
}

.grade-hard {
  background: var(--hard);
  color: var(--on-hard);
}

.grade-good {
  background: var(--good);
  color: var(--on-good);
}

.grade-easy {
  background: var(--easy);
  color: var(--on-easy);
}

.demo-done {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 1.25rem;
}

.demo-live {
  min-height: 1.6em;
  margin-top: 0.75rem;
  text-align: center;
  font-size: 0.9375rem;
  color: var(--ink-muted);
}

@media (max-width: 899px) {
  .hero-copy,
  .demo {
    grid-column: 1 / -1;
  }

  .hero-grid {
    min-height: 0;
  }
}

@media (max-width: 719px) {
  :root {
    --gutter: 1rem;
  }

  .demo {
    max-width: none;
  }
}

@media (max-width: 479px) {
  .grades {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .demo-face {
    padding-top: 3.25rem;
  }
}

/* Sections */

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

.section-head {
  max-width: 46rem;
}

.section-head.narrow {
  max-width: 40rem;
}

/* 2. The life of one card */

.timeline {
  --arc-h: 6rem;
  --axis-h: 2.75rem;
  --stem: 6.75rem;
  --tier-step: 5.75rem;
  --stop-w: 8rem;
  --stop-h: 5rem;
  position: relative;
  height: calc(var(--axis-h) + var(--stem) + 2 * var(--tier-step) + var(--stop-h));
  margin-top: 3.5rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--axis-h);
  height: 2px;
  background: var(--rule);
}

.timeline-arcs {
  position: absolute;
  left: 0;
  bottom: var(--axis-h);
  width: 100%;
  height: var(--arc-h);
  overflow: visible;
}

.arc {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-dasharray: 4 5;
  vector-effect: non-scaling-stroke;
}

.arc-mask {
  fill: none;
  stroke: #fff;
  stroke-width: 28;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 0;
}

.timeline-arcs mask:nth-of-type(2) .arc-mask {
  --i: 1;
}
.timeline-arcs mask:nth-of-type(3) .arc-mask {
  --i: 2;
}
.timeline-arcs mask:nth-of-type(4) .arc-mask {
  --i: 3;
}
.timeline-arcs mask:nth-of-type(5) .arc-mask {
  --i: 4;
}
.timeline-arcs mask:nth-of-type(6) .arc-mask {
  --i: 5;
}
.timeline-arcs mask:nth-of-type(7) .arc-mask {
  --i: 6;
}

.stop {
  position: absolute;
  left: var(--x);
  bottom: var(--axis-h);
  width: 0;
  height: calc(var(--stem) + var(--tier) * var(--tier-step));
}

.stop::before {
  content: "";
  position: absolute;
  left: -0.5px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line);
}

.stop::after {
  content: "";
  position: absolute;
  left: -5px;
  bottom: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--paper);
  background: var(--accent);
}

.stop-card {
  position: absolute;
  z-index: 1;
  left: -1px;
  bottom: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: var(--stop-w);
  height: var(--stop-h);
  padding: 0.5rem 0.75rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(var(--margin), var(--margin)) 0 0.9rem / 100% 1.5px no-repeat,
    var(--card);
  box-shadow: var(--shadow-card);
}

.stop-last .stop-card {
  left: auto;
  right: -1px;
}

.stop-interval {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

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

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

.axis span {
  position: absolute;
  bottom: 0;
  left: var(--x);
  height: calc(var(--axis-h) - 0.5rem);
  display: flex;
  align-items: flex-end;
  font-size: 0.875rem;
  color: var(--ink-muted);
  transform: translateX(-50%);
}

.axis span:first-child {
  transform: none;
}

.aside-note {
  max-width: 34rem;
  margin-top: 3rem;
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--margin);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: color-mix(in srgb, var(--card) 70%, transparent);
  color: var(--ink-muted);
}

@media (max-width: 1023px) {
  .timeline {
    --stop-w: 6.5rem;
  }

  .stop-interval {
    font-size: 1.25rem;
  }
}

@media (max-width: 719px) {
  .timeline {
    height: auto;
    margin-top: 2.5rem;
  }

  .timeline::before,
  .timeline-arcs,
  .axis {
    display: none;
  }

  .stops {
    position: relative;
    padding-left: 3.25rem;
  }

  .stops::before {
    content: "";
    position: absolute;
    left: 1.5rem;
    top: 0;
    bottom: 1.1rem;
    width: 2px;
    background: var(--rule);
  }

  .stop {
    position: relative;
    left: auto;
    bottom: auto;
    width: auto;
    height: calc(2.5rem + var(--gap) * 0.9rem);
    display: flex;
    align-items: flex-end;
  }

  .stop::before {
    left: -1.75rem;
    top: 0.5rem;
    bottom: 1.1rem;
    width: 0.9rem;
    border: 1.5px dashed var(--accent);
    border-left: 0;
    border-radius: 0 100% 100% 0 / 0 50% 50% 0;
    background: none;
  }

  .stop::after {
    left: calc(-1.75rem - 4px);
    bottom: calc(1.1rem - 5px);
  }

  .stop-card,
  .stop-last .stop-card {
    position: static;
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    height: 2.2rem;
    padding: 0;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: none;
    box-shadow: none;
  }

  .stop-interval {
    font-size: 1.125rem;
  }

  .stop-review {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
  }
}

/* 3. How it works */

.steps {
  --gap: clamp(1.5rem, 3vw, 3rem);
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
  margin-top: 3.5rem;
}

/* The dashed connector runs from each numeral to the next one. */
.step:not(:last-child)::before {
  content: "";
  position: absolute;
  top: 2rem;
  left: 3.5rem;
  right: calc(0.75rem - var(--gap));
  border-top: 1.5px dashed var(--ink-soft);
  opacity: 0.6;
  transform-origin: left;
}

.step {
  position: relative;
  display: flex;
  flex-direction: column;
}

.step-num {
  order: -1;
  font-family: var(--font-serif);
  font-size: 4rem;
  font-weight: 400;
  line-height: 1;
  color: var(--ink-soft);
}

.step-art {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  height: 7.5rem;
  margin: 1.25rem 0 1.5rem;
}

.step h3 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.015em;
}

.step p {
  margin-top: 0.5rem;
  color: var(--ink-muted);
}

.mini-card {
  display: grid;
  align-content: start;
  gap: 0.6rem;
  width: 10rem;
  height: 6.25rem;
  padding: 1.6rem 0.9rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(var(--margin), var(--margin)) 0 1rem / 100% 1.5px no-repeat,
    var(--card);
  box-shadow: var(--shadow-card);
  transform: rotate(-2deg);
}

.field {
  display: flex;
  align-items: center;
  height: 1.6rem;
  padding: 0 0.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--font-serif);
  font-size: 0.9375rem;
}

.field-short {
  width: 70%;
}

.caret {
  width: 1.5px;
  height: 1em;
  margin-left: 1px;
  background: var(--accent);
}

.file-chip,
.date-chip,
.keycap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.file-chip {
  align-self: flex-end;
  margin-bottom: 0.5rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  transform: rotate(4deg);
}

.art-keys {
  gap: 0.4rem;
}

.keycap {
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 2px 0 var(--line);
}

.keycap-wide {
  min-width: 4.5rem;
}

.keycap-good {
  border-color: var(--good);
  background: var(--good);
  color: var(--on-good);
  box-shadow: 0 2px 0 color-mix(in srgb, var(--good) 60%, #000);
}

.art-dates {
  gap: 0;
}

.date-chip {
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow-card);
}

.date-chip:nth-child(1) {
  transform: rotate(-6deg) translateY(0.4rem);
}

.date-chip:nth-child(2) {
  margin-left: -0.4rem;
  transform: rotate(1deg);
}

.date-chip:nth-child(3) {
  margin-left: -0.4rem;
  transform: rotate(7deg) translateY(-0.4rem);
}

@media (max-width: 719px) {
  .steps {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .step:not(:last-child)::before {
    display: none;
  }
}

/* 4. Features */

.bento {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-areas:
    "today today today today limit limit"
    "grades grades csv csv csv csv"
    "grades grades local local keys keys"
    "night night night night night night";
  gap: 1rem;
  margin-top: 3.5rem;
}

.tile {
  --tile-rule: transparent;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
  padding: 1.75rem 1.5rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(var(--tile-rule), var(--tile-rule)) 0 0 / 100% 4px no-repeat,
    var(--card);
  box-shadow: var(--shadow-card);
}

.tile::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  box-shadow: var(--shadow-lift);
  opacity: 0;
  pointer-events: none;
}

.tile p {
  margin-top: 0.4rem;
  color: var(--ink-muted);
}

.rule-accent {
  --tile-rule: var(--accent);
}

.rule-hard {
  --tile-rule: var(--hard);
}

.rule-good {
  --tile-rule: var(--good);
}

.rule-grades {
  background:
    linear-gradient(
        to right,
        var(--again) 0 25%,
        var(--hard) 25% 50%,
        var(--good) 50% 75%,
        var(--easy) 75% 100%
      )
      0 0 / 100% 4px no-repeat,
    var(--card);
}

.tile-today {
  grid-area: today;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 1.5rem;
}

.tile-limit {
  grid-area: limit;
}

.tile-grades {
  grid-area: grades;
}

.tile-csv {
  grid-area: csv;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  align-items: center;
  gap: 1.5rem;
}

.tile-csv .csv-snippet {
  margin: 0;
}

.tile-local {
  grid-area: local;
}

.tile-keys {
  grid-area: keys;
}

.tile-night {
  grid-area: night;
}

.today-list {
  display: grid;
  gap: 0.4rem;
}

.today-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  font-size: 0.9375rem;
}

.today-pill {
  justify-self: start;
  margin-top: 0.35rem;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.9375rem;
  font-weight: 600;
}

.big-number {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-top: auto;
  color: var(--ink-muted);
}

.big-number .mono {
  font-size: 4rem;
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
}

.grade-column {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.grade-column .grade {
  flex-direction: row;
  justify-content: space-between;
  min-height: 52px;
  padding: 0 1rem;
}

.csv-snippet {
  margin: auto 0 0;
  padding: 0.85rem 1rem;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  background: var(--paper);
  font-size: 0.875rem;
  line-height: 1.7;
  white-space: pre-line;
}

.csv-snippet code {
  font-size: 0.875rem;
}

.local-art {
  display: grid;
  justify-items: start;
  gap: 0.6rem;
  margin-top: auto;
}

.local-chip {
  justify-content: flex-start;
  align-items: center;
  gap: 0.55rem;
}

.local-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--good);
}

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

.tile-keycaps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
}

/* The night tile keeps fixed light and dark colours whatever the page theme.
   Text on the left, the two cards on the right with the dark diagonal between them. */
.tile-night {
  --night-cards-w: 17rem;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--night-cards-w);
  align-items: center;
  gap: 2rem;
  border-color: #30343d;
  background: #fffdf8;
}

/* The dark half sits under the right-hand card only. It is measured from the
   tile's right edge, so its slanted edge always falls in the gap between the cards. */
.tile-night::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  right: 0;
  bottom: 0;
  width: 11.5rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: #1e2128;
  clip-path: polygon(3rem 0, 100% 0, 100% 100%, 0 100%);
}

.tile-night h3 {
  color: #1f2328;
}

.tile-night p {
  max-width: 24rem;
  color: #575d66;
}

.night-cards {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding-block: 1rem;
}

.night-card {
  display: grid;
  place-items: center;
  width: 6.5rem;
  height: 4rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-serif);
  font-size: 1.125rem;
}

.night-card-light {
  border: 1px solid #e2ddd1;
  background:
    linear-gradient(#d64545, #d64545) 0 0.7rem / 100% 1.5px no-repeat,
    #fffdf8;
  color: #1f2328;
  transform: rotate(-3deg);
}

.night-card-dark {
  border: 1px solid #30343d;
  background:
    linear-gradient(#e07a72, #e07a72) 0 0.7rem / 100% 1.5px no-repeat,
    #14161b;
  color: #e9e7e2;
  transform: rotate(2deg);
}

@media (max-width: 1023px) {
  .bento {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "today today"
      "limit csv"
      "grades grades"
      "local keys"
      "night night";
  }

  .tile-csv {
    display: flex;
  }

  .tile-csv .csv-snippet {
    margin-top: auto;
  }
}

@media (max-width: 719px) {
  .bento {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: none;
  }

  .tile {
    grid-area: auto;
  }

  .tile-today {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Cards drop under the text; the dark half shrinks to the bottom-right corner,
     under the right-hand card only. */
  .tile-night {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
  }

  .tile-night::before {
    top: auto;
    width: 10.5rem;
    height: 6.5rem;
    border-radius: 0 0 var(--radius) 0;
    clip-path: polygon(2rem 0, 100% 0, 100% 100%, 0 100%);
  }

  .night-cards {
    padding-block: 0;
  }
}

/* 5. See the real app */

.frame-wrap {
  position: relative;
  isolation: isolate;
  max-width: 64rem;
  margin: 3.5rem auto 0;
}

.loose-card {
  position: absolute;
  z-index: -1;
  bottom: -2rem;
  width: 16rem;
  height: 10rem;
}

.loose-card-left {
  left: -2.5rem;
  transform: rotate(-4deg);
}

.loose-card-right {
  right: -2.5rem;
  transform: rotate(4deg);
}

.frame {
  display: flex;
  flex-direction: column;
  height: 40rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-lift);
}

.frame-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  height: 40px;
  border-bottom: 1px solid var(--line);
}

.frame-dots {
  position: absolute;
  left: 1rem;
  display: flex;
  gap: 0.4rem;
}

.frame-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line);
}

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

.frame iframe {
  flex: 1;
  width: 100%;
  border: 0;
  background: var(--paper);
}

.sample {
  max-width: 40rem;
  margin-top: 3.5rem;
}

.sample p + p {
  margin-top: 0.15rem;
}

@media (max-width: 1100px) {
  .loose-card {
    width: 12rem;
  }

  .loose-card-left {
    left: 0;
  }

  .loose-card-right {
    right: 0;
  }
}

@media (max-width: 719px) {
  .frame {
    height: 36rem;
  }

  .frame-dots,
  .loose-card {
    display: none;
  }
}

/* 6. What Ruled doesn't do */

.limits-inner {
  max-width: 40rem;
}

.limits h2 {
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
}

.limits-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 2rem;
  margin-top: 1.75rem;
}

.limits-list li {
  position: relative;
  padding-left: 1.25rem;
  color: var(--ink-muted);
}

.limits-list li::before {
  content: "–";
  position: absolute;
  left: 0;
  color: var(--ink-soft);
}

.limits-close {
  margin-top: 1.75rem;
}

@media (max-width: 719px) {
  .limits-list {
    grid-template-columns: 1fr;
  }
}

/* 7. Closing call to action */

.closing-card {
  --card-lines: repeating-linear-gradient(
    to bottom,
    transparent 0 calc(2.25rem - 1px),
    var(--rule) calc(2.25rem - 1px) 2.25rem
  );
  display: grid;
  justify-items: center;
  gap: 1.25rem;
  max-width: 52rem;
  margin-inline: auto;
  padding: clamp(4.5rem, 8vw, 6rem) clamp(1.25rem, 5vw, 4rem) clamp(2.5rem, 5vw, 4rem);
  text-align: center;
  box-shadow: var(--shadow-lift);
  transform: rotate(-1deg);
}

.closing-card h2 {
  font-size: clamp(2.125rem, 1.5rem + 3vw, 4rem);
}

.closing-card > p:first-of-type {
  max-width: 30rem;
  font-size: 1.125rem;
  color: var(--ink-muted);
}

.small {
  font-size: 0.9375rem;
}

@media (max-width: 719px) {
  .closing-card {
    transform: none;
  }
}

/* 8. Footer */

.footer {
  margin-top: var(--section-gap);
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
  color: var(--ink-muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding-block: 1.5rem;
}

.brand-static {
  color: var(--ink);
}

.footer-credits {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
}

@media (max-width: 719px) {
  .footer-inner,
  .footer-credits {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Motion: everything below runs only when the visitor has not asked for reduced motion. */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes rise-more {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}

@keyframes fan {
  from {
    transform: rotate(0deg);
  }
}

@keyframes leave {
  to {
    opacity: 0;
    transform: translate(-55%, 18%) rotate(-8deg);
  }
}

@keyframes enter {
  from {
    opacity: 0.4;
    transform: translateY(10px) scale(0.97);
  }
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

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

@keyframes drop {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@keyframes grow {
  from {
    transform: scaleX(0);
  }
}

@keyframes settle {
  from {
    opacity: 0;
    transform: rotate(-3deg) translateY(16px);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .rise {
    animation: rise 500ms var(--ease-out) var(--d, 0ms) backwards;
  }

  .stack-back {
    animation: fan 600ms var(--ease-out) 150ms backwards;
  }

  .demo-card-inner {
    transition: transform 450ms var(--ease-flip);
  }

  .demo-card.no-transition .demo-card-inner {
    transition: none;
  }

  .demo-card.is-leaving {
    animation: leave 350ms cubic-bezier(0.4, 0, 1, 1) forwards;
  }

  .demo-card.is-entering {
    animation: enter 350ms var(--ease-out);
  }

  .caret {
    animation: blink 1.1s steps(1) infinite;
  }

  .tile {
    transition: transform 200ms var(--ease-out);
  }

  .tile::after {
    transition: opacity 200ms var(--ease-out);
  }

  @media (hover: hover) {
    .tile:hover {
      transform: translateY(-2px);
    }

    .tile:hover::after {
      opacity: 1;
    }
  }

  /* One-time reveals, triggered by main.js. */
  .js [data-reveal]:not(.is-in) {
    opacity: 0;
  }

  .js [data-reveal].is-in {
    animation: rise-more 600ms var(--ease-out) var(--d, 0ms) backwards;
  }

  .js .closing-card[data-reveal].is-in {
    animation-name: settle;
  }

  .js .steps:not(.is-in) .step::before {
    transform: scaleX(0);
  }

  .js .steps.is-in .step::before {
    animation: grow 600ms var(--ease-out) calc(var(--d) + 300ms) backwards;
  }

  /* The schedule: scroll-driven on wide screens where supported, measured on
     entry so it finishes once the whole diagram is on screen. The phone list
     is taller than most viewports, so it plays once on entry instead. */
  @media (min-width: 720px) {
    @supports (animation-timeline: view()) {
      .timeline {
        view-timeline-name: --schedule;
        view-timeline-inset: 0 10%;
      }

      .arc-mask {
        animation: draw linear both;
        animation-timeline: --schedule;
        animation-range: entry calc(var(--i, 0) * 10%) entry calc(var(--i, 0) * 10% + 16%);
      }

      .stop-card {
        animation: drop linear both;
        animation-timeline: --schedule;
        animation-range: entry calc(var(--i) * 10% + 6%) entry calc(var(--i) * 10% + 20%);
      }
    }
  }

  /* The same one-shot fallback, for phones and for browsers without scroll timelines. */
  @media (max-width: 719px) {
    .js .timeline:not(.is-visible) .stop-card {
      opacity: 0;
    }

    .js .timeline.is-visible .stop-card {
      animation: drop 360ms var(--ease-out) calc(var(--i) * 120ms + 300ms) backwards;
    }
  }

  @supports not (animation-timeline: view()) {
    .js .timeline:not(.is-visible) .arc-mask {
      stroke-dashoffset: 1;
    }

    .js .timeline:not(.is-visible) .stop-card {
      opacity: 0;
    }

    .js .timeline.is-visible .arc-mask {
      animation: draw 420ms ease-out calc(var(--i, 0) * 120ms) backwards;
    }

    .js .timeline.is-visible .stop-card {
      animation: drop 360ms var(--ease-out) calc(var(--i) * 120ms + 300ms) backwards;
    }
  }
}

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