/* ==============================================
   gamelicen.se — Dark-Neon Scandinavian
   ============================================== */

:root {
    --accent-cyan: #00E5CC;
    --accent-magenta: #E040A0;
    --accent-violet: #7B5CFF;
    --bg-void: #0A0A14;
    --bg-elevated: #12121F;
    --text-primary: #E8E8F0;
    --text-secondary: #8888A0;
    --gutter: 24px;
    --margin-desktop: 80px;
    --margin-mobile: 24px;
}

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

html {
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

html::-webkit-scrollbar {
    display: none;
}

body {
    background-color: var(--bg-void);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    line-height: 1.6;
    overflow-x: hidden;
    cursor: none;
}

/* ---- Custom Cursor ---- */
.custom-cursor {
    position: fixed;
    width: 12px;
    height: 12px;
    border: 1.5px solid var(--accent-cyan);
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease, background-color 0.3s ease;
}

body:has(.flip-card:hover) .custom-cursor,
body:has(.dot:hover) .custom-cursor {
    width: 24px;
    height: 24px;
    background-color: rgba(0, 229, 204, 0.2);
}

/* ---- Dot Navigation ---- */
.dot-nav {
    position: fixed;
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 1000;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid var(--text-secondary);
    opacity: 0.4;
    transition: all 0.4s ease;
}

.dot.active {
    background-color: var(--accent-cyan);
    border-color: var(--accent-cyan);
    opacity: 1;
    box-shadow: 0 0 8px rgba(0, 229, 204, 0.4);
}

/* ---- SVG Defs (hidden) ---- */
.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ---- Chapter Base ---- */
.chapter {
    position: relative;
    min-height: 100vh;
    padding: 0 var(--margin-desktop);
    overflow: hidden;
}

.chapter-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--gutter);
    height: 100%;
    min-height: inherit;
    align-content: center;
}

.chapter-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 4.5vw;
    color: var(--text-primary);
    line-height: 1.1;
}

.mono-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    color: var(--accent-cyan);
}

/* ---- Flowing Curves ---- */
.flowing-curve {
    position: absolute;
    width: 70%;
    height: auto;
    pointer-events: none;
    z-index: 1;
    opacity: 0.7;
}

.flowing-curve path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 2s ease-out;
}

.flowing-curve.drawn path {
    stroke-dashoffset: 0;
}

/* ---- Glow Pools (Ambient Lighting) ---- */
.chapter::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 30% 50%, rgba(0, 229, 204, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ==============================================
   CHAPTER 1: ORIGIN
   ============================================== */
.chapter-origin {
    min-height: 100vh;
    display: flex;
    align-items: center;
}

.chapter-origin .chapter-grid {
    position: relative;
    z-index: 2;
    width: 100%;
}

.hero-title {
    grid-column: 1 / 9;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 12vw;
    line-height: 1;
    color: var(--text-primary);
    opacity: 0;
    transition: opacity 1.2s ease;
    position: relative;
}

.hero-title.visible {
    opacity: 1;
}

.hero-title::after {
    content: '';
    position: absolute;
    right: -0.05em;
    bottom: 0.05em;
    width: 0.6em;
    height: 0.6em;
    border-radius: 50%;
    background: transparent;
    box-shadow: 0 0 20px rgba(0, 229, 204, 0.5), 0 0 60px rgba(0, 229, 204, 0.2);
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.1); }
}

.origin-shapes {
    grid-column: 6 / 12;
    position: relative;
    height: 300px;
    margin-top: 40px;
}

.orbit-shape {
    position: absolute;
    animation: drift 20s ease-in-out infinite alternate;
}

.shape-circle {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    border: 1.5px solid var(--accent-cyan);
    top: 20px;
    right: 60px;
    animation-delay: 0s;
}

.shape-rect {
    width: 240px;
    height: 140px;
    border-radius: 50px;
    border: 1px solid var(--accent-magenta);
    background-color: var(--bg-elevated);
    top: 80px;
    right: 180px;
    transform: rotate(5deg);
    animation-delay: -5s;
}

.shape-circle-sm {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 1.5px solid var(--accent-violet);
    top: 180px;
    right: 30px;
    animation-delay: -10s;
}

@keyframes drift {
    0% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(15px, -20px) rotate(3deg); }
    50% { transform: translate(-10px, 10px) rotate(-2deg); }
    75% { transform: translate(20px, 15px) rotate(4deg); }
    100% { transform: translate(-5px, -10px) rotate(-1deg); }
}

.origin-curve {
    bottom: 40px;
    left: 15%;
}

/* ==============================================
   CHAPTER 2: FRAMEWORK
   ============================================== */
.chapter-framework {
    min-height: 100vh;
    padding-top: 160px;
    padding-bottom: 160px;
}

.chapter-framework::before {
    background: radial-gradient(ellipse at 70% 40%, rgba(224, 64, 160, 0.06) 0%, transparent 70%);
}

.framework-heading {
    grid-column: 1 / 7;
    margin-bottom: 60px;
}

.card-container {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--gutter);
    min-height: 400px;
    align-items: start;
}

.flip-card {
    perspective: 1200px;
    width: 240px;
    height: 340px;
    cursor: none;
}

.flip-card:nth-child(1) {
    grid-column: 2 / 4;
    margin-top: 0;
}

.flip-card:nth-child(2) {
    grid-column: 5 / 7;
    margin-top: 80px;
}

.flip-card:nth-child(3) {
    grid-column: 9 / 11;
    margin-top: 160px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s ease-in-out;
    transform-style: preserve-3d;
}

.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.flip-card-front {
    background-color: var(--bg-elevated);
    border: 1px solid var(--accent-cyan);
}

.flip-card-back {
    background-color: var(--bg-elevated);
    border-top: 3px solid transparent;
    border-image: linear-gradient(135deg, #00E5CC 0%, #7B5CFF 50%, #E040A0 100%) 1;
    transform: rotateY(180deg);
}

.flip-card-back p {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
}

.card-shape {
    opacity: 0.8;
}

.card-shape-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 1.5px solid var(--accent-cyan);
}

.card-shape-rect {
    width: 120px;
    height: 80px;
    border-radius: 40px;
    border: 1px solid var(--accent-magenta);
    background-color: rgba(224, 64, 160, 0.05);
}

.card-shape-curve {
    width: 140px;
    height: 140px;
}

.card-shape-curve svg {
    width: 100%;
    height: 100%;
}

.framework-curve {
    bottom: 80px;
    left: 10%;
    opacity: 0;
    transition: opacity 1s ease;
}

.framework-curve.visible {
    opacity: 0.7;
}

/* ==============================================
   CHAPTER 3: SPECTRUM
   ============================================== */
.chapter-spectrum {
    min-height: 120vh;
    padding-top: 160px;
    padding-bottom: 160px;
}

.chapter-spectrum::before {
    background: radial-gradient(ellipse at 60% 60%, rgba(123, 92, 255, 0.06) 0%, transparent 70%);
}

.spectrum-heading {
    grid-column: 4 / 12;
}

.spectrum-content {
    grid-column: 4 / 10;
    margin-top: 40px;
}

.spectrum-text {
    font-size: 1.2rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.spectrum-labels {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
}

.spectrum-curves {
    position: absolute;
    top: 30%;
    left: 0;
    width: 100%;
    height: 40%;
    pointer-events: none;
    z-index: 1;
}

.spectrum-path {
    stroke-dasharray: 3000;
    stroke-dashoffset: 3000;
    transition: stroke-dashoffset 0.1s linear;
    filter: blur(0.5px);
}

/* ==============================================
   CHAPTER 4: STRUCTURE
   ============================================== */
.chapter-structure {
    min-height: 100vh;
    padding-top: 160px;
    padding-bottom: 160px;
}

.chapter-structure::before {
    background: radial-gradient(ellipse at 40% 50%, rgba(0, 229, 204, 0.06) 0%, transparent 60%),
                radial-gradient(ellipse at 70% 60%, rgba(224, 64, 160, 0.04) 0%, transparent 60%);
}

.structure-composition {
    grid-column: 3 / 11;
    position: relative;
    min-height: 600px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.structure-shape {
    position: absolute;
    mix-blend-mode: screen;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.structure-shape.visible {
    opacity: 1;
    transform: scale(1);
}

.shape-lg-circle {
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 229, 204, 0.15) 0%, rgba(0, 229, 204, 0.02) 70%);
    border: 1.5px solid rgba(0, 229, 204, 0.2);
    top: 50px;
    left: -20px;
}

.shape-lg-rect {
    width: 400px;
    height: 250px;
    border-radius: 50px;
    background: rgba(224, 64, 160, 0.1);
    border: 1px solid rgba(224, 64, 160, 0.15);
    top: 120px;
    right: -40px;
    transform: rotate(-3deg) scale(0.9);
}

.shape-lg-rect.visible {
    transform: rotate(-3deg) scale(1);
}

.shape-md-circle {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(123, 92, 255, 0.2) 0%, rgba(123, 92, 255, 0.03) 70%);
    border: 1.5px solid rgba(123, 92, 255, 0.2);
    bottom: 80px;
    left: 30%;
}

.shape-bezier-wrap {
    width: 500px;
    height: 300px;
    top: 100px;
    left: 10%;
}

.shape-bezier-wrap svg {
    width: 100%;
    height: 100%;
}

.structure-text-block {
    position: relative;
    z-index: 5;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(10, 10, 20, 0.6);
    padding: 32px;
    border-radius: 12px;
}

.block-1 {
    max-width: 480px;
    margin-bottom: 40px;
}

.block-1 .chapter-heading {
    margin-bottom: 16px;
}

.block-1 p,
.block-2 p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.7;
}

.block-2 {
    max-width: 400px;
    align-self: flex-end;
    margin-left: auto;
}

.block-2 .mono-label {
    display: block;
    margin-top: 16px;
}

.structure-curve {
    bottom: 60px;
    left: 15%;
}

/* ==============================================
   CHAPTER 5: HORIZON
   ============================================== */
.chapter-horizon {
    min-height: 80vh;
    display: flex;
    align-items: center;
}

.chapter-horizon::before {
    background: radial-gradient(ellipse at 20% 70%, rgba(123, 92, 255, 0.06) 0%, transparent 70%);
}

.chapter-horizon .chapter-grid {
    width: 100%;
}

.horizon-echo {
    grid-column: 2 / 8;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.echo-line {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 6vw;
    line-height: 1.1;
    display: block;
    opacity: 0;
    transform: translateX(-60px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.echo-line.visible {
    transform: translateX(0);
}

.echo-1 {
    color: var(--text-primary);
}

.echo-1.visible {
    opacity: 1;
}

.echo-2 {
    color: var(--text-primary);
}

.echo-2.visible {
    opacity: 0.4;
    transition-delay: 0.3s;
}

.echo-3 {
    color: var(--text-primary);
}

.echo-3.visible {
    opacity: 0.15;
    transition-delay: 0.6s;
}

.horizon-curve {
    bottom: 60px;
    left: 10%;
    width: 80%;
}

.horizon-curve path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 0;
    animation: drawUndraw 8s ease-in-out infinite alternate;
}

@keyframes drawUndraw {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 2000; }
}

/* ==============================================
   SECTION SEPARATORS (Void-Fade)
   ============================================== */
.chapter + .chapter::after {
    content: '';
    position: absolute;
    top: -80px;
    left: 0;
    right: 0;
    height: 160px;
    background: linear-gradient(180deg, var(--bg-void) 0%, var(--bg-elevated) 50%, var(--bg-void) 100%);
    pointer-events: none;
    z-index: 0;
    opacity: 0.3;
}

/* ==============================================
   RESPONSIVE
   ============================================== */
@media (max-width: 768px) {
    .chapter {
        padding: 0 var(--margin-mobile);
    }

    .hero-title {
        grid-column: 1 / -1;
        font-size: 14vw;
    }

    .origin-shapes {
        grid-column: 1 / -1;
        height: 200px;
    }

    .shape-circle { width: 120px; height: 120px; right: 20px; }
    .shape-rect { width: 160px; height: 100px; right: 80px; }
    .shape-circle-sm { width: 60px; height: 60px; right: 10px; }

    .chapter-heading {
        font-size: 8vw;
    }

    .framework-heading {
        grid-column: 1 / -1;
    }

    .card-container {
        display: flex;
        flex-direction: column;
        gap: 24px;
        align-items: center;
    }

    .flip-card {
        width: 200px;
        height: 280px;
    }

    .flip-card:nth-child(2),
    .flip-card:nth-child(3) {
        margin-top: 0;
    }

    .spectrum-heading {
        grid-column: 1 / -1;
    }

    .spectrum-content {
        grid-column: 1 / -1;
    }

    .spectrum-labels {
        gap: 16px;
    }

    .structure-composition {
        grid-column: 1 / -1;
        min-height: 500px;
    }

    .shape-lg-circle { width: 200px; height: 200px; }
    .shape-lg-rect { width: 260px; height: 170px; }
    .shape-md-circle { width: 100px; height: 100px; }

    .horizon-echo {
        grid-column: 1 / -1;
    }

    .echo-line {
        font-size: 10vw;
    }

    .dot-nav {
        right: 16px;
    }

    .chapter-framework,
    .chapter-spectrum,
    .chapter-structure {
        padding-top: 80px;
        padding-bottom: 80px;
    }
}
