/*
  noteadventure.com/guides/: the guides and cheat sheets (Sprint 4.15.9).

  Loaded AFTER site.css, which supplies the tokens, fonts, header and buttons. Same rules
  as the rest of the site: nothing from another origin, no inline style, every /assets/ URL
  carries ?v=4.15.9. Each guide is also published as a PDF printed from its page by
  scripts/build-guide-pdfs.mjs, so the @media print block at the bottom is the PDF's
  design, not an afterthought: re-run the script after changing either half.

  Contrast, measured (WCAG relative luminance) for the pairs this file adds:
    admin blue #2C4A7E on paper ......... 8.2:1   white on admin blue ........... 8.8:1
    white on purple #5B3B9A ............. 8.3:1   white on green #2F6B3A ........ 6.4:1
    white on brown #7A4A22 .............. 7.4:1   ink-soft on white ............. 8.2:1
    ink on the four tints (lilac, mint, peach, sky) ...... 12.6 to 13.5:1
    purple on lilac 6.4:1 · green on mint 5.3:1 · brown on peach 6.0:1 · blue on sky 7.1:1
    every accent on paper-2 #F3EAD8 ...... 5.3:1 (green, the lowest) and up
  Text never sits on a painting: the land bands are decorative strips with no copy on them.
*/

:root {
  --admin: #2C4A7E;
  --tint-lilac: #E8DFF6;
  --tint-mint: #DDEFE1;
  --tint-peach: #FBE3CF;
  --tint-sky: #DCE9F6;
  --tint-gold: #F7D98B;
}

/* Each guide names its audience on <body>; the accent follows it. */
.theme-parents { --accent: var(--green); --focus: var(--green); --tint: var(--tint-mint); }
.theme-students { --accent: var(--purple); --focus: var(--purple); --tint: var(--tint-lilac); }
.theme-teachers { --accent: var(--brown); --focus: var(--brown); --tint: var(--tint-peach); }
.theme-admins { --accent: var(--admin); --focus: var(--admin); --tint: var(--tint-sky); }
.theme-install { --accent: var(--purple); --focus: var(--purple); --tint: var(--tint-lilac); }
body.guide-page { background: var(--paper); }
.guide-page .site-header, .guide-hero, .guide-help, .guide-foot { --focus: var(--gold); }

/* ---------- Header: one way back to the list ---------- */

.header-guides { margin-left: auto; }
/* site.css tightens the header below 380px and lets it wrap, as on the homepage. */

/* ---------- Hero ---------- */

.guide-hero { background: var(--night); color: var(--on-night); }
.guide-hero-inner {
  display: grid; gap: 20px 40px; align-items: center;
  padding-block: clamp(28px, 5vw, 64px) clamp(28px, 4vw, 48px);
}
.guide-hero .crumbs { font-size: var(--text-small); color: var(--on-night-soft); }
.guide-hero .crumbs a { color: var(--on-night-soft); font-weight: 700; text-underline-offset: 0.2em; display: inline-flex; align-items: center; min-height: 44px; }
.guide-hero .crumbs a:hover { color: var(--on-night); }
.audience-tag {
  display: inline-block; margin-top: 4px; padding: 4px 12px; border-radius: 999px;
  background: var(--gold); color: var(--ink);
  font-weight: 700; font-size: 0.8125rem; letter-spacing: 0.1em; text-transform: uppercase;
}
.guide-hero h1 { margin-top: 14px; font-size: clamp(2.1rem, 1.5rem + 3vw, 3.6rem); }
.guide-hero h1 .tm { font-size: 0.45em; vertical-align: super; font-weight: 500; }
.guide-hero .lede { margin-top: 14px; color: var(--on-night-soft); max-width: 36em; }
.guide-actions { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; }
.guide-actions .btn-gold { border-color: var(--gold); box-shadow: 0 4px 0 #A9802A; }
.guide-meta { font-size: var(--text-small); color: var(--on-night-soft); }
.guide-hero-art { justify-self: center; width: min(54vw, 240px); }
.guide-hero-art img { filter: drop-shadow(0 18px 24px rgb(0 0 0 / 0.35)); }
@media (min-width: 820px) {
  .guide-hero-inner { grid-template-columns: minmax(0, 1fr) 260px; }
  .guide-hero-art { width: 260px; }
}

.guide-band { background: var(--night); }
.guide-band img { width: 100%; height: clamp(110px, 22vw, 260px); object-fit: cover; object-position: center; }

/* ---------- Body ---------- */

.guide-layout { display: grid; gap: 32px; padding-block: clamp(32px, 5vw, 64px) clamp(48px, 7vw, 96px); }
@media (min-width: 1000px) {
  .guide-layout.has-toc { grid-template-columns: 240px minmax(0, 1fr); gap: 56px; align-items: start; }
}
.guide-toc { font-size: var(--text-small); }
.guide-toc h2 { font-family: var(--font-body); font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.guide-toc ol { margin-top: 8px; border-left: 3px solid var(--line); }
.guide-toc a { display: flex; align-items: center; min-height: 40px; padding: 4px 0 4px 14px; color: var(--ink-soft); text-decoration: none; font-weight: 700; line-height: 1.3; }
.guide-toc a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 0.2em; }
@media (min-width: 1000px) { .guide-toc { position: sticky; top: 88px; } }

.guide-body { max-width: 760px; min-width: 0; }
.guide-body > section + section { margin-top: clamp(36px, 5vw, 56px); }
.guide-body h2 {
  font-size: clamp(1.55rem, 1.25rem + 1.3vw, 2.2rem);
  padding-top: 14px; border-top: 4px solid var(--accent);
}
.guide-body h3 { margin-top: 28px; color: var(--ink); }
.guide-body h4 { margin: 22px 0 0; font-family: var(--font-body); font-size: 1rem; font-weight: 700; }
.guide-body p, .guide-body ul, .guide-body ol, .guide-body dl, .guide-body table { margin-top: 12px; }
.guide-body p, .guide-body li, .guide-body dd { color: var(--ink-soft); }
.guide-body strong { color: var(--ink); }
.guide-body a { color: var(--accent); font-weight: 700; text-underline-offset: 0.2em; overflow-wrap: anywhere; }
.guide-body ul { list-style: disc; padding-left: 1.3em; }
.guide-body ol { list-style: decimal; padding-left: 1.5em; }
.guide-body li + li { margin-top: 6px; }
.guide-body li::marker { color: var(--accent); font-weight: 700; }
.guide-body .section-intro { font-size: var(--text-lede); line-height: 1.55; }

/* A word on screen, in the app or the portal: "tap **Settings**". A label stays on one line
   from 760px; below that it may wrap, because a path like "Settings → Administration →
   Studio details" is wider than a 320px phone's step card (it made the admin guide 470px
   wide), and with text spacing it is still too wide at 600px. */
.ui { font-weight: 700; color: var(--ink); }
@media (min-width: 760px) { .ui { white-space: nowrap; } }

/* Numbered steps: big numbers in the audience colour. */
.steps-list { list-style: none !important; padding-left: 0 !important; counter-reset: step; display: grid; gap: 12px; }
.steps-list > li {
  counter-increment: step; position: relative; margin: 0 !important;
  padding: 16px 18px 16px 70px; border-radius: var(--radius-small);
  background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-soft);
}
.steps-list > li::before {
  content: counter(step); position: absolute; left: 16px; top: 14px;
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: #fff;
  font-family: var(--font-display); font-weight: 600; font-size: 1.2rem;
}
.steps-list > li > strong:first-child { display: block; font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; color: var(--ink); }
.steps-list > li p { margin-top: 4px; }

/* Callouts: tip, note, important. The label is real text, not colour alone. */
.callout { margin-top: 18px; padding: 14px 18px; border-radius: var(--radius-small); background: var(--tint, var(--paper-2)); border-left: 6px solid var(--accent); }
.callout p { color: var(--ink); margin-top: 6px; }
.callout p:first-child { margin-top: 0; }
.callout-label { font-weight: 700; font-size: 0.8125rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.callout-important { background: var(--tint-gold); border-left-color: var(--ink); }
.callout-important .callout-label { color: var(--ink); }

/* "Where things live": a grid of small cards. */
.where-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); margin-top: 16px !important; }
.where-grid > div { padding: 14px 16px; border-radius: var(--radius-small); background: #fff; border: 1px solid var(--line); }
.where-grid dt { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; color: var(--accent); }
.where-grid dd { margin: 4px 0 0; }

/* The guide tables have two or three columns and stay real tables at every width (a table
   restyled as blocks loses its row and column semantics in some screen readers). Each sits
   in .table-scroll, a labeled region that scrolls sideways if a table is ever wider than
   the phone; at the widths measured (320px, with and without text spacing) none is. */
.table-scroll { margin-top: 12px; max-width: 100%; overflow-x: auto; }
.table-scroll > .guide-table { margin-top: 0; }
.guide-table { width: 100%; border-collapse: collapse; font-size: var(--text-small); background: #fff; border: 1px solid var(--line); border-radius: var(--radius-small); overflow: hidden; }
.guide-table th, .guide-table td { text-align: left; vertical-align: top; padding: 10px 12px; border-top: 1px solid var(--line); color: var(--ink-soft); }
.guide-table thead th { border-top: 0; background: var(--tint, var(--paper-2)); color: var(--ink); font-weight: 700; }
.guide-table tbody th { color: var(--ink); font-weight: 700; }
/* Measured at 320px: every table fits as it is. With WCAG 1.4.12 text spacing as well, one
   three-column table in the admin guide is about 40px too wide ("NoteAdventure" is its
   longest word), so it scrolls inside .table-scroll; Chromium and Firefox make a scrolling
   box a tab stop on their own, and it is not one while it fits. */
@media (max-width: 599px) {
  .guide-table th, .guide-table td { padding: 8px 6px; }
  .guide-table th:first-child, .guide-table td:first-child { padding-left: 10px; }
}

/* Small inline companion art beside a section. */
.guide-figure { float: right; width: 120px; margin: 0 0 10px 18px; }
@media (max-width: 479px) { .guide-figure { width: 88px; } }
.clear { clear: both; }

/* ---------- Help and related ---------- */

.guide-help { margin-top: clamp(40px, 6vw, 64px); padding: 22px 24px; border-radius: var(--radius); background: var(--night); color: var(--on-night); display: grid; gap: 8px 24px; align-items: center; }
.guide-help h2 { border: 0; padding: 0; color: var(--on-night); font-size: 1.5rem; }
.guide-help p { color: var(--on-night-soft); margin: 0; }
.guide-body .guide-help a, .guide-help a { color: var(--gold); }
.guide-body .guide-help strong { color: var(--on-night); }
@media (min-width: 700px) { .guide-help { grid-template-columns: 96px minmax(0, 1fr); } .guide-help img { grid-row: span 2; } }
.guide-help img { width: 96px; }

.guide-related { margin-top: 28px; }
.guide-related h2 { border: 0; padding: 0; font-size: 1.25rem; }
.guide-related ul { list-style: none; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.guide-related li { margin: 0 !important; }
.guide-related a { display: flex; align-items: center; min-height: 48px; padding: 8px 14px; border-radius: var(--radius-small); background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.guide-related a:hover { border-color: var(--accent); }
/* Decoration: the empty text after the slash keeps the arrow out of the link's name. */
.guide-related a::after { content: "\2192"; content: "\2192" / ""; margin-left: auto; padding-left: 10px; color: var(--accent); }

.print-only { display: none; }

/* ---------- Footer ---------- */

.guide-foot { background: #17112B; color: var(--on-night-soft); font-size: var(--text-small); }
.guide-foot .wrap { display: flex; flex-wrap: wrap; gap: 6px 24px; justify-content: space-between; align-items: center; padding-block: 22px 28px; }
.guide-foot a { color: var(--gold); font-weight: 700; display: inline-flex; align-items: center; min-height: 44px; text-underline-offset: 0.2em; }

/* ---------- The guides index ---------- */

.guides-index { padding-block: clamp(32px, 5vw, 64px) clamp(48px, 7vw, 96px); }
.audience-group + .audience-group { margin-top: clamp(36px, 5vw, 56px); }
.audience-group > h2 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.1rem); padding-top: 12px; border-top: 4px solid var(--accent); }
.audience-group > p { margin-top: 8px; color: var(--ink-soft); max-width: 40em; }
.guide-cards { margin-top: 18px; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.guide-card { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 4px 16px; align-items: start; padding: 18px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-soft); }
.guide-card img { grid-row: span 3; width: 76px; border-radius: 12px; background: var(--tint, var(--paper-2)); }
.guide-card h3 { font-size: 1.2rem; }
.guide-card h3 a { color: var(--ink); text-decoration: none; }
.guide-card h3 a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 0.2em; }
.guide-card p { color: var(--ink-soft); font-size: var(--text-small); }
.guide-card .card-links { display: flex; flex-wrap: wrap; gap: 0 16px; }
.guide-card .card-links a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; color: var(--accent); text-underline-offset: 0.2em; }

/* ---------- Cheat sheets: one screen, one printed page ---------- */

.sheet { padding-block: clamp(24px, 4vw, 48px) clamp(40px, 6vw, 72px); }
.sheet-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.sheet-step { position: relative; padding: 16px 16px 16px 66px; border-radius: var(--radius-small); color: var(--ink); }
.sheet-step:nth-child(4n+1) { background: var(--tint-gold); }
.sheet-step:nth-child(4n+2) { background: var(--tint-lilac); }
.sheet-step:nth-child(4n+3) { background: var(--tint-mint); }
.sheet-step:nth-child(4n+4) { background: var(--tint-sky); }
.sheet-step .n { position: absolute; left: 14px; top: 14px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: #fff; font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; }
.sheet-step h3 { font-size: 1.15rem; }
.sheet-step p { margin-top: 4px; color: var(--ink); font-size: var(--text-small); line-height: 1.5; }
.sheet-step a { color: var(--ink); font-weight: 700; overflow-wrap: anywhere; }
.sheet-why { margin-bottom: 16px; padding: 16px 20px; border-radius: var(--radius-small); background: var(--night); color: var(--on-night); }
.sheet-why h2 { font-size: 1.3rem; color: var(--gold); }
.sheet-why p { margin-top: 6px; color: var(--on-night-soft); }
.sheet-why strong { color: var(--on-night); }
.sheet-boxes { margin-top: 14px; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.sheet-box { padding: 14px 18px; border-radius: var(--radius-small); background: #fff; border: 2px solid var(--accent); }
.sheet-box h2 { font-size: 1.15rem; color: var(--accent); }
.sheet-box p, .sheet-box li { margin-top: 4px; color: var(--ink-soft); font-size: var(--text-small); }
.sheet-box ul { list-style: disc; padding-left: 1.2em; }
.sheet-box strong { color: var(--ink); }
.sheet-help { margin-top: 14px; padding: 12px 18px; border-radius: var(--radius-small); background: var(--tint-gold); color: var(--ink); text-align: center; }
.sheet-help a { color: var(--ink); font-weight: 700; }
.sheet-link { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; overflow-wrap: anywhere; }

/* ---------- Print: the PDFs ---------- */

@media print {
  @page { size: letter; margin: 0.5in 0.55in 0.55in; }
  :root {
    --text-body: 10.5pt; --text-small: 9.5pt; --text-lede: 12pt;
    --radius: 12px; --radius-small: 10px;
  }
  html { scroll-behavior: auto; }
  body, body.guide-page { font-size: var(--text-body); line-height: 1.45; background: #fff; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .skip-link, .site-header, .guide-toc, .guide-actions, .guide-related, .crumbs, .guide-foot { display: none !important; }
  .print-only { display: block; }
  .wrap { padding-inline: 0; max-width: none; }

  .guide-hero { border-radius: 14px; }
  .guide-hero-inner { grid-template-columns: minmax(0, 1fr) 150px; padding: 22px 26px; gap: 10px 24px; }
  .guide-hero h1 { font-size: 26pt; margin-top: 8px; }
  .guide-hero .lede { font-size: 12pt; margin-top: 8px; }
  .guide-hero-art { width: 150px; }
  /* No filter in print: Chromium prints a filtered image as an untagged raster, so the
     companion at the top of every PDF lost its Figure tag and its alt text. */
  .guide-hero-art img { filter: none; }
  .guide-band { background: none; margin-top: 8px; }
  .guide-band img { height: 1.2in; border-radius: 10px; }

  .guide-layout { display: block; padding: 18px 0 0; }
  .guide-body { max-width: none; }
  .guide-body > section + section { margin-top: 22px; }
  .guide-body h2 { font-size: 17pt; padding-top: 8px; border-top-width: 3px; break-after: avoid; }
  .guide-body h3 { font-size: 12.5pt; margin-top: 14px; break-after: avoid; }
  .guide-body h4 { break-after: avoid; }
  .guide-body a { color: var(--accent); text-decoration: none; }
  .guide-body .guide-help a { color: var(--gold); }
  /* Keep a lead-in sentence with the list it introduces, and short lists whole. */
  .guide-body p + .steps-list, .guide-body p + .where-grid, .guide-body h2 + .steps-list,
  .guide-body h3 + .steps-list, .guide-body p + ul, .guide-body p + ol, .guide-body p + .table-scroll { break-before: avoid; }
  .table-scroll { overflow: visible; }
  .ui { white-space: nowrap; } /* a letter page is ~710px wide, under the screen breakpoint */
  .steps-list { break-inside: avoid; }
  .where-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps-list > li, .callout, .where-grid > div, .guide-table tr, .guide-help, .sheet-step, .sheet-box, .guide-card { break-inside: avoid; box-shadow: none; }
  .steps-list > li { padding: 10px 12px 10px 54px; }
  .steps-list > li::before { width: 30px; height: 30px; font-size: 13pt; left: 12px; top: 10px; }
  .guide-help { margin-top: 22px; padding: 14px 18px; grid-template-columns: 64px minmax(0, 1fr); }
  .guide-help img { width: 64px; grid-row: span 2; }
  .guide-help h2 { font-size: 14pt; }
  .print-foot { margin-top: 18px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 8.5pt; color: var(--ink-soft); display: flex; justify-content: space-between; gap: 12px; }

  /* A cheat sheet must fit ONE page: the build script refuses a second. */
  .sheet { padding: 0; }
  .sheet-hero .guide-hero-inner { grid-template-columns: minmax(0, 1fr) 120px; padding: 16px 22px; }
  .sheet-hero h1 { font-size: 22pt; }
  .sheet-hero .lede { font-size: 11pt; }
  .sheet-hero .guide-hero-art { width: 120px; }
  .sheet-page { padding-top: 12px; }
  .sheet-why { padding: 10px 16px; margin-bottom: 10px; }
  .sheet-why h2 { font-size: 13pt; }
  .sheet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .sheet-step { padding: 10px 12px 10px 52px; }
  .sheet-step .n { width: 30px; height: 30px; font-size: 13pt; left: 12px; top: 10px; }
  .sheet-step h3 { font-size: 11.5pt; }
  .sheet-step p { font-size: 9.5pt; line-height: 1.4; }
  .sheet-boxes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 9px; }
  .sheet-box { padding: 9px 14px; }
  .sheet-box h2 { font-size: 11.5pt; }
  .sheet-box p, .sheet-box li { font-size: 9.5pt; line-height: 1.4; }
  .sheet-help { margin-top: 9px; padding: 8px 14px; font-size: 10pt; }
}
