/* The printable lesson pages (lessons/, written by scripts/build-lessons.py from docs/defend/modules/).
   Source file, committed by hand: it is an INPUT to the generator, never an output, and the generator's input hash includes it.

   NO SCRIPT ANYWHERE ON THESE PAGES, so every control here is markup the browser already understands. The show-answers
   control is a <details>; the "print" instruction is words, because a print button would need a script and the school-mode
   policy for lessons/* is a bare 'self' script-src.

   PRINT FIRST. @page sets one margin and no size, so the person at the printer picks A4 or Letter and the same sheet fits both:
   the content is fluid, has no fixed width in millimetres, and wraps long words instead of overflowing (test/lessons-print
   measures scrollWidth at both widths). Each card starts a page; a card that is longer than a page flows onto the next one
   instead of being cut. A closed <details> is not printed, so the key never reaches a pupil's copy by accident; a teacher who
   opens it before printing gets it. */

:root {
  --ink: #F4F6F0; --dim: #B4BCA9; --bg: #080A07; --panel: #101510; --line: #2A3224;
  --gold: #C9A55C; --green: #8FC9A8; --warn: #E8B86A;
  --serif: "EB Garamond", Georgia, serif;
  --ui: "Jost", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1.125rem/1.55 var(--serif); overflow-wrap: anywhere; }
a { color: var(--green); }
a:focus-visible, summary:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.ls-wrap { max-width: 56rem; margin: 0 auto; padding: 1.2rem 1rem 4rem; }
.ls-top { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; align-items: center; justify-content: space-between;
  padding-bottom: .9rem; border-bottom: 1px solid var(--line); margin-bottom: 1.6rem; }
.ls-brand { font: 700 .8rem/1 var(--ui); letter-spacing: .22em; text-transform: uppercase; color: var(--gold); text-decoration: none; }
.ls-brand span { color: var(--ink); margin-left: .5rem; }
.ls-links { display: flex; flex-wrap: wrap; gap: .2rem 1.1rem; }
.ls-links a { font: 600 .74rem/1 var(--ui); letter-spacing: .14em; text-transform: uppercase; text-decoration: none; color: var(--dim);
  padding: .8rem 0; min-height: 44px; display: inline-flex; align-items: center; }
.ls-links a:hover { color: var(--ink); }
h1 { font: 800 clamp(1.8rem, 5vw, 2.8rem)/1.08 var(--ui); letter-spacing: -.02em; margin: 0 0 .4rem; }
h2 { font: 700 1.35rem/1.2 var(--ui); margin: 2rem 0 .6rem; }
h3 { font: 700 1.05rem/1.25 var(--ui); margin: 1.4rem 0 .4rem; color: var(--gold); }
p { margin: 0 0 .8rem; }
.ls-kicker { font: 600 .8rem/1.2 var(--ui); letter-spacing: .16em; text-transform: uppercase; color: var(--dim); margin: 0 0 1.2rem; }
.ls-lede { color: var(--dim); }
.ls-small { font-size: .95rem; color: var(--dim); }
.ls-note { font-size: .95rem; color: var(--dim); border-left: 3px solid var(--line); padding-left: .8rem; }
.ls-warn { border: 1px solid var(--warn); border-radius: .5rem; padding: .6rem .9rem; color: var(--warn); }
.ls-btn { display: inline-flex; align-items: center; min-height: 48px; padding: .5rem 1.1rem; border-radius: .5rem; border: 1px solid var(--gold);
  color: var(--ink); text-decoration: none; font: 600 .95rem/1.2 var(--ui); }
.ls-btn:hover { background: var(--panel); }
.ls-pages, .ls-list { list-style: none; padding: 0; margin: 0 0 1.2rem; }
.ls-pages li { display: flex; flex-wrap: wrap; gap: .4rem .9rem; align-items: center; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.ls-pages span { color: var(--dim); font-size: .95rem; }
.ls-lesson { padding: .6rem 0 1rem; border-bottom: 1px solid var(--line); }
.ls-lesson h2 { margin-top: .6rem; }
.ls-lesson a { padding: .3rem 0; }
.ls-status table, .ls-sheet table, .ls-key table, .ls-guide table { border-collapse: collapse; width: 100%; font-size: .98rem; }
.ls-status th { text-align: left; width: 11rem; font: 600 .8rem/1.3 var(--ui); color: var(--dim); }
th, td { text-align: left; vertical-align: top; padding: .45rem .5rem; border-bottom: 1px solid var(--line); }
thead th { font: 600 .8rem/1.3 var(--ui); color: var(--gold); }
.ls-tablewrap { overflow-x: auto; margin: 0 0 1rem; }
.ls-sheet, .ls-guide { margin-bottom: 1.2rem; }
.ls-card { border: 1px solid var(--line); border-radius: .6rem; padding: .6rem 1.1rem 1rem; margin: 0 0 1.4rem; background: var(--panel); }
.ls-card h2 { margin-top: .6rem; }
.ls-quote { border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: .4rem; padding: .5rem 1rem; margin: 0 0 1rem; background: var(--panel); }
.ls-quote p:last-child { margin-bottom: 0; }
.ls-key { border: 1px solid var(--gold); border-radius: .5rem; margin: 1.2rem 0; padding: 0 1rem; }
.ls-key > summary { cursor: pointer; font: 700 1rem/1.3 var(--ui); padding: .9rem 0; min-height: 44px; color: var(--gold); }
.ls-key[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: .8rem; }
.ls-items > li { margin-bottom: 1rem; }
.ls-opts { list-style-type: upper-alpha; }
.ls-fn { font: 600 .7rem/1 var(--ui); }
/* A footnote number is a 0.7rem link: a finger needs a larger target than the digit, so the anchor claims padding without moving the line. */
.ls-fn a { display: inline-block; min-width: 1.6rem; min-height: 1.6rem; line-height: 1.6rem; text-align: center; margin: -.4rem 0; }
.ls-skip { position: absolute; left: -999px; top: 0; background: var(--gold); color: #000; padding: .6rem 1rem; font: 700 1rem/1 var(--ui); z-index: 9; }
.ls-skip:focus { left: 0; }
.ls-tablewrap:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.ls-notes { margin-top: 2.4rem; border-top: 1px solid var(--line); }
.ls-notes li { font-size: .92rem; color: var(--dim); margin-bottom: .5rem; }
.ls-foot { margin-top: 2.4rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.ls-tm { font-size: .8rem; }

@media print {
  @page { margin: 14mm; }
  :root { --ink: #000; --dim: #222; --bg: #fff; --panel: #fff; --line: #888; --gold: #000; --green: #000; --warn: #000; }
  html, body { background: #fff !important; color: #000; }
  body { font: 400 11.5pt/1.45 var(--serif); }
  .ls-wrap { max-width: none; padding: 0; }
  .ls-noprint, .ls-top { display: none !important; }
  a { color: #000; text-decoration: none; }
  h1 { font-size: 20pt; }
  h2 { font-size: 14pt; break-after: avoid; }
  h3 { color: #000; break-after: avoid; }
  .ls-card { border: 1px solid #000; border-radius: 0; padding: 4mm 5mm; margin: 0; break-after: page; }
  .ls-card:last-of-type { break-after: auto; }
  .ls-sheet table, .ls-card { break-inside: auto; }
  tr, li { break-inside: avoid; }
  .ls-tablewrap { overflow: visible; }
  table { font-size: 10pt; }
  .ls-quote { border: 1px solid #000; border-left-width: 3px; }
  details.ls-key:not([open]) { display: none; }
  details.ls-key { border: 1px solid #000; }
  .ls-key > summary { color: #000; }
  .ls-notes { break-before: auto; }
  .ls-warn { border: 1px solid #000; }
}
