/*
 * aico.dev — the project site.
 *
 * Built on the same tokens as the product (shared/ui/theme.css): the #4176e6
 * accent, the neutral surfaces, the reading column. A site that invents its own
 * palette makes every screenshot on it look like it came from something else.
 *
 * Light by default, dark on the system setting, and overridable by data-theme
 * so the toggle in the header works in both directions. Same arrangement the
 * app uses, for the same reason.
 *
 * No build step, no framework, no webfont. The whole site is HTML and this
 * file — which is also the honest thing to ship for a tool whose pitch is that
 * it does not hide what it is doing.
 */

:root {
  --bg: #ffffff;
  --surface: #f9fafb;
  --elevated: #f4f5f7;
  --hover: rgba(0, 0, 0, .04);

  --text: #0f1115;
  --text-2: #52565e;
  --muted: #8a8f98;

  --border: rgba(0, 0, 0, .1);
  --border-subtle: rgba(0, 0, 0, .06);

  --accent: #4176e6;
  --accent-hover: #3566d4;
  --accent-soft: rgba(65, 118, 230, .1);
  --on-accent: #ffffff;

  --success: #1a9c53;
  --warning: #b8791a;
  --danger: #d13333;

  --code-bg: #f6f7f9;

  --column: 720px;
  --wide: 1080px;

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --mono: 'SF Mono', 'JetBrains Mono', 'Cascadia Code', Consolas, 'Liberation Mono', Menlo, monospace;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 12px 32px rgba(16, 24, 40, .07);
}

:root[data-theme='dark'] {
  --bg: #0f1115;
  --surface: #16181d;
  --elevated: #1c1f26;
  --hover: rgba(255, 255, 255, .06);

  --text: #e8eaed;
  --text-2: #a3a8b2;
  --muted: #6f7480;

  --border: rgba(255, 255, 255, .12);
  --border-subtle: rgba(255, 255, 255, .07);

  --accent: #679efe;
  --accent-hover: #7fb0ff;
  --accent-soft: rgba(103, 158, 254, .14);
  --on-accent: #0f1115;

  --success: #4ed17e;
  --warning: #f7ad31;
  --danger: #f25a5a;

  --code-bg: #16181d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0f1115;
    --surface: #16181d;
    --elevated: #1c1f26;
    --hover: rgba(255, 255, 255, .06);

    --text: #e8eaed;
    --text-2: #a3a8b2;
    --muted: #6f7480;

    --border: rgba(255, 255, 255, .12);
    --border-subtle: rgba(255, 255, 255, .07);

    --accent: #679efe;
    --accent-hover: #7fb0ff;
    --accent-soft: rgba(103, 158, 254, .14);
    --on-accent: #0f1115;

    --success: #4ed17e;
    --warning: #f7ad31;
    --danger: #f25a5a;

    --code-bg: #16181d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
/* The header is sticky and 60px tall, so an anchor jump would otherwise land the
   target heading exactly underneath it — invisible, which reads as a dead link. */
html { scroll-padding-top: 76px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ── Header ─────────────────────────────────────────────────────── */

.site-header {
  position: sticky; top: 0; z-index: 30;
  border-bottom: 1px solid var(--border-subtle);
  /* 94%, not 86%. The blur alone left scrolled text ghosting behind the brand —
     a header you can read the page through is a header that looks broken. */
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(14px);
}
.site-header .inner {
  display: flex; align-items: center; gap: 1.25rem;
  max-width: var(--wide); margin: 0 auto; padding: .8rem 1.5rem;
}
.brand {
  display: flex; align-items: baseline; gap: .5rem;
  font-weight: 650; letter-spacing: -.02em; font-size: 1.05rem;
  color: var(--text); text-decoration: none;
}
.brand .ver {
  font-family: var(--mono); font-size: .68rem; font-weight: 400;
  color: var(--muted); background: var(--hover);
  padding: .1rem .35rem; border-radius: 4px;
}
.site-nav { display: flex; align-items: center; gap: .25rem; margin-left: auto; }
.site-nav a {
  padding: .35rem .6rem; border-radius: var(--radius-sm);
  font-size: .875rem; color: var(--text-2); text-decoration: none;
  transition: background .12s, color .12s;
}
.site-nav a:hover { background: var(--hover); color: var(--text); }
.site-nav a[aria-current='page'] { color: var(--text); font-weight: 550; }
.theme-toggle {
  display: grid; place-items: center;
  width: 32px; height: 32px; margin-left: .25rem;
  border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  background: transparent; color: var(--text-2); cursor: pointer;
  transition: background .12s, color .12s;
}
.theme-toggle:hover { background: var(--hover); color: var(--text); }

/* ── Layout ─────────────────────────────────────────────────────── */

main { max-width: var(--wide); margin: 0 auto; padding: 0 1.5rem 5rem; }
.prose { max-width: var(--column); }
section { margin-top: 4rem; }
section:first-of-type { margin-top: 3rem; }

h1 { font-size: 2.1rem; line-height: 1.2; letter-spacing: -.03em; font-weight: 680; margin: 0 0 .75rem; }
/* A heading needs air above it, or it reads as part of the paragraph before.
   Zeroed where a section already supplies the gap, so the two do not stack. */
h2 { font-size: 1.4rem; line-height: 1.3; letter-spacing: -.02em; font-weight: 640; margin: 2.75rem 0 .6rem; }
section > h2:first-child,
section > .prose > h2:first-child,
h1 + h2 { margin-top: 0; }
h3 { font-size: 1.02rem; letter-spacing: -.01em; font-weight: 620; margin: 1.75rem 0 .4rem; }
p { margin: 0 0 1rem; color: var(--text-2); }
.prose p, .lede { max-width: var(--column); }
.lede { font-size: 1.12rem; color: var(--text-2); margin-bottom: 1.5rem; }
strong { color: var(--text); font-weight: 620; }

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

ul, ol { margin: 0 0 1rem; padding-left: 1.25rem; color: var(--text-2); }
li { margin-bottom: .4rem; }
li > strong:first-child { color: var(--text); }

hr { border: 0; border-top: 1px solid var(--border-subtle); margin: 3rem 0; }

/* ── Hero ───────────────────────────────────────────────────────── */

.hero { padding: 4rem 0 1rem; }
.hero h1 { font-size: 2.9rem; max-width: 16ch; }
.hero .lede { font-size: 1.2rem; max-width: 56ch; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .45rem;
  font-size: .78rem; font-weight: 550; letter-spacing: .02em;
  color: var(--accent); background: var(--accent-soft);
  padding: .25rem .6rem; border-radius: 999px; margin-bottom: 1.25rem;
}

@media (max-width: 640px) {
  .hero h1 { font-size: 2.1rem; }
  .hero { padding-top: 2.5rem; }
}

/* ── Buttons ────────────────────────────────────────────────────── */

.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.5rem; }
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .6rem 1rem; border-radius: var(--radius-sm);
  font-size: .92rem; font-weight: 550; text-decoration: none;
  border: 1px solid var(--border); color: var(--text);
  background: var(--bg); transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--hover); text-decoration: none; }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: var(--on-accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* ── Code ───────────────────────────────────────────────────────── */

code {
  font-family: var(--mono); font-size: .875em;
  background: var(--code-bg); border: 1px solid var(--border-subtle);
  padding: .1em .35em; border-radius: 4px;
}
pre {
  margin: 0 0 1.25rem;
  background: var(--code-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: .9rem 1.1rem;
  overflow-x: auto;
  font-family: var(--mono); font-size: .84rem; line-height: 1.65;
  color: var(--text);
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; }
pre .c { color: var(--muted); }
pre .k { color: var(--accent); }
pre .s { color: var(--success); }
pre .w { color: var(--warning); }
pre .d { color: var(--danger); }

/* The install line: a command, and a button that takes it. */
.install {
  display: flex; align-items: stretch; gap: 0;
  max-width: 560px; margin: 1.5rem 0 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--code-bg); overflow: hidden;
}
.install code {
  flex: 1; min-width: 0;
  display: flex; align-items: center;
  padding: .7rem .9rem; border: 0; border-radius: 0; background: none;
  font-size: .86rem; white-space: nowrap; overflow-x: auto;
}
.install code::-webkit-scrollbar { height: 0; }
.install button {
  flex-shrink: 0;
  padding: 0 .9rem; border: 0; border-left: 1px solid var(--border-subtle);
  background: transparent; color: var(--text-2);
  font: inherit; font-size: .8rem; font-weight: 550; cursor: pointer;
  transition: background .12s, color .12s;
}
.install button:hover { background: var(--hover); color: var(--text); }
.install button.done { color: var(--success); }

/* ── Cards & grids ──────────────────────────────────────────────── */

.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
/* Four cards in a three-column grid leaves one stranded on its own row, which
   reads as unfinished. A wider minimum settles to 2×2 at the prose width. */
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

.card {
  border: 1px solid var(--border-subtle); border-radius: var(--radius);
  background: var(--surface); padding: 1.25rem;
}
.card h3 { margin: 0 0 .35rem; font-size: .98rem; }
.card p { margin: 0; font-size: .9rem; }
.card .kicker {
  display: block; font-size: .72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin-bottom: .5rem;
}

/* A card that is a link to a docs page. */
a.card { color: inherit; display: block; transition: border-color .12s, background .12s; }
a.card:hover { border-color: var(--accent); background: var(--elevated); text-decoration: none; }
a.card h3 { color: var(--text); }
a.card .more { display: inline-block; margin-top: .6rem; font-size: .84rem; color: var(--accent); }

/* ── Figures ────────────────────────────────────────────────────── */

figure { margin: 1.75rem 0; }
figure img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
/* A full-window screenshot of a mostly-empty app is mostly empty. Cropping to
   the content in CSS keeps the file honest — nothing is retouched, the frame is
   just shorter than the window was. */
figure img.crop { aspect-ratio: 16 / 7; object-fit: cover; object-position: top left; }
figcaption { margin-top: .6rem; font-size: .82rem; color: var(--muted); }
.shots {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  margin: 1.75rem 0 2.75rem;
}
.shots figure { margin: 0; }

/* ── Tables ─────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; margin: 0 0 1.25rem; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th {
  text-align: left; font-weight: 600; font-size: .74rem;
  text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  padding: .5rem .75rem .5rem 0; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: .6rem .75rem .6rem 0; border-bottom: 1px solid var(--border-subtle);
  color: var(--text-2); vertical-align: top;
}
td:first-child { color: var(--text); }
td code, th code { white-space: nowrap; }

/* ── Callout ────────────────────────────────────────────────────── */

.note {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  padding: .85rem 1rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 0 0 1.25rem;
}
.note p:last-child { margin-bottom: 0; }
.note.warn { border-left-color: var(--warning); background: color-mix(in srgb, var(--warning) 10%, transparent); }

/* ── Steps ──────────────────────────────────────────────────────── */

.steps { list-style: none; padding: 0; counter-reset: step; }
.steps > li {
  counter-increment: step;
  position: relative; padding-left: 2.5rem; margin-bottom: 2rem;
}
.steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: .05rem;
  display: grid; place-items: center;
  width: 1.6rem; height: 1.6rem; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-size: .8rem; font-weight: 650;
}
.steps h3 { margin-top: 0; }

/* ── Footer ─────────────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--border-subtle);
  margin-top: 5rem; padding: 2rem 1.5rem 3rem;
}
.site-footer .inner {
  max-width: var(--wide); margin: 0 auto;
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: baseline;
  font-size: .86rem; color: var(--muted);
}
.site-footer a { color: var(--text-2); }
.site-footer .spacer { flex: 1; }

/* ── Docs page furniture ────────────────────────────────────────── */

.crumb { font-size: .82rem; color: var(--muted); margin: 2.5rem 0 .5rem; }
.crumb a { color: var(--muted); }
.next {
  display: flex; flex-wrap: wrap; gap: .75rem;
  margin-top: 3.5rem; padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
}
