/* ==========================================================================
   Cards — the cheat-sheet cards and a student's collection of them
   (cards.js). One sheet for the app (index.html: the chip under an answer,
   the card in a dialog, the collection on Me) and for cards.html.

   A card is a trading card: a number and a rarity across the top, a picture
   in a dark window (a stage, like every 3D model here: --stage-*), its name,
   then what a student would copy onto a cheat sheet. Rarity is the colour of
   the frame — grey, teal, coral, amber, the emblems' own scale. A card not
   yet earned is shown in grey; its words are never locked away under an
   answer.
   ========================================================================== */

.tcard {
  --tc: var(--border-depth);
  --tc-ink: var(--muted);
  position: relative;
  display: block;
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--tc);
  border-radius: var(--r-lg, 16px);
  text-align: left;
  font: inherit;
}
.tcard.rar-2 { --tc: var(--teal); --tc-ink: var(--teal-dark); }
.tcard.rar-3 { --tc: var(--coral); --tc-ink: var(--coral-ink); }
.tcard.rar-4 { --tc: var(--amber); --tc-ink: var(--amber-ink); }
:root[data-theme="dark"] .tcard.rar-2 { --tc-ink: var(--teal); }
:root[data-theme="dark"] .tcard.rar-3 { --tc-ink: var(--coral); }
:root[data-theme="dark"] .tcard.rar-4 { --tc-ink: var(--amber); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tcard.rar-2 { --tc-ink: var(--teal); }
  :root:not([data-theme="light"]) .tcard.rar-3 { --tc-ink: var(--coral); }
  :root:not([data-theme="light"]) .tcard.rar-4 { --tc-ink: var(--amber); }
  :root:not([data-theme="light"]) .tc-links a, :root:not([data-theme="light"]) .tc-credit a { color: var(--teal); }
}

/* The picture's window. */
.tc-art {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  border-radius: var(--r-md, 12px);
  background: radial-gradient(120% 90% at 50% 38%, var(--stage-glow), var(--stage-bg) 72%);
  color: var(--stage-text);
}
.tc-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.tc-img.cover { object-fit: cover; }
/* A diagram from an open collection: shown whole, on the white it was drawn for. */
.tc-img.whole { object-fit: contain; padding: 6px; }
.tc-art.on-white { background: #fff; }
/* The words a card stood on before it had a photograph, over the foot of it. */
.tc-over {
  position: absolute; inset: auto 0 0 0; display: grid; gap: 1px; padding: 18px 12px 8px; text-align: left;
  background: linear-gradient(transparent, rgba(8, 14, 20, 0.82) 55%);
  color: #fff; font-family: var(--font-display); line-height: 1.15; text-wrap: balance; pointer-events: none;
}
.tc-over b { font-weight: 800; font-size: 15px; }
.tc-over small { font-family: var(--font-body); font-weight: 600; font-size: 11px; color: rgba(255, 255, 255, 0.82); }
.tc-img.fig { inset: 0; padding: 0; }
/* Words set large, for a card whose picture is a formula or a name. */
.tc-big {
  display: grid; gap: 4px; justify-items: center; padding: 8px 12px; text-align: center;
  font-family: var(--font-display); line-height: 1.12; text-wrap: balance;
  background-image: linear-gradient(color-mix(in srgb, var(--stage-text) 6%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--stage-text) 6%, transparent) 1px, transparent 1px);
  background-size: 22px 22px; background-position: center;
  position: absolute; inset: 0; align-content: center;
}
.tc-big b { font-weight: 900; font-size: 26px; color: var(--stage-text); }
.tc-big.m b { font-size: 21px; }
.tc-big.s b { font-size: 16px; }
.tc-big small { font-family: var(--font-body); font-weight: 600; font-size: 12px; color: color-mix(in srgb, var(--stage-text) 70%, transparent); }
.tc-art.k-words { aspect-ratio: 16 / 5; }

/* A set's picture with its parts named: the picture in the middle, names
   down both sides, a leader from each to its part. */
.tc-art.has-pins { aspect-ratio: 20 / 11; }
.tc-art.has-pins .tc-img { left: 28%; width: 44%; object-fit: fill; }
.tc-leads { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.tc-leads polyline { fill: none; stroke: color-mix(in srgb, var(--stage-text) 62%, transparent); stroke-width: 1; vector-effect: non-scaling-stroke; }
.tc-dot { position: absolute; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: var(--r-full, 9999px); background: var(--stage-focus); box-shadow: 0 0 0 2px var(--stage-veil); }
.tc-pin {
  position: absolute; width: 26%; transform: translateY(-50%);
  font-size: 10.5px; line-height: 12px; font-weight: 600; color: var(--stage-text);
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.tc-pin.l { left: 0; text-align: right; }
.tc-pin.r { right: 0; text-align: left; }

/* ── The whole card ───────────────────────────────────────────────── */
/* Its words are in view wherever it stands, held or not: a card is earned
   by answering, never unlocked by it. `tc-face` is the card as one column
   (a wide page, print); `tc-deck` is the card set into a box of a given
   height and cut into pages where it does not fit — a page is whole on the
   screen and nothing is scrolled (cards.js, `mount`). */
.tc-face, .tc-deck {
  padding: 8px 12px 12px;
  /* A trading card: the frame in its rarity's colour, a hairline inside it,
     and that colour running down from the top behind the picture. */
  background: linear-gradient(180deg, color-mix(in srgb, var(--tc) 13%, var(--surface)) 0, var(--surface) 168px);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tc) 28%, transparent), var(--card-shadow);
}
.tc-face { max-width: 440px; margin-inline: auto; }
/* A card is as wide as what it stands in, never wider: nothing inside it
   may set its least width (see `.tc-credit.under`). */
.tc-deck { display: block; width: 100%; max-width: 100%; min-width: 0; padding-bottom: 8px; }
.tc-face, .tc-deck { overflow-wrap: break-word; }
.tc-page { min-width: 0; }
.tc-face .tc-art, .tc-deck .tc-art { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--stage-text) 16%, transparent); }
.tc-no { font-family: var(--font-display); font-weight: 900; letter-spacing: .02em; font-variant-numeric: tabular-nums; color: var(--tc-ink); }
.tc-deck.compact .tc-no { display: none; }
.tc-bar { display: flex; align-items: center; gap: 8px; min-height: 22px; margin: 0 2px 6px; font-size: 11px; line-height: 14px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--tc-ink); }
.tc-bar .tc-from { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.tc-earn { display: inline-flex; align-items: center; gap: 4px; letter-spacing: .06em; color: var(--muted); }
.tc-earn.got { padding: 1px 8px 1px 6px; border-radius: var(--r-full, 9999px); background: color-mix(in srgb, var(--amber) 24%, transparent); color: var(--amber-ink); }
.tc-earn.got i { font-style: normal; }
@media (prefers-reduced-motion: no-preference) { .tc-earn.now { animation: tc-pop var(--dur-celebrate, 700ms) var(--ease-reward) 1; } }
.tc-dots { display: inline-flex; gap: 4px; }
.tc-dots i { width: 9px; height: 9px; border-radius: var(--r-full, 9999px); border: 2px solid var(--tc); }
.tc-dots i.on { background: var(--tc); }
.tcard .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* A box too low for the name to have a line of its own: it is said in the bar. */
.tc-name { display: none; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-display); font-weight: 900; font-size: 16px; line-height: 20px; letter-spacing: 0; text-transform: none; color: var(--text); }
.tc-deck.compact .tc-name { display: block; }
.tc-deck.compact .tc-from, .tc-deck.compact .tc-page > .tc-title, .tc-deck.compact .tc-page > .tc-sub, .tc-deck.compact .tc-cont { display: none; }
.tc-deck.compact .tc-turn { width: 30px; height: 30px; font-size: 17px; }
.tc-deck.compact .tc-pager { margin-top: 4px; }
.tc-pages { position: relative; }
.tc-page { display: flow-root; }
.tc-page[hidden] { display: none; }
.tc-deck .tc-art { aspect-ratio: auto; height: var(--tc-art-h, 180px); }
.tc-deck .tc-art.has-pins { aspect-ratio: 20 / 11; height: auto; width: min(100%, calc(var(--tc-art-h, 180px) * 20 / 11)); margin-inline: auto; }
.tc-face .tc-title, .tc-deck .tc-title { margin: 10px 2px 0; font-family: var(--font-display); font-weight: 900; font-size: 21px; line-height: 25px; text-wrap: balance; }
.tc-sub { margin: 2px 2px 0; font-size: 13px; line-height: 18px; color: var(--muted); }
.tc-lead { margin: 6px 2px 0; font-size: 14.5px; line-height: 21px; text-wrap: pretty; }
.tc-cont { display: flex; align-items: baseline; gap: 8px; margin: 2px 2px 4px; }
.tc-cont b { font-family: var(--font-display); font-weight: 900; font-size: 16px; line-height: 20px; }
.tc-cont span { font-size: 11px; line-height: 14px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }

/* What to copy onto the sheet. A short fact is a tag, as on a specimen's
   label; a longer one is a row. The one the question just asked is marked. */
.tc-tags { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tc-tag { padding: 3px 10px; border-radius: var(--r-full, 9999px); border: 1px solid var(--border); background: var(--surface-2); font-size: 13.5px; line-height: 18px; font-weight: 600; }
.tc-tag span { margin-right: 3px; font-weight: 700; color: var(--muted); }
.tc-facts { margin: 8px 0 0; display: grid; gap: 0; border-top: 1px solid var(--border); }
.tc-fact { display: grid; grid-template-columns: minmax(78px, 30%) 1fr; gap: 10px; padding: 5px 2px; border-bottom: 1px solid var(--border); }
.tc-facts dt { font-size: 12px; line-height: 18px; font-weight: 700; color: var(--muted); }
.tc-facts dd { margin: 0; font-size: 14px; line-height: 19px; }
.tc-list { margin: 8px 0 0; padding-left: 24px; font-size: 14px; line-height: 19px; }
.tc-list li { padding: 2px 0; }
.tc-list li::marker { font-weight: 700; color: var(--tc-ink); font-variant-numeric: tabular-nums; }
.tc-table { margin: 8px 0 0; overflow-x: auto; }
.tc-table table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 18px; }
.tc-table th, .tc-table td { padding: 4px 6px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.tc-table thead th { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tc-table tbody th { font-weight: 700; }
.tc-fact.hit, .tc-list li.hit, .tc-table tr.hit > * { background: var(--teal-soft); }
.tc-fact.hit { box-shadow: inset 3px 0 0 var(--teal); padding-left: 8px; }
.tc-fact.hit dt, .tc-table tr.hit th { color: var(--text); }
.tc-list li.hit { box-shadow: -24px 0 0 var(--teal-soft), inset 0 0 0 0 transparent; border-radius: 0 6px 6px 0; }
.tc-tag.hit { border-color: var(--teal); background: var(--teal-soft); }
.tc-asked-here { margin: 8px 0 0; padding: 6px 10px; border-radius: var(--r-sm, 8px); background: var(--teal-soft); box-shadow: inset 3px 0 0 var(--teal); font-size: 14px; line-height: 19px; }
.tc-asked-here b { display: block; font-size: 11px; line-height: 14px; letter-spacing: .09em; text-transform: uppercase; color: var(--teal-dark); }
:root[data-theme="dark"] .tc-asked-here b { color: var(--teal); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tc-asked-here b { color: var(--teal); } }
.tc-tip { margin: 8px 0 0; padding: 7px 10px; border-radius: var(--r-sm, 8px); background: color-mix(in srgb, var(--amber) 14%, var(--surface)); font-size: 14px; line-height: 19px; }
.tc-tip b { display: block; font-size: 11px; line-height: 14px; letter-spacing: .09em; text-transform: uppercase; color: var(--amber-ink); }
.tc-foot { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin: 10px 2px 0; font-size: 12px; line-height: 16px; color: var(--muted); }
.tc-school { padding: 1px 8px; border-radius: var(--r-full, 9999px); border: 1px solid var(--border); font-weight: 700; color: var(--text); }
.tc-foot a { color: var(--teal-dark); }
:root[data-theme="dark"] .tc-foot a { color: var(--teal); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tc-foot a { color: var(--teal); } }
.tc-open { font-weight: 700; }
.tc-more, .tc-credit { flex-basis: 100%; }
.tc-credit { font-size: 11px; line-height: 14px; }

/* Turning the pages of a card that is more than one screen. */
.tc-pager { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 6px; }
.tc-pager[hidden] { display: none; }
.tc-turn { width: 36px; height: 36px; border-radius: var(--r-full, 9999px); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 20px; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0 0 2px; }
.tc-turn:disabled { opacity: .35; cursor: default; }
.tc-turn:not(:disabled):hover { border-color: var(--teal); }
.tc-turn:focus-visible { outline: 3px solid var(--teal-bright); outline-offset: 2px; }
.tc-pips { display: inline-flex; gap: 6px; }
.tc-pips i { width: 7px; height: 7px; border-radius: var(--r-full, 9999px); background: var(--border-depth); }
.tc-pips i.on { background: var(--tc-ink); width: 18px; }

/* Where a mineral is met in daily life: a photograph beside one line. */
.tc-use { display: grid; grid-template-columns: 96px 1fr; gap: 10px; align-items: start; margin: 10px 0 0; }
.tc-use img { width: 96px; height: 72px; object-fit: cover; border-radius: var(--r-sm, 8px); border: 1px solid var(--border); }
.tc-use figcaption { font-size: 13.5px; line-height: 19px; }
.tc-use figcaption b { display: block; font-size: 11px; line-height: 14px; letter-spacing: .09em; text-transform: uppercase; color: var(--tc-ink); }
.tc-use figcaption small { display: block; margin-top: 2px; font-size: 11px; line-height: 14px; color: var(--muted); }
.tc-use figcaption a { color: inherit; }

/* The pictures real tests have printed of it: small, in a row, each a link
   to the question it came with. */
.tc-pics { margin: 10px 0 0; }
.tc-pics .overline { margin: 0 2px 6px; color: var(--muted); }
.tc-pics-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tc-pic { display: block; aspect-ratio: 4 / 3; border-radius: var(--r-sm, 8px); overflow: hidden; background: #fff; border: 1px solid var(--border); }
.tc-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
a.tc-pic:hover, a.tc-pic:focus-visible { outline: 3px solid var(--teal-bright); outline-offset: 1px; }

/* (A test's picture is a button since 2026-11-16: a tap opens it large.) */
button.tc-pic { padding: 0; cursor: pointer; font: inherit; color: var(--text); }
button.tc-pic:hover, button.tc-pic:focus-visible { outline: 3px solid var(--teal-bright); outline-offset: 1px; }
.tc-pic.more { display: grid; place-items: center; background: var(--surface-2); font-family: var(--font-display); font-weight: 900; font-size: 18px; }
/* On an answer card and in a lesson: one low row of four. */
.tc-pics.small { margin-top: 8px; }
.tc-pics.small .tc-pics-row { grid-template-columns: repeat(5, 1fr); }
.tc-pics.small .tc-pic { aspect-ratio: 1; }

/* ── A picture that can be opened ─────────────────────────────────── */
/* Every picture on a card is a way to more of them: a tap opens it large,
   with the pictures real tests print of the same thing beside it. The mark
   in its corner says so, and how many test pictures wait. */
.tc-art[data-zoom] { cursor: zoom-in; }
.tc-art[data-zoom]:focus-visible { outline: 3px solid var(--stage-focus); outline-offset: 2px; }
.tc-zoom {
  position: absolute; right: 6px; top: 6px; display: inline-flex; align-items: center; gap: 4px; min-height: 24px; padding: 2px 6px;
  border-radius: var(--r-full, 9999px); background: var(--stage-veil); color: var(--stage-text);
  font-size: 11px; line-height: 14px; font-weight: 800; pointer-events: none;
}
.tc-zoom svg { width: 14px; height: 14px; }
.tc-zoom i { font-style: normal; font-variant-numeric: tabular-nums; }
.tc-chip .tc-zoom, .tc-tile .tc-zoom { display: none; }
/* The picture a later page opens on: lower than the first page's. */
.tc-deck .tc-art.again { height: var(--tc-art2-h, 104px); margin-bottom: 6px; }
.tc-art.again .tc-big b { font-size: 15px; }
.tc-art-cap {
  position: absolute; left: 6px; bottom: 6px; padding: 2px 8px; border-radius: var(--r-full, 9999px);
  background: var(--stage-veil); color: var(--stage-text); font-size: 11px; line-height: 14px; font-weight: 700; pointer-events: none;
}

/* ── The other pictures of the thing, under the leading one ────────── */
/* A real photograph beside the model, the model beside the photograph,
   where the thing is met in daily life (cards.js, `also`). Each says what
   kind of picture it is in its corner; a tap opens it large. */
.tc-also { display: grid; gap: 6px; margin: 6px 0 0; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); }
.tc-also.n2 { --n: 2; }
.tc-also.n3 { --n: 3; }
.tc-also.n4 { --n: 4; }
.tc-also-pic {
  position: relative; display: block; height: var(--tc-also-h, 64px); padding: 0; overflow: hidden; cursor: zoom-in;
  border-radius: var(--r-sm, 8px); border: 1px solid color-mix(in srgb, var(--stage-text) 16%, var(--border)); background: var(--stage-bg); color: var(--stage-text); font: inherit;
}
.tc-also-pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tc-also-pic.k-model img, .tc-also-pic.k-fig img { object-fit: contain; }
.tc-also-pic.on-white { background: #fff; }
.tc-also-pic.on-white img { object-fit: contain; }
.tc-also-pic i {
  position: absolute; left: 4px; bottom: 4px; padding: 1px 6px; border-radius: var(--r-full, 9999px); background: var(--stage-veil); color: var(--stage-text);
  font-style: normal; font-size: 10px; line-height: 13px; font-weight: 800; letter-spacing: .04em; pointer-events: none;
}
.tc-also-pic i:empty { display: none; }
.tc-also-pic.k-real i, .tc-also-pic.k-use i, .tc-also-pic.k-micro i { background: color-mix(in srgb, var(--stage-focus) 88%, #000); color: #06201f; }
.tc-also-pic.rest { display: grid; place-items: center; background: var(--surface-2); color: var(--text); font-family: var(--font-display); font-weight: 900; font-size: 17px; cursor: pointer; }
.tc-also-pic:hover, .tc-also-pic:focus-visible { outline: 3px solid var(--teal-bright); outline-offset: 1px; }
/* One alone: the picture, and beside it the line that says what it shows. */
.tc-also.one { grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 10px; }
.tc-also.one .tc-also-pic { height: 64px; }
.tc-also.one p { margin: 0; font-size: 13px; line-height: 17px; color: var(--text); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tc-also.one p b { display: block; font-size: 11px; line-height: 14px; letter-spacing: .09em; text-transform: uppercase; color: var(--tc-ink); }
/* Beside a drawing of an idea the real thing is half the lesson: it stands taller. */
.tc-art.k-fig ~ .tc-also, .tc-art.has-pins ~ .tc-also { --tc-also-h: 84px; }
.tc-deck.compact .tc-also { --tc-also-h: 44px; margin-top: 4px; }
.tc-deck.compact .tc-also.one { grid-template-columns: 72px minmax(0, 1fr); }
.tc-deck.compact .tc-also.one .tc-also-pic { height: 44px; }
.tc-deck.compact .tc-also.one p { -webkit-line-clamp: 2; }
.tc-chip .tc-also, .tc-tile .tc-also { display: none; }
/* (A first page that cannot hold it: cards.js, `fit`.) */
.tc-deck.slim .tc-page:first-child > .tc-also { display: none; }
/* In the gallery, what kind of picture this is. */
.tc-view-kind { display: inline-block; margin-right: 8px; padding: 1px 8px; border-radius: var(--r-full, 9999px); background: color-mix(in srgb, var(--stage-text) 16%, transparent); font-size: 11px; line-height: 16px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; vertical-align: 1px; }
.tc-view-kind.k-real, .tc-view-kind.k-use, .tc-view-kind.k-micro { background: var(--stage-focus); color: #06201f; }
@media print { .tc-also { display: none; } }

/* A line the card is being read for (a Hint, a lesson's coming questions). */
.tc-title.hit { text-decoration: underline; text-decoration-color: var(--teal); text-decoration-thickness: 3px; text-underline-offset: 4px; }
.tc-lead.hit, .tc-tip.hit { box-shadow: inset 3px 0 0 var(--teal); padding-left: 10px; background: var(--teal-soft); border-radius: 0 var(--r-sm, 8px) var(--r-sm, 8px) 0; }
.tc-note { margin: 6px 2px 0; font-size: 12px; line-height: 16px; font-weight: 700; color: var(--teal-dark); }
:root[data-theme="dark"] .tc-note { color: var(--teal); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tc-note { color: var(--teal); } }

/* ── Go deeper: a quotation, and where to read or watch more ───────── */
.tc-deeper { margin: 10px 0 0; padding-top: 8px; border-top: 1px solid var(--border); }
.tc-deeper.more { margin-top: 0; padding-top: 0; border-top: 0; }
/* (Two lines at most, and it WRAPS. Until 2026-11-16 it was one line that
   never wrapped: a long credit — "No machine-readable author provided. Rainer
   Zenz assumed…" — then set the least width the whole card could have, and a
   card in a grid grew out of its column and lay across its neighbour. A line
   that cannot wrap must never stand in a card.) */
.tc-credit.under { margin: 3px 2px 0; font-size: 10.5px; line-height: 13px; color: var(--muted); overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tc-credit.under a { color: inherit; }
.tc-deeper .overline { margin: 0 2px 6px; color: var(--muted); }
.tc-quote { margin: 0 0 8px; padding: 6px 10px; border-left: 3px solid var(--border-depth); font-size: 13.5px; line-height: 19px; color: var(--text); }
.tc-quote p { margin: 0; text-wrap: pretty; }
.tc-quote cite { display: block; margin-top: 3px; font-style: normal; font-size: 11px; line-height: 14px; color: var(--muted); }
.tc-quote cite a { color: inherit; }
.tc-links { display: flex; flex-wrap: wrap; gap: 6px; }
.tc-link {
  display: grid; min-width: 0; max-width: 100%; padding: 5px 10px; border-radius: var(--r-md, 12px); border: var(--line, 1px) solid var(--border);
  background: var(--surface); color: var(--text); text-decoration: none; min-height: 38px; align-content: center;
}
.tc-link b { font-size: 13px; line-height: 16px; font-weight: 800; }
.tc-link small { font-size: 11px; line-height: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; min-width: 0; }
.tc-link { grid-template-columns: minmax(0, 1fr) auto; }
.tc-link::after { content: "↗"; grid-column: 2; grid-row: 1 / span 2; align-self: center; margin-left: 8px; color: var(--muted); font-size: 13px; }
.tc-link:hover, .tc-link:focus-visible { border-color: var(--teal); outline: none; }
.tc-link.k-ka b { color: var(--teal-dark); }
/* The open textbook and Khan Academy stand out among the links (cards.js;
   HANDOVER §8bc ③): a tinted chip, their name in the accent. */
.tc-link.k-os, .tc-link.k-ka { border-color: var(--teal); background: var(--teal-soft); }
.tc-link.k-os b, .tc-link.k-ka b { color: var(--teal-dark); }
:root[data-theme="dark"] .tc-link.k-ka b { color: var(--teal); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tc-link.k-ka b { color: var(--teal); } }

/* ── The pictures of a card, large (cards.js, `gallery`) ───────────── */
.tc-view {
  position: fixed; inset: 0; z-index: 400; display: grid; place-items: center; padding: 12px;
  background: color-mix(in srgb, var(--stage-bg) 82%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.tc-view-box {
  width: min(100%, 760px); max-height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto auto; gap: 8px;
  padding: 10px 12px 12px; border-radius: var(--r-xl, 20px); background: var(--stage-bg); color: var(--stage-text);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--stage-text) 18%, transparent), 0 24px 60px rgba(0, 0, 0, .5);
}
@media (prefers-reduced-motion: no-preference) { .tc-view-box { animation: tc-view-in var(--dur-short, 180ms) var(--ease-enter); } }
@keyframes tc-view-in { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.tc-view-head { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; }
.tc-view-head b { font-family: var(--font-display); font-weight: 900; font-size: 18px; line-height: 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-view-n { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; color: color-mix(in srgb, var(--stage-text) 70%, transparent); }
.tc-view-x {
  width: var(--tap-min, 44px); height: var(--tap-min, 44px); border-radius: var(--r-full, 9999px); border: 1px solid color-mix(in srgb, var(--stage-text) 24%, transparent);
  background: var(--stage-veil); color: var(--stage-text); font-size: 24px; line-height: 1; cursor: pointer;
}
.tc-view-x:focus-visible, .tc-view-turn:focus-visible, .tc-view-thumb:focus-visible { outline: 3px solid var(--stage-focus); outline-offset: 2px; }
.tc-view-main { position: relative; margin: 0; min-height: 180px; display: grid; place-items: center; border-radius: var(--r-md, 12px); overflow: hidden; background: radial-gradient(120% 90% at 50% 38%, var(--stage-glow), var(--stage-bg) 72%); touch-action: pan-y; }
.tc-view-main.on-white { background: #fff; }
.tc-view-main img { display: block; max-width: 100%; max-height: min(62vh, 560px); width: auto; height: auto; object-fit: contain; }
.tc-view-turn {
  position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: var(--r-full, 9999px); border: 0;
  background: rgba(13, 17, 23, .62); color: #EAF0F2; font-size: 24px; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0 0 3px;
}
.tc-view-turn.prev { left: 6px; }
.tc-view-turn.next { right: 6px; }
.tc-view-turn[hidden] { display: none; }
.tc-view-cap { margin: 0 2px; font-size: 14px; line-height: 19px; }
.tc-view-cap small { display: block; font-size: 11px; line-height: 14px; color: color-mix(in srgb, var(--stage-text) 70%, transparent); }
.tc-view-cap a { color: inherit; }
.tc-view-strip { display: flex; gap: 6px; overflow-x: auto; padding: 2px; scrollbar-width: thin; }
.tc-view-thumb {
  position: relative; flex: none; width: 64px; height: 48px; padding: 0; border-radius: var(--r-sm, 8px); overflow: hidden; cursor: pointer;
  border: 2px solid color-mix(in srgb, var(--stage-text) 22%, transparent); background: var(--stage-bg);
}
.tc-view-thumb.on-white { background: #fff; }
.tc-view-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tc-view-thumb[aria-selected="true"] { border-color: var(--stage-focus); }
.tc-view-thumb i { position: absolute; left: 2px; bottom: 2px; padding: 0 4px; border-radius: 4px; background: rgba(13, 17, 23, .72); color: #EAF0F2; font-style: normal; font-size: 9px; line-height: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.tc-view-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.tc-view-acts:empty { display: none; }
.tc-view-acts .cta { width: auto; min-height: 44px; padding: 0 18px; font-size: 16px; }
.tc-view-lab { color: var(--stage-focus); font-weight: 800; text-decoration: none; }
.tc-view-lab:hover { text-decoration: underline; }
.tc-view-note { margin: 0; font-size: 12px; line-height: 16px; color: color-mix(in srgb, var(--stage-text) 70%, transparent); }
@media (max-width: 560px) {
  .tc-view { padding: 0; place-items: end center; }
  .tc-view-box { border-radius: var(--r-xl, 20px) var(--r-xl, 20px) 0 0; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  .tc-view-main img { max-height: 52vh; }
}

/* A card that is held carries a sheen that passes once. One that is not is
   in its own colours too: a mineral in grey teaches the wrong thing. */
.tcard.held.tc-face::after, .tcard.held.tc-deck::after, .tcard.held.tc-tile::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, color-mix(in srgb, var(--tc) 22%, transparent) 47%, color-mix(in srgb, #fff 30%, transparent) 50%, color-mix(in srgb, var(--tc) 22%, transparent) 53%, transparent 65%);
  background-size: 300% 100%; background-position: 110% 0; opacity: .0;
}
@media (prefers-reduced-motion: no-preference) {
  .tcard.held.tc-face::after, .tcard.held.tc-deck::after { animation: tc-sheen 1.4s var(--ease-standard) .25s 1 both; }
  .tcard.held.tc-tile:hover::after { animation: tc-sheen .9s var(--ease-standard) 1 both; }
}
@keyframes tc-sheen { 0% { background-position: 110% 0; opacity: 1; } 99% { background-position: -10% 0; opacity: 1; } 100% { background-position: -10% 0; opacity: 0; } }
.tcard:not(.held).tc-tile { --tc: var(--border); }

/* ── In a collection, seen from far off ───────────────────────────── */
.tc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 12px; }
.tc-tile { display: grid; grid-template-rows: auto 1fr auto; gap: 6px; padding: 8px; cursor: pointer; min-height: 176px; align-content: start; }
.tc-tile .tc-art { aspect-ratio: 4 / 3; }
.tc-tile .tc-title { font-family: var(--font-display); font-weight: 700; font-size: 14px; line-height: 18px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.tc-tile .tc-big b { font-size: 15px; }
.tc-tile .tc-big.m b, .tc-tile .tc-big.s b { font-size: 12px; }
.tc-tile-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 10px; line-height: 14px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--tc-ink); }
.tc-tile:focus-visible, .tc-chip:focus-visible { outline: 3px solid var(--teal-bright); outline-offset: 2px; }
@media (hover: hover) { .tc-tile:hover { transform: translateY(-2px); box-shadow: var(--card-shadow); } }
.tc-tile { transition: transform var(--dur-short, 180ms) var(--ease-standard), box-shadow var(--dur-short, 180ms) var(--ease-standard); }

/* ── A card named in passing: a small one that says where it stands ── */
.tc-chip { display: grid; grid-template-columns: 72px 1fr auto; gap: 10px; align-items: center; width: 100%; padding: 6px 10px 6px 6px; cursor: pointer; min-height: 60px; }
.tc-chip .tc-art { width: 72px; aspect-ratio: 4 / 3; border-radius: var(--r-sm, 8px); }
.tc-chip .tc-big b { font-size: 11px; }
.tc-chip .tc-big { padding: 4px; background-size: 12px 12px; }
.tc-chip-text { display: grid; min-width: 0; }
.tc-chip-text .overline { color: var(--tc-ink); }
.tc-chip-text b { font-family: var(--font-display); font-weight: 700; font-size: 15px; line-height: 19px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tc-chip-text small { font-size: 12px; line-height: 16px; color: var(--muted); }
.tc-chip.now { background: color-mix(in srgb, var(--amber) 12%, var(--surface)); }
@media (prefers-reduced-motion: no-preference) {
  .tc-chip.now { animation: tc-pop var(--dur-celebrate, 700ms) var(--ease-reward) 1; }
}
@keyframes tc-pop { 0% { transform: scale(.94); } 55% { transform: scale(1.03); } 100% { transform: scale(1); } }

/* A row of the cards earned in a session (the summary), or held (Me). */
.tc-row { display: grid; grid-auto-flow: column; grid-auto-columns: 132px; gap: 10px; overflow-x: auto; padding: 4px 2px 10px; scroll-snap-type: x proximity; }
.tc-row > * { scroll-snap-align: start; }

@media print {
  .tc-art { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tc-face { box-shadow: none; break-inside: avoid; }
}

/* ── cards.html: the sheet, every card open ───────────────────────── */
.cards-page { background: var(--bg); color: var(--text); }
.cp { max-width: 1120px; margin: 0 auto; padding: 16px 16px 64px; display: grid; gap: 12px; }
.cp-head { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 8px 16px; }
.cp-back { grid-column: 1 / -1; font-weight: 700; color: var(--teal-dark); text-decoration: none; min-height: 32px; display: inline-flex; align-items: center; }
:root[data-theme="dark"] .cp-back { color: var(--teal); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cp-back { color: var(--teal); } }
.cp-back:hover { text-decoration: underline; }
.cp-title { margin: 0; font-family: var(--font-display); font-weight: 900; font-size: 28px; line-height: 32px; }
.cp-event { display: grid; gap: 2px; }
.cp-event select { min-height: var(--tap-min); max-width: 52vw; padding: 0 10px; border-radius: var(--r-md, 12px); border: var(--line) solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; }
.cp-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.cp-count { flex: 1 1 220px; display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 2px 8px; color: var(--muted); font-size: 14px; }
.cp-count b { font-family: var(--font-display); font-weight: 900; font-size: 26px; line-height: 30px; color: var(--text); }
.cp-track { grid-column: 1 / -1; height: 8px; border-radius: var(--r-full, 9999px); background: var(--surface-2); overflow: hidden; }
.cp-track i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--amber), var(--coral)); transition: width var(--dur-long) var(--ease-standard); }
.cp-filter { display: inline-flex; padding: 3px; border-radius: var(--r-full, 9999px); background: var(--surface-2); }
.cp-filter button { min-height: 36px; padding: 0 14px; border: 0; border-radius: var(--r-full, 9999px); background: none; color: var(--muted); font: inherit; font-weight: 700; cursor: pointer; }
.cp-filter button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.cp-print { width: auto; min-height: 40px; padding: 0 16px; font-size: 15px; }
.cp-how { margin: 0; }
.cp-keep { display: block; margin-top: 4px; }
/* The event's units, to jump by: it stays at the top as the sheet is read. */
.cp-units { position: sticky; top: 0; z-index: 5; display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px; padding: 8px 16px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); scrollbar-width: none; }
.cp-units::-webkit-scrollbar { display: none; }
.cp-units a { flex: none; padding: 6px 12px; border-radius: var(--r-full, 9999px); border: var(--line) solid var(--border); background: var(--surface); color: var(--text); font-size: 13px; line-height: 18px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.cp-units a:hover { border-color: var(--teal); }
.cp-sections { display: grid; gap: 28px; }
.cp-section { scroll-margin-top: 56px; }
.cp-unit { margin: 0 0 10px; font-family: var(--font-display); font-weight: 900; font-size: 20px; line-height: 26px; }
.cp-unit small { margin-left: 6px; font-family: var(--font-body); font-size: 13px; font-weight: 600; color: var(--muted); }
.cp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 16px; align-items: start; }
/* (`minmax(0, 1fr)`: a slot is its column's width whatever stands in it.) */
.cp-slot { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0; min-height: 280px; align-content: start; scroll-margin-top: 64px; border-radius: var(--r-lg, 16px); }
.cp-deck { min-width: 0; }
.cp-slot.in { min-height: 0; }
.cp-slot .tc-deck { box-shadow: var(--card-shadow); }
.cp-slot:not(.in) .cp-deck { min-height: 240px; border-radius: var(--r-lg, 16px); background: var(--surface); border: 2px solid var(--border); }
.cp-go { justify-self: start; padding: 2px 4px; color: var(--teal-dark); font-size: 13px; line-height: 18px; font-weight: 700; text-decoration: none; }
:root[data-theme="dark"] .cp-go { color: var(--teal); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cp-go { color: var(--teal); } }
.cp-go:hover { text-decoration: underline; }
/* Beside it, the way to send the card to a friend (share.js). */
.cp-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-md); }
.cp-share { border: 0; background: none; padding: 2px 4px; color: var(--muted); font: inherit; font-size: 13px; line-height: 18px; font-weight: 700; cursor: pointer; }
.cp-share:hover { color: var(--text); text-decoration: underline; }
.cp-share:focus-visible { outline: 3px solid var(--teal-bright); outline-offset: 2px; }
@media print { .cp-foot { display: none; } }
@media (prefers-reduced-motion: no-preference) { .cp-slot.flash { animation: cp-flash 1.6s var(--ease-standard) 1; } }
.cp-slot.flash .tc-deck { outline: 3px solid var(--amber); outline-offset: 3px; }
@keyframes cp-flash { 0% { transform: scale(.98); } 30% { transform: scale(1.01); } 100% { transform: none; } }
.cp-sheet { display: none; }
@media print {
  .cards-page > :not(.cp-sheet) { display: none !important; }
  .cp-sheet { display: block; color: #000; background: #fff; }
  .cp-sheet h1 { margin: 0; font: 900 20px/24px var(--font-display); }
  .cp-sheet p { margin: 2px 0 10px; font-size: 11px; }
  .cp-sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; align-items: start; }
  .cp-sheet .tc-face { max-width: none; margin: 0; padding: 6px 8px 8px; border-width: 1.5px; background: #fff; color: #000; }
  .cp-sheet .tc-face::after { display: none; }
  .cp-sheet .tc-title { font-size: 14px; line-height: 17px; margin-top: 6px; }
  .cp-sheet .tc-lead, .cp-sheet .tc-facts dd, .cp-sheet .tc-list, .cp-sheet .tc-tip, .cp-sheet .tc-table table, .cp-sheet .tc-tag { font-size: 9.5px; line-height: 12.5px; }
  .cp-sheet .tc-facts dt, .cp-sheet .tc-foot, .cp-sheet .tc-bar, .cp-sheet .tc-sub { font-size: 8px; line-height: 11px; }
  .cp-sheet .tc-more, .cp-sheet .tc-credit, .cp-sheet .tc-open, .cp-sheet .tc-earn, .cp-sheet .tc-pics, .cp-sheet .tc-deeper, .cp-sheet .tc-zoom { display: none; }
  .cp-sheet .tc-tag, .cp-sheet .tc-tip { background: #fff; border-color: #999; }
  .cp-sheet .tc-pin { font-size: 7px; line-height: 8px; }
}

/* The way to an event's sheet from the home screen. */
.home-cards { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 14px; border-radius: var(--r-lg, 16px); border: var(--line) solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; min-height: var(--tap-min); }
.home-cards .hc-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-sm, 8px); background: color-mix(in srgb, var(--amber) 22%, transparent); color: var(--amber-ink); font-size: 18px; }
.home-cards .hc-text { display: grid; }
.home-cards .hc-text b { font-family: var(--font-display); font-weight: 700; font-size: 16px; line-height: 20px; }
.home-cards .hc-text small { font-size: 13px; line-height: 18px; color: var(--muted); }
.home-cards .hc-go { font-size: 22px; color: var(--muted); }
.home-cards:hover { border-color: var(--teal); }
.sum-cards { margin-top: var(--sp-lg, 16px); text-align: left; }
.sum-cards .overline { margin: 0 0 6px; color: var(--amber-ink); }
.card-sheet { text-align: left; }

/* Me: each event's sheet, with how much of it is held. */
.me-card-sets { list-style: none; margin: 0 0 var(--sp-md, 12px); padding: 0; display: grid; gap: 2px; }
.me-card-sets a { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: baseline; padding: 8px 2px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border); }
.me-card-sets a:hover span:first-child { text-decoration: underline; }
.me-card-sets .track { grid-column: 1 / -1; height: 6px; border-radius: var(--r-full, 9999px); background: var(--surface-2); overflow: hidden; }
.me-card-sets .track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--amber), var(--coral)); }
.cards-card .tc-row { margin-bottom: var(--sp-sm, 8px); }

/* A link drawn as a button (Me: "Open the cheat sheet"). */
a.cta { display: grid; place-items: center; text-decoration: none; }
