/* microsaas-kit design system. Brand an app by overriding the four knobs below in its page:
   --hue / --chroma (accent colour; every neutral is tinted from it), --font-display, --font-body, --radius.
   Everything else derives from those, light and dark. */
:root {
  --hue: 262;
  --chroma: 0.13;
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --radius: 14px;

  --paper: oklch(0.985 0.005 var(--hue));
  --surface: oklch(0.958 0.011 var(--hue));
  --sunken: oklch(0.93 0.014 var(--hue));
  --ink: oklch(0.21 0.025 var(--hue));
  --muted: oklch(0.47 0.025 var(--hue));
  --line: oklch(0.885 0.014 var(--hue));
  --accent: oklch(0.54 var(--chroma) var(--hue));
  --accent-hover: oklch(0.47 var(--chroma) var(--hue));
  --accent-soft: oklch(0.93 calc(var(--chroma) * 0.35) var(--hue));
  --on-accent: oklch(0.985 0.01 var(--hue));
  --ok: oklch(0.58 0.14 150);
  --bad: oklch(0.56 0.19 27);
  --warn: oklch(0.7 0.14 75);
  --shadow: 0 1px 1px oklch(0.3 0.03 var(--hue) / 0.04), 0 12px 32px -12px oklch(0.3 0.05 var(--hue) / 0.18);

  --r-sm: calc(var(--radius) * 0.5);
  --r-lg: calc(var(--radius) * 1.6);
  --wrap: 1120px;
  --gutter: clamp(16px, 4vw, 32px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: oklch(0.17 0.012 var(--hue));
    --surface: oklch(0.205 0.015 var(--hue));
    --sunken: oklch(0.15 0.012 var(--hue));
    --ink: oklch(0.95 0.008 var(--hue));
    --muted: oklch(0.71 0.02 var(--hue));
    --line: oklch(0.3 0.018 var(--hue));
    --accent: oklch(0.76 calc(var(--chroma) * 0.95) var(--hue));
    --accent-hover: oklch(0.82 calc(var(--chroma) * 0.9) var(--hue));
    --accent-soft: oklch(0.28 calc(var(--chroma) * 0.4) var(--hue));
    --on-accent: oklch(0.18 0.03 var(--hue));
    --ok: oklch(0.76 0.14 150);
    --bad: oklch(0.72 0.16 27);
    --warn: oklch(0.82 0.13 80);
    --shadow: 0 1px 1px oklch(0 0 0 / 0.3), 0 16px 40px -16px oklch(0 0 0 / 0.6);
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--paper); color: var(--ink);
  font: 400 1rem/1.6 var(--font-body); font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
}
/* Grain: breaks the flat-vector look at near-zero cost. */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 100; opacity: .035; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) { body::before { mix-blend-mode: screen; opacity: .025; } }
h1, h2, h3 { font-family: var(--font-display); font-weight: 650; letter-spacing: -0.025em; line-height: 1.05; margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
img, svg { display: block; max-width: 100%; }
code, kbd, .mono { font-family: var(--font-mono); font-size: .9em; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: var(--gutter); top: -60px; z-index: 200; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: var(--r-sm); }
.skip:focus { top: 12px; }

/* ---------- header / footer ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in oklch, var(--paper) 82%, transparent); backdrop-filter: blur(12px) saturate(1.4); border-bottom: 1px solid transparent; transition: border-color .2s; }
.site-header.scrolled { border-bottom-color: var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 24px; height: 64px; }
.mark { display: inline-flex; align-items: center; gap: 10px; font: 700 1.12rem/1 var(--font-display); letter-spacing: -0.02em; text-decoration: none; }
.mark::before { content: ""; width: 14px; height: 14px; border-radius: 4px; background: var(--accent); box-shadow: 4px 4px 0 -1px var(--accent-soft); }
.site-header nav { margin-left: auto; display: flex; align-items: center; gap: clamp(12px, 3vw, 28px); font-size: .94rem; }
.site-header nav a:not(.btn) { text-decoration: none; color: var(--muted); transition: color .15s; }
.site-header nav a:not(.btn):hover { color: var(--ink); }
@media (max-width: 560px) { .site-header nav a.hide-sm { display: none; } }
.site-footer { margin-top: auto; border-top: 1px solid var(--line); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; padding-block: 28px 36px; font-size: .88rem; color: var(--muted); }
.site-footer nav { display: flex; gap: 20px; }

/* ---------- buttons & fields ---------- */
.btn {
  --b: var(--accent); appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 .97rem/1 var(--font-body); letter-spacing: -0.005em; text-decoration: none; cursor: pointer;
  padding: 13px 20px; border-radius: var(--r-sm); border: 1px solid var(--b); background: var(--b); color: var(--on-accent);
  transition: background-color .2s, border-color .2s, transform .12s cubic-bezier(.3,.7,.4,1.5), box-shadow .2s;
}
.btn:hover:not(:disabled) { --b: var(--accent-hover); box-shadow: 0 6px 18px -8px var(--accent); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.985); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.quiet { background: var(--surface); border-color: var(--surface); color: var(--ink); }
.btn.quiet:hover:not(:disabled) { background: var(--sunken); border-color: var(--sunken); box-shadow: none; }
.btn.danger { background: transparent; border-color: transparent; color: var(--bad); padding-inline: 10px; }
.btn.danger:hover:not(:disabled) { background: color-mix(in oklch, var(--bad) 10%, transparent); box-shadow: none; }
.btn.sm { padding: 8px 14px; font-size: .88rem; }
.btn.block { width: 100%; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; }
.link:hover { text-decoration-color: var(--accent); }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > span, .label { font-size: .86rem; font-weight: 550; }
.field small { color: var(--muted); font-size: .82rem; }
input:not([type=checkbox]):not([type=radio]), textarea, select {
  width: 100%; font: inherit; color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 11px 13px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 104px; resize: vertical; line-height: 1.5; }
input:hover, textarea:hover, select:hover { border-color: color-mix(in oklch, var(--muted) 45%, var(--line)); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in oklch, var(--accent) 18%, transparent); }
input::placeholder, textarea::placeholder { color: color-mix(in oklch, var(--muted) 70%, transparent); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.check { display: flex; align-items: center; gap: 10px; font-size: .92rem; margin-bottom: 16px; cursor: pointer; }
.err { color: var(--bad); font-size: .9rem; min-height: 1.4em; margin-top: 10px; }
.err:empty { min-height: 0; margin: 0; }

/* ---------- landing ---------- */
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font: 500 .8rem/1 var(--font-mono); letter-spacing: .02em; color: var(--muted); }
.eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: var(--accent); }
.hero { padding-block: clamp(48px, 9vw, 112px) clamp(56px, 10vw, 128px); display: grid; gap: clamp(40px, 6vw, 72px); align-items: center; }
@media (min-width: 920px) { .hero { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); } }
.hero h1 { font-size: clamp(2.6rem, 6.4vw, 4.6rem); line-height: .98; letter-spacing: -0.04em; margin: 18px 0 22px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.lede { font-size: clamp(1.06rem, 1.6vw, 1.2rem); color: var(--muted); max-width: 46ch; }
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin-top: 32px; }
.fine { font-size: .86rem; color: var(--muted); }
.showcase { position: relative; background: var(--surface); border-radius: var(--r-lg); padding: clamp(16px, 2.4vw, 24px); box-shadow: var(--shadow); min-width: 0; }
.showcase::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--ink) 6%, transparent); }

.section { padding-block: clamp(64px, 9vw, 112px) clamp(72px, 10vw, 128px); border-top: 1px solid var(--line); }
.section-grid { display: grid; gap: 32px 64px; }
@media (min-width: 860px) { .section-grid { grid-template-columns: minmax(0, .8fr) minmax(0, 1.4fr); } .section-grid > .section-head { position: sticky; top: 96px; align-self: start; } }
.section-head h2 { font-size: clamp(1.9rem, 3.6vw, 2.7rem); margin-top: 14px; }
.section-head p { color: var(--muted); margin-top: 14px; max-width: 38ch; }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; display: grid; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 56px 1fr; gap: 4px 16px; padding-block: 26px; border-top: 1px solid var(--line); }
.steps li:first-child { border-top: 0; padding-top: 0; }
.steps li::before { content: counter(s, decimal-leading-zero); grid-row: span 2; font: 500 .85rem/1.9 var(--font-mono); color: var(--accent); }
.steps h3 { font-size: 1.3rem; letter-spacing: -0.02em; }
.steps p { color: var(--muted); max-width: 54ch; }

.plans { display: grid; gap: 16px; }
@media (min-width: 720px) { .plans { grid-template-columns: 1fr 1.15fr; align-items: stretch; } }
.plan { display: flex; flex-direction: column; gap: 18px; padding: clamp(24px, 3vw, 36px); border-radius: var(--r-lg); background: var(--surface); }
.plan.pro { background: var(--ink); color: var(--paper); --muted: color-mix(in oklch, var(--paper) 68%, var(--ink)); --line: color-mix(in oklch, var(--paper) 16%, var(--ink)); }
.plan h3 { font-size: 1.1rem; font-family: var(--font-body); font-weight: 600; letter-spacing: -0.01em; }
.price { font: 650 clamp(2.4rem, 4vw, 3.1rem)/1 var(--font-display); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.price small { font: 400 1rem var(--font-body); color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.plan ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; flex: 1; }
.plan li { display: grid; grid-template-columns: 18px 1fr; gap: 10px; }
.plan li::before { content: ""; width: 10px; height: 6px; margin-top: .55em; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); }
.plan .btn { align-self: flex-start; }
.plan .btn.quiet { background: var(--sunken); border-color: var(--sunken); }

.auth { display: grid; gap: 32px 64px; align-items: start; }
@media (min-width: 860px) { .auth { grid-template-columns: minmax(0, .8fr) minmax(0, 1fr); } }
.auth form { background: var(--surface); padding: clamp(22px, 3vw, 32px); border-radius: var(--r-lg); max-width: 460px; width: 100%; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 6px; }

/* ---------- app shell ---------- */
.app-bar .wrap { gap: 16px; }
.acct { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: .9rem; min-width: 0; }
.acct .who { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 24ch; }
@media (max-width: 560px) { .acct .who { display: none; } }
.tag { display: inline-flex; align-items: center; gap: 6px; font: 500 .75rem/1 var(--font-mono); padding: 5px 8px; border-radius: 5px; background: var(--sunken); color: var(--muted); white-space: nowrap; }
.tag.accent { background: var(--accent-soft); color: var(--ink); }
.app-main { padding-block: clamp(28px, 4vw, 48px) 80px; display: grid; gap: 24px; align-content: start; }
#app-content { display: grid; gap: 20px; align-content: start; }
.app-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; }
.app-head h1 { font-size: clamp(1.7rem, 3vw, 2.2rem); }
.app-grid { display: grid; gap: 24px; align-items: start; }
@media (min-width: 960px) { .app-grid { grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); } .app-grid > aside { position: sticky; top: 88px; } }
.panel { background: var(--surface); border-radius: var(--r-lg); padding: clamp(18px, 2.4vw, 26px); min-width: 0; }
.panel > h2 { font: 600 1rem/1.3 var(--font-body); letter-spacing: -0.01em; margin-bottom: 4px; }
.panel > h2 + p { color: var(--muted); font-size: .9rem; margin-bottom: 18px; }
.banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 14px 18px; border-radius: var(--radius); background: var(--accent-soft); font-size: .94rem; }

.rows { display: grid; }
.row { display: grid; gap: 4px 14px; padding-block: 16px; border-top: 1px solid var(--line); min-width: 0; }
.row:first-child { border-top: 0; padding-top: 4px; }
.row .meta { color: var(--muted); font-size: .86rem; overflow-wrap: anywhere; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 0 color-mix(in oklch, var(--ok) 50%, transparent); animation: beat 2.4s ease-out infinite; }
.dot.bad { background: var(--bad); }
.dot.warn { background: var(--warn); }
@keyframes beat { 70%, 100% { box-shadow: 0 0 0 7px transparent; } }

.empty { display: grid; justify-items: start; gap: 8px; padding: 28px 4px 12px; }
.empty strong { font: 600 1.05rem var(--font-display); }
.empty p { color: var(--muted); font-size: .92rem; max-width: 44ch; }
.skel { height: 52px; border-radius: var(--r-sm); background: linear-gradient(90deg, var(--sunken), var(--surface), var(--sunken)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; margin-block: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.copy { display: flex; gap: 8px; align-items: stretch; }
.copy input { font: .82rem var(--font-mono); background: var(--sunken); border-color: transparent; }

/* ---------- motion ---------- */
.rise { animation: rise .7s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

/* Account page and notices (built by kit.js) */
.banner.notice { background: var(--surface); box-shadow: inset 3px 0 0 var(--warn); }
.account { display: grid; gap: 20px; align-content: start; }
.account-grid { columns: 2 380px; column-gap: 20px; }
.account-grid > .panel { break-inside: avoid; margin-bottom: 20px; display: block; }
.account .panel > p { color: var(--muted); font-size: .92rem; margin-bottom: 16px; }
.account .panel .fine { margin-top: 14px; }
.panel .btn.quiet { background: var(--sunken); border-color: var(--sunken); }
.panel .btn.quiet:hover:not(:disabled) { background: var(--line); border-color: var(--line); }
.panel.danger-zone { box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--bad) 32%, transparent); }
.ok-msg { color: var(--ok); font-size: .9rem; margin-top: 10px; }
.ok-msg:empty { display: none; }
.auth-legal { margin-top: 14px; }
.acct a[aria-current=page] { background: var(--sunken); }

/* Legal and account-link pages (pages/*.html) */
.legal { padding-block: clamp(32px, 6vw, 72px) 96px; }
.legal > * { max-width: 68ch; }
.legal h1 { font-size: clamp(2rem, 4.4vw, 2.9rem); margin-bottom: 10px; }
.legal h2 { font-size: 1.2rem; margin: 40px 0 10px; letter-spacing: -0.015em; }
.legal p, .legal li { line-height: 1.65; }
.legal p + p { margin-top: 12px; }
.legal ul { padding-left: 1.2em; margin: 10px 0; display: grid; gap: 8px; }
.legal .lede { margin: 6px 0 24px; }
.legal .auth-step { max-width: 420px; }
.legal-table { width: 100%; border-collapse: collapse; font-size: .92rem; margin: 12px 0; }
.legal-table th, .legal-table td { text-align: left; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.legal-table th { font-weight: 550; color: var(--muted); }
@media (max-width: 560px) { .legal-table thead { display: none; } .legal-table td { display: block; padding: 2px 0; border: 0; } .legal-table tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); } }
.legal-table td:first-child { font-weight: 550; }
