/* Implied Tonality theme, modelled closely on stripe.com: white page, navy type,
   two-tone headlines, a flowing colour ribbon, white product cards with soft
   blue-grey shadows, a deep band for numbers, faint vertical guides. */
@font-face { font-family: 'Inter'; src: url(/fonts/inter.woff2) format('woff2'); font-weight: 300 700; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url(/fonts/geist-mono.woff2) format('woff2'); font-weight: 400 600; font-display: swap; }
@font-face { font-family: 'Fira Condensed'; src: url(/fonts/fira-800.woff2) format('woff2'); font-weight: 800; font-display: swap; }

:root {
  color-scheme: light;
  --navy: #1a1238;
  --ink: #1a1238;
  --ink-2: #42395f;
  --slate: #5b5578;
  --muted: #6b6488;
  --faint: #9a94b0;
  --line: #e6e3ef;
  --line-2: #d9d4e6;
  --paper: #ffffff;
  --wash: #f7f6fb;
  --surface: #ffffff;
  --surface-2: #f7f6fb;
  --purple: #6e3fd1;
  --purple-ink: #5a2fb8;
  --violet: #8b5cf6;
  --lavender: #b49bd0;
  --plum: #37224a;
  --lav-wash: #f1ecfb;
  --deep: #150d2e;
  --good: #1f8a5b;
  --warn: #c2551f;
  --t1: #6e3fd1; --t2: #9b74e6; --t3: #c2adef; --t4: #e0d6f7; --t5: #efeaf9;
  --c-bg: #ffffff; --c-bg-2: #f7f6fb; --c-line: #e6e3ef; --c-ink: #1a1238; --c-ink-2: #42395f; --c-muted: #6b6488;
  --display: 'Inter', system-ui, sans-serif;
  --body: 'Inter', system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, monospace;
  --cover: 'Fira Condensed', sans-serif;
  --shadow: 0 50px 100px -20px rgba(50, 50, 93, .25), 0 30px 60px -30px rgba(0, 0, 0, .3);
  --shadow-sm: 0 13px 27px -5px rgba(50, 50, 93, .25), 0 8px 16px -8px rgba(0, 0, 0, .3);
  --max: 1080px;
}
html { background: #fff; }
body { background: #fff; color: var(--ink); font: 400 17px/1.6 var(--body); letter-spacing: -0.006em; font-feature-settings: 'cv11', 'ss03'; }
::selection { background: #e0d6f7; color: var(--navy); }
a { color: var(--purple); text-decoration: none; }
a:hover { color: var(--navy); }
h1, h2, h3, h4 { font-family: var(--display); color: var(--navy); font-weight: 500; letter-spacing: -0.022em; line-height: 1.12; }
h1 { font-size: clamp(40px, 4.6vw, 60px); }
h2 { font-size: clamp(30px, 3.1vw, 40px); }
h3 { font-size: 20px; letter-spacing: -0.015em; line-height: 1.3; }
h4 { font-size: 17px; letter-spacing: -0.01em; }
.lede { font-size: clamp(18px, 1.4vw, 21px); color: var(--slate); line-height: 1.55; letter-spacing: -0.012em; }
.muted { color: var(--muted); }
.small { font-size: 14.5px; }
.mono { font-family: var(--mono); }
.wrap { width: min(var(--max), 100% - 48px); }
section { padding: clamp(80px, 9vw, 128px) 0; border: 0 !important; position: relative; }
section.tight { padding: clamp(48px, 5vw, 72px) 0; }
.wash { background: var(--wash); }
.cream { background: #fbf9f6; }
.dark { background: var(--deep); color: #e9e6f5; }
.dark h1, .dark h2, .dark h3, .dark h4 { color: #fff; }
.dark .lede, .dark .muted, .dark p { color: #b8b2d3; }

/* two-tone headlines, Stripe style */
.two-tone { font-size: clamp(30px, 3.1vw, 40px); font-weight: 500; letter-spacing: -0.022em; line-height: 1.18; color: var(--navy); max-width: 800px; }
.two-tone span { color: var(--slate); }
.dark .two-tone { color: #fff; } .dark .two-tone span { color: #a59fc6; }

/* nav */
.nav { position: sticky; top: 0; background: rgba(255,255,255,.86); backdrop-filter: saturate(1.8) blur(12px); -webkit-backdrop-filter: saturate(1.8) blur(12px); border-bottom: 1px solid transparent; z-index: 50; }
.nav.scrolled { border-bottom-color: var(--line); }
.nav .wrap { height: 72px; gap: 32px; }
.brand { color: var(--navy); font: 600 17px var(--display); letter-spacing: -0.02em; gap: 10px; }
.brand .mark { width: 20px; height: 24px; }
.nav-links { gap: 2px; }
.nav-links a, .nav-more > button { color: var(--navy); font: 500 15px var(--body); padding: 8px 12px; border-radius: 6px; background: none; }
.nav-links a:hover, .nav-more > button:hover, .nav-more.open > button { color: var(--slate); background: none; }
.nav-links a[aria-current="page"] { color: var(--purple); background: none; }
.nav-more .menu { background: #fff; border-radius: 10px; box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.nav-more .menu a { color: var(--navy); font-size: 14.5px; border-radius: 6px; }
.nav-more .menu a:hover { background: var(--wash); }

/* buttons */
.btn { font: 500 15px/1 var(--body); letter-spacing: -0.005em; padding: 12px 18px; border-radius: 6px; gap: 6px; transition: background .15s, color .15s, box-shadow .15s; }
.btn::after { content: ''; width: 6px; height: 6px; border-right: 1.6px solid currentColor; border-top: 1.6px solid currentColor; transform: rotate(45deg); margin-left: 4px; transition: transform .15s; }
.btn:hover::after { transform: translateX(2px) rotate(45deg); }
.btn.no-arrow::after, .nav-links a.btn::after { display: none; }
.btn-ink, .btn-purple, .btn-white.primary { background: var(--purple); color: #fff; box-shadow: none; }
.btn-ink:hover, .btn-purple:hover { background: var(--navy); color: #fff; }
.btn-soft, .btn-white { background: #fff; color: var(--purple); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn-soft:hover, .btn-white:hover { color: var(--navy); box-shadow: inset 0 0 0 1px var(--lavender); background: #fff; }
.dark .btn-soft { background: transparent; color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.3); }
.btn-sm { padding: 9px 14px; font-size: 14px; }
.nav-links a.btn-ink { background: var(--purple); color: #fff; margin-left: 12px; padding: 9px 16px; }
.nav-links a.btn-ink:hover { background: var(--navy); color: #fff; }
.link-arrow { color: var(--purple); font-weight: 500; font-size: 15px; }
.link-arrow::after { content: ''; display: inline-block; width: 6px; height: 6px; border-right: 1.6px solid currentColor; border-top: 1.6px solid currentColor; transform: rotate(45deg); margin-left: 8px; vertical-align: 2px; }
.dark .link-arrow { color: #c9b2e8; }

/* cards */
.panel, .dark .panel { background: #fff; color: var(--ink); border-radius: 12px; box-shadow: var(--shadow), 0 0 0 1px rgba(50,50,93,.04); padding: clamp(22px, 2.6vw, 32px); }
.panel.soft { background: var(--wash); box-shadow: none; }
.panel h3, .panel h4 { color: var(--navy); }
.panel p { color: var(--slate); }
.panel .muted { color: var(--muted); }
.spine, .spine.lav, .spine.ink { border-left: 0; border-top: 0; padding: 0; position: relative; }
.spine::before { display: none; }
.spine h3, .spine h4 { color: var(--navy); margin-bottom: 8px; }
.spine p { color: var(--slate); }
.spine::after { content: ''; position: absolute; left: -16px; top: 4px; width: 2px; height: 18px; background: var(--purple); border-radius: 2px; }

/* stats */
.stat .big, .big-stats b { font-weight: 300; color: var(--navy); letter-spacing: -0.04em; }
.stat .big.purple { color: var(--purple); }
.stat + .stat { border-left: 1px solid var(--line); }
.stat p { color: var(--muted); }
.dark .stat .big { color: #fff; } .dark .stat .big.purple { color: #c9b2e8; } .dark .stat + .stat { border-left-color: rgba(255,255,255,.12); }

/* pull quotes */
.pull { font: 500 clamp(26px, 2.8vw, 38px)/1.25 var(--display); letter-spacing: -0.022em; color: var(--navy); }
.dark .pull { color: #fff; }
.pull-cite { color: var(--muted); }

/* forms */
.field label { color: var(--navy); font-weight: 500; font-size: 14px; }
.field .hint { color: var(--muted); }
.input, .textarea, .select { background: #fff; border: 1px solid var(--line-2); border-radius: 6px; color: var(--navy); font: 15.5px/1.4 var(--body); padding: 11px 14px; box-shadow: 0 1px 1px rgba(0,0,0,.03); }
.input:hover, .textarea:hover, .select:hover { background: #fff; border-color: #c3bcd8; }
.input:focus, .textarea:focus, .select:focus { background: #fff; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(110,63,209,.15); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.chip, .subnav a { background: #fff; color: var(--navy); font: 500 14px/1 var(--body); padding: 9px 14px; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--line-2); }
.chip:hover, .subnav a:hover { color: var(--purple); background: #fff; box-shadow: inset 0 0 0 1px var(--lavender); }
.chip[aria-pressed="true"] { background: var(--navy); color: #fff; box-shadow: none; }
.dark .chip { background: transparent; color: #e9e6f5; box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }

/* tables */
.table-wrap { background: #fff; border-radius: 10px; box-shadow: 0 0 0 1px var(--line); }
table.data th { background: var(--wash); color: var(--muted); font: 500 13px var(--body); border-bottom: 1px solid var(--line); }
table.data td { color: var(--ink-2); border-top: 1px solid var(--line); }
table.data td b { color: var(--navy); font-weight: 500; }
table.data tr:hover td { background: #faf9fd; }

/* music UI */
.key { background: #fff; color: var(--navy); border-radius: 6px; box-shadow: inset 0 0 0 1px var(--line-2); font: 500 14px var(--mono); }
.key.black { background: var(--wash); }
.key:hover { box-shadow: inset 0 0 0 1px var(--purple); }
.key.used { background: var(--navy); color: #fff; box-shadow: none; }
.pc { background: #fff; color: var(--navy); box-shadow: inset 0 0 0 1px var(--line-2); border-radius: 6px; }
.pc.on { background: var(--purple); color: #fff; box-shadow: none; }
.pc.t1 { box-shadow: inset 0 0 0 1.5px var(--purple); }
.matrix td { background: var(--wash); color: var(--ink-2); border-radius: 5px; }
.matrix td.diag { background: var(--navy); color: #fff; }
.tier::before { width: 3px; height: 14px; }

/* FAQ, chapters, works */
.qa { border-color: var(--line) !important; }
.qa summary { font: 500 18px/1.35 var(--display); color: var(--navy); }
.qa summary::after { border-color: var(--slate); }
.qa .ans { color: var(--slate); }
.chapter { border-top: 1px solid var(--line); }
.chapter .n { color: var(--purple); font: 500 15px var(--mono); }
.chapter h3 { color: var(--navy); }
.chapter p { color: var(--slate); }
.part-title { color: var(--muted); font: 500 14px var(--body); }
.era { border-top: 1px solid var(--line); }
.era .yr { color: var(--purple); font: 500 18px var(--mono); }
.work { border-top: 1px solid var(--line); }
.work .links a { background: #fff; color: var(--purple); box-shadow: inset 0 0 0 1px var(--line-2); border-radius: 6px; }
.work .links a:hover { background: var(--navy); color: #fff; box-shadow: none; }
.cite-box { background: var(--wash); box-shadow: none; }
.bib p { color: var(--slate); }

/* chat */
.msg.user .bubble { background: var(--wash); color: var(--navy); box-shadow: none; }
.msg.bot .text { color: var(--ink-2); }
.composer { background: linear-gradient(to top, #fff 70%, rgba(255,255,255,0)); }
.composer form { background: #fff; border-radius: 12px; box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.composer textarea { color: var(--navy); }
.composer button { background: var(--purple); color: #fff; border-radius: 8px; }

/* footer */
.end { background: #fff; border-top: 1px solid var(--line); padding: 72px 0 40px; color: var(--slate); }
.end h4 { color: var(--navy); font: 600 14px var(--body); }
.end a { color: var(--slate); font-size: 14.5px; }
.end a:hover { color: var(--purple); }
.end .brand { color: var(--navy); }
.end p { color: var(--muted) !important; }
.end .legal { border-top: 1px solid var(--line); color: var(--faint); }
.end a.btn-white, .end a.btn-ink { color: #fff; }
.end a.btn-soft { color: var(--purple); }

/* page heroes on inner pages */
.page-hero { padding: clamp(72px, 8vw, 112px) 0 clamp(40px, 4vw, 56px); border-bottom: 1px solid var(--line) !important; }
.page-hero h1 { font-size: clamp(40px, 4.6vw, 60px); }

/* vertical guides */
main { position: relative; }
.guides { position: absolute; inset: 0; pointer-events: none; z-index: 0; display: flex; justify-content: center; }
.guides div { width: min(var(--max), 100% - 48px); height: 100%; border-left: 1px solid var(--line); border-right: 1px solid var(--line);
  background: linear-gradient(90deg, transparent calc(33.33% - .5px), rgba(230,227,239,.6) calc(33.33% - .5px), rgba(230,227,239,.6) calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), rgba(230,227,239,.6) calc(66.66% - .5px), rgba(230,227,239,.6) calc(66.66% + .5px), transparent calc(66.66% + .5px)); }
main > section { z-index: 1; }

@media (max-width: 1060px) { .nav.open .nav-links { background: #fff; } }
@media (max-width: 900px) { .guides { display: none; } .stat + .stat { border-left: 0; } }

/* nav, Stripe layout: logo, menus on the left, actions on the right */
.nav .wrap { display: flex; align-items: center; gap: 28px; }
.nav-links { margin-left: 8px !important; display: flex; gap: 0; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.nav-ask { color: var(--navy); font: 500 15px var(--body); }
.nav-ask:hover { color: var(--slate); }
.nav-right .btn { padding: 9px 16px; }
.nav-more { position: relative; }
.nav-more > button { display: flex; align-items: center; gap: 6px; color: var(--navy); font: 500 15px var(--body); padding: 10px 14px; background: none; border: 0; cursor: pointer; }
.nav-more > button svg { transition: transform .2s; opacity: .6; }
.nav-more.open > button svg { transform: rotate(180deg); }
.nav-more.active > button { color: var(--purple); }
.nav-more .menu { display: block; visibility: hidden; opacity: 0; transform: translateY(6px); transition: opacity .15s, transform .15s, visibility .15s; left: -8px; right: auto; top: 100%; min-width: 300px; padding: 10px; border-radius: 12px; box-shadow: 0 50px 100px -20px rgba(50,50,93,.25), 0 30px 60px -30px rgba(0,0,0,.3), 0 0 0 1px rgba(50,50,93,.06); }
.nav-more.open .menu { visibility: visible; opacity: 1; transform: none; }
.nav-more .menu a { display: block; padding: 10px 12px; border-radius: 8px; }
.nav-more .menu a b { display: block; color: var(--navy); font-weight: 500; font-size: 15px; }
.nav-more .menu a span { display: block; color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.nav-more .menu a:hover { background: var(--wash); }
.nav-more .menu a:hover b { color: var(--purple); }
@media (max-width: 1060px) {
  .nav-links { display: none; } .nav-right .nav-ask { display: none; }
  .nav.open .nav-links { display: flex; flex-direction: column; position: absolute; top: 72px; left: 0; right: 0; background: #fff; padding: 12px 24px 24px; box-shadow: var(--shadow-sm); }
  .nav.open .nav-more .menu { visibility: visible; opacity: 1; transform: none; position: static; box-shadow: none; padding: 0 0 8px; }
}

/* chapter cards with real page thumbnails */
.ch-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-bottom: 12px; }
.ch-card { display: grid; grid-template-columns: 132px 1fr; gap: 22px; background: #fff; border-radius: 12px; padding: 18px; box-shadow: 0 0 0 1px var(--line), 0 13px 27px -18px rgba(50,50,93,.25); color: inherit; transition: box-shadow .2s, transform .2s; }
.ch-card:hover { transform: translateY(-3px); box-shadow: 0 0 0 1px var(--line), var(--shadow); color: inherit; }
.ch-thumb { aspect-ratio: 504 / 720; border-radius: 3px; overflow: hidden; background: #fff; box-shadow: 0 0 0 1px var(--line), 0 8px 18px -10px rgba(50,50,93,.4); }
.ch-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ch-body { display: flex; flex-direction: column; min-width: 0; }
.ch-label { font: 500 13px var(--mono); color: var(--purple); margin-bottom: 6px; }
.ch-body h3 { font-size: 19px; margin: 0 0 8px; }
.ch-body p { color: var(--slate); font-size: 14.5px; line-height: 1.5; margin: 0 0 12px; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.ch-go { margin-top: auto; color: var(--purple); font-size: 14px; font-weight: 500; }
.part-title { margin: 56px 0 18px !important; font: 600 15px var(--body) !important; color: var(--navy) !important; }
.chapter-list > .part-title:first-child { margin-top: 24px !important; }

/* gallery */
.gal { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; margin-top: 48px; }
.gal-item { display: flex; flex-direction: column; background: #fff; border: 0; border-radius: 12px; padding: 0; overflow: hidden; cursor: zoom-in; text-align: left; font: inherit; box-shadow: 0 0 0 1px var(--line), 0 13px 27px -18px rgba(50,50,93,.25); transition: box-shadow .2s, transform .2s; }
.gal-item:hover { transform: translateY(-3px); box-shadow: 0 0 0 1px var(--line), var(--shadow); }
.gal-img { display: grid; place-items: center; height: 230px; padding: 18px; background: #fff; border-bottom: 1px solid var(--line); }
.gal-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.gal-cap { padding: 16px 20px 18px; }
.gal-cap b { display: block; color: var(--navy); font-weight: 500; font-size: 15.5px; line-height: 1.35; }
.gal-cap span { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
.lightbox { border: 0; border-radius: 14px; padding: 0; max-width: min(1100px, 94vw); width: 100%; box-shadow: var(--shadow); }
.lightbox::backdrop { background: rgba(21,13,46,.6); backdrop-filter: blur(4px); }
.lightbox img { width: 100%; display: block; padding: 32px; background: #fff; }
.lb-foot { display: flex; gap: 24px; align-items: center; justify-content: space-between; padding: 18px 28px 24px; border-top: 1px solid var(--line); }
.lb-foot p { margin: 0; color: var(--slate); font-size: 14.5px; line-height: 1.5; }
.lb-foot .btn { flex: none; }
.lb-x { position: absolute; top: 10px; right: 12px; width: 36px; height: 36px; border: 0; background: #fff; border-radius: 8px; font-size: 22px; color: var(--navy); cursor: pointer; }
@media (max-width: 900px) { .ch-grid, .gal { grid-template-columns: 1fr; } .ch-card { grid-template-columns: 96px 1fr; } .lb-foot { flex-direction: column; align-items: flex-start; } }

/* readable text in dark bands */
.dark .spine h3, .dark .spine h4 { color: #fff; }
.dark .spine p { color: #b8b2d3; }

.gal-img { overflow: hidden; height: 240px; }
.gal-img img { max-height: 204px; width: auto; }
.gal-cap b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
