/* Tickiti Docs — design tokens mirror www.tickiti.com (sky accent + slate neutrals). */
:root {
  --sky-900: #0c4a6e; --sky-800: #075985; --sky-700: #0369a1; --sky-600: #0284c7;
  --sky-500: #0ea5e9; --sky-400: #38bdf8; --sky-300: #7dd3fc; --sky-200: #bae6fd;
  --sky-100: #e0f2fe; --sky-50: #f0f9ff;
  --slate-900: #0f172a; --slate-800: #1e293b; --slate-700: #334155; --slate-600: #475569;
  --slate-500: #64748b; --slate-400: #94a3b8; --slate-300: #cbd5e1; --slate-200: #e2e8f0;
  --slate-100: #f1f5f9; --slate-50: #f8fafc;

  --accent: var(--sky-600);
  --accent-strong: var(--sky-700);
  --gold: #b29050; /* ticdoc amf7 — the Tickiti wordmark */
  --ink: var(--slate-800);
  --muted: var(--slate-500);
  --bg: #ffffff;
  --bg-soft: var(--slate-50);
  --border: var(--slate-200);

  --font-display: 'Francois One', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  /* House monospace (matches www + totem) — used for the Tickiti wordmark. */
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  /* H1s match ticdoc: Instrument Sans, bold. */
  --font-h1: 'Instrument Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;

  --header-h: 60px;
  --sidebar-w: 290px;
  --content-max: 820px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---- Header ---- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  height: var(--header-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-logo { display: block; flex-shrink: 0; }
.brand-mark { font-family: var(--font-mono); font-weight: 600; font-size: 1.3rem; color: var(--gold); letter-spacing: -.5px; line-height: 1; }

/* Home icon — returns to the docs landing page. */
.home-link { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 8px; color: var(--slate-500); transition: background .2s, color .2s; }
.home-link:hover { background: var(--slate-100); color: var(--slate-800); }

/* Copy-link-to-this-page button (mirrors ticdoc's header link option). */
.copy-link {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: none; background: transparent; border-radius: 8px;
  color: var(--slate-500); cursor: pointer; transition: background .2s, color .2s;
}
.copy-link:hover { background: var(--slate-100); color: var(--slate-800); }
.copy-toast {
  position: absolute; left: 50%; top: calc(100% + 8px); transform: translateX(-50%);
  white-space: nowrap; background: var(--sky-50); color: var(--sky-900);
  border: 1px solid var(--sky-200); border-radius: 999px; padding: 3px 10px;
  font-size: .72rem; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .15s;
}
.copy-link.copied .copy-toast { opacity: 1; }

.search { margin-left: auto; width: min(420px, 50vw); }

/* ---- Layout ---- */
.layout { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); align-items: start; }

.sidebar {
  position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 24px 18px 64px;
  border-right: 1px solid var(--border);
  background: var(--bg-soft);
}
.sidebar nav ul { list-style: none; margin: 0 0 18px; padding: 0; }
.sidebar-section {
  font-family: var(--font-display); font-size: .78rem; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--slate-500); margin: 18px 8px 6px;
}
.sidebar li a {
  display: block; padding: 5px 10px; border-radius: 6px;
  color: var(--slate-700); text-decoration: none; font-size: .92rem;
}
.sidebar li a:hover { background: var(--sky-100); color: var(--accent-strong); }
.sidebar li a.is-active { background: var(--sky-600); color: #fff; font-weight: 600; }

/* ---- Content ---- */
.content { padding: 40px clamp(20px, 5vw, 64px) 80px; min-width: 0; }
.doc { max-width: var(--content-max); }
.doc h1 { font-family: var(--font-h1); font-weight: 700; font-size: 1.75rem; line-height: 1.3; letter-spacing: -.01em; margin: 0 0 .4em; color: #1e293b; }
.doc h2 { font-family: var(--font-h1); font-weight: 600; font-size: 1.4rem; line-height: 1.35; margin: 1.6em 0 .4em; color: #334155; }
.doc h3 { font-family: var(--font-h1); font-weight: 600; font-size: 1.15rem; line-height: 1.4; margin: 1.4em 0 .3em; color: #475569; }
.doc p, .doc li { color: var(--slate-700); }
.doc a { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 2px; }
.doc img { max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--border); cursor: zoom-in; display: block; }
/* "Click to enlarge" caption injected by base.njk after every article <img>.
   The lightbox itself is wired up in the same script — clicking any <img>
   in .doc opens it. */
.doc .img-caption {
  display: block;
  text-align: center;
  font-size: .8rem;
  color: var(--muted);
  margin-top: .4em;
  letter-spacing: .01em;
}
.doc pre {
  background: var(--slate-900); color: #e2e8f0; padding: 16px; border-radius: 8px;
  overflow-x: auto; font-size: .88rem;
}
.doc code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
.doc :not(pre) > code { background: var(--sky-50); color: var(--sky-800); padding: 2px 6px; border-radius: 4px; }
.doc table { border-collapse: collapse; width: 100%; margin: 1.2em 0; }
.doc th, .doc td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.doc th { background: var(--bg-soft); }
.doc blockquote { border-left: 3px solid var(--sky-400); margin: 1.2em 0; padding: 4px 18px; color: var(--muted); background: var(--sky-50); }

.page-footer { max-width: var(--content-max); margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; }
.page-footer a { color: var(--accent-strong); }

/* ---- Image lightbox (click an article image to enlarge) ---- */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(0, 0, 0, .85); cursor: zoom-out;
  opacity: 0; visibility: hidden; transition: opacity .18s ease, visibility .18s ease;
}
.lightbox.is-open { opacity: 1; visibility: visible; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: 0 24px 60px rgba(0, 0, 0, .5); }
.lightbox-close {
  position: absolute; top: 16px; right: 16px;
  display: flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border: none; border-radius: 999px; background: rgba(255, 255, 255, .12); color: #fff;
  cursor: pointer; transition: background .2s;
}
.lightbox-close:hover { background: rgba(255, 255, 255, .24); }
@media (prefers-reduced-motion: reduce) { .lightbox { transition: none; } }

/* ---- Landing ---- */
.hero { max-width: var(--content-max); margin-bottom: 32px; }
.hero h1 { font-family: var(--font-h1); font-weight: 700; font-size: 2.2rem; line-height: 1.15; letter-spacing: -.01em; margin: 0 0 .3em; color: #1e293b; }
.hero p { font-size: 1.1rem; color: var(--muted); margin: 0; }
.section-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }
.section-card { border: 1px solid var(--border); border-radius: 12px; padding: 20px 22px; background: var(--bg); }
.section-card h2 { font-family: var(--font-display); font-size: 1.15rem; margin: 0 0 10px; color: var(--accent-strong); }
.section-card ul { list-style: none; margin: 0; padding: 0; }
.section-card li { margin: 4px 0; }
.section-card a { color: var(--slate-700); text-decoration: none; font-size: .92rem; }
.section-card a:hover { color: var(--accent-strong); text-decoration: underline; }

/* ---- Pagefind search ---- */
.search { position: relative; }
.search .pagefind-ui { --pagefind-ui-primary: var(--sky-700); --pagefind-ui-font: var(--font-body); }

/* Light search pill in the white header (mirrors ticdoc's slate-100 input). */
.search .pagefind-ui__search-input { background: var(--slate-100); color: var(--slate-800); border: 1px solid transparent; }
.search .pagefind-ui__search-input:focus { background: #fff; border-color: var(--sky-400); }
.search .pagefind-ui__search-input::placeholder { color: var(--slate-400); }
.search .pagefind-ui__search-clear { color: var(--slate-500); background: transparent; }

/* Results as a floating light card (dark text — overrides Pagefind's defaults). */
.search .pagefind-ui__drawer {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: min(560px, 92vw); max-height: 72vh; overflow-y: auto; z-index: 50;
}
/* Card chrome only when there's something to show — an empty search bar shows no box. */
.search .pagefind-ui__drawer:has(.pagefind-ui__results),
.search .pagefind-ui__drawer:has(.pagefind-ui__message) {
  background: #fff; color: var(--ink);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .22);
  padding: 8px 18px 16px;
}
.search .pagefind-ui__result { border-top: 1px solid var(--slate-100); padding-top: 12px; }
.search .pagefind-ui__result-link { color: var(--slate-900); }
.search .pagefind-ui__result-excerpt { color: var(--slate-600); }

/* Pagefind reverts <mark> to the browser default (garish yellow). Re-theme to brand. */
.search .pagefind-ui mark { background: var(--sky-100); color: var(--sky-900); padding: 0 2px; border-radius: 3px; font-weight: 600; }

/* ---- Responsive ---- */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .search { width: 100%; }
}
