/* Fera developer docs: guides, home and 404 pages, plus the header shared with the API reference (Scalar).
   Colours follow Fera's ReadMe theme: deep purple #1F0145, link purple #7B27A6. */
:root {
  --fera: #7b27a6;
  --fera-deep: #1f0145;
  --link: #7b27a6;
  --bg: #fff;
  --fg: #1d1b24;
  --muted: #5f5b6b;
  --line: #e6e3ec;
  --code: #f6f4f9;
  --side: #fbfafc;
  --zebra: #f8f6fb;
  --tint: #7b27a61a;
  --header: 56px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --fera: #b986e0;
  --fera-deep: #2a0d55;
  --link: #c9a2ec;
  --bg: #121117;
  --fg: #ecebf1;
  --muted: #a7a3b3;
  --line: #2b2933;
  --code: #1b1a22;
  --side: #16151c;
  --zebra: #18171e;
  --tint: #b986e026;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
html { scroll-padding-top: calc(var(--header) + 16px); }
body { font: 16px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--fg); -webkit-text-size-adjust: 100%; }
a { color: var(--link); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--fera); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: 12px; top: -48px; z-index: 50; padding: 8px 14px; border-radius: 6px; background: var(--fera-deep); color: #fff; text-decoration: none; }
.skip:focus { top: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- header ---- */
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 20px; height: var(--header); padding: 0 20px; border-bottom: 1px solid var(--line); background: var(--bg); }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--fg); flex: none; }
.brand svg { height: 26px; width: auto; color: var(--fg); display: block; }
.brand .dev { color: var(--muted); font-size: 15px; }
.top-nav { display: flex; gap: 2px; min-width: 0; }
.top-nav a, .ext a { padding: 6px 10px; border-radius: 6px; text-decoration: none; color: var(--muted); white-space: nowrap; font-size: 14px; font-weight: 500; }
.top-nav a:hover, .ext a:hover { color: var(--fg); background: var(--code); }
.top-nav a[aria-current="page"], .top-nav a.on { color: var(--fera); background: var(--tint); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.ext { display: flex; gap: 2px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); cursor: pointer; }
.icon-btn:hover { background: var(--code); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-btn .moon, :root[data-theme="dark"] .theme-btn .sun { display: none; }
:root[data-theme="dark"] .theme-btn .moon { display: block; }
.menu-btn { display: none; }
.search-btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 12px; min-width: 210px; border: 1px solid var(--line); border-radius: 8px; background: var(--side); color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.search-btn:hover { border-color: var(--fera); }
.search-btn svg { width: 16px; height: 16px; flex: none; }
.search-btn kbd { margin-left: auto; font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; padding: 1px 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg); }

/* ---- three-column guide layout: sidebar | content | on-this-page ---- */
.wrap { display: grid; grid-template-columns: 272px minmax(0, 1fr) 224px; min-height: calc(100vh - var(--header)); }
.side { position: sticky; top: var(--header); height: calc(100vh - var(--header)); overflow: auto; padding: 20px 14px 40px; border-right: 1px solid var(--line); background: var(--side); }
.side ul { list-style: none; margin: 0; padding: 0; }
.drawer-only { display: none; }
.nav-section { margin: 26px 8px 10px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.nav-group { margin-bottom: 18px; }
.nav-cat { font-size: 13px; font-weight: 700; color: var(--fg); margin: 0 8px 6px; }
.side a { display: block; flex: 1; padding: 5px 8px; border-radius: 6px; text-decoration: none; color: var(--muted); font-size: 14.5px; line-height: 1.4; }
.side a:hover { color: var(--fg); background: var(--code); }
.side a[aria-current="page"] { background: var(--tint); color: var(--fera); font-weight: 600; }
.side .row { display: flex; align-items: center; }
.kids-toggle { flex: none; width: 26px; height: 26px; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.kids-toggle:hover { background: var(--code); color: var(--fg); }
.kids-toggle svg { width: 14px; height: 14px; transition: transform .15s; }
.kids-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.kids { margin-left: 12px !important; padding-left: 8px !important; border-left: 1px solid var(--line); }
.kids[hidden] { display: none; }
.ext-mark { font-size: 12px; opacity: .7; }

.doc { padding: 36px 48px 80px; min-width: 0; max-width: 1000px; }
.doc > header { margin-bottom: 28px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.doc h1 { font-size: 34px; line-height: 1.2; letter-spacing: -.015em; margin: 0; }
.doc .excerpt { font-size: 19px; line-height: 1.5; color: var(--muted); margin: 10px 0 0; }
.doc h2 { font-size: 24px; line-height: 1.3; margin: 40px 0 12px; }
.doc h3 { font-size: 19px; line-height: 1.35; margin: 30px 0 10px; }
.doc h4 { font-size: 17px; margin: 24px 0 8px; }
.doc h5, .doc h6 { font-size: 15.5px; margin: 20px 0 6px; }
.doc h2, .doc h3, .doc h4 { position: relative; }
.anchor { position: absolute; left: -1.1em; padding-right: .3em; color: var(--muted); text-decoration: none; opacity: 0; font-weight: 400; }
.doc h2:hover .anchor, .doc h3:hover .anchor, .doc h4:hover .anchor, .anchor:focus { opacity: 1; }
.doc pre { position: relative; background: var(--code); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; overflow: auto; font-size: 13.5px; line-height: 1.55; margin: 0 0 20px; }
.doc code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
.doc :not(pre) > code { background: var(--code); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; overflow-wrap: break-word; }
.doc td code, .doc th code { white-space: nowrap; }
.doc table { border-collapse: collapse; width: max-content; min-width: 50%; max-width: 100%; display: block; overflow-x: auto; font-size: 14.5px; margin: 0 0 22px; }
.doc td, .doc th { max-width: 520px; }
.doc th, .doc td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; vertical-align: top; }
.doc th { background: var(--side); font-weight: 600; }
.doc tbody tr:nth-child(even) { background: var(--zebra); }
.doc img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 10px; cursor: zoom-in; display: block; margin: 8px auto; }
.doc li + li { margin-top: 4px; }

/* callouts, as on ReadMe: icon + bold title */
.doc blockquote { margin: 0 0 22px; padding: 12px 16px 12px 46px; position: relative; border: 1px solid var(--line); border-left: 4px solid var(--fera); border-radius: 8px; background: var(--side); }
.doc blockquote p { margin: 0 0 6px; }
.doc blockquote p:last-child { margin: 0; }
.doc blockquote::before { content: "📘"; position: absolute; left: 14px; top: 11px; font-size: 18px; }
.callout-title { font-weight: 700; }
.callout.info { border-left-color: #3b82c4; background: #3b82c40f; }
.callout.success { border-left-color: #2f9e6b; background: #2f9e6b10; }
.callout.success::before { content: "👍"; }
.callout.warning { border-left-color: #d08a12; background: #d08a1212; }
.callout.warning::before { content: "🚧"; }
.callout.warning .callout-title { color: #a16207; }
.callout.danger { border-left-color: #d1435b; background: #d1435b10; }
.callout.danger::before { content: "❗️"; }
.callout.danger .callout-title { color: #b91c3c; }
:root[data-theme="dark"] .callout.warning .callout-title { color: #f2b84b; }
:root[data-theme="dark"] .callout.danger .callout-title { color: #f2899b; }

/* breadcrumbs */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; margin: 0 0 10px; padding: 0; font-size: 13.5px; line-height: 1.4; color: var(--muted); }
.crumbs li { display: inline-flex; align-items: baseline; gap: 6px; }
.crumbs li + li::before { content: "›"; color: var(--muted); opacity: .7; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--fera); }

/* "On this page" inside the content, for screens without the right-hand column */
.toc-inline { display: none; margin: 0 0 24px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--side); font-size: 14.5px; }
.toc-inline summary { cursor: pointer; font-weight: 600; }
.toc-inline ul { list-style: none; margin: 8px 0 2px; padding: 0; }
.toc-inline li { margin: 3px 0; } .toc-inline .l3 { padding-left: 14px; } .toc-inline .l4 { padding-left: 28px; }
.toc-inline a { text-decoration: none; }
@media (max-width: 1240px) { .toc-inline { display: block; } }

/* page actions under the title */
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.page-actions a, .page-actions button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--muted); font: inherit; font-size: 13px; text-decoration: none; cursor: pointer; }
.page-actions a:hover, .page-actions button:hover { color: var(--fg); border-color: var(--fera); }
.page-actions svg { width: 15px; height: 15px; }

/* ReadMe's "What's Next" */
.whats-next { display: inline-block; max-width: 100%; margin-top: 40px; padding: 12px 18px 12px 16px; border-left: 3px solid var(--fera); border-radius: 0 8px 8px 0; background: var(--side); }
.whats-next h2 { margin: 0 0 4px; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.whats-next p { margin: 0 0 6px; color: var(--muted); font-size: 14.5px; }
.whats-next ul { margin: 0; padding-left: 18px; font-size: 15px; }
.whats-next li + li { margin-top: 2px; }
.whats-next code { font-size: 12.5px; color: var(--muted); }

/* previous / next */
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); }
.pager a { display: block; max-width: 48%; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--fg); }
.pager a:hover { border-color: var(--fera); }
.pager .label { display: block; font-size: 12.5px; color: var(--muted); }
.pager .t { font-weight: 600; color: var(--fera); }
.pager .next { margin-left: auto; text-align: right; }

/* on this page */
.toc { position: sticky; top: var(--header); height: calc(100vh - var(--header)); overflow: auto; padding: 36px 20px 40px 8px; font-size: 13.5px; }
.toc-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 4px 0 4px 12px; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; line-height: 1.4; }
.toc a:hover { color: var(--fg); }
.toc a.on { color: var(--fera); border-left-color: var(--fera); font-weight: 600; }
.toc .l3 a { padding-left: 24px; font-size: 13px; }
.toc .l4 a { padding-left: 36px; font-size: 12.5px; }

/* CodePen examples (partner badges) */
.doc iframe.embed { display: block; width: 100%; height: 380px; margin: 8px 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--side); }

/* image zoom */
.zoom { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px; background: #0b0a10e6; cursor: zoom-out; }
.zoom img { max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: 0 10px 40px #0008; }

/* ---- home ---- */
.home-main { max-width: 1120px; margin: 0 auto; padding: 64px 24px 80px; }
.home-hero h1 { font-size: 44px; line-height: 1.12; margin: 0 0 14px; letter-spacing: -.025em; }
.home-hero p { font-size: 19px; color: var(--muted); max-width: 40em; margin: 0 0 26px; }
.home-buttons { display: flex; gap: 12px; flex-wrap: wrap; }
.btn { display: inline-block; padding: 10px 18px; border-radius: 8px; border: 1px solid var(--line); text-decoration: none; color: var(--fg); font-weight: 600; }
.btn:hover { border-color: var(--fera); }
.btn.primary { background: var(--fera-deep); border-color: var(--fera-deep); color: #fff; }
:root[data-theme="dark"] .btn.primary { background: var(--fera); border-color: var(--fera); color: #120a1c; }
.home-section { margin-top: 56px; }
.home-section h2 { font-size: 22px; margin: 0 0 18px; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.card { border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; background: var(--side); }
.card h3 { margin: 0 0 8px; font-size: 16px; }
.card p { margin: 0 0 10px; color: var(--muted); font-size: 14.5px; }
.card ul { margin: 0; padding-left: 18px; font-size: 14.5px; line-height: 1.85; }
.card ul ul { padding-left: 16px; font-size: 13.5px; line-height: 1.7; }
a.card { display: block; text-decoration: none; color: var(--fg); }
a.card:hover { border-color: var(--fera); }
a.card h3 { color: var(--fera); }

/* ---- API reference: our header above Scalar ---- */
.ref .scalar-wrap { min-height: calc(100vh - var(--header)); }
/* Static preview of a reference page (operation, tag ...), shown until Scalar has drawn the interactive version. */
.ref-static { max-width: 760px; margin: 0 auto; padding: 48px 24px 64px; }
.ref-static h1 { font-size: 30px; line-height: 1.2; margin: 6px 0 12px; }
.ref-static h2 { font-size: 18px; margin: 28px 0 10px; }
.ref-static table { border-collapse: collapse; width: 100%; font-size: 14px; }
.ref-static th, .ref-static td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.ref-static small { color: var(--muted); }
.ref-method { margin: 0; font: 13.5px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); overflow-wrap: anywhere; }
.ref-method span { display: inline-block; padding: 1px 7px; border-radius: 5px; font-weight: 700; color: #fff; background: #2f9e6b; }
.ref-method .m-post { background: #3b82c4; } .ref-method .m-put, .ref-method .m-patch { background: #d08a12; } .ref-method .m-delete { background: #d1435b; }
.ref-static .ref-loading { margin: 28px 0 0; padding: 0; }
/* API reference section bar: Overview · Reviews · Photos & Videos ... (sticky under the header) */
.ref-sections { position: sticky; top: var(--header); z-index: 20; height: 44px; border-bottom: 1px solid var(--line); background: var(--bg); }
.ref-sections-inner { display: flex; align-items: center; gap: 2px; height: 100%; padding: 0 16px; overflow-x: auto; scrollbar-width: none; }
.ref-sections a { flex: none; padding: 5px 10px; border-radius: 6px; color: var(--muted); font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.ref-sections a:hover { color: var(--fg); background: var(--code); }
.ref-sections a[aria-current="page"] { color: var(--fera); background: var(--tint); }
.ref-sections .ref-spec { margin-left: auto; font-size: 13px; }

/* Shown until Scalar has drawn the reference. */
.ref-loading { max-width: 640px; margin: 64px auto; padding: 0 24px; color: var(--muted); font-size: 15px; }
/* The home page and API reference have no guide sidebar on desktop; on phones it's the menu drawer. */
body.home > .side, body.ref > .side { display: none; }
/* Some Scalar content (long code lines) is wider than a phone; without this the page scrolls sideways and the
   phone's zoomed view drifts off the header, so taps on the menu land on the content instead. */
html:has(body.ref), body.ref { overflow-x: clip; }

/* ---- smaller screens ---- */
@media (max-width: 1240px) {
  .wrap { grid-template-columns: 260px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 1240px) { .brand .dev { display: none; } }
@media (max-width: 1180px) {
  .search-btn { min-width: 0; width: 36px; padding: 0; justify-content: center; }
  .search-btn .label, .search-btn kbd { display: none; }
}
@media (max-width: 1060px) {
  .tab-long { display: none; }
  .top { gap: 10px; padding: 0 14px; }
  .top-nav a, .ext a { padding: 6px 7px; }
}
@media (max-width: 900px) {
  .top { gap: 10px; padding: 0 12px; }
  .menu-btn { display: inline-flex; }
  .top-nav, .brand .dev, .ext { display: none; }
  .search-btn .label { display: none; }
  .search-btn { width: 36px; padding: 0; justify-content: center; }
  .wrap { display: block; }
  .side { position: fixed; z-index: 40; top: var(--header); left: 0; bottom: 0; width: min(320px, 86vw); height: auto; transform: translateX(-105%); transition: transform .2s; box-shadow: 0 0 40px #0003; }
  html.menu-open .side { transform: none; }
  html.menu-open body::after { content: ""; position: fixed; inset: var(--header) 0 0 0; z-index: 35; background: #0006; }
  .drawer-only { display: block; }
  body.home > .side, body.ref > .side { display: block; }
  .doc { padding: 24px 16px 60px; }
  .doc h1 { font-size: 28px; }
  .anchor { display: none; }
  .pager a { max-width: 100%; }
  .home-main { padding: 36px 16px 60px; }
  .home-hero h1 { font-size: 34px; }
}
@media (prefers-reduced-motion: reduce) { .side, .kids-toggle svg { transition: none; } }

/* ---- search dialog ---- */
.search-dialog { width: min(680px, calc(100vw - 24px)); max-height: min(76vh, 720px); margin: 10vh auto auto; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--fg); box-shadow: 0 24px 60px #0004; overflow: hidden; }
.search-dialog[open] { display: flex; flex-direction: column; }
.search-dialog::backdrop { background: #0b0a1099; }
.search-box { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.search-box svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--fg); font: inherit; font-size: 17px; }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-dialog kbd { font: 11.5px ui-monospace, monospace; padding: 1px 6px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); }
.search-filters { display: flex; gap: 6px; padding: 8px 12px 0; overflow-x: auto; scrollbar-width: none; }
.search-filters:empty { display: none; }
.search-filters button { flex: none; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; }
.search-filters button span { opacity: .7; }
.search-filters button[aria-pressed="true"] { background: var(--tint); border-color: var(--fera); color: var(--fera); }
.search-results { list-style: none; margin: 0; padding: 8px; overflow-y: auto; flex: 1; }
.search-results [role="option"] a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--fg); text-decoration: none; }
.search-results [role="option"][aria-selected="true"] a { background: var(--tint); }
.search-results .sub a { padding: 5px 12px 5px 30px; font-size: 14px; color: var(--muted); }
.search-results .sub a::before { content: "↳ "; }
.sr-title { font-weight: 600; }
.sr-badge { margin-left: 8px; padding: 1px 7px; border-radius: 999px; background: var(--code); color: var(--muted); font-size: 11.5px; font-weight: 600; vertical-align: 1px; }
.sr-endpoint { display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.sr-excerpt { margin-top: 2px; font-size: 13.5px; color: var(--muted); line-height: 1.45; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sr-excerpt mark { background: var(--tint); color: var(--fg); border-radius: 2px; padding: 0 1px; }
.sr-empty { padding: 18px 12px; color: var(--muted); }
.search-hint { margin: 0; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
@media (max-width: 900px) {
  .search-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .search-hint { display: none; }
}

/* ---- code blocks (Shiki colours, light/dark from the site theme) ---- */
.code { position: relative; margin: 0 0 22px; border: 1px solid var(--line); border-radius: 10px; background: var(--code); overflow: hidden; }
.code pre, .doc .code pre { margin: 0; border: 0; border-radius: 0; background: transparent !important; white-space: pre-wrap; overflow-wrap: anywhere; }
/* long lines wrap instead of scrolling; the copy button copies the original lines */
.shiki, .shiki span { color: var(--shiki-light); }
:root[data-theme="dark"] .shiki, :root[data-theme="dark"] .shiki span { color: var(--shiki-dark); }
.code-head { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 6px 0 14px; border-bottom: 1px solid var(--line); background: var(--side); font-size: 13px; }
.code-head.bare { position: absolute; right: 0; top: 0; z-index: 1; min-height: 0; padding: 6px; border: 0; background: none; }
.code-title { font-weight: 600; color: var(--muted); }
.code [role="tablist"] { display: flex; gap: 2px; align-self: stretch; }
.code [role="tab"] { padding: 0 10px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.code [role="tab"][aria-selected="true"] { color: var(--fera); border-bottom-color: var(--fera); }
.copy { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; }
.copy:hover { color: var(--fg); border-color: var(--fera); }
.copy svg { width: 14px; height: 14px; }
.code-head.bare .copy { opacity: 0; transition: opacity .15s; }
.code:hover .code-head.bare .copy, .code-head.bare .copy:focus-visible { opacity: 1; }
@media (hover: none) { .code-head.bare .copy { opacity: 1; } }
