/* GramStar website. Plain CSS, no build step. Sections follow the page order. */

@font-face {
  font-family: "Baloo 2";
  src: url("/assets/fonts/baloo2-latin.woff2") format("woff2");
  font-weight: 500 800;
  font-display: swap;
}

@font-face {
  font-family: "Sora";
  src: url("/assets/fonts/sora-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

/* ---------- Tokens ---------- */

:root {
  color-scheme: light;

  /* Paper and ink. Ink is the app's solid-glass navy (#141834). */
  --paper: #fbf7ef;
  --paper-2: #f4ecdc;
  --card: #fffdf8;
  --ink: #141834;
  --ink-2: #464b6b;
  --ink-3: #5a5f80;
  --navy: #0d2a81; /* the wordmark's own colour */
  --line: rgb(20 24 52 / 0.14);
  --line-strong: rgb(20 24 52 / 0.3);

  /* The app's palette, as fills. The -ink shades are darker cousins for text on paper. */
  --sol: #ffd27a;
  --sol-light: #ffe3a8;
  --sun: #ffb13d;
  --sun-ink: #8a4700;
  --ion: #6ee7ff;
  --ion-ink: #00627a;
  --aurora: #5ef0b0;
  --aurora-wash: #dcfaeb;
  --aurora-ink: #0a6343;
  --flare: #ff7a66;
  --flare-wash: #ffe8e3;
  --flare-ink: #a8321e;
  --nova: #b49cff;
  --nova-wash: #f0eaff;
  --nova-ink: #5236b8;

  /* Night, for the end of every page. */
  --space: #04050c;
  --starlight: #f1f3ff;
  --starlight-2: #aeb4d6;

  --display: "Baloo 2", ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  --text: "Sora", system-ui, -apple-system, "Segoe UI", sans-serif;

  --gutter: clamp(1rem, 4.5vw, 3rem);
  --measure: 36rem;
  --section: clamp(4rem, 9vw, 8rem);
}

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

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--text);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  color: var(--ink);
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.75rem, 1.6rem + 5.2vw, 6rem);
  line-height: 0.98;
  letter-spacing: -0.025em;
}

h2 {
  font-size: clamp(2rem, 1.35rem + 2.7vw, 3.5rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 1.4rem;
  line-height: 1.15;
  font-weight: 650;
  letter-spacing: -0.01em;
}

p,
ul,
ol,
dl,
figure,
blockquote {
  margin: 0;
}

p {
  text-wrap: pretty;
}

strong {
  font-weight: 650;
}

a {
  color: var(--navy);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 3px;
}

:focus-visible {
  outline: 3px solid var(--navy);
  outline-offset: 3px;
  border-radius: 4px;
}

.night :focus-visible,
.site-footer :focus-visible {
  outline-color: var(--sol);
}

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

.skip {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: 0 0 10px 10px;
  font-weight: 600;
}

.skip:focus {
  top: 0;
}

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

/* ---------- Masthead ---------- */

.masthead {
  padding-block: 1.25rem 0;
}

.masthead-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
}

.lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding-block: 0.25rem;
  text-decoration: none;
}

.lockup .mark {
  width: 2.4rem;
  height: 2.4rem;
}

.lockup .wordmark {
  width: 7.4rem;
  margin-top: 0.15rem;
}

.masthead nav ul {
  display: flex;
  gap: 0.25rem 1.4rem;
  padding: 0;
  list-style: none;
}

.masthead nav a {
  display: inline-block;
  padding-block: 0.4rem;
  color: var(--ink);
  font-weight: 500;
  font-size: 1rem;
  text-decoration: none;
}

.masthead nav a:hover,
.masthead nav a[aria-current="page"] {
  background: linear-gradient(var(--sol), var(--sol)) no-repeat 0 82% / 100% 0.45em;
}

/* ---------- Shared bits ---------- */

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.1rem;
  color: var(--ink-2);
  font-weight: 500;
  font-size: 1rem;
}

.eyebrow svg {
  width: 1rem;
  height: 1rem;
  flex: none;
}

.lede {
  max-width: 34rem;
  margin-top: 1.5rem;
  font-size: clamp(1.125rem, 1.02rem + 0.45vw, 1.3rem);
  line-height: 1.6;
  color: var(--ink);
}

.prose > * + * {
  margin-top: 1.1rem;
}

.prose {
  max-width: var(--measure);
}

.prose ul,
.prose ol {
  padding-left: 1.25rem;
}

.prose li + li {
  margin-top: 0.6rem;
}

.prose li::marker {
  color: var(--ink-3);
}

.small {
  font-size: 0.9375rem;
  color: var(--ink-2);
}

/* The highlighter swipe behind a word (hand-drawn, one per page at most). */
.swipe {
  position: relative;
  display: inline-block;
  z-index: 0;
}

.swipe svg {
  position: absolute;
  left: -0.08em;
  right: -0.1em;
  bottom: 0.06em;
  width: calc(100% + 0.18em);
  max-width: none;
  height: 0.5em;
  z-index: -1;
}

/* A real app screen, with the iPhone's rounded corners. */
.screen img {
  width: 100%;
  border-radius: 12.5% / 5.75%;
  background: var(--space);
  box-shadow:
    0 0 0 1px rgb(20 24 52 / 0.55),
    0 28px 48px -28px rgb(20 24 52 / 0.6);
}

.screen figcaption {
  margin-top: 0.9rem;
  padding-left: 0.75rem;
  border-left: 2px solid var(--sun);
  color: var(--ink-2);
  font-size: 0.875rem;
  line-height: 1.5;
}

/* The sticky note. */
.note {
  max-width: 17rem;
  padding: 1rem 1.15rem 1.2rem;
  background: var(--sol-light);
  border-radius: 2px 2px 6px 3px;
  color: var(--ink);
  font: 600 1.2rem/1.3 var(--display);
  transform: rotate(-2.2deg);
  box-shadow:
    0 1px 1px rgb(60 40 0 / 0.08),
    0 14px 22px -14px rgb(60 40 0 / 0.45);
}

/* The App Store status. Flip the two lines marked LAUNCH in the README when the app is out. */
.store-live {
  display: none; /* LAUNCH: change to  display: revert;  */
}

.store-soon {
  /* LAUNCH: add  display: none;  */
}

.soon {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 1.1rem;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.2;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1.4rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
}

.button:hover {
  background: var(--navy);
}

/* ---------- Home: hero ---------- */

.hero {
  display: grid;
  gap: 2.5rem;
  padding-block: clamp(3rem, 8vw, 6.5rem) var(--section);
}

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

.hero .actions a:not(.button) {
  font-weight: 500;
}

.hero-screen {
  display: grid;
  grid-template-columns: minmax(0, 13rem);
  align-items: end;
  gap: 0;
}

/* On most phones the caption sits beside the screen, like a margin note. */
@media (min-width: 24rem) {
  .hero-screen {
    grid-template-columns: minmax(0, 12rem) minmax(0, 1fr);
    gap: 1rem;
  }

  .hero-screen figcaption {
    margin: 0 0 1.5rem;
    font-size: 0.8125rem;
  }
}

/* ---------- Home: try one ---------- */

.try {
  padding-block: var(--section);
  background: var(--paper-2);
}

.try-grid {
  display: grid;
  gap: 2.25rem;
}

.try-intro p {
  max-width: 26rem;
  margin-top: 1.1rem;
}

.try-grid > .note {
  margin-left: 0.5rem;
}

.sheet {
  min-width: 0;
  margin: 0;
  padding: clamp(1.25rem, 3.5vw, 2.75rem);
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--card);
  box-shadow: 0 24px 48px -32px rgb(20 24 52 / 0.35);
}

.sentence {
  float: left;
  width: 100%;
  margin-bottom: 1.6rem;
  padding: 0;
  font: 700 clamp(1.75rem, 1.2rem + 2.3vw, 2.75rem)/1.4 var(--display);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.sentence + * {
  clear: both;
}

.gap {
  display: inline-block;
  min-width: 4.2em;
  padding: 0 0.4em;
  border-radius: 0.45em;
  background: rgb(110 231 255 / 0.3);
  box-shadow: inset 0 0 0 2px rgb(0 98 122 / 0.5);
  line-height: 1.3;
  text-align: center;
  vertical-align: 0.04em;
}

.gap-word {
  display: none;
}

.sheet:has(.tile-input:checked) .gap {
  background: var(--aurora);
  box-shadow: inset 0 0 0 2px var(--aurora-ink);
}

.sheet:has(.tile-input:checked) .gap-word {
  display: inline;
}

.sheet:has(.tile-input:checked) .gap-blank {
  display: none;
}

.tile-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.tiles {
  clear: both;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.tile {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.75rem;
  padding: 0.55rem 0.75rem 0.45rem;
  border: 1.5px solid rgb(20 24 52 / 0.5);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 4px 0 rgb(20 24 52 / 0.16);
  color: var(--ink);
  font: 700 1.4rem/1.1 var(--display);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.tile:hover {
  border-color: var(--navy);
}

#try-whose:checked ~ .tiles [for="try-whose"] {
  border-color: var(--aurora-ink);
  background: var(--aurora-wash);
  color: var(--aurora-ink);
}

#try-whos:checked ~ .tiles [for="try-whos"],
#try-which:checked ~ .tiles [for="try-which"],
#try-who:checked ~ .tiles [for="try-who"] {
  border-color: var(--flare-ink);
  background: var(--flare-wash);
  color: var(--flare-ink);
  text-decoration: line-through 2.5px;
}

#try-whose:focus-visible ~ .tiles [for="try-whose"],
#try-whos:focus-visible ~ .tiles [for="try-whos"],
#try-which:focus-visible ~ .tiles [for="try-which"],
#try-who:focus-visible ~ .tiles [for="try-who"] {
  outline: 3px solid var(--navy);
  outline-offset: 3px;
}

.results {
  clear: both;
  margin-top: 1.6rem;
}

.result-empty {
  padding: 1.1rem 1.25rem;
  border: 1.5px dashed var(--line-strong);
  border-radius: 18px;
  color: var(--ink-3);
}

.result {
  display: none;
  padding: 1.15rem 1.3rem 1.25rem;
  border-radius: 18px;
}

.tile-input:checked ~ .results .result-empty {
  display: none;
}

#try-whose:checked ~ .results #why-whose,
#try-whos:checked ~ .results #why-whos,
#try-which:checked ~ .results #why-which,
#try-who:checked ~ .results #why-who {
  display: block;
}

.result.right {
  border: 1.5px solid rgb(10 99 67 / 0.45);
  background: var(--aurora-wash);
}

.result.wrong {
  border: 1.5px solid rgb(168 50 30 / 0.4);
  background: #fff1ed;
}

.result-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 600;
  font-size: 1.05rem;
}

.result-head svg {
  width: 1.75rem;
  height: 1.75rem;
  flex: none;
}

.rule {
  position: relative;
  margin-top: 0.7rem;
  padding-left: 1.25rem;
  font-size: 1.0625rem;
  line-height: 1.55;
}

.rule::before {
  content: "";
  position: absolute;
  left: 0.1rem;
  top: 0.62em;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--aurora-ink);
}

.rule.miss::before {
  background: var(--flare-ink);
}

.rule.miss strong {
  color: var(--flare-ink);
}

.rule.hit strong {
  color: var(--aurora-ink);
}

.rule em {
  font-style: normal;
  color: var(--ink-2);
}

.nova-extra {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1.5px dashed rgb(82 54 184 / 0.4);
}

.nova-extra > p:first-child {
  color: var(--nova-ink);
  font-weight: 600;
  font-size: 0.875rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
  padding: 0;
  list-style: none;
}

.chips li {
  padding: 0.25rem 0.75rem;
  border: 1.5px solid rgb(10 99 67 / 0.4);
  border-radius: 999px;
  background: #fff;
  font-size: 0.9375rem;
}

.try-after {
  max-width: 40rem;
  margin-top: 2.25rem;
  font: 600 clamp(1.3rem, 1.1rem + 0.8vw, 1.65rem)/1.35 var(--display);
}

/* ---------- Home: a run ---------- */

.run {
  display: grid;
  gap: 3rem;
  padding-block: var(--section);
}

.run .lede {
  margin-top: 1rem;
}

.steps {
  margin-top: 2.5rem;
  padding: 0;
  list-style: none;
  counter-reset: step;
  max-width: 34rem;
}

.steps li {
  position: relative;
  padding: 1.25rem 0 1.35rem 3.4rem;
  border-top: 1px solid var(--line);
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.85rem;
  color: var(--navy);
  font: 700 2.4rem/1 var(--display);
}

.steps p {
  margin-top: 0.35rem;
}

.pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.pair .screen:last-child {
  margin-top: 3.5rem;
}

/* ---------- Home: levels ---------- */

.levels {
  padding-block: var(--section);
  border-top: 1px solid var(--line);
}

.levels-grid {
  display: grid;
  gap: 3rem;
}

.levels-grid > .screen {
  order: 2;
  max-width: 15rem;
}

.levels-head p {
  max-width: 32rem;
  margin-top: 1.1rem;
}

.level-list {
  margin-top: 2.5rem;
  padding: 0;
  list-style: none;
}

.level {
  display: grid;
  gap: 0.9rem;
  padding-block: 1.6rem;
  border-top: 1px solid var(--line);
}

.level:last-child {
  border-bottom: 1px solid var(--line);
}

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

.level-name h3 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.75rem;
}

.level-meta {
  color: var(--ink-2);
  font-size: 0.9375rem;
  font-weight: 500;
}

.level-meta span + span::before {
  content: "· ";
}

/* The app's heat meter: one, two or three bars lit. */
.heat {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
  margin-left: 0.15rem;
}

.heat i {
  width: 4px;
  border-radius: 1px;
  background: rgb(20 24 52 / 0.18);
}

.heat i:nth-child(1) { height: 6px; }
.heat i:nth-child(2) { height: 10px; }
.heat i:nth-child(3) { height: 14px; }

.beginner .heat i:nth-child(-n + 1),
.intermediate .heat i:nth-child(-n + 2),
.advanced .heat i:nth-child(-n + 3) {
  background: var(--lvl);
}

.beginner { --lvl: var(--ink); }
.intermediate { --lvl: var(--ion-ink); }
.advanced { --lvl: var(--sun-ink); }

.example {
  padding-left: 1rem;
  border-left: 3px solid var(--lvl);
}

.example-label {
  color: var(--ink-3);
  font-size: 0.8125rem;
  font-weight: 500;
}

.example-sentence {
  margin-top: 0.2rem;
  font: 700 1.35rem/1.35 var(--display);
}

.example-sentence mark {
  padding: 0 0.2em;
  border-radius: 0.3em;
  background: rgb(94 240 176 / 0.55);
  color: inherit;
}

.example-why {
  margin-top: 0.35rem;
  color: var(--ink-2);
  font-size: 0.9375rem;
}

.levels-foot {
  max-width: 34rem;
  margin-top: 1.75rem;
}

/* ---------- Home: coming back ---------- */

.habits {
  padding-block: var(--section);
  background: var(--paper-2);
}

.habits-grid {
  display: grid;
  gap: 3rem;
}

.habits-head p {
  max-width: 34rem;
  margin-top: 1.1rem;
}

.glossary {
  margin-top: 2.5rem;
  display: grid;
  gap: 0;
}

.glossary > div {
  padding-block: 1.1rem 1.2rem;
  border-top: 1px solid var(--line);
}

.glossary dt {
  font: 650 1.45rem/1.2 var(--display);
}

.glossary dt span {
  margin-left: 0.45rem;
  color: var(--ink-3);
  font: 500 0.8125rem/1 var(--text);
  letter-spacing: 0.02em;
}

.glossary dd {
  margin: 0.3rem 0 0;
  max-width: 30rem;
}

/* ---------- Home: what's inside, free and Nova ---------- */

.plans {
  padding-block: var(--section);
}

.plans-grid {
  display: grid;
  gap: 2.5rem;
}

.plans-text p {
  max-width: 30rem;
  margin-top: 1.1rem;
}

.plans-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
  line-height: 1.45;
}

.plans-table th,
.plans-table td {
  padding: 1rem 0.75rem 1rem 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.plans-table thead th {
  padding-top: 0;
  font: 700 1.5rem/1.1 var(--display);
  border-bottom: 2px solid var(--ink);
}

.plans-table thead th:last-child {
  color: var(--nova-ink);
}

.plans-table tbody th {
  font-weight: 500;
}

.plans-table .c-what { width: 36%; }
.plans-table .c-free { width: 16%; }

.plans-table thead td {
  border-bottom: 2px solid var(--ink);
}

.plans-table td:last-child {
  padding-right: 0;
}

.plans-table .no {
  color: var(--ink-3);
}

/* ---------- Night: the end of every page ---------- */

.night {
  position: relative;
  padding-block: clamp(4.5rem, 10vw, 8rem) clamp(3rem, 6vw, 4.5rem);
  background:
    linear-gradient(90deg, rgb(4 5 12 / 0.55), rgb(4 5 12 / 0.1) 70%),
    linear-gradient(rgb(4 5 12 / 0) 55%, var(--space)),
    url("/assets/img/sky-band.webp") 70% 50% / cover no-repeat,
    var(--space);
  color: var(--starlight);
}

.night h2 {
  max-width: 14ch;
  color: var(--starlight);
}

.night p {
  max-width: 30rem;
  margin-top: 1.25rem;
  color: var(--starlight-2);
  font-size: 1.125rem;
}

.night a {
  color: var(--starlight);
}

.night .mark {
  width: 4.5rem;
  height: 4.5rem;
  margin-bottom: 1.75rem;
}

.night .soon {
  margin-top: 2rem;
  border-color: var(--starlight);
}

.night .button {
  margin-top: 2rem;
  background: var(--starlight);
  color: var(--space);
}

.site-footer {
  padding-block: 2.5rem 3rem;
  background: var(--space);
  color: var(--starlight-2);
  font-size: 0.9375rem;
}

.footer-grid {
  display: grid;
  gap: 1.5rem 3rem;
}

/* On Home the footer continues the night band; elsewhere it brings its own bit of sky. */
body:has(.night) .footer-grid {
  padding-top: 2rem;
  border-top: 1px solid rgb(241 243 255 / 0.16);
}

body:not(:has(.night)) .site-footer {
  padding-top: clamp(3.5rem, 7vw, 5rem);
  background:
    linear-gradient(rgb(4 5 12 / 0.35), var(--space) 85%),
    url("/assets/img/sky-band.webp") 70% 45% / cover no-repeat,
    var(--space);
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.footer-brand .mark {
  width: 1.9rem;
  height: auto;
}

.footer-grid .wordmark {
  width: 8rem;
}

.footer-grid ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.4rem;
  padding: 0;
  list-style: none;
}

.site-footer a {
  color: var(--starlight);
}

.footer-note {
  grid-column: 1 / -1;
  color: var(--starlight-2);
  font-size: 0.875rem;
}

/* ---------- Inner pages ---------- */

.page-head {
  padding-block: clamp(3rem, 7vw, 6rem) clamp(2.5rem, 5vw, 4rem);
}

.page-head h1 {
  max-width: 16ch;
  font-size: clamp(2.6rem, 1.6rem + 4.4vw, 5.25rem);
}

.page-head .meta {
  margin-top: 1.25rem;
  color: var(--ink-2);
  font-size: 0.9375rem;
}

/* A two-column reading layout: a quiet side column, then the text. */
.doc {
  display: grid;
  gap: 2rem;
  padding-bottom: var(--section);
}

.doc-side {
  font-size: 0.9375rem;
}

.toc {
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.toc li {
  border-bottom: 1px solid var(--line);
}

.toc a {
  display: block;
  padding-block: 0.55rem;
  color: var(--ink-2);
  text-decoration: none;
}

.toc a:hover {
  color: var(--navy);
  text-decoration: underline;
}

.toc-label {
  margin-bottom: 0.6rem;
  color: var(--ink-3);
  font-weight: 600;
  font-size: 0.8125rem;
}

.doc-main > section + section {
  margin-top: 3rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--line);
}

.doc-main h2 {
  margin-bottom: 1.1rem;
  font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.4rem);
  scroll-margin-top: 1.5rem;
}

.doc-main h3 {
  margin: 2rem 0 0.6rem;
  font-size: 1.35rem;
  scroll-margin-top: 1.5rem;
}

.doc-main h2 + h3 {
  margin-top: 1.25rem;
}

.doc > .note {
  max-width: 34rem;
  margin: 0 0 1rem;
  padding: 1.4rem 1.5rem 1.6rem;
  font: 400 1rem/1.6 var(--text);
  transform: rotate(-0.8deg);
}

.note h2 {
  margin-bottom: 0.75rem;
  font-size: 1.6rem;
}

.note ul {
  padding: 0;
  list-style: none;
}

.note li + li {
  margin-top: 0.7rem;
}

/* About */

.beliefs {
  margin-top: 1rem;
  padding: 0;
  list-style: none;
}

.beliefs li {
  display: grid;
  gap: 0.6rem;
  padding-block: 1.6rem 1.8rem;
  border-top: 1px solid var(--line);
}

.doc-main .beliefs h3 {
  margin: 0;
  font-size: 1.6rem;
}

.beliefs p {
  max-width: var(--measure);
}

.quote-card {
  max-width: 30rem;
  padding: 1.15rem 1.3rem 1.25rem;
  border: 1.5px solid rgb(168 50 30 / 0.4);
  border-radius: 18px;
  background: #fff1ed;
}

.quote-card figcaption {
  margin-top: 0.85rem;
  color: var(--ink-2);
  font-size: 0.875rem;
}

.contact-more {
  margin-top: 1rem;
}

.big-mark {
  display: none;
  width: 12rem;
  height: auto;
}

/* Contact */

.email-for {
  margin-top: 1.75rem;
  color: var(--ink-2);
}

.email-big {
  display: inline-block;
  margin-top: 0.25rem;
  font: 700 clamp(1.6rem, 1.1rem + 2.4vw, 2.6rem)/1.15 var(--display);
  overflow-wrap: anywhere;
}

.email-more {
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}

.email-more li + li {
  margin-top: 0.35rem;
}

.howto {
  margin-top: 1rem;
  padding: 0;
  list-style: none;
  counter-reset: how;
}

.howto li {
  position: relative;
  padding: 0.85rem 0 0.9rem 2.6rem;
  border-top: 1px solid var(--line);
  counter-increment: how;
}

.howto li::before {
  content: counter(how);
  position: absolute;
  left: 0;
  top: 0.55rem;
  color: var(--navy);
  font: 700 1.6rem/1 var(--display);
}

/* 404 */

.lost {
  padding-block: clamp(4rem, 10vw, 8rem);
}

.lost h1 .gap {
  min-width: 0;
  background: var(--aurora);
  box-shadow: inset 0 0 0 3px var(--aurora-ink);
  padding: 0 0.25em;
  line-height: 1.1;
}

.lost .result {
  display: block;
  max-width: 28rem;
  margin-top: 2.5rem;
}

.lost ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-top: 1rem;
  padding: 0;
  list-style: none;
  font-weight: 600;
}

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

@media (min-width: 40rem) {
  .tiles {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .hero-screen {
    grid-template-columns: minmax(0, 16rem) minmax(0, 13rem);
  }

  .footer-grid {
    grid-template-columns: auto 1fr auto;
    align-items: center;
  }
}

@media (min-width: 60rem) {
  .hero {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: 2rem;
    align-items: center;
  }

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

  .hero-screen {
    grid-column: 9 / span 4;
    grid-template-columns: minmax(0, 19rem);
    justify-content: end;
  }

  .hero-screen figcaption {
    margin: 0.9rem 0 0;
    font-size: 0.875rem;
  }

  .try-grid {
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    grid-template-rows: auto 1fr;
    column-gap: clamp(2rem, 4vw, 4rem);
    align-items: start;
  }

  .try-grid > .sheet {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .try-grid > .note {
    grid-column: 1;
    grid-row: 2;
  }

  .run {
    grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
    column-gap: clamp(2rem, 6vw, 6rem);
    align-items: start;
  }

  .run .pair {
    margin-top: 6rem;
  }

  .levels-grid {
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    column-gap: clamp(2rem, 6vw, 6rem);
    align-items: start;
  }

  .levels-grid > .screen {
    order: 0;
    position: sticky;
    top: 2rem;
    max-width: 20rem;
  }

  .level {
    grid-template-columns: minmax(0, 13rem) minmax(0, 1fr);
    column-gap: 2rem;
  }

  .level-name {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
  }

  .level-meta span {
    display: block;
  }

  .level-meta span + span::before {
    content: none;
  }

  .level-about {
    grid-column: 1;
    grid-row: 2;
    color: var(--ink-2);
    font-size: 0.9375rem;
  }

  .level .example {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .habits-grid {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    column-gap: clamp(2rem, 6vw, 6rem);
  }

  .habits-grid .pair {
    margin-top: 8rem;
  }

  .glossary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 2.5rem;
  }

  .plans-grid {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    column-gap: clamp(2rem, 6vw, 6rem);
  }

  .plans-table {
    margin-top: 0.75rem;
  }

  .doc {
    grid-template-columns: minmax(0, 3fr) minmax(0, 8fr);
    column-gap: clamp(2rem, 6vw, 6rem);
    align-items: start;
  }

  .doc-side {
    position: sticky;
    top: 2rem;
  }

  .doc > .note {
    grid-column: 2;
    grid-row: 1;
    margin-bottom: 2.5rem;
  }

  .doc:has(> .note) > .doc-side {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .doc > .note ~ .doc-main {
    grid-column: 2;
    grid-row: 2;
  }

  .big-mark {
    display: block;
  }

  .page-head.with-mark {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 2rem;
  }

  .beliefs li {
    grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
    column-gap: 2.5rem;
  }
}

/* ---------- Motion: small, and only if wanted ---------- */

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  .tile {
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
  }

  .tile:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 rgb(20 24 52 / 0.16);
  }

  #try-whose:checked ~ .results #why-whose,
  #try-whos:checked ~ .results #why-whos,
  #try-which:checked ~ .results #why-which,
  #try-who:checked ~ .results #why-who {
    animation: rise 0.28s ease-out;
  }

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

/* ---------- Analytics choice (assets/analytics.js) ---------- */

.consent {
  position: fixed;
  inset: auto var(--gutter) 1rem;
  z-index: 40;
  max-width: 34rem;
  padding: 1.1rem 1.25rem 1.25rem;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 1.1rem;
  box-shadow: 0 10px 40px rgb(20 24 52 / 0.22);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.consent p {
  margin: 0;
  color: var(--ink-2);
}

.consent .consent-title {
  margin-bottom: 0.35rem;
  color: var(--ink);
  font: 700 1.25rem/1.2 var(--display);
}

.consent a {
  color: var(--navy);
}

.consent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

/* Two equal buttons: saying no is as easy as saying yes. */
.consent-actions button {
  flex: 1 1 10rem;
  padding: 0.8rem 1.2rem;
  background: transparent;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 999px;
  font: 600 0.9375rem/1.2 var(--text);
  cursor: pointer;
}

.consent-actions button[data-choice="yes"] {
  background: var(--ink);
  color: var(--paper);
}

.consent-actions button:hover {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--paper);
}

.consent-open {
  padding: 0;
  background: none;
  border: 0;
  color: var(--starlight);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

@media (min-width: 40rem) {
  .consent {
    inset: auto auto 1.5rem 1.5rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .consent {
    animation: consent-in 0.28s ease-out;
  }

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

@media print {
  .masthead nav,
  .night,
  .consent,
  .consent-open,
  .skip {
    display: none;
  }

  body {
    background: #fff;
  }
}
