/* ==========================================================================
   Vibrato — engraved-sheet house style.
   Cream staff paper, hairline stave rules, rosin-red registration marks.
   Square corners everywhere: nothing on a music stand is rounded.
   ========================================================================== */

:root {
  /* Palette — named for the engraving bench, not for generic UI roles. */
  --staff-cream: #f7f3e8;
  --vellum: #efe8d8;
  --staff-line: #b8b0a0;
  --staff-line-faint: #d9d2c2;
  --ink-black: #1a1a1a;
  --graphite: #302c26;
  --ledger-grey: #6d6759;
  --rosin: #b02318;
  --rosin-deep: #7d170f;
  --paste-white: #fffdf6;

  /* Type */
  --face-engraved: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  --face-note: 'Liberation Mono', 'DejaVu Sans Mono', Consolas, 'Courier New', monospace;
  --face-body: 'Charter', 'Bitstream Charter', 'Iowan Old Style', Georgia, serif;

  /* Measure */
  --measure: 74rem;
  --reading: 44rem;
  --gutter: clamp(1rem, 3.5vw, 2.6rem);
  --rule: 1px;
  --stave-gap: 5px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--staff-cream);
  color: var(--ink-black);
  font-family: var(--face-body);
  font-size: 17.5px;
  line-height: 1.62;
  background-image:
    linear-gradient(180deg, rgba(176, 35, 24, 0.045) 0 6px, transparent 6px);
  background-repeat: no-repeat;
}

img, svg { max-width: 100%; height: auto; display: block; }

a { color: var(--rosin-deep); text-decoration: none; border-bottom: var(--rule) solid var(--staff-line); }
a:hover { color: var(--rosin); border-bottom-color: var(--rosin); }

h1, h2, h3, h4 {
  font-family: var(--face-engraved);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.18;
  margin: 0 0 0.5em;
}

h1 { font-size: clamp(2rem, 4.4vw, 3.1rem); }
h2 { font-size: clamp(1.4rem, 2.5vw, 1.95rem); }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1em; }

.mono, code, kbd { font-family: var(--face-note); font-size: 0.9em; }

/* --------------------------------------------------------------------------
   Stave rules — the five-line divider used instead of horizontal rules.
   -------------------------------------------------------------------------- */
.stave-rule {
  height: calc(var(--stave-gap) * 4 + 1px);
  background: repeating-linear-gradient(
    to bottom,
    var(--staff-line) 0 1px,
    transparent 1px var(--stave-gap)
  );
  border: 0;
  margin: 2.2rem 0;
}
.stave-rule--faint {
  background: repeating-linear-gradient(
    to bottom,
    var(--staff-line-faint) 0 1px,
    transparent 1px var(--stave-gap)
  );
}
.stave-rule--tight { margin: 1rem 0; }

/* Graduated double rule used to close a section, like a final barline. */
.barline-close {
  display: flex;
  gap: 6px;
  align-items: stretch;
  margin: 2.4rem 0;
}
.barline-close::before { content: ''; flex: 0 0 1px; background: var(--staff-line); }
.barline-close::after { content: ''; flex: 0 0 3px; background: var(--ink-black); }

/* --------------------------------------------------------------------------
   Shell
   -------------------------------------------------------------------------- */
.engrave-shell { min-height: 100vh; display: flex; flex-direction: column; }
.engrave-shell > main { flex: 1 0 auto; }

.plate {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Masthead ------------------------------------------------------------------ */
.masthead {
  border-bottom: var(--rule) solid var(--ink-black);
  background: var(--staff-cream);
}
.masthead__inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0.85rem var(--gutter);
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}
.masthead__clef {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 0 0 auto;
}
.masthead__clef i { display: block; width: 26px; height: 2px; background: var(--ink-black); }
.masthead__clef i:nth-child(even) { background: var(--rosin); }
.masthead__wordmark {
  font-family: var(--face-engraved);
  font-size: 1.5rem;
  letter-spacing: 0.01em;
  border: 0;
  color: var(--ink-black);
  margin-right: auto;
}
.masthead__wordmark small {
  display: block;
  font-family: var(--face-note);
  font-size: 0.58rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--rosin);
}
.masthead__nav { display: flex; gap: 1.1rem; flex-wrap: wrap; align-items: center; }
.masthead__nav a {
  border: 0;
  font-family: var(--face-note);
  font-size: 0.78rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--graphite);
  padding-bottom: 3px;
  border-bottom: 2px solid transparent;
}
.masthead__nav a[aria-current='page'],
.masthead__nav a:hover { color: var(--rosin); border-bottom-color: var(--rosin); }

/* Language toggle ----------------------------------------------------------- */
.lang-switch { display: inline-flex; border: var(--rule) solid var(--ink-black); }
.lang-switch a {
  border: 0;
  padding: 0.22rem 0.6rem;
  font-family: var(--face-note);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  color: var(--graphite);
}
.lang-switch a[aria-current='true'] { background: var(--ink-black); color: var(--staff-cream); }

/* --------------------------------------------------------------------------
   Hero — a title page, not a marketing banner
   -------------------------------------------------------------------------- */
.titleleaf {
  border-bottom: var(--rule) solid var(--ink-black);
  padding: clamp(2rem, 6vw, 4.2rem) 0 clamp(1.6rem, 4vw, 2.8rem);
  position: relative;
}
.titleleaf::after {
  content: '';
  position: absolute;
  right: var(--gutter);
  top: clamp(2rem, 6vw, 4.2rem);
  width: 10px;
  height: 10px;
  background: var(--rosin);
}
.titleleaf__eyebrow {
  font-family: var(--face-note);
  font-size: 0.76rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--rosin);
  margin: 0 0 0.9rem;
}
.titleleaf h1 { max-width: 30ch; margin-bottom: 0.6rem; }
.titleleaf__lede { max-width: 46ch; font-size: 1.1rem; color: var(--graphite); }

/* Ledger strip: the small stat band under titles */
.ledger-strip {
  display: flex;
  flex-wrap: wrap;
  border: var(--rule) solid var(--ink-black);
  border-top: 0;
  background: var(--paste-white);
}
.ledger-strip div {
  flex: 1 1 10rem;
  padding: 0.7rem 0.95rem;
  border-right: var(--rule) solid var(--staff-line);
}
.ledger-strip div:last-child { border-right: 0; }
.ledger-strip b {
  display: block;
  font-family: var(--face-note);
  font-size: 1.3rem;
  color: var(--ink-black);
}
.ledger-strip span {
  font-family: var(--face-note);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ledger-grey);
}

/* --------------------------------------------------------------------------
   Study path — the timeline. Vertical rail with ledger cards.
   -------------------------------------------------------------------------- */
.path-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin: 0 0 1.6rem;
}
.clef-tab {
  font-family: var(--face-note);
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.35rem 0.8rem;
  border: var(--rule) solid var(--ink-black);
  background: transparent;
  color: var(--graphite);
  cursor: pointer;
}
.clef-tab[aria-pressed='true'] { background: var(--ink-black); color: var(--staff-cream); }

/* HTMX request indicator (the panel is replaced in place, nothing else moves) */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-block; }

.path-rail { position: relative; padding-left: 2.4rem; }
.path-rail::before {
  content: '';
  position: absolute;
  left: 0.55rem;
  top: 0.4rem;
  bottom: 0.4rem;
  width: 0;
  border-left: 2px solid var(--staff-line);
}
.path-rail > h2 {
  font-family: var(--face-note);
  font-size: 0.8rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--rosin);
  margin: 2rem 0 1rem;
  position: relative;
}
.path-rail > h2:first-child { margin-top: 0; }
.path-rail > h2::before {
  content: '';
  position: absolute;
  left: -2.13rem;
  top: 0.28rem;
  width: 12px;
  height: 12px;
  background: var(--rosin);
}

.path-node { position: relative; margin: 0 0 1.1rem; }
.path-node::before {
  content: '';
  position: absolute;
  left: -1.93rem;
  top: 1.35rem;
  width: 11px;
  height: 11px;
  background: var(--staff-cream);
  border: 2px solid var(--ink-black);
}
.path-node--start::before { background: var(--ink-black); }

.path-card {
  border: var(--rule) solid var(--ink-black);
  background: var(--paste-white);
  padding: 0.95rem 1.1rem 1.05rem;
  border-left: 4px solid var(--ink-black);
}
.path-card__order {
  font-family: var(--face-note);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  color: var(--ledger-grey);
  margin: 0 0 0.35rem;
}
.path-card__order em { font-style: normal; color: var(--rosin); }
.path-card h3 { margin-bottom: 0.3rem; font-size: 1.22rem; }
.path-card h3 a { border: 0; color: var(--ink-black); }
.path-card h3 a:hover { color: var(--rosin); }
.path-card p { margin: 0 0 0.7rem; color: var(--graphite); font-size: 0.97rem; }

.tag-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag {
  font-family: var(--face-note);
  font-size: 0.67rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: var(--rule) solid var(--staff-line);
  padding: 0.12rem 0.45rem;
  color: var(--ledger-grey);
  background: var(--staff-cream);
}
.tag--rosin { border-color: var(--rosin); color: var(--rosin-deep); }
.tag--solid { background: var(--ink-black); color: var(--staff-cream); border-color: var(--ink-black); }

.prereq-note {
  font-family: var(--face-note);
  font-size: 0.72rem;
  color: var(--ledger-grey);
  margin: 0.6rem 0 0;
  padding-top: 0.5rem;
  border-top: var(--rule) dashed var(--staff-line);
}

/* --------------------------------------------------------------------------
   Lesson sheet — the article body
   -------------------------------------------------------------------------- */
.sheet-head { padding-top: clamp(1.6rem, 4vw, 2.6rem); }
.sheet-head__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.9rem;
  align-items: center;
  font-family: var(--face-note);
  font-size: 0.72rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ledger-grey);
  margin-bottom: 0.9rem;
}
.sheet-head h1 { max-width: 34ch; }
.sheet-head__intro {
  font-size: 1.12rem;
  color: var(--graphite);
  max-width: var(--reading);
  border-left: 3px solid var(--rosin);
  padding-left: 1rem;
}

.sheet-figure {
  border: var(--rule) solid var(--ink-black);
  background: var(--paste-white);
  padding: 0.6rem;
  margin: 1.6rem 0;
}
.sheet-figure figcaption {
  font-family: var(--face-note);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--ledger-grey);
  padding: 0.5rem 0.3rem 0.1rem;
  border-top: var(--rule) solid var(--staff-line-faint);
  margin-top: 0.5rem;
}

.prose { max-width: var(--reading); }
.prose h2 {
  margin-top: 2.4rem;
  padding-top: 0.9rem;
  border-top: var(--rule) solid var(--staff-line);
  position: relative;
}
.prose h2::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  width: 54px;
  height: 3px;
  background: var(--rosin);
}
.prose h3 { margin-top: 1.7rem; color: var(--graphite); }
.prose ul, .prose ol { padding-left: 1.2rem; margin: 0 0 1.1rem; }
.prose li { margin-bottom: 0.4rem; }
.prose strong { font-weight: 700; }

/* Notated example blocks: monospace tables of values */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0 1.6rem;
  font-size: 0.94rem;
}
.spec-table caption {
  text-align: left;
  font-family: var(--face-note);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ledger-grey);
  padding-bottom: 0.4rem;
}
.spec-table th, .spec-table td {
  border: var(--rule) solid var(--staff-line);
  padding: 0.45rem 0.6rem;
  text-align: left;
  vertical-align: top;
}
.spec-table th {
  background: var(--vellum);
  font-family: var(--face-note);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.spec-table td.note { font-family: var(--face-note); }

/* Take-away card and drill block */
.take-note {
  border: 2px solid var(--ink-black);
  background: var(--paste-white);
  padding: 1.1rem 1.2rem;
  margin: 2rem 0;
  position: relative;
}
.take-note::before {
  content: 'KEY';
  position: absolute;
  top: -0.7rem;
  left: 1rem;
  background: var(--rosin);
  color: var(--paste-white);
  font-family: var(--face-note);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  padding: 0.1rem 0.45rem;
}
.take-note h2 { font-size: 1.05rem; margin-bottom: 0.4rem; border: 0; padding: 0; }
.take-note h2::before { display: none; }
.take-note p { margin: 0; font-size: 1.02rem; }

.drill-block {
  border: var(--rule) solid var(--ink-black);
  border-left: 6px solid var(--rosin);
  background: var(--vellum);
  padding: 1rem 1.2rem;
  margin: 2rem 0;
}
.drill-block h2 { font-size: 1rem; margin-bottom: 0.35rem; border: 0; padding: 0; }
.drill-block h2::before { display: none; }
.drill-block p { margin: 0; }

/* Previous / next along the path */
.step-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: var(--rule) solid var(--ink-black);
  margin: 2.6rem 0 1rem;
}
.step-nav a {
  padding: 0.9rem 1.1rem;
  border: 0;
  background: var(--paste-white);
  color: var(--ink-black);
}
.step-nav a + a { border-left: var(--rule) solid var(--staff-line); text-align: right; }
.step-nav a:hover { background: var(--vellum); color: var(--rosin-deep); }
.step-nav span {
  display: block;
  font-family: var(--face-note);
  font-size: 0.66rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ledger-grey);
  margin-bottom: 0.2rem;
}
.step-nav b { font-family: var(--face-engraved); font-weight: 600; font-size: 1.02rem; }
.step-nav i { display: block; font-style: normal; color: var(--ledger-grey); font-family: var(--face-note); font-size: 0.7rem; padding: 0.9rem 1.1rem; }

/* --------------------------------------------------------------------------
   Catalog tables (lesson index, chord index)
   -------------------------------------------------------------------------- */
.catalog { width: 100%; border-collapse: collapse; }
.catalog th, .catalog td { border-bottom: var(--rule) solid var(--staff-line); padding: 0.7rem 0.5rem; text-align: left; }
.catalog th {
  font-family: var(--face-note);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ledger-grey);
  border-bottom: 2px solid var(--ink-black);
}
.catalog td.num { font-family: var(--face-note); text-align: right; white-space: nowrap; }
.catalog tr.is-locked td { color: var(--ledger-grey); }
.catalog td a { border-bottom-color: transparent; }
.catalog td a:hover { border-bottom-color: var(--rosin); }

/* Chord library cards */
.chord-rack {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1.1rem;
  margin: 1.6rem 0;
}
.chord-slip {
  border: var(--rule) solid var(--ink-black);
  background: var(--paste-white);
  padding: 0.9rem;
}
.chord-slip h3 { font-family: var(--face-note); font-size: 1.15rem; margin-bottom: 0.25rem; }
.chord-slip p { font-size: 0.92rem; color: var(--graphite); margin: 0 0 0.6rem; }
.chord-slip .interval-ruler {
  font-family: var(--face-note);
  font-size: 0.74rem;
  color: var(--rosin-deep);
  letter-spacing: 0.04em;
  border-top: var(--rule) dashed var(--staff-line);
  padding-top: 0.4rem;
}

/* Chord detail */
.voicing-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 1.4rem;
  align-items: start;
  margin: 1.6rem 0;
}
@media (max-width: 46rem) { .voicing-panel { grid-template-columns: 1fr; } }

.spec-list { margin: 0; border-top: var(--rule) solid var(--ink-black); }
.spec-list dt {
  font-family: var(--face-note);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ledger-grey);
  margin-top: 0.85rem;
}
.spec-list dd { margin: 0.15rem 0 0; padding-bottom: 0.6rem; border-bottom: var(--rule) solid var(--staff-line-faint); }

/* --------------------------------------------------------------------------
   Legal / static pages
   -------------------------------------------------------------------------- */
.document { max-width: var(--reading); }
.document h2 { margin-top: 2.2rem; font-size: 1.3rem; }
.document .stamp {
  font-family: var(--face-note);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rosin);
  margin-bottom: 1.4rem;
}
.notice {
  border: var(--rule) solid var(--rosin);
  background: #fdf4f2;
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
  margin: 1.4rem 0;
}

/* Colophon ------------------------------------------------------------------ */
.colophon {
  border-top: var(--rule) solid var(--ink-black);
  margin-top: 3.5rem;
  padding: 1.8rem 0 2.4rem;
  background: var(--vellum);
  font-size: 0.92rem;
}
.colophon__grid {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1.4rem;
}
.colophon h2 {
  font-family: var(--face-note);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ledger-grey);
  margin-bottom: 0.5rem;
}
.colophon ul { list-style: none; margin: 0; padding: 0; }
.colophon li { margin-bottom: 0.35rem; }
.colophon__fine {
  max-width: var(--measure);
  margin: 1.6rem auto 0;
  padding: 1rem var(--gutter) 0;
  border-top: var(--rule) solid var(--staff-line);
  font-size: 0.84rem;
  color: var(--ledger-grey);
}

/* Accessibility helpers ------------------------------------------------------ */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--ink-black);
  color: var(--staff-cream); padding: 0.6rem 1rem; z-index: 40; border: 0;
}
.skip-link:focus { left: 0; }

/* Mobile -------------------------------------------------------------------- */
@media (max-width: 40rem) {
  body { font-size: 16.5px; }
  .path-rail { padding-left: 1.7rem; }
  .path-node::before { left: -1.5rem; }
  .path-rail > h2::before { left: -1.65rem; }
  .step-nav { grid-template-columns: 1fr; }
  .step-nav a + a { border-left: 0; border-top: var(--rule) solid var(--staff-line); text-align: left; }
  .catalog th:nth-child(3), .catalog td:nth-child(3) { display: none; }
}
