/* ===== Tokens ===== */
:root {
  --bg: #0b0a12;
  --bg-2: #110f1b;
  --surface: #171425;
  --surface-2: #201c33;
  --line: #2c2744;
  --text: #efecf7;
  --muted: #a8a3bd;
  --accent: #ff3d8b;
  --accent-2: #8b5cf6;
  --accent-3: #22d3ee;
  --radius: 16px;
  --radius-sm: 10px;
  --max: 1180px;
  --font-head: 'Unbounded', system-ui, 'Segoe UI', 'Noto Sans', 'PingFang SC', 'Microsoft YaHei', 'Nirmala UI', 'Noto Sans Devanagari', 'Noto Sans Arabic', sans-serif;
  --font-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', 'PingFang SC', 'Microsoft YaHei', 'Nirmala UI', 'Noto Sans Devanagari', 'Noto Sans Arabic', Tahoma, sans-serif;
  color-scheme: dark;
}
/* Scripts that the display font does not cover: use the system stack for headings. */
html[lang='zh'], html[lang='hi'], html[lang='ar'] { --font-head: var(--font-body); }
html[lang='ar'] body, html[lang='hi'] body { line-height: 1.8; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.65 var(--font-body);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-3); text-underline-offset: 3px; }
a:hover { color: #fff; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 .6em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 4.5vw, 3.2rem); font-weight: 700; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.9rem); font-weight: 600; }
h3 { font-size: 1.12rem; font-weight: 600; }
p { margin: 0 0 1em; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.skip { position: absolute; inset-inline-start: -9999px; }
.skip:focus { inset-inline-start: 16px; top: 8px; z-index: 99; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 8px; }
:focus-visible { outline: 2px solid var(--accent-3); outline-offset: 2px; }

/* ===== Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 10, 18, .82); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-row { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font: 700 1.1rem var(--font-head); white-space: nowrap; font-family: 'Unbounded', var(--font-body); }
.logo svg { flex: none; }
.main-nav { margin-inline-start: auto; }
.main-nav ul { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; }
.main-nav a { display: block; white-space: nowrap; padding: 8px 12px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .94rem; }
.main-nav a:hover, .main-nav a[aria-current='page'] { color: var(--text); background: var(--surface-2); }

.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; font-weight: 700; font-size: .9rem; user-select: none; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown[open] > summary { border-color: var(--accent-2); }
.dropdown-panel { position: absolute; inset-inline-end: 0; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px; min-width: 180px; box-shadow: 0 18px 40px rgba(0,0,0,.5); }
.dropdown-panel a { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 8px; color: var(--text); text-decoration: none; }
.dropdown-panel a:hover, .dropdown-panel a[aria-current='true'] { background: var(--surface-2); }
.dropdown-panel small { color: var(--muted); font-weight: 700; }

.menu-btn { display: none; background: none; border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 8px 12px; font: inherit; font-weight: 700; cursor: pointer; }

@media (max-width: 1180px) {
  .menu-btn { display: block; margin-inline-start: auto; }
  .main-nav { position: absolute; inset-inline: 0; top: 64px; background: var(--bg-2); border-bottom: 1px solid var(--line); display: none; margin: 0; }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; padding: 8px 16px 16px; }
  .main-nav a { padding: 12px; border-radius: 10px; }
}

/* ===== Hero ===== */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: right center; }
[dir='rtl'] .hero-img { transform: scaleX(-1); }
.hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(11,10,18,.95) 0%, rgba(11,10,18,.7) 45%, rgba(11,10,18,.1) 100%); }
[dir='rtl'] .hero::after { background: linear-gradient(270deg, rgba(11,10,18,.95) 0%, rgba(11,10,18,.7) 45%, rgba(11,10,18,.1) 100%); }
.hero .wrap { position: relative; z-index: 1; padding-block: clamp(64px, 12vw, 140px); }
.hero-text { max-width: 620px; }
.eyebrow { display: inline-block; font-weight: 800; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 14px; }
.hero p.lead { font-size: 1.15rem; color: #d9d4ea; }
.grad { background: linear-gradient(90deg, var(--accent), var(--accent-2) 60%, var(--accent-3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.btns { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 22px; border-radius: 999px; font-weight: 800; text-decoration: none; border: 1px solid transparent; cursor: pointer; font-size: 1rem; font-family: inherit; }
.btn-primary { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #fff; }
.btn-primary:hover { color: #fff; filter: brightness(1.1); }
.btn-ghost { border-color: var(--line); color: var(--text); background: rgba(255,255,255,.03); }
.btn-ghost:hover { border-color: var(--accent-2); }

/* Page header (inner pages) */
.page-head { position: relative; border-bottom: 1px solid var(--line); overflow: hidden; }
.page-head .wrap { position: relative; z-index: 1; display: grid; grid-template-columns: 1.2fr .8fr; gap: 32px; align-items: center; padding-block: 48px; }
.page-head img { border-radius: var(--radius); border: 1px solid var(--line); aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.page-head::before { content: ''; position: absolute; width: 520px; height: 520px; inset-inline-start: -160px; top: -260px; background: radial-gradient(circle, rgba(139,92,246,.28), transparent 65%); }
.page-head .lead { font-size: 1.08rem; color: #d9d4ea; }
@media (max-width: 800px) { .page-head .wrap { grid-template-columns: 1fr; padding-block: 32px; } .page-head img { max-height: 260px; } }

.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); }

/* ===== Sections ===== */
section.block { padding-block: 56px; }
section.block + section.block { padding-top: 0; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.section-head p { margin: 0; color: var(--muted); max-width: 640px; }

.grid { display: grid; gap: 18px; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
@media (max-width: 360px) { .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; position: relative; }
.card h3 { margin-bottom: .4em; }
.card p { color: #cfcae0; }
.card-link { display: block; text-decoration: none; color: var(--text); overflow: hidden; padding: 0; transition: transform .2s, border-color .2s; }
.card-link:hover { transform: translateY(-3px); border-color: var(--accent-2); color: var(--text); }
.card-link img { aspect-ratio: 16 / 10; object-fit: cover; width: 100%; }
.card-link .card-body { padding: 18px 20px 22px; }
.card-link p { color: var(--muted); margin: 0; font-size: .95rem; }

.steps { counter-reset: step; }
.steps .card::before { counter-increment: step; content: counter(step); display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); font-weight: 800; margin-bottom: 14px; }

/* Prose (long texts) */
.prose { max-width: 760px; }
.prose h2 { margin-top: 1.6em; }
.prose h3 { margin-top: 1.3em; }
.prose ul, .prose ol { padding-inline-start: 1.3em; }
.prose li { margin-bottom: .4em; }
.callout { border-inline-start: 4px solid var(--accent); background: var(--surface); padding: 16px 20px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 1.4em 0; }
[dir='rtl'] .callout { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }

/* ===== Filters ===== */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 22px; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--muted); padding: 7px 14px; border-radius: 999px; font: 600 .9rem var(--font-body); cursor: pointer; }
.chip:hover { color: var(--text); }
.chip[aria-pressed='true'] { background: var(--text); color: var(--bg); border-color: var(--text); }
.search { flex: 1 1 240px; max-width: 360px; background: var(--surface); border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 10px 16px; font: inherit; }
.search::placeholder { color: var(--muted); }
.is-hidden { display: none !important; }
.empty { color: var(--muted); padding: 20px 0; }

/* ===== Genre cards ===== */
.genre { --h: 280; border-top: 4px solid hsl(var(--h) 85% 62%); scroll-margin-top: 90px; }
.genre-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.era { font: 700 .78rem var(--font-body); color: hsl(var(--h) 85% 72%); background: hsl(var(--h) 60% 50% / .14); padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.origin { color: var(--muted); font-size: .9rem; margin-bottom: .7em; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0 0 14px; }
.tags li { font-size: .8rem; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: #d6d1e6; }
.label { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 800; margin: 12px 0 6px; }
.tracklist { list-style: none; padding: 0; margin: 0; }
.tracklist li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: .92rem; }
.tracklist li:last-child { border-bottom: 0; }
.tracklist a { font-size: .8rem; white-space: nowrap; text-decoration: none; color: var(--accent); font-weight: 700; }
.related a { font-size: .85rem; margin-inline-end: 8px; }

/* ===== Instruments ===== */
.meter { display: flex; gap: 4px; }
.meter i { width: 18px; height: 6px; border-radius: 3px; background: var(--surface-2); }
.meter i.on { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.facts div { background: var(--bg-2); border-radius: var(--radius-sm); padding: 10px; }
.facts dt { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 800; }
.facts dd { margin: 4px 0 0; font-weight: 700; font-size: .95rem; }
.family { display: inline-block; font-size: .78rem; font-weight: 800; color: var(--accent-3); margin-bottom: 6px; }
.tip { font-size: .92rem; color: #cfcae0; border-top: 1px solid var(--line); padding-top: 12px; margin: 0; }

/* ===== Festivals ===== */
.fest-month { font: 800 .8rem var(--font-body); color: var(--accent); text-transform: uppercase; letter-spacing: .08em; }
.fest-place { color: var(--muted); font-size: .9rem; margin-bottom: .6em; }
.note { font-size: .88rem; color: var(--muted); }

/* ===== Timeline ===== */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ''; position: absolute; inset-inline-start: 11px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--accent), var(--accent-2), var(--accent-3)); }
.timeline li { position: relative; padding-inline-start: 44px; padding-bottom: 30px; }
.timeline li::before { content: ''; position: absolute; inset-inline-start: 4px; top: 6px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 3px solid var(--accent); }
.timeline .year { font: 800 .85rem var(--font-body); color: var(--accent); letter-spacing: .06em; }
.timeline h3 { margin: 4px 0 6px; font-size: 1.2rem; }
.timeline p { color: #cfcae0; max-width: 720px; }

/* ===== Theory tools ===== */
.tool { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.piano { display: flex; position: relative; height: 170px; margin: 16px 0 8px; user-select: none; direction: ltr; max-width: 560px; }
.piano .w { flex: 1; background: linear-gradient(#fff, #e9e6f2); border: 1px solid #555; border-radius: 0 0 8px 8px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 8px; color: #333; font-weight: 800; font-size: .85rem; cursor: pointer; }
.piano .b { position: absolute; top: 0; width: 8%; height: 60%; background: linear-gradient(#333, #0b0b0b); border-radius: 0 0 6px 6px; z-index: 2; cursor: pointer; }
.piano .w.on { background: linear-gradient(#ffd0e3, var(--accent)); }
.piano .b.on { background: var(--accent-2); }
.metro { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 12px; }
.metro output { font: 800 2rem var(--font-body); min-width: 90px; }
.metro input[type=range] { flex: 1 1 200px; accent-color: var(--accent); }
.beat { display: flex; gap: 8px; }
.beat i { width: 16px; height: 16px; border-radius: 50%; background: var(--surface-2); }
.beat i.on { background: var(--accent); box-shadow: 0 0 14px var(--accent); }

.glossary { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin: 0; }
.glossary div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; }
.glossary dt { font-weight: 800; color: var(--text); }
.glossary dd { margin: 4px 0 0; color: var(--muted); font-size: .93rem; }

/* ===== Albums ===== */
.albums { counter-reset: al; list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.albums li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; }
.albums li::before { counter-increment: al; content: counter(al, decimal-leading-zero); grid-row: span 2; font: 800 1.1rem var(--font-body); color: var(--accent-2); align-self: center; }
.albums strong { font-size: .98rem; }
.albums span { color: var(--muted); font-size: .86rem; }

/* ===== Quiz ===== */
.quiz { background: linear-gradient(135deg, rgba(255,61,139,.14), rgba(139,92,246,.14)); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 4vw, 36px); }
.quiz fieldset { border: 0; padding: 0; margin: 0 0 18px; }
.quiz legend { font-weight: 800; margin-bottom: 10px; font-size: 1.05rem; }
.quiz .opts { display: flex; flex-wrap: wrap; gap: 8px; }
.quiz label { cursor: pointer; }
.quiz input { position: absolute; opacity: 0; pointer-events: none; }
.quiz label span { display: inline-block; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-2); font-weight: 600; }
.quiz input:checked + span { background: var(--text); color: var(--bg); border-color: var(--text); }
.quiz input:focus-visible + span { outline: 2px solid var(--accent-3); }
.quiz-result { margin-top: 18px; }
.quiz-result ol { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; padding: 0; }
.quiz-result a { display: inline-block; padding: 10px 18px; border-radius: 999px; background: var(--surface); border: 1px solid var(--accent-2); color: var(--text); font-weight: 800; text-decoration: none; }

/* ===== Footer ===== */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-2); margin-top: 40px; padding: 40px 0 28px; font-size: .92rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 28px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }
.footer-bottom { border-top: 1px solid var(--line); margin-top: 28px; padding-top: 18px; color: var(--muted); font-size: .85rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-grid > :first-child { grid-column: 1 / -1; } }

/* Ad container (only used if you add manual AdSense units) */
.ad-slot { margin: 32px auto; text-align: center; min-height: 100px; }

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

/* Compact header on phones */
.menu-btn, .dropdown > summary { white-space: nowrap; }
@media (max-width: 480px) {
  .header-row { gap: 8px; }
  .logo { font-size: .88rem; white-space: normal; line-height: 1.15; min-width: 0; }
  .logo span { max-width: 9.5em; }
  .menu-btn .t { display: none; }
  .menu-btn, .dropdown > summary { padding: 8px 10px; }
}
