/* ============================================================================
 * StudyBits — public site design system
 * Built on the Studio dashboard tokens (src/app/studio/_styles/studio.css):
 * editorial light palette, Inter / Fraunces / JetBrains Mono, the signature
 * iridescent AI gradient + shimmer, pill buttons, and a Midnight dark mode.
 * ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Fraunces:opsz,wght@9..144,300;9..144,400;9..144,500&family=JetBrains+Mono:wght@400;500&family=Varela+Round&display=swap');

:root {
  --bg: #FBFBF9;
  --bg-2: #F2F2F0;
  --chrome: rgba(251, 251, 249, 0.72);
  --surface: #FFFFFF;
  --surface-2: #F4F4F1;
  --surface-3: #E8E8E5;
  --border-subtle: #ECECEA;
  --border-strong: rgba(26, 26, 26, 0.12);
  --text-primary: #0A0A0A;
  --text-secondary: #525252;
  --text-tertiary: #9A9A95;
  --brand: #3B5BFF;
  --brand-soft: #EAEEFF;
  --success: #1F8A4C;
  --warning: #D4881F;
  --danger: #C0382B;

  --ai-grad: linear-gradient(135deg, #C8B5FF 0%, #8AB6FF 50%, #B5E8D1 100%);
  --ai-grad-soft: linear-gradient(135deg, rgba(200,181,255,0.18) 0%, rgba(138,182,255,0.18) 50%, rgba(181,232,209,0.18) 100%);

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-serif: 'Fraunces', 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --shadow-sm: 0 1px 2px rgba(15,15,15,0.04);
  --shadow-md: 0 1px 2px rgba(15,15,15,0.03), 0 12px 32px rgba(15,15,15,0.08);
  --shadow-lg: 0 1px 2px rgba(15,15,15,0.03), 0 30px 60px -18px rgba(15,15,15,0.18);
  --shadow-pop: 0 1px 2px rgba(15,15,15,0.06), 0 12px 32px rgba(15,15,15,0.12);

  --maxw: 1200px;
  --radius: 16px;
}

[data-theme="dark"] {
  --bg: #0A0E1A;
  --bg-2: #0E1322;
  --chrome: rgba(10, 14, 26, 0.72);
  --surface: #141A2C;
  --surface-2: #1A2138;
  --surface-3: #242D48;
  --border-subtle: rgba(123, 138, 200, 0.16);
  --border-strong: rgba(123, 138, 200, 0.30);
  --text-primary: #E8ECF7;
  --text-secondary: #A9B2CC;
  --text-tertiary: #6B7494;
  --brand: #8AB6FF;
  --brand-soft: #1C2950;
  --shadow-md: 0 1px 2px rgba(0,0,0,0.4), 0 12px 32px rgba(0,0,0,0.45);
  --shadow-lg: 0 1px 2px rgba(0,0,0,0.4), 0 30px 60px -18px rgba(0,0,0,0.6);
  --shadow-pop: 0 1px 2px rgba(0,0,0,0.4), 0 12px 32px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01';
}
::selection { background: var(--brand); color: #fff; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---- typography ---------------------------------------------------------- */
.serif { font-family: var(--font-serif); font-weight: 300; }
.mono { font-family: var(--font-mono); }
.display {
  font-family: var(--font-serif);
  font-weight: 300;
  letter-spacing: -0.028em;
  line-height: 1.04;
  margin: 0;
  color: var(--text-primary);
  text-wrap: balance;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.lead {
  font-size: 19px;
  line-height: 1.6;
  color: var(--text-secondary);
  text-wrap: pretty;
}

/* ---- layout -------------------------------------------------------------- */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }
.section { padding: 110px 0; }
.section-sm { padding: 72px 0; }
.center { text-align: center; }
.grid { display: grid; gap: 24px; }

/* ---- AI gradient utilities ---------------------------------------------- */
@keyframes ai-shimmer { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
@keyframes shimmer-text { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse-ring { 0% { box-shadow: 0 0 0 0 rgba(59,91,255,0.28); } 70% { box-shadow: 0 0 0 12px rgba(59,91,255,0); } 100% { box-shadow: 0 0 0 0 rgba(59,91,255,0); } }
@keyframes caret { 50% { opacity: 0; } }
@keyframes float-y { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.ai-grad { background: var(--ai-grad); background-size: 200% 200%; animation: ai-shimmer 6s linear infinite; }
.ai-grad-soft { background: var(--ai-grad-soft); }
.shimmer-text {
  background: linear-gradient(90deg, var(--text-primary) 0%, var(--text-primary) 40%, #8AB6FF 50%, var(--text-primary) 60%, var(--text-primary) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer-text 3s linear infinite;
}
.ai-border { position: relative; }
.ai-border::before {
  content: ''; position: absolute; inset: 0; padding: 1.5px; border-radius: inherit;
  background: linear-gradient(135deg, #C8B5FF, #8AB6FF, #B5E8D1, #C8B5FF);
  background-size: 300% 300%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none; animation: ai-shimmer 6s linear infinite;
}

/* ---- buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 22px; border-radius: 999px; border: 1px solid transparent;
  font-family: var(--font-sans); font-size: 14.5px; font-weight: 500; cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--text-primary); color: var(--bg); }
.btn-primary:hover { box-shadow: var(--shadow-md); }
.btn-brand { background: var(--brand); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text-primary); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--text-tertiary); }
.btn-sm { height: 38px; padding: 0 16px; font-size: 13.5px; }
.btn-lg { height: 52px; padding: 0 28px; font-size: 16px; }
.btn-block { width: 100%; }

/* ---- chips / badges ------------------------------------------------------ */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border-subtle); background: var(--surface);
  border-radius: 999px; padding: 7px 14px; font-size: 13px; color: var(--text-secondary);
  transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
a.chip:hover, button.chip:hover { transform: translateY(-1px); border-color: var(--border-strong); color: var(--text-primary); }
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px;
  background: var(--ai-grad-soft); border: 1px solid var(--border-subtle); white-space: nowrap;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.01em; color: var(--text-secondary);
}
.dot { width: 7px; height: 7px; border-radius: 999px; background: var(--success); }
.dot.pulse { animation: pulse-ring 2s infinite; }

/* ---- cards --------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }

/* ---- header -------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  background: var(--chrome); border-bottom: 1px solid transparent;
}
.site-header.scrolled { border-bottom-color: var(--border-subtle); }
.nav {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  height: 68px; max-width: var(--maxw); margin: 0 auto; padding: 0 28px;
}
.nav-brand { display: inline-flex; align-items: center; gap: 10px; font-family: 'Varela Round', var(--font-sans); font-weight: 400; font-size: 19px; letter-spacing: 0.01em; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-link {
  padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--text-secondary);
  transition: color 0.15s ease, background 0.15s ease;
}
.nav-link:hover { color: var(--text-primary); background: var(--surface-2); }
.nav-link.active { color: var(--text-primary); }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.nav-divider { width: 1px; height: 22px; background: var(--border-subtle); margin: 0 4px; }
.nav-toggle {
  display: none; place-items: center; width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 11px; border: 1px solid var(--border-subtle); background: var(--surface);
  color: var(--text-primary); cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease;
}
.nav-toggle:hover { border-color: var(--border-strong); }
.nav-toggle.is-open { background: var(--surface-2); }
@media (max-width: 880px) {
  .nav-links { display: none; }
  .nav-login, .nav-demo, .nav-docs, .nav-divider { display: none; }
  .nav-toggle { display: grid; }
}

/* ---- mobile menu (redesigned: fixed full-height panel) ------------------ */
.site-menu {
  position: fixed; left: 0; right: 0; top: 68px; bottom: 0; z-index: 90;
  display: flex; flex-direction: column;
  background: var(--bg);
  border-top: 1px solid var(--border-subtle);
  opacity: 0; visibility: hidden; transform: translateY(-8px);
  transition: opacity 0.22s ease, transform 0.3s cubic-bezier(0.22,1,0.36,1), visibility 0.3s;
}
.site-menu.open { opacity: 1; visibility: visible; transform: none; }
.site-menu-inner {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  padding: 14px 22px calc(22px + env(safe-area-inset-bottom)); overflow-y: auto;
}
.site-menu-nav { display: flex; flex-direction: column; }
.site-menu-link {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 4px; font-size: 18px; font-weight: 500; color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
}
.site-menu-link svg { color: var(--text-tertiary); transition: transform 0.16s ease, color 0.16s ease; }
.site-menu-link:active { color: var(--brand); }
.site-menu-link.active { color: var(--brand); }
.site-menu-link.active svg, .site-menu-link:hover svg { color: var(--brand); transform: translateX(3px); }
/* "Docs" is a resource, not a marketing page — set it apart from the group. */
.site-menu-link-sep { margin-top: 10px; border-top: 1px solid var(--border-subtle); }
/* Bottom cluster fills the lower half so the panel never looks empty */
.site-menu-foot { margin-top: auto; padding-top: 28px; }
.site-menu-aside { padding: 18px 0 4px; border-top: 1px solid var(--border-subtle); }
.site-menu-tag { margin: 0 0 14px; max-width: 320px; font-size: 15px; line-height: 1.5; color: var(--text-secondary); }
.site-menu-works { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-tertiary); }
.site-menu-works > span:first-child { font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; font-size: 11px; margin-right: 2px; }
.site-menu-chip { border: 1px solid var(--border-subtle); border-radius: 999px; padding: 5px 11px; background: var(--surface); color: var(--text-secondary); font-weight: 500; }
.site-menu-cta { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }

/* ---- footer -------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--border-subtle); background: var(--bg-2); padding: 72px 0 36px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(4, 1fr); gap: 40px; }
.footer-col h4 { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-tertiary); margin: 0 0 16px; }
.footer-col a { display: block; font-size: 14px; color: var(--text-secondary); padding: 6px 0; transition: color 0.15s ease; }
.footer-col a:hover { color: var(--text-primary); }
/* the "Book a demo" CTA is an <a> inside .footer-col, so restore button styling
 * (the generic .footer-col a rule above otherwise wins on specificity). */
.site-footer .footer-col a.btn {
  display: inline-flex; width: auto; height: 38px; padding: 0 16px;
  font-size: 13.5px; color: var(--text-primary); margin-top: 6px;
}
.site-footer .footer-col a.btn:hover { color: var(--text-primary); }
.site-footer .footer-col a.nav-brand { display: inline-flex; padding: 0; color: var(--text-primary); }
.footer-bottom {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--border-subtle);
  font-size: 13px; color: var(--text-tertiary);
}
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; } }

/* ---- reveal on scroll ----------------------------------------------------
 * Content is ALWAYS visible (opacity:1). Only transform animates, so if the
 * browser pauses animations the content still shows — never a blank gate. */
@keyframes reveal-rise { from { transform: translateY(26px); } to { transform: none; } }
.reveal { opacity: 1; }
.reveal.in { animation: reveal-rise 0.7s cubic-bezier(0.22,1,0.36,1) both; }
.reveal.in[data-delay="1"] { animation-delay: 0.07s; }
.reveal.in[data-delay="2"] { animation-delay: 0.14s; }
.reveal.in[data-delay="3"] { animation-delay: 0.21s; }
.reveal.in[data-delay="4"] { animation-delay: 0.28s; }
@media (prefers-reduced-motion: reduce) {
  .reveal.in { animation: none; }
  html { scroll-behavior: auto; }
}

/* ---- composer (lifted from studio-hero-composer) ------------------------- */
.composer {
  position: relative; border-radius: 20px; background: var(--surface);
  border: 1px solid var(--border-subtle); box-shadow: var(--shadow-md); text-align: left;
}
.composer::before {
  content: ''; position: absolute; inset: -1px; padding: 1.5px; border-radius: 21px;
  background: linear-gradient(135deg, #C8B5FF, #8AB6FF, #B5E8D1, #C8B5FF); background-size: 300% 300%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none; animation: ai-shimmer 6s linear infinite;
}
.composer-body { padding: 22px 24px 6px; min-height: 76px; font-size: 16.5px; line-height: 1.55; color: var(--text-primary); }
.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px 14px 22px; }
.composer-hint { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-tertiary); }
.composer-send {
  display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border: 0;
  border-radius: 50%; background: var(--text-primary); color: var(--bg); cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.composer-send:hover { transform: scale(1.05); }
.caret { display: inline-block; width: 2px; height: 1.05em; background: var(--brand); margin-left: 1px; transform: translateY(2px); animation: caret 1s steps(1) infinite; }

/* ---- misc utilities ------------------------------------------------------ */
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-wrap { flex-wrap: wrap; }
.muted { color: var(--text-tertiary); }
.divider { height: 1px; background: var(--border-subtle); border: 0; margin: 0; }
.kbd { font-family: var(--font-mono); font-size: 11px; background: var(--surface-2); border-radius: 4px; padding: 2px 6px; color: var(--text-secondary); }
.theme-toggle {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 999px;
  border: 1px solid var(--border-subtle); background: var(--surface); color: var(--text-secondary); cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.theme-toggle:hover { color: var(--text-primary); border-color: var(--border-strong); }

/* ---- small-screen refinements ------------------------------------------- */
/* Marketing pages are full-page takeovers; clip any incidental horizontal
 * overflow so a single wide element never produces a sideways scroll. */
html, body { overflow-x: hidden; }
@media (max-width: 600px) {
  .container { padding: 0 18px; }
  .section { padding: 64px 0; }
  .section-sm { padding: 48px 0; }
  .btn-lg { height: 50px; font-size: 15.5px; }
  .cta-band { padding: 28px 22px; border-radius: 20px; }
  .cta-band .btn { width: 100%; }
  .cta-band .row { width: 100%; }
}
