/* ============================================================
   NEXUM PUBLISHING — Design System
   Font choice: Fraunces — variable serif with italic axis,
   strong personality contrast vs Inter body; feels editorial
   not corporate, matches "quiet confidence" moodboard.
   ============================================================ */

/* ── Preconnect handled in HTML; font-display swap set below ── */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300..900;1,9..144,300..900&family=Inter:wght@400;500;600&display=swap');

/* ============================================================
   TOKENS
   ============================================================ */
:root {
  --bg:          #0A0E1A;
  --bg-elev:     #0F1424;
  --bg-elev-2:   #151B30;
  --fg:          #E8ECF5;
  --fg-muted:    #8B95B0;
  --fg-dim:      #5A6480;
  --accent-cyan: #00D4FF;
  --accent-violet: #8B5CF6;
  --border:      rgba(232,236,245,0.08);

  --glow-cyan:   radial-gradient(circle, rgba(0,212,255,0.25), transparent 60%);
  --glow-violet: radial-gradient(circle, rgba(139,92,246,0.20), transparent 60%);

  /* Typography scale */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body:    'Inter', system-ui, sans-serif;

  --size-h1: clamp(48px, 8vw, 96px);
  --size-h2: clamp(36px, 5vw, 64px);
  --size-h3: 28px;
  --size-body: 17px;
  --size-caption: 14px;

  --lh-display: 1.05;
  --lh-body: 1.65;

  /* Spacing rhythm */
  --section-pad: clamp(80px, 10vw, 140px);
  --container:   1240px;
  --container-pad: clamp(20px, 5vw, 48px);

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 200ms var(--ease);
}

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

html {
  font-size: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--size-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { cursor: pointer; font: inherit; border: none; background: none; }

/* ============================================================
   LAYOUT PRIMITIVES
   ============================================================ */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.section-pad {
  padding-block: var(--section-pad);
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: var(--lh-display);
}

h1 { font-size: var(--size-h1); }
h2 { font-size: var(--size-h2); }
h3 { font-size: var(--size-h3); }

/* Display italic em — cyan accent */
h1 em, h2 em {
  font-style: italic;
  color: var(--accent-cyan);
}

.tagline {
  display: block;
  font-family: var(--font-body);
  font-size: var(--size-caption);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-muted);
  font-variant: small-caps;
}

/* ============================================================
   FOCUS VISIBLE — keyboard nav (AA)
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding-block: 18px;
  transition: background var(--transition), backdrop-filter var(--transition), box-shadow var(--transition);
}

.nav.scrolled {
  background: rgba(10, 14, 26, 0.80);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  box-shadow: 0 1px 0 var(--border);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav__wordmark {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--fg);
  white-space: nowrap;
}

.nav__wordmark span {
  color: var(--accent-cyan);
}

.nav__links {
  display: flex;
  align-items: center;
  gap: clamp(20px, 3vw, 40px);
}

.nav__link {
  font-size: 15px;
  font-weight: 500;
  color: var(--fg-muted);
  transition: color var(--transition);
}

.nav__link:hover { color: var(--fg); }

/* ============================================================
   BUTTON
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.btn--outline {
  border: 1.5px solid var(--accent-cyan);
  color: var(--accent-cyan);
  background: transparent;
}

.btn--outline:hover {
  background: var(--accent-cyan);
  color: var(--bg);
  box-shadow: 0 0 32px rgba(0,212,255,0.35);
  transform: translateY(-1px);
}

.btn--outline:active { transform: translateY(0); }

.btn--large {
  padding: 16px 40px;
  font-size: 17px;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 720px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}

/* 3D canvas sits behind content */
#hero-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
}

/* Static fallback gradient (mobile / reduced-motion) */
.hero__bg-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    var(--glow-cyan),
    var(--glow-violet),
    var(--bg);
  background-position: 30% 40%, 70% 60%, center;
  background-size: 60% 60%, 50% 50%, 100% 100%;
  background-repeat: no-repeat;
  display: none; /* shown by JS when Three.js not loaded */
}

.hero__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  max-width: 820px;
  padding-inline: 24px;
  padding-top: 80px; /* nav offset */
}

.hero__tagline {
  margin-bottom: -8px;
}

.hero__title {
  font-size: var(--size-h1);
}

.hero__lead {
  font-size: clamp(16px, 2vw, 18px);
  color: var(--fg-muted);
  max-width: 580px;
  line-height: 1.7;
}

.hero__cta {
  margin-top: 8px;
}

/* Scroll hint */
.scroll-hint {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--fg-dim);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.scroll-hint__line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, var(--fg-dim), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%, 100% { opacity: 0.4; transform: scaleY(1); }
  50%       { opacity: 1;   transform: scaleY(1.15); }
}

/* ============================================================
   MANIFESTO
   ============================================================ */
.manifesto {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.manifesto__text {
  max-width: 920px;
  color: var(--fg-muted);
  line-height: 1.35;
}

.manifesto__text em {
  font-style: italic;
  color: var(--fg);
}

/* ============================================================
   PILLARS (service cards)
   ============================================================ */
.pillars__header {
  margin-bottom: 56px;
}

.pillars__label {
  margin-bottom: 12px;
}

.pillars__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.pillar-card {
  position: relative;
  padding: 48px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  overflow: hidden;
}

.pillar-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--glow-violet);
  opacity: 0;
  transition: opacity 300ms var(--ease);
  pointer-events: none;
}

.pillar-card:hover {
  border-color: rgba(0,212,255,0.30);
  transform: translateY(-2px);
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
}

.pillar-card:hover::before { opacity: 1; }

.pillar-card__num {
  display: block;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(48px, 5vw, 72px);
  font-weight: 800;
  color: var(--fg-dim);
  line-height: 1;
  margin-bottom: 24px;
  letter-spacing: -0.04em;
}

.pillar-card__title {
  font-size: var(--size-h3);
  margin-bottom: 16px;
  color: var(--fg);
}

.pillar-card__body {
  color: var(--fg-muted);
  font-size: 16px;
  line-height: 1.7;
}

/* ============================================================
   STATS
   ============================================================ */
.stats {
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.stats__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
}

.stat-cell {
  padding: 56px 32px;
  text-align: center;
  border-right: 1px solid var(--border);
}

.stat-cell:last-child { border-right: none; }

.stat-cell__num {
  display: block;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(40px, 5vw, 64px);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--fg);
  line-height: 1;
  margin-bottom: 8px;
}

.stat-cell__label {
  font-size: var(--size-caption);
  color: var(--fg-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ============================================================
   QUOTE
   ============================================================ */
.quote-section {
  text-align: center;
}

.quote-section blockquote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(24px, 3.5vw, 40px);
  font-weight: 600;
  line-height: 1.3;
  color: var(--fg-muted);
  max-width: 880px;
  margin: 0 auto 28px;
  letter-spacing: -0.02em;
  quotes: '\201C' '\201D';
}

.quote-section blockquote::before { content: open-quote; }
.quote-section blockquote::after  { content: close-quote; }

.quote-section__attribution {
  font-size: 15px;
  color: var(--fg-dim);
  letter-spacing: 0.04em;
}

/* ============================================================
   FINAL CTA
   ============================================================ */
.cta-final {
  text-align: center;
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
}

.cta-final__title {
  margin-bottom: 20px;
}

.cta-final__body {
  color: var(--fg-muted);
  max-width: 520px;
  margin: 0 auto 40px;
}

.cta-final__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 700;
  font-style: italic;
  color: var(--fg);
  position: relative;
}

.cta-final__link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-cyan);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 300ms var(--ease);
}

.cta-final__link:hover { color: var(--accent-cyan); }
.cta-final__link:hover::after { transform: scaleX(1); }

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
}

.footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: clamp(32px, 4vw, 64px);
  padding-block: 64px;
}

.footer__brand {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.footer__wordmark {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.footer__wordmark span { color: var(--accent-cyan); }

.footer__tagline {
  color: var(--fg-muted);
  font-size: 15px;
  line-height: 1.6;
  max-width: 260px;
}

.footer__col-title {
  font-size: var(--size-caption);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin-bottom: 20px;
}

.footer__links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer__links a {
  font-size: 15px;
  color: var(--fg-muted);
  transition: color var(--transition);
}

.footer__links a:hover { color: var(--fg); }

.footer__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 24px;
  border-top: 1px solid var(--border);
  gap: 16px;
  flex-wrap: wrap;
}

.footer__copy {
  font-size: var(--size-caption);
  color: var(--fg-dim);
}

.footer__socials {
  display: flex;
  gap: 16px;
}

.footer__social {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg-muted);
  transition: color var(--transition), border-color var(--transition);
}

.footer__social:hover {
  color: var(--accent-cyan);
  border-color: rgba(0,212,255,0.3);
}

.footer__social svg { width: 16px; height: 16px; fill: currentColor; }

/* ============================================================
   SCROLL FADE-IN (IO observer target)
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 600ms var(--ease), transform 600ms var(--ease);
}

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

/* Staggered children */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 600ms var(--ease), transform 600ms var(--ease);
}

.reveal-stagger.visible > *:nth-child(1) { opacity: 1; transform: none; transition-delay: 0ms; }
.reveal-stagger.visible > *:nth-child(2) { opacity: 1; transform: none; transition-delay: 120ms; }
.reveal-stagger.visible > *:nth-child(3) { opacity: 1; transform: none; transition-delay: 240ms; }
.reveal-stagger.visible > *:nth-child(4) { opacity: 1; transform: none; transition-delay: 360ms; }

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .scroll-hint__line { animation: none; }
  .reveal, .reveal-stagger > * {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ============================================================
   RESPONSIVE — 1024px
   ============================================================ */
@media (max-width: 1024px) {
  .pillars__grid {
    grid-template-columns: 1fr 1fr;
  }

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

/* ============================================================
   RESPONSIVE — 768px
   ============================================================ */
@media (max-width: 768px) {
  .nav__links { display: none; } /* mobile: would use hamburger in v2 */

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

  .pillar-card { padding: 32px; }

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

  .stat-cell {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 40px 20px;
  }

  .stat-cell:nth-child(odd)  { border-right: 1px solid var(--border); }
  .stat-cell:nth-child(3),
  .stat-cell:nth-child(4)    { border-bottom: none; }

  .footer__grid {
    grid-template-columns: 1fr;
    gap: 40px;
    padding-block: 48px;
  }

  .footer__bar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ============================================================
   RESPONSIVE — 360px
   ============================================================ */
@media (max-width: 400px) {
  .btn--large { padding: 14px 28px; font-size: 15px; }
}

/* ============================================================
   RESPONSIVE — 1280px / 1920px — contained by --container
   ============================================================ */
@media (min-width: 1280px) {
  .hero__content { max-width: 960px; }
}

@media (min-width: 1920px) {
  :root { --container: 1440px; }
}
