.theory-page {
  margin:0;
  background:#fbf6ee;
  color:#2c2320;
  font:16px/1.55 system-ui,sans-serif;
}
.theory-page * { box-sizing:border-box; }
.theory-page a { color:#6b3d2f; }
.theory-page :focus-visible { outline:2px solid #9b462d; outline-offset:4px; }
.theory-site-header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px max(16px,calc((100vw - 1080px) / 2));
  background:#fffcf7;
  border-bottom:1px solid #ebddce;
}
.theory-site-header nav { display:flex; gap:clamp(12px,3vw,28px); margin-left:auto; }
.theory-site-header a { text-decoration:none; }
.theory-site-header .theory-brand { color:#2c2320; font-weight:850; letter-spacing:-.04em; }
.theory-brand span { color:#a45137; }
.theory { max-width:1100px; margin:auto; padding:12px clamp(12px,4vw,32px) 36px; }
.theory-intro {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  min-height:112px;
  border-bottom:1px solid #ebddce;
}
.theory-intro h1,.theory-slide h2 { margin:0; letter-spacing:-.05em; line-height:1.05; text-wrap:balance; }
.theory-intro h1 { font-size:clamp(25px,5.5vw,58px); }
.theory-intro p { margin:.35em 0 0; color:#624b41; font-size:clamp(15px,2.4vw,20px); }
.theory-intro img { object-fit:contain; width:clamp(84px,18vw,155px); height:auto; align-self:end; }
.theory-tabs { display:flex; flex-wrap:wrap; gap:6px; margin:14px 0 10px; }
.theory-tabs a,.theory-pagination a {
  display:inline-flex;
  align-items:center;
  min-height:40px;
  padding:5px 12px;
  border:1px solid #d8bfab;
  border-radius:20px;
  background:#fffdf8;
  color:#604033;
  font-size:14px;
  font-weight:650;
  text-decoration:none;
}
.theory-tabs a[aria-current] { background:#823f2e; border-color:#823f2e; color:#fffaf0; }
.theory-slide {
  --card-accent:#9e553d;
  --card-tint:#fbe8d5;
  padding:clamp(15px,3.6vw,38px);
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(200px,30%);
  grid-template-areas:'head head' 'notes listen' 'practice practice' 'nav nav';
  gap:clamp(12px,2.5vw,24px);
  background:#fffdf8;
  border:1px solid #e1cbb9;
  border-radius:22px;
  box-shadow:0 12px 34px #643a2410;
}
#low { --card-accent:#80513e; --card-tint:#f4e4d6; --object-position:33.3333%; }
#mid { --card-accent:#6b4c62; --card-tint:#f3e6ec; --object-position:66.6667%; }
#high { --card-accent:#915628; --card-tint:#f8ebcc; --object-position:100%; }
@supports selector(:has(*)) {
  .theory-cards:not(:has(.theory-slide:target)) .theory-slide:not(:first-child),
  .theory-cards:has(.theory-slide:target) .theory-slide:not(:target) { display:none; }
}
.theory-slide-head {
  grid-area:head;
  min-height:136px;
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:center;
  gap:12px;
  padding:8px clamp(12px,3vw,24px);
  border-radius:14px;
  background:linear-gradient(110deg,var(--card-tint),#fffbf3 88%);
}
.theory-range { margin:0 0 4px; color:var(--card-accent); font:700 clamp(15px,2.4vw,23px)/1.2 ui-monospace,monospace; }
.theory-slide h2 { font-size:clamp(23px,5vw,52px); }
.theory-object {
  width:clamp(100px,20vw,170px);
  aspect-ratio:3/4;
  background:url('./img/theory-objects.webp') var(--object-position,0%) center / 400% 100% no-repeat;
}
.theory-notes { grid-area:notes; align-self:center; }
.theory-notes p,.theory-practice p { margin:0; max-width:67ch; }
.theory-notes p + p { margin-top:.85em; }
.theory-listen { grid-area:listen; }
.theory-slide h3 { margin:0 0 .38em; font-size:17px; }
.theory-tones { display:grid; gap:6px; }
.theory-tones button {
  display:flex;
  align-items:center;
  gap:7px;
  min-height:44px;
  padding:6px 9px;
  border:1px solid #d8bfab;
  border-radius:9px;
  background:#fdf5e9;
  color:#2c2320;
  font:inherit;
  text-align:left;
  cursor:pointer;
}
.theory-tones button::before { content:'▶'; font-size:.73em; color:var(--card-accent); }
.theory-tones button[data-playing] { background:var(--card-tint); border-color:var(--card-accent); }
.theory-tones strong { white-space:nowrap; }
.theory-tones span { font-size:13px; }
.theory-practice {
  grid-area:practice;
  padding:clamp(11px,2.5vw,20px);
  border-left:4px solid var(--card-accent);
  border-radius:8px;
  background:#f9f0e5;
}
.theory-pagination { grid-area:nav; display:flex; flex-wrap:wrap; gap:6px; }
.theory-pagination a + a { margin-left:auto; }
.theory-footer { color:#594b42; font-size:14px; }
.theory-footer summary { cursor:pointer; }
@media(max-width:660px) {
  .theory-slide { grid-template-columns:1fr; grid-template-areas:'head' 'notes' 'listen' 'practice' 'nav'; }
  .theory-slide-head { min-height:110px; }
  .theory-tones { grid-template-columns:repeat(auto-fit,minmax(min(100%,110px),1fr)); }
  .theory-tones button { flex-wrap:wrap; }
}
.theory-chapters {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(min(100%,280px),1fr));
  gap:12px;
  margin-top:16px;
}
.theory-chapters a {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:clamp(16px,4vw,28px);
  border:1px solid #e1cbb9;
  border-radius:18px;
  background:#fffdf8;
  color:#2c2320;
  text-decoration:none;
}
.theory-chapters a:hover { border-color:#9e553d; }
.theory-chapters h2,.theory-contact h2 { margin:0; font-size:clamp(20px,3.2vw,31px); line-height:1.15; }
.theory-chapters p,.theory-contact p { margin:.45em 0 0; max-width:65ch; }
.theory-chapters a > span { color:#823f2e; font-size:32px; line-height:1; }
.theory-contact {
  display:flex;
  align-items:center;
  justify-content:space-between;
  flex-wrap:wrap;
  gap:14px;
  margin-top:14px;
  padding:clamp(15px,3vw,25px);
  border:1px solid #e1cbb9;
  border-radius:16px;
  background:#f7e9dc;
}
.theory-contact a {
  display:inline-flex;
  align-items:center;
  min-height:44px;
  border-radius:24px;
  padding:7px 15px;
  background:#823f2e;
  color:#fffaf0;
  text-decoration:none;
  font-weight:750;
}
.theory-contact a:hover { background:#683225; }
