/* wine.study: one stylesheet, no build step. */

:root {
  /* Each colour is given as its light and its dark value. Which one is used
     follows color-scheme, set below. */
  --bg: light-dark(#faf7f2, #171310);
  --surface: light-dark(#ffffff, #211b17);
  --sunken: light-dark(#f2ede5, #1c1714);
  --ink: light-dark(#231d19, #f1eae3);
  --muted: light-dark(#6e645c, #a99d92);
  --line: light-dark(#e3dace, #3b322c);
  --accent: light-dark(#7a1f3d, #e591ab);
  --accent-ink: light-dark(#ffffff, #1d0f14);
  --accent-soft: light-dark(#f4e4e9, #3b1f2a);
  --good: light-dark(#2c7a4b, #80d09d);
  --good-soft: light-dark(#e2f1e7, #1c3226);
  --bad: light-dark(#b23a31, #f1958c);
  --bad-soft: light-dark(#f9e5e2, #3c1f1c);
  --warn: light-dark(#8a5d0b, #e5c462);
  --warn-soft: light-dark(#f8edd3, #3a3017);
  --strong: light-dark(#2c7a4b, #58b07a);
  --familiar: #86b765;
  --learning: light-dark(#e2bd4f, #d9b54c);
  --radius: 12px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* Follow the device, until the reader chooses with the button in the header. */
  color-scheme: light dark;
}
/* Their choice, set on the page by theme.js. */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }

/* Several components set their own display, which would otherwise defeat the hidden attribute. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.55 var(--sans);
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: 2rem; letter-spacing: -0.01em; }
h2 { font-size: 1.35rem; margin-top: 2rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-underline-offset: 0.15em; }
ul, ol { padding-left: 1.2em; }
small, .small { font-size: 0.875rem; }
.muted { color: var(--muted); }
.eyebrow {
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 0.4rem;
}
.lede { font-size: 1.15rem; color: var(--muted); max-width: 38rem; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* -- frame ---------------------------------------------------------------- */

.site-header {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.75rem;
  max-width: 48rem; margin: 0 auto; padding: 1rem 1.25rem;
}
/* The logo pushes everything else on its row to the right. */
.brand { display: block; margin-right: auto; line-height: 0; }
.brand img { display: block; height: 2.5rem; width: auto; }
/* The course's navigation has a row of its own, under the logo. Beside it there
   is no room once the account, the theme switch and the way back to studying
   are there too. */
.site-header nav { order: 3; display: flex; gap: 0.25rem; width: calc(100% + 1.2rem); margin: 0 -0.6rem; }

.theme-toggle {
  display: inline-grid; place-items: center; width: 2.2rem; height: 2.2rem; padding: 0;
  border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); background: var(--sunken); }
/* The moon offers dark, the sun offers light. */
.theme-toggle .sun, .theme-toggle[data-now="dark"] .moon { display: none; }
.theme-toggle[data-now="dark"] .sun { display: block; }

/* The way back to studying, on every page except the two that already have one. */
.study-link { white-space: nowrap; }
.study-link .count {
  margin-left: 0.15rem; padding: 0 0.45rem; border-radius: 999px; font-size: 0.78rem;
  background: color-mix(in srgb, currentColor 20%, transparent);
}
.page-home .study-link, .page-study .study-link { display: none; }
.site-header nav a, .account-link {
  color: var(--muted); text-decoration: none; font-size: 0.95rem; font-weight: 600;
  padding: 0.35rem 0.6rem; border-radius: 999px;
}
.site-header nav a:hover, .account-link:hover { color: var(--ink); background: var(--sunken); }
.page-path [data-nav="path"], .page-explain [data-nav="explain"],
.page-tasting [data-nav="tasting"], .page-progress [data-nav="progress"],
.page-account .account-link:not(.staff-link), .page-dashboard .staff-link {
  color: var(--accent); background: var(--accent-soft);
}
/* Signing in and the account sit beside the navigation, not in it: they are not part of the course. */
.account-link { white-space: nowrap; }
.page-study .account-link { display: none; }

@media (max-width: 30rem) {
  /* On a phone the first row is full with the logo, the account and the way
     back to studying, so the theme switch joins the navigation on its row. */
  .site-header { column-gap: 0.5rem; }
  .brand img { height: 1.9rem; }
  .site-header nav { flex: 1 1 0; width: auto; margin-right: 0; justify-content: space-between; }
  .site-header .theme-toggle { order: 4; }
  .page-study .site-header { padding-bottom: 0.25rem; }
}

main { max-width: 48rem; margin: 0 auto; padding: 1rem 1.25rem 4rem; }

.site-footer {
  max-width: 48rem; margin: 0 auto; padding: 1.5rem 1.25rem 3rem;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem;
}
.site-footer p { margin: 0 0 0.5em; }

.notice {
  border-radius: var(--radius); padding: 0.8rem 1rem; margin: 0 0 1.25rem;
  background: var(--warn-soft); color: var(--ink); font-size: 0.95rem;
}
.notice strong { color: var(--warn); }
.notice p { margin: 0; }
.notice.quiet { background: var(--sunken); }
.hero + .notice { margin-top: 1.25rem; }
.notice.quiet strong { color: inherit; }
.notice.good { background: var(--good-soft); }
.notice.good strong { color: var(--good); }
.notice.bad { background: var(--bad-soft); color: var(--bad); font-weight: 600; }

/* -- building blocks ------------------------------------------------------ */

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem; margin: 0 0 1rem;
}
.card > :last-child { margin-bottom: 0; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer;
  padding: 0.7rem 1.25rem; border-radius: 999px; border: 1.5px solid var(--accent);
  background: var(--accent); color: var(--accent-ink);
  min-height: 2.9rem;
}
.button:hover { filter: brightness(1.08); }
.button.secondary { background: transparent; color: var(--accent); }
.button.quiet { background: transparent; border-color: var(--line); color: var(--ink); }
.button.small { min-height: 2.2rem; padding: 0.35rem 0.9rem; font-size: 0.9rem; }
.button[disabled] { opacity: 0.45; cursor: default; filter: none; }
.button-row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.chip {
  display: inline-block; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.03em;
  padding: 0.15rem 0.55rem; border-radius: 999px; background: var(--sunken); color: var(--muted);
  white-space: nowrap; vertical-align: middle;
}
.chip.ready { background: var(--accent-soft); color: var(--accent); }
.chip.done, .chip.strong { background: var(--good-soft); color: var(--good); }
.chip.learning { background: var(--warn-soft); color: var(--warn); }
.chip.draft { background: var(--warn-soft); color: var(--warn); }

/* A bar split by how well facts are known. */
.bar {
  display: flex; height: 0.6rem; border-radius: 999px; overflow: hidden; background: var(--sunken);
}
.bar span { display: block; height: 100%; }
.bar .strong { background: var(--strong); }
.bar .familiar { background: var(--familiar); }
.bar .learning { background: var(--learning); }
.bar.thin { height: 0.35rem; }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.8rem; color: var(--muted); margin-top: 0.5rem; }
.legend i { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 3px; margin-right: 0.35rem; vertical-align: -1px; }
.legend .strong { background: var(--strong); }
.legend .familiar { background: var(--familiar); }
.legend .learning { background: var(--learning); }

.rows { list-style: none; padding: 0; margin: 0; }
.rows > li { padding: 0.9rem 0; border-top: 1px solid var(--line); }
.rows > li:first-child { border-top: 0; padding-top: 0; }
.rows > li:last-child { padding-bottom: 0; }
.row-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 0.4rem; }
.row-head strong { font-weight: 650; }
.row-head a { color: inherit; text-decoration: none; }
.row-head a:hover { color: var(--accent); text-decoration: underline; }

/* -- home ----------------------------------------------------------------- */

.hero { padding: 1.5rem 0 0.5rem; }
.hero h1 { font-size: 2.4rem; margin-bottom: 0.3em; }
.next-up { margin: 1.25rem 0 0; }
.next-up .button { font-size: 1.05rem; padding: 0.85rem 1.6rem; }
.next-up p { margin: 0.75rem 0 0; color: var(--muted); font-size: 0.95rem; }

.gates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; margin: 1.75rem 0; }
.gate { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.gate .value { font-family: var(--serif); font-size: 1.9rem; font-weight: 600; line-height: 1.1; }
.gate .name { font-weight: 700; }
.gate .exam, .gate .detail { font-size: 0.8rem; color: var(--muted); }
.gate .bar { margin: 0.6rem 0 0.5rem; }
.gate .bar span { background: var(--accent); }
@media (max-width: 34rem) {
  .gates { grid-template-columns: 1fr; }
  .gate { display: grid; grid-template-columns: 1fr auto; column-gap: 1rem; align-items: center; }
  .gate .value { grid-column: 2; grid-row: 1 / span 2; }
  .gate .bar, .gate .detail { grid-column: 1 / -1; }
}

.choices-start { display: grid; gap: 0.75rem; margin-top: 1.5rem; }
.choices-start form { margin: 0; }
.choices-start button {
  width: 100%; text-align: left; font: inherit; cursor: pointer; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem;
}
.choices-start button:hover { border-color: var(--accent); }
.choices-start strong { display: block; font-size: 1.05rem; }
.choices-start span { color: var(--muted); font-size: 0.92rem; }

/* -- path and topics ------------------------------------------------------ */

.stage-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.stage-head h2 { margin: 0; }
.topic-list { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 0.5rem; }
.topic-list a {
  display: grid; grid-template-columns: 1fr auto; gap: 0.2rem 1rem; align-items: center;
  padding: 0.7rem 0.9rem; border-radius: 10px; text-decoration: none; color: var(--ink);
  background: var(--sunken);
}
.topic-list a:hover { outline: 1.5px solid var(--accent); }
.topic-list .bar { grid-column: 1 / -1; }
.topic-list .locked { opacity: 0.6; }
.kind { color: var(--muted); font-size: 0.8rem; }

.crumbs { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.5rem; }
.crumbs a { color: var(--muted); }
.fact-list { list-style: none; padding: 0; margin: 0; }
.fact-list li { display: grid; grid-template-columns: auto 1fr; gap: 0.7rem; padding: 0.55rem 0; border-top: 1px solid var(--line); }
.fact-list li:first-child { border-top: 0; }
.dot { width: 0.75rem; height: 0.75rem; border-radius: 50%; margin-top: 0.45rem; background: var(--line); }
.dot.level-1 { background: var(--learning); }
.dot.level-2 { background: var(--familiar); }
.dot.level-3 { background: var(--strong); }
.links { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.links a {
  font-size: 0.9rem; padding: 0.2rem 0.65rem; border-radius: 999px; text-decoration: none;
  background: var(--sunken); color: var(--ink);
}
.links a:hover { color: var(--accent); }
dl.meta { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1rem; margin: 0; }
dl.meta dt { color: var(--muted); font-size: 0.85rem; padding-top: 0.2rem; }
dl.meta dd { margin: 0; }

.learn-body p:last-child, .learn-body ul:last-child, .learn-body ol:last-child { margin-bottom: 0; }
.learn-body ul, .learn-body ol { margin: 0 0 1em; }
.figure { margin: 1.25rem 0 0; }
.figure svg { width: 100%; height: auto; max-height: 26rem; display: block; }

/* -- the session ---------------------------------------------------------- */

.page-study .site-header nav, .page-study .site-footer { display: none; }
.runner { max-width: 38rem; margin: 0 auto; }
.runner-top { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 1.5rem; }
.runner-top .bar { flex: 1; }
.runner-top .bar span { background: var(--accent); transition: width 0.25s ease; }
.runner-top button {
  font: inherit; font-size: 0.85rem; color: var(--muted); background: none; border: 0; cursor: pointer;
  padding: 0.3rem 0.2rem; text-decoration: underline;
}
.stage-tag { margin-bottom: 0.6rem; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

.learn-card h1 { font-size: 1.7rem; }
.prompt { font-family: var(--serif); font-size: 1.45rem; line-height: 1.3; margin: 0 0 1.25rem; }
.hint { color: var(--muted); font-size: 0.9rem; margin: -0.6rem 0 1rem; }

.options { display: grid; gap: 0.6rem; margin: 0 0 1.25rem; padding: 0; list-style: none; }
.option {
  display: flex; align-items: center; gap: 0.75rem; width: 100%; text-align: left;
  font: inherit; color: var(--ink); cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 0.85rem 1rem; min-height: 3.2rem;
}
.option:hover:not([disabled]) { border-color: var(--accent); }
.option .key {
  flex: none; width: 1.6rem; height: 1.6rem; border-radius: 6px; display: grid; place-items: center;
  font-size: 0.8rem; font-weight: 700; background: var(--sunken); color: var(--muted);
}
.option[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.option[aria-pressed="true"] .key { background: var(--accent); color: var(--accent-ink); }
.option[disabled] { cursor: default; }
.option.is-right { border-color: var(--good); background: var(--good-soft); }
.option.is-right .key { background: var(--good); color: var(--surface); }
.option.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.option.is-wrong .key { background: var(--bad); color: var(--surface); }

.order-list { list-style: none; margin: 0 0 1.25rem; padding: 0; display: grid; gap: 0.5rem; counter-reset: place; }
.order-list li {
  display: flex; align-items: center; gap: 0.6rem; counter-increment: place; min-height: 3.2rem;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 0.75rem 1rem;
  /* Rows are dragged, so a touch on one must move the row and not scroll the page. */
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
}
.order-list li::before { content: counter(place); font-weight: 700; color: var(--muted); width: 1.2rem; }
.order-list .label { flex: 1; }
.order-list .grip { color: var(--muted); letter-spacing: -0.2em; padding-right: 0.2em; }
.order-list li:hover { border-color: var(--accent); }
.order-list li.dragging {
  cursor: grabbing; position: relative; z-index: 2; border-color: var(--accent); background: var(--accent-soft);
  box-shadow: 0 10px 28px rgb(0 0 0 / 0.22);
}
.order-list.locked li { cursor: default; touch-action: auto; }
.order-list.locked li:hover { border-color: var(--line); }
.order-list.locked .grip { visibility: hidden; }
.order-list li.is-right, .order-list.locked li.is-right:hover { border-color: var(--good); background: var(--good-soft); }
.order-list li.is-wrong, .order-list.locked li.is-wrong:hover { border-color: var(--bad); background: var(--bad-soft); }

.typed { display: grid; gap: 0.6rem; margin: 0 0 1.25rem; }
.typed input, textarea, select, input[type="text"], input[type="email"], input[type="password"], input[type="number"] {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: var(--radius); padding: 0.75rem 0.9rem; width: 100%;
}
.typed input.is-right { border-color: var(--good); background: var(--good-soft); }
.typed input.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
textarea { min-height: 13rem; resize: vertical; line-height: 1.5; }

.confidence { margin: 0 0 1rem; }
.confidence p { margin: 0 0 0.5rem; font-weight: 650; }
.confidence .button-row .button { flex: 1; min-width: 6.5rem; }
.skip { font: inherit; font-size: 0.9rem; color: var(--muted); background: none; border: 0; cursor: pointer; text-decoration: underline; padding: 0.4rem 0; }
.keys { color: var(--muted); font-size: 0.78rem; margin-top: 1.25rem; }
.keys kbd {
  font: inherit; font-size: 0.72rem; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
  padding: 0 0.35rem; background: var(--surface);
}
@media (hover: none) { .keys { display: none; } }

.feedback { border-radius: var(--radius); padding: 1rem 1.1rem; margin: 0 0 1.25rem; background: var(--sunken); }
.feedback.right { background: var(--good-soft); }
.feedback.wrong { background: var(--bad-soft); }
.feedback.partly { background: var(--warn-soft); }
.feedback .verdict { font-weight: 750; margin: 0 0 0.35rem; }
.feedback.right .verdict { color: var(--good); }
.feedback.wrong .verdict { color: var(--bad); }
.feedback.partly .verdict { color: var(--warn); }
.feedback p { margin: 0 0 0.5rem; }
.feedback p:last-child { margin-bottom: 0; }
.feedback .aside { font-size: 0.92rem; color: var(--muted); }

.summary-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; margin: 1.25rem 0; text-align: center; }
.summary-stats div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 0.5rem; }
.summary-stats b { display: block; font-family: var(--serif); font-size: 1.8rem; line-height: 1.1; }
.summary-stats span { font-size: 0.8rem; color: var(--muted); }

.segments { display: flex; height: 1.1rem; border-radius: 999px; overflow: hidden; background: var(--sunken); }
.segments span { display: block; height: 100%; }
.seg-wrong-definitely { background: #a12a22; }
.seg-wrong-probably { background: #cf6259; }
.seg-wrong-maybe { background: #e7a39c; }
.seg-no-idea { background: #b7ada3; }
.seg-right-maybe { background: #b5d99f; }
.seg-right-probably { background: #74b565; }
.seg-right-definitely { background: #2c7a4b; }
.segment-legend { list-style: none; margin: 0.6rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; font-size: 0.82rem; color: var(--muted); }
.segment-legend i { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 3px; margin-right: 0.35rem; vertical-align: -1px; }

.loading { color: var(--muted); padding: 3rem 0; text-align: center; }

/* -- written answers ------------------------------------------------------ */

.answer-box { white-space: pre-wrap; background: var(--sunken); border-radius: var(--radius); padding: 1rem; margin: 0 0 1rem; }
.rubric { list-style: none; margin: 0; padding: 0; }
.rubric > li { padding: 0.9rem 0; border-top: 1px solid var(--line); }
.rubric > li:first-child { border-top: 0; padding-top: 0; }
.rubric .point { margin: 0 0 0.5rem; }
.rubric .marks { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.rubric .guidance { color: var(--muted); font-size: 0.88rem; margin: 0 0 0.5rem; }
.award { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.award label {
  display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; font-size: 0.92rem;
  padding: 0.35rem 0.8rem; border: 1.5px solid var(--line); border-radius: 999px; background: var(--surface);
}
.award input { accent-color: var(--accent); margin: 0; }
.award label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.compare { display: grid; grid-template-columns: auto auto 1fr; gap: 0.3rem 0.9rem; align-items: baseline; font-size: 0.95rem; }
.compare .who { color: var(--muted); font-size: 0.8rem; }
.compare .got { font-weight: 750; white-space: nowrap; }
.compare .got.full { color: var(--good); }
.compare .got.none { color: var(--bad); }
.compare q { font-style: italic; }
.differs { background: var(--warn-soft); border-radius: 8px; padding: 0.1rem 0.5rem; font-size: 0.8rem; color: var(--warn); font-weight: 700; }
.totals { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin: 0 0 1rem; text-align: center; }
.totals div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 0.5rem; }
.totals b { display: block; font-family: var(--serif); font-size: 1.8rem; line-height: 1.1; }
.totals span { font-size: 0.8rem; color: var(--muted); }
.spinner {
  display: inline-block; width: 1rem; height: 1rem; border-radius: 50%; vertical-align: -2px; margin-right: 0.5rem;
  border: 2px solid var(--line); border-top-color: var(--accent); animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
  .runner-top .bar span { transition: none; }
}

/* -- tasting -------------------------------------------------------------- */

.wine-form { display: grid; gap: 0.9rem; }
.wine-form label { display: grid; gap: 0.3rem; font-weight: 650; font-size: 0.92rem; text-transform: capitalize; }
.wine-form select, .wine-form input { font-weight: 400; text-transform: none; }
.scale-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.75rem; }
table.compare-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.compare-table th, table.compare-table td { text-align: left; padding: 0.55rem 0.5rem 0.55rem 0; border-top: 1px solid var(--line); vertical-align: top; }
table.compare-table thead th { border-top: 0; color: var(--muted); font-size: 0.8rem; font-weight: 650; }
table.compare-table td:first-child { text-transform: capitalize; font-weight: 650; white-space: nowrap; }
.match { color: var(--good); font-weight: 700; }
.mismatch { color: var(--warn); font-weight: 700; }
details { border-top: 1px solid var(--line); padding: 0.75rem 0; }
details:first-of-type { border-top: 0; }
summary { cursor: pointer; font-weight: 650; }
details p { margin: 0.6rem 0 0; }

/* -- progress and review -------------------------------------------------- */

table.plain { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.plain th, table.plain td { text-align: left; padding: 0.5rem 0.75rem 0.5rem 0; border-top: 1px solid var(--line); }
table.plain thead th { border-top: 0; color: var(--muted); font-size: 0.8rem; }
table.plain td.num, table.plain th.num { text-align: right; font-variant-numeric: tabular-nums; }
.review-fact { border-top: 1px solid var(--line); padding: 1rem 0; }
.review-fact:first-child { border-top: 0; }
.review-form { background: var(--sunken); border-radius: 10px; padding: 0.6rem 0.8rem; margin: 0.5rem 0 0; font-size: 0.92rem; }
.review-form code { font-size: 0.78rem; color: var(--muted); }
.review-form .right { color: var(--good); font-weight: 700; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.88em; }
pre { background: var(--sunken); padding: 1rem; border-radius: var(--radius); overflow-x: auto; font-size: 0.85rem; }


/* -- strands ---------------------------------------------------------------- */

.strand-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.25rem 0 1rem; }
.strand-tabs a {
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: inherit;
  text-decoration: none;
  font-size: 0.9rem;
}
.strand-tabs a:hover { border-color: var(--accent); }
.strand-tabs a[aria-current="page"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
ol.rows.strands { counter-reset: strand; padding-left: 0; }
ol.rows.strands > li { counter-increment: strand; }
ol.rows.strands > li > strong::before { content: counter(strand) ". "; }
.card h3 { margin: 1.25rem 0 0.5rem; font-size: 1rem; }


/* -- accounts --------------------------------------------------------------- */

.narrow { max-width: 27rem; }
.field { display: grid; gap: 0.35rem; margin: 0 0 1.1rem; }
.field label { font-weight: 650; font-size: 0.92rem; }
.field input[aria-invalid="true"] { border-color: var(--bad); }
.field .errorlist { list-style: none; margin: 0; padding: 0; color: var(--bad); font-size: 0.9rem; font-weight: 600; }
.field .helptext { color: var(--muted); font-size: 0.85rem; }
.field .helptext ul { margin: 0; padding-left: 1.1em; }
.after-form { margin-top: 1.5rem; }
.button-row form { margin: 0; }


/* -- the front page a visitor sees ------------------------------------------- */

/* Laid out as the first wine.study front page was: the logo large and centred,
   one line on what this is, a paragraph on why, and the way onto the list. */
.landing { text-align: center; margin: 0 0 3rem; }
.landing-logo { display: block; width: min(24rem, 88%); height: auto; margin: 0 auto 1.75rem; }
.landing h1 { max-width: 32rem; margin: 0 auto 0.9rem; }
.landing p { max-width: 34rem; margin-left: auto; margin-right: auto; }
.landing .lede { margin-bottom: 2rem; }
.landing .waiting-form {
  display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: flex-start; justify-content: center;
  max-width: 30rem; margin: 1.1rem auto;
}
.landing .waiting-form .field { flex: 1 1 14rem; margin: 0; text-align: left; }
/* The sentence above the box says what it is for. */
.landing .waiting-form label {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.landing .waiting-form .notice { flex: 1 1 100%; text-align: left; }
/* The header's small logo would only repeat the large one. */
.page-landing .brand { visibility: hidden; }
.landing-note { margin-top: 2.5rem; }

/* -- the waiting list --------------------------------------------------------- */

.waiting-form { max-width: 27rem; }
/* A box for the programs that fill in every box. People never see it. */
.for-programs { position: absolute; left: -100vw; width: 1px; height: 1px; overflow: hidden; }

/* -- the dashboard ------------------------------------------------------------ */

.page-dashboard .site-header, .page-dashboard main, .page-dashboard .site-footer { max-width: 64rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 0.75rem; margin: 1.25rem 0; }
.stats > div {
  display: grid; gap: 0.1rem; padding: 0.9rem 1rem; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface);
}
.stats strong { font-family: var(--serif); font-size: 1.9rem; line-height: 1.1; }
.stats span { font-weight: 600; }
.stats small { color: var(--muted); }
/* A wide table scrolls sideways inside its card and does not push the page wider. */
.scroll { overflow-x: auto; }
.scroll table { min-width: 34rem; }
.scroll th, .scroll td { white-space: nowrap; }
.scroll td.wraps { white-space: normal; min-width: 9rem; }
table.plain tr.quiet td { color: var(--muted); }
table.plain td.actions { white-space: nowrap; text-align: right; padding-right: 0; }
table.plain td.actions form { display: inline-block; margin-left: 0.3rem; }
.state {
  display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px; font-size: 0.8rem; font-weight: 650;
  background: var(--sunken); color: var(--muted); white-space: nowrap;
}
.state.good { background: var(--good-soft); color: var(--good); }
.state.warn { background: var(--warn-soft); color: var(--warn); }
.state.bad { background: var(--bad-soft); color: var(--bad); }
input.copy {
  width: 100%; min-width: 14rem; margin-top: 0.3rem; padding: 0.3rem 0.5rem; font: inherit; font-size: 0.85rem;
  color: var(--ink); background: var(--sunken); border: 1px solid var(--line); border-radius: 8px;
}
td > input.copy:first-child { margin-top: 0; }
.inline-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 0 1rem; align-items: start; margin-bottom: 1.25rem; }
.inline-form .button { justify-self: start; align-self: end; margin-bottom: 1.1rem; }
