/* ============================================
   A&P Studio — Design System
   ============================================ */

/* --- Custom Properties --- */
:root {
  /* Colors */
  --bg-primary: #090c13;
  --bg-secondary: #0e1219;
  --bg-surface: #131720;
  --bg-surface-hover: #181d28;
  --border-subtle: rgba(255, 255, 255, 0.05);
  --border-medium: rgba(255, 255, 255, 0.08);

  --text-primary: #e4e6ea;
  --text-secondary: #7d8491;
  --text-tertiary: #4e5562;

  --accent: #4a7cff;
  --accent-dim: rgba(74, 124, 255, 0.12);
  --accent-hover: #6090ff;

  /* Typography */
  --font-sans: 'IBM Plex Sans', 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'JetBrains Mono', 'SF Mono', monospace;

  /* Spacing scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;
  --space-3xl: 6rem;
  --space-4xl: 10rem;

  /* Layout */
  --max-width: 1200px;
  --section-padding: clamp(5rem, 10vh, 8rem);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.45, 0, 0.55, 1);
  --duration-fast: 200ms;
  --duration-base: 400ms;
  --duration-slow: 800ms;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  overflow-x: hidden;
}

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

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

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

ul, ol {
  list-style: none;
}

/* --- Typography --- */
h1, h2, h3, h4, h5 {
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

h1 {
  font-size: clamp(2.1rem, 4.5vw, 3.2rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.15;
}

h2 {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

h3 {
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  font-weight: 600;
}

p {
  color: var(--text-secondary);
  max-width: 56ch;
  font-weight: 400;
}

.label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

/* --- Layout --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 clamp(1.5rem, 5vw, 3rem);
}

section {
  padding: var(--section-padding) 0;
  position: relative;
}

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1.25rem 0;
  transition: background var(--duration-base) var(--ease-out),
              border-color var(--duration-base) var(--ease-out);
}

.nav.scrolled {
  background: rgba(9, 12, 19, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

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

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

.nav-logo svg {
  height: 28px;
  width: auto;
  color: #5a8abf;
}

.nav-logo img {
  height: 28px;
  width: auto;
  opacity: 0.9;
}

.nav-logo span {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-primary);
}

/* Mobile menu — hidden by default */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(9, 12, 19, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-base) var(--ease-out),
              visibility var(--duration-base);
}

.mobile-menu.open {
  opacity: 1;
  visibility: visible;
}

.mobile-menu a {
  font-size: 1.2rem;
  color: var(--text-secondary);
  transition: color var(--duration-fast);
}

.mobile-menu a:hover {
  color: var(--text-primary);
}

.mobile-menu-close {
  position: absolute;
  top: 1.25rem;
  right: clamp(1.5rem, 5vw, 3rem);
  font-size: 1.5rem;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2.5rem;
}

.nav-links a {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-tertiary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color var(--duration-fast);
  position: relative;
}

.nav-links a:hover {
  color: var(--text-primary);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width var(--duration-base) var(--ease-out);
}

.nav-links a:hover::after {
  width: 100%;
}

/* Mobile menu toggle */
.nav-toggle {
  display: none;
  width: 24px;
  height: 24px;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 100%;
  height: 1.5px;
  background: var(--text-secondary);
  transition: transform var(--duration-base) var(--ease-out),
              opacity var(--duration-fast);
}

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

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

.hero-canvas canvas {
  width: 100%;
  height: 100%;
}

/* Gradient overlay — minimal, only bottom fade + gentle logo-area clarity */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 32% 28% at 50% 44%, rgba(9,12,19,0.35) 0%, transparent 100%),
    linear-gradient(180deg, transparent 0%, transparent 75%, var(--bg-primary) 100%);
  z-index: 1;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 680px;
}

/* --- Hero Logo — Central Object --- */
.hero-logo {
  position: relative;
  width: clamp(150px, 22vw, 240px);
  height: auto;
  margin-bottom: var(--space-2xl);

  /* Pre-reveal state */
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 1.2s var(--ease-out),
              transform 1.2s var(--ease-out);
}

.hero-logo.revealed {
  opacity: 1;
  transform: scale(1);
}

.hero-logo svg {
  width: 100%;
  height: auto;
  position: relative;
  z-index: 2;
}

/* Subtle structural glow behind logo — engineered, not neon */
.hero-logo::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 220%;
  height: 220%;
  background: radial-gradient(
    ellipse at center,
    rgba(74, 124, 255, 0.06) 0%,
    rgba(74, 124, 255, 0.02) 40%,
    transparent 70%
  );
  z-index: 0;
  pointer-events: none;
}

/* Thin framing lines around logo — connecting to background structure */
.hero-logo::after {
  content: '';
  position: absolute;
  top: -12%;
  left: -12%;
  right: -12%;
  bottom: -12%;
  border: 0.5px solid rgba(74, 124, 255, 0.08);
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.5s var(--ease-out) 0.8s;
}

.hero-logo.revealed::after {
  opacity: 1;
}

/* --- Hero Text — Center-aligned Brand Statement --- */
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: var(--space-lg);
  opacity: 0;
  transform: translateY(12px);
  animation: fadeUp 0.8s var(--ease-out) 1.0s forwards;
}

.hero-eyebrow .line {
  width: 28px;
  height: 0.5px;
  background: var(--accent);
  opacity: 0.4;
}

.hero h1 {
  margin-bottom: var(--space-lg);
  opacity: 0;
  transform: translateY(16px);
  animation: fadeUp 0.9s var(--ease-out) 1.2s forwards;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.hero-description {
  font-size: clamp(0.88rem, 1.3vw, 0.98rem);
  line-height: 1.8;
  color: var(--text-tertiary);
  font-weight: 400;
  letter-spacing: 0.005em;
  margin-bottom: var(--space-xl);
  max-width: 440px;
  opacity: 0;
  transform: translateY(12px);
  animation: fadeUp 0.9s var(--ease-out) 1.4s forwards;
}

.hero-actions {
  display: flex;
  gap: var(--space-md);
  opacity: 0;
  transform: translateY(12px);
  animation: fadeUp 0.9s var(--ease-out) 1.6s forwards;
}

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

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 4px;
  transition: all var(--duration-base) var(--ease-out);
}

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

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(74, 124, 255, 0.2);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-medium);
}

.btn-secondary:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.03);
}

.btn-arrow {
  transition: transform var(--duration-fast) var(--ease-out);
  font-size: 0.9em;
}

.btn:hover .btn-arrow {
  transform: translateX(3px);
}

/* --- Section Shared --- */
.section-header {
  margin-bottom: var(--space-3xl);
}

.section-header .label {
  margin-bottom: var(--space-md);
  display: block;
}

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

.section-header p {
  font-size: 1rem;
  line-height: 1.8;
}

/* Reveal on scroll */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

.reveal-stagger.visible > *:nth-child(1) { transition-delay: 0ms; }
.reveal-stagger.visible > *:nth-child(2) { transition-delay: 100ms; }
.reveal-stagger.visible > *:nth-child(3) { transition-delay: 200ms; }
.reveal-stagger.visible > *:nth-child(4) { transition-delay: 300ms; }
.reveal-stagger.visible > *:nth-child(5) { transition-delay: 400ms; }

.reveal-stagger.visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* --- Divider --- */
.section-divider {
  width: 100%;
  height: 1px;
  background: var(--border-subtle);
  border: none;
}

/* --- Who We Are --- */
.who-we-are {
  background: var(--bg-primary);
}

.who-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3xl);
  align-items: start;
}

.who-statement h2 {
  margin-bottom: var(--space-xl);
}

.who-statement h2 .accent {
  color: var(--accent);
}

.who-detail {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.who-detail p {
  font-size: 0.95rem;
  line-height: 1.9;
}

.who-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border-subtle);
}

.metric-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.metric-label {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* --- What We Build --- */
.what-we-build {
  background: var(--bg-secondary);
}

.product-grid {
  display: grid;
  gap: var(--space-lg);
}

.product-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: clamp(2rem, 4vw, 3rem);
  transition: border-color var(--duration-base) var(--ease-out),
              background var(--duration-base) var(--ease-out);
}

.product-card:hover {
  border-color: var(--border-medium);
  background: var(--bg-surface-hover);
}

.product-card.featured {
  border-color: rgba(74, 124, 255, 0.15);
  position: relative;
  overflow: hidden;
}

.product-card.featured::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.4;
}

.product-tag {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--space-lg);
}

.product-tag.primary {
  background: var(--accent-dim);
  color: var(--accent);
}

.product-tag.secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-tertiary);
}

.product-card h3 {
  margin-bottom: var(--space-md);
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
}

.product-logo {
  height: clamp(28px, 3.5vw, 42px);
  width: auto;
  display: block;
  opacity: 0.95;
}

.product-card > p {
  font-size: 0.9rem;
  line-height: 1.85;
  margin-bottom: var(--space-xl);
}

.product-features {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.product-feature {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  font-size: 0.72rem;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.product-feature .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.6;
}

/* Secondary products grid */
.product-secondary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
  margin-top: var(--space-lg);
}

/* --- Approach --- */
.approach {
  background: var(--bg-primary);
}

.approach-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
}

.approach-item {
  background: var(--bg-primary);
  padding: clamp(1.5rem, 3vw, 2.5rem);
  transition: background var(--duration-base) var(--ease-out);
}

.approach-item:hover {
  background: var(--bg-secondary);
}

.approach-number {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-tertiary);
  letter-spacing: 0.08em;
  margin-bottom: var(--space-xl);
  display: block;
}

.approach-item h3 {
  font-size: 1rem;
  margin-bottom: var(--space-md);
}

.approach-item p {
  font-size: 0.82rem;
  line-height: 1.8;
  color: var(--text-tertiary);
}

/* --- CTA / Contact --- */
.cta-section {
  background: var(--bg-secondary);
  text-align: center;
}

.cta-content {
  max-width: 560px;
  margin: 0 auto;
}

.cta-content h2 {
  margin-bottom: var(--space-lg);
}

.cta-content > p {
  margin: 0 auto var(--space-xl);
  text-align: center;
}

.cta-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
}

/* --- Footer --- */
.footer {
  padding: var(--space-2xl) 0;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-primary);
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-divider {
  border: none;
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-lg) 0;
}

.footer-info {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.footer-info span {
  font-size: 0.68rem;
  color: var(--text-tertiary);
  letter-spacing: 0.01em;
}

.footer-info em {
  font-style: normal;
  color: var(--text-secondary);
  margin-right: 0.2em;
}

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

.footer-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.footer-logo img {
  height: 20px;
  opacity: 0.7;
}

.footer-logo span {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

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

.footer-links {
  display: flex;
  gap: var(--space-xl);
}

.footer-links a {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  transition: color var(--duration-fast);
}

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

/* --- Responsive --- */
@media (max-width: 1024px) {
  .who-content {
    grid-template-columns: 1fr;
    gap: var(--space-2xl);
  }

  .approach-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  .hero-logo {
    width: clamp(120px, 32vw, 180px);
  }

  .hero-content {
    max-width: 100%;
    padding: 0 var(--space-md);
  }

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

  .hero-actions .btn {
    justify-content: center;
  }

  .product-secondary-grid {
    grid-template-columns: 1fr;
  }

  .approach-grid {
    grid-template-columns: 1fr;
  }

  .who-metrics {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
  }

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

  .footer-top {
    flex-direction: column;
    gap: var(--space-lg);
    text-align: center;
  }

  .footer-info {
    text-align: center;
  }

  .footer-links {
    gap: var(--space-lg);
  }
}

@media (max-width: 480px) {
  .who-metrics {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .metric-item {
    flex-direction: row;
    align-items: baseline;
    gap: var(--space-md);
  }
}
