:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #efede8;
  --text: #1c1b1f;
  --muted: #5d5b63;
  --line: #e1dfd9;
  --accent: #c2410c;
  --accent-soft: #fde8db;
  --accent-text: #9a3412;
  --code-bg: #ecebe6;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px -16px rgba(0,0,0,.18);
  --radius: 14px;
  --max: 1080px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111118;
    --surface: #1a1a22;
    --surface-2: #22222c;
    --text: #ececf1;
    --muted: #a3a2ad;
    --line: #2d2d38;
    --accent: #fb923c;
    --accent-soft: #3a2316;
    --accent-text: #fdba74;
    --code-bg: #262630;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -16px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111118;
  --surface: #1a1a22;
  --surface-2: #22222c;
  --text: #ececf1;
  --muted: #a3a2ad;
  --line: #2d2d38;
  --accent: #fb923c;
  --accent-soft: #3a2316;
  --accent-text: #fdba74;
  --code-bg: #262630;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -16px rgba(0,0,0,.6);
  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: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); }
h3 { font-size: 1.08rem; margin-top: 1.2em; }
h3:first-child { margin-top: 0; }
p { margin: 0 0 .9em; }
ul, ol { padding-left: 1.3em; margin: 0 0 .9em; }
li { margin-bottom: .35em; }
code {
  font: .9em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--code-bg);
  padding: .1em .4em;
  border-radius: 6px;
}
strong { font-weight: 600; }
table { border-collapse: collapse; width: 100%; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; color: var(--text); text-decoration: none; white-space: nowrap;
}
.brand-mark {
  width: 22px; height: 22px; border-radius: 7px;
  background: conic-gradient(from 200deg, #fb923c, #c2410c, #7c2d12, #fb923c);
}
.topnav {
  display: flex; gap: 4px; overflow-x: auto; flex: 1;
  scrollbar-width: none; -ms-overflow-style: none;
}
.topnav::-webkit-scrollbar { display: none; }
.topnav a {
  color: var(--muted); text-decoration: none; font-size: .9rem;
  padding: 6px 10px; border-radius: 8px; white-space: nowrap;
}
.topnav a:hover, .topnav a.active { color: var(--text); background: var(--surface-2); }
.theme-toggle {
  flex: none; display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer;
}
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

/* ---------- Layout ---------- */
main { max-width: var(--max); margin: 0 auto; padding: 0 16px 48px; }
.step { padding: 56px 0 8px; border-top: 1px solid var(--line); }
.step:first-of-type { border-top: 0; }
.step-head { margin-bottom: 24px; max-width: 720px; }
.step-label {
  display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent-text); background: var(--accent-soft); padding: 3px 10px; border-radius: 999px; margin-bottom: 10px;
}
.intro { color: var(--muted); font-size: 1.05rem; }

/* ---------- Hero ---------- */
.hero { padding: 56px 0 40px; }
.eyebrow { color: var(--accent-text); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; font-size: .8rem; margin-bottom: 12px; }
.hero h1 { font-size: clamp(2rem, 1.3rem + 3.2vw, 3.4rem); max-width: 780px; letter-spacing: -0.02em; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 640px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 24px 0 36px; }
.btn {
  display: inline-block; padding: 11px 18px; border-radius: 10px; font-weight: 600; text-decoration: none;
  border: 1px solid transparent; transition: transform .08s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { color: #fff; filter: brightness(1.06); }
.btn-ghost { border-color: var(--line); color: var(--text); background: var(--surface); }
.quick-steps {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px;
}
.quick-steps li {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  font-size: .95rem; font-weight: 500; margin: 0;
}
.num {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-text); font-weight: 700; font-size: .85rem;
}

/* ---------- Cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(235px, 1fr)); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow);
}
.card > :last-child { margin-bottom: 0; }
.note { color: var(--muted); font-size: .92rem; border-left: 3px solid var(--line); padding-left: 10px; }

/* ---------- Numbered steps ---------- */
.numbered { list-style: none; padding: 0; counter-reset: step; max-width: 760px; }
.numbered > li {
  counter-increment: step; position: relative; padding-left: 56px; margin-bottom: 22px;
}
.numbered > li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 700;
}
.numbered > li h3 { margin-top: 4px; }
.numbered.compact > li { padding-left: 44px; margin-bottom: 12px; }
.numbered.compact > li::before { width: 28px; height: 28px; border-radius: 9px; font-size: .9rem; }
.numbered > li > :last-child { margin-bottom: 0; }

/* ---------- Two column ---------- */
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 32px; }
.plain { padding-left: 1.1em; }

/* ---------- Callout ---------- */
.callout {
  margin: 28px 0 8px; padding: 16px 20px; border-radius: var(--radius);
  background: var(--accent-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}

/* ---------- File types ---------- */
.filetypes { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 20px; }
.filetype { background: var(--surface-2); border-radius: 12px; padding: 16px 18px; }
.filetype code { font-size: 1.05rem; font-weight: 700; background: var(--surface); }
.filetype p { margin: 8px 0 0; font-size: .95rem; color: var(--muted); }

/* ---------- Methods ---------- */
.methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: 16px; }
.method {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow);
}
.method-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.method-head h3 { margin: 0; }
.pill {
  font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  background: var(--accent); color: #fff; padding: 3px 9px; border-radius: 999px;
}
.method ol { margin-bottom: .6em; }
.method > :last-child { margin-bottom: 0; }

/* ---------- Tables ---------- */
.gestures th, .cheat th, .cheat td, .gestures td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.gestures th { width: 32%; color: var(--accent-text); font-weight: 600; }
.cheat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; max-width: 760px; }
.cheat thead th { background: var(--surface-2); font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.cheat tbody tr:last-child td { border-bottom: 0; }
.cheat td:first-child { font-weight: 600; width: 45%; }

/* ---------- FAQ ---------- */
.faq details {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; padding: 0 18px;
}
.faq summary { cursor: pointer; padding: 14px 0; font-weight: 600; list-style: none; position: relative; padding-right: 28px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  color: var(--accent-text); font-size: 1.3rem; line-height: 1;
}
.faq details[open] summary::after { content: "–"; }
.faq details p { padding-bottom: 14px; margin: 0; color: var(--text); }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 28px 16px 48px; text-align: center; color: var(--muted); font-size: .88rem; }
.footer p { max-width: 720px; margin: 0 auto .6em; }

@media (max-width: 640px) {
  .topbar { gap: 10px; }
  .brand span:last-child { display: none; }
  .step { padding-top: 40px; }
  .hero { padding-top: 32px; }
  .card, .method { padding: 16px 18px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---------- Brush recipes ---------- */
.panels { max-width: none; margin-bottom: 8px; }
.panels td:first-child { width: 18%; }
.panels td:nth-child(2) { width: 36%; color: var(--muted); }
.recipes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: 16px; margin: 8px 0 32px; }
.recipe {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow);
}
.recipe-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.recipe-head h4 { margin: 0; font-size: 1.08rem; line-height: 1.25; }
.recipe-base { color: var(--muted); font-size: .92rem; margin-bottom: 10px; }
.recipe ol { margin-bottom: 0; }
.recipe li { margin-bottom: .5em; }
.recipe em { font-style: normal; color: var(--accent-text); font-weight: 500; }
#brushsetup > h3 { margin-top: 36px; font-size: 1.25rem; }
#brushsetup > h3:first-of-type { margin-top: 0; }
@media (max-width: 640px) {
  .panels thead { display: none; }
  .panels tr { display: block; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .panels td { display: block; width: auto !important; padding: 2px 0; border: 0; }
  .panels td:nth-child(3)::before { content: "Use when: "; font-weight: 600; color: var(--text); }
}
