/* Learn path (/registers, /learn/*): a console of small instruments.
   Chest is always warm, head is always cool, and screens stay dark in both themes. */
.lrn {
  --l-panel: #1b1f27; --l-raised: #232832; --l-line: #333a47; --l-hi: rgba(255,255,255,.05);
  --l-ink: #eef0f3; --l-dim: #9aa3b2; --l-amber: #e9a13b; --l-warm: #f0764e; --l-cool: #6fb6ff;
  --l-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 36px 0 72px;
}
@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) .lrn {
    --l-panel: #e4e8ee; --l-raised: #f5f7fa; --l-line: #c6cdd8; --l-hi: rgba(255,255,255,.7);
    --l-ink: #171a21; --l-dim: #586170; --l-amber: #a9640a; --l-warm: #c2491f; --l-cool: #1f6fb5;
  }
}
html[data-theme="light"] .lrn {
  --l-panel: #e4e8ee; --l-raised: #f5f7fa; --l-line: #c6cdd8; --l-hi: rgba(255,255,255,.7);
  --l-ink: #171a21; --l-dim: #586170; --l-amber: #a9640a; --l-warm: #c2491f; --l-cool: #1f6fb5;
}
.site-footer { margin-top: 0; }
.lrn i { font-style: normal; }

.lrn-mono { font-family: var(--l-mono); font-size: 0.72rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--l-dim); }
.lrn-warm { color: var(--l-warm); }
.lrn-cool { color: var(--l-cool); }
.lrn h1 { font-size: clamp(2rem, 4.4vw, 3.2rem); margin: 10px 0 22px; text-wrap: balance; color: var(--l-ink); }

/* ===== In-lesson jump links ===== */
.lrn-jump { display: flex; flex-wrap: wrap; gap: 10px 12px; margin-bottom: 26px; }
.lrn-jump a { display: inline-flex; align-items: center; gap: 10px; padding: 6px 16px 6px 6px; border: 1px solid var(--l-line); border-radius: 99px; color: var(--l-ink); font-size: 0.92rem; font-weight: 600; }
.lrn-jump a:hover { border-color: var(--l-amber); }
.lrn-chip { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-family: var(--l-mono); font-size: 0.8rem; font-weight: 600; background: var(--l-amber); color: #14161c; }
.lrn-part { scroll-margin-top: 96px; }
.lrn-part + .lrn-part { margin-top: 80px; padding-top: 40px; border-top: 1px solid var(--l-line); }
.lrn-part > h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); margin: 10px 0 24px; color: var(--l-ink); text-wrap: balance; }

/* ===== Console ===== */
.lrn-console { background: var(--l-panel); border: 1px solid var(--l-line); border-radius: 22px; padding: 16px; box-shadow: inset 0 1px 0 var(--l-hi), var(--shadow-md); }
.lrn-split { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 16px; }
.lrn-stack { display: flex; flex-direction: column; gap: 12px; }

/* Screens are dark in both themes, so their inks are fixed. */
.lrn-screen {
  --l-warm: #f0764e; --l-cool: #6fb6ff; --l-amber: #e9a13b; --l-dim: #98a1b0;
  background: #0f1218; border: 1px solid #2a303b; border-radius: 14px; padding: 20px;
  color: #dfe3ea; display: flex; flex-direction: column; justify-content: center; gap: 12px; min-width: 0;
}
.lrn-folds { align-items: center; }
.lrn-folds canvas { max-width: 100% !important; height: auto !important; }
.lrn-slider { display: flex; align-items: center; gap: 14px; width: 100%; max-width: 380px; }
.lrn-slider b { font-size: 0.95rem; font-weight: 600; }
.lrn-slider input { -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #e85d3a, #60b0ff); outline-offset: 6px; }
.lrn-slider input::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; border-radius: 50%; background: #fff; cursor: grab; box-shadow: 0 0 0 4px rgba(255,255,255,.14), 0 2px 6px rgba(0,0,0,.5); }
.lrn-slider input::-moz-range-thumb { width: 28px; height: 28px; border: none; border-radius: 50%; background: #fff; cursor: grab; box-shadow: 0 0 0 4px rgba(255,255,255,.14), 0 2px 6px rgba(0,0,0,.5); }
.lrn-pitch { display: flex; align-items: center; gap: 10px; font-family: var(--l-mono); font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--l-dim); }
.lrn-pitch-track { width: 150px; height: 6px; background: rgba(255,255,255,.08); border-radius: 3px; overflow: hidden; }
.lrn-pitch-fill { height: 100%; width: 10%; border-radius: 3px; background: linear-gradient(90deg, #e85d3a, #f0c040, #60b0ff); transition: width .1s; }

/* ===== Step 1 readout ===== */
.lrn-readout { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.lrn-term, .lrn-now, .lrn-cell { background: var(--l-raised); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.lrn-term p { font-size: 1.15rem; line-height: 1.4; color: var(--l-ink); }
.lrn-now b { font-size: clamp(1.6rem, 3vw, 2.1rem); line-height: 1.1; letter-spacing: -0.02em; color: var(--l-warm); transition: color .2s; }
.lrn-cells { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lrn-cell { min-height: 74px; }
.lrn-cell:nth-child(n+3) { grid-column: span 2; min-height: 0; }
.lrn-cell b { font-size: 1rem; font-weight: 600; color: var(--l-ink); line-height: 1.3; }
.lrn-readout.is-head .lrn-now b { color: var(--l-cool); }
.lrn-hint { text-align: center; padding-top: 2px; }

/* ===== Steps 2 and 3: text beside its instrument ===== */
.lrn-row { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 20px; background: var(--l-raised); border-radius: 16px; padding: 8px 8px 8px 24px; }
.lrn-row-text { padding: 18px 0; display: flex; flex-direction: column; gap: 10px; }
.lrn-tag { font-size: 0.8rem; font-weight: 600; color: var(--l-amber); }
.lrn-row-text p, .lrn-row-text li { color: var(--l-ink); font-size: 1.02rem; line-height: 1.6; max-width: 34em; }
.lrn-row-text ul { padding-left: 1.15em; display: flex; flex-direction: column; gap: 6px; }

.lrn-bars { display: flex; align-items: center; height: 52px; }
.lrn-band { display: block; flex: 1; height: 26px; border-radius: 6px; transition: height .3s ease, opacity .3s ease; }
.lrn-even { background: linear-gradient(90deg, var(--l-warm), var(--l-cool)); }
.lrn-chest { background: var(--l-warm); }
.lrn-head { background: var(--l-cool); }
.lrn-both { gap: 4px; }
.lrn-uneven .lrn-chest { height: 40px; }
.lrn-uneven .lrn-head { height: 8px; opacity: .65; }
.is-head-strong .lrn-uneven .lrn-chest { height: 8px; opacity: .65; }
.is-head-strong .lrn-uneven .lrn-head { height: 40px; opacity: 1; }
.lrn-mark { flex: 0 0 2px; height: 52px; margin: 0 5px; background: #fff; border-radius: 1px; }
.lrn-axis { display: flex; justify-content: space-between; }
.lrn-cap { text-align: center; color: #dfe3ea; }
.lrn-cap-top { text-align: left; }
.lrn-seg { align-self: flex-start; display: inline-flex; gap: 2px; padding: 3px; border-radius: 9px; background: rgba(255,255,255,.07); }
.lrn-seg button { background: none; color: var(--l-dim); padding: 7px 12px; border-radius: 6px; font-size: 0.8rem; font-weight: 600; }
.lrn-seg button.is-on { background: rgba(255,255,255,.16); color: #fff; }
.lrn-seg button:focus-visible, .lrn-jump a:focus-visible, .lrn-more:focus-visible { outline: 2px solid var(--l-amber); outline-offset: 2px; }

.lrn-meter { display: flex; gap: 2px; height: 46px; border-radius: 8px; overflow: hidden; }
.lrn-z { display: grid; place-items: center; background: rgba(255,255,255,.07); min-width: 0; }
.lrn-z b { font-family: var(--l-mono); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap; }
.lrn-go { background: var(--l-amber); color: #1a1206; }
.lrn-ok { background: rgba(255,255,255,.15); }
.lrn-no { background: repeating-linear-gradient(135deg, rgba(240,118,78,.34) 0 6px, rgba(240,118,78,.14) 6px 12px); color: #ffb9a3; }
.lrn-meter.lrn-dur > :nth-child(1) { flex: 1; }
.lrn-meter.lrn-dur > :nth-child(2) { flex: 4; }
.lrn-meter.lrn-dur > :nth-child(3) { flex: 3; }
.lrn-meter.lrn-dur > :nth-child(4) { flex: 2.5; }
.lrn-meter.lrn-int > :nth-child(odd) { flex: 2; }
.lrn-meter.lrn-int > :nth-child(2) { flex: 3; }
.lrn-ticks { display: flex; justify-content: space-between; letter-spacing: 0.04em; }
.lrn-ticks.lrn-dur { display: grid; grid-template-columns: 1fr 4fr 3fr 2.5fr; gap: 2px; }
.lrn-ticks.lrn-dur > :nth-child(5) { display: none; }
.lrn-pips { display: flex; gap: 6px; height: 40px; }
.lrn-pips .lrn-p { flex: 2; background: var(--l-amber); border-radius: 5px; }
.lrn-pips .lrn-r { flex: 1; border: 1px dashed rgba(255,255,255,.32); border-radius: 5px; }
.lrn-legend { display: flex; gap: 20px; }
.lrn-legend span { display: inline-flex; align-items: center; gap: 8px; }
.lrn-legend i { width: 16px; height: 10px; border-radius: 3px; }
.lrn-legend .lrn-p { background: var(--l-amber); }
.lrn-legend .lrn-r { border: 1px dashed rgba(255,255,255,.4); }

/* ===== Side-by-side table ===== */
.lrn-block { margin-top: 56px; }
.lrn-block h2 { font-size: 1.5rem; margin-bottom: 18px; color: var(--l-ink); }
.lrn-table-wrap { overflow-x: auto; border: 1px solid var(--l-line); border-radius: 14px; }
.lrn-table { width: 100%; border-collapse: collapse; font-size: 0.98rem; }
.lrn-table th, .lrn-table td { padding: 14px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--l-line); }
.lrn-table tbody tr:last-child > * { border-bottom: none; }
.lrn-table thead th { font-size: 1.05rem; }
.lrn-table tbody th { font-family: var(--l-mono); font-size: 0.72rem; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--l-dim); width: 24%; }
.lrn-table td { color: var(--l-ink); width: 38%; }
.lrn-note { margin-top: 22px; font-size: 1.1rem; line-height: 1.6; color: var(--l-ink); max-width: 40em; }

/* ===== Learn page: one tile per lesson ===== */
.lrn-up { display: inline-block; }
.lrn-up:hover { color: var(--l-amber); }
.lrn-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 20px; margin-top: 8px; }
.lrn-tile { display: flex; flex-direction: column; gap: 4px; padding: 12px; color: var(--l-ink); transition: border-color var(--transition), transform var(--transition); }
.lrn-tile:hover { border-color: var(--l-amber); transform: translateY(-2px); color: var(--l-ink); }
.lrn-tile .lrn-screen { min-height: 150px; }
.lrn-tile-text { display: flex; flex-direction: column; gap: 6px; padding: 16px 10px 10px; flex: 1; }
.lrn-tile-text b { font-size: 1.3rem; line-height: 1.2; letter-spacing: -0.01em; }
.lrn-tile-text p { color: var(--l-dim); font-size: 0.95rem; flex: 1; }
.lrn-open { margin-top: 8px; font-weight: 600; color: var(--l-amber); }
.lrn-tile:focus-visible { outline: 2px solid var(--l-amber); outline-offset: 3px; }

/* ===== Lesson foot ===== */
.lrn-pager { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--l-line); }
.lrn-more { display: flex; flex-direction: column; gap: 4px; color: var(--l-ink); }
.lrn-more b { font-size: 1.1rem; }
.lrn-more:hover b { color: var(--l-amber); }

@media (max-width: 900px) {
  .lrn { padding: 24px 0 52px; }
  .lrn h1 { margin: 8px 0 18px; }
  .lrn-part + .lrn-part { margin-top: 52px; padding-top: 28px; }
  .lrn-console { padding: 10px; border-radius: 18px; }
  .lrn-split { grid-template-columns: 1fr; }
  .lrn-row { grid-template-columns: 1fr; gap: 0; padding: 4px 16px 16px; }
  .lrn-screen { padding: 16px; }
  .lrn-table th, .lrn-table td { padding: 12px 10px; }
}
@media (max-width: 560px) {
  .lrn-pager { flex-direction: column; align-items: stretch; }
  .lrn-pager .btn { white-space: normal; text-align: center; }
@media (max-width: 520px) {
  .lrn-z b { font-size: 0.6rem; letter-spacing: 0.04em; }
  .lrn-ticks { font-size: 0.62rem; }
}
@media (prefers-reduced-motion: reduce) { .lrn-band, .lrn-now b { transition: none; } }
