/* ════════════════════════════════════
   GLOBAL STYLES & VARIABLES
════════════════════════════════════ */

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

:root {
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-display: 'Space Grotesk', sans-serif;
  --font-quote: 'Cormorant Garamond', Georgia, serif;
  --zinc-950: #09090b;
  --zinc-900: #18181b;
  --zinc-800: #27272a;
  --zinc-700: #3f3f46;
  --zinc-500: #71717a;
  --zinc-400: #a1a1aa;
  --zinc-300: #d4d4d8;
  --zinc-100: #f4f4f5;
  --purple-300: #c4b5fd;
  --purple-400: #a78bfa;
  --purple-500: #8b5cf6;
  --purple-600: #7c3aed;
  --orange-300: #fdba74;
  --orange-400: #fb923c;
  --orange-500: #f97316;
  --white-5: rgba(255,255,255,0.05);
  --white-10: rgba(255,255,255,0.10);
  --white-20: rgba(255,255,255,0.20);
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.7;
  color: var(--zinc-100);
  background: var(--zinc-950);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  position: relative;
  animation: po-page-enter 320ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ── Custom scrollbar ── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--zinc-950); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--purple-600), var(--orange-500));
  border-radius: 10px; border: 2px solid var(--zinc-950);
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--purple-500), var(--orange-400));
}

/* ── Custom text selection ── */
::selection { background: rgba(139,92,246,0.35); color: white; }
::-moz-selection { background: rgba(139,92,246,0.35); color: white; }

/* ── Typography & Links ── */
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.15; }
a { color: var(--purple-400); text-decoration: none; transition: color 0.2s; }
@media (hover: hover) { a:hover { color: var(--purple-300); } }

/* Body-prose link affordance (WCAG 1.4.1) */
p a, li a, dd a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.footer-links a, .nav-desktop a, .newsletter-msg a,
.cta-email a, .btn-white { text-decoration: none; }

/* ── Global focus-visible ── */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--purple-400);
  outline-offset: 2px;
  border-radius: 4px;
  box-shadow: 0 0 0 4px rgba(139,92,246,0.28);
}
button:focus-visible, a:focus-visible, .btn-white:focus-visible {
  outline-offset: 3px;
}
.field-input:focus-visible {
  outline: none;
  border-color: var(--purple-400);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.28);
}

/* ── Container Utility ── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 16px; }


/* ════════════════════════════════════
   VIEW TRANSITIONS & PAGE KEYFRAMES
════════════════════════════════════ */

@view-transition {
  navigation: auto;
}

@keyframes po-page-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes po-view-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
  to {
    opacity: 0;
    transform: translateY(-6px) scale(0.995);
    filter: blur(6px);
  }
}

@keyframes po-view-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(1.005);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes po-brand-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@supports (view-transition-name: root) {
  body {
    animation: none;
  }
}

::view-transition-old(root) {
  animation: po-view-out 190ms cubic-bezier(0.4, 0, 1, 1) both;
}

::view-transition-new(root) {
  animation: po-view-in 260ms cubic-bezier(0.16, 1, 0.3, 1) both;
}


/* ════════════════════════════════════
   HEADER & NAVIGATION
════════════════════════════════════ */

header {
  view-transition-name: po-header;
}

header .logo {
  view-transition-name: po-brand;
}

header .logo .logo-img {
  object-fit: contain;
  animation: po-brand-spin 24s linear infinite;
  transform-origin: 50% 50%;
  will-change: transform;
}

.site-header .logo .logo-img {
  width: 32px;
  height: 32px;
}

header:not(.site-header) .logo .logo-img {
  width: 28px;
  height: 28px;
}

@media (hover: hover) {
  header .logo:hover .logo-img {
    animation-duration: 2.4s;
  }
}

header:not(.site-header) .nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

header:not(.site-header) .nav-links a {
  color: var(--zinc-400);
  font-size: 14px;
  line-height: 1;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 9999px;
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  white-space: nowrap;
}

header:not(.site-header) .nav-links a.is-active,
header:not(.site-header) .nav-links a:hover {
  color: white;
  border-color: var(--white-10);
  background: rgba(255, 255, 255, 0.03);
}

@media (max-width: 760px) {
  header:not(.site-header) .nav-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  header:not(.site-header) .nav-links {
    justify-content: flex-start;
    gap: 4px;
  }

  header:not(.site-header) .nav-links a {
    padding: 7px 8px;
    font-size: 13px;
  }
}

@media (max-width: 640px) {
  header:not(.site-header) .nav-inner,
  header:not(.site-header) ~ main .container,
  header:not(.site-header) ~ footer .container {
    max-width: 390px;
    margin-left: 0;
    margin-right: 0;
  }

  header:not(.site-header) ~ main h1 {
    max-width: 100%;
    font-size: clamp(34px, 10vw, 40px);
    line-height: 1.08;
    letter-spacing: 0;
    overflow-wrap: break-word;
  }

  header:not(.site-header) ~ main .lede,
  header:not(.site-header) ~ main .dek,
  header:not(.site-header) ~ main article p {
    max-width: 100%;
    overflow-wrap: break-word;
  }
}

@media (prefers-reduced-motion: reduce) {
  body,
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none !important;
  }

  header .logo .logo-img {
    animation: none !important;
  }
}
