@import "tokens.css";

:root {
  --radius: var(--radius-md);
  --header-h: 56px;
  --sidebar-w: 240px;
  --content-max: 720px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 20px);
}

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 55% at 8% -8%, rgba(59, 130, 246, 0.06), transparent 55%),
    radial-gradient(ellipse 55% 45% at 96% 108%, rgba(12, 14, 18, 0.03), transparent 50%),
    var(--bg);
}

a {
  color: var(--text-muted);
  text-decoration: none;
}

a:hover {
  color: var(--text);
  text-decoration: underline;
}

a:visited { color: var(--text-muted); }

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 4vw, 28px);
  background: rgba(248, 249, 251, 0.85);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-family: var(--font-brand);
  font-size: 1.2rem;
  letter-spacing: 0.03em;
  color: var(--text);
  text-decoration: none;
  line-height: 1;
}

.brand:hover { color: var(--text); text-decoration: none; }
.brand:visited { color: var(--text); }

.nav {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 0.875rem;
}

.nav a {
  color: var(--text-muted);
  text-decoration: none;
}

.nav a:hover { color: var(--text); text-decoration: none; }
.nav a:visited { color: var(--text-muted); }
.nav a.active { color: var(--text); font-weight: 600; }

.btn-dl {
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--text);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-xs);
  transition: background 0.18s ease, transform 0.18s var(--ease-spring), box-shadow 0.18s ease;
}

.btn-dl:hover {
  background: #1a1f28;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Layout */
.layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px 80px;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  gap: 56px;
  align-items: start;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 32px;
    padding-top: 32px;
  }
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: calc(var(--header-h) + 24px);
}

@media (max-width: 900px) {
  .sidebar { position: static; }
}

.sidebar-title {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 12px;
}

.toc {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc a {
  display: block;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.toc a:hover {
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.toc a.active {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 500;
}

@media (max-width: 900px) {
  .toc {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }

  .toc a {
    border: 1px solid var(--border);
    padding: 6px 12px;
  }

  .toc a.active {
    background: var(--text);
    color: #fff;
    border-color: var(--text);
  }
}

/* Main content */
.content { min-width: 0; max-width: var(--content-max); }

.anchor-alias {
  height: 0;
  overflow: hidden;
  scroll-margin-top: calc(var(--header-h) + 20px);
}

.ui-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  vertical-align: -3px;
  margin: 0 2px;
}

.ui-icon svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
  color: var(--text);
}

.ui-icon.chevron svg {
  width: 10px;
  height: 10px;
}

.ui-img {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  vertical-align: -3px;
  margin: 0 2px;
}

.ui-img img {
  width: 12px;
  height: 12px;
  display: block;
}

.muted-line {
  color: var(--text-faint);
  font-size: 0.875rem;
}

.page-hero {
  margin-bottom: 40px;
}

.page-hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 12px;
}

.page-hero p {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 48ch;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* Quick links grid */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 48px;
}

@media (max-width: 560px) {
  .quick-grid { grid-template-columns: 1fr; }
}

.quick-card {
  display: flex;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  text-decoration: none;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s var(--ease-spring);
}

.quick-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
  text-decoration: none;
}

.quick-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: #fff;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text);
}

.quick-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quick-text strong {
  display: block;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.quick-text span {
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.45;
}

/* Sections */
section {
  margin-bottom: 56px;
  scroll-margin-top: calc(var(--header-h) + 20px);
}

.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.section-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--text);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}

.section-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

section h2 {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.lead {
  color: var(--text-muted);
  font-size: 0.9375rem;
  margin-bottom: 20px;
}

h3 {
  font-size: 0.875rem;
  font-weight: 600;
  margin: 24px 0 10px;
  color: var(--text);
}

p { margin-bottom: 12px; color: var(--text-muted); }
p:last-child { margin-bottom: 0; }

/* Icon bullet list */
.list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 16px;
}

.list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.list li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text);
  margin-top: 8px;
  flex-shrink: 0;
}

.list li strong { color: var(--text); font-weight: 600; }

/* Numbered steps */
.steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.steps li {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 0;
  border-bottom: 1px solid var(--border);
}

.steps li:last-child { border-bottom: none; }

.step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-faint);
  border-right: 1px solid var(--border);
}

.step-body {
  padding: 16px 18px;
}

.step-body strong {
  display: block;
  color: var(--text);
  font-weight: 600;
  font-size: 0.9375rem;
  margin-bottom: 4px;
}

.step-body span {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.55;
}

/* Callout */
.note {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  margin: 20px 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.note svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
  margin-top: 1px;
}

.note strong { color: var(--text); }

.tip {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text-muted);
}

.tip strong { color: var(--text); }

/* Shortcuts */
.keys {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}

.key-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}

.key-row:last-child { border-bottom: none; }

.key-row:nth-child(odd) { background: var(--surface); }

.key-combo {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.key-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
}

kbd {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: #fff;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
}

/* Platform badges */
.platforms {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 16px;
}

.platform {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.platform img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.platform.soundcloud { background: #ff5500; }
.platform svg { width: 18px; height: 18px; fill: #fff; }

/* Code */
code {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.8125rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--text);
}

pre {
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.55;
  margin: 12px 0 16px;
}

pre code {
  background: none;
  border: none;
  padding: 0;
}

/* FAQ */
.faq {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

summary {
  padding: 14px 16px;
  font-weight: 500;
  font-size: 0.9375rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  user-select: none;
  color: var(--text);
}

summary::-webkit-details-marker { display: none; }

summary::after {
  content: "+";
  font-size: 1.125rem;
  font-weight: 400;
  color: var(--text-faint);
}

details[open] summary::after { content: "-"; }

details[open] summary {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.faq-body {
  padding: 14px 16px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-faint);
  background: rgba(248, 249, 251, 0.72);
}

.footer a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer a:hover { color: var(--text); text-decoration: none; }
.footer a:visited { color: var(--text-muted); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
