/* ============================================
   aiice.quest — Deep Ocean Design System
   ============================================ */

/* CSS Custom Properties for Depth System */
:root {
    --depth: 0;
    --gold-glow: 0.1;
    --bg-darkness: 0;
    --text-opacity: 0.9;

    /* Color Palette */
    --abyss-black: #0a0a0f;
    --trench-navy: #0d1321;
    --hadal-blue: #141e33;
    --bioluminescent-gold: #d4a017;
    --pale-gold: #e8d5a3;
    --deep-teal: #1a5c4e;
    --muted-teal: #4a7c6f;
    --phantom-cyan: #2dd4bf;
    --silver-mist: #b8c4d0;
    --coral-warning: #c45e3a;
    --void-black: #080810;
    --deepest-black: #050508;
}

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

html {
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Work Sans', sans-serif;
    font-weight: 300;
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--silver-mist);
    background: var(--trench-navy);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Depth Gradient Overlay (full page) */
#depth-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg,
        #0d1321 0%,
        #0a0a0f 40%,
        #080810 70%,
        #050508 100%
    );
    z-index: -3;
    pointer-events: none;
}

/* ============================================
   Organic Blobs
   ============================================ */
#blob-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    pointer-events: none;
    overflow: hidden;
}

.blob {
    position: absolute;
    will-change: transform, opacity;
    transition: transform 1.5s ease-out;
}

.blob path {
    fill: rgba(26, 92, 78, 0.08);
}

.blob-1 {
    width: 500px;
    height: 500px;
    top: 5%;
    right: -5%;
    animation: blob-drift-1 16s ease-in-out infinite;
}

.blob-2 {
    width: 400px;
    height: 400px;
    top: 30%;
    right: 10%;
    animation: blob-drift-2 20s ease-in-out infinite;
}

.blob-2 path {
    fill: rgba(45, 212, 191, 0.04);
}

.blob-3 {
    width: 350px;
    height: 350px;
    top: 55%;
    right: -3%;
    animation: blob-drift-3 14s ease-in-out infinite;
}

.blob-4 {
    width: 450px;
    height: 450px;
    top: 75%;
    right: 5%;
    animation: blob-drift-4 18s ease-in-out infinite;
}

.blob-4 path {
    fill: rgba(45, 212, 191, 0.04);
}

.blob-5 {
    width: 300px;
    height: 300px;
    top: 90%;
    right: 15%;
    animation: blob-drift-5 22s ease-in-out infinite;
}

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

@keyframes blob-drift-2 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(12px, -18px) rotate(-2deg); }
    66% { transform: translate(-10px, 12px) rotate(1.5deg); }
}

@keyframes blob-drift-3 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(8px, 15px) rotate(1deg); }
    50% { transform: translate(-12px, -8px) rotate(-2deg); }
    75% { transform: translate(15px, -5px) rotate(0.5deg); }
}

@keyframes blob-drift-4 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(-15px, 10px) rotate(2deg); }
}

@keyframes blob-drift-5 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(10px, -12px) rotate(-1deg); }
    66% { transform: translate(-8px, 15px) rotate(2deg); }
}

/* ============================================
   Isometric Icons
   ============================================ */
#iso-icons {
    position: fixed;
    top: 0;
    right: 0;
    width: 25vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.iso-icon {
    position: absolute;
    opacity: 0.3;
    will-change: transform, opacity;
    transition: opacity 0.4s ease;
}

.iso-server {
    width: 100px;
    height: 100px;
    top: 10%;
    right: 8vw;
    animation: iso-float-1 25s linear infinite;
}

.iso-crystal {
    width: 80px;
    height: 80px;
    top: 35%;
    right: 4vw;
    animation: iso-float-2 30s linear infinite;
}

.iso-nautilus {
    width: 90px;
    height: 90px;
    top: 60%;
    right: 10vw;
    animation: iso-float-3 22s linear infinite;
}

.iso-trident {
    width: 70px;
    height: 84px;
    top: 82%;
    right: 6vw;
    animation: iso-float-4 28s linear infinite;
}

@keyframes iso-float-1 {
    0% { transform: translateY(0) rotateY(0deg); }
    100% { transform: translateY(-40px) rotateY(36deg); }
}

@keyframes iso-float-2 {
    0% { transform: translateY(0) rotateY(0deg); }
    100% { transform: translateY(-50px) rotateY(36deg); }
}

@keyframes iso-float-3 {
    0% { transform: translateY(0) rotateY(0deg); }
    100% { transform: translateY(-35px) rotateY(36deg); }
}

@keyframes iso-float-4 {
    0% { transform: translateY(0) rotateY(0deg); }
    100% { transform: translateY(-45px) rotateY(36deg); }
}

.iso-icon:hover {
    opacity: 0.8;
}

.iso-icon:hover g {
    stroke: var(--phantom-cyan);
    transition: stroke 0.2s ease;
}

/* ============================================
   Navigation Dots
   ============================================ */
#nav-dots {
    position: fixed;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 2rem;
    z-index: 100;
}

.nav-dot {
    position: relative;
    width: 20px;
    height: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dot-border {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.dot-border circle {
    stroke-dasharray: 50.27;
    stroke-dashoffset: 50.27;
    transition: stroke-dashoffset 0.6s ease-out;
}

.nav-dot.active .dot-border circle {
    stroke-dashoffset: 0;
}

.nav-dot:hover .dot-border {
    transform: scale(1.5);
}

.nav-dot::before {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--bioluminescent-gold);
    opacity: 0.6;
}

.nav-dot.active::before {
    opacity: 1;
    animation: dot-pulse 2s ease-in-out infinite;
}

@keyframes dot-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 4px rgba(212, 160, 23, 0.4); }
    50% { opacity: 0.5; box-shadow: 0 0 12px rgba(212, 160, 23, 0.6); }
}

.dot-label {
    position: absolute;
    right: 30px;
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    color: #4a7c6f;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.nav-dot:hover .dot-label {
    opacity: 1;
    transform: translateX(0);
}

/* ============================================
   Depth Indicator
   ============================================ */
#depth-indicator {
    position: fixed;
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    pointer-events: none;
}

.depth-value {
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    font-weight: 400;
    color: #4a7c6f;
    opacity: 0.5;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    letter-spacing: 0.15em;
}

/* ============================================
   Gold Seams
   ============================================ */
.gold-seam {
    position: absolute;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        #d4a017 15%,
        #e8d5a3 50%,
        #d4a017 85%,
        transparent 100%
    );
    box-shadow: 0 0 20px rgba(212, 160, 23, 0.15);
    z-index: 5;
    pointer-events: none;
}

.seam-surface {
    top: 100vh;
}

.seam-twilight {
    top: 200vh;
}

.gold-seam-inline {
    width: 60%;
    height: 1px;
    margin: 3rem 0;
    background: linear-gradient(90deg,
        transparent 0%,
        #d4a017 15%,
        #e8d5a3 50%,
        #d4a017 85%,
        transparent 100%
    );
    box-shadow: 0 0 20px rgba(212, 160, 23, 0.15);
}

/* ============================================
   Sections
   ============================================ */
.depth-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    scroll-snap-align: start;
    padding: 4rem 0;
}

.section-content {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding-left: clamp(4rem, 8vw, 8rem);
    padding-right: clamp(3rem, 6vw, 8rem);
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    column-gap: 1.5rem;
}

.section-content > * {
    grid-column: 1 / 9;
}

/* Section Title Wrapper with Border-Draw */
.section-title-wrapper {
    position: relative;
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
}

.section-title-wrapper .border-draw {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.section-title-wrapper .border-draw rect {
    stroke-dasharray: 1824;
    stroke-dashoffset: 1824;
    transition: stroke-dashoffset 1.8s ease-out;
}

.section-title-wrapper.visible .border-draw rect {
    stroke-dashoffset: 0;
}

/* Typography */
.section-title {
    font-family: 'Anybody', sans-serif;
    font-weight: 700;
    font-stretch: 150%;
    font-size: clamp(3rem, 8vw, 7rem);
    color: var(--bioluminescent-gold);
    text-shadow: 0 0 40px rgba(212, 160, 23, 0.3);
    line-height: 1.1;
    letter-spacing: -0.02em;
    position: relative;
    z-index: 1;
}

.section-subtitle {
    font-family: 'Syne', sans-serif;
    font-weight: 600;
    font-size: clamp(1rem, 3vw, 2.5rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--pale-gold);
    margin-bottom: 2rem;
}

.section-body {
    max-width: 55ch;
    margin-bottom: 2rem;
    opacity: var(--text-opacity, 0.9);
}

.section-body p {
    color: var(--silver-mist);
    font-weight: 300;
    line-height: 1.85;
}

/* Content Cards */
.content-card {
    position: relative;
    padding: 1.5rem 2rem;
    margin-top: 1.5rem;
}

.content-card .card-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.content-card .card-border rect {
    stroke-dasharray: 1344;
    stroke-dashoffset: 1344;
    opacity: 0.5;
    transition: stroke-dashoffset 1.8s ease-out;
}

.content-card.visible .card-border rect {
    stroke-dashoffset: 0;
}

.card-text {
    font-family: 'Syne', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--pale-gold);
    letter-spacing: 0.04em;
    position: relative;
    z-index: 1;
}

/* Nautilus Sigil */
.nautilus-sigil {
    margin-top: 3rem;
    display: flex;
    justify-content: center;
    grid-column: 1 / -1;
}

.sigil-svg {
    width: 150px;
    height: 150px;
}

.sigil-path {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 3s ease-out;
}

.nautilus-sigil.visible .sigil-path {
    stroke-dashoffset: 0;
}

/* ============================================
   Section-Specific Backgrounds
   ============================================ */
#section-surface {
    background: transparent;
}

#section-twilight {
    background: rgba(10, 10, 15, 0.3);
}

#section-midnight {
    background: rgba(8, 8, 16, 0.5);
}

#section-abyssal {
    background: rgba(5, 5, 8, 0.6);
}

#section-hadal {
    background: rgba(5, 5, 8, 0.8);
}

/* Section transition dissolve */
.depth-section::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 15vh;
    background: linear-gradient(to bottom, transparent, rgba(5, 5, 8, 0.3));
    pointer-events: none;
    z-index: 1;
}

/* Element visibility states */
.section-title-wrapper,
.content-card,
.nautilus-sigil {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.section-title-wrapper.visible,
.content-card.visible,
.nautilus-sigil.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   Scroll Velocity Effect on Blobs
   ============================================ */
body.scrolling-fast .blob {
    transform: scaleY(0.8);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
    .section-content {
        padding-left: 3rem;
        padding-right: 2rem;
    }

    .section-content > * {
        grid-column: 1 / 11;
    }

    #iso-icons {
        display: none;
    }

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

@media (max-width: 768px) {
    .section-content {
        display: block;
        padding-left: 2rem;
        padding-right: 1.5rem;
    }

    #nav-dots {
        right: 1rem;
        gap: 1.5rem;
    }

    #depth-indicator {
        left: 1rem;
    }

    .depth-value {
        font-size: 0.7rem;
    }

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

    .section-subtitle {
        font-size: clamp(0.8rem, 2.5vw, 1.5rem);
    }

    .dot-label {
        display: none;
    }
}
