/* Hearmony site. Same identity as the app (DESIGN.md): mist + porcelain + graphite, one raspberry accent,
   resin hues only on ladder steps; Bodoni Moda 28 for display, Sofia Sans for text; the analysis-bracket headline. */
@font-face { font-family: 'Bodoni Moda'; src: url('/fonts/bodoni-600.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Bodoni Moda'; src: url('/fonts/bodoni-500i.woff2') format('woff2'); font-weight: 500; font-style: italic; font-display: swap; }
@font-face { font-family: 'Sofia Sans'; src: url('/fonts/sofia-400.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Sofia Sans'; src: url('/fonts/sofia-500.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Sofia Sans'; src: url('/fonts/sofia-600.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'HM Glyphs'; src: url('/fonts/hm-glyphs.woff2') format('woff2'); unicode-range: U+266D-266F, U+1D12A-1D12B; font-display: swap; }

:root {
  --canvas: #ecedf1;
  --surface: #fafafb;
  --sunk: #e3e5eb;
  --ink: #1a1b21;
  --ink-soft: #5a5d6a;
  --hair: #d2d4dc;
  --accent: #c8195c;
  --accent-press: #9e1047;
  --on-accent: #ffffff;
  --correct: #157552;
  --wrong: #b4431a;
  --r0: #f28881; --r1: #47b7f1; --r2: #d0a43a; --r3: #b199f4; --r4: #73c076; --r5: #ea86af;
  --r6: #04c1d0; --r7: #e99355; --r8: #82a8fd; --r9: #a8b44b; --r10: #d48dd8; --r11: #2dc5a6;
  --display: 'Bodoni Moda', 'Hiragino Mincho ProN', 'Yu Mincho', 'AppleMyungjo', 'Nanum Myeongjo', Georgia, serif;
  --text: 'Sofia Sans', 'HM Glyphs', 'Helvetica Neue', Arial, 'Hiragino Sans', 'Apple SD Gothic Neo', 'Malgun Gothic', 'Yu Gothic UI', system-ui, sans-serif;
  --radius: 8px;
  --gutter: 20px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #121219;
    --surface: #1b1c25;
    --sunk: #0d0d13;
    --ink: #ececf2;
    --ink-soft: #a2a4b3;
    --hair: #2e3040;
    --accent: #ff5c93;
    --accent-press: #e23d78;
    --on-accent: #121219;
    --correct: #4fd39a;
    --wrong: #ff8a5b;
    --r0: #ffa098; --r1: #69caff; --r2: #e7b643; --r3: #c3affe; --r4: #81d584; --r5: #fe9ac2;
    --r6: #07d6e7; --r7: #ffa666; --r8: #9ebdff; --r9: #bbc855; --r10: #eb9def; --r11: #34dbb9;
  }
}
@media (prefers-color-scheme: dark) {
  /* the 3D art keeps its mist backdrop in dark mode (DESIGN.md: never a dark backdrop), on a print card like the app */
  .hero-art .resin { background: #ecedf1; border-radius: 28px; }
}
:lang(ja) { --text: 'Sofia Sans', 'HM Glyphs', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic UI', 'Meiryo', system-ui, sans-serif; --display: 'Bodoni Moda', 'Hiragino Mincho ProN', 'Yu Mincho', serif; }
:lang(ko) { --text: 'Sofia Sans', 'HM Glyphs', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif; --display: 'Bodoni Moda', 'AppleMyungjo', 'Nanum Myeongjo', 'Batang', serif; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 400 17px/1.6 var(--text); font-feature-settings: 'kern'; }
:lang(ko) body, :lang(ko) p, :lang(ko) li, :lang(ko) td { word-break: keep-all; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
[hidden] { display: none !important; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-press); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.wrap { width: min(1120px, 100% - 2 * var(--gutter)); margin-inline: auto; }
.narrow { width: min(720px, 100% - 2 * var(--gutter)); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 12px; top: 12px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.vh { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.num, td, .tab { font-variant-numeric: tabular-nums; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 600 26px/1 var(--display); letter-spacing: -0.01em; }
.brand img { width: 34px; height: 34px; border-radius: 8px; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; font-size: 15px; }
.nav a { color: var(--ink-soft); text-decoration: none; }
.nav a:hover, .nav a[aria-current='page'] { color: var(--ink); text-decoration: underline; text-underline-offset: 5px; }
.lang { position: relative; }
.lang summary { list-style: none; cursor: pointer; color: var(--ink-soft); font-size: 15px; display: flex; align-items: center; gap: 6px; }
.lang summary::-webkit-details-marker { display: none; }
.lang ul { position: absolute; right: 0; top: calc(100% + 8px); margin: 0; padding: 6px; list-style: none; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); min-width: 160px; z-index: 5; }
.lang li a { display: block; padding: 6px 10px; color: var(--ink); text-decoration: none; border-radius: 6px; }
.lang li a:hover, .lang li a[aria-current='true'] { background: var(--sunk); }

/* the analysis bracket (app headline technique): one colour sentence, a square bracket under the key phrase,
   a small italic label in the term face */
.display { font: 600 clamp(40px, 6.4vw, 76px)/1.06 var(--display); letter-spacing: -0.015em; margin: 0; text-wrap: pretty; }
h2.display { text-wrap: balance; }
h2.display { font-size: clamp(30px, 3.6vw, 44px); line-height: 1.1; }
.br { display: inline-flex; flex-direction: column; align-items: center; vertical-align: top; }
.br-phrase { position: relative; padding: 0 0.06em; }
.br-phrase::after { content: ''; position: absolute; left: 0; right: 0; bottom: -0.1em; height: 0.2em; border: 1.5px solid var(--accent); border-top: 0; border-radius: 0 0 1px 1px; }
.br-label { font: italic 500 0.34em/1 var(--display); color: var(--accent); margin-top: 0.42em; letter-spacing: 0; }
.lead { font-size: clamp(18px, 1.6vw, 21px); color: var(--ink-soft); max-width: 40em; margin: 22px 0 0; }

/* buttons: piano keys (square top, rounded front edge, darker edge underneath) */
.key { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 22px; border: 0; border-radius: 4px 4px 12px 12px; font: 600 17px/1 var(--text); cursor: pointer; text-decoration: none; transition: transform 0.08s ease, box-shadow 0.08s ease; }
.key-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 3px 0 var(--accent-press); }
.key-secondary { background: var(--surface); color: var(--ink); box-shadow: 0 3px 0 var(--hair), inset 0 0 0 1px var(--hair); }
.key:hover { color: inherit; }
.key-primary:hover { color: var(--on-accent); }
.key:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--accent-press); }
.key-secondary:active { box-shadow: 0 1px 0 var(--hair), inset 0 0 0 1px var(--hair); }
.key svg { width: 20px; height: 20px; }
.key[aria-pressed='true'] { background: var(--ink); color: var(--canvas); box-shadow: 0 3px 0 #000; }
.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin-top: 30px; }
.cta-note { color: var(--ink-soft); font-size: 15px; margin: 0; }

/* hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 40px; align-items: center; padding: 34px 0 30px; }
.hero-art { position: relative; justify-self: end; width: min(500px, 100%); }
.hero-art .shot { position: absolute; z-index: 1; right: 0; bottom: -4%; width: 44%; border-radius: 22px; box-shadow: 0 24px 48px -24px rgba(26, 27, 33, 0.35); border: 1px solid var(--hair); background: var(--surface); }
.hero-art .resin { position: relative; z-index: 0; width: 88%; pointer-events: none; }

/* staff rule divider: five hairlines */
.staff-rule { height: 13px; margin-block: 56px; background: repeating-linear-gradient(to bottom, var(--hair) 0 1px, transparent 1px 3px); background-size: 100% 13px; }

/* sections */
section { padding: 8px 0 18px; }
.section-head { max-width: 46em; margin-bottom: 26px; }
.section-head p { color: var(--ink-soft); margin: 14px 0 0; }
.steps { counter-reset: s; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; padding: 0; margin: 0; list-style: none; }
.steps li { background: var(--surface); border-radius: var(--radius); padding: 22px 20px 20px; position: relative; }
.steps li::before { counter-increment: s; content: counter(s); font: 600 34px/1 var(--display); color: var(--accent); display: block; margin-bottom: 12px; }
.steps h3 { font: 600 19px/1.25 var(--text); margin: 0 0 6px; }
.steps p { margin: 0; color: var(--ink-soft); font-size: 16px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 36px; align-items: start; }
.shots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 30px; }
.shots figure { margin: 0; }
.shots img { border-radius: 22px; border: 1px solid var(--hair); background: var(--surface); }
.shots figcaption { font-size: 14px; color: var(--ink-soft); margin-top: 10px; }
.panel { background: var(--surface); border-radius: var(--radius); padding: 24px 24px 22px; }
.panel h3 { font: 600 24px/1.2 var(--display); margin: 0 0 12px; }
.plain-list { margin: 0; padding: 0 0 0 1.1em; }
.plain-list li { margin: 4px 0; }
.plain-list li::marker { color: var(--accent); }
.fine { font-size: 15px; color: var(--ink-soft); }

/* ladder ornament (resin steps drawn in CSS) */
.ladder { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.ladder li { height: 30px; border-radius: 6px 6px 8px 8px; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.16); display: flex; align-items: center; padding: 0 12px; font: 500 15px/1 var(--text); color: #1a1b21; }

/* tables */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--hair); }
table { border-collapse: collapse; width: 100%; font-size: 16px; }
caption { text-align: left; padding: 14px 16px 0; color: var(--ink-soft); font-size: 14px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--hair); white-space: nowrap; }
thead th { font: 600 14px/1.3 var(--text); color: var(--ink-soft); background: var(--surface); position: sticky; top: 0; }
tbody th { font-weight: 600; position: sticky; left: 0; background: var(--surface); }
tr:last-child td, tr:last-child th { border-bottom: 0; }
td.hl, th.hl { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.cell-name { font-size: 17px; }
.wrap-cells td { white-space: normal; min-width: 150px; }

/* note picker keyboard */
.kbd { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); position: relative; height: 150px; max-width: 520px; user-select: none; margin: 8px 0 18px; }
.kbd button { font: 600 14px/1 var(--text); border: 1px solid var(--hair); cursor: pointer; }
.kbd .w { background: #fafafb; color: #1a1b21; border-radius: 0 0 10px 10px; height: 150px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 12px; box-shadow: inset 0 -4px 0 #e3e5eb; }
.kbd .b { position: absolute; top: 0; width: 9%; height: 92px; background: #1a1b21; color: #ecedf1; border-radius: 0 0 8px 8px; z-index: 2; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 8px; font-size: 11px; }
.kbd button[aria-pressed='true'] { background: var(--accent); color: #fff; }
.kbd button.lit { box-shadow: inset 0 -4px 0 var(--accent-press); }

/* the tests and tools */
.tool { background: var(--surface); border-radius: 14px; padding: 22px; border: 1px solid var(--hair); }
.tool-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.answer-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.answer-grid .key { min-height: 48px; padding: 0 6px; font-size: 16px; }
.status { min-height: 1.6em; margin: 16px 0 0; font-weight: 500; }
.status.ok { color: var(--correct); }
.status.no { color: var(--wrong); }
.score { font: 600 clamp(40px, 6vw, 64px)/1 var(--display); margin: 8px 0; }
.toggle { display: inline-flex; align-items: center; gap: 10px; font-size: 16px; cursor: pointer; }
.toggle input { width: 20px; height: 20px; accent-color: var(--accent); }
.play-cell { display: flex; gap: 6px; }
.play-cell .key { min-height: 38px; padding: 0 12px; font-size: 14px; border-radius: 3px 3px 9px 9px; }
.song { display: block; }
.song small { display: block; color: var(--ink-soft); font-size: 13px; }

/* staff charts */
.staff-chart { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--hair); padding: 18px 10px 10px; overflow-x: auto; }
.staff-chart svg { min-width: 760px; width: 100%; height: auto; color: var(--ink); }
.staff-chart text { font: 500 13px var(--text); fill: var(--ink-soft); }
.staff-chart .mid { fill: var(--accent); }

/* tool cards on the home page */
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.card { display: block; background: var(--surface); border-radius: var(--radius); padding: 20px; color: var(--ink); text-decoration: none; border: 1px solid transparent; }
.card:hover { border-color: var(--hair); color: var(--ink); }
.card h3 { font: 600 20px/1.2 var(--display); margin: 0 0 8px; }
.card p { margin: 0; color: var(--ink-soft); font-size: 15px; }
.card .steps-mini { display: flex; gap: 3px; align-items: flex-end; height: 26px; margin-bottom: 14px; }
.card .steps-mini span { width: 14px; border-radius: 3px 3px 4px 4px; }

/* prose pages */
.prose h2 { font: 600 clamp(26px, 3vw, 34px)/1.15 var(--display); margin: 44px 0 12px; }
.prose h3 { font: 600 19px/1.3 var(--text); margin: 28px 0 8px; }
.prose p, .prose li { max-width: 68ch; }
.prose ul { padding-left: 1.2em; }
.prose li::marker { color: var(--accent); }
.updated { color: var(--ink-soft); font-size: 15px; }
.faq dt { font-weight: 600; margin-top: 18px; }
.faq dd { margin: 4px 0 0; color: var(--ink-soft); max-width: 68ch; }

/* footer */
.foot { margin-top: 72px; padding: 30px 0 40px; border-top: 1px solid var(--hair); color: var(--ink-soft); font-size: 15px; }
.foot-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.foot a { color: var(--ink-soft); }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 24px; }
  .hero-art { width: min(380px, 100%); justify-self: center; margin-bottom: 30px; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .answer-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .top { flex-wrap: wrap; }
  .nav { gap: 2px 14px; font-size: 14px; }
  .steps, .cards { grid-template-columns: 1fr; }
  .shots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shots figure:last-child { display: none; }
  .answer-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kbd { height: 128px; }
  .kbd .w { height: 128px; }
  .kbd .b { height: 78px; }
  .staff-rule { margin-block: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
tr.own th, tr.own td { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
tr.own th { color: var(--accent); }
