/* ============================================================
   CarolTutor — the songbook.

   One idea: an old Christmas songbook, opened on a winter evening. Evergreen
   cloth, cream paper, cranberry, and a little gold. Ornament is line-engraved
   holly and nothing louder.

   The first section is what the music engine needs in order to draw and play
   at all (carried over from HymnTutor's styles.css). Everything after the
   line marked "page" is CarolTutor's own.
   ============================================================ */

/* ---- faces the engine sets the music and words in ---- */
@font-face {
  font-family: 'Noto Music';
  src: url('/engine/fonts/NotoMusic-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: 'EB Garamond';
  src: url('/engine/fonts/EBGaramond-normal.woff2') format('woff2');
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'EB Garamond';
  src: url('/engine/fonts/EBGaramond-italic.woff2') format('woff2');
  font-weight: 400 800;
  font-style: italic;
  font-display: swap;
}
/* Noto Serif, condensed: the words under the staff on a printed page
   (PRINT_FACE in practice.js), used only by Print. */
@font-face {
  font-family: 'Noto Serif';
  src: url('/engine/fonts/NotoSerif-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62.5% 100%;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: 'Noto Serif';
  src: url('/engine/fonts/NotoSerif-italic.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62.5% 100%;
  font-style: italic;
  font-display: block;
}
@font-face {
  font-family: 'Source Sans 3';
  src: url('/engine/fonts/SourceSans3-normal.woff2') format('woff2');
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --evergreen-night: #0e241b;
  --evergreen-deep: #153527;
  --evergreen: #1f4a36;
  --evergreen-soft: #3d6f57;
  --cranberry: #8a1f2d;
  --cranberry-deep: #6a1622;
  --gold: #b08a34;
  --gold-bright: #dcbf73;
  --gold-pale: #ecdcae;
  --paper: #fbf5e6;
  --paper-deep: #f3e9d0;
  --ink: #2a241c;
  --ink-soft: #6b5f4c;
  --line: #e2d5b5;
  --danger: #a02020;
  --serif: "EB Garamond", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", "Segoe UI", system-ui, sans-serif;

  /* The four parts. notation.js reads these names off :root, so the engine
     draws in CarolTutor's colors without a line of it being changed. Each has
     to read as a note on cream paper, so the gold is the deep end of gold. */
  --voice-soprano: #a47a17;
  --voice-alto: #8a1f2d;
  --voice-tenor: #2b7350;
  --voice-bass: #2f5c8c;
  /* The note under the pointer. None of the four above, or hovering that
     part's notes would change nothing. */
  --note-hover: #7a3f9c;
}

/* ---- what the drawn music needs (from HymnTutor's styles.css) ---- */
.hymn-system { display: block; margin: 2px 0; }
.note-hit { cursor: pointer; }
.note-hit:hover .notehead { fill: var(--note-hover); }
.note-hit:hover .stem, .note-hit:hover .noteflag { stroke: var(--note-hover); }
.note-playing .notehead { fill: var(--gold) !important; }
.note-playing.note-voice-s .notehead { fill: var(--voice-soprano) !important; }
.note-playing.note-voice-a .notehead { fill: var(--voice-alto) !important; }
.note-playing.note-voice-t .notehead { fill: var(--voice-tenor) !important; }
.note-playing.note-voice-b .notehead { fill: var(--voice-bass) !important; }
.col-band { fill: transparent; cursor: pointer; transition: fill 0.12s ease; }
.col-band:hover { fill: rgba(176, 138, 52, 0.14); }
.col-band.active { fill: rgba(176, 138, 52, 0.24); }
.col-band.col-selected { fill: rgba(176, 138, 52, 0.12); stroke: var(--gold); stroke-width: 1; }
.lyric, .lyric-hyphen, .measure-no { pointer-events: none; user-select: none; }

/* ============================ page ============================ */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.55;
  /* Evergreen cloth: darker toward the edges, as a book is in lamplight. */
  background:
    radial-gradient(ellipse 120% 80% at 50% 0%, rgba(61, 111, 87, 0.35), transparent 60%),
    linear-gradient(180deg, var(--evergreen-deep), var(--evergreen-night));
  background-attachment: fixed;
}
/* The weave of the cloth. A fine grain, fixed behind everything. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.55 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
}
a { color: var(--evergreen); text-decoration-color: rgba(31, 74, 54, 0.35); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 3px; border-radius: 3px; }
[hidden] { display: none !important; }

/* ---------------- header and footer, on the cloth ---------------- */

.site-header {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto 14px;
  padding: 16px 22px 13px;
}
/* A gold hairline under the header, fading at both ends. */
.site-header::after {
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(176, 138, 52, 0.7) 18%, rgba(176, 138, 52, 0.7) 82%, transparent);
}
.header-right { display: flex; align-items: center; gap: 22px; }
.brand {
  font-size: 27px;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-decoration: none;
  color: var(--gold-bright);
  background: linear-gradient(180deg, #f3e2ad, #cfae5c);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-accent { font-style: italic; color: var(--gold-pale); }
/* Two gold pills with a panel under each: the pages of the site (Menu)
   and the instrument, chosen once for the whole site. */
.inst, .menu { position: relative; }
.inst-btn, .pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-size: 16px;
  cursor: pointer;
  color: var(--gold-pale);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(176, 138, 52, 0.6);
  border-radius: 999px;
  padding: 5px 13px 5px 11px;
}
.inst-btn:hover, .inst-btn[aria-expanded="true"],
.pill-btn:hover, .pill-btn[aria-expanded="true"] { background: rgba(255, 255, 255, 0.09); border-color: var(--gold-bright); }
.inst-note { color: var(--gold-bright); font-size: 17px; line-height: 1; }
.chev {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: -3px 0 0 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}
[aria-expanded="true"] > .chev { transform: rotate(-135deg); margin-top: 3px; }
.inst-panel, .pill-panel {
  position: absolute;
  z-index: 10;
  right: 0;
  top: calc(100% + 8px);
  min-width: 150px;
  padding: 6px;
  background: var(--paper);
  border: 1px solid var(--gold);
  border-radius: 4px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
}
.inst-panel button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  font: inherit;
  font-size: 18px;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  background: none;
  border: 0;
  border-radius: 3px;
  padding: 7px 10px;
}
.inst-panel button::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--gold); flex: none; }
.inst-panel button[aria-checked="true"]::before { background: var(--cranberry); border-color: var(--cranberry-deep); }
.inst-panel button:hover { background: var(--paper-deep); }
.menu-panel { min-width: 200px; }
.menu-panel a {
  display: block;
  font-size: 18px;
  color: var(--ink);
  text-decoration: none;
  border-radius: 3px;
  padding: 7px 12px;
  white-space: nowrap;
}
.menu-panel a:hover { background: var(--paper-deep); }
.menu-panel a[aria-current="page"] { color: var(--cranberry); font-weight: 600; }

/* The printed book: its cover, and the steps. */
.booklet { display: block; width: 220px; max-width: 70%; height: auto; margin: 4px auto 22px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.25); }
.book-facts { text-align: center; font-style: italic; color: var(--ink-soft); }
.book-facts:empty { display: none; }
.steps { margin: 0 0 12px; padding-left: 1.3em; }
.steps li { margin-bottom: 6px; }

.app-main { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: 8px 16px 40px; }
.loading { color: var(--gold-pale); font-style: italic; text-align: center; padding: 60px 0; }

/* ---------------- holly, and the rule it sits on ---------------- */

.holly { display: block; }
.holly { overflow: visible; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.22)); }
.holly .leaf { fill: url(#leaf-paint); stroke: var(--holly-edge, #123324); stroke-width: 1.1; stroke-linejoin: round; }
.holly .vein { fill: none; stroke: rgba(236, 226, 190, 0.5); stroke-width: 0.9; stroke-linecap: round; }
.holly .berry { fill: url(#berry-paint); stroke: #5c0f1a; stroke-width: 0.8; }
.holly .glint { fill: rgba(255, 255, 255, 0.7); }

/* The four corner pieces of a printed border. */
.corner { position: absolute; width: 26px; height: 26px; pointer-events: none; }
.corner path { fill: none; stroke: var(--corner, var(--gold)); stroke-width: 1; }
.corner circle { fill: var(--corner, var(--gold)); }
.corner.tl { top: var(--corner-in); left: var(--corner-in); }
.corner.tr { top: var(--corner-in); right: var(--corner-in); transform: scaleX(-1); }
.corner.bl { bottom: var(--corner-in); left: var(--corner-in); transform: scaleY(-1); }
.corner.br { bottom: var(--corner-in); right: var(--corner-in); transform: scale(-1); }

.rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 10px auto 22px;
  max-width: 420px;
}
.rule::before, .rule::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold) 70%);
}
.rule::after { transform: scaleX(-1); }
.rule .holly { width: 54px; height: auto; flex: none; }

/* ---------------- the cover ---------------- */

.cover {
  position: relative;
  min-height: min(76vh, 720px);
  display: grid;
  place-items: center;
  padding: 18px 0 8px;
}
/* Lamplight: a warm glow behind the plate, as from a candle out of frame. */
.cover::before {
  content: "";
  position: absolute;
  inset: -40px 0 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 46% 40% at 50% 44%, rgba(226, 180, 96, 0.17), transparent 70%),
    radial-gradient(ellipse 30% 26% at 14% 88%, rgba(226, 160, 80, 0.08), transparent 70%),
    radial-gradient(ellipse 30% 26% at 88% 12%, rgba(226, 160, 80, 0.07), transparent 70%);
}
.snow { position: absolute; inset: -80px -16px 0; width: calc(100% + 32px); height: calc(100% + 80px); pointer-events: none; }
.plate {
  position: relative;
  width: 100%;
  max-width: 680px;
  text-align: center;
  padding: 52px 30px 48px;
  color: var(--gold-pale);
  --corner: var(--gold-bright);
  --corner-in: 9px;
  border: 1px solid var(--gold);
  /* A second, fainter rule outside the first: the double line a binder
     stamps into a cloth cover. */
  outline: 1px solid rgba(176, 138, 52, 0.45);
  outline-offset: 7px;
  background:
    radial-gradient(ellipse 80% 60% at 50% 30%, rgba(61, 111, 87, 0.28), transparent 70%),
    rgba(12, 32, 24, 0.72);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4), inset 0 0 60px rgba(0, 0, 0, 0.25);
  --holly-edge: #0e2a1e;
}
.plate .holly { width: 190px; height: auto; margin: 0 auto 20px; }
/* "A songbook of", with a short gold line to either side. */
.plate-over span { display: inline-flex; align-items: center; gap: 14px; }
.plate-over span::before, .plate-over span::after { content: ""; width: 34px; height: 1px; background: var(--gold); }
.plate-over, .plate-under {
  font-size: 15px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold-bright);
  margin: 0;
}
.plate h1 {
  font-size: clamp(44px, 9.5vw, 84px);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: 0.01em;
  margin: 12px 0 18px;
  /* Gold leaf: pale where the lamp catches it, deeper toward the foot. */
  color: #f1e2b4;
  background: linear-gradient(180deg, #fbf3d6 10%, #ecd79b 55%, #c9a652 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}
.plate h1 em { display: block; font-size: 0.56em; font-style: italic; font-weight: 400; margin-bottom: 4px; }
.plate-rule { width: 150px; height: 1px; margin: 0 auto 32px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }

.btn-gold {
  display: inline-block;
  font: inherit;
  font-size: 17px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  padding: 13px 30px;
  border-radius: 2px;
  border: 1px solid var(--gold-bright);
  background: linear-gradient(180deg, #e2c77e, #c19d47);
  color: #23301f;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-gold:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.36); }
.plate-under { margin-top: 28px; font-size: 13px; color: rgba(220, 191, 115, 0.8); }

/* ---------------- a leaf of the book ---------------- */

.leaf {
  position: relative;
  --corner-in: 15px;
  /* Laid paper: a faint tooth, lighter where the lamp falls, a little
     foxed toward the edges. */
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45  0 0 0 0 0.36  0 0 0 0 0.2  0 0 0 0.09 0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23p)'/%3E%3C/svg%3E"),
    radial-gradient(ellipse 90% 60% at 50% 0%, rgba(255, 255, 255, 0.6), transparent 60%),
    radial-gradient(ellipse 120% 100% at 50% 50%, transparent 62%, rgba(176, 138, 52, 0.13)),
    var(--paper);
  border-radius: 3px;
  padding: 44px 48px 44px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset, 0 28px 80px rgba(0, 0, 0, 0.45);
}
/* The printed border, a hair inside the trimmed edge. */
.leaf::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(176, 138, 52, 0.55);
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px rgba(176, 138, 52, 0.28);
  border-radius: 2px;
  pointer-events: none;
}
.leaf-narrow { max-width: 760px; margin: 0 auto; }
.leaf h1 {
  text-align: center;
  font-size: clamp(30px, 5vw, 44px);
  font-weight: 500;
  line-height: 1.15;
  margin: 4px 0 0;
  color: var(--evergreen-deep);
}
.kicker {
  text-align: center;
  font-size: 13.5px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--cranberry);
  margin: 0 0 6px;
}
.lede { text-align: center; font-style: italic; color: var(--ink-soft); margin: 0 auto 24px; max-width: 520px; }
.back { display: inline-block; font-size: 15px; letter-spacing: 0.12em; text-transform: uppercase; text-decoration: none; color: var(--ink-soft); }
.back:hover { color: var(--cranberry); }

/* ---------------- the contents page ---------------- */

.find {
  display: block;
  width: 100%;
  max-width: 460px;
  margin: 0 auto 26px;
  font: inherit;
  font-style: italic;
  text-align: center;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--gold);
  border-radius: 0;
  padding: 8px 6px;
}
.find::placeholder { color: var(--ink-soft); opacity: 0.8; }
.find:focus { outline: none; border-bottom: 2px solid var(--cranberry); padding-bottom: 7px; }

.contents { list-style: none; margin: 0; padding: 0; }
.contents li + li { border-top: 1px solid var(--line); }
.entry {
  display: grid;
  grid-template-columns: 3.4em 1fr auto;
  align-items: baseline;
  column-gap: 10px;
  padding: 13px 8px 12px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}
.entry:hover { background: linear-gradient(90deg, transparent, rgba(243, 233, 208, 0.9) 12%, rgba(243, 233, 208, 0.9) 88%, transparent); }
.entry-no { text-align: right; font-size: 15px; letter-spacing: 0.08em; color: var(--gold); font-variant-numeric: oldstyle-nums; }
.entry-title { font-size: 23px; line-height: 1.25; color: var(--evergreen-deep); }
.entry:hover .entry-title { color: var(--cranberry); }
.entry-line { display: block; font-size: 17.5px; font-style: italic; color: var(--ink-soft); }
.entry-by { font-size: 15px; color: var(--ink-soft); text-align: right; max-width: 15em; }
.entry-key {
  display: inline-block;
  margin-left: 10px;
  font-size: 11.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cranberry);
  border: 1px solid rgba(138, 31, 45, 0.4);
  padding: 1px 7px 0;
  border-radius: 2px;
  vertical-align: 3px;
}
.none { text-align: center; font-style: italic; color: var(--ink-soft); padding: 24px 0 8px; }

/* ---------------- a carol ---------------- */

.carol-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.carol-first { text-align: center; font-style: italic; color: var(--ink-soft); margin: 6px 0 0; }

.controls { margin: 0 0 20px; font-family: var(--sans); font-size: 15px; color: var(--ink); }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 16px;
}
.controls-label { font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft); }

.play-btn {
  font: inherit;
  font-weight: 600;
  font-size: 16px;
  min-width: 108px;
  cursor: pointer;
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid var(--cranberry-deep);
  background: linear-gradient(180deg, #a52c3c, var(--cranberry) 60%, #7a1a27);
  color: #fff7e6;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 3px 8px rgba(106, 22, 34, 0.35);
}
.play-btn:hover { background: linear-gradient(180deg, #b03344, #93232f 60%, #7f1c29); }
.play-btn .glyph { display: inline-block; width: 1.1em; }

.parts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.part-chip {
  display: inline-block;
  font: inherit;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--part-color);
  background: #fffdf6;
  color: var(--part-color);
  transition: background 0.12s ease, color 0.12s ease, opacity 0.12s ease;
}
.part-chip small { font-weight: 400; font-size: 12.5px; margin-left: 5px; }
.part-chip.loud { background: var(--part-color); color: #fffaf0; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18); }
.part-chip.mute { border-style: dashed; opacity: 0.6; }
.part-chip.sample { cursor: default; white-space: nowrap; }

.tools-btn {
  font: inherit;
  cursor: pointer;
  color: var(--evergreen-deep);
  background: transparent;
  border: 1px solid rgba(176, 138, 52, 0.75);
  border-radius: 999px;
  padding: 8px 15px;
}
.tools-btn:hover, .tools-btn[aria-expanded="true"] { background: var(--paper-deep); }
.tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 18px;
  max-width: 640px;
  margin: 14px auto 0;
  padding: 12px 16px;
  background: rgba(243, 233, 208, 0.7);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.print-btn {
  font: inherit;
  cursor: pointer;
  color: var(--evergreen-deep);
  background: transparent;
  border: 1px solid rgba(176, 138, 52, 0.75);
  border-radius: 999px;
  padding: 4px 12px;
}
.print-btn:hover { background: var(--paper-deep); }
.print-btn:disabled { opacity: 0.6; cursor: progress; }
/* A carol's printed page (engine/hymn-sheet.js lays it out): the title in
   the songbook's green over its holly rule, sized for a letter sheet. */
.print-head h1 { color: var(--evergreen-deep) !important; }
.print-head .rule { margin: 3pt auto 6pt; max-width: 3in; gap: 0.12in; }
.print-head .rule .holly { width: 0.5in; }
.ctl { display: inline-flex; align-items: center; gap: 6px; }
.ctl input[type="range"] { width: 112px; accent-color: var(--cranberry); }
.ctl input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--evergreen); }
.tempo-val { min-width: 4.6em; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.hymn-music { margin-top: 6px; }
.credits {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 30px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 15.5px;
  color: var(--ink-soft);
}
.credits b { font-weight: 500; font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; margin-right: 6px; color: var(--gold); }

.turn { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 22px; }
.turn a {
  display: block;
  text-decoration: none;
  color: var(--gold-pale);
  padding: 12px 16px;
  border: 1px solid rgba(176, 138, 52, 0.45);
  border-radius: 3px;
  transition: background 0.15s ease;
}
.turn a:hover { background: rgba(255, 255, 255, 0.05); }
.turn a.next { text-align: right; grid-column: 2; }
.turn small { display: block; font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); }
.turn span { font-size: 20px; font-style: italic; }

/* ---------------- about ---------------- */

.prose { max-width: 600px; margin: 0 auto; }
.prose h2 {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--cranberry);
  margin: 30px 0 6px;
}
.prose p { margin: 0 0 12px; }
.prose p:first-of-type::first-letter {
  float: left;
  font-size: 3.5em;
  line-height: 0.82;
  padding: 6px 8px 0 0;
  color: var(--cranberry);
}
.prose dl { margin: 0; }
.prose dt { font-weight: 600; color: var(--evergreen-deep); margin-top: 10px; }
.prose dd { margin: 0; color: var(--ink-soft); }
.prose strong { font-weight: 600; color: var(--evergreen-deep); }
.settings { list-style: none; margin: 18px 0; padding: 0; display: grid; gap: 12px; }
.settings li { display: grid; grid-template-columns: 7.6em 1fr; gap: 16px; align-items: start; }
.settings .part-chip { justify-self: start; margin-top: 2px; }
.steps { margin: 18px 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 14px; }
.steps li { position: relative; padding-left: 46px; counter-increment: step; }
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 1px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  font-size: 17px;
  color: var(--cranberry);
  border: 1px solid var(--gold);
  border-radius: 50%;
  background: #fffdf6;
}
.try {
  margin: 30px 0 0;
  padding: 14px 18px;
  font-style: italic;
  background: rgba(243, 233, 208, 0.7);
  border-left: 3px solid var(--cranberry);
  border-radius: 0 3px 3px 0;
}
.try strong { font-style: normal; }
.center { text-align: center; margin-top: 28px; }
.btn-plain {
  display: inline-block;
  font-size: 15px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--evergreen-deep);
  border: 1px solid var(--gold);
  border-radius: 2px;
  padding: 10px 24px;
}
.btn-plain:hover { background: var(--paper-deep); }

/* The Support page's three gifts. */
.gifts { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; margin: 32px 0 8px; }
.gifts .btn-gold { min-width: 140px; text-align: center; }

/* Ethan's sign-off, on the About and Support pages. */
.prose .signoff { margin: 22px 0 4px; font-style: italic; }
.signature { margin: 0 0 12px; font-size: 21px; color: var(--evergreen-deep); line-height: 1.25; }
.signature span {
  display: block;
  font-size: 13px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 2px;
}
.contact-line { margin-top: 32px; padding-top: 22px; border-top: 1px solid var(--line); text-align: center; }
.contact-line p { font-style: italic; color: var(--ink-soft); }
.prose .contact-line p::first-letter { float: none; font-size: inherit; padding: 0; color: inherit; }
.contact-line .btn-plain { font-family: inherit; background: none; cursor: pointer; }
.contact-line .btn-plain:hover { background: var(--paper-deep); }

/* ---------------- the contact dialog ---------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(14, 36, 27, 0.72);
}
.modal {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--paper);
  color: var(--ink);
  border-radius: 3px;
  padding: 30px 30px 24px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.5);
  outline: 1px solid rgba(176, 138, 52, 0.55);
  outline-offset: -10px;
}
.modal h2 { margin: 0 0 6px; font-size: 28px; font-weight: 500; color: var(--evergreen-deep); text-align: center; }
.modal-intro { margin: 0 0 18px; text-align: center; font-style: italic; color: var(--ink-soft); }
.modal label {
  display: block;
  margin-bottom: 14px;
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.modal input, .modal textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 5px;
  font: inherit;
  font-family: var(--serif);
  font-size: 18px;
  letter-spacing: normal;
  text-transform: none;
  color: var(--ink);
  background: #fffdf6;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 8px 10px;
}
.modal textarea { resize: vertical; min-height: 120px; }
.modal input:focus, .modal textarea:focus { outline: none; border-color: var(--cranberry); box-shadow: 0 0 0 1px var(--cranberry); }
.modal .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.modal-error { min-height: 1.3em; margin: 0 0 8px; font-family: var(--sans); font-size: 15px; color: var(--danger); }
.modal-error:empty { min-height: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.modal-actions .btn-plain { font-family: inherit; background: none; cursor: pointer; }
.modal-actions .btn-plain:hover { background: var(--paper-deep); }
.modal-actions .btn-send { background: var(--evergreen-deep); color: var(--paper); border-color: var(--evergreen-deep); }
.modal-actions .btn-send:hover { background: var(--evergreen); }
.modal-actions .btn-send:disabled { opacity: 0.7; cursor: progress; }

/* ---------------- notices ---------------- */

.notices { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 20; width: max-content; max-width: calc(100vw - 32px); }
.notice {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--sans);
  font-size: 15px;
  background: var(--paper);
  color: var(--ink);
  border-left: 4px solid var(--evergreen);
  padding: 11px 14px;
  border-radius: 3px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
.notice.error { border-left-color: var(--cranberry); }
.notice button { font: inherit; background: none; border: 0; color: var(--ink-soft); cursor: pointer; font-size: 20px; line-height: 1; padding: 0 2px; }

/* ---------------- a phone, held while singing ---------------- */

@media (max-width: 760px) {
  /* The name, the menu, and the instrument on one line. */
  .site-header { flex-wrap: wrap; padding: 12px 14px 11px; margin-bottom: 10px; }
  .site-header::after { left: 14px; right: 14px; }
  .header-right { gap: 10px; }
  .inst-btn, .pill-btn { font-size: 15px; padding: 4px 11px 4px 10px; }
  .brand { font-size: 24px; }
}

@media (max-width: 640px) {
  body { font-size: 18px; }
  .app-main { padding: 4px 8px 28px; }
  .leaf { padding: 30px 16px 28px; --corner-in: 9px; }
  .leaf::before { inset: 5px; box-shadow: none; }
  .corner { width: 20px; height: 20px; }
  .plate { padding: 40px 18px 38px; outline-offset: 5px; margin: 0 6px; width: auto; --corner-in: 7px; }
  .plate .holly { width: 150px; }
  .plate-over { letter-spacing: 0.24em; font-size: 13px; }
  .plate-over span::before, .plate-over span::after { width: 22px; }
  .entry { grid-template-columns: 2.4em 1fr; padding: 12px 2px 11px; }
  .entry-by { display: none; }
  .entry-title { font-size: 21px; }
  .play-btn { min-width: 0; }
  .part-chip { padding: 7px 11px; }
  .ctl input[type="range"] { width: 120px; }
  .settings li { grid-template-columns: 1fr; gap: 6px; }
  .turn { grid-template-columns: 1fr; }
  .turn a.next { grid-column: 1; }
}

/* ---------------- the hint that the long line exists ---------------- */

.turn-hint { display: none; }
.page-btn { display: none; }
@media (max-width: 640px) and (orientation: portrait) {
  .turn-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin: 14px 0 0;
    font-family: var(--serif);
    font-size: 16px;
    font-style: italic;
    color: var(--ink-soft);
  }
  /* A phone, about to be turned. */
  .turn-icon {
    flex: none;
    width: 11px;
    height: 18px;
    border: 1.5px solid var(--gold);
    border-radius: 2.5px;
    transform: rotate(-28deg);
  }
}

/* ---------------- the long line: a phone on its side ----------------
   The carol alone, as one unbroken staff that scrolls sideways. A carol
   with a refrain is two: the verse, then the refrain centered beside it. Play and the four
   parts stand in a rail down the left edge, because height is the thing a
   sideways phone has least of and width the thing it has most. */

body.long { overflow: hidden; }
body.long .site-header,
body.long .carol-top,
body.long .leaf > h1,
body.long .carol-first,
body.long .rule,
body.long .tools-btn,
body.long .tools,
body.long .credits,
body.long .turn,
body.long .corner,
body.long .leaf::before { display: none; }
body.long .app-main { max-width: none; padding: 0; }
body.long .leaf {
  position: fixed;
  inset: 0;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
}
body.long .controls {
  position: fixed;
  z-index: 2;
  top: 0;
  bottom: 0;
  left: 0;
  width: calc(60px + env(safe-area-inset-left));
  padding-left: env(safe-area-inset-left);
  margin: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(90deg, var(--evergreen-night), var(--evergreen-deep));
  border-right: 1px solid var(--gold);
}
body.long .toolbar, body.long .parts { flex-direction: column; flex-wrap: nowrap; gap: 7px; }
body.long .page-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  margin-bottom: 2px;
  font: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  color: var(--gold-pale);
  background: transparent;
  border: 1px solid rgba(176, 138, 52, 0.7);
  border-radius: 50%;
}
body.long .toolbar, body.long .parts { gap: 6px; }
body.long .play-btn { min-width: 0; width: 44px; height: 44px; padding: 0; border-radius: 50%; margin-bottom: 4px; }
body.long .play-btn .word { display: none; }
body.long .play-btn .glyph { width: auto; }
body.long .part-chip { width: 40px; height: 40px; padding: 0; border-radius: 50%; background: var(--paper); }
body.long .part-chip.loud { background: var(--part-color); }
body.long .part-chip.mute { opacity: 0.5; }
body.long .hymn-music {
  position: fixed;
  top: 6px;
  bottom: calc(4px + env(safe-area-inset-bottom));
  left: calc(61px + env(safe-area-inset-left));
  right: 0;
  margin: 0;
  display: flex;
  align-items: center;
  /* A little air between the verse and the refrain. */
  gap: 22px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  /* Room to bring the last chord back to the reading point. */
  padding-right: 60vw;
  scrollbar-width: none;
}
body.long .hymn-music::-webkit-scrollbar { display: none; }
body.long .hymn-system { flex: none; margin: 0; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
