/* ============================================
   senggack.net - Goblincore Knowledge Architecture
   Colors:
     Deep Loam:     #2a1f14
     Foxfire Green:  #7db87a
     Warm Bark:      #8b7355
     Lichen Gold:    #c4a86b
     Parchment:      #f0e8d8
     Spore White:    #e8e0d0
     Mushroom Cap:   #6b4d3a
     Moss Dark:      #4a6741
   ============================================ */

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

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

body {
    background: #2a1f14;
    color: #e8e0d0;
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(15px, 1.6vw, 19px);
    line-height: 1.8;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---------- SVG Filters (hidden) ---------- */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ---------- Spore Particle Canvas ---------- */
#spore-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
}

/* ---------- Hero Canopy ---------- */
#hero-canopy {
    position: relative;
    width: 100%;
    height: 120vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: #2a1f14;
    z-index: 2;
    overflow: hidden;
}

/* Moss texture overlay via pseudo-element */
#hero-canopy::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        repeating-conic-gradient(#4a6741 0% 25%, transparent 0% 50%);
    background-size: 4px 4px;
    opacity: 0.03;
    pointer-events: none;
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 3;
    text-align: center;
    will-change: transform;
}

/* SVG Title */
#hero-title-svg {
    width: clamp(280px, 50vw, 600px);
    height: auto;
    opacity: 0;
    display: block;
    margin: 0 auto;
}

#hero-title-svg.animate-in {
    opacity: 1;
}

.char-stroke path,
.char-stroke circle {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: none;
}

.char-stroke.draw path,
.char-stroke.draw circle {
    animation: draw-stroke 1.8s ease-out forwards;
}

@keyframes draw-stroke {
    to {
        stroke-dashoffset: 0;
    }
}

/* Fallback text title - hidden by default, shown if SVG fails */
.hero-title-text {
    font-family: 'Caveat', cursive;
    font-size: clamp(80px, 15vw, 200px);
    color: #c4a86b;
    line-height: 1.1;
    letter-spacing: 0.05em;
    display: none;
}

/* Subtitle */
.hero-subtitle {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(16px, 2.5vw, 28px);
    font-weight: 400;
    font-style: italic;
    color: #e8e0d0;
    opacity: 0;
    transform: translateY(10px);
    margin-top: 1.5rem;
    letter-spacing: 0.12em;
    transition: opacity 1s ease-out, transform 1s ease-out;
}

.hero-subtitle.fade-in {
    opacity: 1;
    transform: translateY(0);
}

/* Scroll indicator */
.scroll-indicator {
    position: absolute;
    bottom: 3vh;
    left: 50%;
    transform: translateX(-50%);
    z-index: 4;
    opacity: 0;
    transition: opacity 1.2s ease-out 3.5s;
}

.scroll-indicator.visible {
    opacity: 0.6;
}

.scroll-arrow {
    display: block;
    width: 20px;
    height: 20px;
    border-right: 2px solid #8b7355;
    border-bottom: 2px solid #8b7355;
    transform: rotate(45deg);
    animation: bounce-arrow 2s ease-in-out infinite;
}

@keyframes bounce-arrow {
    0%, 100% { transform: rotate(45deg) translateY(0); }
    50% { transform: rotate(45deg) translateY(8px); }
}

/* ---------- Mycelium Network SVG ---------- */
.mycelium-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}

#mycelium-network {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
}

.mycelium-line {
    fill: none;
    stroke: #8b7355;
    stroke-width: 1.2;
    opacity: 0.5;
    filter: url(#mycelium-turbulence);
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1.2s ease-out;
}

.mycelium-line.drawn {
    stroke-dashoffset: 0;
}

/* ---------- Content Clusters Section ---------- */
#content-clusters {
    position: relative;
    z-index: 3;
    padding: 0 5vw 8vh;
    max-width: 1200px;
    margin: 0 auto;
}

/* Individual cluster */
.content-cluster {
    position: relative;
    margin-bottom: 2rem;
    padding: clamp(2rem, 4vw, 4rem);
    border-radius: 4px;
    transition: filter 0.8s ease-out, opacity 0.8s ease-out;
}

/* Blur-focus reveal default state */
.blur-reveal {
    filter: blur(4px);
    opacity: 0.6;
}

.blur-reveal.in-focus {
    filter: blur(0px);
    opacity: 1;
}

/* Offset margins for organic feel */
.content-cluster[data-offset="2"] { margin-left: 2%; }
.content-cluster[data-offset="3"] { margin-left: 3%; margin-right: 5%; }
.content-cluster[data-offset="4"] { margin-left: 6%; margin-right: 2%; }
.content-cluster[data-offset="5"] { margin-left: 1%; margin-right: 7%; }
.content-cluster[data-offset="6"] { margin-left: 8%; margin-right: 1%; }

/* Background treatments */
.content-cluster[data-bg="parchment"] {
    background: #f0e8d8;
    color: #2a1f14;
}

.content-cluster[data-bg="dark"] {
    background: #2a1f14;
    color: #e8e0d0;
    border: 1px solid rgba(139, 115, 85, 0.3);
}

.content-cluster[data-bg="moss"] {
    background: #4a6741;
    color: #f0e8d8;
}

/* Moss noise overlay on all clusters */
.content-cluster::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        repeating-conic-gradient(#6b4d3a 0% 25%, transparent 0% 50%);
    background-size: 3px 3px;
    opacity: 0.05;
    pointer-events: none;
    border-radius: inherit;
}

/* Cluster inner layout */
.cluster-inner {
    display: flex;
    gap: clamp(1.5rem, 3vw, 3rem);
    align-items: flex-start;
    position: relative;
    z-index: 1;
}

/* Specimen icon */
.specimen-icon {
    flex-shrink: 0;
    width: clamp(80px, 12vw, 120px);
    height: clamp(80px, 12vw, 120px);
}

.specimen-svg {
    width: 100%;
    height: 100%;
}

/* Cluster text */
.cluster-text {
    flex: 1;
    min-width: 0;
}

.taxonomy-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(10px, 1.1vw, 13px);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #8b7355;
    display: block;
    margin-bottom: 0.5rem;
}

.content-cluster[data-bg="dark"] .taxonomy-label {
    color: #c4a86b;
}

.content-cluster[data-bg="moss"] .taxonomy-label {
    color: #c4a86b;
}

.cluster-title {
    font-family: 'Caveat', cursive;
    font-size: clamp(28px, 5vw, 64px);
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 0.75rem;
}

.content-cluster[data-bg="parchment"] .cluster-title {
    color: #2a1f14;
}

.content-cluster[data-bg="dark"] .cluster-title {
    color: #7db87a;
}

.content-cluster[data-bg="moss"] .cluster-title {
    color: #f0e8d8;
}

.cluster-body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(15px, 1.6vw, 19px);
    line-height: 1.8;
    font-weight: 400;
    max-width: 65ch;
}

.content-cluster[data-bg="parchment"] .cluster-body {
    color: #6b4d3a;
}

.content-cluster[data-bg="dark"] .cluster-body {
    color: #e8e0d0;
}

.content-cluster[data-bg="moss"] .cluster-body {
    color: #e8e0d0;
}

/* ---------- Discovery Pockets ---------- */
.discovery-pocket {
    position: relative;
    margin-top: 1.2rem;
    z-index: 2;
}

.pocket-trigger {
    display: inline-block;
    font-size: 1.4rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.3s ease, transform 0.3s ease;
    user-select: none;
}

.pocket-trigger:hover {
    opacity: 1;
    transform: scale(1.2);
}

.pocket-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.5s ease, opacity 0.4s ease, margin-top 0.4s ease;
    margin-top: 0;
    padding: 0 1rem;
    border-left: 2px solid #c4a86b;
}

.discovery-pocket.open .pocket-content {
    max-height: 200px;
    opacity: 1;
    margin-top: 0.8rem;
    padding: 0.6rem 1rem;
}

.pocket-content p {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(13px, 1.3vw, 16px);
    font-style: italic;
    line-height: 1.6;
}

.content-cluster[data-bg="parchment"] .pocket-content {
    border-left-color: #8b7355;
    color: #6b4d3a;
}

.content-cluster[data-bg="dark"] .pocket-content {
    border-left-color: #c4a86b;
    color: #e8e0d0;
}

.content-cluster[data-bg="moss"] .pocket-content {
    border-left-color: #c4a86b;
    color: #f0e8d8;
}

/* ---------- Torn-Edge Dividers ---------- */
.torn-divider {
    width: 100%;
    height: 40px;
    position: relative;
    margin: 1rem 0;
}

.torn-divider::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    clip-path: polygon(
        0% 20%,
        5% 45%,
        10% 15%,
        18% 55%,
        25% 25%,
        30% 60%,
        38% 20%,
        45% 50%,
        50% 30%,
        58% 65%,
        62% 25%,
        70% 55%,
        75% 15%,
        82% 50%,
        88% 20%,
        93% 55%,
        100% 35%,
        100% 100%,
        0% 100%
    );
    background: rgba(139, 115, 85, 0.15);
}

/* ---------- Footer ---------- */
#site-footer {
    position: relative;
    z-index: 3;
    text-align: center;
    padding: 6vh 2rem 4vh;
    background: #2a1f14;
    border-top: 1px solid rgba(139, 115, 85, 0.2);
}

.footer-mycelium {
    width: 100%;
    max-width: 800px;
    margin: 0 auto 2rem;
    opacity: 0.4;
}

.footer-network-svg {
    width: 100%;
    height: auto;
}

.footer-text {
    font-family: 'Vollkorn', serif;
    font-weight: 700;
    font-size: clamp(18px, 2.5vw, 28px);
    color: #e8e0d0;
    letter-spacing: 0.05em;
}

.footer-separator {
    color: #8b7355;
    margin: 0 0.4em;
}

.footer-korean {
    font-family: 'Caveat', cursive;
    color: #c4a86b;
    font-size: 1.1em;
}

.footer-subtext {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(10px, 1.1vw, 13px);
    color: #8b7355;
    letter-spacing: 0.1em;
    margin-top: 0.6rem;
    text-transform: lowercase;
}

/* ---------- Responsive Adjustments ---------- */
@media (max-width: 768px) {
    .cluster-inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .specimen-icon {
        width: 90px;
        height: 90px;
    }

    .content-cluster {
        padding: clamp(1.5rem, 3vw, 2.5rem);
    }

    /* Reset offsets on mobile */
    .content-cluster[data-offset="2"],
    .content-cluster[data-offset="3"],
    .content-cluster[data-offset="4"],
    .content-cluster[data-offset="5"],
    .content-cluster[data-offset="6"] {
        margin-left: 0;
        margin-right: 0;
    }

    .pocket-content {
        text-align: left;
    }
}

@media (max-width: 480px) {
    #hero-canopy {
        height: 100vh;
    }

    .hero-subtitle {
        font-size: clamp(14px, 4vw, 18px);
        letter-spacing: 0.05em;
    }
}

/* ---------- Selection Color ---------- */
::selection {
    background: #c4a86b;
    color: #2a1f14;
}

::-moz-selection {
    background: #c4a86b;
    color: #2a1f14;
}
