main h2 {
  margin-bottom: 0.25rem;
}

/* ==========================================================================
   Shared components. docs/standards.md says when to use each one; a page's
   own stylesheet keeps only what is truly its own.
   ========================================================================== */

/* Card */
.card {
  background: var(--ash);
  border: 1px solid var(--grate);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-width: 0;
  /* A word too long for the line (an address, a URL) breaks rather than
     pushing the page sideways; ordinary words never break. */
  overflow-wrap: break-word;
}

.card > h2,
.card > h3,
.card-head > h2,
.card-head > h3,
details.fold > summary {
  margin: 0;
  font: 700 1.25rem/1.2 var(--display);
  color: var(--paper);
}

/* A card's title with a tag (Practice or Live) or a button beside it. */
.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.card h4 {
  margin: 0.4rem 0 0;
  font: 700 1rem/1.3 var(--display);
}

/* A small label above a value or row (not a heading). */
.label {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--smoke);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Folding: a whole card (details.card.fold), a part inside a card
   (details.more), and a list row (details.row). Every fold shows a marker. */
details.fold > summary,
details.more > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.5rem;
}

details.fold > summary::-webkit-details-marker,
details.more > summary::-webkit-details-marker,
details.row > summary::-webkit-details-marker {
  display: none;
}

details.fold > summary::before,
details.more > summary::before {
  content: "";
  flex: none;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0.32em 0 0.32em 0.5em;
  border-color: transparent transparent transparent var(--ember);
  transition: transform 0.15s ease;
}

details.fold[open] > summary::before,
details.more[open] > summary::before {
  transform: rotate(90deg);
}

details.fold:not([open]) {
  gap: 0;
}

/* A folding card is no taller than its title row when closed; its title
   sits where a plain card's title does. */
details.card.fold {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

details.card.fold[open] {
  padding-bottom: 1rem;
}

/* What a folding card holds is spaced like a plain card's parts. Without
   this, everything after the summary sat in one box with no gap between
   notes, stats and headings (browsers without ::details-content keep the
   old look). */
details.card.fold[open]::details-content {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-width: 0;
}

details.more > summary {
  font: 600 0.9375rem/1.3 var(--body);
  color: var(--paper);
}

details.more > summary:hover,
details.fold > summary:hover {
  color: var(--ember);
}

details.more[open] > summary {
  margin-bottom: 0.5rem;
}

details.row > summary {
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-right: 1.75rem;
}

details.row > summary::after {
  content: "";
  position: absolute;
  right: 0.5rem;
  top: 50%;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--smoke);
  border-bottom: 2px solid var(--smoke);
  transform: translateY(-70%) rotate(-45deg);
  transition: transform 0.15s ease;
}

details.row[open] > summary::after {
  transform: translateY(-70%) rotate(45deg);
  border-color: var(--ember);
}

/* A row's summary is a 40px tap target. :where keeps this weaker than a
   page's own row padding (the lessons list). */
details.row > summary {
  min-height: 2.5rem;
}

:where(details.row) > summary {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

/* Rows listed in a card (Cube Robot runs, License Finder people): a line
   between rows, and an open row's parts spaced like a card's. */
.card > details.row + details.row {
  border-top: 1px solid var(--grate);
}

.card > details.row > :not(summary) {
  margin: 0;
}

.card > details.row[open]::details-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
  padding-bottom: 0.75rem;
}

summary:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 2px;
  border-radius: 4px;
}

.count {
  font: 400 0.875rem/1 var(--body);
  color: var(--smoke);
}

/* Second level views (inside a tab) */
.subtabs {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 0.1rem;
}

.subtabs button {
  appearance: none;
  flex: none;
  background: transparent;
  color: var(--smoke);
  border: 1px solid var(--grate);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font: 600 0.875rem/1.2 var(--body);
  cursor: pointer;
}

.subtabs button[aria-selected="true"] {
  color: var(--bark);
  background: var(--ember);
  border-color: var(--ember);
}

/* Tab bars stay on one line and scroll sideways on a phone. */
.tabs {
  overflow-x: auto;
  scrollbar-width: none;
}

/* When a tab bar or sub tab bar has more to its right, its end fades, so a
   phone shows there is more to swipe to. The fade follows the scroll and is
   gone at the end or when everything fits. Browsers without scroll driven
   animations show the bar as before. */
@property --tab-fade {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

@keyframes tab-fade {
  from { --tab-fade: 2rem; }
  to { --tab-fade: 0px; }
}

@supports (animation-timeline: scroll()) {
  .tabs,
  .subtabs {
    animation: tab-fade linear both;
    animation-timeline: scroll(self inline);
    mask-image: linear-gradient(to right, black calc(100% - var(--tab-fade)), transparent);
  }
}

.tabs button,
.tabs a {
  flex: none;
  white-space: nowrap;
}

/* A choice of one (joined) */
.seg {
  display: inline-flex;
  border: 1px solid var(--grate);
  border-radius: 6px;
  overflow: hidden;
}

.seg button {
  appearance: none;
  background: transparent;
  color: var(--paper);
  border: 0;
  border-left: 1px solid var(--grate);
  padding: 0.5rem 0.85rem;
  font: 500 0.875rem/1.2 var(--body);
  cursor: pointer;
}

.seg button:first-child {
  border-left: 0;
}

.seg button.on,
.seg button[aria-pressed="true"] {
  background: var(--ember);
  color: var(--bark);
  font-weight: 600;
}

/* Toggle chips */
.chip {
  appearance: none;
  background: transparent;
  color: var(--paper);
  border: 1px solid var(--grate);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font: 500 0.875rem/1.2 var(--body);
  cursor: pointer;
}

.chip:hover {
  border-color: var(--ember);
}

.chip.on,
.chip[aria-pressed="true"] {
  background: var(--ember);
  border-color: var(--ember);
  color: var(--bark);
}

/* Buttons: one primary (the card's main action), secondary (.action, below),
   text buttons, and danger. */
.primary,
.action.primary {
  appearance: none;
  background: var(--ember);
  color: var(--bark);
  border: 1px solid var(--ember);
  border-radius: 6px;
  padding: 0.6rem 1.1rem;
  font: 700 0.9375rem/1.3 var(--body);
  cursor: pointer;
}

.primary:hover:not(:disabled),
.action.primary:hover:not(:disabled) {
  background: var(--ember-hi);
  border-color: var(--ember-hi);
  color: var(--bark);
}

.primary:disabled {
  opacity: 0.45;
  cursor: default;
}

.link-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  background: none;
  border: 0;
  padding: 0.5rem 0.1rem;
  min-height: 2.5rem;
  color: var(--ember);
  font: 500 0.875rem/1.3 var(--body);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.action.danger {
  color: var(--bad);
  border-color: var(--bad-fill);
}

.action.danger:hover:not(:disabled) {
  color: var(--bark);
  background: var(--bad-fill);
  border-color: var(--bad-fill);
}

/* Inside a card the gap spaces things; paragraphs add no margin of their own. */
.card > p,
details.more > p {
  margin: 0;
}

/* Parts inside an open fold are spaced like a card. Where the browser has
   ::details-content (Chrome, Safari 18.4 and later), everything after the
   summary sits inside it, so the gap must be set there too; without it a
   fold's note, fields and buttons touched (Car Shopping's "Price on paper",
   November 15, 2026). */
details.more[open] {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

details.more[open]::details-content {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-width: 0;
}

details.more[open] > summary {
  margin-bottom: 0;
}

a.primary,
a.action {
  display: inline-block;
  text-decoration: none;
}

.field textarea {
  width: 100%;
  background: var(--ash);
  color: var(--paper);
  border: 1px solid var(--grate);
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
  font: 400 0.9375rem/1.4 var(--body);
}

/* A lone button in a card keeps its own width. */
.card > button,
.card > a.action,
.card > a.primary {
  align-self: flex-start;
}

/* A row of buttons */
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

/* Status pill: a dot in the state's color, and words that say the state. */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--grate);
  border-radius: 999px;
  background: var(--bark);
  color: var(--paper);
  font: 500 0.8125rem/1.2 var(--body);
  white-space: nowrap;
}

.pill::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--smoke);
  flex: none;
}

.pill.ok::before { background: var(--good-fill); }
.pill.warn::before { background: var(--ember); }
.pill.bad::before { background: var(--bad-fill); }

/* Tag: a small attribute (Same trim, Vegan), no dot. */
.tag {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--grate);
  border-radius: 999px;
  color: var(--smoke);
  font: 500 0.75rem/1.4 var(--body);
}

.tag.good { color: var(--good); border-color: var(--good-fill); }
.tag.bad { color: var(--bad); border-color: var(--bad-fill); }

/* Numbers at a glance */
.stats {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
}

.stat {
  background: var(--bark);
  border: 1px solid var(--grate);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.stat .k {
  color: var(--smoke);
  font-size: 0.8125rem;
}

.stat .v {
  font: 700 1.25rem/1.2 var(--display);
  color: var(--paper);
  overflow-wrap: anywhere;
}

.stat .s {
  color: var(--smoke);
  font-size: 0.8125rem;
}

.up { color: var(--good); }
.down { color: var(--bad); }

/* Tables, in a box that scrolls sideways with a fade at its edge. */
.table-scroll {
  --scroll-bg: var(--ash);
  overflow-x: auto;
  max-width: 100%;
  background:
    linear-gradient(to right, var(--scroll-bg) 30%, transparent) left / 1.5rem 100% no-repeat local,
    linear-gradient(to left, var(--scroll-bg) 30%, transparent) right / 1.5rem 100% no-repeat local,
    linear-gradient(to right, rgba(0, 0, 0, 0.35), transparent) left / 0.75rem 100% no-repeat scroll,
    linear-gradient(to left, rgba(0, 0, 0, 0.35), transparent) right / 0.75rem 100% no-repeat scroll;
}

/* A table that sits on the page, not in a card. */
.table-scroll.on-page {
  --scroll-bg: var(--bark);
}

/* On a phone, a wide table reads as one labeled block per row: the first
   cell is the row's name; every other cell shows its data-label. */
@media (max-width: 34rem) {
  .table.stacked thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .table.stacked,
  .table.stacked tbody,
  .table.stacked tr,
  .table.stacked td {
    display: block;
  }

  .table.stacked tr {
    padding: 0.55rem 0;
    border-bottom: 1px solid rgba(75, 61, 51, 0.5);
  }

  /* A row kept back by "Show all" stays hidden in the stacked layout. */
  .table.stacked tr[hidden] {
    display: none;
  }

  .table.stacked td {
    display: flex;
    gap: 0.75rem;
    padding: 0.1rem 0;
    border: 0;
  }

  .table.stacked td::before {
    content: attr(data-label);
    flex: none;
    width: 6.5rem;
    color: var(--smoke);
    font-family: var(--body); /* the label, even beside a .mono value */
    font-size: 0.8125rem;
    font-weight: 400;
    padding-top: 0.05rem;
  }

  .table.stacked td:first-child {
    padding-bottom: 0.2rem;
    font-weight: 600;
  }

  .table.stacked td:first-child::before {
    content: none;
  }

  /* A number in a stacked row sits beside its label like any other value,
     and a long label wraps in its column instead of running over the value
     (Finances, November 22, 2026). */
  .table.stacked td.num {
    text-align: left;
  }

  .table.stacked td::before {
    white-space: normal;
  }

  /* A cell with nothing in it shows no label either. */
  .table.stacked td:empty {
    display: none;
  }
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table th {
  text-align: left;
  color: var(--smoke);
  font-weight: 600;
  font-size: 0.8125rem;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--grate);
  white-space: nowrap;
}

.table td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid rgba(75, 61, 51, 0.5);
  vertical-align: top;
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Words around the content */
.note {
  margin: 0;
  color: var(--smoke);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.fine {
  margin: 1.5rem 0 0;
  max-width: var(--measure);
  color: var(--smoke);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.callout {
  margin: 0;
  padding: 0.65rem 0.85rem;
  border-left: 3px solid var(--ember);
  border-radius: 0 6px 6px 0;
  background: rgba(244, 163, 64, 0.08);
}

.callout.bad {
  border-left-color: var(--bad-fill);
  background: rgba(224, 112, 90, 0.08);
}

.loading {
  color: var(--smoke);
}

.error {
  margin: 0;
  color: var(--bad);
}

/* Checkbox with its label as the tap target */
.check {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.5rem;
  min-height: 2.25rem;
  cursor: pointer;
}

.check input {
  flex: none;
  width: 1.05rem;
  height: 1.05rem;
  margin: 0.2rem 0 0;
  accent-color: var(--ember);
}

code,
.mono {
  font-family: var(--mono);
  font-size: 0.875em;
}

@media (max-width: 34rem) {
  .card {
    padding: 0.9rem;
  }
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--grate);
  margin-bottom: 1.5rem;
}

.tabs button {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  padding: 0.625rem 0.875rem;
  color: var(--smoke);
  font: 600 1rem/1.2 var(--body);
  cursor: pointer;
}

.tabs button:hover {
  color: var(--paper);
}

.tabs button[aria-selected="true"] {
  color: var(--paper);
  border-bottom-color: var(--ember);
}

/* Tabs that are links to sibling pages (News and Lessons learned). */
.tabs a {
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  padding: 0.625rem 0.875rem;
  color: var(--smoke);
  font: 600 1rem/1.2 var(--body);
  text-decoration: none;
}

.tabs a:hover {
  color: var(--paper);
}

.tabs a[aria-current="page"] {
  color: var(--paper);
  border-bottom-color: var(--ember);
}

/* Controls */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
  margin-bottom: 1.25rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8125rem;
  color: var(--smoke);
  min-width: 10rem;
}

.field.grow {
  flex: 1 1 16rem;
}

/* A grid of fields (a form's boxes side by side): two on a phone, more as
   room allows. A label that wraps to two lines keeps its box level with
   its neighbors. */
.fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.6rem;
}

.fields .field {
  min-width: 0;
  justify-content: flex-end;
}

@media (max-width: 34rem) {
  .fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.field input,
.field select {
  width: 100%;
  background: var(--ash);
  color: var(--paper);
  border: 1px solid var(--grate);
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
  font: 400 0.9375rem/1.3 var(--body);
}

.field input:focus-visible,
.field select:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 1px;
}

.action {
  appearance: none;
  background: transparent;
  color: var(--paper);
  border: 1px solid var(--grate);
  border-radius: 6px;
  padding: 0.55rem 0.9rem;
  font: 500 0.875rem/1.3 var(--body);
  cursor: pointer;
}

.action:hover:not(:disabled) {
  border-color: var(--ember);
  color: var(--ember);
}

.action:disabled {
  opacity: 0.45;
  cursor: default;
}

/* News */

/* "Updated for the week of ..." sits under the lede. */
.lede + .feed-status {
  margin: -1.5rem 0 1.5rem;
}

.feed-status:empty {
  display: none;
}

.overview {
  max-width: var(--measure);
  color: var(--paper);
  margin: 0 0 1.5rem;
}

.overview:empty {
  display: none;
}

/* The topics this week, each a link to its fold. */
.jump {
  margin: 0 0 1rem;
}

.jump ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.jump a {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0 0.85rem;
  border: 1px solid var(--grate);
  border-radius: 999px;
  color: var(--paper);
  font: 500 0.875rem/1.2 var(--body);
  text-decoration: none;
}

.jump a:hover {
  border-color: var(--ember);
  color: var(--ember);
}

/* Each topic folds (details.card.fold); the first is open. */
#news-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.topic {
  scroll-margin-top: 1rem;
}

.topic > summary .count {
  margin-left: 0.15rem;
}

.stories {
  list-style: none;
  margin: 0;
  padding: 0;
}

.story {
  padding: 0.9rem 0;
  border-top: 1px solid rgba(75, 61, 51, 0.5);
  max-width: var(--measure);
}

.story:last-child {
  padding-bottom: 0.2rem;
}

.story a.headline {
  font: 600 1rem/1.4 var(--body);
  color: var(--paper);
  text-decoration: none;
}

.story a.headline:hover {
  color: var(--ember);
  text-decoration: underline;
}

.meta {
  margin: 0.2rem 0 0.35rem;
  color: var(--smoke);
  font-size: 0.8125rem;
}

.meta span + span::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  margin: 0 0.6rem 0.2rem;
  border-radius: 50%;
  background: var(--grate);
  vertical-align: middle;
}

.story p.summary {
  margin: 0;
  font-size: 0.9375rem;
}

.empty {
  color: var(--smoke);
}

.found {
  color: var(--smoke);
  font-size: 0.9375rem;
  margin: 0;
}

/* Lessons */

/* Search, then the four lists (folded behind Filters on a phone). */
.ll-search {
  margin-bottom: 0.75rem;
}

.ll-filters {
  margin-bottom: 1.25rem;
}

.ll-filters .controls {
  margin-bottom: 0;
}

@media (min-width: 34.0625rem) {
  .ll-filters > summary {
    display: none;
  }
}

.resultbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.resultbar p {
  margin: 0;
  color: var(--smoke);
  font-size: 0.9375rem;
}

.lessons {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--grate);
}

.lesson {
  border-bottom: 1px solid var(--grate);
}

/* Each lesson is a details.row: the chevron on the right shows it opens. */
.lesson summary {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.15rem 1rem;
  padding: 0.9rem 0.25rem;
}

.lesson summary:hover .ltitle,
.lesson [open] .ltitle {
  color: var(--ember);
}

.lesson summary:focus-visible {
  outline-offset: -2px;
}

.lid {
  grid-row: span 2;
  font: 700 0.9375rem/1.5 var(--display);
  color: var(--ember);
}

.ltitle {
  font-weight: 600;
  line-height: 1.4;
}

.lmeta {
  color: var(--smoke);
  font-size: 0.8125rem;
}

.lbody {
  padding: 0 0.25rem 1.25rem 6.75rem;
  max-width: calc(var(--measure) + 6.75rem);
}

.lbody h4 {
  margin: 1rem 0 0.25rem;
  font: 600 0.8125rem/1.3 var(--body);
  color: var(--smoke);
}

.lbody p {
  margin: 0;
  font-size: 0.9375rem;
}

.lbody .facts {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.3rem 1rem;
  font-size: 0.875rem;
}

.lbody .facts dt {
  color: var(--smoke);
}

.lbody .facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
  color: var(--smoke);
  font-size: 0.9375rem;
}

@media (max-width: 640px) {
  .lesson summary {
    grid-template-columns: 1fr;
  }

  .lid {
    grid-row: auto;
  }

  .lbody {
    padding-left: 0.25rem;
  }

  .field {
    min-width: 0;
    flex: 1 1 100%;
  }
}

/* Privacy: plain cards of text. */
.privacy .card p {
  margin: 0;
  max-width: var(--measure);
}

/* Tap targets are at least 40px tall (docs/standards.md, Phone): buttons,
   sub tabs, choices of one and checkboxes everywhere, and toggle chips on a
   phone, where fingers do the tapping. */
.primary,
.action,
.subtabs button,
.seg button {
  min-height: 2.5rem;
}

a.primary,
a.action {
  display: inline-flex;
  align-items: center;
  gap: 0.4em; /* an icon and its words keep their space */
}

.check {
  min-height: 2.5rem;
}

@media (max-width: 34rem) {
  .chip {
    min-height: 2.5rem;
  }
}
