/* ==========================================================================
   Almost a Lab — Shared Design System
   Loaded by all product landing pages
   ========================================================================== */

/* ---------- Custom Properties ---------- */
:root {
  /* Backgrounds */
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-card: #161616;
  --bg-card-hover: #1a1a1a;

  /* Text */
  --text-primary: #ffffff;
  --text-secondary: #999999;
  --text-muted: #555555;

  /* Borders */
  --border: #222222;
  --border-light: #333333;

  /* Brand */
  --lab-green: #D1FF4C;
  --lab-blue: #4B6BFF;

  /* Per-product accent (overridden per page) */
  --accent: #3B82F6;
  --accent-dim: rgba(59, 130, 246, 0.1);
  --accent-glow: rgba(59, 130, 246, 0.3);

  /* Typography */
  --font-display: 'Archivo Black', sans-serif;
  --font-body: 'Satoshi', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Animation */
  --ease-lab: cubic-bezier(0.22, 1, 0.36, 1);
  --duration-fast: 200ms;
  --duration-normal: 400ms;
  --duration-slow: 600ms;
}

/* ---------- Light Theme ---------- */
[data-theme="light"] {
  /* Backgrounds — warm paper palette */
  --bg-primary: #f5f3ed;
  --bg-secondary: #eae7df;
  --bg-card: #fbfaf7;
  --bg-card-hover: #f3f1ea;

  /* Text */
  --text-primary: #1a1815;
  --text-secondary: #5c5850;
  --text-muted: #969185;

  /* Borders */
  --border: #dbd6cb;
  --border-light: #c8c2b5;

  /* Brand */
  --lab-green: #1a7a3a;
}

/* ---------- Light theme dot grid ---------- */
[data-theme="light"] body {
  background-image: radial-gradient(circle, rgba(160,152,135,0.18) 1px, transparent 1px);
  background-size: 28px 28px;
}

/* ---------- Light theme grain overlay ---------- */
[data-theme="light"] body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.3;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
}

/* ---------- Theme-aware link hover ---------- */
.link-hover { transition: color 200ms ease; }
.link-hover:hover { color: var(--text-primary) !important; }

/* ---------- Light theme card enhancements ---------- */
[data-theme="light"] .lab-card {
  border-left: 2px solid transparent;
}
[data-theme="light"] .lab-card:hover {
  border-left-color: var(--accent);
  box-shadow: 0 4px 24px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.03);
}

/* ---------- Section Divider ---------- */
.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), var(--accent), var(--border), transparent);
  max-width: 600px;
  margin: 1rem auto;
}
@media (max-width: 640px) {
  .section-divider { margin: 0.5rem auto; }
}

/* ---------- Theme Toggle Button ---------- */
.theme-toggle {
  position: relative;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: color var(--duration-fast) var(--ease-lab);
}
.theme-toggle:hover {
  color: var(--accent);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
  transition: transform var(--duration-normal) var(--ease-lab),
              opacity var(--duration-fast) var(--ease-lab);
}
.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  position: absolute;
}
.theme-toggle .icon-sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}
.theme-toggle .icon-moon {
  opacity: 1;
  transform: rotate(0) scale(1);
}
[data-theme="light"] .theme-toggle .icon-sun {
  opacity: 1;
  transform: rotate(0) scale(1);
}
[data-theme="light"] .theme-toggle .icon-moon {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-primary);
  line-height: 1.65;
  overflow-x: hidden;
  transition: background-color var(--duration-normal) var(--ease-lab),
              color var(--duration-normal) var(--ease-lab);
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; }

/* ---------- Nav Scroll State ---------- */
.nav-scrolled {
  background: color-mix(in srgb, var(--bg-primary) 90%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: var(--border) !important;
}

/* ---------- Focus Styles ---------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Typography ---------- */
.text-hero {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 5rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.text-h2 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3.5vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}
.text-h3 {
  font-family: var(--font-body);
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  line-height: 1.3;
  font-weight: 700;
}
.text-body {
  font-family: var(--font-body);
  font-size: clamp(1rem, 1.1vw, 1.125rem);
  line-height: 1.65;
}
.text-caption {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.5;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ---------- Color Utilities ---------- */
.color-accent    { color: var(--accent); }
.color-secondary { color: var(--text-secondary); }
.color-muted     { color: var(--text-muted); }

/* ---------- Accent Glow ---------- */
.accent-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse, var(--accent-glow), transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.accent-glow--lg { width: 90%; height: 90%; filter: blur(50px); }
.accent-glow--sm { width: 70%; height: 70%; filter: blur(50px); }
[data-theme="light"] .accent-glow {
  background: radial-gradient(ellipse, var(--accent-dim), transparent 70%);
}
[data-theme="light"] .accent-glow--sm { opacity: 0.6; }

/* ---------- Layout ---------- */
.section-padding {
  padding: clamp(60px, 10vh, 120px) clamp(24px, 5vw, 80px);
}
.section-padding-sm {
  padding: clamp(40px, 6vh, 80px) clamp(24px, 5vw, 80px);
}
.container {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* ---------- Section Label ---------- */
.section-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1.5rem;
}
.section-label::after {
  content: '';
  display: var(--show-label-line, block);
  flex: 1;
  height: 1px;
  background: var(--border-light);
  max-width: 80px;
}
@media (max-width: 640px) {
  .section-label::after { display: none; }
}

/* ---------- Lab Card ---------- */
.lab-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 2rem;
  transition: transform var(--duration-fast) var(--ease-lab),
              background var(--duration-fast) var(--ease-lab),
              border-color var(--duration-fast) var(--ease-lab),
              box-shadow var(--duration-fast) var(--ease-lab);
}
.lab-card:hover {
  transform: translateY(-2px);
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

/* ---------- Buttons ---------- */
.lab-btn-primary {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--accent);
  color: var(--bg-primary);
  padding: 0.875rem 2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: box-shadow var(--duration-fast) var(--ease-lab),
              transform var(--duration-fast) var(--ease-lab),
              filter var(--duration-fast) var(--ease-lab);
}
.lab-btn-primary:hover {
  box-shadow: 0 0 30px var(--accent-glow), 0 0 60px var(--accent-dim);
  transform: translateY(-2px);
  filter: brightness(1.1);
}
.lab-btn-primary:active {
  transform: translateY(0);
}

.lab-btn-secondary {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 2px;
  transition: color var(--duration-fast) var(--ease-lab),
              border-color var(--duration-fast) var(--ease-lab);
}
.lab-btn-secondary:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- Skip Link ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: 10001;
  background: var(--accent);
  color: var(--bg-primary);
  padding: 0.5rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
.skip-link:focus {
  position: fixed;
  left: 1rem;
  top: 1rem;
  width: auto;
  height: auto;
  overflow: visible;
}

/* ---------- Scroll Animations ---------- */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--duration-normal) var(--ease-lab),
              transform var(--duration-normal) var(--ease-lab);
}
.animate-on-scroll.is-visible {
  opacity: 1;
  transform: none;
}

.stagger-2 { transition-delay: 100ms; }
.stagger-3 { transition-delay: 200ms; }
.stagger-4 { transition-delay: 300ms; }
.stagger-5 { transition-delay: 400ms; }
.stagger-6 { transition-delay: 500ms; }
.stagger-7 { transition-delay: 600ms; }
.stagger-8 { transition-delay: 700ms; }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes pulse-glow {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
.animate-float { animation: float 6s ease-in-out infinite; }
.animate-pulse-glow { animation: pulse-glow 3s ease-in-out infinite; }

/* ---------- Full-Page Hero ---------- */
.hero-section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.75rem, 1.5vh, 1.5rem);
  position: relative;
  overflow: hidden;
  padding-top: 7rem; /* clear fixed nav */
  padding-bottom: 1rem;
}

/* Center hero content via auto margins instead of justify-content: center.
   Auto margins distribute leftover space equally (centering on tall screens)
   but collapse to 0 when content overflows (preventing upward clipping).
   Targets the first/last in-flow children (accent-glow is position: absolute). */
.hero-section > .hero-top         { margin-top: auto; }
.hero-section > .hero-scroll-hint { margin-bottom: auto; }

.hero-top {
  text-align: center;
  padding: 0 1.5rem;
  max-width: 720px;
}

.hero-top .section-label {
  justify-content: center;
}

.hero-top .section-label::after {
  display: none;
}

.hero-center {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0 1.5rem;
  position: relative;
}

/* ---------- Hero Frame ---------- */
.hero-frame {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: min(900px, 75vw);
  max-height: 45vh;
  background: var(--bg-card);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
[data-theme="light"] .hero-frame {
  box-shadow: 0 8px 40px rgba(0,0,0,0.07), 0 2px 8px rgba(0,0,0,0.04);
}

/* Scale frame up on large displays */
@media (min-width: 1600px) {
  .hero-frame { max-width: min(1100px, 65vw); max-height: 50vh; min-height: 35vh; }
}
@media (min-width: 2000px) {
  .hero-frame { max-width: min(1300px, 55vw); max-height: 50vh; min-height: 35vh; }
}

.hero-frame__chrome {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.hero-frame__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: 0.75;
}

.hero-frame__content {
  flex: 1;
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Stacked variant: 2 columns on desktop */
.hero-frame--stacked .hero-frame__content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
}

.hero-frame--stacked .hero-frame__content > * {
  background: var(--bg-card);
}

@media (max-width: 640px) {
  .hero-frame--stacked .hero-frame__content {
    grid-template-columns: 1fr;
  }
}

/* ---------- Hero CTA Overlay ---------- */
.hero-cta-overlay {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  transform: translateY(-50%);
}

/* Give secondary link button-like presence to match primary */
.hero-cta-overlay .lab-btn-secondary {
  font-size: 0.85rem;
  padding: 0.875rem 2rem;
  border: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

/* ---------- Scroll Hint ---------- */
.hero-scroll-hint {
  padding-bottom: 2rem;
  display: flex;
  justify-content: center;
  color: var(--text-muted);
  animation: hero-bounce 2s ease-in-out infinite;
}

@keyframes hero-bounce {
  0%, 100% { transform: translateY(0); opacity: 0.6; }
  50% { transform: translateY(6px); opacity: 1; }
}

/* ---------- Hero Responsive ---------- */
/* Short viewports (laptops with browser chrome): tighten top padding */
@media (max-height: 800px) {
  .hero-section { padding-top: 5.5rem; }
}

@media (max-width: 640px) {
  .hero-section {
    min-height: auto;
    padding-top: 6.5rem;
    padding-bottom: 2.5rem;
    gap: 1rem;
  }

  .hero-top .text-body {
    display: none;
  }

  .hero-frame {
    max-width: 100%;
    max-height: none;
  }

  .hero-cta-overlay {
    transform: none;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 1.5rem 0;
    gap: 0.75rem;
  }

  .hero-cta-overlay .lab-btn-secondary {
    border: none;
    border-bottom: 1px solid var(--border-light);
    padding: 0;
    padding-bottom: 2px;
  }

  .hero-scroll-hint {
    display: none;
  }
}

/* ---------- Social Proof Strip ---------- */
.social-proof-strip {
  padding: clamp(24px, 4vh, 48px) clamp(24px, 5vw, 80px);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}
.social-proof-strip .container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(1.5rem, 4vw, 3rem);
  flex-wrap: wrap;
}
.proof-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.proof-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.proof-dot--accent { background: var(--accent); }
.proof-dot--green { background: var(--lab-green); }
.proof-accent {
  color: var(--accent);
  font-weight: 600;
}
.proof-divider {
  width: 1px;
  height: 16px;
  background: var(--border-light);
}
@media (max-width: 640px) {
  .proof-divider { display: none; }
  .social-proof-strip .container {
    flex-direction: column;
    gap: 0.75rem;
  }
}

/* ---------- Waitlist Counter ---------- */
.waitlist-counter {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  justify-content: center;
  margin-top: -0.25rem;
}
.counter-faces {
  display: flex;
}
.counter-face {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  border: 2px solid var(--bg-primary);
  background: var(--bg-card);
  margin-left: -8px;
  position: relative;
}
.counter-face:first-child {
  margin-left: 0;
}
.counter-text {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.counter-num {
  color: var(--accent);
  font-weight: 700;
}
[data-theme="light"] .counter-face {
  border-color: var(--bg-primary);
}

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .animate-on-scroll {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .animate-float { animation: none; }
  .animate-pulse-glow { animation: none; }
  .hero-scroll-hint { animation: none; }
  html { scroll-behavior: auto; }
}
