/* Gothar.com - Elite Design System V3
 * Inspired by: Active Theory, Stripe, Linear, Locomotive Scroll
 * Performance: <30KB gzipped, GPU-accelerated animations
 * Accessibility: WCAG 2.2 AA compliant
 * Updated: 2025-11-01 - V3 Compact Insights Strip
 * Version: 3.0.0 - Includes Insights Strip with compact layout
 * Cache-bypass marker: portfolio-fix-21nov
 */

/* ============================================
   CSS CUSTOM PROPERTIES (Design Tokens)
   ============================================ */

:root {
  /* Colors - Light Mode */
  --bg: #FAFBFC;
  --text: #0D0F14;
  --accent: #2563EB;       /* Matte blue-600 (was #0066FF - too bright) */
  --accent-warm: #FF6B35;
  --muted: #5A6673;
  --border: #E4E7EC;
  --surface: #FFFFFF;

  /* Spacing - 8-point grid with pure doubling (8→16→32→64→128→256) */
  --space-xs: 0.5rem;   /* 8px */
  --space-sm: 1rem;     /* 16px */
  --space-md: 2rem;     /* 32px */
  --space-lg: 4rem;     /* 64px */
  --space-xl: 8rem;     /* 128px */
  --space-2xl: 16rem;   /* 256px - for maximum breathing room */

  /* Typography */
  --font-display: "Space Grotesk", -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-body: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  /* Animation */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out-quad: cubic-bezier(0.45, 0, 0.55, 1);
  --duration-fast: 200ms;
  --duration-normal: 400ms;
  --duration-slow: 800ms;

  /* Layout */
  --max-width: 1400px;
  --gutter: 4rem;

  /* Border Radius - Standardized scale */
  --radius-sm: 0.5rem;    /* 8px - buttons, inputs, small cards */
  --radius-md: 1rem;      /* 16px - cards, modals */
  --radius-lg: 1.5rem;    /* 24px - large cards, sections */
  --radius-full: 9999px;  /* pills, avatars */

  /* Shadows - Elevation system */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 20px 48px rgba(0, 0, 0, 0.12);

  /* Semantic Colors */
  --color-success: #16a34a;
  --color-error: #dc2626;
  --color-warning: #f59e0b;
  --color-info: #0ea5e9;

  /* Button Colors */
  --btn-primary-bg: #1a1a1a;
  --btn-primary-hover: #2a2a2a;
}

/* Dark Mode */
body.dark {
  --bg: #0D0F14;
  --text: #F8FAFC;
  --accent: #60A5FA;       /* Matte blue-400 (was #3B82F6 - too bright) */
  --accent-warm: #FF8A65;
  --muted: #A8B5C7;
  --border: #1E293B;
  --surface: #1A1F2E;

  /* Dark mode semantic colors (slightly brighter for contrast) */
  --color-success: #22c55e;
  --color-error: #ef4444;
  --color-warning: #fbbf24;
  --color-info: #38bdf8;

  /* Dark mode button colors */
  --btn-primary-bg: #F8FAFC;
  --btn-primary-hover: #E5E7EB;
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-padding-top: 2rem; /* Account for fixed language switcher */
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html {
    scroll-behavior: auto;
  }
}

body {
  font-family: var(--font-body);
  font-size: 17px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background var(--duration-normal) var(--ease-out-expo),
              color var(--duration-normal) var(--ease-out-expo);
  overflow-x: hidden;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(3rem, 10vw, 7.5rem);
}

h2 {
  font-size: clamp(2.5rem, 6vw, 5rem);
}

h3 {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
}

p {
  font-size: 1.125rem;
  color: var(--muted);
  max-width: 65ch;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  z-index: 10000;
  padding: 1rem 2rem;
  background: var(--accent);
  color: white;
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  top: 0;
}

/* Focus visible styles */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

/* ============================================
   HEADER LOGO
   ============================================ */

.header-logo {
  position: fixed;
  top: 1.5rem;
  left: 1.5rem;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  color: var(--text);
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-out-expo);
  opacity: 0.7;
}

.header-logo:hover {
  opacity: 1;
  transform: scale(1.05);
}

/* Navigation Menu (Logo-triggered) */
.header-nav {
  position: fixed;
  top: 1.5rem;
  left: 1.5rem;
  z-index: 100;
}

.header-nav .header-logo {
  position: relative;
  top: auto;
  left: auto;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.nav-menu {
  position: absolute;
  top: calc(100% + 0.75rem);
  left: 0;
  min-width: 160px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--duration-fast) var(--ease-out-expo);
}

.header-nav.open .nav-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-menu-item {
  display: block;
  padding: 0.625rem 1rem;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: background var(--duration-fast) var(--ease-out-expo),
              color var(--duration-fast) var(--ease-out-expo);
}

.nav-menu-item:hover {
  background: var(--border);
  color: var(--accent);
}

.nav-menu-item:first-child {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.nav-menu-item:last-child {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* When nav is open, logo gets full opacity */
.header-nav.open .header-logo {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .nav-menu {
    transition: none;
  }
}

.header-logo:active {
  transform: scale(0.95);
}

.header-logo svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* ============================================
   LANGUAGE SWITCHER
   ============================================ */

.lang-switcher {
  position: fixed;
  top: 2rem;
  right: 2rem;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2rem;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 1rem;
  transition: all var(--duration-fast) var(--ease-out-expo);
  min-height: 44px; /* iOS touch target minimum */
}

.lang-btn:hover {
  background: var(--bg);
  color: var(--accent);
  transform: scale(1.05);
}

.lang-btn:active {
  transform: scale(0.98);
}

.lang-btn.active {
  color: var(--accent);
  background: var(--bg);
}

.icon-globe {
  flex-shrink: 0;
}

.divider {
  color: var(--border);
  user-select: none;
}

/* ============================================
   THEME TOGGLE
   ============================================ */

.theme-toggle {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 100;
  width: 3.5rem;
  height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-expo);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.icon-sun {
  display: block;
  color: var(--text);
}

.icon-moon {
  display: none;
  color: var(--text);
}

body.dark .icon-sun {
  display: none;
}

body.dark .icon-moon {
  display: block;
}

/* ============================================
   HERO SECTION
   ============================================ */

.hero {
  position: relative;
  min-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl) var(--gutter);
  overflow: hidden;
}

.hero-orb {
  position: absolute;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 80vw;
  height: 80vw;
  max-width: 1200px;
  max-height: 1200px;
  /* Purpose: Ambient depth - creates visual anchor for hero section */
  background: radial-gradient(circle,
    rgba(0, 102, 255, 0.15) 0%,
    rgba(255, 107, 53, 0.08) 40%,
    transparent 70%);
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.7;
  animation: float 20s ease-in-out infinite;
  pointer-events: none;
}

@keyframes float {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-40px); }
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  text-align: center;
}

.hero-heading {
  margin-bottom: var(--space-md);
  font-weight: 800;
}

/* Rotating Keywords - Locomotive-inspired gradient effect */
.rotating-word {
  position: relative;
  display: inline-block;
  height: 1.3em;
  min-width: 12ch;
  vertical-align: bottom;
  overflow: hidden;
  white-space: nowrap;
}

/* Enhanced radial glow - Locomotive aesthetic */
.rotating-word::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 140%;
  height: 220%;
  background: radial-gradient(ellipse, rgba(0, 102, 255, 0.25) 0%, rgba(255, 107, 53, 0.15) 40%, transparent 70%);
  filter: blur(24px);
  pointer-events: none;
  z-index: -1;
  opacity: 0.7;
}

.rotating-word-item {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  opacity: 0;
  transform: translateY(16px);
  animation-name: rotate-word;
  animation-duration: calc(var(--kw-count, 4) * 3s);
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  animation-iteration-count: infinite;
  animation-fill-mode: forwards;
  will-change: opacity, transform;
  font-weight: 700;

  /* Locomotive-inspired rich gradient: blue → cyan → orange → red */
  background: linear-gradient(120deg,
    #0066FF 0%,
    #00D4FF 35%,
    #FF6B35 70%,
    #FF3D00 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% 100%;
  animation: gradient-shift calc(var(--kw-count, 4) * 3s) ease infinite;
}

/* First word visible by default */
.rotating-word-item:nth-child(1) {
  animation-delay: 0s;
  opacity: 1;
  transform: translateY(0);
}

.rotating-word-item:nth-child(2) {
  animation-delay: 3s;
}

.rotating-word-item:nth-child(3) {
  animation-delay: 6s;
}

.rotating-word-item:nth-child(4) {
  animation-delay: 9s;
}

@keyframes rotate-word {
  0% { opacity: 1; transform: translateY(0); }
  23% { opacity: 1; transform: translateY(0); }
  28% { opacity: 0; transform: translateY(-16px); }
  100% { opacity: 0; transform: translateY(-16px); }
}

@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@media (prefers-reduced-motion: reduce) {
  .rotating-word::before {
    display: none;
  }
  .rotating-word-item {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    background-position: 0% 50%;
  }
  .rotating-word-item:not(:first-child) {
    display: none;
  }
}

/* Hero metrics - quantified performance promise */
.hero-metrics {
  font-size: 0.875rem;
  font-family: 'JetBrains Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', 'Courier New', monospace;
  font-weight: 500;
  color: var(--text-muted);
  margin: var(--space-xs) auto var(--space-md);
  letter-spacing: 0.03em;
  opacity: 0.9;
}

/* Hero tagline - poetic precision motto */
.hero-tagline {
  font-size: 1.125rem;
  margin: var(--space-md) auto var(--space-lg);
  max-width: 50ch;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* Hero experience - authority with restraint */
.hero-experience {
  font-size: 0.9375rem;
  margin: var(--space-sm) auto var(--space-lg);
  color: var(--text-muted);
  font-weight: 400;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn-primary, .btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2.5rem;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0.75rem;
  transition: all var(--duration-fast) var(--ease-out-expo);
  cursor: pointer;
  border: 2px solid transparent;
}

.btn-primary {
  background: var(--btn-primary-bg);
  color: white;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  background: var(--btn-primary-hover);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Submit success state */
.btn-primary.btn-success {
  background: var(--color-success);
  border-color: var(--color-success);
}

.btn-primary.btn-success:hover {
  background: var(--color-success);
  transform: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

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

.btn-ghost:active {
  transform: scale(0.98);
}

/* Magnetic effect (enhanced on desktop) */
@media (hover: hover) {
  .magnetic {
    position: relative;
    transition: transform var(--duration-fast) var(--ease-out-expo);
  }

  .magnetic:hover {
    transform: scale(1.05);
  }
}

/* ============================================
   SECTIONS
   ============================================ */

.services, .process, .proof, .contact {
  padding: var(--space-xl) var(--gutter);
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-eyebrow {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: var(--space-lg);
}

/* ============================================
   SERVICES GRID
   ============================================ */

.services-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* 4 equal columns on desktop */
  gap: var(--space-lg);
}

/* Tablet: 2 columns */
@media (max-width: 1024px) {
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile: 1 column */
@media (max-width: 640px) {
  .services-grid {
    grid-template-columns: 1fr;
  }
}

.service-card {
  padding: var(--space-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  transition: all var(--duration-normal) var(--ease-out-expo);
  min-height: 420px;
  display: flex;
  flex-direction: column;
}

.service-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
  border-color: var(--accent);
}

.service-number {
  font-size: 3rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: var(--space-sm);
  opacity: 0.2;
}

.service-title {
  font-size: 1.5rem;
  margin-bottom: var(--space-sm);
  color: var(--text);
}

.service-description {
  font-size: 1rem;
  margin-bottom: var(--space-md);
}

.service-features {
  list-style: none;
  padding: 0;
  margin-top: auto;
}

.service-features li {
  padding-left: 1.5rem;
  margin-bottom: 0.5rem;
  position: relative;
  font-size: 0.875rem;
  color: var(--muted);
}

.service-features li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* ============================================
   PROCESS TIMELINE
   ============================================ */

.process-subtitle {
  font-size: 1.25rem;
  text-align: center;
  margin: 0 auto var(--space-lg);
  color: var(--text);
}

.process-timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.process-step {
  text-align: center;
  padding: var(--space-md);
}

.process-time {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--accent);
  margin-bottom: var(--space-sm);
  font-weight: 600;
}

.process-title {
  font-size: 1.5rem;
  margin-bottom: var(--space-sm);
}

.process-description {
  font-size: 0.875rem;
}

/* ============================================
   METRICS / PROOF
   ============================================ */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* 4 equal columns on desktop */
  gap: var(--space-xl);
  margin-top: var(--space-xl);
}

/* Tablet: 2 columns */
@media (max-width: 1024px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile: 1 column */
@media (max-width: 640px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
}

.metric-card {
  text-align: center;
  padding: var(--space-xl); /* Increased from lg to xl */
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  transition: all var(--duration-normal) var(--ease-out-expo);
}

.metric-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
  border-color: var(--accent);
}

.metric-value {
  font-size: 4rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: var(--space-md); /* Increased spacing */
  /* Purpose: Premium feel - makes KPIs pop, draws attention to proof */
  background: linear-gradient(135deg, var(--accent), var(--accent-warm));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  word-break: keep-all; /* Prevent number breaking */
}

.metric-label {
  font-size: 1.25rem; /* Slightly larger */
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--text);
  min-height: 2.5rem; /* Ensure consistent height */
  display: flex;
  align-items: center;
  justify-content: center;
}

.metric-description {
  font-size: 0.9375rem; /* Slightly larger for readability */
  line-height: 1.5;
  color: var(--muted);
}

/* ============================================
   CASE STUDIES (Social Proof)
   ============================================ */

.cases-section {
  margin-top: var(--space-2xl);
  padding-top: var(--space-2xl);
  border-top: 1px solid var(--border);
}

.cases-heading {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: var(--space-xl);
  color: var(--text);
}

.cases-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  margin-top: var(--space-xl);
}

/* Tablet: 1 column */
@media (max-width: 1024px) {
  .cases-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
}

.case-card {
  padding: var(--space-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  transition: all var(--duration-normal) var(--ease-out-expo);
  text-align: left;
}

.case-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
  border-color: var(--accent);
}

.case-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
}

.case-metric {
  font-size: 3rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: var(--space-sm);
  /* Purpose: Consistent premium feel across all metrics - maintains visual language */
  background: linear-gradient(135deg, var(--accent), var(--accent-warm));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.case-description {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: var(--space-md);
  line-height: 1.4;
}

.case-tech {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--accent);
  padding: 0.25rem 0.75rem;
  background: rgba(10, 165, 233, 0.1);
  border-radius: 0.375rem;
  display: inline-block;
  font-weight: 500;
}

.proof-portfolio-link {
  margin-top: var(--space-xl);
  text-align: center;
  font-size: 1rem;
}

/* ============================================
   CONTACT FORM
   ============================================ */

.contact-content {
  max-width: 850px;
  margin: 0 auto;
  padding: var(--space-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
}

.contact .section-eyebrow {
  font-size: 2.5rem;
  font-weight: 700;
  opacity: 1;
  color: var(--text);
  margin-bottom: var(--space-sm);
  letter-spacing: -0.02em;
  text-transform: none;
}

.contact-subtitle {
  font-size: 1.25rem;
  text-align: center;
  margin: 0 auto var(--space-sm);
  color: var(--text);
  font-weight: 400;
}

.contact-pricing {
  text-align: center;
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: var(--space-lg);
  font-weight: 400;
}

.contact-form {
  margin-top: var(--space-lg);
}

.form-group {
  margin-bottom: var(--space-md);
}

/* Conversational form labels */
.form-label {
  display: block;
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.625rem;
  color: var(--text);
  letter-spacing: 0;
}

/* Kinetic form inputs - 1px → 2px on focus (120ms ease) */
.form-input, .form-textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--text);
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  transition: border 120ms ease, box-shadow 120ms ease;
  line-height: 1.5;
}

.form-textarea {
  padding: 1rem;
  min-height: 140px;
  resize: vertical;
}

/* Kinetic focus animation: border grows from 1px to 2px */
.form-input:focus, .form-textarea:focus {
  outline: none;
  border: 2px solid var(--accent);
  padding: calc(0.875rem - 1px) calc(1rem - 1px); /* Compensate for border growth */
  box-shadow: 0 0 0 3px rgba(10, 165, 233, 0.1);
}

.form-textarea:focus {
  padding: calc(1rem - 1px);
}

/* Form validation states */
.form-input:invalid:not(:placeholder-shown),
.form-textarea:invalid:not(:placeholder-shown) {
  border-color: var(--color-error);
}

.form-input:valid:not(:placeholder-shown),
.form-textarea:valid:not(:placeholder-shown) {
  border-color: var(--color-success);
}

/* Browser autofill styling - maintain visual continuity */
/* Purpose: Override browser's yellow background (#FAFFBD) with our design system */
.form-input:-webkit-autofill,
.form-input:-webkit-autofill:hover,
.form-input:-webkit-autofill:focus,
.form-input:-webkit-autofill:active {
  /* Box-shadow technique: fills background while preserving our colors */
  -webkit-box-shadow: 0 0 0 1000px var(--background) inset;
  -webkit-text-fill-color: var(--text);
  /* Delay transition prevents flash of yellow on autofill */
  transition: background-color 5000s ease-in-out 0s;
  border: 1px solid var(--border);
}

/* Maintain kinetic focus animation on autofilled fields */
.form-input:-webkit-autofill:focus {
  border: 2px solid var(--accent);
  padding: calc(0.875rem - 1px) calc(1rem - 1px);
  box-shadow: 0 0 0 3px rgba(10, 165, 233, 0.1), 0 0 0 1000px var(--background) inset;
}

/* Honeypot field - completely hidden */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.contact-form button[type="submit"] {
  margin-top: var(--space-lg);
  width: auto;
  min-width: 200px;
}

.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator {
  display: inline;
}

.htmx-request .btn-text {
  display: none;
}

#form-message {
  margin-top: var(--space-md);
  padding: 1rem;
  border-radius: 0.5rem;
  text-align: center;
}

#form-message.success,
.form-success {
  background: rgba(34, 197, 94, 0.1);
  color: rgb(34, 197, 94);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

#form-message.error,
.form-error {
  background: rgba(239, 68, 68, 0.1);
  color: rgb(239, 68, 68);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.form-success,
.form-error {
  padding: 1rem;
  border-radius: 0.5rem;
  text-align: center;
  margin: 0;
  font-weight: 500;
}

/* ============================================
   FOOTER (Premium Multi-Column Layout)
   ============================================ */

.footer {
  padding: var(--space-xl) var(--gutter);
  border-top: 1px solid var(--border);
  margin-top: var(--space-2xl);
  background: var(--surface);
}

.footer-grid {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr; /* Brand takes more space */
  gap: var(--space-xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--border);
}

/* Tablet: 2 columns */
@media (max-width: 1024px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile: 1 column */
@media (max-width: 640px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.footer-logo {
  width: 48px;
  height: 60px;
  margin-bottom: var(--space-sm);
  color: var(--text);
  display: block;
  /* Ensures retina sharpness */
  shape-rendering: geometricPrecision;
  /* Smooth on all displays */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Dark mode: Slightly reduced opacity for better visual hierarchy */
@media (prefers-color-scheme: dark) {
  .footer-logo {
    opacity: 0.95;
  }
}

.footer-tagline {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--muted);
}

.footer-heading {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.footer-nav {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-link {
  font-size: 0.9375rem;
  color: var(--muted);
  text-decoration: none;
  position: relative;
  display: inline-block;
  transition: color var(--duration-fast) var(--ease-out-expo);
}

.footer-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width var(--duration-normal) var(--ease-out-expo);
}

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

.footer-link:hover::after {
  width: 100%;
}

/* Compact footer navigation (Connect column) */
.footer-nav-compact {
  gap: 1rem;
}

.footer-languages {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-lang-label {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
}

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

.footer-link-inline {
  display: inline;
  font-size: 0.875rem;
}

.footer-lang-divider {
  color: var(--border);
  user-select: none;
}

/* Footer Bottom Bar */
.footer-bottom {
  max-width: var(--max-width);
  margin: 0 auto;
  padding-top: var(--space-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.footer-copyright {
  font-size: 0.875rem;
  color: var(--muted);
}

.footer-legal {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.footer-legal-link {
  font-size: 0.875rem;
  color: var(--muted);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out-expo);
}

.footer-legal-link:hover {
  color: var(--accent);
}

.footer-divider {
  color: var(--border);
}

/* ============================================
   ANIMATIONS
   ============================================ */

.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--duration-slow) var(--ease-out-expo),
              transform var(--duration-slow) var(--ease-out-expo);
  transition-delay: var(--delay, 0s);
}

.fade-in.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   LETTER ANIMATIONS (A2 Process + A3 Values)
   ============================================ */

/* Shared character styles - hidden by default */
.ch {
  display: inline-block;
  transform: translateY(8px);
  opacity: 0;
}

/* Screen reader accessible text (hidden visually, read by SR) */
.process-verb-sr,
.value-word-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   A2: Process Verb Animations
   ============================================ */

.process-verb {
  position: relative;
  display: inline-block;
  height: 1.2em; /* Fixed height prevents CLS */
}

/* Animation: Slide-up (Frame) */
[data-animate-process].seen .ch-slide-up {
  animation: chSlideUp 0.18s cubic-bezier(0.2, 0.6, 0.3, 1) forwards;
  animation-delay: calc(var(--i) * 60ms);
}

@keyframes chSlideUp {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Animation: Drop-down (Build) */
[data-animate-process].seen .ch-drop-down {
  animation: chDropDown 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  animation-delay: calc(var(--i) * 60ms);
}

@keyframes chDropDown {
  from {
    transform: translateY(-1em);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Animation: Fade-in (Test) */
[data-animate-process].seen .ch-fade-in-word {
  animation: chFadeIn 0.2s ease-out forwards;
  animation-delay: calc(var(--i) * 50ms);
}

@keyframes chFadeIn {
  from {
    opacity: 0.2;
  }
  to {
    opacity: 1;
  }
}

/* Animation: Slide-left (Ship) */
[data-animate-process].seen .ch-slide-left {
  animation: chSlideLeft 0.18s cubic-bezier(0.2, 0.6, 0.3, 1) forwards;
  animation-delay: calc(var(--i) * 60ms);
}

@keyframes chSlideLeft {
  from {
    transform: translateX(8px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ============================================
   A3: Values Section
   ============================================ */

.values {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-xl) var(--gutter);
  text-align: center;
}

.values-list {
  margin-top: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.value-statement {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s var(--ease-out-expo),
              transform 0.6s var(--ease-out-expo);
  transition-delay: var(--delay, 0s);
}

[data-animate-word].seen {
  opacity: 1;
  transform: translateY(0);
}

.value-word {
  position: relative;
  display: inline-block;
  color: var(--accent);
  height: 1.4em; /* Fixed height prevents CLS */
}

.value-rest {
  color: var(--text);
}

/* Values word animation - subtle build */
[data-animate-word].seen .value-word .ch {
  animation: chValueBuild 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: calc(var(--i) * 40ms);
}

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

/* Subtle link from Values to Experience */
.values-experience-link {
  margin-top: var(--space-lg);
  text-align: center;
  font-size: 0.9375rem;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s var(--ease-out-expo),
              transform 0.6s var(--ease-out-expo);
  transition-delay: var(--delay, 0s);
}

.values-experience-link.in-view {
  opacity: 1;
  transform: translateY(0);
}

.subtle-link {
  color: var(--muted);
  text-decoration: none;
  transition: color var(--duration-fast) ease;
  position: relative;
}

.subtle-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width var(--duration-normal) var(--ease-out-expo);
}

.subtle-link:hover {
  color: var(--accent);
}

.subtle-link:hover::after {
  width: 100%;
}

/* ============================================
   EXPERIENCE PAGE
   ============================================ */

.experience-page {
  min-height: 80vh;
  padding: var(--space-2xl) var(--gutter);
  background: var(--bg);
  position: relative;
}

/* Thread of Time - Desktop left gradient line */
@media (min-width: 768px) {
  .experience-page::before {
    content: "";
    position: fixed;
    left: max(2rem, calc(50vw - 40ch - 4rem));
    top: 0;
    width: 3px;
    height: 100vh;
    background: linear-gradient(to bottom, var(--accent) 0%, transparent 70%);
    opacity: 0.4;
    border-radius: 2px;
    pointer-events: none;
  }
}

/* Subtle pulse animation (respects prefers-reduced-motion) */
@media (min-width: 768px) and (prefers-reduced-motion: no-preference) {
  .experience-page::before {
    animation: threadPulse 8s ease-in-out infinite;
  }
}

@keyframes threadPulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.5; }
}

/* Blueprint SVG background */
.blueprint-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.06;
  color: var(--muted);
}

.experience-container {
  max-width: 75ch; /* Optimal reading length */
  margin: 0 auto;
}

.experience-title {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
  margin-bottom: var(--space-xl);
  text-align: center;
}

.experience-narrative {
  font-size: 1.25rem;
  line-height: 1.8;
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--text);
}

.experience-narrative p {
  margin-bottom: 1.5em;
}

.experience-emphasis {
  font-style: italic;
  color: var(--accent);
  font-weight: 600;
}

.experience-cta {
  margin-top: var(--space-xl);
  text-align: center;
}

.experience-see-also {
  margin-top: var(--space-md);
  font-size: 0.9375rem;
  color: var(--muted);
}

.experience-link-divider {
  margin: 0 var(--space-sm);
  color: var(--border);
}

/* Technology Stack Margin Annotations - Active Theory aesthetic */
.era-section {
  position: relative;
  margin-bottom: 1.5em;
}

/* Desktop only - margin stack annotations */
@media (min-width: 1200px) {
  .era-section::before {
    content: '// ' attr(data-era) '\A' attr(data-stack);
    position: absolute;
    left: -240px;
    top: 0;
    width: 200px;
    font-family: 'JetBrains Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', 'Courier New', monospace;
    font-size: 0.6875rem;
    line-height: 1.6;
    color: var(--text-muted);
    opacity: 0.35;
    white-space: pre-wrap;
    word-wrap: break-word;
    text-align: right;
    letter-spacing: 0.02em;
    pointer-events: none;
    user-select: none;
  }

  /* Subtle connection line to Thread of Time (left border) */
  .era-section::after {
    content: '';
    position: absolute;
    left: -260px;
    top: 4px;
    width: 12px;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--text-muted));
    opacity: 0.15;
    pointer-events: none;
  }

  /* Experience container needs extra left margin for annotations */
  .experience-container {
    margin-left: auto;
    margin-right: auto;
  }
}

.about-experience-link {
  margin-top: var(--space-md);
  font-size: 0.9375rem;
  color: var(--muted);
}

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

@media (max-width: 768px) {
  :root {
    --gutter: 2rem;
    --space-xl: 4rem;
  }

  .lang-switcher {
    top: 1rem;
    right: 1rem;
    padding: 0.5rem 1rem;
  }

  .theme-toggle {
    bottom: 1rem;
    right: 1rem;
    width: 3rem;
    height: 3rem;
  }

  .hero {
    min-height: 70vh;
    padding: var(--space-lg) var(--gutter);
  }

  .hero-tagline {
    font-size: 1rem;
  }

  .hero-cta {
    flex-direction: column;
    width: 100%;
  }

  .btn-primary, .btn-ghost {
    width: 100%;
  }

  /* services-grid responsive rules moved to main declaration */

  .process-timeline {
    grid-template-columns: 1fr;
  }

  /* metrics-grid responsive rules moved to main declaration */

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

  /* Experience page mobile */
  .experience-title {
    font-size: 2rem;
  }

  .experience-narrative {
    font-size: 1.125rem;
  }

  .experience-page {
    padding: var(--space-lg) var(--gutter);
  }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* GPU acceleration for animations */
.hero-orb, .rotating-keyword .keyword, .btn-primary, .service-card {
  will-change: transform;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  .hero-orb {
    animation: none;
  }
  .fade-in {
    opacity: 1;
    transform: none;
  }
  /* Disable all letter animations */
  .ch,
  [data-animate-process] .ch,
  [data-animate-word] .ch {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .value-statement {
    opacity: 1;
    transform: none;
  }
}

/* ============================================
   LEGAL PAGES (Privacy, Terms, 404)
   ============================================ */

.legal-page {
  padding: var(--space-2xl) var(--gutter);
  max-width: 900px;
  margin: 0 auto;
}

.page-content {
  max-width: 800px;
  margin: 0 auto;
}

.page-title {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 700;
  margin-bottom: var(--space-sm);
  color: var(--text);
  letter-spacing: -0.02em;
}

.page-meta {
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: var(--space-xl);
  font-weight: 500;
}

.legal-content {
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--text);
}

.legal-section {
  margin-bottom: var(--space-2xl);
}

.legal-heading {
  font-size: 1.75rem;
  font-weight: 700;
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
  color: var(--text);
  letter-spacing: -0.01em;
}

.legal-text h3 {
  font-size: 1.375rem;
  font-weight: 600;
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
  color: var(--text);
}

.legal-text p {
  margin-bottom: var(--space-md);
}

.legal-text ul,
.legal-text ol {
  margin-left: 1.5rem;
  margin-bottom: var(--space-md);
}

.legal-text li {
  margin-bottom: var(--space-xs);
  padding-left: 0.5rem;
}

.legal-text strong {
  font-weight: 600;
  color: var(--text);
}

.legal-text a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal-text a:hover {
  text-decoration-thickness: 2px;
}

.legal-text code {
  background: var(--surface);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-family: ui-monospace, 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 0.875em;
  color: var(--accent);
  border: 1px solid var(--border);
}

.legal-footer {
  margin-top: var(--space-2xl);
  padding-top: var(--space-xl);
  border-top: 2px solid var(--border);
  font-weight: 600;
  color: var(--text);
}

/* ============================================
   404 ERROR PAGE
   ============================================ */

.error-page {
  padding: var(--space-2xl) var(--gutter);
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.error-code {
  font-size: clamp(6rem, 15vw, 12rem);
  font-weight: 800;
  color: var(--accent);
  opacity: 0.1;
  line-height: 1;
  margin-bottom: -2rem;
  letter-spacing: -0.05em;
  user-select: none;
}

.error-message {
  font-size: 1.25rem;
  color: var(--muted);
  margin-bottom: var(--space-lg);
  line-height: 1.6;
}

.error-detail {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: var(--space-md);
  font-family: ui-monospace, 'SF Mono', Monaco, monospace;
}

.error-detail code {
  background: var(--surface);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  color: var(--accent);
  border: 1px solid var(--border);
}

.error-suggestion {
  font-size: 1rem;
  color: var(--text);
  margin-bottom: var(--space-lg);
  font-weight: 500;
}

.error-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
  margin-top: var(--space-xl);
}

/* ============================================
   ABOUT / PHILOSOPHY PAGE
   ============================================ */

.about-hero {
  text-align: center;
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--border);
}

.about-tagline {
  font-size: 1.5rem;
  color: var(--muted);
  font-weight: 500;
  margin-top: var(--space-md);
  max-width: 100%;
}

.about-section {
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-xl);
}

.about-section:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.about-section-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: var(--space-lg);
  color: var(--text);
  letter-spacing: -0.02em;
}

.about-subtitle {
  font-size: 1.25rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: var(--space-md);
  font-family: var(--font-mono);
}

.about-text {
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--text);
  max-width: 100%;
  margin-bottom: var(--space-md);
}

.about-values-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  margin-top: var(--space-lg);
}

/* Tablet: 1 column */
@media (max-width: 1024px) {
  .about-values-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
}

.about-value-card {
  padding: var(--space-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  transition: all var(--duration-normal) var(--ease-out-expo);
}

.about-value-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
  border-color: var(--accent);
}

.about-value-label {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: var(--space-sm);
  letter-spacing: -0.01em;
}

.about-value-text {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--muted);
  max-width: 100%;
}

.about-team {
  text-align: center;
  border-bottom: none;
  padding-bottom: 0;
}

.about-team .about-text {
  margin: 0 auto;
  max-width: 60ch;
}

/* ============================================
   DESKTOP SPACING OPTIMIZATION
   Reduce vertical spacing on larger screens for better content density
   ============================================ */

@media (min-width: 1024px) {
  /* Tighten section spacing on desktop */
  .services,
  .process,
  .proof,
  .contact-section {
    padding: var(--space-lg) var(--gutter); /* Was xl: 128px → 64px */
  }

  /* Reduce vertical gaps between sections */
  .cases-section,
  .proof,
  .footer {
    margin-top: var(--space-xl); /* Was 2xl: 256px → 128px */
    padding-top: var(--space-lg); /* Was 2xl/xl: → 64px */
  }

  /* Tighten footer spacing */
  .footer {
    padding: var(--space-lg) var(--gutter); /* Was 2xl: 256px → 64px */
  }

  /* Reduce gaps within sections */
  .cases-heading,
  .service-number {
    margin-bottom: var(--space-lg); /* Was xl: 128px → 64px */
  }

  /* Contact form tighter on desktop */
  .contact-intro {
    margin-bottom: var(--space-lg); /* Was 2xl: 256px → 64px */
  }
}

/* Print styles */
@media print {
  .lang-switcher, .theme-toggle, .hero-orb {
    display: none;
  }

  .legal-page, .error-page {
    padding: 0;
  }

  .legal-text {
    font-size: 12pt;
    line-height: 1.5;
  }

  .page-title {
    font-size: 24pt;
  }

  .legal-heading {
    font-size: 18pt;
    page-break-after: avoid;
  }

  .legal-section {
    page-break-inside: avoid;
  }
}

/* ============================================
   ARTICLES
   ============================================ */

.articles-header {
  max-width: 80ch;
  margin: 0 auto var(--space-2xl);
  text-align: center;
}

.articles-tagline {
  font-size: 1.25rem;
  color: var(--muted);
  margin-top: var(--space-md);
}

.articles-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  max-width: var(--max-width);
  margin: 0 auto;
}

@media (min-width: 768px) {
  .articles-grid {
    grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
  }
}

.article-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--duration-normal) var(--ease-out-expo);
  display: flex;
  flex-direction: column;
}

.article-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -8px rgba(13, 15, 20, 0.1);
  border-color: var(--accent);
}

/* Hero image styles */
.article-hero-link {
  display: block;
  margin: 0;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.article-hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-out-expo);
}

.article-card:hover .article-hero-image {
  transform: scale(1.05);
}

/* Add padding to card content (but not hero image) */
.article-card .article-meta,
.article-card .article-card-title,
.article-card .article-card-excerpt,
.article-card .article-tags,
.article-card .article-read-more {
  padding: 0 var(--space-lg);
}

.article-card .article-meta {
  padding-top: var(--space-lg);
}

.article-card .article-read-more {
  padding-bottom: var(--space-lg);
}

.article-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: var(--space-md);
}

.article-date {
  font-variant-numeric: tabular-nums;
}

.article-reading-time::before {
  content: "•";
  margin-right: var(--space-sm);
}

.article-card-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 var(--space-md);
}

.article-card-link {
  color: inherit;
  text-decoration: none;
  background: linear-gradient(to right, var(--accent), var(--accent)) no-repeat bottom;
  background-size: 0% 2px;
  transition: background-size var(--duration-normal) var(--ease-out-expo);
}

.article-card-link:hover {
  background-size: 100% 2px;
}

.article-card-excerpt {
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: var(--space-md);
  flex-grow: 1;
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
}

.article-tag {
  background: var(--bg);
  color: var(--muted);
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.article-read-more {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  transition: transform var(--duration-fast) var(--ease-out-expo);
}

.article-read-more:hover {
  transform: translateX(4px);
}

/* Article Detail */

.article-detail {
  max-width: 75ch;
  margin: 0 auto;
}

.article-breadcrumb {
  margin-bottom: var(--space-lg);
}

.article-header {
  margin-bottom: var(--space-2xl);
}

.article-hero-image-detail {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.article-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin: var(--space-md) 0 var(--space-lg);
}

.article-excerpt-detail {
  font-size: 1.25rem;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: var(--space-lg);
}

/* Markdown Content */

.markdown-content {
  font-size: 1.125rem;
  line-height: 1.75;
  color: var(--text);
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.3;
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
}

.markdown-content h1:first-child,
.markdown-content h2:first-child,
.markdown-content h3:first-child {
  margin-top: 0;
}

.markdown-content h2 {
  font-size: 2rem;
}

.markdown-content h3 {
  font-size: 1.5rem;
}

.markdown-content p {
  margin-bottom: var(--space-md);
}

.markdown-content ul,
.markdown-content ol {
  margin-left: var(--space-lg);
  margin-bottom: var(--space-md);
}

.markdown-content li {
  margin-bottom: var(--space-sm);
}

.markdown-content code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.markdown-content pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  overflow-x: auto;
  margin-bottom: var(--space-md);
}

.markdown-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.875rem;
}

.markdown-content a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  transition: color var(--duration-fast);
}

.markdown-content a:hover {
  color: var(--accent-warm);
}

.markdown-content strong {
  font-weight: 600;
  color: var(--text);
}

.markdown-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-md);
}

.markdown-content th,
.markdown-content td {
  padding: var(--space-sm);
  border: 1px solid var(--border);
  text-align: left;
}

.markdown-content th {
  background: var(--bg);
  font-weight: 600;
}

.article-footer {
  border-top: 1px solid var(--border);
  padding-top: var(--space-lg);
  margin-top: var(--space-2xl);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.article-author {
  color: var(--muted);
}

@media (max-width: 768px) {
  .article-title {
    font-size: 2rem;
  }

  .markdown-content {
    font-size: 1rem;
  }

  .markdown-content h2 {
    font-size: 1.5rem;
  }

  .markdown-content h3 {
    font-size: 1.25rem;
  }
}

/* ============================================
   INSIGHTS STRIP (Option A: Featured Articles Carousel)
   Locomotive-inspired: Smooth animations, magnetic hover, scroll snap
   ============================================ */

.insights-strip {
  padding: var(--space-md) var(--gutter);
  background: linear-gradient(180deg, var(--bg) 0%, var(--surface) 100%);
  border-top: 1px solid var(--border);
  position: relative;
}

.insights-strip-header {
  max-width: var(--max-width);
  margin: 0 auto var(--space-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.insights-strip-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.insights-strip-view-all {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  transition: transform var(--duration-fast) var(--ease-out-expo);
}

.insights-strip-view-all:hover {
  transform: translateX(4px);
}

.insights-strip-container {
  max-width: var(--max-width);
  margin: 0 auto;
  overflow: visible;
}

.insights-strip-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  max-width: var(--max-width);
}

/* Insight Card - Compact portrait layout */
.insight-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: hidden;
  text-decoration: none !important;
  color: var(--text);
  transition: transform var(--duration-normal) var(--ease-out-expo),
              box-shadow var(--duration-normal) var(--ease-out-expo);
  position: relative;
  height: 380px;
  max-width: 100%;
  will-change: transform;
}

.insight-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
}

/* Image wrapper - compact height */
.insight-card-image-wrapper {
  position: relative;
  width: 100%;
  height: 140px;
  overflow: hidden;
  background: var(--border);
}

.insight-card-picture {
  display: block;
  width: 100%;
  height: 100%;
}

.insight-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-out-expo);
}

.insight-card:hover .insight-card-image {
  transform: scale(1.05);
}

/* Gradient overlay - Locomotive style */
.insight-card-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    rgba(37, 99, 235, 0) 0%,
    rgba(37, 99, 235, 0.1) 100%
  );
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-out-expo);
  pointer-events: none;
}

.insight-card:hover .insight-card-overlay {
  opacity: 1;
}

/* Card content */
.insight-card-content {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-grow: 1;
}

.insight-card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.3;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-xs);
  text-decoration: none !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.insight-card-excerpt {
  font-family: var(--font-body);
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--muted);
  margin-bottom: var(--space-xs);
  text-decoration: none !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.insight-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.875rem;
  color: var(--muted);
  margin-top: auto;
}

.insight-card-reading-time {
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

.insight-card-category {
  padding: 0.25rem 0.75rem;
  background: var(--border);
  border-radius: var(--radius-sm);
  font-weight: 500;
  text-transform: capitalize;
}

/* Accessibility: Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .insight-card,
  .insight-card-image,
  .insight-card-overlay,
  .insights-strip-view-all {
    transition: none;
  }

  .insight-card:hover {
    transform: none;
  }

  .insight-card:hover .insight-card-image {
    transform: none;
  }
}

/* Responsive: Tablet (600-1024px) */
@media (max-width: 1024px) {
  .insights-strip {
    padding: var(--space-sm) var(--space-md);
  }

  .insights-strip-title {
    font-size: 1.5rem;
  }

  .insights-strip-header {
    margin-bottom: var(--space-sm);
  }

  .insights-strip-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
  }

  .insight-card {
    height: 360px;
  }

  .insight-card-image-wrapper {
    height: 120px;
  }

  .insight-card-title {
    font-size: 0.9375rem;
  }

  .insight-card-excerpt {
    font-size: 0.8125rem;
    -webkit-line-clamp: 2;
  }
}

/* Responsive: Mobile (<600px) */
@media (max-width: 600px) {
  .insights-strip {
    padding: var(--space-sm) var(--space-sm);
  }

  .insights-strip-header {
    margin-bottom: var(--space-xs);
  }

  .insights-strip-title {
    font-size: 1.25rem;
  }

  .insights-strip-view-all {
    font-size: 0.875rem;
  }

  .insights-strip-grid {
    display: flex;
    overflow-x: auto;
    gap: var(--space-xs);
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--space-xs);
    scrollbar-width: none;
  }

  .insights-strip-grid::-webkit-scrollbar {
    display: none;
  }

  .insight-card {
    flex: 0 0 auto;
    width: 260px;
    height: 340px;
    scroll-snap-align: start;
  }

  .insight-card-image-wrapper {
    height: 110px;
  }

  .insight-card-title {
    font-size: 0.9375rem;
  }

  .insight-card-excerpt {
    font-size: 0.8125rem;
    -webkit-line-clamp: 2;
  }

  .insight-card-content {
    padding: var(--space-sm);
  }
}

/* ============================================
   PORTFOLIO PAGE
   Award-winning UX: Gallery-style "Curated Mastery"
   ============================================ */

.portfolio-page {
  padding: var(--space-2xl) var(--gutter);
  max-width: var(--max-width);
  margin: 0 auto;
}

.portfolio-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.portfolio-subtitle {
  font-size: 1.5rem;
  color: var(--muted);
  font-weight: 500;
  margin-top: var(--space-md);
  letter-spacing: -0.01em;
}

.portfolio-intro {
  max-width: 720px;
  margin: var(--space-lg) auto 0;
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--text);
  opacity: 0.85;
  text-align: center;
}

/* Portfolio Grid - Asymmetric 2-column layout */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-xl);
}

/* Tablet: 2 columns equal */
@media (max-width: 1024px) {
  .portfolio-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
  }
}

/* Mobile: Single column */
@media (max-width: 640px) {
  .portfolio-page {
    padding: var(--space-lg) var(--gutter);
  }

  .portfolio-header {
    margin-bottom: var(--space-lg);
  }

  .portfolio-subtitle {
    font-size: 1.25rem;
  }

  .portfolio-intro {
    font-size: 0.9375rem;
    line-height: 1.6;
    text-align: left;
  }

  .portfolio-grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
}

/* Portfolio Card */
.portfolio-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--duration-normal) var(--ease-out-expo);
  display: flex;
  flex-direction: column;
}

.portfolio-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
  border-color: var(--accent);
}

/* Card Image */
.portfolio-card-image {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--border);
}

.portfolio-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-out-expo);
}

.portfolio-card:hover .portfolio-card-img {
  transform: scale(1.05);
}

.portfolio-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(37, 99, 235, 0) 0%,
    rgba(37, 99, 235, 0.15) 100%
  );
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-out-expo);
  pointer-events: none;
}

.portfolio-card:hover .portfolio-card-overlay {
  opacity: 1;
}

/* Card Content */
.portfolio-card-content {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.portfolio-card-category {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: var(--space-sm);
}

.portfolio-card-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-xs);
  letter-spacing: -0.02em;
}

.portfolio-card-tagline {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: var(--space-md);
  font-weight: 500;
}

.portfolio-card-description {
  flex-grow: 1;
  margin-bottom: var(--space-md);
}

.portfolio-card-description p {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--muted);
}

.portfolio-card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9375rem;
  transition: gap var(--duration-fast) var(--ease-out-expo);
  margin-top: auto;
}

.portfolio-card-link:hover {
  gap: 0.75rem;
}

.portfolio-card-link svg {
  transition: transform var(--duration-fast) var(--ease-out-expo);
}

.portfolio-card:hover .portfolio-card-link svg {
  transform: translate(2px, -2px);
}

/* Accessibility: Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .portfolio-card,
  .portfolio-card-img,
  .portfolio-card-overlay,
  .portfolio-card-link,
  .portfolio-card-link svg {
    transition: none;
  }

  .portfolio-card:hover {
    transform: none;
  }

  .portfolio-card:hover .portfolio-card-img {
    transform: none;
  }
}
