/* aiice.io - Cryo-Surrealist Dreamscape */
:root {
    --abyss: #080c14;
    --deep-ice: #0d1a2a;
    --frost: #7ec8e3;
    --pale-surface: #e8f4f8;
    --muted-ice: #a8c8d8;
    --shadow-teal: #5a8a9a;
    --frozen-violet: #3a2a5e;
    --refraction: #b8e0f0;
    --amber: #d4a574;
}

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

html { scroll-behavior: smooth; }

body {
    background: var(--abyss);
    color: var(--muted-ice);
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    line-height: 1.75;
    overflow-x: hidden;
    position: relative;
}

#particleCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* Diagonal Fissure Line */
.fissure-line {
    position: fixed;
    top: -20%;
    left: -10%;
    width: 140%;
    height: 2px;
    background: var(--frost);
    box-shadow: 0 0 40px rgba(126, 200, 227, 0.4), 0 0 80px rgba(126, 200, 227, 0.15);
    transform: rotate(35deg);
    transform-origin: center;
    z-index: 3;
    pointer-events: none;
    opacity: 0.6;
}

/* Diamond Waypoints */
.waypoints {
    position: fixed;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.waypoints {
    top: 50%;
    right: auto;
    left: 50%;
    transform: translateY(-50%) translateX(20vw) rotate(0deg);
}

.waypoint {
    width: 10px;
    height: 10px;
    background: var(--frost);
    transform: rotate(45deg);
    cursor: pointer;
    opacity: 0.4;
    transition: opacity 0.4s ease, box-shadow 0.4s ease, transform 0.4s ease;
    position: relative;
}

.waypoint:hover, .waypoint.active {
    opacity: 1;
    box-shadow: 0 0 20px rgba(126, 200, 227, 0.5);
    transform: rotate(45deg) scale(1.4);
}

.waypoint-label {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%) rotate(-45deg);
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--shadow-teal);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.waypoint:hover .waypoint-label {
    opacity: 1;
}

/* Ice Refraction Prisms */
.prism-field {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.prism {
    position: absolute;
    width: 60px;
    height: 60px;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Neural Lattice */
.neural-lattice {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* Sections */
.section {
    position: relative;
    z-index: 5;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1200px;
}

/* Threshold */
.threshold {
    min-height: 100vh;
    flex-direction: column;
}

.threshold-content {
    text-align: center;
    position: relative;
}

.fissure-reveal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(35deg);
    width: 0;
    height: 2px;
    background: var(--frost);
    box-shadow: 0 0 60px rgba(126, 200, 227, 0.5);
    animation: fissureOpen 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.5s forwards;
}

@keyframes fissureOpen {
    0% { width: 0; opacity: 0; }
    100% { width: 60vw; opacity: 1; }
}

.hero-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 5.5rem);
    letter-spacing: 0.04em;
    color: var(--pale-surface);
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 2;
}

.char {
    display: inline-block;
    opacity: 0;
    transform: scale(0.9);
    filter: blur(4px);
    animation: charCrystallize 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.char:nth-child(1) { animation-delay: 1.7s; }
.char:nth-child(2) { animation-delay: 1.74s; }
.char:nth-child(3) { animation-delay: 1.78s; }
.char:nth-child(4) { animation-delay: 1.82s; }
.char:nth-child(5) { animation-delay: 1.86s; }
.char-dot { color: var(--frost); }
.char:nth-child(6) { animation-delay: 1.90s; }
.char:nth-child(7) { animation-delay: 1.94s; }
.char:nth-child(8) { animation-delay: 1.98s; }

@keyframes charCrystallize {
    0% { opacity: 0; transform: scale(0.9); filter: blur(4px); }
    100% { opacity: 1; transform: scale(1); filter: blur(0); }
}

.hero-subtitle {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.2vw, 1.1rem);
    color: var(--muted-ice);
    opacity: 0;
    animation: fadeIn 1s ease 2.4s forwards;
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 0.8; }
}

/* Lattice Section */
.lattice {
    min-height: 120vh;
    flex-direction: column;
    gap: 4rem;
    padding: 10vh 8vw;
    align-items: stretch;
}

.panel {
    backdrop-filter: blur(12px);
    background: rgba(10, 20, 40, 0.35);
    border: 1px solid rgba(126, 200, 227, 0.15);
    padding: clamp(2rem, 4vw, 3.5rem);
    max-width: 38ch;
    opacity: 0;
    transition: opacity 1s ease, transform 1s ease;
}

.panel.revealed {
    opacity: 1;
}

.panel-left {
    align-self: flex-start;
    margin-left: 5vw;
}

.panel-right {
    align-self: flex-end;
    margin-right: 5vw;
}

.depth-far { transform: translateZ(-80px) translateY(20px); }
.depth-far.revealed { transform: translateZ(-80px) translateY(0); }
.depth-near { transform: translateZ(0) translateY(20px); }
.depth-near.revealed { transform: translateZ(0) translateY(0); }
.depth-mid { transform: translateZ(-40px) translateY(20px); }
.depth-mid.revealed { transform: translateZ(-40px) translateY(0); }

.section-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    letter-spacing: 0.04em;
    color: var(--pale-surface);
    margin-bottom: 1.5rem;
}

.body-text {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: 1.75;
    color: var(--muted-ice);
}

.body-text a {
    color: var(--frost);
    text-decoration: none;
    text-shadow: 0 0 8px rgba(126, 200, 227, 0.3);
}

.accent-label {
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--shadow-teal);
    display: block;
    margin-bottom: 1rem;
}

/* Dendrite Section */
.dendrite {
    min-height: 100vh;
    position: relative;
}

.dendrite-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dendrite-svg {
    position: absolute;
    width: 80vw;
    height: 80vh;
    max-width: 1000px;
    max-height: 800px;
}

.dendrite-svg path {
    stroke: var(--frost);
    stroke-width: 0.5;
    fill: none;
}

.dendrite-text {
    position: relative;
    z-index: 2;
    max-width: 32ch;
    text-align: center;
}

/* Signal / Radar Section */
.signal {
    min-height: 100vh;
    flex-direction: column;
    gap: 3rem;
}

.radar-container {
    width: min(80vw, 600px);
    height: min(80vw, 600px);
}

.radar-chart {
    width: 100%;
    height: 100%;
}

.data-polygon {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 2s ease;
}

.data-polygon.drawn {
    stroke-dashoffset: 0;
}

.vertex-label {
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    letter-spacing: 0.12em;
    fill: var(--shadow-teal);
    text-anchor: middle;
}

/* The Deep */
.deep {
    min-height: 80vh;
    flex-direction: column;
}

.deep-content {
    max-width: 36ch;
    text-align: center;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.deep-content.revealed {
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .waypoints {
        transform: translateY(-50%) translateX(35vw);
    }
    .panel-left, .panel-right {
        margin-left: 3vw;
        margin-right: 3vw;
        max-width: 90%;
    }
    .fissure-line { opacity: 0.3; }
}
