/* Sideporch's own colours (the "Porch" theme in src/themes.rs) and its
   typeface. The hero is the porch at dusk; the rest of the page is quiet. */
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-weight: 200 800;
  font-display: swap;
  src: url("/fonts/normal-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-weight: 200 800;
  font-display: swap;
  src: url("/fonts/normal-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light dark;
  --floor: #24403C; --floor-2: #2E524D; --floor-3: #3B6660;
  --haint: #B9E0DA; --haint-2: #DCEFEC; --lamp: #F5C04A;
  --ink: #1B2826; --muted: #52655F; --line: #DCE4E2; --screen: #F5F8F7; --paper: #FFFFFF;
  --night: #101A19; --night-2: #172422; --night-line: #2A3B38;
  --bg: var(--paper); --fg: var(--ink); --soft: var(--screen); --border: var(--line); --link: var(--floor-3);
  --measure: 38rem;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: var(--night); --fg: var(--haint-2); --soft: var(--night-2); --border: var(--night-line); --link: var(--haint); --muted: #9DB3AE; }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 1.0625rem/1.6 "Atkinson Hyperlegible Next", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-underline-offset: 0.18em; text-decoration-thickness: 0.07em; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--lamp); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.15; margin: 0; }
p { margin: 0; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.88em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The porch at dusk */

.dusk {
  color: var(--haint-2);
  background:
    radial-gradient(40rem 26rem at 78% 18%, rgb(245 192 74 / 0.16), transparent 70%),
    var(--floor);
}
.dusk a { color: var(--haint-2); }
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  max-width: 72rem; margin: 0 auto; padding: 1.25rem 1.5rem;
}
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 800; font-size: 1.2rem; text-decoration: none; }
.bar ul { display: flex; gap: 1.5rem; margin: 0; padding: 0; list-style: none; font-weight: 600; }
.bar ul a { text-decoration: none; }
.bar ul a:hover { text-decoration: underline; }

.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 3.5rem; align-items: center;
  max-width: 72rem; margin: 0 auto; padding: 2.5rem 1.5rem 5rem;
}
.hero h1 {
  font-size: clamp(2.6rem, 5.4vw, 4.4rem); font-weight: 800; letter-spacing: -0.025em; line-height: 1.02;
  color: #fff; max-width: 12ch; text-wrap: balance;
}
.lede { margin-top: 1.4rem; max-width: 34rem; font-size: 1.2rem; line-height: 1.55; color: var(--haint); }
.start { margin-top: 2.2rem; max-width: 34rem; }
.start-label { font-weight: 700; color: #fff; }
.copyline {
  display: flex; align-items: stretch; margin-top: 0.5rem;
  border: 1px solid var(--floor-3); border-radius: 0.7rem; background: rgb(0 0 0 / 0.22); overflow: hidden;
}
.copyline code { flex: 1; min-width: 0; padding: 0.8rem 1rem; overflow-x: auto; white-space: nowrap; color: var(--haint-2); }
.copyline button {
  flex-shrink: 0; border: 0; border-left: 1px solid var(--floor-3); padding: 0 1.1rem;
  font: inherit; font-weight: 700; color: var(--floor); background: var(--haint); cursor: pointer;
}
.copyline button:hover { background: var(--haint-2); }
.start-note { margin-top: 0.7rem; font-size: 0.95rem; color: var(--haint); }

/* The conversation under the roof */
.porch { position: relative; margin: 0; padding: 2.6rem 0 0 1.2rem; }
.roof { position: absolute; left: 0; top: 0; width: 100%; height: 5.2rem; color: var(--haint); overflow: visible; }
.lamp {
  position: absolute; right: 12%; top: 3.6rem; width: 0.9rem; height: 0.9rem; border-radius: 50%;
  background: var(--lamp); box-shadow: 0 0 1.6rem 0.7rem rgb(245 192 74 / 0.45), 0 0 5rem 2rem rgb(245 192 74 / 0.18);
}
.window {
  position: relative; margin-top: 2.4rem; border-radius: 0.9rem; overflow: hidden;
  --muted: #52655F; --line: #DCE4E2;
  background: var(--paper); color: var(--ink); box-shadow: 0 1.5rem 3rem -1.2rem rgb(0 0 0 / 0.55);
}
.window-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem 1.1rem; border-bottom: 1px solid var(--line); font-weight: 800;
}
.online { display: flex; align-items: center; gap: 0.4rem; font-weight: 600; font-size: 0.85rem; color: var(--muted); }
.dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: #3A9A6E; }
.talk { list-style: none; margin: 0; padding: 0.4rem 0 0.2rem; }
.msg { display: flex; gap: 0.75rem; padding: 0.45rem 1.1rem; font-size: 0.95rem; line-height: 1.45; }
.avatar {
  flex-shrink: 0; display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 0.55rem;
  font-weight: 800; color: #fff; background: hsl(var(--hue) 32% 38%);
}
.bot-face { background: var(--floor-3); }
.who { font-weight: 800; }
.who time { margin-left: 0.3rem; font-weight: 400; font-size: 0.78rem; color: var(--muted); }
.badge { padding: 0 0.35rem; border-radius: 0.25rem; font-size: 0.72rem; font-weight: 700; background: var(--haint-2); color: var(--floor); }
.spoken { margin-left: 0.3rem; padding: 0 0.35rem; border-radius: 0.25rem; font-size: 0.72rem; font-weight: 700; background: var(--haint-2); color: var(--floor); }
.poll { margin-top: 0.35rem; padding: 0.7rem 0.8rem; border: 1px solid var(--line); border-radius: 0.7rem; }
.poll-q { font-weight: 800; display: flex; justify-content: space-between; gap: 0.5rem; }
.poll-q span { font-size: 0.75rem; font-weight: 700; color: var(--muted); }
.opt { display: flex; align-items: center; gap: 0.55rem; margin-top: 0.35rem; padding: 0.3rem 0.5rem; border: 1px solid var(--line); border-radius: 0.5rem; }
.rank { display: grid; place-items: center; width: 1.35rem; height: 1.35rem; border-radius: 0.3rem; background: var(--screen); font-size: 0.8rem; font-weight: 800; }
.opt.win { background: var(--haint-2); border-color: var(--floor-3); }
.opt .tag { margin-left: auto; padding: 0 0.4rem; border-radius: 0.3rem; background: var(--lamp); font-size: 0.75rem; font-weight: 800; }
.opt.out { color: var(--muted); }
.opt .note { margin-left: auto; font-size: 0.78rem; }
.poll-foot { margin-top: 0.45rem; font-size: 0.8rem; color: var(--muted); }
.typing { height: 1.6rem; padding: 0 1.1rem 0.6rem 3.95rem; font-size: 0.8rem; color: var(--muted); opacity: 0; }

/* One moment on load: porch.js reveals the messages one by one. Without
   it, everything shows at once. */
.talk.playing .msg { opacity: 0; transform: translateY(0.4rem); }
.talk.playing .msg.here { opacity: 1; transform: none; transition: opacity 0.35s ease, transform 0.35s ease; }
.typing.on { opacity: 1; transition: opacity 0.2s; }
.opt.win .tag { transition: opacity 0.3s 0.6s; }
.talk.playing .msg:not(.here) .tag { opacity: 0; }

/* The quiet part */

main.landing { max-width: 72rem; margin: 0 auto; padding: 0 1.5rem; }
.landing > section { margin-top: 6rem; }
.demo-note { margin-top: 0.7rem; font-size: 0.92rem; opacity: 0.8; }
.why-lede { margin-top: 1rem; max-width: var(--measure); font-size: 1.15rem; color: var(--muted); }
.reasons { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.5rem; margin-top: 2.2rem; }
.reasons > div { padding: 1.2rem 1.3rem; border: 1px solid var(--border); border-radius: 0.8rem; }
.reasons h3 { font-size: 1.1rem; font-weight: 800; }
.reasons p { margin-top: 0.5rem; color: var(--muted); font-size: 0.97rem; }
.compare .table-wrap { margin-top: 1.8rem; overflow-x: auto; }
.compare table { width: 100%; min-width: 44rem; border-collapse: collapse; font-size: 0.97rem; }
.compare th, .compare td { padding: 0.7rem 0.8rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.compare thead th { font-size: 0.9rem; font-weight: 800; }
.compare thead th:nth-child(2), .compare td:first-of-type { background: var(--soft); }
.compare tbody th { font-weight: 700; color: var(--muted); width: 22%; }
.compare-note { margin-top: 1rem; max-width: var(--measure); font-size: 0.92rem; color: var(--muted); }
.faq-list { margin-top: 1.8rem; max-width: 48rem; }
.faq details { border-bottom: 1px solid var(--border); padding: 0.9rem 0; }
.faq summary { cursor: pointer; font-weight: 700; font-size: 1.05rem; }
.faq details p { margin-top: 0.6rem; color: var(--muted); max-width: var(--measure); }
h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); font-weight: 800; letter-spacing: -0.015em; max-width: 24ch; text-wrap: balance; }

.groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3rem; margin-top: 2.5rem; }
.groups h3 { font-size: 1.15rem; font-weight: 800; padding-bottom: 0.7rem; border-bottom: 3px solid var(--haint); }
.groups ul { margin: 0; padding: 0; list-style: none; }
.groups li { padding: 0.8rem 0; border-bottom: 1px solid var(--border); color: var(--muted); line-height: 1.5; }
.groups li strong { color: var(--fg); }
.groups code { color: var(--fg); }

.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem 2rem; }
.gallery figure { margin: 0; }
.gallery .wide { grid-column: 1 / -1; }
.gallery img { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: 0.8rem; }
.gallery figcaption { margin-top: 0.6rem; max-width: var(--measure); color: var(--muted); font-size: 0.95rem; }

.size { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 3rem; align-items: center; }
.size p { margin-top: 1rem; max-width: var(--measure); color: var(--muted); }
.size table { width: 100%; border-collapse: collapse; font-size: 1.05rem; }
.size th { text-align: left; font-size: 0.9rem; font-weight: 700; color: var(--muted); padding: 0 0 0.6rem; border-bottom: 2px solid var(--fg); }
.size th:last-child, .size td:last-child { text-align: right; }
.size td { padding: 0.85rem 0; border-bottom: 1px solid var(--border); }
.size td:last-child { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

.install { max-width: 50rem; }
.steps { margin: 2.5rem 0 0; padding: 0; list-style: none; counter-reset: step; }
.steps > li { position: relative; padding: 0 0 2.2rem 3.4rem; counter-increment: step; }
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: -0.1rem;
  display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%;
  font-weight: 800; color: var(--floor); background: var(--haint);
}
.steps > li:not(:last-child)::after { content: ""; position: absolute; left: 1.05rem; top: 2.5rem; bottom: 0.3rem; width: 2px; background: var(--border); }
.steps h3 { font-size: 1.2rem; font-weight: 800; }
.steps p { margin-top: 0.4rem; max-width: var(--measure); color: var(--muted); }
.ways { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.5rem 1rem; margin: 1rem 0 0; align-items: baseline; }
.ways dt { font-weight: 700; }
.ways dd { margin: 0; min-width: 0; }
.ways code { display: block; padding: 0.45rem 0.7rem; overflow-x: auto; white-space: nowrap; border-radius: 0.45rem; background: var(--soft); border: 1px solid var(--border); }
.more { max-width: var(--measure); color: var(--muted); }

body > footer {
  display: flex; align-items: center; gap: 0.8rem; max-width: 72rem; margin: 6rem auto 0; padding: 2rem 1.5rem 3rem;
  border-top: 1px solid var(--border); color: var(--muted); font-size: 0.95rem;
}

@media (max-width: 60rem) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 2rem; padding-bottom: 3.5rem; }
  .groups { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  .reasons { grid-template-columns: minmax(0, 1fr); }
  .size { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
}
@media (max-width: 40rem) {
  .bar ul { gap: 1rem; font-size: 0.95rem; }
  .bar ul li:first-child { display: none; }
}
@media (max-width: 24rem) {
  /* GitHub is in the footer too. */
  .bar ul li:has(> a[href*="github.com"]) { display: none; }
  .bar { gap: 0.5rem; padding-left: 1rem; padding-right: 1rem; }
  .bar ul { gap: 0.8rem; font-size: 0.9rem; }
  .brand { font-size: 1.05rem; }
  .gallery { grid-template-columns: minmax(0, 1fr); }
  .porch { padding-left: 0.5rem; }
  .steps > li { padding-left: 2.9rem; }
  .ways { grid-template-columns: 1fr; gap: 0.2rem; }
  .ways dt { margin-top: 0.6rem; }
}

/* Documentation */

.plain { color: var(--haint-2); background: var(--floor); }
.plain a { color: var(--haint-2); }
.plain .bar { max-width: 84rem; padding-top: 0.9rem; padding-bottom: 0.9rem; }
.plain .brand img { width: 30px; height: 30px; }

.docs-shell {
  display: grid; grid-template-columns: 15rem minmax(0, 1fr) 13rem; gap: 3.5rem;
  max-width: 84rem; margin: 0 auto; padding: 2.5rem 1.5rem 0; align-items: start;
}
.docs-main { min-width: 0; }
body.docs > footer { max-width: 84rem; }

.docs-nav {
  position: sticky; top: 1.5rem; max-height: calc(100vh - 3rem); overflow-y: auto;
  padding: 0 0.5rem 2rem 0; font-size: 0.95rem; overscroll-behavior: contain;
}
.docs-nav h2 {
  margin: 1.6rem 0 0.4rem; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
}
.docs-nav h2 a { color: var(--muted); text-decoration: none; }
.docs-nav h2 a:hover { color: var(--fg); }
.docs-nav ul { margin: 0; padding: 0; list-style: none; }
.docs-nav li a, .docs-home {
  display: block; padding: 0.3rem 0.65rem; border-radius: 0.45rem; color: var(--fg); text-decoration: none; line-height: 1.35;
}
.docs-nav li a:hover, .docs-home:hover { background: var(--soft); }
.docs-nav a[aria-current="page"] { background: var(--haint-2); color: var(--floor); font-weight: 700; }
.docs-nav h2 a[aria-current="page"] { background: none; color: var(--fg); }
.docs-home { font-weight: 700; }
/* A group of pages inside a section, such as Integrations → Automations:
   a disclosure that opens while the reader is inside it. */
.docs-group summary {
  display: flex; align-items: center; gap: 0.25rem; list-style: none; cursor: pointer;
}
.docs-group summary::-webkit-details-marker { display: none; }
.docs-group summary::after {
  content: ""; flex: none; width: 0.45rem; height: 0.45rem; margin-right: 0.6rem;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg); transition: transform 0.15s;
}
.docs-group details[open] > summary::after { transform: rotate(45deg); }
.docs-group summary a { flex: 1; font-weight: 700; }
.docs-group ul { margin: 0.1rem 0 0.3rem 0.65rem; padding-left: 0.5rem; border-left: 1px solid var(--border); }
.docs-menu {
  display: none; align-items: center; gap: 0.5rem; justify-self: start;
  padding: 0.45rem 0.9rem; border: 1px solid var(--border); border-radius: 0.5rem;
  font: inherit; font-weight: 700; color: var(--fg); background: var(--soft); cursor: pointer;
}
.docs-menu::before { content: ""; width: 1rem; height: 0.7rem; border-block: 2px solid currentColor; background: linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat; }

.crumb { font-size: 0.9rem; font-weight: 700; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--fg); text-decoration: underline; }
.lede-docs { font-size: 1.2rem; color: var(--muted); }

/* Text in the docs */
.prose { max-width: 46rem; }
.prose > * + * { margin-top: 1.1rem; }
.prose h1 { margin-top: 0.4rem; font-size: clamp(2rem, 4vw, 2.6rem); font-weight: 800; letter-spacing: -0.02em; text-wrap: balance; }
.prose h2 { margin-top: 2.8rem; font-size: 1.6rem; font-weight: 800; letter-spacing: -0.01em; max-width: none; }
.prose h3 { margin-top: 2rem; font-size: 1.2rem; font-weight: 800; }
.prose h4 { margin-top: 1.6rem; font-size: 1.05rem; font-weight: 800; }
.prose :is(h2, h3, h4) { scroll-margin-top: 1.5rem; }
.prose :is(h2, h3, h4) a.zola-anchor { color: inherit; text-decoration: none; }
.prose :is(h2, h3, h4) a.zola-anchor:hover::after { content: " #"; color: var(--muted); font-weight: 400; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li + li, .prose li > ul, .prose li > ol { margin-top: 0.35rem; }
.prose li::marker { color: var(--muted); }
.prose strong { font-weight: 800; }
.prose :not(pre) > code { padding: 0.1em 0.35em; border-radius: 0.3em; background: var(--soft); border: 1px solid var(--border); overflow-wrap: break-word; }
.prose pre {
  position: relative; margin-left: 0; margin-right: 0; padding: 0.95rem 1.1rem; overflow-x: auto;
  border: 1px solid var(--border); border-radius: 0.6rem; font-size: 0.92rem; line-height: 1.55;
}
.prose pre code { font-size: inherit; }
/* The highlighting theme's own background, replaced by the site's. */
.prose pre.giallo { background-color: var(--soft) !important; }
.giallo-l { display: inline-block; min-height: 1lh; width: 100%; }
.copy-code {
  position: absolute; top: 0.5rem; right: 0.5rem; padding: 0.2rem 0.6rem; border: 1px solid var(--border); border-radius: 0.4rem;
  font: inherit; font-size: 0.8rem; font-weight: 700; color: var(--fg); background: var(--bg); cursor: pointer; opacity: 0;
}
.code { position: relative; }
.code pre { margin: 0; }
.code:hover .copy-code, .copy-code:focus-visible { opacity: 1; }
/* Always shown on touch screens, above the code rather than over it. */
@media (hover: none) {
  .copy-code { opacity: 1; }
  .code pre { padding-top: 2.6rem; }
}
.prose blockquote { margin-left: 0; margin-right: 0; padding-left: 1rem; border-left: 3px solid var(--border); color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }
.prose table, .table-scroll table { border-collapse: collapse; font-size: 0.95rem; }
.prose > table { display: block; overflow-x: auto; }
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 0.6rem; }
.table-scroll table { width: 100%; }
.prose th, .prose td { padding: 0.55rem 0.8rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.prose td code, .prose th code { white-space: nowrap; overflow-wrap: normal; }
.prose th { font-size: 0.85rem; font-weight: 800; color: var(--muted); background: var(--soft); }
.prose tr:last-child td { border-bottom: 0; }
.prose kbd {
  padding: 0.05em 0.4em; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 0.3em;
  font: 0.85em ui-monospace, "SF Mono", Menlo, Consolas, monospace; background: var(--soft);
}

.callout { padding: 0.9rem 1.1rem; border-radius: 0.6rem; border-left: 4px solid var(--floor-3); background: var(--soft); }
.callout > * + * { margin-top: 0.6rem; }
.callout-label { font-size: 0.8rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.callout-tip { border-left-color: #3A9A6E; }
.callout-warning { border-left-color: var(--lamp); }

.paths ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1rem; margin: 1.5rem 0 0; padding: 0 !important; list-style: none; max-width: 60rem; }
.paths li { margin: 0 !important; padding: 1rem 1.1rem; border: 1px solid var(--border); border-radius: 0.8rem; color: var(--muted); font-size: 0.95rem; }
.paths li > strong:first-child { display: block; margin-bottom: 0.3rem; font-size: 1.05rem; }
.paths li > strong:first-child a { color: var(--fg); text-decoration: none; }
.paths li > strong:first-child a:hover { text-decoration: underline; }
.prose:has(.paths) { max-width: 60rem; }
.cards-title { margin-top: 2.8rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1.2rem; max-width: none; }
.prose:has(.cards) { max-width: 60rem; }
.card { padding: 1.2rem 1.3rem; border: 1px solid var(--border); border-radius: 0.8rem; }
.card h2 { margin: 0; font-size: 1.2rem; }
.card h2 a { text-decoration: none; color: var(--fg); }
.card h2 a:hover { text-decoration: underline; }
.card p { margin-top: 0.4rem; color: var(--muted); font-size: 0.95rem; }
.card ul { margin: 0.8rem 0 0; padding: 0; list-style: none; font-size: 0.95rem; }
.card li + li { margin-top: 0.25rem; }
.page-list { padding: 0 !important; list-style: none; }
.page-list li { padding: 0.8rem 0; border-bottom: 1px solid var(--border); }
.page-list li + li { margin-top: 0; }
.page-list a { font-weight: 700; }
.page-list span { display: block; color: var(--muted); font-size: 0.95rem; }
.page-group { margin-top: 2.2rem; }
.page-group h2 { margin-bottom: 0.2rem; }
.page-group h2 a { color: var(--fg); text-decoration: none; }
.page-group h2 a:hover { text-decoration: underline; }
.page-group > p { margin-top: 0; color: var(--muted); }
.card .card-group a { font-weight: 700; }

.page-foot { max-width: 46rem; margin-top: 3.5rem; padding-top: 1.2rem; border-top: 1px solid var(--border); }
.edit { font-size: 0.9rem; color: var(--muted); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.4rem; }
.pager a {
  display: block; padding: 0.8rem 1rem; border: 1px solid var(--border); border-radius: 0.6rem;
  font-weight: 700; text-decoration: none; color: var(--fg);
}
.pager a:hover { border-color: var(--floor-3); }
.pager span { display: block; font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.pager .next { grid-column: 2; text-align: right; }

.toc { position: sticky; top: 1.5rem; max-height: calc(100vh - 3rem); overflow-y: auto; font-size: 0.88rem; }
.toc h2 { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.toc ul { margin: 0.5rem 0 0; padding: 0; list-style: none; }
.toc ul ul { margin: 0.15rem 0 0.2rem; padding-left: 0.8rem; }
.toc a { display: block; padding: 0.2rem 0 0.2rem 0.7rem; border-left: 2px solid var(--border); color: var(--muted); text-decoration: none; line-height: 1.35; }
.toc a:hover { color: var(--fg); }
.toc a[aria-current] { color: var(--fg); font-weight: 700; border-left-color: var(--floor-3); }

.lost { max-width: 40rem; margin: 0 auto; padding: 6rem 1.5rem 2rem; }
.lost h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; letter-spacing: -0.02em; }
.lost p { margin-top: 1rem; color: var(--muted); }
.lost-links { display: flex; flex-wrap: wrap; gap: 0.6rem 1.4rem; font-weight: 700; }

@media (prefers-color-scheme: dark) {
  .docs-nav a[aria-current="page"] { background: var(--floor-2); color: var(--haint-2); }
  .toc a[aria-current] { border-left-color: var(--haint); }
  .pager a:hover { border-color: var(--haint); }
}

@media (max-width: 72rem) {
  .docs-shell { grid-template-columns: 14rem minmax(0, 1fr); gap: 3rem; }
  .toc { display: none; }
}
@media (max-width: 52rem) {
  .docs-shell { grid-template-columns: minmax(0, 1fr); gap: 1.2rem; padding-top: 1.2rem; }
  .docs-nav { position: static; max-height: none; padding: 0; }
  .js .docs-menu { display: inline-flex; }
  .js .docs-nav {
    position: fixed; z-index: 20; inset: 0 auto 0 0; width: min(20rem, 86vw); max-height: none;
    padding: 1.2rem 1rem 2rem; background: var(--bg); box-shadow: 0 0 2rem rgb(0 0 0 / 0.3);
    transform: translateX(-105%); visibility: hidden; transition: transform 0.2s ease, visibility 0.2s;
  }
  .js .docs-nav.open { transform: none; visibility: visible; transition: transform 0.2s ease, visibility 0s; }
  .drawer-open::after { content: ""; position: fixed; inset: 0; z-index: 19; background: rgb(16 26 25 / 0.5); }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
}
@media (prefers-reduced-motion: reduce) { .js .docs-nav { transition: none; } }

/* Search */

.nav-search {
  display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.3rem 0.45rem 0.3rem 0.6rem;
  border: 1px solid var(--floor-3); border-radius: 0.5rem; font: inherit; color: var(--haint-2);
  background: rgb(0 0 0 / 0.18); cursor: pointer;
}
.nav-search:hover { background: rgb(0 0 0 / 0.3); }
.nav-search kbd {
  padding: 0 0.35rem; border: 1px solid var(--floor-3); border-radius: 0.3rem;
  font: 0.8rem ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.lost .nav-search { color: var(--fg); border-color: var(--border); background: var(--soft); }

.search {
  width: min(40rem, calc(100vw - 2rem)); max-height: min(36rem, calc(100dvh - 4rem)); margin: 10vh auto auto; padding: 0;
  border: 1px solid var(--border); border-radius: 0.9rem; color: var(--fg); background: var(--bg);
  box-shadow: 0 1.5rem 4rem -1rem rgb(0 0 0 / 0.5);
}
.search[open] { display: flex; flex-direction: column; }
.search::backdrop { background: rgb(16 26 25 / 0.55); }
.search-bar { display: flex; align-items: center; gap: 0.7rem; padding: 0.3rem 0.6rem 0.3rem 1rem; border-bottom: 1px solid var(--border); color: var(--muted); }
.search-bar input {
  flex: 1; min-width: 0; padding: 0.8rem 0; border: 0; outline: 0; font: inherit; font-size: 1.1rem;
  color: var(--fg); background: transparent;
}
.search-bar input::-webkit-search-cancel-button { display: none; }
.search-close {
  padding: 0.15rem 0.45rem; border: 1px solid var(--border); border-radius: 0.35rem;
  font: 0.8rem ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--muted); background: var(--soft); cursor: pointer;
}
.search-results { margin: 0; padding: 0.4rem; overflow-y: auto; list-style: none; }
.search-results:empty { display: none; }
.search-results a { display: block; padding: 0.65rem 0.8rem; border-radius: 0.5rem; color: var(--fg); text-decoration: none; }
.search-results a:hover, .search-results a:focus-visible { background: var(--soft); outline: 0; }
.search-results a:focus-visible { box-shadow: inset 0 0 0 2px var(--floor-3); }
.search-results strong { display: block; font-weight: 800; }
.search-results span {
  display: -webkit-box; margin-top: 0.15rem; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  font-size: 0.9rem; line-height: 1.45; color: var(--muted);
}
.search-results mark { color: inherit; background: rgb(245 192 74 / 0.4); border-radius: 0.15rem; }
.search-results .empty { padding: 1rem 0.8rem; color: var(--muted); }
@media (max-width: 40rem) {
  .nav-search kbd { display: none; }
  .search { margin-top: 1rem; }
}

/* Screenshots, and the viewer they open in */

.shot { margin: 1.8rem 0 0; }
.diagram { margin: 1.8rem 0 0; padding: 1.2rem; border: 1px solid var(--border); border-radius: 0.7rem; overflow-x: auto; }
.diagram pre.mermaid { margin: 0; padding: 0; background: none; border: 0; text-align: center; white-space: pre; }
.diagram pre.mermaid:not([data-processed]) { color: var(--muted); font-size: 0.8rem; text-align: left; }
.diagram figcaption { margin-top: 0.8rem; font-size: 0.92rem; color: var(--muted); }
.shot img, a[data-zoom] img { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: 0.7rem; }
.shot figcaption { margin-top: 0.55rem; font-size: 0.92rem; color: var(--muted); }
.shot-version { white-space: nowrap; font-size: 0.8rem; opacity: 0.75; }
.shot-version:not(:first-child)::before { content: "· "; }
.gallery-version { grid-column: 1 / -1; margin: 0; font-size: 0.85rem; color: var(--muted); text-align: center; }
a[data-zoom] { position: relative; display: block; border-radius: 0.7rem; cursor: zoom-in; }
a[data-zoom]::after {
  content: ""; position: absolute; right: 0.7rem; bottom: 0.7rem; width: 2.2rem; height: 2.2rem; border-radius: 50%;
  background: rgb(27 40 38 / 0.72) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6'/%3E%3Cpath d='m15 15 4.5 4.5M10.5 8v5M8 10.5h5'/%3E%3C/g%3E%3C/svg%3E") center / 1.2rem no-repeat;
  opacity: 0; transition: opacity 0.15s;
}
a[data-zoom]:hover::after, a[data-zoom]:focus-visible::after { opacity: 1; }
@media (hover: none) { a[data-zoom]::after { opacity: 0.85; width: 1.9rem; height: 1.9rem; } }

.viewer {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0;
  border: 0; color: #fff; background: transparent; overflow: hidden;
}
.viewer::backdrop { background: rgb(10 17 16 / 0.93); }
.viewer-stage {
  position: absolute; inset: 4rem 4.5rem 4.5rem; display: flex; overflow: auto;
  overscroll-behavior: contain; touch-action: pan-x pan-y pinch-zoom;
}
.viewer-stage img {
  margin: auto; max-width: 100%; max-height: 100%; object-fit: contain;
  border-radius: 0.5rem; box-shadow: 0 1rem 3rem rgb(0 0 0 / 0.55); cursor: zoom-in; user-select: none;
}
.viewer.actual .viewer-stage img { max-width: none; max-height: none; cursor: grab; }
.viewer.actual.dragging .viewer-stage img { cursor: grabbing; }
.viewer-close, .viewer-step {
  position: absolute; display: grid; place-items: center; width: 3rem; height: 3rem; padding: 0;
  border: 0; border-radius: 50%; color: #fff; background: rgb(255 255 255 / 0.14); cursor: pointer;
}
.viewer-close:hover, .viewer-step:hover { background: rgb(255 255 255 / 0.28); }
.viewer-close:focus-visible, .viewer-step:focus-visible { outline: 3px solid var(--lamp); outline-offset: 2px; }
.viewer-close { top: 0.6rem; right: 0.75rem; }
.viewer-step { top: calc(50% - 1.5rem); }
.viewer-step.prev { left: 0.75rem; }
.viewer-step.next { right: 0.75rem; }
.viewer-caption {
  position: absolute; left: 4.5rem; right: 4.5rem; bottom: 1.3rem; text-align: center;
  font-size: 0.95rem; color: var(--haint-2);
}
.viewer-count { margin-left: 0.5rem; color: #9DB3AE; white-space: nowrap; }
@media (max-width: 40rem) {
  .viewer-stage { inset: 4rem 0.5rem 7.5rem; }
  .viewer-step { top: auto; bottom: 3.6rem; }
  .viewer-step.prev { left: calc(50% - 3.75rem); }
  .viewer-step.next { right: calc(50% - 3.75rem); }
  .viewer-caption { left: 1rem; right: 1rem; bottom: 0.9rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .viewer[open] { animation: viewer-in 0.18s ease-out; }
  .viewer[open]::backdrop { animation: viewer-in 0.18s ease-out; }
}
@keyframes viewer-in { from { opacity: 0; } }

/* Landing page additions */

.cta { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }
.button {
  display: inline-flex; align-items: center; padding: 0.75rem 1.3rem; border: 1px solid var(--haint); border-radius: 0.7rem;
  font-weight: 800; text-decoration: none;
}
.dusk .button { color: var(--haint-2); }
.dusk .button:hover { background: rgb(0 0 0 / 0.18); }
.dusk .button.primary { color: var(--floor); background: var(--lamp); border-color: var(--lamp); }
.dusk .button.primary:hover { background: #F8CE6E; border-color: #F8CE6E; }
.cta + .start { margin-top: 1.8rem; }
.start-label { font-size: 0.95rem; }
.gallery .phones { grid-column: 1 / -1; justify-self: center; width: min(100%, 38rem); }
.tag-rec {
  display: inline-block; margin-left: 0.35rem; padding: 0 0.4rem; border-radius: 0.3rem;
  font-size: 0.75rem; font-weight: 800; vertical-align: 0.1em; color: var(--floor); background: var(--haint-2);
}
.steps a { font-weight: 600; }
