/* The learning section, over the landing page's palette.
 *
 * landing.css comes first and brings the tokens, the Vazirmatn face, the top
 * bar and the footer; this file is only what a page of prose and a tool need
 * on top of that. Nothing here redefines a colour: the section is part of the
 * site, not a second site inside it.
 *
 * Two borrowings from the music-toolkit pages this section grew out of — the
 * engraved look of a brass instrument panel: the accent used as a thin line
 * rather than a fill, and headings in a serif face. In Persian the serif is
 * Vazirmatn all the same (there is no Palatino for Persian worth having), so
 * the engraving is carried by letter-spacing and weight instead.
 */

:root {
  --brass: var(--accent);
  --brass-soft: rgba(255, 209, 102, 0.12);
}

body.learn { padding-bottom: 0; }

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---- the page's own head ---- */

.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 18px;
  color: var(--muted);
  font-size: 0.9rem;
}
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: var(--line); }
.crumbs [aria-current] { color: var(--text); }

.page-head {
  margin: clamp(18px, 3vw, 40px) 0 clamp(22px, 3.5vw, 40px);
  max-width: 68ch;
}

/* An article is a column of reading. The tool above it may use the whole
   width, but the words keep one measure and sit in the middle of the page —
   a page of prose pinned to one edge with a third of the screen blank beside
   it reads as a layout that went wrong. */
.article .crumbs,
.article .page-head,
.article .prose { margin-inline: auto; }
.article .crumbs { max-width: 68ch; }
.page-head h1 {
  margin: 0 0 10px;
  font-size: clamp(1.8rem, 4.5vw, 2.7rem);
  font-weight: 800;
  line-height: 1.35;
  text-wrap: balance;
}
.page-head > p {
  margin: 0;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.8;
}
.stamp {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 16px !important;
  color: var(--muted);
  font-size: 0.85rem !important;
}

.badge.tool {
  border: 1px solid var(--brass);
  background: var(--brass-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.78rem;
  font-weight: 700;
}

/* ---- the index ---- */

.shelf { margin-bottom: clamp(26px, 4vw, 46px); }
.shelf h2 {
  margin: 0 0 4px;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
}
.shelf-blurb {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.95rem;
}
.lessons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 14px;
}
.lesson {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 20px 18px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.2s, transform 0.2s;
}
.lesson:hover { border-color: var(--brass); transform: translateY(-2px); }
.lesson:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; }
.lesson h3 { margin: 0; font-size: 1.15rem; font-weight: 700; }
.lesson p { margin: 0; flex: 1; color: var(--muted); font-size: 0.93rem; line-height: 1.75; }
.lesson-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
}
.empty { color: var(--muted); }

/* ---- the prose ---- */

.prose {
  max-width: 68ch;
  margin: 0 0 clamp(24px, 4vw, 44px);
  font-size: 1.02rem;
  line-height: 2;
}
.prose h2 {
  margin: 34px 0 12px;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.5;
}
.prose h3 {
  margin: 24px 0 8px;
  font-size: 1.1rem;
  font-weight: 700;
}
.prose p { margin: 0 0 14px; color: #cfd6e4; }
.prose a { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.prose strong { color: var(--text); font-weight: 700; }
.prose ul, .prose ol { margin: 0 0 16px; padding-inline-start: 1.4em; color: #cfd6e4; }
.prose li { margin-bottom: 6px; }
.prose li::marker { color: var(--muted); }

/* A line worth stopping on: the rule a paragraph was building toward. */
.aside {
  margin: 22px 0;
  padding: 14px 18px;
  border-inline-start: 2px solid var(--brass);
  background: var(--brass-soft);
  border-radius: 0 10px 10px 0;
  color: var(--text);
}
.aside p { margin: 0; color: inherit; }

/* Music reads left to right whatever the page does — the keyboard under it
   is not mirrored, and neither is a scale. */
.ltr { direction: ltr; }

.table-wrap { overflow-x: auto; margin: 0 0 20px; }
table.keys {
  width: 100%;
  min-width: 460px;
  border-collapse: collapse;
  font-size: 0.95rem;
}
table.keys caption {
  caption-side: top;
  text-align: start;
  color: var(--muted);
  font-size: 0.88rem;
  padding-bottom: 8px;
}
table.keys th, table.keys td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-align: start;
}
table.keys thead th {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
table.keys tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
table.keys .sig { font-variant-numeric: tabular-nums; color: var(--accent); }

/* A drawing inside the prose: full width of the column, its caption under it
   in the muted voice the rest of the asides use. */
.figure {
  margin: 24px 0;
  padding: 18px 18px 10px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.figure svg { display: block; width: 100%; height: auto; }
.figure figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.8;
}

/* ---- the shared furniture of a tool ---- */

.tool-box {
  margin: 0 0 clamp(24px, 4vw, 44px);
}
/* landing.css owns .card too, where it is a song's link: it lifts and turns
   blue under the pointer. Here a card is a panel — it holds still. (The
   lesson cards on the index are links and do move; they are .lesson.) */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
body.learn .card { display: block; overflow: visible; transition: none; }
body.learn .card:hover { transform: none; border-color: var(--line); }
h2.sect {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}
.hint { margin: 0; color: var(--muted); font-size: 0.88rem; line-height: 1.9; }
/* A hint that follows the thing it explains. No style attribute in a content
   file can do this: the CSP allows no inline style, and blocks it silently
   enough that a margin simply goes missing. */
.hint.spaced { margin-top: 12px; }
.hint b { color: var(--text); font-weight: 700; }

.btn {
  border: 1px solid var(--line);
  background: var(--bg-raise);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 18px;
  font: 700 0.92rem/1 var(--font-ui);
  cursor: pointer;
}
.btn:hover { border-color: var(--brass); color: var(--accent); }
.btn:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.btn.brass { background: none; border-color: var(--brass); color: var(--accent); }
.btn.brass:hover { background: var(--brass-soft); }
.btn[aria-pressed="true"], .btn.on {
  background: var(--brass-soft);
  border-color: var(--brass);
  color: var(--accent);
}

.chipbtn {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  padding: 8px 10px;
  text-align: center;
  font: 600 1.02rem/1.2 var(--font-ui);
}
.chipbtn:hover { border-color: var(--brass); }
.chipbtn:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.chipbtn.on { border-color: var(--brass); color: var(--accent); background: var(--brass-soft); }

.note-chip {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 56px;
  padding: 7px 8px 6px;
  text-align: center;
}
.note-chip .n { font-size: 1.15rem; line-height: 1.2; }
.note-chip .d, .note-chip .iv {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}
.note-chip.root { border-color: var(--brass); background: var(--brass-soft); }

/* ---- a keyboard, and the chips that choose what lands on it ----
   Shared by every tool that spells notes: the chord explorer and the scale
   explorer draw the same three octaves, so the keys are described once. */

.roots {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}
.note-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.play-row { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; align-items: center; }

.kbd-box svg { display: block; width: 100%; height: auto; }
.wk { fill: #e8ecf4; stroke: #0d1017; stroke-width: 1; }
.bk { fill: #1b212e; stroke: #0d1017; stroke-width: 1; }
.wk.hl { fill: rgba(255, 209, 102, 0.45); stroke: var(--accent); }
.bk.hl { fill: #b9822a; stroke: var(--accent); }
.wk.rt, .bk.rt { fill: var(--accent); stroke: var(--accent); }

/* ---- the closing invitation ---- */

.cta-band {
  margin: clamp(30px, 5vw, 56px) 0 clamp(20px, 3vw, 30px);
  padding: clamp(22px, 3.5vw, 34px);
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: center;
}
.cta-band h2 { margin: 0 0 8px; font-size: 1.3rem; }
.cta-band p { margin: 0 auto 18px; max-width: 52ch; color: var(--muted); }
.cta-band .cta {
  display: inline-block;
  background: var(--accent);
  color: #14181f;
  font-weight: 700;
  padding: 10px 26px;
  border-radius: 999px;
}
.cta-band .cta:hover { filter: brightness(1.06); }

/* Two ways in, side by side, wrapping to two lines on a narrow screen rather
   than shrinking. The second is outlined instead of filled: both are real
   offers, but one of them is what most people came for, and two solid amber
   pills side by side would make the reader choose before reading either. */
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.cta-band .cta-quiet {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.cta-band .cta-quiet:hover { border-color: var(--accent); color: var(--accent); filter: none; }

@media (max-width: 560px) {
  .page-head h1 { line-height: 1.45; }
  .prose { font-size: 0.98rem; line-height: 1.95; }
}
