/* Whyline shared styles: tokens, base, layout, components. Plain CSS, no build step. */
:root {
  --bg: #fbfaf7; --surface: #fff; --fg: #14161f; --muted: #5d6275; --line: #e6e3dc;
  --accent: #f5b83d; --accent-hover: #f0aa1c; --accent-fg: #14161f;
  --focus: #14161f; --danger: #b42318; --success: #1a7f37;
  --code-bg: #14161f; --code-fg: #d9dce6; --code-dim: #8a90a6; --code-line: #3d4256;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;
  --r-ctl: 8px; --r-card: 12px; --radius: var(--r-card);
  --t-xs: 0.8125rem; --t-sm: 0.9375rem; --t-base: 1rem; --t-lg: 1.125rem; --t-xl: 1.375rem; --t-2xl: 1.75rem;
  --t-3xl: clamp(1.75rem, 3.4vw, 2.25rem); --t-4xl: clamp(2.25rem, 5.4vw, 3.5rem);
  --shadow: 0 1px 2px #14161f0d, 0 8px 24px -12px #14161f26;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1016; --surface: #151823; --fg: #eceef4; --muted: #9aa0b4; --line: #262a38;
    --focus: #f5b83d; --danger: #ff8a80; --success: #4ade80; --code-bg: #0b0d12; --code-line: #2a2f40;
    --shadow: 0 1px 2px #0006, 0 8px 24px -12px #000a;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--fg); font: var(--t-base)/1.6 system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-underline-offset: 3px; }
img, svg { max-width: 100%; }
code, pre, kbd { font-family: var(--mono); font-size: 0.9em; }
:not(pre) > code { background: color-mix(in srgb, var(--fg) 7%, transparent); padding: 0.1em 0.4em; border-radius: 6px; overflow-wrap: anywhere; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.code :focus-visible { outline-color: var(--accent); }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip { position: absolute; left: var(--s4); top: -100px; background: var(--accent); color: var(--accent-fg); padding: var(--s2) var(--s4); border-radius: var(--r-ctl); font-weight: 600; z-index: 20; }
.skip:focus { top: var(--s2); }

.container { max-width: 1120px; margin: 0 auto; padding: 0 var(--s4); }
@media (min-width: 720px) { .container { padding: 0 var(--s5); } }

/* Header */
.site-header { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.nav { display: flex; align-items: center; gap: var(--s5); min-height: 64px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: var(--t-lg); text-decoration: none; }
.brand img { width: 28px; height: 28px; }
.nav-links { margin-left: auto; display: flex; align-items: center; gap: var(--s1); flex-wrap: wrap; }
.nav-links a:not(.btn) { color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: var(--r-ctl); font-weight: 500;
  transition: color 0.15s, background-color 0.15s; }
.nav-links a:not(.btn):hover { color: var(--fg); background: color-mix(in srgb, var(--fg) 6%, transparent); }
.nav-links a[aria-current="page"] { color: var(--fg); background: color-mix(in srgb, var(--accent) 22%, transparent); }
.nav-links .btn { margin-left: var(--s2); }
.btn.menu-btn { display: none; margin-left: auto; }
@media (max-width: 860px) {
  .js .btn.menu-btn { display: inline-flex; }
  .js .nav-links { display: none; width: 100%; flex-direction: column; align-items: stretch; margin: 0 0 var(--s3); gap: 2px; }
  .js .nav-links.open { display: flex; }
  .js .nav-links a:not(.btn) { padding: 12px; }
  .nav-links .btn { margin: var(--s2) 0 0; }
}

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); padding: 10px 18px; border-radius: var(--r-ctl);
  border: 1px solid var(--line); background: var(--surface); color: var(--fg); font: inherit; font-weight: 600; line-height: 1.3;
  text-decoration: none; cursor: pointer; transition: background-color 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s; }
.btn:hover { border-color: color-mix(in srgb, var(--fg) 30%, var(--line)); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn[aria-busy="true"] { cursor: progress; transform: none; }
.btn[aria-busy="true"]::after { content: ""; width: 0.9em; height: 0.9em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; }
@media (prefers-reduced-motion: no-preference) {
  .btn[aria-busy="true"]::after { animation: spin 0.7s linear infinite; }
  .skeleton { animation: shimmer 1.4s ease-in-out infinite; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 50% { opacity: 0.55; } }

/* Forms */
input { font: inherit; padding: 10px 14px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--surface); color: var(--fg); }
input::placeholder { color: var(--muted); opacity: 0.8; }
input:focus-visible { border-color: var(--focus); }

/* Layout blocks */
.section { padding: var(--s8) 0; border-top: 1px solid var(--line); }
.section.first { border-top: 0; }
.section-head { max-width: 46rem; margin-bottom: var(--s6); }
.section-head h2 { font-size: var(--t-3xl); margin-bottom: var(--s3); }
.section-head p { color: var(--muted); font-size: var(--t-lg); }
.eyebrow { display: inline-block; font-size: var(--t-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; margin-bottom: var(--s4); background: var(--surface); }
.cta { display: flex; gap: var(--s3); flex-wrap: wrap; }
.grid { display: grid; gap: var(--s4); }
@media (min-width: 720px) { .grid.two { grid-template-columns: repeat(2, 1fr); } .grid.three { grid-template-columns: repeat(3, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--s5); transition: border-color 0.15s, box-shadow 0.15s; }
a.card { display: block; text-decoration: none; }
a.card:hover { border-color: color-mix(in srgb, var(--accent) 70%, var(--line)); box-shadow: var(--shadow); }
.card h2, .card h3 { font-size: var(--t-lg); margin-bottom: var(--s2); }
.card p { color: var(--muted); }
.card p + p, .card p + ul { margin-top: var(--s2); }
.card .benefit { color: var(--fg); margin-top: var(--s3); font-size: var(--t-sm); }
.card .benefit::before { content: "Why it helps: "; font-weight: 600; }
.badge { display: inline-block; font-size: var(--t-xs); font-weight: 600; border: 1px solid var(--line); border-radius: 999px; padding: 1px 10px; background: var(--surface); }

.hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s7); align-items: center; padding: var(--s8) 0; }
@media (min-width: 900px) { .hero { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); } }
.hero h1, .page-head h1 { font-size: clamp(2.1rem, 4.4vw, 3.25rem); letter-spacing: -0.03em; line-height: 1.08; margin-bottom: var(--s4); }
.hero h1 { font-size: clamp(2rem, 4vw, 2.75rem); text-wrap: wrap; }
.hero h1 em { font-style: normal; background: linear-gradient(transparent 62%, color-mix(in srgb, var(--accent) 55%, transparent) 62%); }
.lead { font-size: var(--t-lg); color: var(--muted); max-width: 38rem; margin-bottom: var(--s5); }
.page-head { padding: var(--s7) 0 var(--s5); }
.page-head .lead { margin-bottom: 0; }
.page-head h1 { font-size: clamp(2rem, 4.6vw, 3rem); }

/* Steps */
ol.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s4); counter-reset: s; }
ol.steps > li { counter-increment: s; display: grid; grid-template-columns: 40px 1fr; gap: var(--s4); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--s5); }
ol.steps > li::before { content: counter(s); width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-fg); font-weight: 700; }
ol.steps h2, ol.steps h3 { font-size: var(--t-lg); margin: 4px 0 var(--s2); }
ol.steps p, ol.steps ul { color: var(--muted); }
ol.steps > li > div { min-width: 0; }
ol.steps > li > div > * + * { margin-top: var(--s3); }
@media (max-width: 480px) { ol.steps > li { grid-template-columns: 1fr; } }

/* Code */
.code { position: relative; background: var(--code-bg); color: var(--code-fg); border-radius: var(--r-card); border: 1px solid var(--code-line); }
.code pre { margin: 0; padding: 44px var(--s4) var(--s4); overflow-x: auto; line-height: 1.7; }
.code[data-nocopy] pre { padding: var(--s4); white-space: pre-wrap; overflow-wrap: anywhere; }
.code .c { color: var(--code-dim); }
.code .label { display: block; padding: var(--s2) var(--s4); border-bottom: 1px solid var(--code-line); color: var(--code-dim); font-size: var(--t-xs); font-weight: 600; }
.copy { position: absolute; top: var(--s2); right: var(--s2); font: 600 12px system-ui; padding: 4px 10px; border-radius: 6px;
  border: 1px solid var(--code-line); background: transparent; color: var(--code-fg); cursor: pointer; transition: background-color 0.15s; }
.copy:hover { background: #ffffff14; }
.copy:active { background: #ffffff24; }
.code .out b { color: var(--accent); font-weight: 600; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: var(--t-sm); }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; background: color-mix(in srgb, var(--fg) 4%, transparent); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td code { white-space: nowrap; }
td:first-child { min-width: 9rem; }

.callout { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--r-ctl); padding: var(--s3) var(--s4);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.callout strong:first-child { display: block; margin-bottom: 2px; }
.callout.plain { border-left-color: var(--muted); background: var(--surface); }

/* Docs layout and prose */
.docs { display: grid; gap: var(--s6); padding-block: var(--s6) var(--s8); }
@media (min-width: 900px) { .docs { grid-template-columns: 220px minmax(0, 1fr); gap: var(--s7); } .docs-nav { position: sticky; top: 88px; align-self: start; } }
.docs-nav h2 { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: var(--s2); }
.docs-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s1); }
@media (min-width: 900px) { .docs-nav ul { flex-direction: column; flex-wrap: nowrap; } }
.docs-nav a { display: block; text-decoration: none; color: var(--muted); padding: 6px 12px; border-radius: var(--r-ctl); font-size: var(--t-sm); }
.docs-nav a:hover { color: var(--fg); background: color-mix(in srgb, var(--fg) 6%, transparent); }
.docs-nav a[aria-current="page"] { color: var(--fg); font-weight: 600; background: color-mix(in srgb, var(--accent) 22%, transparent); }
.prose { max-width: 46rem; min-width: 0; }
.prose h1 { font-size: clamp(2rem, 4.6vw, 2.75rem); letter-spacing: -0.03em; }
.prose h2 { font-size: var(--t-2xl); margin-top: var(--s7); }
.prose h3 { font-size: var(--t-lg); margin-top: var(--s5); }
.prose > p, .prose li { color: color-mix(in srgb, var(--fg) 88%, var(--muted)); }
.prose > * + * { margin-top: var(--s3); }
.prose > h2 + *, .prose > h3 + * { margin-top: var(--s2); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: var(--s1); }
.prose .lead { margin-bottom: 0; }
.post { padding-block: var(--s6) var(--s8); }
.post .cta { margin-top: var(--s6); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: var(--s7) 0 var(--s6); color: var(--muted); font-size: var(--t-sm); }
.footer-grid { display: grid; gap: var(--s6); }
@media (min-width: 720px) { .footer-grid { grid-template-columns: 1.4fr repeat(3, 1fr); } }
.site-footer h2 { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg); margin-bottom: var(--s3); }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--fg); text-decoration: underline; }
.site-footer .brand { color: var(--fg); margin-bottom: var(--s3); }

/* Shared states (dashboard) */
.alert { padding: 12px 16px; border-radius: var(--r-ctl); border: 1px solid var(--line); border-left-width: 4px; background: var(--surface); }
.alert.error { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.alert.ok { border-color: var(--success); background: color-mix(in srgb, var(--success) 8%, var(--surface)); }
.alert.warn { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.alert.error::before { content: "Error: "; font-weight: 700; color: var(--danger); }
.alert.ok::before { content: "\2713  "; font-weight: 700; color: var(--success); }
.skeleton { background: var(--line); border-radius: var(--r-ctl); }
