/* ═══════════════════════════════════════════════════════════════════════════════
   FRACTAL — Matrix Labradorite Design System
   The stone appears as unremarkable dark grey until light hits it at the right 
   angle, then it erupts in spectral iridescence.
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────────────────
   SACRED VARIABLES — φ = 1.618 
   ───────────────────────────────────────────────────────────────────────────── */
:root {
    /* Obsidian Foundation */
    --void: #000000;
    --obsidian: #0A0A0A;
    --graphite: #121212;
    --graphite-light: #1a1a1a;
    
    /* Gold — Sun/Resh (5% rule) */
    --gold: #C9A96E;
    --gold-glow: rgba(201, 169, 110, 0.4);
    --gold-ghost: rgba(201, 169, 110, 0.08);
    
    /* Burgundy — Mars/Peh (SINGLE USE) */
    --burgundy: #6B1D2A;
    
    /* Silver — Moon */
    --silver: #F5F5F5;
    --silver-dim: rgba(245, 245, 245, 0.6);
    --silver-ghost: rgba(245, 245, 245, 0.08);
    
    /* Labradorite Iridescence — Neptune */
    --cyan: #00BCD4;
    --violet: #7C4DFF;
    --cyan-glow: rgba(0, 188, 212, 0.5);
    --violet-glow: rgba(124, 77, 255, 0.5);
    
    /* Fibonacci Spacing */
    --sp-1: 8px;
    --sp-2: 13px;
    --sp-3: 21px;
    --sp-4: 34px;
    --sp-5: 55px;
    --sp-6: 89px;
    --sp-7: 144px;
    
    /* Timing */
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Cormorant Garamond', Georgia, serif;
    background: var(--void);
    color: var(--silver);
    overflow-x: hidden;
    cursor: crosshair;
}

::selection {
    background: var(--cyan);
    color: var(--void);
}

/* ─────────────────────────────────────────────────────────────────────────────
   MATRIX CANVAS — Digital Rain
   ───────────────────────────────────────────────────────────────────────────── */
#matrix-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    opacity: 0.4;
    pointer-events: none;
}

/* ─────────────────────────────────────────────────────────────────────────────
   GEOMETRY CANVAS — Sacred Shapes
   ───────────────────────────────────────────────────────────────────────────── */
#geometry-canvas {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    mix-blend-mode: screen;
}

/* ─────────────────────────────────────────────────────────────────────────────
   LABRADORITE LAYER — Hidden Fire Reveal
   ───────────────────────────────────────────────────────────────────────────── */
.labradorite {
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(
        800px ellipse at var(--mx, 50%) var(--my, 50%),
        var(--cyan-glow) 0%,
        var(--violet-glow) 25%,
        transparent 60%
    );
    mix-blend-mode: screen;
    transition: opacity 0.6s var(--ease);
}

body:hover .labradorite {
    opacity: 1;
}

/* ─────────────────────────────────────────────────────────────────────────────
   SCAN LINES — CRT Effect
   ───────────────────────────────────────────────────────────────────────────── */
.scan-lines {
    position: fixed;
    inset: 0;
    z-index: 1000;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.1) 2px,
        rgba(0, 0, 0, 0.1) 4px
    );
    animation: scan-move 8s linear infinite;
}

.scan-lines::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(0, 188, 212, 0.03) 50%,
        transparent 100%
    );
    animation: scan-sweep 4s ease-in-out infinite;
}

@keyframes scan-move {
    0% { background-position: 0 0; }
    100% { background-position: 0 100px; }
}

@keyframes scan-sweep {
    0%, 100% { transform: translateY(-100%); opacity: 0; }
    50% { transform: translateY(100%); opacity: 1; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   NAVIGATION
   ───────────────────────────────────────────────────────────────────────────── */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--sp-4) var(--sp-5);
    mix-blend-mode: difference;
}

.nav__logo {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    text-decoration: none;
    color: var(--silver);
}

.logo-mark {
    position: relative;
    width: 24px;
    height: 24px;
}

.logo-square {
    position: absolute;
    inset: 4px;
    border: 1px solid currentColor;
    transition: transform 0.6s var(--ease);
}

.logo-square--rotated {
    transform: rotate(45deg);
}

.nav__logo:hover .logo-square {
    transform: rotate(-15deg);
}

.nav__logo:hover .logo-square--rotated {
    transform: rotate(60deg);
}

.logo-text {
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.3em;
    text-transform: uppercase;
}

.nav__cta {
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--silver);
    text-decoration: none;
    padding: var(--sp-2) var(--sp-3);
    border: 1px solid var(--silver-ghost);
    transition: all 0.4s var(--ease);
}

.nav__cta:hover {
    background: var(--silver);
    color: var(--void);
    border-color: var(--silver);
}

/* ─────────────────────────────────────────────────────────────────────────────
   HERO — Minimal Impact
   ───────────────────────────────────────────────────────────────────────────── */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.hero__core {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero__title {
    font-size: clamp(3rem, 15vw, 12rem);
    font-weight: 300;
    letter-spacing: 0.15em;
    color: transparent;
    -webkit-text-stroke: 1px var(--silver-dim);
    position: relative;
    display: flex;
}

.hero__title::before {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    color: var(--silver);
    -webkit-text-stroke: 0;
    clip-path: inset(0 100% 0 0);
    animation: title-reveal 2s var(--ease) 0.5s forwards;
}

@keyframes title-reveal {
    to { clip-path: inset(0 0 0 0); }
}

/* Character animations */
.char {
    display: inline-block;
    opacity: 0;
    transform: translateY(40px) rotateX(-90deg);
    animation: char-in 0.8s var(--ease-back) forwards;
    animation-delay: calc(0.1s + var(--i) * 0.08s);
}

@keyframes char-in {
    to {
        opacity: 1;
        transform: translateY(0) rotateX(0);
    }
}

/* Glitch effect on hover */
.hero__title:hover::before {
    animation: glitch 0.3s steps(2) infinite;
}

@keyframes glitch {
    0% { clip-path: inset(40% 0 61% 0); transform: translate(-2px, 2px); }
    20% { clip-path: inset(92% 0 1% 0); transform: translate(2px, -2px); }
    40% { clip-path: inset(43% 0 1% 0); transform: translate(-2px, 0); }
    60% { clip-path: inset(25% 0 58% 0); transform: translate(0, 2px); }
    80% { clip-path: inset(54% 0 7% 0); transform: translate(2px, -2px); }
    100% { clip-path: inset(58% 0 43% 0); transform: translate(-2px, 2px); }
}

/* Sacred Sigil */
.hero__sigil {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(90vw, 600px);
    height: min(90vw, 600px);
    pointer-events: none;
    opacity: 0.06;
    z-index: -1;
}

.sigil-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.sigil-square,
.sigil-hex,
.sigil-tri {
    fill: none;
    stroke-width: 0.5;
}

.sigil-square {
    stroke: var(--gold);
    stroke-dasharray: 480;
    stroke-dashoffset: 480;
    animation: draw 3s var(--ease) 0.2s forwards;
}

.sigil-square--2 {
    animation-delay: 0.5s;
}

.sigil-hex {
    stroke: var(--cyan);
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    animation: draw 2.5s var(--ease) 1s forwards;
}

.sigil-hex--2 {
    stroke: var(--violet);
    animation-delay: 1.3s;
}

.sigil-tri {
    stroke: var(--burgundy);
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    animation: draw 2s var(--ease) 1.8s forwards;
}

.sigil-center {
    fill: var(--gold);
    opacity: 0;
    animation: pulse-in 0.5s var(--ease) 2.5s forwards;
}

@keyframes draw {
    to { stroke-dashoffset: 0; }
}

@keyframes pulse-in {
    0% { opacity: 0; transform: scale(0); }
    50% { opacity: 1; transform: scale(1.5); }
    100% { opacity: 0.8; transform: scale(1); }
}

/* Continuous rotation on hover */
.hero:hover .sigil-svg {
    animation: sigil-rotate 20s linear infinite;
}

@keyframes sigil-rotate {
    to { transform: rotate(360deg); }
}

/* Scroll Cue */
.scroll-cue {
    position: absolute;
    bottom: var(--sp-5);
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5rem;
    color: var(--gold);
    opacity: 0;
    animation: fade-in 1s var(--ease) 3s forwards, float 2s ease-in-out infinite 3s;
}

@keyframes fade-in {
    to { opacity: 0.6; }
}

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

/* ─────────────────────────────────────────────────────────────────────────────
   ALLIANCES — Partnership Cards with Sacred Geometry
   ───────────────────────────────────────────────────────────────────────────── */
.alliances {
    position: relative;
    z-index: 10;
    padding: var(--sp-7) var(--sp-5);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--sp-5);
}

/* Jupiter 4×4 Kamea Grid Background */
.alliances__kamea {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    pointer-events: none;
}

.kamea-svg {
    width: min(90vw, 600px);
    height: min(90vw, 600px);
    color: var(--gold);
    animation: kamea-rotate 180s linear infinite;
}

.kamea-lines {
    stroke: currentColor;
    stroke-width: 0.3;
    opacity: 0.04;
}

.planet-glyph {
    fill: currentColor;
    font-size: 24px;
    opacity: 0.08;
    font-family: serif;
}

.planet-glyph--saturn { fill: var(--silver); }
.planet-glyph--moon { fill: var(--silver); opacity: 0.06; }
.planet-glyph--sun { fill: var(--gold); opacity: 0.1; }

@keyframes kamea-rotate {
    to { transform: rotate(360deg); }
}

/* Section Header with Orbital Geometry */
.alliances__header {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    opacity: 0;
    animation: fade-up 1s var(--ease) 0.2s forwards;
}

.header__orbit {
    position: relative;
    width: 36px;
    height: 36px;
}

.orbit-ring {
    position: absolute;
    inset: 0;
    border: 1px solid var(--gold);
    border-radius: 50%;
    opacity: 0.3;
    animation: orbit-spin 20s linear infinite;
}

.orbit-ring--inner {
    inset: 8px;
    animation-direction: reverse;
    animation-duration: 15s;
    opacity: 0.2;
}

.orbit-point {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    background: var(--gold);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 8px var(--gold-glow);
}

@keyframes orbit-spin {
    to { transform: rotate(360deg); }
}

.header__numeral {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.2rem;
    font-weight: 300;
    color: var(--gold);
    opacity: 0.5;
}

.header__label {
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--silver-dim);
}

@keyframes fade-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.alliances__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--sp-4);
    max-width: 1000px;
    width: 100%;
}

.alliance {
    position: relative;
    padding: var(--sp-5);
    background: var(--graphite);
    border: 1px solid var(--silver-ghost);
    overflow: hidden;
    transition: all 0.6s var(--ease);
}

.alliance::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        transparent 0%,
        rgba(0, 188, 212, 0.03) 50%,
        rgba(124, 77, 255, 0.05) 100%
    );
    opacity: 0;
    transition: opacity 0.6s var(--ease);
}

.alliance::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(0, 188, 212, 0.08),
        rgba(124, 77, 255, 0.1),
        transparent
    );
    transition: left 0.8s var(--ease);
}

.alliance:hover {
    border-color: var(--gold-ghost);
    transform: translateY(-4px);
}

.alliance:hover::before {
    opacity: 1;
}

.alliance:hover::after {
    left: 100%;
}

/* Flagship Variant */
.alliance--flagship {
    grid-column: 1 / -1;
    border-color: var(--gold-ghost);
    background: linear-gradient(135deg, var(--graphite) 0%, var(--graphite-light) 100%);
}

.alliance--flagship .alliance__tag {
    color: var(--gold);
}

.alliance__glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--burgundy);
    box-shadow: 0 0 20px var(--burgundy);
}

/* Planetary Sigils */
.alliance__sigil {
    position: absolute;
    top: var(--sp-4);
    right: var(--sp-4);
    width: 36px;
    height: 36px;
    color: var(--gold);
    opacity: 0.15;
    transition: all 0.6s var(--ease);
}

.alliance__sigil svg {
    width: 100%;
    height: 100%;
}

.alliance:hover .alliance__sigil {
    opacity: 0.6;
    transform: scale(1.15);
}

/* Sigil colors per card variant */
.alliance--flagship .alliance__sigil {
    color: var(--burgundy);
}

.alliance--sponsors .alliance__sigil {
    color: var(--gold);
}

/* Sacred Numbers (Sephirotic) */
.alliance__number {
    position: absolute;
    bottom: var(--sp-4);
    right: var(--sp-4);
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.5rem;
    font-weight: 300;
    color: var(--silver);
    opacity: 0.04;
    line-height: 1;
    transition: opacity 0.6s var(--ease);
}

.alliance:hover .alliance__number {
    opacity: 0.1;
}

.alliance__tag {
    display: block;
    font-size: 0.65rem;
    font-weight: 400;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--cyan);
    margin-bottom: var(--sp-3);
}

.alliance--flagship .alliance__tag {
    color: var(--burgundy);
}

.alliance--research .alliance__tag {
    color: var(--cyan);
}

.alliance--sponsors .alliance__tag {
    color: var(--gold);
}

.alliance__name {
    font-size: 2rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    margin-bottom: var(--sp-2);
}

.alliance__partner {
    font-size: 1.1rem;
    color: var(--silver);
    margin-bottom: var(--sp-1);
}

.alliance__cred {
    font-size: 0.8rem;
    color: var(--cyan);
    letter-spacing: 0.1em;
}

.alliance__role {
    font-size: 0.85rem;
    color: var(--silver-dim);
    margin-bottom: var(--sp-1);
}

.alliance__org {
    font-size: 0.75rem;
    color: var(--violet);
    letter-spacing: 0.1em;
}

/* Sponsors */
.alliance--sponsors {
    display: flex;
    flex-direction: column;
}

.sponsors {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    margin-top: auto;
    padding-top: var(--sp-3);
}

.sponsor {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    color: var(--silver-dim);
    transition: color 0.3s var(--ease);
}

.sponsor:hover {
    color: var(--silver);
}

.sponsor__icon {
    width: 32px;
    height: 32px;
    fill: currentColor;
}

.sponsor span {
    font-size: 1rem;
    letter-spacing: 0.1em;
}

/* Corner Accents (Flagship card) */
.alliance__corners {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.corner {
    position: absolute;
    width: 20px;
    height: 20px;
}

.corner--tl {
    top: 0;
    left: 0;
    border-top: 1px solid var(--gold);
    border-left: 1px solid var(--gold);
    opacity: 0.3;
}

.corner--br {
    bottom: 0;
    right: 0;
    border-bottom: 1px solid var(--gold);
    border-right: 1px solid var(--gold);
    opacity: 0.3;
}

.alliance:hover .corner {
    opacity: 0.6;
}

/* Tag Glyph Styling */
.tag__glyph {
    font-size: 0.9em;
    margin-right: 0.3em;
}

/* Alliance Seals (bottom-right geometry) */
.alliance__seal {
    position: absolute;
    bottom: var(--sp-4);
    right: var(--sp-4);
    width: 36px;
    height: 36px;
    color: var(--silver);
    opacity: 0.04;
    transition: all 0.6s var(--ease);
}

.alliance__seal svg {
    width: 100%;
    height: 100%;
}

.alliance:hover .alliance__seal {
    opacity: 0.12;
    transform: rotate(15deg);
}

.alliance--singularity .alliance__sigil {
    color: var(--violet);
}

.alliance--singularity .alliance__tag {
    color: var(--violet);
}

/* Solomon's Seal (Bottom Hexagram with Zodiac) */
.alliances__hexagram {
    width: 100px;
    height: 100px;
    color: var(--gold);
    opacity: 0;
    animation: fade-up 1s var(--ease) 0.8s forwards;
}

.hex-seal {
    width: 100%;
    height: 100%;
    opacity: 0.2;
}

.zodiac-ring {
    animation: zodiac-rotate 60s linear infinite;
    transform-origin: center;
}

@keyframes zodiac-rotate {
    to { transform: rotate(360deg); }
}

.zodiac-marks line {
    stroke: currentColor;
    stroke-width: 0.3;
    opacity: 0.5;
}

.hex-up, .hex-down {
    transition: all 0.8s var(--ease);
}

.hex-center {
    transition: all 0.6s var(--ease);
}

.alliances__hexagram:hover .hex-seal {
    opacity: 0.4;
}

.alliances__hexagram:hover .hex-up {
    transform: rotate(5deg);
    transform-origin: center;
}

.alliances__hexagram:hover .hex-down {
    transform: rotate(-5deg);
    transform-origin: center;
}

.alliances__hexagram:hover .hex-center {
    r: 5;
}

/* ─────────────────────────────────────────────────────────────────────────────
   FOOTER
   ───────────────────────────────────────────────────────────────────────────── */
.footer {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-4);
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    color: var(--silver-dim);
    border-top: 1px solid var(--silver-ghost);
}

.footer__sigil {
    color: var(--gold);
    animation: sigil-pulse 3s ease-in-out infinite;
}

@keyframes sigil-pulse {
    0%, 100% { opacity: 0.5; transform: scale(1) rotate(0deg); }
    50% { opacity: 1; transform: scale(1.2) rotate(45deg); }
}

/* ─────────────────────────────────────────────────────────────────────────────
   SCROLL REVEAL
   ───────────────────────────────────────────────────────────────────────────── */
.alliance {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}

.alliance.revealed {
    opacity: 1;
    transform: translateY(0);
}

.alliance:nth-child(1) { transition-delay: 0ms; }
.alliance:nth-child(2) { transition-delay: 100ms; }
.alliance:nth-child(3) { transition-delay: 200ms; }

/* ─────────────────────────────────────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .nav {
        padding: var(--sp-3) var(--sp-4);
    }
    
    .alliances {
        padding: var(--sp-6) var(--sp-4);
    }
    
    .alliance--flagship {
        grid-column: auto;
    }
}

/* ─────────────────────────────────────────────────────────────────────────────
   REDUCED MOTION
   ───────────────────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .scan-lines,
    #matrix-canvas {
        display: none;
    }
}

/* ─────────────────────────────────────────────────────────────────────────────
   FOCUS STATES
   ───────────────────────────────────────────────────────────────────────────── */
a:focus-visible {
    outline: 1px solid var(--gold);
    outline-offset: 4px;
}
