/* SUNO.click — Audio Engineering, DSP & Mastering Reference Portal
   System fonts only, no external requests. */

:root {
  --ink: #15171c;
  --ink-soft: #3a3f4b;
  --muted: #5d6371;
  --line: #e3e0d9;
  --line-strong: #d3cfc6;
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-alt: #f4f2ed;
  --navy: #131727;
  --navy-2: #1c2237;
  --navy-line: rgba(255, 255, 255, 0.10);
  --on-navy: #e9ecf4;
  --on-navy-muted: #b5bccd;
  --accent: #c2410c;
  --accent-strong: #9a3412;
  --accent-bright: #fb923c;
  --accent-soft: #fff3ea;
  --teal: #0f766e;
  --teal-soft: #eaf6f3;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(19, 23, 39, 0.05), 0 6px 20px rgba(19, 23, 39, 0.06);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --max: 1160px;
  --prose: 720px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; height: auto; display: block; }

a { color: var(--accent-strong); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent-bright); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3, h4 { line-height: 1.22; letter-spacing: -0.015em; color: var(--ink); margin: 0 0 0.6em; }
h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 2.9rem); font-weight: 800; }
h2 { font-size: clamp(1.4rem, 1.2rem + 0.8vw, 1.75rem); font-weight: 750; }
h3 { font-size: 1.2rem; font-weight: 700; }
p { margin: 0 0 1.1em; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 20px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--accent-bright); color: var(--navy); font-weight: 700;
  padding: 10px 14px; border-radius: var(--radius-sm); text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--navy);
  border-bottom: 1px solid var(--navy-line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 16px; }

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.brand:hover { color: #fff; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-name { font-weight: 800; font-size: 1.2rem; letter-spacing: 0.01em; }
.brand-name span { color: var(--accent-bright); }
.brand-tag { display: none; font-size: 0.75rem; color: var(--on-navy-muted); border-left: 1px solid var(--navy-line); padding-left: 10px; margin-left: 2px; line-height: 1.25; max-width: 150px; }
@media (min-width: 1100px) { .brand-tag { display: block; } }

.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.site-nav a {
  display: block; padding: 8px 12px; border-radius: var(--radius-sm);
  color: var(--on-navy); text-decoration: none; font-size: 0.95rem; font-weight: 550;
}
.site-nav a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.site-nav a[aria-current="page"], .site-nav a.is-active { color: #fff; box-shadow: inset 0 -2px 0 var(--accent-bright); border-radius: 0; }

.nav-toggle {
  display: none; width: 44px; height: 44px; border: 1px solid var(--navy-line); border-radius: var(--radius-sm);
  background: transparent; color: #fff; cursor: pointer; padding: 0; position: relative;
}
.nav-toggle .bar { position: absolute; left: 12px; right: 12px; height: 2px; background: currentColor; border-radius: 2px; transition: transform 0.2s ease, opacity 0.2s ease; }
.nav-toggle .bar:nth-child(2) { top: 15px; }
.nav-toggle .bar:nth-child(3) { top: 21px; }
.nav-toggle .bar:nth-child(4) { top: 27px; }
.nav-toggle[aria-expanded="true"] .bar:nth-child(2) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bar:nth-child(3) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .bar:nth-child(4) { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 899px) {
  .nav-toggle { display: inline-block; }
  .site-nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    background: var(--navy); border-bottom: 1px solid var(--navy-line);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.25);
  }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; padding: 8px 12px 16px; gap: 2px; }
  .site-nav a { padding: 12px 12px; font-size: 1.05rem; }
  .site-nav a[aria-current="page"], .site-nav a.is-active { box-shadow: inset 3px 0 0 var(--accent-bright); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 999px; font-weight: 700; font-size: 1rem;
  text-decoration: none; border: 1px solid transparent; cursor: pointer; font-family: inherit; line-height: 1.2;
}
.btn-primary { background: var(--accent-bright); color: var(--navy); }
.btn-primary:hover { background: #fdba74; color: var(--navy); }
.btn-ghost { border-color: rgba(255, 255, 255, 0.35); color: #fff; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--ink-soft); color: var(--ink); }

/* ---------- Hero ---------- */
.hero {
  background: radial-gradient(1200px 400px at 85% 0%, rgba(251, 146, 60, 0.13), transparent 60%), linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  color: var(--on-navy);
  padding: 56px 0 64px;
}
.hero-grid { display: grid; gap: 40px; align-items: center; }
@media (min-width: 960px) { .hero-grid { grid-template-columns: 1.15fr 0.85fr; } }
.hero h1 { color: #fff; max-width: 15ch; }
.hero .eyebrow { color: var(--accent-bright); }
.hero-lead { font-size: 1.15rem; color: var(--on-navy-muted); max-width: 56ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.hero-figure { border: 1px solid var(--navy-line); border-radius: var(--radius); background: rgba(255, 255, 255, 0.03); padding: 16px; }
.hero-figure figcaption { font-size: 0.8rem; color: var(--on-navy-muted); margin-top: 8px; font-family: var(--mono); }
.hero-stats { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--navy-line); }
.hero-stats div { font-size: 0.9rem; color: var(--on-navy-muted); }
.hero-stats strong { display: block; font-size: 1.35rem; color: #fff; font-family: var(--mono); font-weight: 700; }

.eyebrow { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin: 0 0 10px; }

/* ---------- Sections ---------- */
.section { padding: 56px 0; }
.section + .section { padding-top: 8px; }
.section-alt { background: var(--surface-alt); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-alt + .section { padding-top: 56px; }
.section-head { max-width: 760px; margin-bottom: 24px; }
.section-head p { color: var(--muted); }
.category-block { margin-bottom: 44px; }
.category-block:last-child { margin-bottom: 0; }
.category-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; margin-bottom: 16px; }
.category-head h2, .category-head h3 { margin: 0; }
.category-head p { margin: 0; color: var(--muted); max-width: 64ch; flex-basis: 100%; }

/* ---------- Cards ---------- */
.card-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .card-grid.cols-4 { grid-template-columns: repeat(4, 1fr); } }

.card {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; text-decoration: none; color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-2px); color: var(--ink); }
.card-cat { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.card-title { font-size: 1.12rem; font-weight: 750; line-height: 1.3; }
.card-desc { font-size: 0.95rem; color: var(--muted); line-height: 1.55; margin: 0; flex: 1; }
.card-meta { font-size: 0.82rem; color: var(--muted); font-family: var(--mono); margin-top: 6px; }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs { padding: 20px 0 0; font-size: 0.88rem; }
.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; color: var(--muted); }
.breadcrumbs li + li::before { content: "/"; margin-right: 6px; color: var(--line-strong); }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent-strong); text-decoration: underline; }

/* ---------- Article layout ---------- */
.page-header { padding: 18px 0 8px; max-width: 820px; }
.page-header .lead-in { color: var(--muted); font-size: 1.12rem; }
.byline { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 0.92rem; color: var(--muted); margin: 0 0 6px; }
.byline strong { color: var(--ink); font-weight: 650; }
.byline .dot { color: var(--line-strong); }

.article-layout { display: grid; gap: 32px; padding-bottom: 32px; }
@media (min-width: 1100px) {
  .article-layout { grid-template-columns: minmax(0, var(--prose)) 260px; justify-content: space-between; }
  .article-layout .toc { order: 2; position: sticky; top: 88px; align-self: start; max-height: calc(100vh - 110px); overflow: auto; }
}

.toc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; font-size: 0.92rem; }
.toc-title { font-size: 0.75rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.toc ol { margin: 0; padding-left: 1.2em; }
.toc li { margin: 4px 0; line-height: 1.4; }
.toc a { color: var(--ink-soft); text-decoration: none; }
.toc a:hover { color: var(--accent-strong); text-decoration: underline; }

/* ---------- Prose ---------- */
.prose { max-width: var(--prose); min-width: 0; }
.prose > * + h2 { margin-top: 2.2em; }
.prose h3 { margin-top: 1.8em; }
.prose p, .prose li { line-height: 1.75; color: var(--ink); }
.prose .lead { font-size: 1.2rem; line-height: 1.65; color: var(--ink-soft); }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.2em; }
.prose li { margin: 0.35em 0; }
.prose li::marker { color: var(--accent); }
.prose strong { font-weight: 700; }
.prose code { font-family: var(--mono); font-size: 0.9em; background: var(--surface-alt); padding: 0.1em 0.35em; border-radius: 4px; }
.meta-line { font-size: 0.92rem; color: var(--muted); font-family: var(--mono); }

.formula {
  font-family: var(--mono); font-size: 1rem; text-align: center;
  background: var(--surface-alt); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 16px; overflow-x: auto; color: var(--ink);
}

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; margin: 1.2em 0 1.6em; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.94rem; line-height: 1.5; }
caption { caption-side: top; text-align: left; font-weight: 750; padding: 12px 14px 4px; color: var(--ink); }
th, td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
thead th { background: var(--surface-alt); font-size: 0.8rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-soft); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fcfbf8; }
td:first-child { font-weight: 600; }
.prose table td, .prose table th { min-width: 110px; }
.num { font-family: var(--mono); white-space: nowrap; }

/* ---------- Callouts ---------- */
.callout { border-radius: var(--radius-sm); padding: 16px 20px; margin: 1.6em 0; border: 1px solid; border-left-width: 4px; }
.callout p:last-child, .callout ol:last-child, .callout ul:last-child { margin-bottom: 0; }
.callout-title { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; margin: 0 0 8px; }
.callout.tip { background: var(--accent-soft); border-color: #f7d4bf; border-left-color: var(--accent); }
.callout.tip .callout-title { color: var(--accent-strong); }
.callout.chain { background: var(--teal-soft); border-color: #c7e6df; border-left-color: var(--teal); }
.callout.chain .callout-title { color: var(--teal); }
.callout.chain ol { margin: 0; padding-left: 1.4em; }
.callout.chain li { font-size: 0.97rem; }
.callout.chain li::marker { color: var(--teal); font-weight: 700; }

/* ---------- Author box & related ---------- */
.author-box { display: flex; gap: 16px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-top: 2.4em; }
.author-avatar { flex: none; width: 52px; height: 52px; border-radius: 50%; background: var(--navy); color: var(--accent-bright); display: grid; place-items: center; font-weight: 800; font-size: 1.05rem; }
.author-box p { margin: 0 0 6px; font-size: 0.95rem; color: var(--ink-soft); line-height: 1.6; }
.author-box .author-name { font-weight: 750; color: var(--ink); margin-bottom: 2px; }
.related { padding: 8px 0 56px; }
.related h2 { font-size: 1.35rem; }

/* ---------- Glossary ---------- */
.letter-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 28px; padding: 0; list-style: none; }
.letter-nav a { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); text-decoration: none; font-weight: 700; color: var(--ink); }
.letter-nav a:hover { border-color: var(--accent); color: var(--accent-strong); }
.glossary-group { margin-bottom: 28px; }
.glossary-group > h2 { font-size: 1.5rem; color: var(--accent); border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.glossary-list { margin: 0; }
.glossary-list dt { font-weight: 750; font-size: 1.05rem; margin-top: 18px; scroll-margin-top: 90px; }
.glossary-list dd { margin: 4px 0 0; color: var(--ink-soft); line-height: 1.7; }
.glossary-list dd a { font-size: 0.92rem; white-space: nowrap; }

/* ---------- Contact ---------- */
.contact-card { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius-sm); padding: 20px 22px; margin: 1.4em 0 2em; }
.contact-label { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 0 0 4px; }
.contact-email { font-size: 1.35rem; font-weight: 750; margin: 0 0 6px; word-break: break-word; }
.contact-note { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* ---------- Reference tables on home ---------- */
.ref-grid { display: grid; gap: 24px; }
@media (min-width: 1000px) { .ref-grid { grid-template-columns: 1fr 1fr; } }
.ref-grid .table-wrap { margin: 0; }

/* ---------- Calculator ---------- */
.calc { display: grid; gap: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
@media (min-width: 1000px) { .calc { grid-template-columns: 300px minmax(0, 1fr); align-items: start; } }
.calc-controls label { display: block; font-weight: 750; margin-bottom: 8px; }
.calc-input-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.calc-input-row input {
  width: 120px; font-family: var(--mono); font-size: 1.5rem; font-weight: 700; text-align: center;
  padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg); color: var(--ink);
}
.calc-input-row input:focus { outline: 3px solid var(--accent-bright); outline-offset: 1px; border-color: var(--accent); }
.step { width: 44px; height: 48px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--ink); font-family: inherit; }
.step:hover { border-color: var(--ink-soft); }
.calc-tap { margin-top: 12px; width: 100%; }
.calc-status { margin: 14px 0 0; font-size: 0.95rem; color: var(--ink-soft); font-family: var(--mono); }
.calc-status.is-error { color: #b42318; }
.calc-results { display: grid; gap: 20px; min-width: 0; }
.calc-results .table-wrap { margin: 0; }
.calc-results td { font-family: var(--mono); white-space: nowrap; }
.calc-results td:first-child { font-family: var(--font); }
.calc-notes { margin-top: 28px; }

/* ---------- Notice / about strip ---------- */
.notice { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: grid; gap: 8px; }
@media (min-width: 900px) { .notice { grid-template-columns: 1fr auto; align-items: center; gap: 24px; } }
.notice p { margin: 0; color: var(--ink-soft); }

/* ---------- 404 ---------- */
.error-page { padding: 72px 0; text-align: center; }
.error-code { font-family: var(--mono); font-size: 4.5rem; font-weight: 800; color: var(--accent); margin: 0; line-height: 1; }
.error-page .hero-actions { justify-content: center; }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy); color: var(--on-navy-muted); padding: 48px 0 0; font-size: 0.94rem; }
.footer-grid { display: grid; gap: 32px; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr 0.9fr; } }
.footer-brand p { margin: 12px 0 0; line-height: 1.6; }
.footer-title { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: #fff; margin: 0 0 12px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin: 0 0 8px; }
.site-footer a { color: var(--on-navy); text-decoration: none; }
.site-footer a:hover { color: var(--accent-bright); text-decoration: underline; }
.footer-disclaimer { margin-top: 36px; padding: 20px 0; border-top: 1px solid var(--navy-line); font-size: 0.86rem; line-height: 1.65; color: var(--on-navy-muted); }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding: 16px 0 28px; border-top: 1px solid var(--navy-line); font-size: 0.85rem; }
.footer-bottom p { margin: 0; }

@media print {
  .site-header, .site-footer, .toc, .related, .nav-toggle { display: none !important; }
  body { background: #fff; }
  .prose { max-width: none; }
}

/* layout refinements */
.category-head { display: block; }
.category-head p { margin-top: 6px; }
.page-header { padding-bottom: 20px; }
@media (max-width: 600px) { .byline .dot { display: none; } .byline { gap: 2px 14px; } }
