/* ==============================
   yongjoon.xyz — Surreal Scholar's Desk
   ============================== */

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

body {
    background-color: #f4ece1;
    color: #4a3f35;
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.85;
    opacity: 0;
    transition: opacity 0.6s ease;
    overflow-x: hidden;
}

body.loaded {
    opacity: 1;
}

/* ==============================
   Dot Grid Background
   ============================== */
.dot-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ==============================
   Floating Book Pages
   ============================== */
.floating-page {
    position: fixed;
    z-index: 1;
    pointer-events: none;
}

.floating-page-1 {
    top: 8%;
    right: 10%;
    animation: floatPage1 18s ease-in-out infinite;
}

.floating-page-2 {
    bottom: 15%;
    left: 6%;
    animation: floatPage2 22s ease-in-out infinite;
}

.floating-page-3 {
    top: 45%;
    right: 5%;
    animation: floatPage3 20s ease-in-out infinite;
}

@keyframes floatPage1 {
    0%, 100% { transform: translateY(0) rotate(-3deg); }
    50% { transform: translateY(-8px) rotate(-1deg); }
}

@keyframes floatPage2 {
    0%, 100% { transform: translateY(0) rotate(2deg); }
    50% { transform: translateY(6px) rotate(4deg); }
}

@keyframes floatPage3 {
    0%, 100% { transform: translateY(0) rotate(1deg); }
    50% { transform: translateY(-10px) rotate(-1deg); }
}

/* ==============================
   Scroll Indicator
   ============================== */
.scroll-indicator {
    position: fixed;
    left: 2%;
    top: 0;
    height: 100vh;
    width: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 40px 0;
}

.scroll-track {
    position: absolute;
    left: 50%;
    top: 40px;
    bottom: 40px;
    width: 2px;
    background: #d4c4a8;
    transform: translateX(-50%);
}

.scroll-fill {
    width: 100%;
    height: 0%;
    background: #c4724e;
    transition: height 0.1s linear;
}

.scroll-node {
    position: relative;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d4c4a8;
    z-index: 101;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
}

.scroll-node.active {
    background: #c4724e;
    animation: nodePulse 3s ease-in-out infinite;
}

.scroll-node span {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Karla', sans-serif;
    font-size: 0.7rem;
    color: #8a7a68;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.scroll-node:hover span {
    opacity: 1;
}

@keyframes nodePulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.5; }
}

/* ==============================
   Hero Section
   ============================== */
.hero-section {
    position: relative;
    z-index: 10;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8%;
}

.hero-folio {
    background: #faf6ef;
    border: 1px solid #d4c4a8;
    border-radius: 2px;
    padding: 4rem 5rem;
    box-shadow: 0 2px 8px rgba(212,196,168,0.3);
    text-align: center;
    max-width: 700px;
    position: relative;
    opacity: 0;
    transform: scale(0.97);
    animation: heroFadeIn 0.8s ease 0.4s forwards;
}

.hero-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(4rem, 10vw, 8rem);
    color: #3d2b1f;
    letter-spacing: 0.02em;
    line-height: 1.05;
    margin-bottom: 1.5rem;
}

.hero-subtitle {
    font-family: 'Karla', sans-serif;
    font-style: italic;
    font-size: 0.9rem;
    color: #8a7a68;
    min-height: 1.4em;
}

@keyframes heroFadeIn {
    to { opacity: 1; transform: scale(1); }
}

/* ==============================
   Block Clusters
   ============================== */
.block-cluster {
    position: relative;
    z-index: 10;
    width: 85%;
    margin-left: 8%;
    margin-right: 7%;
    margin-bottom: 60px;
}

.cluster-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: minmax(60px, auto);
    gap: 16px;
}

/* ==============================
   Block Types
   ============================== */

/* Folio Block */
.folio-block {
    background: #faf6ef;
    border: 1px solid #d4c4a8;
    border-radius: 2px;
    padding: 2.5rem 3rem;
    box-shadow: 0 2px 8px rgba(212,196,168,0.3);
    position: relative;
    opacity: 0;
    transform: scale(0.97);
    transition: transform 350ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 350ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.folio-block.visible {
    opacity: 1;
    transform: scale(1);
}

.folio-block:hover {
    transform: translateY(-2px) scale(1);
    box-shadow: 0 6px 20px rgba(212,196,168,0.5);
}

/* Annotation Block */
.annotation-block {
    background: #ede5d4;
    border-radius: 2px;
    padding: 1.5rem 1.8rem;
    box-shadow: 0 2px 6px rgba(212,196,168,0.25);
    position: relative;
    opacity: 0;
    transform: scale(0.97);
    transition: transform 350ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 350ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 15;
}

.annotation-block.visible {
    opacity: 1;
}

.annotation-block:hover {
    transform: translateY(-2px) rotate(0deg) !important;
    box-shadow: 0 6px 16px rgba(212,196,168,0.45);
}

/* Image Block */
.image-block {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    opacity: 0;
    transform: scale(0.97);
}

.image-block.visible {
    opacity: 1;
    transform: scale(1);
}

.impossible-shape {
    width: 100%;
    max-width: 200px;
    height: auto;
    color: #a8c3b0; /* celadon mist reference */
}

/* Void Block */
.void-block {
    position: relative;
    opacity: 0;
}

.void-block.visible {
    opacity: 1;
}

.ink-bloom {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 40% 60%, rgba(61,43,31,0.05) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 1.5s ease;
}

.void-block.visible .ink-bloom {
    opacity: 1;
}

/* ==============================
   Typography
   ============================== */
.cluster-label {
    font-family: 'Karla', sans-serif;
    font-size: 0.75rem;
    font-weight: 400;
    color: #8a7a68;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: block;
    margin-bottom: 1.5rem;
}

.block-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 5.5rem);
    color: #3d2b1f;
    letter-spacing: 0.02em;
    line-height: 1.05;
    margin-bottom: 2rem;
}

.block-body {
    max-width: 38em;
    margin-bottom: 2em;
    color: #4a3f35;
}

.annotation-text {
    font-family: 'Karla', sans-serif;
    font-style: italic;
    font-size: 0.8rem;
    line-height: 1.6;
    color: #8a7a68;
}

.annotation-hidden {
    display: none;
}

.annotation-text.expandable {
    cursor: pointer;
}

.annotation-text.expandable::after {
    content: ' ...';
    color: #c4724e;
}

.annotation-text.expanded::after {
    content: '';
}

.annotation-text.expanded .annotation-hidden {
    display: inline;
}

.page-number {
    position: absolute;
    bottom: 1rem;
    right: 1.5rem;
    font-family: 'Karla', sans-serif;
    font-size: 0.7rem;
    color: #8b4a2b;
}

/* ==============================
   Cluster Dividers
   ============================== */
.cluster-divider {
    position: relative;
    z-index: 10;
    width: 85%;
    margin-left: 8%;
    margin-right: 7%;
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hanok-curve {
    width: 100%;
    height: 60px;
}

.closing-whisper {
    font-family: 'Karla', sans-serif;
    font-style: italic;
    font-size: 0.85rem;
    color: #8a7a68;
    margin-top: 2rem;
    text-align: center;
}

/* ==============================
   Pulse-Attention Animation
   ============================== */
@keyframes pulseAttention {
    from {
        opacity: 0;
        transform: scale(0.97);
        box-shadow: 0 1px 4px rgba(212,196,168,0.2);
    }
    to {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(212,196,168,0.3);
    }
}

.folio-block.visible,
.annotation-block.visible,
.image-block.visible {
    animation: pulseAttention 0.6s ease forwards;
}

/* ==============================
   Mobile (< 768px)
   ============================== */
@media (max-width: 768px) {
    .block-cluster {
        width: 90%;
        margin-left: 5%;
        margin-right: 5%;
    }

    .cluster-grid {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    .folio-block,
    .annotation-block,
    .image-block,
    .void-block {
        transform: none !important;
    }

    .annotation-block {
        transform: rotate(0deg) !important;
    }

    .hero-folio {
        padding: 2rem 2.5rem;
    }

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

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

    .folio-block {
        padding: 2rem;
    }

    .scroll-indicator {
        display: none;
    }

    .dot-grid {
        display: none;
    }

    .floating-page-2,
    .floating-page-3 {
        display: none;
    }

    .cluster-divider {
        height: 100px;
        width: 90%;
        margin-left: 5%;
        margin-right: 5%;
    }

    .void-block {
        min-height: 80px;
    }
}
