/* Tangrams to print (/tangram/print/...): on the screen, the sheets as they will come out; on
   paper, only the kind chosen, a sheet to a page of A4. */
@font-face { font-family: "Lounge Sans"; src: url("./fonts/NotoSansJP-Medium.woff2") format("woff2"); font-weight: 100 600; font-display: swap; }
@font-face { font-family: "Lounge Sans"; src: url("./fonts/NotoSansJP-Bold.woff2") format("woff2"); font-weight: 700 900; font-display: swap; }
@font-face { font-family: "Lounge Round"; src: url("./fonts/MPLUSRounded1c-Black.woff2") format("woff2"); font-weight: 851 1000; font-display: swap; }
:root { --bg: #f6f5f2; --ink: #1e222a; --muted: #737a86; --accent: #ff8a5c; --accent-text: #e2582c; --shadow: 0 1px 2px rgb(22 28 45 / 0.06), 0 6px 18px rgb(22 28 45 / 0.07); }
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: radial-gradient(ellipse 70% 60% at 50% 30%, #fbfaf7 0%, var(--bg) 70%, #efede8 100%) fixed; font: 500 16px/1.75 "Lounge Sans", "Noto Sans JP", system-ui, sans-serif; word-break: auto-phrase; }
main { max-width: 900px; margin: 0 auto; padding: 24px 18px 60px; }
a { color: var(--accent-text); }
.crumbs { font-size: 13px; color: var(--muted); }
.crumbs a { color: inherit; }
h1, h2 { font-family: "Lounge Round", "M PLUS Rounded 1c", sans-serif; font-weight: 900; line-height: 1.35; }
h1 { font-size: clamp(24px, 4.5vw, 32px); margin: 12px 0 6px; }
h2 { font-size: 20px; margin: 28px 0 10px; }
.lead { margin: 0 0 14px; color: #4a505c; }
.note { color: var(--muted); font-size: 14px; }
.choose { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 10px; }
.choose button { min-height: 46px; padding: 0 18px; border: 0; border-radius: 14px; background: var(--accent); color: #fff; font: 900 15px "Lounge Round", sans-serif; box-shadow: 0 3px 0 #d0643e; cursor: pointer; }
.steps { display: grid; gap: 10px; margin: 0 0 10px; padding: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding: 12px 14px 12px 52px; border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
.steps li::before { content: counter(step); position: absolute; left: 14px; top: 13px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font: 900 14px "Lounge Round", sans-serif; }
.steps b { display: block; }
.list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.item { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 16px; background: #fff; box-shadow: var(--shadow); color: var(--ink); text-decoration: none; }
.item:hover { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
.item .peek { display: flex; gap: 6px; }
.item .peek svg { width: 46px; height: 46px; }
.item .peek path { fill: var(--ink); opacity: 0.75; }
.item b { font: 900 17px "Lounge Round", sans-serif; }
.item small { color: var(--muted); font-weight: 700; }
.chapters { display: flex; flex-wrap: wrap; gap: 8px; }
.chapters a, .chapters span { padding: 6px 12px; border-radius: 999px; background: #fff; box-shadow: var(--shadow); color: var(--ink); text-decoration: none; font-weight: 800; font-size: 14px; }
.chapters .on { background: var(--ink); color: #fff; }
.more { margin-top: 34px; }

/* A sheet: A4 in proportion on the screen, a page of A4 on paper. */
.sheet { display: flex; flex-direction: column; width: 100%; max-width: 640px; aspect-ratio: 210 / 297; margin: 0 auto 16px; padding: 4.5%; border-radius: 6px; background: #fff; box-shadow: var(--shadow); overflow: hidden; }
.sheet-title { display: flex; justify-content: space-between; gap: 12px; margin: 0 0 3%; font-size: 13px; }
.sheet-title b { font-family: "Lounge Round", sans-serif; font-weight: 900; font-size: 15px; }
.sheet-title .site { color: var(--muted); font-size: 10px; }
.four, .nine { flex: 1; display: grid; gap: 3%; min-height: 0; }
.four { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.nine { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); }
figure { display: flex; flex-direction: column; min-height: 0; margin: 0; padding: 3%; border: 1.5px solid #e6e2d8; border-radius: 10px; }
figcaption { display: flex; align-items: baseline; gap: 6px; font-weight: 800; font-size: 13px; }
figcaption .no { font: 900 11px "Lounge Round", sans-serif; color: var(--muted); }
figcaption .lv { margin-left: auto; color: #c58a00; font-size: 11px; }
figure svg { flex: 1; width: 100%; min-height: 0; }
figure path, .real-fig path { fill: #3a3e47; }
figure polygon { stroke: #fff; stroke-width: 0.06; stroke-linejoin: round; }
.rule { margin: 3% 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.real-fig { flex: 1; display: grid; place-items: center; min-height: 0; }
.real-fig svg { max-width: 100%; max-height: 100%; width: auto; height: auto; }
.sheet.real .real-fig svg { width: 80%; height: 80%; }
.cut { flex: 1; display: grid; place-items: center; gap: 4%; }
.cut svg { width: 62%; height: auto; }
.kind > .sheet ~ .sheet { display: none; }
.kind h2 { margin-top: 26px; }

@media print {
  @page { size: A4; margin: 10mm; }
  body { background: #fff; }
  main { max-width: none; padding: 0; }
  .crumbs, h1, .lead, .note, .choose, .steps, .list, .more, .chapters, .kind h2 { display: none !important; }
  /* Only the kind chosen; every sheet of it, one to a page. */
  .kind { display: none; }
  body[data-print="work"] .kind[data-kind="work"],
  body[data-print="real"] .kind[data-kind="real"],
  body[data-print="answers"] .kind[data-kind="answers"],
  body[data-print="colour"] .kind[data-kind="colour"],
  body[data-print="mono"] .kind[data-kind="mono"] { display: block; }
  /* Printed without a choice (the browser's own print button): the first kind. */
  body:not([data-print]) .kind:first-of-type { display: block; }
  .kind > .sheet ~ .sheet { display: flex; }
  .sheet { width: 190mm; height: 277mm; max-width: none; aspect-ratio: auto; margin: 0; padding: 0; border-radius: 0; box-shadow: none; break-after: page; overflow: visible; }
  .sheet:last-child { break-after: auto; }
  /* At the pieces' own size: the shadow as the millimetres say, shrunk only to fit the page. */
  .sheet.real .real-fig svg { width: var(--w); height: var(--h); max-width: 186mm; max-height: 250mm; }
  .cut svg { width: 82mm; height: 82mm; }
  figure { border-color: #ccc; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
