/* =============================================
   HHUDDL.com - Translucent Frost Design System
   ============================================= */

/* --- CSS Custom Properties --- */
:root {
    --frost-base: #EDF2F7;
    --deep-ice: #1A2332;
    --glass-surface: rgba(200, 215, 235, 0.35);
    --glass-surface-solid: #C8D7EB;
    --crystal-edge: #7EB8E0;
    --dopamine-violet: #8B5CF6;
    --dopamine-coral: #F43F5E;
    --warm-frost: #F8FAFC;
    --huddle-frost: #F0F4F8;
    --obsidian-depth: #0F172A;

    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Cormorant Garamond', Garamond, serif;
    --font-mono: 'Space Mono', 'Courier New', monospace;

    --grid-columns: 16;
    --grid-gutter: 24px;
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    background-color: var(--deep-ice);
    color: var(--frost-base);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Frost Rail Navigation --- */
#frost-rail {
    position: fixed;
    left: 0;
    top: 0;
    width: 60px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    z-index: 1000;
    background: rgba(26, 35, 50, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid rgba(126, 184, 224, 0.15);
}

.rail-glyph {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--crystal-edge);
    transition: color 0.3s ease, transform 0.3s ease;
    opacity: 0.6;
}

.rail-glyph:hover {
    opacity: 1;
    transform: scale(1.2);
}

.rail-glyph.active {
    color: var(--dopamine-violet);
    opacity: 1;
}

.rail-glyph.active svg {
    filter: drop-shadow(0 0 6px rgba(139, 92, 246, 0.5));
}

/* --- Section Base --- */
.section {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* --- Frost Panel Sections --- */
.frost-panel {
    min-height: 100vh;
    display: flex;
    align-items: center;
    background-color: var(--deep-ice);
    padding-left: 80px;
}

.frost-panel-bg {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 1;
}

/* --- Hero Section --- */
#chapter-hero {
    justify-content: flex-start;
    padding-left: 0;
    background: var(--deep-ice);
    transition: background 1.5s ease;
}

#chapter-hero.frost-revealed {
    background: linear-gradient(135deg, var(--deep-ice) 0%, rgba(26, 35, 50, 0.85) 50%, var(--deep-ice) 100%);
}

.hero-content {
    position: relative;
    z-index: 10;
    padding-left: calc(60px + 6vw);
    padding-right: 4vw;
    max-width: 80vw;
}

#hero-title {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(3rem, 8vw, 6rem);
    letter-spacing: -0.02em;
    color: var(--frost-base);
    line-height: 1.1;
    margin-bottom: 1.5rem;
    min-height: 1.2em;
    font-style: normal;
}

#hero-subtitle {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    letter-spacing: 0.08em;
    color: var(--crystal-edge);
    line-height: 1.6;
    min-height: 1.6em;
}

.hero-halo {
    position: absolute;
    top: 50%;
    left: 40%;
    transform: translate(-50%, -50%);
    width: 60vw;
    height: 60vw;
    max-width: 700px;
    max-height: 700px;
    background: radial-gradient(ellipse, rgba(255, 255, 255, 0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
}

/* --- Hero Background Shapes --- */
.hero-bg-shapes {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}

.crystalline-hex {
    position: absolute;
    width: 120px;
    height: 104px;
    opacity: 0;
    transition: opacity 1.2s ease;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.crystalline-hex.visible {
    opacity: 0.6;
}

.hex-1 {
    top: 15%;
    right: 12%;
    background: linear-gradient(135deg, rgba(126, 184, 224, 0.2), rgba(200, 215, 235, 0.1));
    border: 1px solid rgba(126, 184, 224, 0.3);
    width: 140px;
    height: 121px;
}

.hex-2 {
    top: 25%;
    right: 22%;
    background: linear-gradient(225deg, rgba(126, 184, 224, 0.15), rgba(237, 242, 247, 0.08));
    width: 100px;
    height: 87px;
}

.hex-3 {
    bottom: 30%;
    right: 8%;
    background: linear-gradient(45deg, rgba(200, 215, 235, 0.18), rgba(126, 184, 224, 0.1));
    width: 160px;
    height: 139px;
}

.hex-4 {
    bottom: 20%;
    right: 25%;
    background: linear-gradient(180deg, rgba(126, 184, 224, 0.12), rgba(237, 242, 247, 0.06));
    width: 80px;
    height: 69px;
}

.hex-5 {
    top: 40%;
    right: 35%;
    background: linear-gradient(90deg, rgba(200, 215, 235, 0.14), rgba(126, 184, 224, 0.08));
    width: 110px;
    height: 95px;
}

/* --- Prism Shards --- */
.prism-shard {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0.4;
}

.shard-1 {
    top: 10%;
    left: 70%;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-bottom: 80px solid rgba(126, 184, 224, 0.15);
    transform: rotate(15deg);
}

.shard-2 {
    bottom: 15%;
    left: 65%;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 60px solid rgba(200, 215, 235, 0.12);
    transform: rotate(75deg);
}

.shard-3 {
    top: 55%;
    right: 5%;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 70px solid rgba(237, 242, 247, 0.1);
    transform: rotate(-15deg);
}

/* --- Typewriter Cursor --- */
.typewriter-cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background-color: var(--dopamine-coral);
    vertical-align: text-bottom;
    animation: cursorBlink 530ms ease infinite;
    margin-left: 2px;
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* --- Glass Cards --- */
.glass-card {
    position: relative;
    z-index: 10;
    background: var(--glass-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    padding: 3rem 3.5rem;
    max-width: 680px;
    margin-left: 6vw;
    transition: backdrop-filter 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease, -webkit-backdrop-filter 0.4s ease;
}

.glass-card:hover {
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow: 0 8px 32px rgba(26, 35, 50, 0.12);
}

.section-title {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(2.5rem, 6vw, 5.5rem);
    letter-spacing: -0.02em;
    color: var(--frost-base);
    line-height: 1.1;
    margin-bottom: 1.5rem;
    font-style: normal;
}

.section-body {
    font-family: var(--font-body);
    font-size: 1.125rem;
    font-weight: 400;
    line-height: 1.85;
    color: var(--frost-base);
    margin-bottom: 1.25rem;
    opacity: 0.92;
}

.section-body:last-child {
    margin-bottom: 0;
}

/* --- Crystalline 3D Forms --- */
.crystalline-form {
    position: relative;
    width: 400px;
    height: 400px;
    transform-style: preserve-3d;
    transition: transform 0.1s linear;
}

/* Hexagonal Prism */
.hex-prism {
    width: 300px;
    height: 350px;
}

.prism-face {
    position: absolute;
    background: linear-gradient(135deg, rgba(126, 184, 224, 0.15), rgba(200, 215, 235, 0.08));
    border: 1px solid rgba(126, 184, 224, 0.25);
}

.face-1 {
    width: 150px;
    height: 350px;
    left: 0;
    top: 0;
    transform: rotateY(-30deg) translateZ(75px);
    background: linear-gradient(180deg, rgba(126, 184, 224, 0.2), rgba(237, 242, 247, 0.05));
}

.face-2 {
    width: 150px;
    height: 350px;
    left: 75px;
    top: 0;
    transform: rotateY(30deg) translateZ(75px);
    background: linear-gradient(180deg, rgba(200, 215, 235, 0.15), rgba(126, 184, 224, 0.05));
}

.face-3 {
    width: 150px;
    height: 350px;
    left: 150px;
    top: 0;
    transform: rotateY(90deg) translateZ(0);
    background: linear-gradient(180deg, rgba(237, 242, 247, 0.12), rgba(200, 215, 235, 0.04));
}

.face-4 {
    width: 300px;
    height: 150px;
    left: 0;
    top: 0;
    transform: rotateX(60deg) translateZ(100px);
    background: linear-gradient(90deg, rgba(126, 184, 224, 0.18), rgba(237, 242, 247, 0.08));
}

.face-5 {
    width: 300px;
    height: 150px;
    left: 0;
    bottom: 0;
    transform: rotateX(-60deg) translateZ(100px);
    background: linear-gradient(90deg, rgba(200, 215, 235, 0.12), rgba(126, 184, 224, 0.06));
}

.face-6 {
    width: 150px;
    height: 350px;
    right: 0;
    top: 0;
    transform: rotateY(-90deg) translateZ(0);
    background: linear-gradient(180deg, rgba(126, 184, 224, 0.1), rgba(237, 242, 247, 0.03));
}

/* Shard Cluster */
.shard-cluster {
    width: 350px;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.elongated-shard {
    position: absolute;
    background: linear-gradient(to top, rgba(126, 184, 224, 0.2), rgba(237, 242, 247, 0.08));
    border: 1px solid rgba(126, 184, 224, 0.2);
}

.s1 {
    width: 40px;
    height: 200px;
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    transform: rotate(15deg) translateX(-60px);
}

.s2 {
    width: 30px;
    height: 250px;
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    transform: rotate(-10deg) translateX(-20px);
    background: linear-gradient(to top, rgba(200, 215, 235, 0.18), rgba(126, 184, 224, 0.06));
}

.s3 {
    width: 50px;
    height: 300px;
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    transform: rotate(5deg) translateX(20px);
}

.s4 {
    width: 25px;
    height: 180px;
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    transform: rotate(75deg) translateX(50px) translateY(-30px);
    background: linear-gradient(to top, rgba(237, 242, 247, 0.15), rgba(200, 215, 235, 0.05));
}

.s5 {
    width: 35px;
    height: 220px;
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    transform: rotate(-25deg) translateX(60px);
    background: linear-gradient(to top, rgba(126, 184, 224, 0.16), rgba(237, 242, 247, 0.04));
}

/* Octahedron */
.octahedron-form {
    width: 300px;
    height: 300px;
    transform-style: preserve-3d;
}

.octa-face {
    position: absolute;
    width: 200px;
    height: 200px;
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    border: 1px solid rgba(126, 184, 224, 0.2);
}

.of-1 {
    top: 0;
    left: 50px;
    background: linear-gradient(180deg, rgba(126, 184, 224, 0.2), rgba(200, 215, 235, 0.08));
    transform: rotateX(30deg) translateZ(40px);
}

.of-2 {
    top: 0;
    left: 50px;
    background: linear-gradient(180deg, rgba(200, 215, 235, 0.15), rgba(237, 242, 247, 0.05));
    transform: rotateY(30deg) rotateX(30deg) translateZ(40px);
}

.of-3 {
    bottom: 0;
    left: 50px;
    background: linear-gradient(0deg, rgba(126, 184, 224, 0.18), rgba(200, 215, 235, 0.06));
    transform: rotateX(-30deg) translateZ(40px) scaleY(-1);
}

.of-4 {
    bottom: 0;
    left: 50px;
    background: linear-gradient(0deg, rgba(237, 242, 247, 0.12), rgba(126, 184, 224, 0.04));
    transform: rotateY(-30deg) rotateX(-30deg) translateZ(40px) scaleY(-1);
}

/* --- Ice Fracture Networks --- */
.ice-fracture-network {
    position: absolute;
    pointer-events: none;
    z-index: 2;
    opacity: 0.4;
}

.fracture-net-1 {
    top: 10%;
    right: 5%;
}

.fracture-net-2 {
    bottom: 5%;
    left: 55%;
}

/* --- Fracture Line Dividers --- */
.fracture-line {
    position: relative;
    width: 100%;
    height: 60px;
    overflow: hidden;
    z-index: 50;
    background: transparent;
}

.fracture-line svg {
    width: 100%;
    height: 100%;
}

.fracture-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 0.8s ease-out;
}

.fracture-path.drawn {
    stroke-dashoffset: 0;
}

/* --- Huddle Zone Sections --- */
.huddle-zone {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background-color: var(--huddle-frost);
    padding: 6rem 0;
    padding-left: 80px;
}

.huddle-content {
    max-width: 800px;
    margin-left: 8vw;
    padding-right: 4vw;
}

.huddle-zone .section-title {
    color: var(--obsidian-depth);
    font-size: clamp(2rem, 5vw, 4rem);
    margin-bottom: 2rem;
}

.text-column {
    margin-bottom: 2rem;
}

.body-text {
    font-family: var(--font-body);
    font-size: 1.125rem;
    font-weight: 400;
    line-height: 1.85;
    color: var(--obsidian-depth);
    margin-bottom: 1.25rem;
}

.body-text:last-child {
    margin-bottom: 0;
}

/* --- Pull Quotes --- */
.pull-quote {
    position: relative;
    margin: 2.5rem 0;
    padding-left: 2rem;
    display: flex;
    align-items: stretch;
    gap: 1.5rem;
}

.quote-rule {
    width: 4px;
    background-color: var(--dopamine-violet);
    border-radius: 2px;
    flex-shrink: 0;
}

.pull-quote p {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 400;
    font-style: italic;
    line-height: 1.5;
    color: var(--obsidian-depth);
    opacity: 0.88;
}

/* --- Spark Strip Sections --- */
.spark-strip {
    min-height: 40vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, var(--deep-ice) 0%, var(--obsidian-depth) 100%);
    padding: 4rem 2rem;
    padding-left: 80px;
}

.spark-content {
    text-align: center;
    max-width: 800px;
}

.spark-text {
    font-family: var(--font-mono);
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    letter-spacing: 0.08em;
    color: var(--frost-base);
    line-height: 1.6;
    min-height: 1.6em;
}

.spark-text.glow {
    text-shadow: 0 0 30px rgba(139, 92, 246, 0.5);
    transition: text-shadow 0.6s ease;
}

/* --- Reveal Animations --- */
.reveal-element {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.reveal-element.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Crystalline forms have slower entrance */
.crystalline-form {
    opacity: 0;
    transform: scale(0.92);
    transition: opacity 1s ease-out, transform 1s ease-out;
}

.crystalline-form.revealed {
    opacity: 1;
    transform: scale(1);
}

/* --- Crystal Halo --- */
.crystal-halo {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    #frost-rail {
        width: 44px;
        gap: 14px;
    }

    .rail-glyph {
        width: 24px;
        height: 24px;
    }

    .rail-glyph svg {
        width: 12px;
        height: 12px;
    }

    .frost-panel {
        padding-left: 56px;
    }

    .hero-content {
        padding-left: calc(44px + 4vw);
    }

    .glass-card {
        padding: 2rem 2rem;
        margin-left: 3vw;
        max-width: calc(100vw - 80px);
    }

    .huddle-zone {
        padding-left: 56px;
    }

    .huddle-content {
        margin-left: 4vw;
    }

    .spark-strip {
        padding-left: 56px;
    }

    .pull-quote p {
        font-size: 1.35rem;
    }

    .crystalline-form {
        transform: scale(0.6);
    }

    .crystalline-form.revealed {
        transform: scale(0.6);
    }

    .hex-1, .hex-2, .hex-3, .hex-4, .hex-5 {
        transform: scale(0.6);
    }

    .ice-fracture-network {
        display: none;
    }
}

@media (max-width: 480px) {
    #frost-rail {
        width: 36px;
        gap: 10px;
    }

    .frost-panel {
        padding-left: 44px;
    }

    .hero-content {
        padding-left: calc(36px + 3vw);
    }

    .glass-card {
        padding: 1.5rem 1.5rem;
        margin-left: 2vw;
    }

    .huddle-zone {
        padding-left: 44px;
    }

    .spark-strip {
        padding-left: 44px;
    }

    .section-title {
        font-size: clamp(1.8rem, 5vw, 3rem);
    }
}
