/* QilbeeDB — brand light design system
   Ground: white / warm paper, ink with a violet undertone.
   Brand accents from the official logo: violet #7038CC, magenta #D8536A,
   orange #F5872A, blue #3D85CE. The two temporal accents are semantic:
   orange = event time ("when it happened"), violet = record time
   ("when it was learned"). One dark panel (the bi-temporal section and
   code blocks) gives the light page its editorial rhythm.
   Type: Source Serif 4 (display) · Geist (body/UI) · Geist Mono (data). */

:root {
  --paper: #FFFFFF;
  --paper-warm: #FAF7F3;
  --ink: #201A26;
  --ink-dim: #56505E;
  --ink-faint: #6F6878;
  --violet: #7038CC;
  --violet-soft: #A78BFA;
  --magenta: #D8536A;
  --orange: #F5872A;
  --orange-deep: #C05F10;
  --blue: #3D85CE;
  --line: #E9E3DC;
  --line-strong: #D9D2C9;
  --panel: #241D2E;
  --panel-ink: #F4F1FA;
  --panel-dim: rgba(244, 241, 250, 0.62);
  --grad: linear-gradient(92deg, #7038CC 0%, #D8536A 52%, #F5872A 100%);
  --grad-text: linear-gradient(92deg, #7038CC 0%, #C9506A 50%, #C05F10 100%);
  --shadow-card: 0 1px 2px rgba(32, 26, 38, 0.05), 0 10px 30px rgba(32, 26, 38, 0.06);
  --font-display: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-body: "Geist", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "Geist Mono", "SF Mono", Menlo, Consolas, monospace;
  --r-card: 16px;
  --r-tile: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.66;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

::selection { background: var(--violet); color: #fff; }

a { color: var(--violet); text-decoration-thickness: 1px; text-underline-offset: 3px; }

:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  font-weight: 500;
  text-decoration: none;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 1rem; }

.wrap {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 2.5rem);
}
.wrap.narrow { max-width: 50rem; }

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.nav {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.7rem clamp(1rem, 4vw, 2.5rem);
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  min-width: 0;
}
.brand-mark { width: 2.1rem; height: auto; display: block; }
.brand-name {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1.12rem;
  color: var(--ink);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 1.35rem;
  margin-left: auto;
}
.nav-links a {
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 0.93rem;
  font-weight: 500;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a.nav-start { color: var(--violet); }

.nav-side {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-left: auto;
}
.nav-links + .nav-side { margin-left: 0; }

.lang-switch {
  display: flex;
  gap: 0.2rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}
.lang-switch a {
  color: var(--ink-faint);
  text-decoration: none;
  padding: 0.6rem 0.55rem;
  border-radius: 8px;
}
.lang-switch a:hover { color: var(--ink); background: rgba(32, 26, 38, 0.05); }
.lang-switch a[aria-current="true"] {
  color: var(--violet);
  font-weight: 500;
  background: rgba(112, 56, 204, 0.09);
}

.nav-github {
  font-size: 0.85rem;
  font-weight: 500;
  color: #fff;
  background: var(--ink);
  padding: 0.6rem 1rem;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
}
.nav-github:hover { background: #3A3145; }

/* ---------- hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(52% 60% at 78% 30%, rgba(245, 135, 42, 0.09) 0%, rgba(245, 135, 42, 0) 100%),
    radial-gradient(40% 52% at 12% 80%, rgba(112, 56, 204, 0.06) 0%, rgba(112, 56, 204, 0) 100%),
    var(--paper);
}

.hero-hive {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hive-toggle {
  position: absolute;
  right: clamp(0.8rem, 2vw, 1.5rem);
  bottom: clamp(0.8rem, 2vw, 1.5rem);
  z-index: 2;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  cursor: pointer;
}
.hive-toggle:hover { color: var(--ink); border-color: var(--ink-faint); }

/* white veil over the comb on the text side */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(255, 255, 255, 0.5) 40%,
    rgba(255, 255, 255, 0) 64%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 72rem;
  margin: 0 auto;
  padding: clamp(3.5rem, 9vh, 7rem) clamp(1.25rem, 4vw, 2.5rem) clamp(3rem, 7vh, 5.5rem);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 1.1rem;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.25rem, 4.6vw, 3.7rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-wrap: balance;
}
.hero-title em {
  font-style: normal;
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: var(--violet); /* fallback */
  -webkit-text-fill-color: transparent;
}

.hero-sub {
  margin-top: 1.4rem;
  max-width: 33em;
  font-size: clamp(1.02rem, 1.4vw, 1.14rem);
  color: var(--ink-dim);
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 2rem;
}

.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.98rem;
  padding: 0.8rem 1.55rem;
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.btn-primary {
  background: var(--ink);
  color: #fff;
}
.btn-primary:hover { background: #3A3145; }
.btn-ghost {
  color: var(--ink);
  border: 1px solid var(--line-strong);
  background: var(--paper);
}
.btn-ghost:hover { border-color: var(--ink-faint); background: var(--paper-warm); }

.hero-figure {
  margin: 0;
  justify-self: center;
}
.hero-figure img {
  display: block;
  width: min(100%, 430px);
  height: auto;
  filter: drop-shadow(0 22px 44px rgba(112, 56, 204, 0.16));
}

.hero-stats {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem clamp(2rem, 5vw, 4rem);
  margin-top: clamp(0.5rem, 2vh, 1.5rem);
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
}
.hero-stats .stat {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
}
.hero-stats dd.stat-n {
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 500;
  color: var(--ink);
}
.hero-stats dt.stat-l {
  font-size: 0.85rem;
  color: var(--ink-faint);
  max-width: 12em;
}

/* ---------- sections ---------- */

.section { padding: clamp(4rem, 9vw, 7.5rem) 0; }

.section-head { max-width: 46rem; margin-bottom: clamp(2rem, 5vw, 3.2rem); }

h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.8rem, 3.5vw, 2.7rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.section-intro {
  margin-top: 1rem;
  color: var(--ink-dim);
  font-size: 1.06rem;
  max-width: 42em;
}

.prose p { margin-top: 1.1rem; color: var(--ink-dim); font-size: 1.1rem; }
.prose p:first-child { margin-top: 1.3rem; }

.section-plain { background: var(--paper-warm); }

/* ---------- memory cards ---------- */

.memory-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.1rem;
}

.memory-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  padding: 1.6rem 1.45rem 1.75rem;
}
@media (min-width: 60rem) {
  .memory-grid { grid-template-columns: repeat(4, 1fr); }
  .memory-card:nth-child(even) { transform: translateY(1.3rem); }
}

/* one brand color per memory system — the logo's own spectrum */
.memory-card:nth-child(1) .memory-icon { color: var(--blue); }
.memory-card:nth-child(2) .memory-icon { color: var(--violet); }
.memory-card:nth-child(3) .memory-icon { color: var(--magenta); }
.memory-card:nth-child(4) .memory-icon { color: var(--orange); }

.memory-icon { width: 2.8rem; height: 2.8rem; margin-bottom: 1rem; }

.memory-card h3 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1.18rem;
  letter-spacing: -0.01em;
}

.memory-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--violet);
  background: rgba(112, 56, 204, 0.08);
  border-radius: 999px;
  padding: 0.18rem 0.6rem;
  margin: 0.5rem 0 0.7rem;
}

.memory-card p { color: var(--ink-dim); font-size: 0.95rem; }

.memory-note {
  margin-top: clamp(2.4rem, 5vw, 3.2rem);
  max-width: 44em;
  color: var(--ink-dim);
  border-left: 3px solid var(--orange);
  padding-left: 1.2rem;
}
.memory-note strong { color: var(--ink); }

/* ---------- bi-temporal: the dark panel ---------- */

.section-time {
  background: var(--panel);
  color: var(--panel-ink);
  --tl-event: #F5872A;
  --tl-record: #A78BFA;
  --tl-line: rgba(244, 241, 250, 0.45);
}
.section-time .eyebrow { color: #F5A85C; }
.section-time h2 { color: var(--panel-ink); }
.section-time .section-intro { color: var(--panel-dim); }

.timeline {
  position: relative;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(244, 241, 250, 0.14);
  border-radius: var(--r-card);
  padding: clamp(1.2rem, 3vw, 2.2rem);
}
@media (max-width: 46rem) {
  .timeline::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 3rem;
    border-radius: 0 var(--r-card) var(--r-card) 0;
    background: linear-gradient(270deg, var(--panel) 0%, rgba(36, 29, 46, 0) 100%);
    pointer-events: none;
  }
}

.scroll-x { overflow-x: auto; }
.scroll-x svg { width: 100%; min-width: 620px; display: block; }

.tl-label { font-family: var(--font-mono); font-size: 14px; }
.tl-label.tl-event { fill: var(--tl-event); }
.tl-label.tl-record { fill: var(--tl-record); }
.tl-desc { font-family: var(--font-body); font-size: 12.5px; fill: rgba(244, 241, 250, 0.55); }
.tl-note { font-family: var(--font-mono); font-size: 12.5px; fill: rgba(244, 241, 250, 0.75); }

.timeline figcaption {
  margin-top: 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--panel-dim);
}

/* ---------- speed ---------- */

.section-speed { background: var(--paper-warm); }

.speed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1.2rem;
}
.speed-grid .stat {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  position: relative;
  padding-top: 1.2rem;
}
.speed-grid .stat::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3.5rem;
  height: 3px;
  border-radius: 2px;
  background: var(--grad);
}
.speed-grid dd.stat-n {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: clamp(2rem, 4.2vw, 3.1rem);
  color: var(--ink);
  line-height: 1.15;
}
.speed-grid dt.stat-l { color: var(--ink-dim); font-size: 0.95rem; margin-top: 0.4rem; }


/* ---------- compat + cases ---------- */

.compat-grid, .cases-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
}

.compat-grid li {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: var(--r-tile);
  padding: 1.15rem 1.25rem;
}
.compat-grid .item-name {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--violet);
  display: block;
  margin-bottom: 0.3rem;
}
.compat-grid p { color: var(--ink-dim); font-size: 0.92rem; }

.section-cases { background: var(--paper-warm); }

.cases-grid li {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-tile);
  box-shadow: var(--shadow-card);
  padding: 1.4rem 1.35rem;
}
.cases-grid h3 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1.08rem;
  letter-spacing: -0.01em;
  margin-bottom: 0.45rem;
}
.cases-grid p { color: var(--ink-dim); font-size: 0.94rem; }

/* ---------- quickstart ---------- */

.start-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 1.1rem;
}
.start-grid .code-main { grid-row: span 2; }

.code-card {
  background: var(--panel);
  border-radius: 14px;
  padding: 1.1rem 1.25rem 1.2rem;
  min-width: 0;
}
.code-card figcaption {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #F5A85C;
  margin-bottom: 0.8rem;
}
.code-card pre { overflow-x: auto; }
.code-card code {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.65;
  color: var(--panel-ink);
  white-space: pre;
}

.start-hint {
  margin-top: 1.3rem;
  font-family: var(--font-mono);
  font-size: 0.83rem;
  color: var(--ink-faint);
}

.code-query { margin-top: 1.1rem; }
.code-query figcaption {
  text-transform: none;
  letter-spacing: 0;
  color: var(--panel-dim);
  font-size: 0.84rem;
}
.code-query code { color: #FFC08A; }

/* ---------- faq ---------- */

.faq-list details {
  border-bottom: 1px solid var(--line);
  padding: 0.3rem 0;
}
.faq-list summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 0;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1.08rem;
  color: var(--ink);
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after {
  content: "+" / "";
  font-family: var(--font-mono);
  color: var(--violet);
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}
.faq-list details[open] summary::after { content: "−" / ""; }
.faq-list details p {
  color: var(--ink-dim);
  padding: 0 0 1.2rem;
  max-width: 44em;
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--paper-warm);
  padding: clamp(3rem, 6vw, 4.5rem) 0 2rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2.5rem;
}

.footer-brand .brand-mark { width: 3.2rem; }
.footer-tagline { margin-top: 1rem; color: var(--ink-dim); max-width: 28em; }

.footer-col h3 {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.9rem;
}
.footer-col a {
  display: block;
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 0.94rem;
  padding: 0.45rem 0;
}
.footer-col a:hover { color: var(--violet); }

.footer-note {
  margin-top: 2.6rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
}
.footer-note p { font-size: 0.78rem; color: var(--ink-faint); max-width: 60em; }

/* ---------- reveal on scroll (JS-gated so no-JS users see everything) ---------- */

html.js .reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
html.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html.js .reveal { opacity: 1; transform: none; transition: none; }
  .btn, .nav-github { transition: none; }
}

/* ---------- responsive ---------- */

@media (max-width: 60rem) {
  .nav { flex-wrap: wrap; row-gap: 0; }
  .nav-links {
    order: 3;
    flex-basis: 100%;
    overflow-x: auto;
    padding: 0.15rem 0 0.5rem;
    gap: 1.2rem;
  }
  .nav-links a { padding: 0.35rem 0; white-space: nowrap; }
  .hero::after {
    background: rgba(255, 255, 255, 0.72);
  }
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .hero-figure {
    order: -1;
    justify-self: start;
  }
  .hero-figure img { width: min(46vw, 240px); }
}

@media (max-width: 46rem) {
  .start-grid { grid-template-columns: 1fr; }
  .code-card code { white-space: pre-wrap; word-break: break-word; }
  .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
  .hero-stats { gap: 1.1rem 1.8rem; }
  .hero-stats dd.stat-n { font-size: 1.25rem; }
}

@media (max-width: 30rem) {
  body { font-size: 1rem; }
  .brand-name { font-size: 1.02rem; }
  .hero-ctas .btn { width: 100%; text-align: center; }
  .hero-figure img { width: min(52vw, 200px); }
}
