/* aiice.dev - Hand-drawn scholarly aesthetic */
/* Colors: #f5f0e8 cream, #2d2319 umber, #7b6b5a sienna, #c47d2e amber, #3a6b8c blue, #e8c55a gold, #f0d4a8 apricot */

:root {
    --paper: #f5f0e8;
    --ink: #2d2319;
    --annotation: #7b6b5a;
    --amber: #c47d2e;
    --blue: #3a6b8c;
    --gold: #e8c55a;
    --apricot: #f0d4a8;
    --bubble-fill: rgba(245, 240, 232, 0.7);
}

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

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

body {
    background-color: var(--paper);
    color: var(--ink);
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.125rem;
    line-height: 1.75;
    overflow-x: hidden;
    position: relative;
}

/* ================================ */
/* Bokeh Background Layer           */
/* ================================ */

#bokeh-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.bokeh {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    will-change: transform;
}

.bokeh-1 {
    width: 300px; height: 300px;
    background: radial-gradient(circle, var(--apricot), transparent 70%);
    opacity: 0.12;
    top: 10%; left: 5%;
    animation: bokeh-drift-1 80s ease-in-out infinite alternate;
}
.bokeh-2 {
    width: 250px; height: 250px;
    background: radial-gradient(circle, var(--gold), transparent 70%);
    opacity: 0.1;
    top: 30%; right: 10%;
    animation: bokeh-drift-2 95s ease-in-out infinite alternate;
}
.bokeh-3 {
    width: 200px; height: 200px;
    background: radial-gradient(circle, var(--blue), transparent 70%);
    opacity: 0.08;
    top: 60%; left: 15%;
    animation: bokeh-drift-3 110s ease-in-out infinite alternate;
}
.bokeh-4 {
    width: 350px; height: 350px;
    background: radial-gradient(circle, var(--apricot), transparent 70%);
    opacity: 0.1;
    top: 80%; right: 20%;
    animation: bokeh-drift-4 75s ease-in-out infinite alternate;
}
.bokeh-5 {
    width: 180px; height: 180px;
    background: radial-gradient(circle, var(--gold), transparent 70%);
    opacity: 0.09;
    top: 15%; left: 60%;
    animation: bokeh-drift-5 100s ease-in-out infinite alternate;
}
.bokeh-6 {
    width: 220px; height: 220px;
    background: radial-gradient(circle, var(--blue), transparent 70%);
    opacity: 0.08;
    top: 45%; left: 40%;
    animation: bokeh-drift-6 88s ease-in-out infinite alternate;
}
.bokeh-7 {
    width: 280px; height: 280px;
    background: radial-gradient(circle, var(--apricot), transparent 70%);
    opacity: 0.11;
    top: 70%; left: 70%;
    animation: bokeh-drift-7 105s ease-in-out infinite alternate;
}
.bokeh-8 {
    width: 160px; height: 160px;
    background: radial-gradient(circle, var(--gold), transparent 70%);
    opacity: 0.1;
    top: 5%; right: 30%;
    animation: bokeh-drift-8 92s ease-in-out infinite alternate;
}
.bokeh-9 {
    width: 240px; height: 240px;
    background: radial-gradient(circle, var(--blue), transparent 70%);
    opacity: 0.07;
    top: 50%; right: 5%;
    animation: bokeh-drift-9 115s ease-in-out infinite alternate;
}
.bokeh-10 {
    width: 190px; height: 190px;
    background: radial-gradient(circle, var(--apricot), transparent 70%);
    opacity: 0.09;
    top: 25%; left: 25%;
    animation: bokeh-drift-10 83s ease-in-out infinite alternate;
}
.bokeh-11 {
    width: 320px; height: 320px;
    background: radial-gradient(circle, var(--gold), transparent 70%);
    opacity: 0.08;
    top: 90%; left: 45%;
    animation: bokeh-drift-11 98s ease-in-out infinite alternate;
}
.bokeh-12 {
    width: 170px; height: 170px;
    background: radial-gradient(circle, var(--blue), transparent 70%);
    opacity: 0.09;
    top: 35%; right: 35%;
    animation: bokeh-drift-12 107s ease-in-out infinite alternate;
}
.bokeh-13 {
    width: 260px; height: 260px;
    background: radial-gradient(circle, var(--apricot), transparent 70%);
    opacity: 0.1;
    top: 55%; left: 8%;
    animation: bokeh-drift-13 90s ease-in-out infinite alternate;
}
.bokeh-14 {
    width: 200px; height: 200px;
    background: radial-gradient(circle, var(--gold), transparent 70%);
    opacity: 0.08;
    top: 75%; right: 40%;
    animation: bokeh-drift-14 102s ease-in-out infinite alternate;
}
.bokeh-15 {
    width: 230px; height: 230px;
    background: radial-gradient(circle, var(--blue), transparent 70%);
    opacity: 0.07;
    top: 8%; left: 80%;
    animation: bokeh-drift-15 120s ease-in-out infinite alternate;
}

@keyframes bokeh-drift-1 { from { transform: translate(0, 0); } to { transform: translate(80px, 60px); } }
@keyframes bokeh-drift-2 { from { transform: translate(0, 0); } to { transform: translate(-60px, 90px); } }
@keyframes bokeh-drift-3 { from { transform: translate(0, 0); } to { transform: translate(100px, -40px); } }
@keyframes bokeh-drift-4 { from { transform: translate(0, 0); } to { transform: translate(-70px, -80px); } }
@keyframes bokeh-drift-5 { from { transform: translate(0, 0); } to { transform: translate(50px, 70px); } }
@keyframes bokeh-drift-6 { from { transform: translate(0, 0); } to { transform: translate(-90px, 40px); } }
@keyframes bokeh-drift-7 { from { transform: translate(0, 0); } to { transform: translate(60px, -60px); } }
@keyframes bokeh-drift-8 { from { transform: translate(0, 0); } to { transform: translate(-40px, 80px); } }
@keyframes bokeh-drift-9 { from { transform: translate(0, 0); } to { transform: translate(70px, 50px); } }
@keyframes bokeh-drift-10 { from { transform: translate(0, 0); } to { transform: translate(-80px, -50px); } }
@keyframes bokeh-drift-11 { from { transform: translate(0, 0); } to { transform: translate(40px, -70px); } }
@keyframes bokeh-drift-12 { from { transform: translate(0, 0); } to { transform: translate(-50px, 60px); } }
@keyframes bokeh-drift-13 { from { transform: translate(0, 0); } to { transform: translate(90px, 30px); } }
@keyframes bokeh-drift-14 { from { transform: translate(0, 0); } to { transform: translate(-30px, -90px); } }
@keyframes bokeh-drift-15 { from { transform: translate(0, 0); } to { transform: translate(55px, 45px); } }

/* ================================ */
/* Navigation                       */
/* ================================ */

#nav-wordmark {
    position: fixed;
    top: 2rem;
    left: 2.5rem;
    z-index: 100;
}

.wordmark {
    font-family: 'Caveat', cursive;
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: 0.02em;
    opacity: 0.8;
}

#nav-index {
    position: fixed;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.nav-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1.5px solid var(--annotation);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: border-color 0.3s, background-color 0.3s;
}

.nav-circle span {
    font-family: 'Kalam', cursive;
    font-size: 0.75rem;
    color: var(--annotation);
    transition: color 0.3s;
}

.nav-circle.active {
    border-color: var(--amber);
    background-color: rgba(196, 125, 46, 0.1);
}

.nav-circle.active span {
    color: var(--amber);
}

/* ================================ */
/* Scenes (full viewport)           */
/* ================================ */

.scene {
    min-height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    scroll-snap-align: start;
    padding: 4rem 6rem;
    overflow: hidden;
}

.scene-content {
    max-width: 550px;
    position: relative;
    z-index: 10;
}

.scene-content--left {
    margin-right: auto;
    margin-left: 8%;
}

.scene-content--right {
    margin-left: auto;
    margin-right: 8%;
}

.scene-content--center {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

/* ================================ */
/* Typography                       */
/* ================================ */

.heading-handwritten {
    font-family: 'Caveat', cursive;
    font-size: clamp(2.5rem, 6vw, 5rem);
    font-weight: 600;
    color: var(--ink);
    line-height: 1.2;
    margin-bottom: 1.5rem;
    letter-spacing: -0.01em;
}

.heading-handwritten .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
}

.heading-handwritten .char.revealed {
    opacity: 1;
    transform: translateY(0);
}

.body-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.125rem;
    line-height: 1.75;
    color: var(--ink);
    margin-bottom: 1.25rem;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.body-text.revealed {
    opacity: 1;
    transform: translateY(0);
}

.coda {
    margin-top: 3rem;
}

.coda-text {
    font-family: 'Caveat', cursive;
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 700;
    color: var(--amber);
    letter-spacing: 0.02em;
}

.coda-text .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
}

.coda-text .char.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ================================ */
/* Margin Annotations               */
/* ================================ */

.margin-annotation {
    position: absolute;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    max-width: 200px;
    opacity: 0;
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
    z-index: 10;
}

.annotation--right {
    right: 6%;
    top: 45%;
    transform: translateX(30px);
}

.annotation--left {
    left: 6%;
    top: 55%;
    transform: translateX(-30px);
}

.margin-annotation.revealed {
    opacity: 1;
    transform: translateX(0);
}

.annotation-icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.annotation-text {
    font-family: 'Kalam', cursive;
    font-size: 0.85rem;
    color: var(--annotation);
    line-height: 1.5;
}

/* ================================ */
/* Connector Lines                  */
/* ================================ */

.connector-line {
    position: absolute;
    top: 42%;
    left: 55%;
    z-index: 5;
    opacity: 0.6;
}

.connection-web {
    position: absolute;
    top: 10%;
    left: 5%;
    width: 90%;
    height: 80%;
    z-index: 2;
    opacity: 0.5;
}

.node-dot {
    opacity: 0;
    transition: opacity 0.6s ease-out;
}

.node-dot.revealed {
    opacity: 1;
}

/* SVG draw path animation */
.draw-path {
    stroke-dasharray: var(--path-length, 1000);
    stroke-dashoffset: var(--path-length, 1000);
    transition: stroke-dashoffset 2s ease-out;
}

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

/* ================================ */
/* Botanicals                       */
/* ================================ */

.botanical {
    position: absolute;
    z-index: 3;
    opacity: 0.7;
}

.botanical--fern {
    bottom: 3%;
    right: 15%;
}

.botanical--sprout {
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%);
}

.botanical--bud {
    bottom: 2%;
    right: 20%;
}

/* ================================ */
/* Bubbles                          */
/* ================================ */

.bubble-cluster {
    position: absolute;
    z-index: 5;
}

#bubble-cluster-1 {
    top: 35%;
    left: 15%;
}

#bubble-cluster-2 {
    top: 30%;
    right: 10%;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    background: var(--bubble-fill);
    border: 1.5px solid rgba(123, 107, 90, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem;
    opacity: 0;
    transform: translateY(30px) scale(0.8);
    will-change: transform;
}

.bubble.revealed {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.bubble--large {
    width: 220px;
    height: 220px;
}

.bubble--medium {
    width: 140px;
    height: 140px;
}

.bubble--small {
    width: 80px;
    height: 80px;
    padding: 0;
}

.bubble--tiny {
    width: 40px;
    height: 40px;
    padding: 0;
}

.bubble-text {
    font-family: 'Caveat', cursive;
    font-size: 1.1rem;
    color: var(--ink);
    line-height: 1.4;
    font-weight: 500;
}

.bubble-label {
    font-family: 'Kalam', cursive;
    font-size: 0.85rem;
    color: var(--annotation);
}

/* Hand-drawn wobble for bubble borders */
.bubble--large {
    border-radius: 50% 48% 52% 49% / 48% 51% 49% 52%;
}

.bubble--medium {
    border-radius: 48% 52% 49% 51% / 51% 49% 52% 48%;
}

.bubble--small {
    border-radius: 52% 48% 50% 50% / 49% 51% 50% 50%;
}

/* ================================ */

/* Code / Technical text */
.code-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.9rem;
    color: var(--ink);
    background: rgba(45, 35, 25, 0.04);
    padding: 0.15em 0.3em;
    border-radius: 3px;
}
/* Underline Flourish               */
/* ================================ */

.underline-flourish {
    position: relative;
    display: inline-block;
}

.underline-flourish::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: -4px;
    right: -4px;
    height: 8px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='8' viewBox='0 0 100 8'%3E%3Cpath d='M0 5 C10 2, 20 7, 30 4 C40 1, 50 6, 60 3 C70 0, 80 5, 90 3 C95 2, 98 4, 100 3' stroke='%23c47d2e' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") repeat-x;
    background-size: 100px 8px;
    opacity: 0;
    transition: opacity 0.6s ease-out;
}

.underline-flourish.drawn::after {
    opacity: 1;
}

/* ================================ */
/* Responsive                       */
/* ================================ */

@media (max-width: 768px) {
    .scene {
        padding: 3rem 1.5rem;
        flex-direction: column;
        justify-content: center;
    }

    .scene-content {
        max-width: 100%;
    }

    .scene-content--left,
    .scene-content--right {
        margin-left: 0;
        margin-right: 0;
    }

    #nav-index {
        right: 0.8rem;
        gap: 0.8rem;
    }

    .nav-circle {
        width: 26px;
        height: 26px;
    }

    .nav-circle span {
        font-size: 0.65rem;
    }

    #nav-wordmark {
        top: 1rem;
        left: 1.5rem;
    }

    .margin-annotation {
        position: relative;
        right: auto;
        left: auto;
        top: auto;
        margin-top: 2rem;
        max-width: 100%;
    }

    .annotation--right,
    .annotation--left {
        right: auto;
        left: auto;
        top: auto;
        transform: none;
    }

    .bubble-cluster {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        margin: 2rem auto;
        width: 300px;
        height: 300px;
    }

    .connector-line {
        display: none;
    }

    .connection-web {
        position: relative;
        top: auto;
        left: auto;
        width: 100%;
        height: 300px;
        margin: 2rem 0;
    }

    .botanical {
        opacity: 0.4;
    }
}
