/* Daravel documentation site. Colours come from the brand mark
   (docs/brand/README.md): navy tile, ice wing, fire body. */
:root {
  --paper: #f6f8fc;
  --surface: #ffffff;
  --sunken: #eef2f9;
  --ink: #11133a;
  --ink-soft: #4a4f78;
  --rule: #d9deec;
  --link: #1d4ed8;
  --ice: #0ea5e9;
  --fire: #fb923c;
  --ember: #e11d48;
  --focus: #6d28d9;
  --code-bg: #0b0d2a;
  --code-ink: #e6e9ff;
  --code-muted: #8a90c4;
  --tok-keyword: #67e8f9;
  --tok-string: #fdba74;
  --tok-comment: #8a90c4;
  --tok-type: #a5b4fc;
  --tok-number: #f9a8d4;
  --seam: linear-gradient(180deg, #a5f3fc, #38bdf8 35%, #fb923c 65%, #e11d48);
  --font: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #0b0d2a;
  --surface: #11143a;
  --sunken: #161a4a;
  --ink: #e6e9ff;
  --ink-soft: #a9aed6;
  --rule: #262b63;
  --link: #67e8f9;
  --code-bg: #070820;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0b0d2a;
    --surface: #11143a;
    --sunken: #161a4a;
    --ink: #e6e9ff;
    --ink-soft: #a9aed6;
    --rule: #262b63;
    --link: #67e8f9;
    --code-bg: #070820;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
img { max-width: 100%; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 12px; z-index: 50; background: var(--surface); padding: 8px 12px; }

/* Header */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  height: 64px; padding: 0 24px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 19px; letter-spacing: -0.01em; }
.brand img { width: 30px; height: 30px; }
.brand .ver { font: 500 12px/1 var(--mono); color: var(--ink-soft); border: 1px solid var(--rule); border-radius: 999px; padding: 4px 8px; }
.topnav { display: flex; gap: 18px; margin-left: 8px; }
.topnav a { color: var(--ink-soft); text-decoration: none; font-weight: 500; font-size: 15px; }
.topnav a:hover, .topnav a[aria-current] { color: var(--ink); }
.tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.tool-button {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 12px;
  background: var(--surface); color: var(--ink-soft);
  border: 1px solid var(--rule); border-radius: 8px;
  font: 500 14px/1 var(--font); cursor: pointer; text-decoration: none;
}
.tool-button:hover { color: var(--ink); border-color: var(--ink-soft); }
.tool-button kbd { font: 500 12px/1 var(--mono); color: var(--ink-soft); }
.search-trigger { min-width: 200px; }
.search-trigger kbd { margin-left: auto; }
.lang a { padding: 0 6px; color: var(--ink-soft); text-decoration: none; }
.lang a[aria-current] { color: var(--ink); font-weight: 700; }
.menu-toggle { display: none; }

/* Documentation layout */
.docs { display: grid; grid-template-columns: 272px minmax(0, 1fr) 224px; max-width: 1440px; margin: 0 auto; }
.sidebar {
  position: sticky; top: 64px; align-self: start;
  height: calc(100vh - 64px); overflow-y: auto;
  padding: 24px 20px 40px 24px; border-right: 1px solid var(--rule);
}
.version-select { width: 100%; height: 36px; margin-bottom: 18px; padding: 0 10px; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); color: var(--ink); font: 500 14px var(--font); }
.sidebar details { margin-bottom: 10px; }
.sidebar summary { cursor: pointer; font-weight: 700; font-size: 15px; padding: 4px 0; list-style: none; }
.sidebar summary::-webkit-details-marker { display: none; }
.sidebar summary::before { content: "▸"; display: inline-block; width: 1em; color: var(--ink-soft); transition: transform .15s; }
.sidebar details[open] summary::before { transform: rotate(90deg); }
.sidebar ul { list-style: none; margin: 4px 0 0; padding: 0 0 0 14px; border-left: 1px solid var(--rule); }
.sidebar li a { display: block; padding: 4px 10px; margin-left: -1px; border-left: 2px solid transparent; color: var(--ink-soft); text-decoration: none; font-size: 15px; line-height: 1.4; }
.sidebar li a:hover { color: var(--ink); }
.sidebar li a[aria-current="page"] { color: var(--ink); font-weight: 600; border-left-color: var(--fire); }

.article { min-width: 0; padding: 40px 56px 80px; }
.prose { max-width: 760px; }
.prose h1 { font-size: 44px; line-height: 1.1; letter-spacing: -0.025em; margin: 0 0 24px; font-weight: 800; }
.prose h2 { font-size: 28px; line-height: 1.2; letter-spacing: -0.015em; margin: 52px 0 14px; padding-top: 4px; }
.prose h3 { font-size: 20px; margin: 32px 0 10px; }
.prose h2 .anchor, .prose h3 .anchor { margin-left: 8px; color: var(--ink-soft); text-decoration: none; opacity: 0; }
.prose h2:hover .anchor, .prose h3:hover .anchor, .anchor:focus { opacity: 1; }
.prose p, .prose li { max-width: 72ch; }
.prose :not(pre) > code { font: 500 0.86em var(--mono); background: var(--sunken); padding: 2px 6px; border-radius: 5px; }
.prose table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; font-size: 15px; margin: 20px 0; }
.prose th, .prose td { border-bottom: 1px solid var(--rule); padding: 9px 12px; text-align: left; vertical-align: top; }
.prose th { font-weight: 700; border-bottom-width: 2px; }
.prose blockquote { margin: 20px 0; padding: 4px 18px; border-left: 3px solid var(--ice); color: var(--ink-soft); }
.banner { margin: 0 0 28px; padding: 12px 16px; border-radius: 10px; background: var(--sunken); border-left: 4px solid var(--fire); font-size: 15px; }

/* GitHub alerts: > [!NOTE] */
.markdown-alert { margin: 22px 0; padding: 12px 18px; border-radius: 10px; background: var(--sunken); border-left: 4px solid var(--ice); }
.markdown-alert-title { font-weight: 700; margin: 0 0 4px; }
.markdown-alert-tip { border-left-color: #10b981; }
.markdown-alert-important { border-left-color: var(--focus); }
.markdown-alert-warning, .markdown-alert-caution { border-left-color: var(--fire); }

/* Code */
pre { position: relative; margin: 20px 0; padding: 18px 20px; overflow-x: auto; background: var(--code-bg); color: var(--code-ink); border: 1px solid var(--rule); border-radius: 12px; font: 400 14px/1.6 var(--mono); }
pre code { font: inherit; }
.copy { position: absolute; top: 10px; right: 10px; height: 28px; padding: 0 10px; border-radius: 6px; border: 1px solid #2a2f6b; background: #161a4a; color: var(--code-muted); font: 500 12px var(--font); cursor: pointer; opacity: 0; transition: opacity .15s; }
pre:hover .copy, .copy:focus { opacity: 1; }
.tok-k { color: var(--tok-keyword); }
.tok-s { color: var(--tok-string); }
.tok-c { color: var(--tok-comment); font-style: italic; }
.tok-t { color: var(--tok-type); }
.tok-n { color: var(--tok-number); }

/* Previous / next */
.pager { display: flex; gap: 16px; justify-content: space-between; margin-top: 64px; padding-top: 24px; border-top: 1px solid var(--rule); max-width: 760px; }
.pager a { display: block; padding: 14px 18px; border: 1px solid var(--rule); border-radius: 10px; text-decoration: none; color: var(--ink); max-width: 48%; }
.pager a:hover { border-color: var(--ink-soft); }
.pager span { display: block; font-size: 13px; color: var(--ink-soft); }
.pager .next { margin-left: auto; text-align: right; }

/* On this page */
.toc { position: sticky; top: 64px; align-self: start; padding: 40px 24px; font-size: 14px; max-height: calc(100vh - 64px); overflow-y: auto; }
.toc p { font-weight: 700; margin: 0 0 8px; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li a { display: block; padding: 3px 0; color: var(--ink-soft); text-decoration: none; }
.toc li.sub a { padding-left: 12px; }
.toc li a.active { color: var(--ink); font-weight: 600; }

/* Search dialog */
.search-dialog { width: min(640px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--rule); border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgba(11, 13, 42, .35); }
.search-dialog::backdrop { background: rgba(11, 13, 42, .45); }
.search-dialog input { width: 100%; height: 56px; padding: 0 20px; border: 0; border-bottom: 1px solid var(--rule); background: transparent; color: var(--ink); font: 400 18px var(--font); }
.search-dialog input:focus { outline: none; }
.search-results { list-style: none; margin: 0; padding: 8px; max-height: 60vh; overflow-y: auto; }
.search-results a { display: block; padding: 10px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.search-results a small { display: block; color: var(--ink-soft); }
.search-results li[aria-selected="true"] a { background: var(--sunken); }
.search-empty { padding: 18px 20px; color: var(--ink-soft); }

/* Landing page */
.hero { max-width: 1200px; margin: 0 auto; padding: 72px 24px 32px; }
.hero h1 { font-size: clamp(40px, 6.2vw, 76px); line-height: 0.98; letter-spacing: -0.035em; font-weight: 800; max-width: 21ch; margin: 0 0 24px; }
.hero .lede { font-size: 20px; color: var(--ink-soft); max-width: 60ch; margin: 0 0 32px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.button { display: inline-flex; align-items: center; height: 46px; padding: 0 20px; border-radius: 10px; font-weight: 700; text-decoration: none; }
.button.primary { background: var(--ink); color: var(--paper); }
.button.secondary { border: 1px solid var(--rule); color: var(--ink); background: var(--surface); }
.install { display: inline-flex; align-items: center; gap: 12px; height: 46px; padding: 0 8px 0 16px; border-radius: 10px; background: var(--code-bg); color: var(--code-ink); font: 400 14px var(--mono); }
.install button { height: 32px; padding: 0 10px; border: 1px solid #2a2f6b; border-radius: 6px; background: #161a4a; color: var(--code-muted); font: 500 12px var(--font); cursor: pointer; }

.compare { max-width: 1200px; margin: 40px auto 0; padding: 0 24px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: -1px; }
.tabs button { height: 40px; padding: 0 16px; border: 1px solid transparent; border-bottom: 0; border-radius: 10px 10px 0 0; background: transparent; color: var(--ink-soft); font: 600 15px var(--font); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--code-bg); color: var(--code-ink); }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) 6px minmax(0, 1fr); background: var(--code-bg); border: 1px solid var(--rule); border-radius: 0 14px 14px 14px; overflow: hidden; }
.pair pre { border: 0; }
.pair[hidden] { display: none; }
.pair .side { min-width: 0; padding: 18px 0 6px; }
.pair .side h3 { margin: 0; padding: 0 22px; font: 500 13px var(--mono); color: var(--code-muted); }
.pair pre { margin: 0; border-radius: 0; background: transparent; }
.pair .seam { background: var(--seam); }
.pair .note { grid-column: 1 / -1; margin: 0; padding: 14px 22px; border-top: 1px solid #1d2152; color: var(--code-muted); font-size: 15px; }

.section { max-width: 1200px; margin: 0 auto; padding: 88px 24px 0; }
.section > h2 { font-size: 36px; line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 12px; max-width: 24ch; }
.section > p { color: var(--ink-soft); max-width: 62ch; margin: 0 0 36px; }
.reasons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 56px; margin: 0; }
.reasons div { padding: 20px 0; border-top: 1px solid var(--rule); }
.reasons dt { font-weight: 700; font-size: 19px; margin-bottom: 6px; }
.reasons dt a { color: var(--ink); text-decoration: none; }
.reasons dt a:hover { color: var(--link); text-decoration: underline; }
.reasons dd { margin: 0; color: var(--ink-soft); }
.reasons dd a { white-space: nowrap; }

.measures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px; }
.measure strong { display: block; font-size: 52px; line-height: 1; letter-spacing: -0.03em; font-weight: 800; }
.measure span { display: block; margin-top: 10px; color: var(--ink-soft); }
.bar { height: 8px; margin-top: 16px; background: var(--sunken); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ice); }
.source { margin-top: 28px; font-size: 14px; color: var(--ink-soft); }

.packages { width: 100%; border-collapse: collapse; }
.packages td { padding: 14px 0; border-top: 1px solid var(--rule); vertical-align: top; }
.packages td:first-child { width: 34%; font: 500 15px var(--mono); }
.packages .planned { color: var(--ink-soft); }

.footer { max-width: 1200px; margin: 96px auto 0; padding: 32px 24px 48px; border-top: 1px solid var(--rule); color: var(--ink-soft); font-size: 14px; display: flex; flex-wrap: wrap; gap: 12px 32px; }

@media (max-width: 1200px) {
  .docs { grid-template-columns: 260px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 900px) {
  .topnav { display: none; }
  .menu-toggle { display: inline-flex; }
  .docs { display: block; }
  .sidebar { display: none; position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--rule); }
  .sidebar.open { display: block; }
  .article { padding: 28px 16px 64px; }
  .prose h1 { font-size: 34px; }
  .search-trigger { min-width: 0; }
  .search-trigger kbd, .tools .github { display: none; }
  .tools { gap: 6px; }
  .tool-button { padding: 0 10px; }
  .lang a { padding: 0 4px; }
  .search-trigger .label { display: none; }
  .reasons, .measures { grid-template-columns: 1fr; }
  .pair { grid-template-columns: 1fr; }
  .pair .seam { height: 6px; }
  .hero { padding-top: 48px; }
  .topbar { padding: 0 16px; gap: 12px; }
  .brand .ver { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
