/* Shared styles for the SIDtune website. Colours are the app's "SIDtune Purple" theme (SIDtune/UI/Theme.swift). */
@font-face { font-family: "Pet Me 64"; src: url("fonts/PetMe64.ttf") format("truetype"); font-display: swap; }

:root {
  --bg: #120e27;
  --bg-2: #1a1538;
  --panel: #231c4d;
  --panel-2: #2c2460;
  --line: #342b6b;
  --text: #eeeaff;
  --muted: #a39dd6;
  --accent: #8b7fe8;
  --accent-strong: #a89dff;
  --accent-ink: #120e27;
  --tri: #5fd7ff;
  --saw: #ffd75f;
  --pulse: #ff7ab6;
  --mix: #b48cff;
  --radius: 10px;
  --topbar-h: 60px;
  --c64: "Pet Me 64", ui-monospace, Menlo, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 16px; line-height: 1.62;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--tri); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; height: auto; display: block; }
code { font-family: var(--mono); font-size: .9em; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 0 .3em; }
kbd {
  display: inline-block; padding: 0 .45em; border: 1px solid var(--accent); border-radius: 4px; background: var(--bg-2);
  color: var(--accent-strong); font-family: var(--mono); font-size: .86em; line-height: 1.5; white-space: nowrap;
}
.path { color: var(--accent-strong); font-style: normal; font-weight: 600; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50; height: var(--topbar-h);
  background: rgba(18, 14, 39, .92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { max-width: 1320px; margin: 0 auto; height: 100%; padding: 0 22px; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--accent-strong); margin-right: auto; }
.brand:hover { text-decoration: none; }
.brand img { width: 36px; height: 36px; border-radius: 8px; }
.brand b { font-family: var(--c64); font-weight: 400; font-size: 14px; letter-spacing: .02em; }
.brand span { display: block; color: var(--muted); font-size: 12px; font-family: var(--sans); margin-top: 2px; }
.topnav { display: flex; gap: 4px; }
.topnav a { font-size: 14px; font-weight: 600; color: var(--text); padding: 8px 12px; border-radius: 8px; white-space: nowrap; }
.topnav a:hover { text-decoration: none; color: var(--accent-strong); background: var(--panel); }
.topnav a[aria-current="page"] { color: var(--accent-ink); background: var(--accent-strong); }

/* ---------- typography ---------- */
h1, h2 { font-family: var(--c64); font-weight: 400; line-height: 1.3; letter-spacing: .01em; }
h3, h4 { font-weight: 700; line-height: 1.3; }
h2 { color: var(--accent-strong); font-size: 20px; margin: 0 0 14px; }
h2 .num { color: var(--muted); margin-right: 10px; }
h3 { color: var(--tri); font-size: 19px; margin: 30px 0 8px; }
h4 { color: #fff; font-size: 16px; margin: 20px 0 6px; }
p { margin: 0 0 14px; }
ul, ol { padding-left: 1.3em; margin: 0 0 14px; }
li { margin: 4px 0; }
strong { color: #fff; }
.lead { font-size: 18px; max-width: 64ch; }
.muted { color: var(--muted); }

/* ---------- hero (home and guide) ---------- */
.hero {
  padding: 64px 48px 52px;
  background:
    radial-gradient(1000px 360px at 85% -80px, rgba(180, 140, 255, .18), transparent 60%),
    radial-gradient(800px 300px at 5% 0, rgba(95, 215, 255, .10), transparent 60%),
    var(--bg);
  border-bottom: 1px solid var(--line);
}
.hero-inner { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 48px; align-items: center; }
.eyebrow { font-family: var(--c64); color: var(--tri); font-size: 11px; letter-spacing: .1em; }
.hero h1 { font-size: clamp(32px, 6vw, 60px); color: var(--accent-strong); margin: 12px 0 14px; text-shadow: 0 0 28px rgba(168, 157, 255, .35); }
.hero h1 small { display: block; font-family: var(--sans); font-weight: 700; font-size: clamp(18px, 2.4vw, 24px); color: #fff; letter-spacing: 0; margin-top: 14px; text-shadow: none; }
.meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.meta span { font-size: 13px; color: var(--muted); border: 1px solid var(--line); padding: 4px 12px; border-radius: 999px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.btn { display: inline-block; font-weight: 700; font-size: 15px; color: var(--accent-ink); background: var(--accent-strong); border-radius: 10px; padding: 11px 18px; }
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn.ghost { color: var(--text); background: transparent; border: 1px solid var(--accent); }

/* The visualiser: a static picture of the app's piano roll, coloured by waveform. */
.viz { background: #0e0a22; border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: 0 20px 50px rgba(0, 0, 0, .5); }
.viz .legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.viz .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- home ---------- */
.home { max-width: 1180px; margin: 0 auto; padding: 0 48px 40px; }
.home section { padding-top: 56px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin: 18px 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.card h3 { margin: 0 0 6px; font-size: 17px; color: #fff; }
.card h3::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 10px; background: var(--c, var(--accent-strong)); }
.card p { margin: 0; font-size: 15px; color: var(--muted); }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.panel { background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 22px 24px; }
.panel h2 { font-size: 16px; }
.panel p:last-child { margin-bottom: 0; }

/* ---------- guide layout ---------- */
.layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); max-width: 1320px; margin: 0 auto; }
nav.toc {
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto;
  padding: 28px 18px 40px 22px; border-right: 1px solid var(--line); font-size: 14px;
}
.toc-title { font-family: var(--c64); font-size: 10px; letter-spacing: .08em; color: var(--muted); margin: 0 0 14px 8px; }
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.toc > ol > li { counter-increment: s; margin: 2px 0; }
.toc > ol > li > a::before { content: counter(s, decimal-leading-zero) "  "; color: var(--muted); font-family: var(--mono); font-size: 12px; white-space: pre; }
.toc a { color: var(--text); display: block; padding: 3px 8px; border-radius: 6px; }
.toc a:hover { background: var(--panel); text-decoration: none; color: var(--accent-strong); }
.toc ol ol { padding-left: 30px; margin: 2px 0 6px; }
.toc ol ol a { color: var(--muted); font-size: 13px; padding: 1px 8px; }
details.toc-mobile { display: none; }

.guide main { padding: 0 48px 80px; min-width: 0; }
.guide .hero { margin: 0 -48px; padding: 52px 48px 40px; }
.guide .hero h1 { font-size: clamp(28px, 4.4vw, 44px); }
.guide section { padding-top: 36px; }
.guide section + section { border-top: 1px solid var(--line); margin-top: 36px; }

/* ---------- callouts & tables ---------- */
.note, .tip {
  border: 1px solid var(--line); border-left: 4px solid var(--tri); background: var(--panel);
  padding: 12px 16px; border-radius: 8px; margin: 16px 0;
}
.tip { border-left-color: var(--saw); }
.note > b:first-child, .tip > b:first-child { display: block; font-family: var(--c64); font-weight: 400; font-size: 11px; letter-spacing: .06em; margin-bottom: 4px; color: var(--tri); }
.tip > b:first-child { color: var(--saw); }
.table-wrap { overflow-x: auto; margin: 14px 0 18px; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--tri); background: var(--panel); font-size: 13px; letter-spacing: .04em; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td:first-child { color: var(--accent-strong); font-weight: 600; white-space: nowrap; }
.top-link { font-size: 13px; float: right; color: var(--muted); }

/* ---------- single-column pages (privacy, support) ---------- */
.page { max-width: 820px; margin: 0 auto; padding: 48px 24px 80px; }
.page h1 { font-size: clamp(24px, 4vw, 36px); color: var(--accent-strong); margin: 0 0 10px; }
.page .dates { font-size: 14px; color: var(--muted); margin-bottom: 26px; }
.page h2 { margin-top: 40px; font-size: 17px; }
.page h3 { margin-top: 24px; font-size: 17px; }
.page td:first-child { white-space: normal; }
.summary { border: 1px solid var(--accent); background: var(--bg-2); border-radius: var(--radius); padding: 16px 20px; margin: 18px 0 8px; }
.summary b:first-child { display: block; font-family: var(--c64); font-weight: 400; font-size: 11px; color: var(--accent-strong); letter-spacing: .06em; margin-bottom: 6px; }
.contact-card { display: grid; grid-template-columns: 96px 1fr; gap: 22px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 24px; margin: 22px 0; }
.contact-card img { width: 96px; height: 96px; border-radius: 20px; }
.contact-card .name { font-size: 20px; color: #fff; font-weight: 700; }
.contact-card .role { color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.contact-card .email { font-family: var(--mono); font-size: 17px; word-break: break-all; }
.faq dt { font-weight: 700; color: #fff; margin-top: 18px; }
.faq dd { margin: 4px 0 0; }

/* ---------- footer ---------- */
.site-footer { max-width: 1320px; margin: 0 auto; padding: 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 8px 22px; }
.site-footer a { color: var(--muted); }
.site-footer .spacer { margin-left: auto; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .hero-inner { grid-template-columns: 1fr; gap: 32px; }
  .viz { max-width: 520px; }
}
@media (max-width: 880px) {
  :root { --topbar-h: 56px; }
  .topbar-inner { padding: 0 12px; gap: 8px; }
  .brand b, .brand span { display: none; }
  .topnav a { padding: 7px 9px; font-size: 13.5px; }
  .topnav .long { display: none; }
  .hero { padding: 40px 16px 34px; }
  .home { padding: 0 16px 30px; }
  .home section { padding-top: 40px; }
  .layout { grid-template-columns: 1fr; }
  nav.toc { display: none; }
  details.toc-mobile { display: block; margin: 18px 0 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
  details.toc-mobile summary { font-family: var(--c64); font-size: 11px; color: var(--accent-strong); cursor: pointer; }
  details.toc-mobile ol { margin: 10px 0 4px; }
  .guide main { padding: 0 16px 60px; }
  .guide .hero { margin: 0 -16px; padding: 36px 16px 28px; }
  .page { padding: 32px 16px 60px; }
  .contact-card { grid-template-columns: 1fr; }
  h2 { font-size: 17px; }
  .site-footer .spacer { margin-left: 0; }
}

@media print {
  :root { --bg: #fff; --bg-2: #f5f4fb; --panel: #f0eef9; --line: #ccc8e6; --text: #111; --muted: #555; --accent-strong: #4a3fb0; --tri: #00607a; }
  .topbar, nav.toc, details.toc-mobile, .top-link, .viz { display: none !important; }
  .layout { display: block; }
  .hero { background: none; }
  .hero h1 { text-shadow: none; }
  strong, h4, .card h3 { color: #000; }
}
