/* ─────────────────────────────────────────────────────────────
   Ember documentation.

   Same palette and type as the desktop shell, opened up for
   reading: a dark page with one warm accent, mono for anything
   structural (labels, section numbers, filenames, code) and
   Poppins for prose.
   ───────────────────────────────────────────────────────────── */

@font-face { font-family: "Poppins"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/poppins-400.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/poppins-500.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/poppins-600.woff2") format("woff2"); }
@font-face { font-family: "Geist Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/geist-mono-400.woff2") format("woff2"); }
@font-face { font-family: "Geist Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/geist-mono-500.woff2") format("woff2"); }

:root {
  --sans: "Poppins", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
  --head-h: 56px;
  --rail-w: 236px;
  --toc-w: 208px;
  --measure: 38rem;
  --r: 6px;
  --r-lg: 12px;
}

:root[data-theme="night"] {
  --bg: #0a0a0a;
  --panel: #0f0f10;
  --raised: #0d0d0f;
  --hover: #161618;
  --line: #232326;
  --line-soft: #19191c;
  --fg: #ededed;
  --prose: #c3c3ca;
  --fg-mid: #a1a1a6;
  --fg-dim: #6e6e76;
  --fg-faint: #4d4d54;
  --accent: #f0663a;
  --accent-soft: rgba(240, 102, 58, .12);
  --bloom-a: rgba(240, 102, 58, .16);
  --bloom-b: rgba(240, 102, 58, .05);
  --grain: .035;
  --tk-str: #93939c;
  --tk-num: #e0a96d;
  --tk-key: #e6e6ea;
  --tk-punct: #6a6a72;
  color-scheme: dark;
}

:root[data-theme="day"] {
  --bg: #fdfcfb;
  --panel: #f6f5f3;
  --raised: #ffffff;
  --hover: #f0efec;
  --line: #e5e3df;
  --line-soft: #eeece8;
  --fg: #171717;
  --prose: #35353a;
  --fg-mid: #545454;
  --fg-dim: #74747c;
  --fg-faint: #9a9aa2;
  --accent: #d2481a;
  --accent-soft: rgba(210, 72, 26, .09);
  --bloom-a: rgba(210, 72, 26, .10);
  --bloom-b: rgba(210, 72, 26, .04);
  --grain: 0;
  --tk-str: #6f6f78;
  --tk-num: #a4601b;
  --tk-key: #16161a;
  --tk-punct: #9a9aa2;
  color-scheme: light;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--prose);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.72;
  letter-spacing: -.006em;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Warm light spilling from the top-left, plus a faint grain so the large
   dark areas are not flat. Both sit behind everything and never scroll. */
.bloom {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(720px 380px at 8% -8%, var(--bloom-a), transparent 68%),
    radial-gradient(900px 500px at 100% 8%, var(--bloom-b), transparent 72%);
}

.bloom::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

svg { display: block; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

a { color: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
::selection { background: var(--accent-soft); }

.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 20;
  padding: 8px 14px;
  border-radius: var(--r);
  background: var(--raised);
  font-size: 13px;
}
.skip:focus { left: 12px; }

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

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--head-h);
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--fg);
  font-weight: 500;
  font-size: 14.5px;
  letter-spacing: -.02em;
  text-decoration: none;
}
.brand svg { color: var(--accent); fill: color-mix(in srgb, var(--accent) 18%, transparent); }
.brand-tag {
  padding-top: 1px;
  color: var(--fg-dim);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .06em;
}

.top-actions { display: flex; align-items: center; gap: 8px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--fg-mid);
  font-family: var(--mono);
  font-size: 11.5px;
  text-decoration: none;
  transition: color .16s, border-color .16s, background .16s;
}
.pill:hover { border-color: color-mix(in srgb, var(--accent) 42%, var(--line)); color: var(--fg); }
.pill-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.pill-button { cursor: pointer; }
.pill-button[data-state="done"] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }

.icon-button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--fg-mid);
  cursor: pointer;
  transition: color .16s, border-color .16s;
}
.icon-button:hover { color: var(--fg); border-color: var(--fg-faint); }
:root[data-theme="night"] .sun { display: none; }
:root[data-theme="day"] .moon { display: none; }

.nav-toggle { display: none; }

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

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--toc-w);
  gap: 56px;
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 28px 120px;
}
.layout-wide { grid-template-columns: var(--rail-w) minmax(0, 1fr); }

.nav {
  position: sticky;
  top: var(--head-h);
  align-self: start;
  max-height: calc(100vh - var(--head-h));
  padding: 34px 0 40px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.nav-group + .nav-group { margin-top: 26px; }
.nav-label {
  margin: 0 0 9px;
  color: var(--fg-faint);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.nav ul { margin: 0; padding: 0; list-style: none; }
.nav li a {
  position: relative;
  display: block;
  padding: 5px 10px;
  border-radius: var(--r);
  color: var(--fg-mid);
  font-size: 13.5px;
  text-decoration: none;
  transition: color .14s, background .14s;
}
.nav li a:hover { color: var(--fg); background: var(--hover); }
.nav li a[aria-current="page"] { color: var(--fg); background: var(--accent-soft); font-weight: 500; }
.nav li a[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
.nav-file { font-family: var(--mono); font-size: 12px; }

/* ── Document ──────────────────────────────────────────────── */

.doc { padding: 46px 0 0; min-width: 0; }

.kicker {
  margin: 0 0 14px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.lede {
  margin: 0 0 34px;
  max-width: var(--measure);
  color: var(--fg-mid);
  font-size: 17px;
  line-height: 1.62;
}

.prose { max-width: var(--measure); counter-reset: section; }

.prose h1, .doc-index h1, .hero h1 {
  margin: 0 0 18px;
  color: var(--fg);
  font-size: 33px;
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -.032em;
}

/* The first paragraph after the title carries the page. */
.prose h1 + p {
  margin-bottom: 34px;
  color: var(--fg-mid);
  font-size: 17px;
  line-height: 1.62;
}

.prose h2 {
  position: relative;
  margin: 58px 0 16px;
  padding-top: 22px;
  border-top: 1px solid var(--line-soft);
  color: var(--fg);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.022em;
}
.prose h2::before {
  counter-increment: section;
  content: counter(section, decimal-leading-zero);
  position: absolute;
  left: -3rem;
  top: 24px;
  color: var(--fg-faint);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .04em;
}

.prose h3 { margin: 34px 0 10px; color: var(--fg); font-size: 15.5px; font-weight: 600; letter-spacing: -.012em; }
.prose h4 { margin: 26px 0 8px; color: var(--fg); font-size: 14px; font-weight: 500; }

.prose p { margin: 0 0 18px; }
.prose a { color: var(--accent); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 32%, transparent); transition: border-color .15s; }
.prose a:hover { border-bottom-color: var(--accent); }

.anchor {
  margin-left: 10px;
  border: 0;
  color: var(--fg-faint);
  font-family: var(--mono);
  font-size: .72em;
  opacity: 0;
  transition: opacity .15s;
}
h2:hover .anchor, h3:hover .anchor, h4:hover .anchor, .anchor:focus-visible { opacity: 1; }

.prose ul, .prose ol { margin: 0 0 18px; padding-left: 1.25rem; }
.prose li { margin-bottom: 7px; }
.prose li::marker { color: var(--fg-faint); }
.prose ul ul, .prose ol ol, .prose ul ol, .prose ol ul { margin: 7px 0 0; }

.prose blockquote {
  margin: 0 0 20px;
  padding: 2px 0 2px 18px;
  border-left: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--fg-mid);
}
.prose blockquote p:last-child { margin-bottom: 0; }

.prose hr { margin: 40px 0; border: 0; border-top: 1px solid var(--line); }

.prose code {
  padding: 2px 5px;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: var(--panel);
  color: var(--fg);
  font-family: var(--mono);
  font-size: .855em;
  letter-spacing: -.01em;
}
.prose a code { color: inherit; }

.table-scroll { margin: 0 0 22px; overflow-x: auto; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; }
.prose th, .prose td { padding: 9px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th {
  color: var(--fg-dim);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
}

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

figure.code {
  position: relative;
  margin: 0 0 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--raised);
  overflow: hidden;
}
:root[data-theme="day"] figure.code { background: var(--panel); }

figure.code::after {
  content: attr(data-language);
  position: absolute;
  top: 10px;
  right: 14px;
  color: var(--fg-faint);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  transition: opacity .15s;
}
figure.code:hover::after { opacity: 0; }

figure.code pre { margin: 0; padding: 18px 20px; overflow-x: auto; }
figure.code code {
  display: block;
  color: var(--prose);
  font-family: var(--mono);
  font-size: 12.75px;
  line-height: 1.72;
  letter-spacing: -.008em;
  tab-size: 2;
}

.code-copy {
  position: absolute;
  top: 7px;
  right: 8px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel);
  color: var(--fg-dim);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, color .15s, border-color .15s;
}
figure.code:hover .code-copy, .code-copy:focus-visible { opacity: 1; }
.code-copy:hover { color: var(--fg); border-color: var(--fg-faint); }
.code-copy[data-state="done"] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); opacity: 1; }

.tk-com { color: var(--fg-faint); font-style: italic; }
.tk-str { color: var(--tk-str); }
.tk-key { color: var(--tk-key); }
.tk-kw, .tk-tag, .tk-cmd { color: var(--accent); }
.tk-num, .tk-lit, .tk-var, .tk-flag { color: var(--tk-num); }
.tk-attr, .tk-fn { color: var(--fg-mid); }
.tk-punct { color: var(--tk-punct); }

/* ── On this page ──────────────────────────────────────────── */

.toc {
  position: sticky;
  top: var(--head-h);
  align-self: start;
  max-height: calc(100vh - var(--head-h));
  padding: 52px 0 40px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.toc-label {
  margin: 0 0 10px;
  color: var(--fg-faint);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.toc ul { margin: 0; padding: 0 0 0 12px; border-left: 1px solid var(--line); list-style: none; }
.toc li.lvl-3 { padding-left: 12px; }
.toc a {
  position: relative;
  display: block;
  padding: 4px 0;
  color: var(--fg-dim);
  font-size: 12.5px;
  line-height: 1.45;
  text-decoration: none;
  transition: color .14s;
}
.toc a:hover { color: var(--fg-mid); }
.toc a.active { color: var(--accent); }
.toc a.active::before {
  content: "";
  position: absolute;
  left: -13px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--accent);
}

/* ── Pager and footer ──────────────────────────────────────── */

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: var(--measure);
  margin: 64px 0 0;
}
.pager-link {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  text-decoration: none;
  transition: border-color .16s, background .16s, transform .16s;
}
.pager-link:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); background: var(--panel); transform: translateY(-1px); }
.pager-link[rel="next"] { text-align: right; }
.pager-dir { color: var(--fg-faint); font-family: var(--mono); font-size: 10px; letter-spacing: .13em; text-transform: uppercase; }
.pager-title { color: var(--fg); font-size: 14px; font-weight: 500; }

.doc-foot {
  max-width: var(--measure);
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  color: var(--fg-dim);
  font-size: 13px;
}
.doc-foot p { margin: 0; }
.doc-foot a { color: var(--fg-mid); text-decoration: none; border-bottom: 1px solid var(--line); }
.doc-foot a:hover { color: var(--accent); }
.doc-foot code { font-family: var(--mono); font-size: 12px; }

/* ── Home ──────────────────────────────────────────────────── */

.home { padding: 60px 0 0; min-width: 0; }
.hero { max-width: 40rem; margin-bottom: 76px; }
.hero h1 { font-size: 54px; letter-spacing: -.04em; }
.hero .lede { font-size: 18.5px; margin-bottom: 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.button {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: transform .16s, box-shadow .16s, background .16s;
}
.button:hover { transform: translateY(-1px); box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 32%, transparent); }
.button-quiet { background: transparent; border-color: var(--line); color: var(--fg); }
.button-quiet:hover { border-color: var(--fg-faint); box-shadow: none; }

.dual {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 380px);
  gap: 40px;
  align-items: center;
  margin-bottom: 76px;
  padding: 30px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}
.dual-copy { max-width: 34rem; }
.dual-copy h2 { margin: 0 0 12px; color: var(--fg); font-size: 22px; font-weight: 600; letter-spacing: -.026em; }
.dual-copy p { margin: 0; color: var(--fg-mid); }
.dual-copy code { padding: 1px 5px; border-radius: 5px; background: var(--panel); font-family: var(--mono); font-size: .85em; }
.dual-copy a { color: var(--accent); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 32%, transparent); }

.dual-demo { display: grid; gap: 8px; }
.demo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--fg-mid);
}
.demo-tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--hover);
  color: var(--fg-dim);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.demo-tag-alt { background: var(--accent-soft); color: var(--accent); }
.demo-row:last-child { border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }

.grid-section { margin-bottom: 72px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }

.card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
  text-decoration: none;
  transition: border-color .18s, transform .18s, background .18s;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); transform: translateY(-2px); }
.card-section { color: var(--fg-faint); font-family: var(--mono); font-size: 10px; letter-spacing: .13em; text-transform: uppercase; }
.card h2 { margin: 0; color: var(--fg); font-size: 16.5px; font-weight: 600; letter-spacing: -.02em; }
.card p {
  margin: 0;
  color: var(--fg-dim);
  font-size: 13.5px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-raw { margin-top: auto; padding-top: 8px; color: var(--fg-faint); font-family: var(--mono); font-size: 11px; transition: color .18s; }
.card:hover .card-raw { color: var(--accent); }

.more {
  display: inline-block;
  margin-top: 18px;
  color: var(--fg-mid);
  font-family: var(--mono);
  font-size: 12px;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.more:hover { color: var(--accent); }
.more::after { content: " →"; }

.home-prose { max-width: var(--measure); }
.doc-index .lede code { padding: 2px 5px; border-radius: 5px; background: var(--panel); font-family: var(--mono); font-size: .85em; }
.doc-index .cards { margin-top: 8px; }

/* ── Entrance ──────────────────────────────────────────────── */

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.top, .nav, .doc, .home, .toc { animation: rise .5s cubic-bezier(.2, .7, .3, 1) backwards; }
.nav { animation-delay: .04s; }
.doc, .home { animation-delay: .08s; }
.toc { animation-delay: .14s; }

/* The first visit gets the entrance sequence. In-page navigation keeps the
   shell mounted, so a new article does not replay it. */
html[data-client-navigation] .nav,
html[data-client-navigation] .doc,
html[data-client-navigation] .home,
html[data-client-navigation] .toc { animation: none; }

/* ── Narrow ────────────────────────────────────────────────── */

@media (max-width: 1180px) {
  .layout { grid-template-columns: var(--rail-w) minmax(0, 1fr); gap: 36px; }
  .toc { display: none; }
  .dual { grid-template-columns: minmax(0, 1fr); gap: 28px; }
}

@media (max-width: 820px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0 20px 80px; }
  .nav-toggle { display: grid; }
  .nav {
    position: static;
    max-height: none;
    padding: 22px 0 4px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--line-soft);
  }
  .nav[hidden] { display: none; }
  .prose h2::before { position: static; display: block; margin-bottom: 4px; }
  figure.code::after { display: none; }
  .code-copy { opacity: 1; }
  .hero h1 { font-size: 40px; }
  .prose h1, .doc-index h1 { font-size: 27px; }
  .pager { grid-template-columns: 1fr; }
  .top { padding: 0 16px; }
  .pill:not(.pill-button) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}
