/* ═══════════════════════════════════════════════════════════
   PuniCodex — Home Critical CSS (above-the-fold only)

   The render-blocking slice for the home page: boot veil, nav,
   and hero. Every rule below is copied VERBATIM from
   assets/fonts/fonts.css, css/main.css, and css/home-v2.css —
   the full stylesheets load deferred right after this file and
   re-assert the identical rules, so the steady-state cascade is
   unchanged. If you edit one of those source blocks, mirror the
   change here.
   ═══════════════════════════════════════════════════════════ */

/* ─── Fonts (latin subsets used above the fold) ─── */

/* latin */
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/assets/fonts/cormorant-garamond-400-normal-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* latin */
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/assets/fonts/cormorant-garamond-400-normal-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* latin */
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url(/assets/fonts/montserrat-300-normal-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* latin */
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/assets/fonts/montserrat-300-normal-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* latin */
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/assets/fonts/montserrat-300-normal-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* latin */
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/assets/fonts/montserrat-300-normal-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ─── Design Tokens (from main.css) ─── */
:root {
    /* Depth Colors */
    --void: #050505;
    --abyss: #0A0A0A;
    --deep: #0D0D0D;
    --surface: #141414;
    --surface-raised: #1A1A1A;
    --hover: #252525;
    --hover-bright: #333333;

    /* Gold System */
    --gold: #D4AF37;
    --gold-bright: #E8C547;
    --gold-dim: rgba(212, 175, 55, 0.12);
    --gold-glow: rgba(212, 175, 55, 0.35);
    --gold-glow-strong: rgba(212, 175, 55, 0.6);
    --gold-text-shadow: 0 0 40px rgba(212, 175, 55, 0.25);

    /* Accent */
    --blue: #4169E1;
    --blue-glow: rgba(65, 105, 225, 0.3);

    /* Text */
    --text-primary: #F0F0F0;
    --text-secondary: #A0A0A0;
    --text-dim: #555555;
    --text-faint: #333333;

    /* Spacing */
    --space-1: 8px;
    --space-2: 16px;
    --space-3: 24px;
    --space-4: 32px;
    --space-5: 48px;
    --space-6: 64px;
    --space-7: 96px;
    --space-8: 128px;
    --space-9: 160px;

    /* Typography */
    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Animation */
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-enter: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-exit: cubic-bezier(0.7, 0, 0.84, 0);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-dramatic: cubic-bezier(0.87, 0, 0.13, 1);
    --duration-fast: 150ms;
    --duration-normal: 300ms;
    --duration-slow: 600ms;
    --duration-dramatic: 1200ms;

    /* Layout */
    --container-max: 1440px;
    --nav-height: 72px;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 20px;
}

/* ─── Reset (from main.css) ─── */
*, *::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;
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--void);
    overflow-x: hidden;
}

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

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-smooth);
}

/* GPU layer promotion for animated elements */
.hero-content, .hero-canvas, .psi-icon, .scroll-indicator {
    will-change: transform;
    transform: translateZ(0);
}

button {
    font-family: inherit;
    border: none;
    background: none;
}

ul, ol {
    list-style: none;
}

/* ─── Typography (from main.css) ─── */
.display-xl {
    font-family: var(--font-display);
    font-size: clamp(52px, 9vw, 120px);
    font-weight: 600;
    line-height: 0.95;
    letter-spacing: -0.02em;
    color: var(--gold);
}

.display-lg {
    font-family: var(--font-display);
    font-size: clamp(40px, 6vw, 80px);
    font-weight: 600;
    line-height: 1.0;
    letter-spacing: -0.01em;
    color: var(--gold);
}

.display-md {
    font-family: var(--font-display);
    font-size: clamp(28px, 3.5vw, 52px);
    font-weight: 600;
    line-height: 1.1;
    color: var(--gold);
}

.body-lg {
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.7;
    letter-spacing: 0.01em;
    color: var(--text-secondary);
}

.body-md {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    letter-spacing: 0.01em;
    color: var(--text-secondary);
}

.body-sm {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    letter-spacing: 0.02em;
    color: var(--text-secondary);
}

/* ─── Container (from main.css) ─── */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

@media (max-width: 768px) {
    .container {
        padding: 0 var(--space-3);
    }
}

/* ─── Navigation (from main.css) ─── */
.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    z-index: 1010;
    transition: background var(--duration-slow) var(--ease-smooth),
                backdrop-filter var(--duration-slow) var(--ease-smooth),
                border-color var(--duration-slow) var(--ease-smooth);
    border-bottom: 1px solid transparent;
}

.main-nav.scrolled {
    background: rgba(5, 5, 5, 0.95);
    border-bottom-color: var(--gold-dim);
}

.nav-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-6);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

@media (max-width: 768px) {
    .nav-inner {
        padding: 0 var(--space-3);
    }
}

.nav-wordmark {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 600;
    color: var(--gold);
    letter-spacing: 0.05em;
    position: relative;
}

.nav-wordmark img {
    display: block;
    height: 24px;
    width: auto;
    max-width: 62vw;
}

@media (max-width: 640px) {
    .nav-wordmark img {
        height: 18px;
    }
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.nav-link {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    transition: color var(--duration-fast) var(--ease-smooth);
    position: relative;
    padding: 4px 0;
    white-space: nowrap;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 1px;
    background: var(--gold);
    transition: width var(--duration-normal) var(--ease-smooth), left var(--duration-normal) var(--ease-smooth);
}

.nav-link:hover,
.nav-link.active {
    color: var(--gold);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
    left: 0;
}

/* ─── More Dropdown ─── */
.nav-more {
    position: relative;
}

.nav-more-toggle {
    background: transparent;
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.06em;
    padding: 6px 12px;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-smooth);
    white-space: nowrap;
}

.nav-more-toggle:hover,
.nav-more-toggle[aria-expanded="true"] {
    border-color: var(--gold);
    color: var(--gold);
}

.nav-more-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    max-height: calc(100vh - 96px);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--surface-raised);
    border: 1px solid rgba(212, 175, 55, 0.15);
    border-radius: var(--radius-md);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition: all var(--duration-fast) var(--ease-smooth);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    z-index: 1011;
}

.nav-more-menu::-webkit-scrollbar { width: 6px; }
.nav-more-menu::-webkit-scrollbar-track { background: transparent; }
.nav-more-menu::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.3);
    border-radius: 999px;
}

.nav-more:hover .nav-more-menu,
.nav-more-toggle[aria-expanded="true"] + .nav-more-menu,
.nav-more-menu:focus-within {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

.nav-more-menu .nav-link {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
}

.nav-more-menu .nav-link:hover {
    background: var(--gold-dim);
}

.nav-more-menu .nav-link::after {
    display: none;
}

.nav-cta {
    padding: 10px 22px;
    border: 1px solid var(--gold);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--gold);
    transition: all var(--duration-normal) var(--ease-smooth);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.nav-cta::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gold);
    transform: translateX(-101%);
    transition: transform var(--duration-normal) var(--ease-enter);
}

.nav-cta:hover::before {
    transform: translateX(0);
}

.nav-cta:hover {
    color: var(--void);
}

.nav-cta span {
    position: relative;
    z-index: 1;
}

/* Mobile Nav Toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    width: 28px;
    height: 20px;
    z-index: 1003;
    position: relative;
}

.nav-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--gold);
    transition: all var(--duration-normal) var(--ease-smooth);
    transform-origin: center;
}

.nav-toggle.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

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

    .nav-cta {
        display: none;
    }

    .nav-toggle {
        display: flex;
    }
}

/* Mobile Menu Overlay */
.mobile-menu {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    height: calc(100vh - var(--nav-height));
    background: rgba(5, 5, 5, 0.98);
    z-index: 1009;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-3);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration-normal) var(--ease-smooth);
    overflow-y: auto;
}

.mobile-menu.active {
    opacity: 1;
    pointer-events: all;
}

body.menu-open {
    overflow: hidden;
}

/* ─── Buttons (from main.css) ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 16px 36px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.06em;
    border-radius: var(--radius-md);
    transition: color var(--duration-normal) var(--ease-smooth), border-color var(--duration-normal) var(--ease-smooth), box-shadow var(--duration-normal) var(--ease-smooth);
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--gold);
    color: var(--void);
    border-color: var(--gold);
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gold-bright);
    transform: translateX(-101%);
    transition: transform var(--duration-normal) var(--ease-enter);
}

.btn-primary:hover::before {
    transform: translateX(0);
}

.btn-primary:hover {
    border-color: var(--gold-bright);
    box-shadow: 0 0 40px var(--gold-glow), 0 0 80px var(--gold-dim);
}

.btn-primary span {
    position: relative;
    z-index: 1;
}

.btn-outline {
    background: transparent;
    color: var(--gold);
    border: 1px solid var(--gold);
}

.btn-outline::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gold);
    transform: translateX(-101%);
    transition: transform var(--duration-normal) var(--ease-enter);
}

.btn-outline:hover::before {
    transform: translateX(0);
}

.btn-outline:hover {
    color: var(--void);
    box-shadow: 0 0 30px var(--gold-glow);
}

.btn-outline span {
    position: relative;
    z-index: 1;
}

.btn-lg {
    padding: 20px 52px;
    font-size: 16px;
}

/* Native scroll reveal — triggered by IntersectionObserver adding .revealed */
.reveal-up, .reveal-scale, .reveal-fade {
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}
.reveal-up { opacity: 0; transform: translateY(40px); }
.reveal-up.revealed { opacity: 1; transform: translateY(0); }

.reveal-scale { opacity: 0; transform: scale(0.92); }
.reveal-scale.revealed { opacity: 1; transform: scale(1); }

.reveal-fade { opacity: 0; }
.reveal-fade.revealed { opacity: 1; }

/* Stagger children within [data-stagger] containers */
[data-stagger] .reveal-up { transition-delay: calc(var(--stagger-index, 0) * 60ms); }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .reveal-up, .reveal-scale, .reveal-fade {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

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

/* ─── Boot veil — The Convergence (from home-v2.css) ─── */
#boot-veil {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--void);
    transition: opacity 0.8s ease, visibility 0.8s;
}

#boot-veil.done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#boot-veil canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

#boot-veil .boot-core {
    position: absolute;
    left: 50%;
    top: 44%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.1rem;
    pointer-events: none;
}

#boot-veil .boot-core img {
    width: 120px;
    height: 120px;
    filter: drop-shadow(0 0 28px rgba(212, 175, 55, 0.35));
}

#boot-veil .boot-caption {
    font-family: var(--font-display);
    font-size: 1.35rem;
    letter-spacing: 0.34em;
    text-indent: 0.34em;
    color: var(--gold);
    text-align: center;
    animation: boot-caption-in 1.1s ease 0.9s both;
}

#boot-veil .boot-caption span {
    display: block;
    margin-top: 0.45rem;
    font-family: var(--font-body);
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.42em;
    text-indent: 0.42em;
    text-transform: uppercase;
    color: var(--text-secondary);
    animation: boot-caption-in 1.1s ease 1.25s both;
}

@keyframes boot-caption-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── Hero — The Orrery of Scripts (from home-v2.css) ─── */
.hero {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: var(--space-6) var(--space-3);
    background:
        radial-gradient(circle at 50% 42%, rgba(212, 175, 55, 0.055) 0%, transparent 46%),
        var(--void);
}

#orrery {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

/* Central scrim: keeps the wordmark legible inside the glyph shell, and
   vignettes the edges into the void. */
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    background:
        radial-gradient(ellipse 54% 42% at 50% 46%, rgba(5, 5, 8, 0.62) 0%, rgba(5, 5, 8, 0.24) 58%, transparent 80%),
        radial-gradient(ellipse at center, transparent 0%, rgba(5, 5, 5, 0.82) 82%, var(--void) 100%);
    pointer-events: none;
}

.hero-vignette {
    display: none;
}

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

.hero-kicker {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.42em;
    text-transform: uppercase;
    color: var(--gold);
    opacity: 0.85;
    margin-bottom: var(--space-4);
}

/* Hairline gold rule with a diamond node — procedural, no image. */
.hero-rule {
    position: relative;
    width: 148px;
    height: 1px;
    margin: var(--space-4) auto var(--space-5);
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.85), transparent);
}

.hero-rule::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 7px;
    height: 7px;
    transform: translate(-50%, -50%) rotate(45deg);
    border: 1px solid var(--gold);
    background: var(--void);
}

.hero h1 {
    margin-bottom: var(--space-3);
    position: relative;
    text-shadow:
        0 1px 0 rgba(212, 175, 55, 0.15),
        0 2px 8px rgba(0, 0, 0, 0.6),
        0 0 60px rgba(212, 175, 55, 0.18);
}

.hero-subtitle {
    max-width: 560px;
    margin: 0 auto var(--space-6);
    font-weight: 300;
    letter-spacing: 0.02em;
}

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

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: var(--space-6);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 3;
    opacity: 0.6;
}

.scroll-line {
    width: 1px;
    height: 50px;
    background: linear-gradient(to bottom, var(--gold), transparent);
}

.scroll-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--gold);
}

.scroll-text {
    font-size: 10px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-top: 4px;
}
