/* TonalScript website. Shares the editor's quiet palette, system type and
 * control sizes (src/ui-theme.css, src/styles.css) so the site and the app
 * read as one product. The music itself uses the editor's notation fonts. */
@font-face { font-family: TonalScriptNotation; src: url('/fonts/TonalScript-Notation.woff?v=3') format('woff'); font-display: swap; }
@font-face { font-family: 'STIX Two Text'; src: url('/fonts/STIXTwoText-Regular.woff2') format('woff2'); font-display: swap; }

:root {
  color-scheme: light;
  --page: #f5f6f8;
  --panel: #fff;
  --paper: #fff;
  --field: #fff;
  --text: #20252d;
  --text-soft: #273449;
  --muted: #62728a;
  --border: #dce3ed;
  --control-border: #cdd3dd;
  --hover: #eef2f8;
  --accent: #2867ca;
  --accent-hover: #1f58b0;
  --accent-text: #fff;
  --selected: #e6efff;
  --selected-border: #779ce1;
  --selected-text: #174b9b;
  --ink: #000;
  --playhead: #2670ee;
  --shadow: 0 2px 8px rgba(37, 60, 94, .035);
  --ui-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", system-ui, sans-serif;
  --notation-font: TonalScriptNotation, "DejaVu Sans", system-ui, sans-serif;
  font: 15px/1.6 var(--ui-font);
  color: var(--text);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #171717;
    --panel: #202020;
    --paper: #f7f7f5;
    --field: #161616;
    --text: #f1f1f1;
    --text-soft: #e6e6e6;
    --muted: #ababab;
    --border: #363636;
    --control-border: #464646;
    --hover: #2b2b2b;
    --accent: #e8e8e8;
    --accent-hover: #fff;
    --accent-text: #171717;
    --selected: #353535;
    --selected-border: #6a6a6a;
    --selected-text: #f1f1f1;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body, figure, pre { margin: 0; }
body { min-height: 100vh; display: flex; flex-direction: column; background: var(--page); }
main { flex: 1; }
h1, h2, h3, p { margin-top: 0; }
a { color: inherit; }
:is(a, button, input, summary):focus-visible { outline: 2px solid #4d7ed1; outline-offset: 2px; border-radius: 6px; }
code { font-family: var(--notation-font); font-size: 1.02em; font-variant-ligatures: none; }
.skip { position: absolute; left: .5rem; top: .5rem; transform: translateY(-200%); padding: .5rem .75rem; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; z-index: 10; }
.skip:focus { transform: none; }
.wrap { width: min(100% - 32px, 72rem); margin-inline: auto; }

/* Masthead — the same thin white bar as the editor. */
.site-header { position: sticky; top: 0; z-index: 5; background: var(--panel); border-bottom: 1px solid var(--border); }
.header-row, .site-header.wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; }
.site-header.wrap { width: 100%; padding-inline: max(16px, calc((100% - 72rem) / 2)); }
.site-header nav { display: flex; align-items: center; gap: 4px; font-size: 13px; }
.site-header nav a { display: inline-flex; align-items: center; min-height: 36px; padding: 0 10px; border-radius: 6px; text-decoration: none; color: var(--text-soft); }
.site-header nav a:hover { background: var(--hover); }
.brand { display: inline-flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 650; letter-spacing: -.025em; text-decoration: none; color: var(--text); }
.brand img { border-radius: 7px; }
.brand.small { font-size: 14px; }
.site-header nav a.header-app { margin-left: 6px; color: var(--accent-text); background: var(--accent); font-weight: 600; }
.site-header nav a.header-app:hover { background: var(--accent-hover); }

/* Buttons — editor control metrics, slightly larger for a landing page. */
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--control-border); background: var(--panel); color: var(--text-soft); font-size: 14px; font-weight: 600; text-decoration: none; transition: background .1s, border-color .1s; }
.button:hover { background: var(--hover); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* First screen: words on the left, the actual Split view on the right. */
.hero { display: grid; gap: clamp(24px, 4vw, 40px); padding-block: clamp(32px, 6vw, 64px) clamp(32px, 5vw, 56px); }
.hero-text { max-width: 40rem; }
.eyebrow { margin-bottom: 12px; color: var(--muted); font-size: 13px; font-weight: 500; }
.hero h1 { margin-bottom: 16px; font-size: clamp(30px, 4.2vw, 46px); line-height: 1.12; font-weight: 650; letter-spacing: -.03em; }
.lead { max-width: 30rem; margin-bottom: 24px; color: var(--muted); font-size: 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.hero-note { margin: 14px 0 0; color: var(--muted); font-size: 13px; }

.split { min-width: 0; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; }
#demo { scroll-margin-top: 68px; }
.split-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 4px 14px; border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--text-soft); }
.demo-reset { min-height: 36px; border: 0; background: transparent; color: var(--muted); font: inherit; cursor: pointer; }
.demo-reset:hover:not(:disabled) { color: var(--text); text-decoration: underline; }
.demo-reset:disabled { opacity: .6; cursor: default; }
.split-body { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); }
.pane { min-width: 0; padding: 12px 14px 14px; }
.script-pane { border-right: 1px solid var(--border); }
.pane-title { margin-bottom: 8px; font-size: 13px; font-weight: 600; letter-spacing: -.01em; }
.script { font: 15px/1.9 var(--notation-font); color: var(--text-soft); overflow-wrap: anywhere; }
.script-line { display: flex; align-items: baseline; gap: .45em; }
.script .tag { flex: none; color: var(--muted); white-space: nowrap; }
.script .data { color: var(--muted); }
.script-input { flex: 1; min-width: 0; width: 100%; padding: 2px 6px; margin-left: -6px; font: inherit; color: var(--text); background: transparent; border: 1px solid transparent; border-radius: 6px; }
.script-input:hover { border-color: var(--border); }
.script-input:focus { outline: none; border-color: var(--selected-border); background: var(--field); }
.script-input[aria-invalid=true] { border-color: #d27a4b; }
.hint { margin: 10px 0 0; color: var(--muted); font: 12px/1.5 var(--ui-font); white-space: normal; }
.score-paper { background: var(--paper); color: var(--ink); border-radius: 8px; padding: 12px 10px; }
.score-pane .score-paper { border: 1px solid var(--border); }
.score-svg { display: block; width: 100%; height: auto; }
.score-svg :is(path, rect) { fill: currentColor; }
.score-svg [fill=none], .score-svg .stem, .score-svg .ledger, .score-svg .vf-stave path { fill: none; stroke: currentColor; }
.score-svg .vf-stave path, .score-svg .ledger { stroke-width: 1; }
.score-svg .stem { stroke-width: 1.5; }
.score-svg text { fill: currentColor; font-size: 20px; }
.score-svg .chord { font: 700 20px "Times New Roman", "STIX Two Text", serif; }
.score-svg .analysis { font-family: 'STIX Two Text', "Times New Roman", serif; }
.score-svg .lyric { font-family: "Times New Roman", "STIX Two Text", serif; }
.score-svg .measure-number { font: 15px "Times New Roman", serif; }
.score-svg .note.is-playing { color: var(--playhead); }
.score-svg .playhead { fill: var(--playhead); opacity: .28; }
.split-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.icon-button { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 10px; border: 1px solid var(--control-border); border-radius: 6px; background: var(--panel); color: var(--text-soft); font: 500 13px var(--ui-font); cursor: pointer; }
.icon-button:hover { background: var(--hover); }
.demo-open { margin-inline-start: auto; }
.icon-button[aria-pressed=true] { background: var(--selected); border-color: var(--selected-border); color: var(--selected-text); }
.play-icon { font-size: 10px; }
.status::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: #3aa76d; vertical-align: 1px; }
.status.is-warning::before { background: #d27a4b; }

/* Sections below the fold stay plain and document-like. */
.how, .instruments, .open { padding-block: clamp(28px, 5vw, 56px); border-top: 1px solid var(--border); }
section > h2 { margin-bottom: 18px; font-size: 20px; font-weight: 650; letter-spacing: -.02em; }
.rows { display: grid; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.row { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: 20px; align-items: start; padding: 16px 18px; background: var(--panel); }
.row h3, .card h3 { margin-bottom: 4px; font-size: 15px; font-weight: 600; }
.row p, .card p { margin: 0; color: var(--muted); }
.snippet { justify-self: start; padding: 3px 10px; border-radius: 6px; background: var(--page); border: 1px solid var(--border); color: var(--text-soft); white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.chips li { padding: 4px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--panel); font-size: 13px; color: var(--text-soft); }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.card { padding: 16px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }
.card a { color: var(--selected-text); }
.closing { margin-top: 28px; }

.site-footer { border-top: 1px solid var(--border); background: var(--panel); }
.footer-row, .site-footer.wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; min-height: 56px; font-size: 13px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.site-footer nav a { color: var(--muted); text-decoration: none; }
.site-footer nav a:hover { color: var(--text); }

/* Plans, help and other service pages. */
.service { width: min(100% - 32px, 45rem); margin: clamp(28px, 6vw, 64px) auto; }
.service h1 { font-size: clamp(26px, 4vw, 34px); line-height: 1.2; font-weight: 650; letter-spacing: -.025em; }
.service h2 { font-size: 16px; font-weight: 600; }
.service section { border-top: 1px solid var(--border); padding-block: 16px; }
.service details { padding-block: 8px; }
.service summary { cursor: pointer; font-weight: 600; }
.service a { color: var(--selected-text); }

@media (max-width: 960px) {
  .split-body { grid-template-columns: 1fr; }
  .script-pane { border-right: 0; border-bottom: 1px solid var(--border); }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  :root { font-size: 15px; }
  .site-header nav .quiet-link { display: none; }
  .split-body { grid-template-columns: 1fr; }
  .script-pane { border-right: 0; border-bottom: 1px solid var(--border); }
  .script-input { font-size: 16px; }
  .split-foot .status { flex: 1; }
  .demo-open { width: 100%; margin-inline-start: 0; }
  .row { grid-template-columns: 1fr; gap: 8px; }
  .cards { grid-template-columns: 1fr; }
  .actions .button { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
