/* ============================================================
   THE SEVEN GATES — Consciousness Ascent Journey Map
   Design: SpaceX mission control + Kabbalistic pillar + chakra spectrum
   Built: 2026-03-30
   ============================================================ */

/* ---- Page Variables ---- */
:root {
    --sg-gold: #d4af37;
    --sg-gold-dim: rgba(212, 175, 55, 0.4);
    --sg-gold-glow: rgba(212, 175, 55, 0.15);
    --sg-gold-bright: #f0d060;
    --sg-bg: #050508;
    --sg-panel: rgba(8, 10, 18, 0.75);
    --sg-panel-border: rgba(212, 175, 55, 0.08);
    --sg-text: #e4e6ed;
    --sg-text-muted: #5a5e72;
    --sg-text-dim: #3a3e52;
    --sg-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    --sg-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --sg-pillar-w: 2px;
    --sg-node-size: 20px;
    --sg-node-size-heart: 32px;
    --sg-gate-gap: 0;
    --sg-content-max: 480px;
    /* Gate chakra spectrum */
    --sg-c1: #ef4444;
    --sg-c2: #f97316;
    --sg-c3: #eab308;
    --sg-c4: #d4af37;
    --sg-c5: #3b82f6;
    --sg-c6: #6366f1;
    --sg-c7: #a855f7;
}

/* ---- Base ---- */
.seven-gates-page {
    background: var(--th-bg-primary, var(--sg-bg));
    color: var(--th-text-primary, var(--sg-text));
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    font-family: var(--sg-sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- Entry Scanline ---- */
.sg-scanline {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 10000;
    width: 0;
    height: 1px;
    background: var(--sg-gold);
    box-shadow: 0 0 12px var(--sg-gold), 0 0 30px rgba(212, 175, 55, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.5s cubic-bezier(0.2, 0, 0.1, 1);
    pointer-events: none;
}
.sg-scanline.active { width: 100vw; }
.sg-scanline.done { opacity: 0; transition: opacity 0.4s ease; }

/* ---- Main Container ---- */
#sg-main {
    opacity: 0;
    transition: opacity 0.6s ease;
    position: relative;
}
#sg-main.visible { opacity: 1; }

/* ---- Hero Section ---- */
.sg-hero {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 24px 48px;
    position: relative;
}
.sg-hero-eyebrow {
    font-family: var(--sg-mono);
    font-size: clamp(0.65rem, 1.2vw, 0.75rem);
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: var(--sg-gold);
    opacity: 0;
    transform: translateY(20px);
    margin-bottom: 16px;
}
.sg-hero-title {
    font-family: var(--sg-sans);
    font-size: clamp(2.2rem, 6vw, 4.5rem);
    font-weight: 200;
    letter-spacing: 0.08em;
    line-height: 1.1;
    color: var(--th-text-primary, #fff);
    opacity: 0;
    transform: translateY(30px);
    margin: 0 0 20px;
}
.sg-hero-title span {
    display: block;
    font-weight: 100;
    font-size: 0.45em;
    letter-spacing: 0.25em;
    color: var(--sg-gold);
    margin-top: 12px;
}
.sg-hero-sub {
    font-size: clamp(0.85rem, 1.5vw, 1.05rem);
    line-height: 1.7;
    color: var(--th-text-secondary, var(--sg-text-muted));
    max-width: 560px;
    opacity: 0;
    transform: translateY(20px);
    margin: 0 auto;
}
.sg-hero-rule {
    width: 60px;
    height: 1px;
    background: var(--sg-gold-dim);
    margin: 32px auto;
    opacity: 0;
}

/* Hero enter animations */
.sg-hero.entered .sg-hero-eyebrow {
    opacity: 1; transform: translateY(0);
    transition: opacity 0.8s ease, transform 0.8s ease;
}
.sg-hero.entered .sg-hero-title {
    opacity: 1; transform: translateY(0);
    transition: opacity 0.8s ease 0.15s, transform 0.8s ease 0.15s;
}
.sg-hero.entered .sg-hero-sub {
    opacity: 0.85; transform: translateY(0);
    transition: opacity 0.8s ease 0.35s, transform 0.8s ease 0.35s;
}
.sg-hero.entered .sg-hero-rule {
    opacity: 1;
    transition: opacity 0.6s ease 0.5s;
}

/* Scroll indicator */
.sg-scroll-cue {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    animation: sg-scroll-fade 2s ease 1.5s forwards;
}
.sg-scroll-cue svg {
    width: 20px;
    height: 20px;
    stroke: var(--sg-gold-dim);
    animation: sg-scroll-bounce 2s ease-in-out infinite;
}
@keyframes sg-scroll-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}
@keyframes sg-scroll-fade {
    to { opacity: 0.6; }
}

/* ---- Pillar Container ---- */
.sg-pillar-wrap {
    position: relative;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Central gold line */
.sg-pillar {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: var(--sg-pillar-w);
    background: linear-gradient(
        180deg,
        transparent 0%,
        var(--sg-gold-dim) 5%,
        var(--sg-gold) 15%,
        var(--sg-gold) 85%,
        var(--sg-gold-dim) 95%,
        transparent 100%
    );
    transform: translateX(-50%);
    animation: sg-pillar-pulse 6s ease-in-out infinite;
    z-index: 1;
}
@keyframes sg-pillar-pulse {
    0%, 100% { box-shadow: 0 0 6px var(--sg-gold-glow), 0 0 12px transparent; }
    50% { box-shadow: 0 0 10px var(--sg-gold-dim), 0 0 24px var(--sg-gold-glow); }
}

/* Particle canvas overlay */
#sg-particles {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

/* ---- Progress Nav (fixed side) ---- */
.sg-progress {
    position: fixed;
    right: clamp(12px, 2vw, 28px);
    top: 50%;
    transform: translateY(-50%);
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 14px;
    opacity: 0;
    transition: opacity 0.6s ease;
}
.sg-progress.visible { opacity: 1; }

.sg-progress-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    background: transparent;
    cursor: pointer;
    transition: all 0.35s ease;
    position: relative;
}
.sg-progress-dot::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    /* 44px touch target */
}
.sg-progress-dot.active {
    border-color: var(--dot-color);
    background: var(--dot-color);
    box-shadow: 0 0 8px var(--dot-color), 0 0 16px rgba(255, 255, 255, 0.05);
    transform: scale(1.3);
}

/* ---- Gate Section ---- */
.sg-gate {
    min-height: 85vh;
    display: flex;
    align-items: center;
    position: relative;
    z-index: 3;
    padding: 60px 0;
}

/* Alternate sides: odd gates left, even gates right
   Use data-gate attribute instead of nth-child to avoid sibling count issues */
.sg-gate[data-gate="1"],
.sg-gate[data-gate="3"],
.sg-gate[data-gate="5"],
.sg-gate[data-gate="7"] { justify-content: flex-start; }

.sg-gate[data-gate="2"],
.sg-gate[data-gate="4"],
.sg-gate[data-gate="6"] { justify-content: flex-end; }

.sg-gate[data-gate="1"] .sg-gate-content,
.sg-gate[data-gate="3"] .sg-gate-content,
.sg-gate[data-gate="5"] .sg-gate-content,
.sg-gate[data-gate="7"] .sg-gate-content {
    margin-right: calc(50% + 40px);
    text-align: right;
}
.sg-gate[data-gate="2"] .sg-gate-content,
.sg-gate[data-gate="4"] .sg-gate-content,
.sg-gate[data-gate="6"] .sg-gate-content {
    margin-left: calc(50% + 40px);
    text-align: left;
}

/* ---- Gate Node (circle on pillar) ---- */
.sg-gate-node {
    position: absolute;
    left: 50%;
    top: 50%;
    width: var(--sg-node-size);
    height: var(--sg-node-size);
    border-radius: 50%;
    border: 2px solid var(--gate-color);
    background: transparent;
    transform: translate(-50%, -50%);
    z-index: 4;
    transition: all 0.5s ease;
}
.sg-gate-node::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 1px solid var(--gate-color);
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* Gate visible state */
.sg-gate.in-view .sg-gate-node {
    background: var(--gate-color);
    box-shadow: 0 0 12px var(--gate-color), 0 0 24px rgba(0, 0, 0, 0.3);
}
.sg-gate.in-view .sg-gate-node::after { opacity: 0.3; }

/* Heart gate (4) — emphasized */
.sg-gate[data-gate="4"] .sg-gate-node {
    width: var(--sg-node-size-heart);
    height: var(--sg-node-size-heart);
}
.sg-gate[data-gate="4"].in-view .sg-gate-node {
    animation: sg-heartbeat 2s ease-in-out infinite;
}
@keyframes sg-heartbeat {
    0%, 100% { box-shadow: 0 0 12px var(--sg-c4), 0 0 24px rgba(0,0,0,0.3); transform: translate(-50%, -50%) scale(1); }
    15% { transform: translate(-50%, -50%) scale(1.12); box-shadow: 0 0 20px var(--sg-c4), 0 0 40px var(--sg-gold-glow); }
    30% { transform: translate(-50%, -50%) scale(1); }
    45% { transform: translate(-50%, -50%) scale(1.08); box-shadow: 0 0 16px var(--sg-c4), 0 0 32px var(--sg-gold-glow); }
}

/* ---- Gate Content ---- */
.sg-gate-content {
    max-width: var(--sg-content-max);
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}
.sg-gate.in-view .sg-gate-content {
    opacity: 1;
    transform: translateY(0);
}

.sg-gate-label {
    font-family: var(--sg-mono);
    font-size: 0.7rem;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: var(--gate-color);
    margin-bottom: 4px;
}
.sg-gate-name {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 200;
    letter-spacing: 0.06em;
    line-height: 1.15;
    color: var(--th-text-primary, #fff);
    margin: 0 0 12px;
}
.sg-gate-desc {
    font-size: clamp(0.85rem, 1.3vw, 0.95rem);
    line-height: 1.75;
    color: var(--th-text-secondary, var(--sg-text-muted));
    margin-bottom: 24px;
}

/* ---- Gate Card (program info) ---- */
.sg-gate-card {
    background: var(--th-bg-surface, var(--sg-panel));
    border: 1px solid var(--sg-panel-border);
    border-radius: 12px;
    padding: 20px 24px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: relative;
    overflow: hidden;
}
.sg-gate-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gate-color), transparent);
    opacity: 0.6;
}

.sg-card-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 12px;
    flex-wrap: wrap;
}
.sg-card-row:last-child { margin-bottom: 0; }

.sg-card-label {
    font-family: var(--sg-mono);
    font-size: 0.6rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--sg-text-dim);
    flex-shrink: 0;
    min-width: 70px;
}
.sg-card-value {
    font-size: 0.85rem;
    color: var(--th-text-primary, var(--sg-text));
    letter-spacing: 0.02em;
}
.sg-card-value.highlight {
    color: var(--gate-color);
    font-weight: 500;
}

/* Agent dot indicator */
.sg-agent-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gate-color);
    margin-right: 6px;
    vertical-align: middle;
    box-shadow: 0 0 4px var(--gate-color);
}

/* ---- Enrollment Status Badge ---- */
.sg-gate-status {
    margin-top: 16px;
    font-family: var(--sg-mono);
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    padding: 6px 14px;
    border-radius: 20px;
    display: inline-block;
}
/* Default state (pre-auth) */
.sg-gate[data-state="default"] .sg-gate-status {
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--sg-text-dim);
}
.sg-gate[data-state="locked"] .sg-gate-status {
    border: 1px dashed var(--sg-text-dim);
    color: var(--sg-text-dim);
}
.sg-gate[data-state="active"] .sg-gate-status {
    border: 1px solid var(--gate-color);
    color: var(--gate-color);
    animation: sg-breathe 3s ease-in-out infinite;
}
.sg-gate[data-state="completed"] .sg-gate-status {
    background: var(--gate-color);
    color: #000;
    font-weight: 600;
}
@keyframes sg-breathe {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Locked gate dim */
.sg-gate[data-state="locked"] .sg-gate-node {
    opacity: 0.25;
    border-style: dashed;
}
.sg-gate[data-state="locked"] .sg-gate-card {
    opacity: 0.5;
}

/* Completed gate glow */
.sg-gate[data-state="completed"] .sg-gate-node {
    background: var(--gate-color);
    box-shadow: 0 0 20px var(--gate-color), 0 0 40px rgba(0, 0, 0, 0.3);
}

/* ---- Finale Section ---- */
.sg-finale {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 24px;
    position: relative;
    z-index: 3;
}
.sg-finale-text {
    font-size: clamp(1rem, 2vw, 1.3rem);
    font-weight: 200;
    line-height: 1.8;
    color: var(--th-text-secondary, var(--sg-text-muted));
    max-width: 520px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}
.sg-finale.in-view .sg-finale-text {
    opacity: 0.8;
    transform: translateY(0);
}
.sg-finale-cta {
    margin-top: 32px;
    display: inline-block;
    font-family: var(--sg-mono);
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--sg-gold);
    border: 1px solid var(--sg-gold-dim);
    border-radius: 4px;
    padding: 12px 28px;
    text-decoration: none;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
}
.sg-finale.in-view .sg-finale-cta {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.3s;
}
.sg-finale-cta:hover {
    background: rgba(212, 175, 55, 0.08);
    border-color: var(--sg-gold);
    box-shadow: 0 0 12px var(--sg-gold-glow);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet */
@media (max-width: 1024px) {
    .sg-gate[data-gate] .sg-gate-content {
        margin-left: 72px;
        margin-right: 0;
        text-align: left;
        max-width: 100%;
    }
    .sg-pillar {
        left: 32px;
        transform: none;
    }
    .sg-gate-node {
        left: 32px !important;
        transform: translate(-50%, -50%);
    }
    .sg-progress { right: 12px; gap: 12px; }
    .sg-progress-dot { width: 8px; height: 8px; }
}

/* Mobile */
@media (max-width: 767px) {
    .sg-pillar { display: none; }
    #sg-particles { display: none; }
    .sg-gate-node {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        transform: none;
        margin: 0 auto 16px;
    }
    /* Preserve heartbeat animation on mobile */
    .sg-gate[data-gate="4"].in-view .sg-gate-node {
        transform: none;
        animation: sg-heartbeat-mobile 2s ease-in-out infinite;
    }
    .sg-gate {
        min-height: auto;
        padding: 48px 20px;
        flex-direction: column;
        justify-content: center !important;
        border-left: 3px solid var(--gate-color);
    }
    .sg-gate:nth-child(odd) .sg-gate-content,
    .sg-gate:nth-child(even) .sg-gate-content {
        margin: 0;
        text-align: left;
        max-width: 100%;
    }
    .sg-gate-card { padding: 16px 18px; }
    .sg-hero { min-height: 85vh; min-height: 85dvh; padding: 60px 20px 40px; }
    .sg-progress {
        position: fixed;
        bottom: 12px;
        top: auto;
        right: auto;
        left: 50%;
        transform: translateX(-50%) translateY(0);
        flex-direction: row;
        gap: 10px;
        background: rgba(5, 5, 8, 0.85);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        padding: 8px 16px;
        border-radius: 20px;
        border: 1px solid var(--sg-panel-border);
    }
    .sg-finale { min-height: 50vh; padding: 60px 20px; }
}

@keyframes sg-heartbeat-mobile {
    0%, 100% { box-shadow: 0 0 12px var(--sg-c4), 0 0 24px rgba(0,0,0,0.3); transform: scale(1); }
    15% { transform: scale(1.12); box-shadow: 0 0 20px var(--sg-c4), 0 0 40px var(--sg-gold-glow); }
    30% { transform: scale(1); }
    45% { transform: scale(1.08); box-shadow: 0 0 16px var(--sg-c4), 0 0 32px var(--sg-gold-glow); }
}

/* Small phone */
@media (max-width: 480px) {
    .sg-hero-title { letter-spacing: 0.04em; }
    .sg-gate { padding: 36px 16px; }
    .sg-gate-name { font-size: 1.6rem; }
    .sg-gate-card { padding: 14px 16px; }
    .sg-card-row { flex-direction: column; gap: 2px; }
    .sg-card-label { min-width: auto; }
}

/* Very small */
@media (max-width: 389px) {
    .sg-progress { display: none; }
    .sg-gate { padding: 28px 12px; }
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
    .sg-scanline { transition: none; }
    #sg-main { transition: none; opacity: 1; }
    .sg-gate-content { opacity: 1; transform: none; transition: none; }
    .sg-hero-eyebrow, .sg-hero-title, .sg-hero-sub, .sg-hero-rule {
        opacity: 1; transform: none; transition: none;
    }
    .sg-pillar { animation: none; }
    .sg-gate[data-gate="4"].in-view .sg-gate-node { animation: none; }
    .sg-gate[data-state="active"] .sg-gate-status { animation: none; opacity: 1; }
    .sg-scroll-cue { display: none; }
}
