/* =========================================================
   MusoKit v2 — site shell + shared page patterns.
   Load after /css/tokens.css. Page-specific layout lives in the page.
   ========================================================= */

.wrap { width: 100%; max-width: 1312px; margin: 0 auto; padding-left: calc(var(--gutter) + var(--safe-left)); padding-right: calc(var(--gutter) + var(--safe-right)); }
@media (min-width: 400px) { :root { --gutter: 20px; } }
@media (min-width: 960px) { :root { --gutter: 40px; } }
@media (min-width: 1280px) { :root { --gutter: 64px; } }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-weight: 700; text-decoration: none; }
.skip:focus { top: calc(8px + var(--safe-top)); }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ---------- Site header ---------- */
.site-header { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); padding-top: var(--safe-top); }
.site-header .bar { height: 60px; display: flex; align-items: center; gap: 4px; }
.site-header .brand { flex-grow: 1; display: flex; text-decoration: none; color: var(--text); min-height: var(--tap-min); align-items: center; }
.site-header .brand .wordmark { font-size: 28px; }
.top-nav, .search-box, .get-app-btn { display: none; }
@media (min-width: 960px) {
  .site-header { border-bottom: 1px solid var(--line); }
  .site-header .bar { height: 84px; gap: 12px; }
  .site-header .brand { flex-grow: 0; margin-right: 28px; }
  .site-header .brand .wordmark { font-size: 32px; }
  .top-nav { display: flex; gap: 4px; flex-grow: 1; }
  .top-nav a { height: 44px; padding: 0 14px; border-radius: 12px; display: flex; align-items: center; color: var(--text); text-decoration: none; font-size: 16px; font-weight: 500; }
  .top-nav a:hover { background: var(--sunk); }
  .top-nav a[aria-current="page"] { font-weight: 700; box-shadow: inset 0 -3px 0 var(--coral); border-radius: 12px 12px 0 0; }
  .search-icon-btn { display: none; }
  .search-box { display: flex; height: 44px; width: 240px; padding: 0 8px 0 14px; border: 1.5px solid var(--line); border-radius: var(--r-pill); background: var(--surface); color: var(--text-2); font-size: 15px; align-items: center; gap: 10px; }
  .search-box span { flex-grow: 1; text-align: left; }
  .search-box kbd, .kbd { font-family: var(--font-mono); font-size: 12px; padding: 3px 8px; border-radius: 6px; background: var(--sunk); color: var(--text); }
  .app-live .get-app-btn { display: inline-flex; height: 44px; padding: 0 18px; border: 2px solid var(--text); border-radius: var(--r-pill); color: var(--text); text-decoration: none; font-size: 15px; font-weight: 600; align-items: center; }
}

/* ---------- Bottom nav icons (layout in tokens.css) ---------- */
.bottom-nav a .pill .ic { color: var(--text-2); }
.bottom-nav a[aria-current="page"] .pill .ic { color: var(--ink-fixed); }

/* ---------- App promo: hidden until the Play listing is live, and inside the app ---------- */
.app-promo { display: none !important; }
.app-live .app-promo { display: flex !important; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 56px; padding: 24px 0 32px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 18px; }
.site-footer .wordmark { font-size: 26px; }
.site-footer .foot-tag { font-size: 15px; color: var(--text-2); margin: 0; }
.site-footer .foot-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; }
.site-footer .foot-col { display: contents; }
.site-footer .foot-col h2 { display: none; }
.site-footer .foot-col a { height: 44px; display: flex; align-items: center; color: var(--text); text-decoration: none; font-size: 15px; }
.site-footer .foot-col.tools { display: none; }
.site-footer small { font-size: 13px; color: var(--text-2); }
@media (min-width: 960px) {
  .site-footer { margin-top: 88px; background: var(--ink-fixed); color: #F3EEE6; border: 0; padding: 48px 0 40px; }
  .site-footer .foot-inner { display: grid; grid-template-columns: 1.6fr repeat(4, 1fr); gap: 40px; }
  .site-footer .foot-brand { display: flex; flex-direction: column; gap: 14px; }
  .site-footer small { grid-column: 1 / -1; }
  .site-footer small a { color: #F3EEE6; }
  .site-footer .wordmark { color: #F3EEE6; font-size: 32px; }
  .site-footer .foot-tag, .site-footer small { color: #A7A39C; }
  .site-footer .foot-cols { display: contents; }
  .site-footer .foot-col { display: flex; flex-direction: column; gap: 10px; }
  .site-footer .foot-col h2 { display: block; font-family: var(--font-body); font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #A7A39C; margin: 0 0 2px; }
  .site-footer .foot-col a { height: auto; min-height: 28px; color: #F3EEE6; }
  .site-footer .foot-col a:hover { color: var(--coral); }
  .site-footer .foot-col.tools { display: flex; }
}
@media (max-width: 959px) { .site-footer .foot-inner { display: flex; flex-direction: column; gap: 18px; } }

/* ---------- Search dialog ---------- */
.search-dialog { border: 0; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: min(640px, 80vh); border-radius: 24px; background: var(--surface); color: var(--text); box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); }
.search-dialog::backdrop { background: rgba(18,21,29,.5); }
.search-dialog .sd-top { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--line); }
.search-dialog input { flex-grow: 1; height: 48px; border: 0; background: transparent; font-size: 18px; outline: none; }
.search-dialog ul { list-style: none; margin: 0; padding: 8px; overflow: auto; max-height: calc(min(640px, 80vh) - 80px); }
.search-dialog li a { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 6px 12px; border-radius: 14px; color: var(--text); text-decoration: none; }
.search-dialog li a:hover, .search-dialog li a.is-active { background: var(--sunk); }
.search-dialog li small { display: block; color: var(--text-2); font-size: 14px; }
.search-dialog .empty { padding: 20px; color: var(--text-2); }

/* ---------- Shared content patterns (tool + content pages) ---------- */
.section-title { font-size: var(--fs-h2); margin: 0 0 16px; }
.quick-answer { background: var(--sunk); border-radius: 24px; padding: 22px; }
.quick-answer .tag { background: var(--text); color: var(--bg); margin-bottom: 12px; height: 30px; font-size: 13px; }
.quick-answer h2 { font-size: 22px; margin-bottom: 8px; }
.quick-answer p { margin: 0; }
.quick-answer .qa-meta { display: block; margin-top: 10px; font-size: 14px; color: var(--text-2); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; counter-reset: step; }
.steps li { counter-increment: step; display: flex; gap: 14px; align-items: flex-start; }
.steps li::before { content: counter(step); flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--coral); color: var(--ink-fixed); font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.faq { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { min-height: 60px; display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 700; font-size: 17px; list-style: none; padding: 8px 0; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; margin-left: auto; width: 10px; height: 10px; border-right: 2.4px solid var(--text-2); border-bottom: 2.4px solid var(--text-2); transform: rotate(45deg) translate(-2px,-2px); transition: transform var(--t-med) var(--ease-out); flex-shrink: 0; }
.faq details[open] summary::after { transform: rotate(-135deg) translate(-2px,-2px); }
.faq details p { margin: 0 0 18px; color: var(--text-2); }
.related { display: grid; gap: 8px; }
.row-link:hover { border-color: var(--text-2); }
.row-link strong { display: block; font-size: 16px; }
.row-link span.sub { display: block; font-size: 14px; color: var(--text-2); }
.row-link .grow { flex-grow: 1; min-width: 0; }
.row-link .chev { color: var(--text-2); }
.prose { max-width: 72ch; }
.prose h2 { font-size: var(--fs-h2); margin: 40px 0 12px; }
.prose h3 { font-size: var(--fs-h3); margin: 28px 0 8px; }
.prose p, .prose li { color: var(--text); }
.prose ul, .prose ol { padding-left: 1.3em; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom)); transform: translate(-50%, 20px); z-index: 60; min-height: 48px; padding: 0 8px 0 18px; border-radius: var(--r-pill); background: var(--text); color: var(--bg); display: flex; align-items: center; gap: 8px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity var(--t-med), transform var(--t-med) var(--ease-out); }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { height: 40px; padding: 0 14px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--coral); font-weight: 700; }
@media (min-width: 960px) { .toast { bottom: 32px; } }

/* =========================================================
   Tool page template (tuner, metronome, drum machine, every tool)
   DOM order = phone order: tool → quick answer → how to → prose → FAQ → related.
   Desktop regroups into tool + right rail, then content + "On this page".
   ========================================================= */
@media (max-width: 959px) { body.tool-page .site-header { display: none; } }
.tool-header .back { color: var(--text); flex-shrink: 0; }
.tool-header .h-titles { flex: 1; min-width: 0; }
.tool-header h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-header .h-action { flex-shrink: 0; }
.tool-header .h-meta, .crumbs, .kbd-card, .on-page { display: none; }
.pill-btn { height: 44px; padding: 0 12px 0 16px; border: 1.5px solid var(--line); border-radius: var(--r-pill); background: transparent; color: var(--text); font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.pill-btn .muted { font-weight: 500; }
.tool-layout { display: flex; flex-direction: column; gap: 36px; padding-top: 4px; }
.tool-layout > * { min-width: 0; }
.tool-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-card); padding: 22px 18px; }
.tool-layout .blk h2 { font-size: 26px; margin-bottom: 16px; }
.kbd-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 14px; align-items: center; font-size: 15px; }
.kbd-grid kbd { font-family: var(--font-mono); font-size: 13px; padding: 4px 10px; border-radius: 8px; background: var(--sunk); justify-self: start; }
.rail-title { font-family: var(--font-body); font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); margin: 0 0 10px; }
.steps strong { display: block; font-size: 17px; }
.steps .sb { display: block; color: var(--text-2); }
@media (min-width: 960px) {
  .tool-header { position: static; height: auto; display: block; background: transparent; max-width: 1312px; margin: 0 auto; padding: 36px calc(var(--gutter) + var(--safe-right)) 0 calc(var(--gutter) + var(--safe-left)); }
  .tool-header .back { display: none; }
  .crumbs { display: flex; gap: 8px; font-size: 14px; color: var(--text-2); margin-bottom: 10px; }
  .crumbs a { color: var(--text-2); }
  .tool-header .h-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; }
  .tool-header h1 { font-size: var(--fs-h1); line-height: 1.05; letter-spacing: -.035em; }
  .tool-header .h-meta { display: block; font-size: 15px; color: var(--text-2); padding-bottom: 10px; }
  .tool-header .h-action { display: none; }
  .tool-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; grid-template-rows: auto auto 1fr; column-gap: 24px; row-gap: 20px; padding-top: 28px; align-items: start;
    grid-template-areas: "tool qa" "tool kbd" "tool rel" "howto onpage" "prose onpage" "faq onpage"; }
  .tool-layout > .tool-card { grid-area: tool; border-radius: 32px; padding: 40px 48px; }
  .tool-layout > .qa { grid-area: qa; }
  .tool-layout > .kbd-card { grid-area: kbd; display: flex; flex-direction: column; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 24px 26px; }
  .tool-layout > .rel { grid-area: rel; }
  .tool-layout > .howto { grid-area: howto; margin-top: 68px; max-width: 760px; }
  .tool-layout > .prose-blk { grid-area: prose; max-width: 760px; }
  .tool-layout > .faq-blk { grid-area: faq; max-width: 760px; margin-top: 44px; }
  .tool-layout > .on-page { grid-area: onpage; display: flex; flex-direction: column; gap: 4px; margin-top: 68px; padding: 8px 0 0 24px; border-left: 1px solid var(--line); position: sticky; top: 108px; }
  .on-page a { height: 40px; display: flex; align-items: center; color: var(--text); text-decoration: none; font-size: 15px; }
  .on-page a:hover { color: var(--link); }
  .tool-layout .blk h2 { font-size: 34px; margin-bottom: 24px; }
  .tool-layout .qa h2 { font-size: 22px; }
  .howto .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 32px; }
  .rel .rail-title { margin-top: 6px; }
}
