/* ============================================
   continua.st -- Styles
   Isometric + Ma + Jewel Tones + Glassmorphism
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --deep-bg: #1A0F30;
    --byzantine: #2D1B4E;
    --persian-green: #1B998B;
    --deep-magenta: #6A0572;
    --cerise: #C2185B;
    --champagne: #E8B4B8;
    --bone-white: #E8DCD0;
    --sapphire: #1A3A5C;
    --amethyst-mist: #3D2560;
    --topaz-gold: #D4A843;
    --glass-bg: rgba(109, 68, 155, 0.12);
    --glass-border: rgba(232, 180, 184, 0.18);
    --glass-shadow: rgba(26, 15, 48, 0.4);
    --extrusion-color: rgba(26, 15, 48, 0.6);
    --grid-color: #3D2560;
}

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

html {
    scroll-behavior: smooth;
    background: var(--deep-bg);
    overflow-x: hidden;
}

body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 380;
    font-size: clamp(1.05rem, 1.2vw + 0.5rem, 1.35rem);
    line-height: 1.9;
    color: var(--bone-white);
    background: var(--deep-bg);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Isometric Grid Background --- */
.iso-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    background:
        repeating-linear-gradient(
            30deg,
            var(--grid-color) 0px,
            var(--grid-color) 0.5px,
            transparent 0.5px,
            transparent 60px
        ),
        repeating-linear-gradient(
            150deg,
            var(--grid-color) 0px,
            var(--grid-color) 0.5px,
            transparent 0.5px,
            transparent 60px
        );
    opacity: 0.1;
    transition: opacity 4s ease;
}

.iso-grid.breathing {
    animation: gridBreathe 4s ease-in-out infinite;
}

@keyframes gridBreathe {
    0%, 100% { opacity: 0.08; }
    50% { opacity: 0.15; }
}

/* --- Continuity Thread SVG --- */
.continuity-thread {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
}

/* --- Floating Decorative Shapes --- */
.floating-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.float-shape {
    position: absolute;
    opacity: 0;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

.shape-cube {
    width: 40px;
    height: 40px;
    background: rgba(27, 153, 139, 0.08);
    border: 1px solid rgba(27, 153, 139, 0.12);
    transform: rotate(45deg);
}

.shape-step {
    width: 60px;
    height: 30px;
    background: rgba(106, 5, 114, 0.06);
    border: 1px solid rgba(106, 5, 114, 0.1);
    clip-path: polygon(0% 50%, 50% 50%, 50% 0%, 100% 0%, 100% 100%, 0% 100%);
}

.shape-l {
    width: 50px;
    height: 50px;
    background: rgba(194, 24, 91, 0.05);
    border: 1px solid rgba(194, 24, 91, 0.08);
    clip-path: polygon(0% 0%, 40% 0%, 40% 60%, 100% 60%, 100% 100%, 0% 100%);
}

.shape-1 {
    top: 15%;
    left: 8%;
    opacity: 1;
    animation: floatRotate 120s linear infinite;
}

.shape-2 {
    top: 35%;
    right: 12%;
    opacity: 1;
    animation: floatRotate 100s linear infinite reverse;
}

.shape-3 {
    top: 55%;
    left: 5%;
    opacity: 1;
    animation: floatRotate 90s linear infinite;
}

.shape-4 {
    top: 72%;
    right: 7%;
    opacity: 1;
    animation: floatRotate 110s linear infinite reverse;
}

.shape-5 {
    top: 25%;
    right: 25%;
    opacity: 1;
    animation: floatRotate 130s linear infinite;
}

.shape-6 {
    top: 80%;
    left: 20%;
    opacity: 1;
    animation: floatRotate 105s linear infinite reverse;
}

@keyframes floatRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --- Isometric Navigation Cube --- */
.iso-nav {
    position: fixed;
    top: 32px;
    left: 32px;
    z-index: 1000;
    perspective: 400px;
}

.cube-wrapper {
    width: 56px;
    height: 56px;
}

.cube {
    width: 56px;
    height: 56px;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(-25deg) rotateY(-25deg);
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    cursor: pointer;
}

.cube-face {
    position: absolute;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(232, 180, 184, 0.25);
    backdrop-filter: blur(8px);
    transition: background 0.3s ease;
}

.cube-front {
    background: rgba(106, 5, 114, 0.7);
    transform: translateZ(28px);
}

.cube-back {
    background: rgba(27, 153, 139, 0.7);
    transform: rotateY(180deg) translateZ(28px);
}

.cube-right {
    background: rgba(194, 24, 91, 0.7);
    transform: rotateY(90deg) translateZ(28px);
}

.cube-left {
    background: rgba(26, 58, 92, 0.7);
    transform: rotateY(-90deg) translateZ(28px);
}

.cube-top {
    background: rgba(212, 168, 67, 0.7);
    transform: rotateX(90deg) translateZ(28px);
}

.cube-bottom {
    background: rgba(45, 27, 78, 0.7);
    transform: rotateX(-90deg) translateZ(28px);
}

.cube-label {
    font-family: 'Recursive', monospace;
    font-variation-settings: 'MONO' 1, 'CASL' 0;
    font-weight: 400;
    font-size: clamp(0.7rem, 0.8vw, 0.95rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--bone-white);
    transition: font-variation-settings 0.3s ease;
}

.cube-face:hover .cube-label {
    font-variation-settings: 'MONO' 0, 'CASL' 1;
}

/* --- Sections Base --- */
.section {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 100px 40px;
}

.section + .section {
    margin-top: 200px;
}

/* --- Section Counter --- */
.section-counter {
    font-family: 'Recursive', monospace;
    font-variation-settings: 'MONO' 1, 'CASL' 0;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 10rem);
    font-variant-numeric: tabular-nums;
    color: var(--topaz-gold);
    position: absolute;
    top: 40px;
    right: 60px;
    opacity: 0.25;
    z-index: 1;
    pointer-events: none;
}

.section-heading {
    font-family: 'Recursive', sans-serif;
    font-variation-settings: 'CASL' 0, 'MONO' 0;
    font-weight: 800;
    font-size: clamp(2.5rem, 5vw + 1rem, 6rem);
    letter-spacing: 0.02em;
    color: var(--bone-white);
    margin-bottom: 80px;
    transition: font-variation-settings 0.4s ease;
    text-align: left;
    align-self: flex-start;
    padding-left: 10%;
}

.section-heading:hover {
    font-variation-settings: 'CASL' 1, 'MONO' 0;
}

/* --- Glassmorphic Card --- */
.glass-card {
    background: var(--glass-bg);
    background-image: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.05),
        transparent
    );
    backdrop-filter: blur(24px) saturate(1.3);
    -webkit-backdrop-filter: blur(24px) saturate(1.3);
    border: 1px solid var(--glass-border);
    border-radius: 2px;
    box-shadow: 0 8px 32px var(--glass-shadow);
    position: relative;
}

/* --- Isometric Extrusion --- */
.iso-extrude {
    position: relative;
}

.iso-extrude::after {
    content: '';
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 100%;
    height: 100%;
    background: var(--extrusion-color);
    transform: skew(-2deg, -1deg) translate(4px, 4px);
    z-index: -1;
    border-radius: 2px;
    pointer-events: none;
}

/* --- Hero Section --- */
.section-hero {
    min-height: 120vh;
    background: radial-gradient(ellipse at center, var(--byzantine) 0%, var(--deep-bg) 70%);
}

.hero-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 60px;
}

.pyramid-structure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    animation: pyramidRotate 30s ease-in-out infinite;
    perspective: 600px;
}

@keyframes pyramidRotate {
    0%, 100% { transform: rotateY(0deg); }
    50% { transform: rotateY(8deg); }
}

.pyramid-level {
    transition: transform 0.5s ease;
}

.pyramid-level-1 {
    width: 280px;
    height: 80px;
}

.pyramid-level-2 {
    width: 200px;
    height: 80px;
}

.pyramid-level-3 {
    width: 120px;
    height: 80px;
}

.hero-title-container {
    text-align: center;
}

.hero-title {
    font-family: 'Recursive', sans-serif;
    font-variation-settings: 'CASL' 0, 'MONO' 0;
    font-weight: 800;
    font-size: clamp(3rem, 8vw + 1rem, 10rem);
    letter-spacing: 0.06em;
    color: var(--bone-white);
    display: flex;
    gap: 0.02em;
    justify-content: center;
    transition: font-variation-settings 0.4s ease;
}

.hero-title:hover {
    font-variation-settings: 'CASL' 1, 'MONO' 0;
}

.title-letter {
    display: inline-block;
    font-variant-numeric: tabular-nums;
    transition: color 0.2s ease;
}

.hero-subtitle {
    margin-top: 20px;
    font-size: clamp(0.8rem, 1vw, 1.1rem);
}

/* --- Accent Label --- */
.accent-label {
    font-family: 'Recursive', monospace;
    font-variation-settings: 'MONO' 1, 'CASL' 0;
    font-weight: 400;
    font-size: clamp(0.7rem, 0.8vw, 0.95rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--persian-green);
}

/* --- Concept Corridor --- */
.section-concepts {
    padding-bottom: 200px;
}

.concept-corridor {
    display: flex;
    gap: 80px;
    overflow-x: auto;
    padding: 40px 10%;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    max-width: 100vw;
}

.concept-corridor::-webkit-scrollbar {
    display: none;
}

.concept-tile {
    flex: 0 0 320px;
    padding: 40px 32px;
    scroll-snap-align: center;
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.concept-tile[data-depth="foreground"] {
    opacity: 1;
    transform: scale(1);
}

.concept-tile[data-depth="midground"] {
    opacity: 0.85;
    transform: scale(0.95);
}

.concept-tile[data-depth="background"] {
    opacity: 0.65;
    transform: scale(0.88);
}

.concept-title {
    font-family: 'Recursive', sans-serif;
    font-variation-settings: 'CASL' 0, 'MONO' 0;
    font-weight: 800;
    font-size: clamp(1.4rem, 2vw, 2rem);
    letter-spacing: 0.02em;
    color: var(--champagne);
    transition: font-variation-settings 0.4s ease;
}

.concept-tile:hover .concept-title {
    font-variation-settings: 'CASL' 1, 'MONO' 0;
}

.concept-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 380;
    font-size: clamp(0.95rem, 1.1vw + 0.3rem, 1.15rem);
    line-height: 1.9;
    color: var(--bone-white);
    font-optical-sizing: auto;
}

.concept-counter {
    align-self: flex-end;
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    font-variant-numeric: tabular-nums;
}

/* --- Deep Dive Sections --- */
.section-deep {
    background: radial-gradient(ellipse at 50% 50%, var(--byzantine) 0%, var(--deep-bg) 60%);
}

.section-deep-alt {
    background: radial-gradient(ellipse at 30% 50%, rgba(26, 58, 92, 0.3) 0%, var(--deep-bg) 60%);
}

.deep-card {
    max-width: 680px;
    width: 90%;
    padding: 60px 48px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.deep-title {
    font-family: 'Recursive', sans-serif;
    font-variation-settings: 'CASL' 0, 'MONO' 0;
    font-weight: 800;
    font-size: clamp(2rem, 4vw + 0.5rem, 4rem);
    letter-spacing: 0.02em;
    color: var(--bone-white);
    margin-bottom: 40px;
    transition: font-variation-settings 0.4s ease;
}

.deep-title:hover {
    font-variation-settings: 'CASL' 1, 'MONO' 0;
}

.deep-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 380;
    line-height: 1.9;
    color: var(--bone-white);
    margin-bottom: 2em;
    font-optical-sizing: auto;
}

.deep-text:last-of-type {
    margin-bottom: 40px;
}

.deep-counter-row {
    display: flex;
    gap: 60px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.deep-counter-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.counter-large {
    font-family: 'Recursive', monospace;
    font-variation-settings: 'MONO' 1, 'CASL' 0;
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 5rem);
    font-variant-numeric: tabular-nums;
    color: var(--topaz-gold);
    line-height: 1;
}

.counter-label {
    font-size: clamp(0.65rem, 0.75vw, 0.85rem);
}

/* --- Coda Section --- */
.section-coda {
    min-height: 100vh;
    background: radial-gradient(ellipse at center, var(--byzantine) 0%, var(--deep-bg) 70%);
}

.coda-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.coda-card {
    max-width: 600px;
    width: 90%;
    padding: 60px 48px;
    text-align: center;
}

.coda-title {
    font-family: 'Recursive', sans-serif;
    font-variation-settings: 'CASL' 0, 'MONO' 0;
    font-weight: 800;
    font-size: clamp(1.8rem, 3.5vw + 0.5rem, 3.5rem);
    letter-spacing: 0.02em;
    color: var(--champagne);
    margin-bottom: 24px;
    transition: font-variation-settings 0.4s ease;
}

.coda-title:hover {
    font-variation-settings: 'CASL' 1, 'MONO' 0;
}

.coda-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 380;
    line-height: 1.9;
    color: var(--bone-white);
    margin-bottom: 40px;
    font-optical-sizing: auto;
}

.coda-symbol {
    margin-top: 20px;
}

.counter-symbol {
    font-family: 'Recursive', monospace;
    font-variation-settings: 'MONO' 1, 'CASL' 0;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 8rem);
    font-variant-numeric: tabular-nums;
    color: var(--persian-green);
    line-height: 1;
}

/* --- Grid Glow Behind Content --- */
.section::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 600px;
    height: 600px;
    transform: translate(-50%, -50%);
    background: radial-gradient(
        ellipse,
        rgba(61, 37, 96, 0.3) 0%,
        transparent 70%
    );
    pointer-events: none;
    z-index: -1;
}

/* --- Scroll-based reveal animation --- */
.glass-card,
.deep-card,
.coda-card {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.glass-card.visible,
.deep-card.visible,
.coda-card.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Override for depth tiles */
.concept-tile.visible[data-depth="midground"] {
    opacity: 0.85;
    transform: scale(0.95) translateY(0);
}

.concept-tile.visible[data-depth="background"] {
    opacity: 0.65;
    transform: scale(0.88) translateY(0);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .section {
        padding: 60px 20px;
    }

    .section + .section {
        margin-top: 100px;
    }

    .concept-corridor {
        gap: 40px;
        padding: 20px 5%;
    }

    .concept-tile {
        flex: 0 0 280px;
    }

    .deep-card,
    .coda-card {
        padding: 40px 28px;
    }

    .deep-counter-row {
        gap: 30px;
    }

    .section-counter {
        font-size: clamp(2rem, 6vw, 5rem);
        top: 20px;
        right: 20px;
    }

    .section-heading {
        padding-left: 5%;
        margin-bottom: 40px;
    }

    .iso-nav {
        top: 16px;
        left: 16px;
    }

    .cube-wrapper,
    .cube,
    .cube-face {
        width: 44px;
        height: 44px;
    }

    .cube-front { transform: translateZ(22px); }
    .cube-back { transform: rotateY(180deg) translateZ(22px); }
    .cube-right { transform: rotateY(90deg) translateZ(22px); }
    .cube-left { transform: rotateY(-90deg) translateZ(22px); }
    .cube-top { transform: rotateX(90deg) translateZ(22px); }
    .cube-bottom { transform: rotateX(-90deg) translateZ(22px); }

    .hero-title {
        font-size: clamp(2.5rem, 10vw, 5rem);
    }

    .pyramid-level-1 { width: 200px; height: 60px; }
    .pyramid-level-2 { width: 140px; height: 60px; }
    .pyramid-level-3 { width: 80px; height: 60px; }
}

@media (max-width: 480px) {
    .concept-corridor {
        flex-direction: column;
        align-items: center;
        overflow-x: visible;
    }

    .concept-tile {
        flex: 0 0 auto;
        width: 90%;
    }

    .deep-counter-row {
        flex-direction: column;
    }
}
