/* ============================================================
   Turbo EA - Shared shell
   Loaded first by every top-level page (index, consulting,
   privacy). Owns the design tokens, the base reset, the
   navigation, the footer and the scroll-reveal behaviour.
   Page stylesheets (home.css, styles.css) load after this one
   and win on any overlap.
   ============================================================ */

/* ------------------------------------------------------------
   1. Design tokens
   ------------------------------------------------------------ */
:root {
  /* Surfaces (dark) */
  --bg-0: #07070d;
  --bg-1: #0d0d16;
  --bg-2: #13131f;
  --bg-3: #191928;

  /* Text */
  --text-1: #f2f3f8;
  --text-2: #a6abc2;
  --text-3: #6e7390;

  /* Brand: the logo ramp */
  --brand-blue: #0d93d9;
  --brand-violet: #7b2ff7;
  --brand-fuchsia: #d6008f;
  --brand-pink: #ff1e9c;

  /* Text-safe accent variants. The raw ramp is tuned for gradients,
     icons and large type; these clear 4.5:1 for small text on the
     surface of the active theme. */
  --brand-blue-text: #0d93d9;
  --brand-violet-text: #9a5cff;
  --brand-fuchsia-text: #ff4fb0;
  --brand-pink-text: #ff1e9c;

  /* Back-compat aliases: consulting.html and privacy.html set icon
     colours inline through these names. */
  --brand-purple: var(--brand-violet);

  --accent-teal: #06b6a4;
  --accent-green: #22c55e;
  --accent-orange: #f59e0b;

  --gradient-brand: linear-gradient(120deg, #0d93d9 0%, #7b2ff7 48%, #ff1e9c 100%);
  --gradient-btn: linear-gradient(135deg, #0d93d9, #7b2ff7);
  --surface-tint: linear-gradient(135deg, rgba(13, 147, 217, 0.06), rgba(123, 47, 247, 0.06));

  /* Link colour, readable on both themes */
  --link: #2fa9e8;

  /* Borders */
  --border-1: rgba(255, 255, 255, 0.08);
  --border-2: rgba(255, 255, 255, 0.15);

  /* Always-dark surfaces (nav, footer, terminal) */
  --dark-surface: #0a0a12;
  --dark-surface-2: #13131f;
  --dark-border: rgba(255, 255, 255, 0.08);

  /* Radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;

  /* Shadows */
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-2: 0 12px 32px -8px rgba(0, 0, 0, 0.5);
  --shadow-card: 0 24px 56px -30px rgba(0, 0, 0, 0.6);
  --shadow-screenshot: 0 40px 80px -32px rgba(0, 0, 0, 0.7);

  /* Type */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', Consolas, monospace;
  --fs-h1: clamp(2.5rem, 5.5vw, 4.25rem);
  --fs-h2: clamp(1.875rem, 3.2vw, 2.625rem);
  --fs-h3: 1.125rem;
  --fs-lead: clamp(1.0625rem, 1.6vw, 1.1875rem);
  --fs-body: 1rem;
  --fs-sm: 0.875rem;
  --fs-xs: 0.8125rem;

  /* Spacing (8px grid) */
  --sp-1: 8px;
  --sp-2: 16px;
  --sp-3: 24px;
  --sp-4: 32px;
  --sp-5: 40px;
  --sp-6: 48px;
  --sp-7: 56px;
  --sp-8: 64px;
  --sp-10: 80px;
  --sp-12: 96px;
  --sp-14: 112px;
  --sp-16: 128px;

  /* Shell measurements */
  --shell: 1180px;
  --pad: 32px;
  --nav-h: 64px;

  /* Motion */
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
}

html.light {
  --bg-0: #ffffff;
  --bg-1: #f5f6fa;
  --bg-2: #ffffff;
  --bg-3: #fafbfd;

  --text-1: #161929;
  --text-2: #4b5068;
  --text-3: #7c819a;

  --brand-blue-text: #0a76ae;
  --brand-violet-text: #7b2ff7;
  --brand-fuchsia-text: #a8006e;
  --brand-pink-text: #d6008f;

  --link: #0a76ae;

  --surface-tint: linear-gradient(135deg, rgba(13, 147, 217, 0.035), rgba(123, 47, 247, 0.035));

  --border-1: rgba(20, 24, 45, 0.09);
  --border-2: rgba(20, 24, 45, 0.16);

  --shadow-1: 0 1px 2px rgba(20, 24, 45, 0.06);
  --shadow-2: 0 12px 32px -8px rgba(20, 24, 45, 0.1);
  --shadow-card: 0 24px 56px -30px rgba(20, 24, 45, 0.24);
  --shadow-screenshot: 0 40px 80px -32px rgba(20, 24, 45, 0.28);
}

/* ------------------------------------------------------------
   2. Reset and base
   ------------------------------------------------------------ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  overflow-x: hidden;
}

body {
  font-family: var(--font-family);
  font-size: var(--fs-body);
  line-height: 1.7;
  color: var(--text-2);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1,
h2,
h3,
h4 {
  color: var(--text-1);
  line-height: 1.25;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* Icon font. `.ms` is the short alias used by the shell and the home
   page; `.material-symbols-outlined` is kept for the pages that still
   use the long form. */
.ms {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  display: inline-block;
  white-space: nowrap;
  direction: ltr;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  user-select: none;
}

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  user-select: none;
}

:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
  border-radius: 2px;
}

::selection {
  background: rgba(13, 147, 217, 0.35);
  color: var(--text-1);
}

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

/* ------------------------------------------------------------
   3. Scroll animations
   ------------------------------------------------------------ */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: none;
}

/* Stagger containers: the container shows immediately, children
   cascade in once .visible lands. */
.fade-in[data-stagger] {
  opacity: 1;
  transform: none;
  transition: none;
}

.fade-in[data-stagger] > * {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.fade-in[data-stagger].visible > * {
  opacity: 1;
  transform: none;
}

.fade-in[data-stagger].visible > :nth-child(2) { transition-delay: 60ms; }
.fade-in[data-stagger].visible > :nth-child(3) { transition-delay: 120ms; }
.fade-in[data-stagger].visible > :nth-child(4) { transition-delay: 180ms; }
.fade-in[data-stagger].visible > :nth-child(5) { transition-delay: 240ms; }
.fade-in[data-stagger].visible > :nth-child(6) { transition-delay: 300ms; }
.fade-in[data-stagger].visible > :nth-child(7) { transition-delay: 360ms; }
.fade-in[data-stagger].visible > :nth-child(n + 8) { transition-delay: 420ms; }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  html {
    scroll-behavior: auto;
  }

  .fade-in,
  .fade-in[data-stagger] > * {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ------------------------------------------------------------
   4. Navigation (always dark, both themes)
   ------------------------------------------------------------ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--dark-surface);
  border-bottom: 1px solid var(--dark-border);
  transition: box-shadow var(--transition-base);
}

.nav.scrolled {
  box-shadow: 0 8px 24px -16px rgba(0, 0, 0, 0.8);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  height: var(--nav-h);
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--pad);
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  flex: none;
}

.nav-logo-img {
  height: 24px;
  width: auto;
}

.nav-links {
  display: flex;
  flex: 1;
  align-items: center;
  gap: var(--sp-3);
}

.nav-link {
  position: relative;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: #a6abc2;
  padding: 6px 0;
  transition: color var(--transition-fast);
}

.nav-link::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 2px;
  border-radius: 1px;
  background: var(--gradient-brand);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-base);
}

.nav-link:hover {
  color: #ffffff;
}

.nav-link:hover::after {
  transform: scaleX(1);
}

.nav-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
}

.nav-utility {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: #e8eaf2;
  transition: color var(--transition-fast);
}

.nav-utility:hover {
  color: #ffffff;
}

.nav-utility .ms {
  font-size: 18px;
}

.nav-cta {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 18px;
  border-radius: var(--r-sm);
  background: var(--gradient-brand);
  color: #ffffff;
  font-size: var(--fs-xs);
  font-weight: 600;
  transition: var(--transition-fast);
}

.nav-cta:hover {
  color: #ffffff;
  filter: brightness(1.1);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--r-sm);
  background: transparent;
  color: #a6abc2;
  cursor: pointer;
  transition: var(--transition-fast);
}

.theme-toggle:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
}

.theme-toggle .ms {
  font-size: 18px;
}

/* Dark mode shows the sun (switch to light), light mode the moon. */
.theme-toggle .theme-icon-moon {
  display: none;
}

html.light .theme-toggle .theme-icon-moon {
  display: inline-block;
}

html.light .theme-toggle .theme-icon-sun {
  display: none;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--r-sm);
  background: transparent;
  color: #f2f3f8;
  cursor: pointer;
}

.nav-toggle .ms {
  font-size: 20px;
}

.nav-toggle .nav-toggle-close {
  display: none;
}

.nav-toggle.open .nav-toggle-close {
  display: inline-block;
}

.nav-toggle.open .nav-toggle-open {
  display: none;
}

@media (max-width: 1024px) {
  .nav-toggle {
    display: inline-flex;
  }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: calc(100vh - var(--nav-h));
    height: calc(100dvh - var(--nav-h));
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-1);
    padding: var(--sp-4) var(--pad);
    background: var(--dark-surface);
    border-bottom: 1px solid var(--dark-border);
    overflow-y: auto;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-link {
    font-size: 1.125rem;
    padding: 10px 0;
    width: 100%;
  }

  .nav-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: var(--sp-2);
    margin-left: 0;
    margin-top: var(--sp-3);
    padding-top: var(--sp-3);
    border-top: 1px solid var(--dark-border);
  }

  .nav-utility {
    height: 44px;
    padding: 0 var(--sp-2);
    border: 1px solid var(--dark-border);
    border-radius: var(--r-sm);
    font-size: 1.0625rem;
    gap: 10px;
  }

  .nav-cta {
    height: 44px;
    justify-content: center;
    font-size: 1rem;
  }

  .nav-actions .theme-toggle {
    margin-top: var(--sp-2);
    align-self: center;
  }
}

/* ------------------------------------------------------------
   5. Footer (always dark, both themes)
   ------------------------------------------------------------ */
.footer {
  background: var(--dark-surface);
  border-top: 1px solid var(--dark-border);
  padding: var(--sp-6) var(--pad);
}

.footer-inner {
  max-width: var(--shell);
  margin-inline: auto;
}

.footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2) var(--sp-4);
}

.footer-brand-text {
  font-size: 1.0625rem;
  font-weight: 700;
  color: #f2f3f8;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-3);
}

.footer-links a {
  font-size: var(--fs-sm);
  color: #8a8fa8;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: #ffffff;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--dark-border);
}

.footer-copy {
  font-size: var(--fs-xs);
  color: #5d6178;
}

.footer-sponsor {
  display: inline-flex;
  align-items: center;
}

@media (max-width: 700px) {
  .footer-top,
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 860px) {
  :root {
    --pad: 20px;
  }
}
