/* =========================================================================
   QueryVault — Showcase Site
   Dark-theme design matched to the application's visual tokens.
   Brand color language: blue at rest, amber while pending, green on commit.
   ========================================================================= */

:root {
  --bg: #0a0a0a;
  --bg-subtle: #111111;
  --bg-2: #161616;
  --fg: #ededed;
  --muted: #a1a1a1;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #0070f3;
  --accent-hover: #3291ff;
  --amber: #f59e0b;
  --green: #22c55e;
  --card: rgba(22, 22, 22, 0.82);
  --mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', ui-monospace, Menlo, Consolas, monospace;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

a {
  color: inherit;
}

code {
  font-family: var(--mono);
}

/* ---- loader ---------------------------------------------------------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--bg);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loader.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader__mark {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.04em;
  background: linear-gradient(90deg, #0070f3, #22c55e 55%, #f59e0b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.loader__bar {
  width: 220px;
  height: 3px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}

.loader__fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.2s ease;
}

.loader__pct {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.loader__hint {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

/* ---- sticky canvas stage -------------------------------------------- */
.stage {
  position: fixed;
  inset: 0;
  z-index: 1;
}

.stage__canvas {
  width: 100vw;
  height: 100vh;
  display: block;
}

/* ---- floating captions (revealed by scroll progress) -------------------- */
.features {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.feature {
  position: absolute;
  top: 50%;
  transform: translateY(-46%);
  max-width: 400px;
  padding: 24px 26px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.feature--left {
  left: 6vw;
  transform: translate(-16px, -46%);
}

.feature--right {
  right: 6vw;
  transform: translate(16px, -46%);
}

.feature.is-active {
  opacity: 1;
  transform: translate(0, -50%);
}

.feature__eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-hover);
  font-weight: 600;
}

.feature__title {
  margin: 0 0 8px;
  font-size: 24px;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.feature__copy {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

/* ---- scroll hint ----------------------------------------------------- */
.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: opacity 0.4s ease;
}

.scroll-hint.is-hidden {
  opacity: 0;
}

.scroll-hint__chev {
  width: 12px;
  height: 12px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  animation: bob 1.6s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% {
    transform: rotate(45deg) translate(0, 0);
    opacity: 0.4;
  }
  50% {
    transform: rotate(45deg) translate(3px, 3px);
    opacity: 1;
  }
}

/* ---- document flow (drives the scroll height) ----------------------- */
#main {
  position: relative;
  z-index: 2;
}

.section {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 24px;
}

.section--hero {
  min-height: 100vh;
  padding-top: 40px;
  padding-bottom: 40px;
}

.section--scrub {
  height: 620vh;
}

.section--cta {
  min-height: 100vh;
  background: linear-gradient(180deg, transparent, var(--bg) 22%);
}

/* Query-grid backdrop */
.fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.section--hero > :not(.fx),
.section--cta > :not(.fx) {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.hero__title {
  margin: 0;
  font-size: clamp(56px, 11vw, 148px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.95;
  background: linear-gradient(90deg, #0070f3, #38bdf8 40%, #22c55e 78%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__sub {
  margin: 20px 0 0;
  font-size: clamp(16px, 2.4vw, 22px);
  color: var(--muted);
  max-width: 720px;
  line-height: 1.5;
}

/* SQL typing flourish */
.hero__query {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 30px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(13, 17, 23, 0.72);
  backdrop-filter: blur(6px);
  font-family: var(--mono);
  font-size: clamp(13px, 1.9vw, 16px);
  max-width: min(92vw, 620px);
  text-align: left;
}

.hero__prompt {
  color: var(--green);
  font-weight: 700;
  flex-shrink: 0;
}

.hero__code {
  color: #cdd6e4;
  white-space: pre;
  overflow: hidden;
}

.hero__code .kw {
  color: #38bdf8;
}
.hero__code .fn {
  color: var(--amber);
}
.hero__code .str {
  color: var(--green);
}

.hero__caret {
  width: 8px;
  height: 1.15em;
  background: var(--accent);
  flex-shrink: 0;
  animation: blink 1.05s steps(1) infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

.hero__tools {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 26px;
}

.hero__chip {
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  color: var(--fg);
  background: rgba(22, 22, 22, 0.65);
  backdrop-filter: blur(4px);
}

.hero__chip b {
  color: var(--accent);
  font-family: var(--mono);
}

.hero__actions,
.cta__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 32px;
}

.cta__title {
  margin: 0;
  font-size: clamp(32px, 6vw, 64px);
  letter-spacing: -0.03em;
  font-weight: 800;
  max-width: 900px;
}

.cta__sub {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: clamp(15px, 2.2vw, 19px);
  max-width: 640px;
  line-height: 1.6;
}

.cta__sub code {
  color: var(--accent-hover);
  background: rgba(0, 112, 243, 0.12);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 0.9em;
}

.btn {
  display: inline-flex;
  align-items: center;
  height: 48px;
  padding: 0 24px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}

.btn--primary:hover {
  background: var(--accent-hover);
}

.btn--ghost {
  border: 1px solid var(--line);
  color: var(--fg);
  background: rgba(255, 255, 255, 0.03);
}

.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

/* ---- feature grid ---------------------------------------------------- */
.grid-section {
  position: relative;
  z-index: 2;
  background: var(--bg-subtle);
  border-top: 1px solid var(--line);
  padding: 96px 24px;
}

.grid-inner {
  max-width: 1040px;
  margin: 0 auto;
}

.grid-title {
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  text-align: center;
  font-weight: 800;
}

.grid-sub {
  color: var(--muted);
  text-align: center;
  margin: 0 0 48px;
  font-size: clamp(14px, 2vw, 17px);
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.tile {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-2);
  transition: border-color 0.2s, transform 0.2s;
}

.tile:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.tile__badge {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 20px;
  margin-bottom: 16px;
}

.tile h3 {
  margin: 0 0 8px;
  font-size: 19px;
  font-weight: 700;
}

.tile p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.tile p code {
  color: #cdd6e4;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.88em;
}

/* ---- light-mode showcase -------------------------------------------- */
.showcase {
  position: relative;
  z-index: 2;
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding: 96px 24px;
  text-align: center;
}

.showcase__inner {
  max-width: 1040px;
  margin: 0 auto;
}

.showcase__title {
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  font-weight: 800;
}

.showcase__sub {
  color: var(--muted);
  margin: 0 auto 40px;
  font-size: clamp(14px, 2vw, 17px);
  max-width: 620px;
  line-height: 1.6;
}

.showcase__img {
  width: 100%;
  max-width: 960px;
  height: auto;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

/* ---- footer ---------------------------------------------------------- */
.footer {
  position: relative;
  z-index: 2;
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding: 64px 24px 36px;
}

.footer__grid {
  max-width: 1040px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
}

.footer__brand {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #0070f3, #22c55e);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.footer__tag {
  color: var(--muted);
  font-size: 14px;
  margin: 8px 0 0;
  max-width: 40ch;
  line-height: 1.5;
}

.footer nav h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 0 0 14px;
  font-weight: 700;
}

.footer nav a {
  display: block;
  color: var(--fg);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 0;
  opacity: 0.75;
  transition: opacity 0.15s;
}

.footer nav a:hover {
  opacity: 1;
  color: var(--accent-hover);
}

.footer__legal {
  max-width: 1040px;
  margin: 44px auto 0;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
  line-height: 1.5;
}

@media (max-width: 720px) {
  .feature {
    max-width: min(88vw, 400px);
  }
  .feature--left,
  .feature--right {
    left: 50%;
    right: auto;
    transform: translate(-50%, 8%);
  }
  .feature.is-active {
    transform: translate(-50%, 0);
  }
  .footer__grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

/* Reduced-motion preference override */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .scroll-hint__chev,
  .hero__caret {
    animation: none;
  }
  .feature {
    transition: opacity 0.2s ease;
  }
}
