/* ============================================
   KoralMind — Design System & Styles
   Deep Reef palette. Plus Jakarta Sans + Inter.
   Built by Flux.
   ============================================ */

/* --- Design Tokens --- */
:root {
  /* Primary — The Depths */
  --color-abyssal: #0A1628;
  --color-reef-teal: #1B4965;
  --color-shallow: #2D6A8F;

  /* Secondary — The Life (Coral) */
  --color-coral: #FF6B6B;
  --color-coral-bloom: #FF9E9E;
  --color-reef-red: #E04848;

  /* Accent — The Glow (Bioluminescent) */
  --color-cyan: #00E5FF;
  --color-deep-glow: #00B4D8;
  --color-seafoam: #72EFDD;

  /* Neutrals — The Sand */
  --color-pearl: #FAFBFC;
  --color-warm-sand: #F0E6D3;
  --color-driftwood: #8B9DAF;
  --color-deep-stone: #2C3E50;
  --color-ocean-floor: #0D1117;

  /* Typography */
  --font-display: 'Plus Jakarta Sans', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Type Scale */
  --text-hero: clamp(2.5rem, 6vw, 4.5rem);
  --text-display: clamp(2rem, 4vw, 3rem);
  --text-heading: clamp(1.5rem, 3vw, 2.25rem);
  --text-subheading: 1.25rem;
  --text-body: 1.0625rem;
  --text-small: 0.9375rem;
  --text-caption: 0.8125rem;
  --text-label: 0.75rem;

  /* Spacing */
  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 40px;
  --space-xl: 64px;
  --space-2xl: 96px;
  --space-3xl: 128px;

  /* Tracking */
  --tracking-tight: -0.02em;
  --tracking-normal: 0;
  --tracking-wide: 0.05em;
  --tracking-wider: 0.1em;

  /* Transitions */
  --ease-enter: cubic-bezier(0.0, 0.0, 0.2, 1);
  --ease-exit: cubic-bezier(0.4, 0.0, 1, 1);
  --ease-morph: cubic-bezier(0.4, 0.0, 0.2, 1);

  /* Layout */
  --max-width: 1200px;
  --max-prose: 720px;
  --nav-height: 72px;
  --card-radius: 12px;
  --btn-radius: 8px;
}

/* --- Reset & Base --- */
*, *::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);
  font-size: var(--text-body);
  line-height: 1.7;
  color: var(--color-pearl);
  background: var(--color-abyssal);
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-coral); text-decoration: none; transition: color 0.2s var(--ease-morph); }
a:hover { color: var(--color-coral-bloom); }

/* Focus styles — WCAG */
:focus-visible {
  outline: 2px solid var(--color-cyan);
  outline-offset: 3px;
}

/* Skip to content — WCAG */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 9999;
  padding: 8px 16px;
  background: var(--color-coral);
  color: var(--color-abyssal);
  font-weight: 600;
  border-radius: var(--btn-radius);
  transition: top 0.2s;
}
.skip-link:focus { top: 8px; }

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: var(--tracking-tight);
  color: var(--color-pearl);
}

h1 { font-size: var(--text-hero); }
h2 { font-size: var(--text-display); }
h3 { font-size: var(--text-heading); }
h4 { font-size: var(--text-subheading); font-weight: 600; }

p { margin-bottom: 1em; }
p:last-child { margin-bottom: 0; }

.text-coral { color: var(--color-coral); }
.text-cyan { color: var(--color-cyan); }
.text-driftwood { color: var(--color-driftwood); }
.text-center { text-align: center; }

.label {
  font-family: var(--font-display);
  font-size: var(--text-label);
  font-weight: 600;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-coral);
}

/* --- Layout --- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.max-prose {
  max-width: var(--max-prose);
  margin: 0 auto;
}

.section {
  padding: var(--space-2xl) 0;
  position: relative;
}

.section-abyssal { background: var(--color-abyssal); }
.section-reef { background: var(--color-reef-teal); }
.section-teal {
  background: linear-gradient(180deg,
    rgba(27, 73, 101, 0.15) 0%,
    rgba(10, 22, 40, 1) 100%
  );
}

/* --- Navigation --- */
.nav-bg {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: rgba(10, 22, 40, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 999;
  border-bottom: 1px solid rgba(45, 106, 143, 0.15);
}

nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-md);
  max-width: var(--max-width);
  margin: 0 auto;
  z-index: 1000;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

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

.nav-wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--color-pearl);
  letter-spacing: var(--tracking-tight);
}

.nav-wordmark .k { color: var(--color-coral); }

.nav-links {
  display: flex;
  gap: var(--space-md);
}

.nav-links a {
  font-family: var(--font-body);
  font-size: var(--text-small);
  font-weight: 500;
  color: var(--color-driftwood);
  text-decoration: none;
  transition: color 0.2s;
  position: relative;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--color-pearl);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0; right: 0;
  height: 2px;
  background: var(--color-coral);
  border-radius: 1px;
}

.nav-cta {
  font-family: var(--font-display);
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--color-abyssal) !important;
  background: var(--color-coral);
  padding: 10px 24px;
  border-radius: var(--btn-radius);
  transition: background 0.2s var(--ease-morph);
}

.nav-cta:hover {
  background: var(--color-coral-bloom);
  color: var(--color-abyssal) !important;
}

.nav-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 24px;
  position: relative;
}

.nav-hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--color-pearl);
  position: absolute;
  left: 0;
  transition: all 0.3s;
}

.nav-hamburger span:nth-child(1) { top: 0; }
.nav-hamburger span:nth-child(2) { top: 50%; transform: translateY(-50%); }
.nav-hamburger span:nth-child(3) { bottom: 0; }

/* Mobile Menu */
.mobile-menu {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 40, 0.97);
  backdrop-filter: blur(20px);
  z-index: 1001;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
}

.mobile-menu.open { display: flex; }

.mobile-menu a {
  font-family: var(--font-display);
  font-size: var(--text-heading);
  font-weight: 600;
  color: var(--color-pearl);
  text-decoration: none;
}

.mobile-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: none;
  border: none;
  color: var(--color-pearl);
  font-size: 2rem;
  cursor: pointer;
}

/* --- Hero --- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  z-index: 0;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.hero-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 800px;
  padding: 0 var(--space-md);
  padding-top: var(--nav-height);
}

.hero h1 {
  margin-bottom: var(--space-sm);
}

.hero-sub {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--color-driftwood);
  line-height: 1.8;
  max-width: 600px;
  margin: 0 auto var(--space-lg);
}

/* Hero Metrics */
.hero-metrics {
  display: flex;
  justify-content: center;
  gap: var(--space-xl);
  margin-bottom: var(--space-lg);
}

.hero-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-metric-number {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  font-weight: 800;
  color: var(--color-coral);
  letter-spacing: var(--tracking-tight);
}

.hero-metric-label {
  font-size: var(--text-caption);
  color: var(--color-driftwood);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  margin-top: 4px;
}

/* --- Buttons --- */
.btn-primary {
  display: inline-block;
  font-family: var(--font-display);
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--color-abyssal);
  background: var(--color-coral);
  padding: 14px 32px;
  border-radius: var(--btn-radius);
  border: none;
  cursor: pointer;
  transition: all 0.2s var(--ease-morph);
}

.btn-primary:hover {
  background: var(--color-coral-bloom);
  color: var(--color-abyssal);
  transform: translateY(-1px);
}

.btn-ghost {
  display: inline-block;
  font-family: var(--font-display);
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--color-coral);
  background: transparent;
  padding: 14px 32px;
  border-radius: var(--btn-radius);
  border: 1.5px solid var(--color-coral);
  cursor: pointer;
  transition: all 0.2s var(--ease-morph);
}

.btn-ghost:hover {
  background: rgba(255, 107, 107, 0.1);
  color: var(--color-coral-bloom);
  border-color: var(--color-coral-bloom);
}

.cta-row {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  flex-wrap: wrap;
}

/* --- Cards --- */
.card {
  background: rgba(27, 73, 101, 0.15);
  border: 1px solid rgba(45, 106, 143, 0.2);
  border-radius: var(--card-radius);
  padding: var(--space-lg);
  transition: all 0.3s var(--ease-morph);
}

.card:hover {
  border-color: rgba(255, 107, 107, 0.2);
  box-shadow: 0 0 24px rgba(255, 107, 107, 0.05);
}

.card-title {
  font-family: var(--font-display);
  font-size: var(--text-subheading);
  font-weight: 700;
  margin-bottom: var(--space-xs);
  color: var(--color-pearl);
}

.card-body {
  font-size: var(--text-small);
  color: var(--color-driftwood);
  line-height: 1.7;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-md);
}

/* --- Pull Quotes --- */
.pull-quote {
  padding: var(--space-lg) 0;
  text-align: center;
}

.pull-quote blockquote {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 500;
  font-style: italic;
  color: var(--color-pearl);
  line-height: 1.5;
  max-width: 700px;
  margin: 0 auto;
}

.pull-quote cite {
  display: block;
  margin-top: var(--space-sm);
  font-family: var(--font-body);
  font-size: var(--text-small);
  font-style: normal;
  color: var(--color-coral);
}

/* --- Reef Divider --- */
.reef-line {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md) 0;
}

.reef-line::before,
.reef-line::after {
  content: '';
  flex: 1;
  max-width: 120px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(45, 106, 143, 0.3), transparent);
}

.reef-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-coral);
  margin: 0 var(--space-sm);
  box-shadow: 0 0 8px rgba(255, 107, 107, 0.4);
}

/* --- Case Study Featured --- */
.case-study-featured {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  align-items: center;
  margin: var(--space-xl) 0;
}

.case-study-image {
  aspect-ratio: 16/10;
  border-radius: var(--card-radius);
  border: 1px solid rgba(45, 106, 143, 0.2);
  overflow: hidden;
  background: rgba(27, 73, 101, 0.2);
  min-height: 250px;
}

.case-study-text h3 {
  color: var(--color-coral);
  margin-bottom: 4px;
}

.case-study-subtitle {
  font-size: var(--text-small);
  color: var(--color-driftwood);
  margin-bottom: var(--space-sm);
}

.case-study-oneliner {
  font-size: var(--text-body);
  line-height: 1.7;
  margin-bottom: var(--space-sm);
}

.case-study-stats {
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  color: var(--color-cyan);
  margin-bottom: var(--space-md);
}

/* --- Portfolio Cards --- */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.portfolio-card {
  background: rgba(27, 73, 101, 0.1);
  border: 1px solid rgba(45, 106, 143, 0.15);
  border-radius: var(--card-radius);
  padding: var(--space-md);
}

.portfolio-card h4 {
  color: var(--color-pearl);
  margin-bottom: 8px;
}

.portfolio-card p {
  font-size: var(--text-small);
  color: var(--color-driftwood);
}

/* --- Team Preview --- */
.team-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xl);
}

.team-leads {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
  width: 100%;
  max-width: 800px;
}

.team-lead-card {
  text-align: center;
  padding: var(--space-lg);
}

.team-lead-card .avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  margin: 0 auto var(--space-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.75rem;
  color: var(--color-pearl);
}

.team-lead-card .name {
  font-family: var(--font-display);
  font-size: var(--text-subheading);
  font-weight: 700;
  color: var(--color-pearl);
  margin-bottom: 4px;
}

.team-lead-card .role {
  font-size: var(--text-small);
  color: var(--color-coral);
  margin-bottom: var(--space-xs);
}

.team-lead-card .desc {
  font-size: var(--text-small);
  color: var(--color-driftwood);
  line-height: 1.6;
}

.team-members {
  display: flex;
  gap: var(--space-lg);
  justify-content: center;
}

.team-member {
  text-align: center;
}

.team-member .avatar-sm {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin: 0 auto var(--space-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--color-pearl);
}

.team-member .name {
  font-family: var(--font-display);
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--color-pearl);
}

.team-member .role {
  font-size: var(--text-caption);
  color: var(--color-driftwood);
}

/* --- How It Works --- */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  margin: var(--space-xl) 0;
}

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

.step-number {
  font-family: var(--font-display);
  font-size: var(--text-display);
  font-weight: 800;
  color: var(--color-coral);
  opacity: 0.3;
  margin-bottom: var(--space-xs);
}

.step h4 {
  margin-bottom: var(--space-xs);
}

.step p {
  font-size: var(--text-small);
  color: var(--color-driftwood);
}

/* --- Footer --- */
.footer {
  padding: var(--space-xl) 0 var(--space-lg);
  border-top: 1px solid rgba(45, 106, 143, 0.15);
  text-align: center;
}

.footer-logo {
  height: 28px;
  margin: 0 auto var(--space-md);
}

.footer-tagline {
  font-family: var(--font-display);
  font-size: var(--text-small);
  font-style: italic;
  color: var(--color-driftwood);
  margin-bottom: var(--space-md);
}

.footer-links {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  margin-bottom: var(--space-md);
}

.footer-links a {
  font-size: var(--text-small);
  color: var(--color-driftwood);
}

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

.footer-credit {
  font-size: var(--text-caption);
  color: rgba(139, 157, 175, 0.5);
}

/* --- Page Header --- */
.page-header {
  padding: calc(var(--nav-height) + var(--space-2xl)) 0 var(--space-xl);
  text-align: center;
  position: relative;
  background: radial-gradient(ellipse at 50% 80%, rgba(27, 73, 101, 0.2), transparent 60%);
}

.page-header h1 {
  color: var(--color-coral);
  margin-bottom: var(--space-sm);
}

.page-header .subtitle {
  font-size: var(--text-body);
  color: var(--color-driftwood);
  max-width: 600px;
  margin: 0 auto;
}

/* --- Service Cards --- */
.services-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.service-card {
  display: flex;
  gap: var(--space-lg);
  padding: var(--space-lg);
  background: rgba(27, 73, 101, 0.1);
  border: 1px solid rgba(45, 106, 143, 0.15);
  border-radius: var(--card-radius);
  transition: all 0.3s var(--ease-morph);
}

.service-card:hover {
  border-color: rgba(255, 107, 107, 0.2);
  box-shadow: 0 0 30px rgba(255, 107, 107, 0.04);
}

.service-icon {
  flex-shrink: 0;
  padding-top: 4px;
}

.service-content h3 {
  font-size: var(--text-heading);
  margin-bottom: var(--space-xs);
}

.service-content > p {
  color: var(--color-driftwood);
  margin-bottom: var(--space-md);
}

.service-details {
  margin-bottom: var(--space-md);
}

.service-details p {
  font-size: var(--text-small);
  color: var(--color-driftwood);
  margin-bottom: 8px;
  line-height: 1.6;
}

.service-details strong {
  color: var(--color-pearl);
}

.service-price {
  font-family: var(--font-display);
  font-size: var(--text-subheading);
  font-weight: 700;
  color: var(--color-coral);
}

.coral-divider-inline {
  display: flex;
  justify-content: center;
  overflow: hidden;
  line-height: 0;
}

.coral-divider-inline img {
  width: 60%;
  max-height: 60px;
  object-fit: cover;
}

/* --- Comparison Table --- */
.comparison-table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.comparison-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-small);
}

.comparison-table th,
.comparison-table td {
  padding: 16px 20px;
  text-align: left;
  border-bottom: 1px solid rgba(45, 106, 143, 0.15);
}

.comparison-table th {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-small);
  color: var(--color-driftwood);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.comparison-table th.text-coral {
  color: var(--color-coral);
}

.comparison-table td {
  color: var(--color-driftwood);
}

.comparison-table td.text-coral {
  color: var(--color-coral);
  font-weight: 500;
}

.comparison-table td:first-child {
  color: var(--color-pearl);
}

.comparison-table tbody tr:hover {
  background: rgba(27, 73, 101, 0.1);
}

@media (max-width: 768px) {
  .service-card {
    flex-direction: column;
    gap: var(--space-sm);
  }
}

/* --- Coral Divider --- */
.coral-divider {
  width: 100%;
  overflow: hidden;
  line-height: 0;
  margin: -1px 0;
  position: relative;
  z-index: 1;
}

.coral-divider img {
  width: 100%;
  height: auto;
  max-height: 100px;
  object-fit: cover;
  opacity: 0.6;
}

/* --- Avatar Image Wraps --- */
.avatar-img-wrap {
  position: relative;
  transition: box-shadow 0.4s var(--ease-morph);
}

.avatar-img-wrap:hover {
  box-shadow: 0 0 30px var(--glow-color, rgba(255,107,107,0.3)) !important;
}

/* --- Scroll Animations --- */
.section-enter {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease-enter), transform 0.6s var(--ease-enter);
}

.section-enter.visible {
  opacity: 1;
  transform: translateY(0);
}

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

/* --- Scroll Indicator --- */
.scroll-indicator {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  animation: float 2s ease-in-out infinite;
}

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

/* --- Contact Form --- */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-family: var(--font-display);
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--color-pearl);
}

.form-group input,
.form-group textarea {
  font-family: var(--font-body);
  font-size: var(--text-body);
  color: var(--color-pearl);
  background: rgba(27, 73, 101, 0.2);
  border: 1px solid rgba(45, 106, 143, 0.25);
  border-radius: var(--btn-radius);
  padding: 14px 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--color-coral);
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--color-driftwood);
  opacity: 0.6;
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-cta:not(.mobile-menu .nav-cta) { display: none; }
  .nav-hamburger { display: block; }

  .hero-metrics {
    gap: var(--space-md);
  }

  .case-study-featured {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

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

  .team-leads {
    grid-template-columns: 1fr;
  }

  .team-members {
    flex-wrap: wrap;
  }

  .section {
    padding: var(--space-xl) 0;
  }
}

@media (max-width: 480px) {
  .hero-metrics {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .cta-row {
    flex-direction: column;
    align-items: center;
  }

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