/* Lumejo cards: screen (phone first) and print (A4). Tokens from brand/lumejo/kit/lumejo-tokens.css. */
:root {
  --ink-soft: #5A5246;
  --rule: #DDD3BD;
  --card-pad: 18px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--lj-paper);
  color: var(--lj-ink);
  font: 400 var(--lj-size-text)/1.55 var(--lj-font-text);
}
a { color: inherit; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--lj-sun); outline-offset: 2px; }

/* ---------- chrome (preview page only) ---------- */
.chrome { max-width: 820px; margin: 0 auto; padding: 12px 16px 0; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.logo img { height: 40px; display: block; }
.chrome-note { margin: 0; font-size: var(--lj-size-label); color: var(--ink-soft); flex: 1 1 160px; }
.picker { font-size: var(--lj-size-label); font-weight: 600; display: flex; gap: 8px; align-items: center; flex: 1 1 100%; min-width: 0; }
.picker select { font: inherit; font-weight: 400; padding: 6px 8px; border: 2px solid var(--lj-ink); border-radius: 8px; background: #fff; min-width: 0; width: 100%; flex: 1 1 0; max-width: 420px; }
.tabs { padding-top: 14px; gap: 8px; }
.tabs button {
  font: 600 var(--lj-size-label)/1 var(--lj-font-text); color: var(--lj-ink);
  min-height: 44px; padding: 10px 16px; background: var(--lj-parchment);
  border: var(--lj-line); border-radius: var(--lj-edge); cursor: pointer;
  box-shadow: 2px 2px 0 var(--lj-ink);
}
.tabs button[aria-selected="true"] { background: var(--lj-sun); }
.tabs button:active { transform: translate(2px, 2px); box-shadow: none; }
.tabs .print { margin-left: auto; background: #fff; }
body.print-only .chrome { display: none; }

/* ---------- the card ---------- */
main { max-width: 820px; margin: 0 auto; padding: 14px 16px 48px; }
.card {
  background: var(--lj-parchment);
  border: var(--lj-line);
  border-radius: var(--lj-edge);
  padding: var(--card-pad);
  box-shadow: 4px 5px 0 rgb(28 23 18 / 0.85);
}
.card h1, .card h2, .card h3, .card p { margin: 0; }
.draft-banner {
  display: inline-block; margin-bottom: 10px; padding: 3px 12px;
  font-size: var(--lj-size-label); font-weight: 700;
  border: 2px dashed var(--lj-ink); border-radius: 999px; background: #fff;
}
.card-head { display: grid; gap: 2px; padding-bottom: 10px; border-bottom: 2px dashed var(--rule); margin-bottom: 12px; }
.eyebrow { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.card-title { font: italic 600 clamp(1.5rem, 5vw, 2.1rem)/1.12 var(--lj-font-title); text-wrap: balance; }
.card-kind { font-weight: 700; font-size: var(--lj-size-label); }
.card h2 { font: italic 600 1.3rem/1.2 var(--lj-font-title); margin: 0 0 6px; }
.card h3 { font-size: var(--lj-size-label); font-weight: 700; margin: 10px 0 4px; }
.card section { margin-top: 14px; }
.card ul, .card ol { margin: 0; padding-left: 1.2em; }
.card li + li { margin-top: 4px; }
.hint { color: var(--ink-soft); font-size: 0.85em; }
.cols { display: grid; gap: 0 22px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }

/* evidence marks: symbol and word, never colour alone */
.ev { display: inline-flex; gap: 3px; align-items: baseline; font-size: 0.72em; font-weight: 700; padding: 0 6px; margin-left: 2px; border: 1.5px solid var(--lj-ink); border-radius: 999px; white-space: nowrap; vertical-align: 1px; }
.ev-contested { background: var(--lj-sun); }
.ev-unverified { background: #fff; border-style: dashed; }
.ev-simplified, .ev-verified { background: transparent; }
.legend { margin-top: 8px; font-size: var(--lj-size-label); }

/* study card */
.hero { background: #fff; border: 2px solid var(--lj-ink); border-radius: 14px 18px 12px 20px / 18px 12px 20px 14px; padding: 12px 14px; display: grid; gap: 4px; margin-top: 0; }
.hero h2 { font-size: 1rem; font-family: var(--lj-font-text); font-style: normal; font-weight: 700; margin: 0; color: var(--ink-soft); }
.question { font: italic 600 1.35rem/1.25 var(--lj-font-title); margin-bottom: 6px !important; }
.big-idea { font-weight: 500; }
.terms dl { margin: 0; display: grid; gap: 8px; }
.term dt { font-weight: 700; }
.term dd { margin: 0; }
.example { display: block; color: var(--ink-soft); font-size: 0.9em; }
.caption { font-size: var(--lj-size-label); color: var(--ink-soft); margin-bottom: 4px !important; }
.timeline { list-style: none; padding: 0 0 0 14px !important; border-left: 2.5px solid var(--lj-ink); display: grid; gap: 4px; }
.timeline li { position: relative; display: grid; grid-template-columns: 7.2em 1fr; gap: 8px; margin: 0 !important; }
.timeline li::before { content: ""; position: absolute; left: -20px; top: 0.55em; width: 9px; height: 9px; border-radius: 50%; background: var(--lj-sun); border: 2px solid var(--lj-ink); }
.when { font: italic 600 1.05em/1.3 var(--lj-font-title); }
.places { list-style: none; padding: 0 !important; margin-top: 8px !important; display: grid; gap: 3px; }
.places .pin { color: var(--lj-vermilion); margin-right: 6px; font-size: 0.8em; }
.questions { display: grid; gap: 8px; }
.questions li { margin: 0 !important; }
.options { list-style: none; padding: 0 !important; display: flex; flex-wrap: wrap; gap: 2px 18px; font-size: 0.95em; }
.options li { margin: 0 !important; }
.box { display: inline-block; width: 0.85em; height: 0.85em; border: 1.5px solid var(--lj-ink); border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.lines { display: none; }
.further ul { list-style: none; padding: 0 !important; }
.unpublished { opacity: 0.6; }
.card-foot { margin-top: 16px; padding-top: 8px; border-top: 2px dashed var(--rule); display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.78rem; color: var(--ink-soft); }

/* teacher card */
.chapters { columns: 2 220px; padding-left: 0 !important; list-style: none; }
.chapters li { margin: 0 0 2px !important; break-inside: avoid; }
.chapters b { font-family: var(--lj-font-title); font-style: italic; margin-right: 4px; }
.card table { width: 100%; border-collapse: collapse; font-size: 0.92em; }
.card td { padding: 5px 6px; border-bottom: 1.5px solid var(--rule); vertical-align: top; }
.curriculum td:first-child { font-weight: 700; white-space: nowrap; }
.badge { display: inline-block; font-size: 0.78em; font-weight: 700; padding: 0 7px; border-radius: 999px; border: 1.5px dashed var(--lj-ink); white-space: nowrap; }
.badge-confirmed { border-style: solid; background: var(--lj-sun); }
.flow .when-col { width: 7.5em; }
.flow .phase { font-weight: 700; }
.flow .when-col .hint { display: block; }
.flow .note { display: block; color: var(--ink-soft); font-size: 0.92em; margin-top: 2px; }
.phase-activity, .phase-homework { background: rgb(255 216 74 / 0.18); }
.belief { font-weight: 700; }
.misconceptions li + li, .answers li + li { margin-top: 8px; }
.contested { border-left: 3px solid var(--lj-ink); padding-left: 10px; margin: 6px 0 10px; }
.sources { list-style: none; padding: 0 !important; }
.sid { font-weight: 700; margin-right: 4px; }
.tip { display: block; }
.look-for { font-size: 0.92em; }
.error { color: var(--lj-vermilion); font-weight: 700; }

@media (max-width: 520px) {
  :root { --card-pad: 14px; }
  .flow tr { display: grid; border-bottom: 1.5px solid var(--rule); }
  .flow .when-col { width: auto; padding-bottom: 0; }
  .flow td { border-bottom: 0; }
  .curriculum, .curriculum tbody { display: block; }
  .curriculum tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; border-bottom: 1.5px solid var(--rule); }
  .curriculum td { border-bottom: 0; }
  .curriculum td:nth-child(3) { grid-column: 1 / -1; grid-row: 2; padding-top: 0; }
}

/* ---------- print: A4. Study card 1 page, teacher card at most 2 ---------- */
@page { size: A4; margin: 9.5mm 11mm; }
@media print {
  body { background: #fff; font-size: 9.3pt; line-height: 1.34; }
  .chrome, .tabs { display: none !important; }
  main { max-width: none; padding: 0; }
  .card { background: #fff; border: 0; box-shadow: none; padding: 0; border-radius: 0; }
  .card a { text-decoration: none; }
  .card section { margin-top: 2.4mm; }
  .card h2 { font-size: 12pt; margin-bottom: 0.8mm; break-after: avoid; }
  .card h3 { margin: 1.5mm 0 0.5mm; break-after: avoid; }
  .card li + li { margin-top: 0.8mm; }
  .card-title { font-size: 18pt; }
  .card h3, .caption, .card-kind, .draft-banner, .legend { font-size: 0.9em; }
  .eyebrow { font-size: 0.78em; }
  .hero h2 { font-size: 0.95em; }
  .card-head { padding-bottom: 1.5mm; margin-bottom: 1.5mm; }
  .draft-banner { margin-bottom: 1mm; padding: 0 3mm; }
  .unpublished { display: none; }
  .ev, .badge-confirmed, .timeline li::before, .phase-activity, .phase-homework { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .card-foot { margin-top: 2.5mm; padding-top: 1.2mm; font-size: 7.3pt; }
  li, tr, .term, .contested { break-inside: avoid; }

  /* study card: one page */
  .hero { padding: 2mm 3mm; border-width: 1.5px; gap: 0.5mm; }
  .question { font-size: 13pt; margin-bottom: 1mm !important; }
  .study-card .cols { display: block; columns: 2; column-gap: 7mm; margin-top: 2.5mm; }
  .study-card .cols section { margin-top: 0; break-inside: avoid; }
  .study-card .cols section + section { margin-top: 2mm; }
  .terms dl { gap: 1.5mm; }
  .timeline { gap: 0.6mm; }
  .places { margin-top: 1.5mm !important; gap: 0.4mm; }
  .questions { gap: 1.8mm; }
  .lines { display: block; height: calc(var(--n) * 6mm); background: repeating-linear-gradient(to bottom, transparent 0 5.7mm, #9a9180 5.7mm 6mm); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .q-recall .lines { --n: 1; }
  .q-explain .lines, .q-apply .lines { --n: 1.5; }
  .q-think .lines { --n: 2; }
  .lines-1, .lines-2 { --n: 1; }

  /* teacher card: at most two pages */
  .teacher-card { font-size: 8.3pt; line-height: 1.28; }
  .teacher-card h2 { font-size: 11pt; }
  .chapters { columns: auto; display: flex; flex-wrap: wrap; gap: 0 4mm; }
  .chapters li { margin: 0 !important; }
  .card td { padding: 0.7mm 1.2mm; }
  .flow .when-col { width: 6.4em; }
  .teacher-card .misconceptions ul, .teacher-card .answers ol, .teacher-card .sensitivity ul, .teacher-card .sources, .teacher-card .simplified { columns: 2; column-gap: 6mm; }
  .teacher-card .misconceptions li + li, .teacher-card .answers li + li { margin-top: 1.5mm; }
  .teacher-card .contested { margin: 1mm 0 1.5mm; }
  .teacher-card .contested ul { columns: 2; column-gap: 6mm; }
  .sources li, .simplified li { font-size: 0.94em; }
  .answers .q-prompt { display: none; }
  .review h2 { display: inline; font-size: 9pt; margin-right: 2mm; }
  .review p { display: inline; }
  .fit-tight .study-card { font-size: 8.8pt; }
  .fit-tight .teacher-card { font-size: 7.9pt; line-height: 1.26; }
  .fit-nosources .key-sources { display: none; }
}
