/* ========================================
   GRAIL AUTOMATION — Design System
   ======================================== */

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; }
ul, ol { list-style: none; }

/* --- Custom Properties --- */
:root,
[data-theme="dark"] {
  --bg-page: #0B1012;
  --bg-card: #1C1D1F;
  --bg-elevated: #131A2F;
  --accent: #1257CE;
  --accent-hover: #1a6ae8;
  --accent-glow: rgba(18, 87, 206, 0.08);
  --text-primary: #DFE0E5;
  --text-secondary: #8B8D95;
  --border-subtle: #2E446D;
  --border-default: #1B2842;
  --nav-bg: rgba(11, 16, 18, 0.85);
  --logo-opacity: 0.04;
  --dot-color: rgba(46, 68, 109, 0.3);
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --client-filter: brightness(0) invert(0.6);
  --client-filter-hover: brightness(0) invert(1);
}

[data-theme="light"] {
  --bg-page: #FAFBFC;
  --bg-card: #FFFFFF;
  --bg-elevated: #F0F2F5;
  --accent: #1257CE;
  --accent-hover: #0E47A8;
  --accent-glow: rgba(18, 87, 206, 0.05);
  --text-primary: #111318;
  --text-secondary: #4A4D56;
  --border-subtle: #E2E4E9;
  --border-default: #D1D4DB;
  --nav-bg: rgba(250, 251, 252, 0.85);
  --logo-opacity: 0.03;
  --dot-color: rgba(209, 212, 219, 0.5);
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --client-filter: brightness(0) opacity(0.4);
  --client-filter-hover: brightness(0) opacity(1);
}

/* --- Typography --- */
body {
  font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-page);
}

h1, h2, h3 {
  font-family: 'Baloo 2', cursive;
  font-weight: 700;
  line-height: 1.15;
}

.mono {
  font-family: 'Space Mono', 'SF Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

/* --- Layout --- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

section {
  padding: 6rem 0;
}

.section-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

.section-title {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
}

/* --- Dot Grid Background --- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, var(--dot-color) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
  z-index: 0;
}

body > * {
  position: relative;
  z-index: 1;
}

/* ========================================
   NAV
   ======================================== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1rem 0;
  transition: background 0.3s ease, border-color 0.3s ease, backdrop-filter 0.3s ease;
  border-bottom: 1px solid transparent;
}

.nav.scrolled {
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom-color: var(--border-default);
}

.nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-logo {
  width: 32px;
  height: 28px;
  color: var(--accent);
}

.nav-wordmark {
  font-family: 'Space Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-primary);
  font-weight: 400;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.theme-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--text-secondary);
  transition: color 0.2s ease, background 0.2s ease;
}

.theme-toggle:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  border-radius: 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s ease;
  white-space: nowrap;
}

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

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(18, 87, 206, 0.3);
}

.btn-ghost {
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
}

/* ========================================
   HERO
   ======================================== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 5rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 120%;
  height: 80%;
  background: radial-gradient(ellipse at center, var(--accent-glow), transparent 60%);
  pointer-events: none;
}

.hero-watermark {
  position: absolute;
  top: 50%;
  right: -5%;
  transform: translateY(-50%);
  width: 500px;
  height: 440px;
  opacity: var(--logo-opacity);
  color: var(--accent);
  pointer-events: none;
}

.hero-content {
  max-width: 680px;
  position: relative;
}

.hero-eyebrow {
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: fadeUp 0.6s ease forwards;
  animation-delay: 0.1s;
}

.hero-headline {
  font-size: 3rem;
  line-height: 1.1;
  margin-bottom: 0.75rem;
  opacity: 0;
  animation: fadeUp 0.6s ease forwards;
  animation-delay: 0.3s;
}

.hero-subline {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.75rem;
  font-style: italic;
  color: var(--accent);
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: fadeUp 0.6s ease forwards;
  animation-delay: 0.5s;
}

.hero-body {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 540px;
  margin-bottom: 2.5rem;
  line-height: 1.7;
  opacity: 0;
  animation: fadeUp 0.6s ease forwards;
  animation-delay: 0.65s;
}

.hero-ctas {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  opacity: 0;
  animation: fadeUp 0.6s ease forwards;
  animation-delay: 0.8s;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   SERVICES
   ======================================== */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-top: 3rem;
}

.service-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-top: 3px solid var(--border-subtle);
  border-radius: 12px;
  padding: 2rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.service-card:hover {
  border-top-color: var(--accent);
  box-shadow: 0 0 24px var(--accent-glow), var(--card-shadow);
}

.service-icon {
  width: 40px;
  height: 40px;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

.service-card h3 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

.service-card p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* ========================================
   PROCESS
   ======================================== */
.process-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin-top: 3rem;
  position: relative;
}

.process-steps::before {
  content: '';
  position: absolute;
  top: 28px;
  left: calc(12.5% + 20px);
  right: calc(12.5% + 20px);
  height: 2px;
  background: var(--border-default);
}

.process-step {
  text-align: center;
  padding: 0 1rem;
  position: relative;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--bg-page);
  color: var(--accent);
  font-family: 'Space Mono', monospace;
  font-size: 1.125rem;
  font-weight: 400;
  margin-bottom: 1.25rem;
  position: relative;
  z-index: 1;
}

.process-step h3 {
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
}

.process-step p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ========================================
   CLIENTS
   ======================================== */
.clients-section {
  text-align: center;
}

.client-logos {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 3rem;
  margin-top: 3rem;
}

.client-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-secondary);
  opacity: 0.5;
  transition: opacity 0.3s ease, color 0.3s ease;
  letter-spacing: 0.02em;
}

.client-logo:hover {
  opacity: 1;
  color: var(--text-primary);
}

.platforms {
  margin-top: 4rem;
  padding-top: 3rem;
  border-top: 1px solid var(--border-default);
}

.platforms .section-label {
  margin-bottom: 1.5rem;
}

.platform-list {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.5rem 2.5rem;
}

.platform-item {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9375rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ========================================
   ABOUT
   ======================================== */
.about-content {
  max-width: 640px;
}

.about-content p {
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--text-secondary);
}

.about-content p + p {
  margin-top: 1rem;
}

/* ========================================
   BOOKING
   ======================================== */
.booking-section {
  background: var(--bg-card);
  border-top: 1px solid var(--border-default);
  border-bottom: 1px solid var(--border-default);
}

.booking-header {
  margin-bottom: 2.5rem;
}

.booking-header h2 {
  font-size: 2.5rem;
  font-style: italic;
}

.booking-header p {
  color: var(--text-secondary);
  margin-top: 0.75rem;
  font-size: 1.0625rem;
}

.booking-slots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.slot-card {
  display: block;
  background: var(--bg-page);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.slot-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.slot-day {
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.slot-date {
  font-family: 'Baloo 2', cursive;
  font-size: 1.375rem;
  margin-bottom: 0.5rem;
}

.slot-time {
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.booking-fallback {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.booking-fallback a {
  color: var(--accent);
  transition: color 0.2s ease;
}

.booking-fallback a:hover {
  color: var(--accent-hover);
}

/* ========================================
   FOOTER
   ======================================== */
.footer {
  padding: 3rem 0;
  border-top: 1px solid var(--border-default);
}

.footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.footer-logo {
  width: 24px;
  height: 21px;
  color: var(--accent);
}

.footer-copy {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-link-icon {
  width: 18px;
  height: 18px;
}

/* ========================================
   ANIMATIONS — Scroll Reveal
   ======================================== */
.fade-up {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.fade-up:nth-child(2) { transition-delay: 0.1s; }
.fade-up:nth-child(3) { transition-delay: 0.2s; }
.fade-up:nth-child(4) { transition-delay: 0.3s; }

/* ========================================
   RESPONSIVE
   ======================================== */

/* Tablet */
@media (min-width: 768px) {
  .hero-headline {
    font-size: 3.75rem;
  }

  .section-title {
    font-size: 2.75rem;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .hero-headline {
    font-size: 4.5rem;
  }

  section {
    padding: 8rem 0;
  }

  .services-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Mobile adjustments */
@media (max-width: 767px) {
  .nav-wordmark {
    display: none;
  }

  .hero {
    min-height: auto;
    padding-top: 7rem;
    padding-bottom: 4rem;
  }

  .hero-watermark {
    display: none;
  }

  .hero-subline {
    font-size: 1.375rem;
  }

  section {
    padding: 4rem 0;
  }

  .section-title {
    font-size: 2rem;
  }

  .process-steps {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .process-steps::before {
    top: 0;
    bottom: 0;
    left: 27px;
    right: auto;
    width: 2px;
    height: auto;
  }

  .process-step {
    text-align: left;
    padding-left: 4.5rem;
    padding-right: 0;
  }

  .step-number {
    position: absolute;
    left: 0;
    top: 0;
  }

  .booking-header h2 {
    font-size: 2rem;
  }

  .client-logos {
    gap: 2rem;
  }

  .footer .container {
    flex-direction: column;
    text-align: center;
  }
}
