/* ============================================================
   monopole.ai - Goblincore Aesthetic
   Deep Forest Intelligence Design System
   Duotone: Amber (#C8913A) + Moss (#4A6741)
   ============================================================ */

/* CSS Custom Properties */
:root {
    --color-forest-floor: #2C1B0E;
    --color-parchment-cream: #F2E8D5;
    --color-amber-glow: #C8913A;
    --color-moss-deep: #4A6741;
    --color-dark-umber: #3B2A1A;
    --color-bark: #8B7355;
    --color-shadow-umber: #5C4A32;
    --color-aged-paper: #D4C4A8;
    --color-spore-gold: #E8B94A;

    --font-display: 'Fraunces', serif;
    --font-body: 'Literata', serif;
    --font-mono: 'JetBrains Mono', monospace;

    --spacing-section: clamp(4rem, 8vh, 8rem);
    --column-max: 680px;
}

/* ============================================================
   Reset & Base
   ============================================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-weight: 380;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    color: var(--color-aged-paper);
    background-color: var(--color-forest-floor);
    overflow-x: hidden;
    position: relative;
}

/* SVG defs container - hidden */
.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ============================================================
   Grain Texture Overlay
   ============================================================ */

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* ============================================================
   Hero Section
   ============================================================ */

.hero {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--color-forest-floor);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

/* Dancheong corner ornaments */
.dancheong-corner {
    position: absolute;
    z-index: 5;
    opacity: 0;
    transition: opacity 1.5s ease-out;
}

.dancheong-corner.visible {
    opacity: 1;
}

.dancheong-top-left {
    top: 1.5rem;
    left: 1.5rem;
}

.dancheong-top-right {
    top: 1.5rem;
    right: 1.5rem;
}

.hero-content {
    text-align: center;
    z-index: 10;
    position: relative;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 6vw, 4.8rem);
    color: var(--color-parchment-cream);
    font-variation-settings: 'SOFT' 100, 'WONK' 1;
    font-weight: 600;
    margin-bottom: 1.5rem;
    letter-spacing: 0.04em;
}

.hero-word {
    display: inline-block;
}

/* Individual hero letters (created by JS) */
.hero-letter {
    display: inline-block;
    opacity: 0;
}

.hero-letter.revealed {
    animation: ink-appear 0.5s ease-out forwards;
}

@keyframes ink-appear {
    0% {
        opacity: 0;
        filter: blur(4px);
        transform: scale(0.9);
    }
    60% {
        opacity: 0.8;
        filter: blur(1px);
        transform: scale(1.02);
    }
    100% {
        opacity: 1;
        filter: blur(0);
        transform: scale(1);
    }
}

.hero-ai {
    font-family: var(--font-mono);
    font-size: clamp(0.85rem, 2vw, 1.15rem);
    letter-spacing: 0.06em;
    color: var(--color-amber-glow);
    font-weight: 400;
    position: relative;
    top: -0.4em;
    margin-left: 0.2em;
    opacity: 0;
}

.hero-ai.revealed {
    animation: ink-appear 0.4s ease-out forwards;
}

/* Monopole Icon */
.monopole-icon-wrapper {
    margin: 2rem auto;
    opacity: 0;
    transition: opacity 1s ease-out;
}

.monopole-icon-wrapper.visible {
    opacity: 1;
}

.monopole-icon {
    width: clamp(130px, 28vw, 220px);
    height: clamp(130px, 28vw, 220px);
    animation: slow-rotate 20s linear infinite;
}

@keyframes slow-rotate {
    from { transform: rotateY(0deg); }
    to { transform: rotateY(360deg); }
}

/* Scroll Hint */
.scroll-hint {
    position: absolute;
    bottom: 2.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 1s ease-out 2s;
}

.scroll-hint.visible {
    opacity: 1;
}

.scroll-hint-text {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-bark);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.scroll-hint-arrow {
    animation: gentle-bounce 2.5s ease-in-out infinite;
}

@keyframes gentle-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(6px); }
}

/* ============================================================
   Transition Zone (Hero to Content)
   ============================================================ */

.transition-zone {
    width: 100%;
    height: clamp(120px, 20vh, 250px);
    position: relative;
    z-index: 2;
    overflow: hidden;
}

.transition-roots {
    width: 100%;
    height: 100%;
    display: block;
}

.tendril {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 1.2s ease-out;
}

.tendril.drawn {
    stroke-dashoffset: 0;
}

/* ============================================================
   Content Wrapper (Parchment background)
   ============================================================ */

.content-wrapper {
    background: var(--color-parchment-cream);
    padding: 0 2rem;
    position: relative;
    z-index: 3;
}

/* ============================================================
   Content Sections
   ============================================================ */

.content-section {
    max-width: var(--column-max);
    margin: 0 auto;
    padding: var(--spacing-section) 0;
    position: relative;
    /* Off-center by 3% left for visual tension */
    transform: translateX(-1.5%);
}

.section-heading {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3.5vw, 2.6rem);
    color: var(--color-dark-umber);
    font-variation-settings: 'SOFT' 80, 'WONK' 0.8;
    font-weight: 500;
    margin-bottom: 2.5rem;
    position: relative;
    padding-bottom: 1.2rem;
}

/* Hand-drawn underline */
.heading-underline {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: 280px;
    height: 6px;
    display: block;
}

.underline-path {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 0.8s ease-out;
}

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

/* ============================================================
   Specimen Cards
   ============================================================ */

.specimen-card {
    background: var(--color-parchment-cream);
    border: 1.5px solid var(--color-bark);
    padding: 2.2rem 2rem 2rem;
    margin: 1.8rem 0;
    position: relative;
    box-shadow: 2px 3px 12px rgba(44, 27, 14, 0.08);
    opacity: 0;
    transform: translateY(20px) rotate(-1.5deg);

    /* Torn paper edge effect */
    clip-path: polygon(
        0% 0%,
        97% 0%,
        100% 1.5%,
        98.5% 4%,
        100% 7%,
        97.5% 11%,
        100% 15%,
        99% 100%,
        2% 100%,
        0% 97%,
        1.5% 93%,
        0% 89%,
        2% 84%,
        0% 80%,
        1% 75%,
        0% 70%
    );
}

.specimen-card.revealed {
    animation: card-enter 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes card-enter {
    to {
        opacity: 1;
        transform: translateY(0) rotate(var(--card-rotation, -0.3deg));
    }
}

.specimen-number {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--color-shadow-umber);
    letter-spacing: 0.06em;
    position: absolute;
    top: 1.2rem;
    right: 1.5rem;
    font-weight: 400;
}

.specimen-card p {
    color: var(--color-dark-umber);
    margin-bottom: 1rem;
    line-height: 1.72;
}

.specimen-card p:last-child {
    margin-bottom: 0;
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--color-dark-umber);
    margin-bottom: 1rem;
    font-variation-settings: 'SOFT' 80, 'WONK' 0.7;
    font-weight: 500;
}

.specimen-list {
    list-style: none;
    margin: 0.8rem 0 0 0;
    color: var(--color-dark-umber);
}

.specimen-list li {
    padding: 0.55rem 0;
    padding-left: 1.6rem;
    position: relative;
}

.specimen-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--color-amber-glow);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

/* ============================================================
   Interstitial Panels
   ============================================================ */

.interstitial-panel {
    width: 100vw;
    min-height: 40vh;
    background: var(--color-forest-floor);
    margin-left: calc(-50vw + 50%);
    padding: 3rem 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.isometric-scene {
    width: 100%;
    height: 100%;
    max-width: 600px;
    max-height: 300px;
}

.iso-icon {
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.iso-icon.visible {
    opacity: 1;
    transform: scale(1);
}

/* ============================================================
   Footer Section
   ============================================================ */

.footer-section {
    background: var(--color-forest-floor);
    color: var(--color-aged-paper);
    padding: 6rem 2rem 4rem;
    text-align: center;
    position: relative;
    z-index: 4;
}

.footer-roots {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 250px;
    z-index: 1;
}

.root-path {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 1.2s ease-out;
}

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

.root-branch {
    transition-delay: 0.6s;
}

/* Mushroom sprouts at root junctions */
.sprout {
    opacity: 0;
    transform: scale(0);
    transform-origin: center bottom;
    transition: opacity 0.4s ease-out, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sprout.visible {
    opacity: 1;
    transform: scale(1);
}

.footer-content {
    position: relative;
    z-index: 5;
    padding-top: 2rem;
}

.footer-icon-container {
    margin: 0 auto 1.5rem;
    display: flex;
    justify-content: center;
}

.footer-monopole-icon {
    width: 100px;
    height: 100px;
    opacity: 0;
    transition: opacity 0.8s ease-out;
}

.footer-monopole-icon.visible {
    opacity: 1;
}

.footer-title {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    color: var(--color-parchment-cream);
    font-variation-settings: 'SOFT' 100, 'WONK' 1;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.footer-text {
    font-family: var(--font-body);
    color: var(--color-aged-paper);
    font-size: 1rem;
    font-weight: 380;
    margin-bottom: 2rem;
}

.footer-divider {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
}

.footer-contact {
    margin-top: 1rem;
}

.footer-link {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--color-amber-glow);
    text-decoration: none;
    letter-spacing: 0.04em;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: var(--color-spore-gold);
}

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

@media (max-width: 768px) {
    .content-section {
        transform: translateX(0);
        padding: clamp(2rem, 4vh, 4rem) 0;
    }

    .interstitial-panel {
        min-height: 30vh;
        padding: 2rem 1rem;
    }

    .dancheong-corner svg {
        width: 50px;
        height: 50px;
    }

    .dancheong-top-left {
        top: 1rem;
        left: 1rem;
    }

    .dancheong-top-right {
        top: 1rem;
        right: 1rem;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 1rem;
    }

    .content-section {
        padding: clamp(1.5rem, 3vh, 3rem) 0;
    }

    .specimen-card {
        padding: 1.5rem 1.2rem;
        margin: 1.2rem 0;
    }

    .section-heading {
        font-size: 1.4rem;
        margin-bottom: 2rem;
    }

    .heading-underline {
        max-width: 200px;
    }

    .interstitial-panel {
        min-height: 25vh;
    }

    .footer-section {
        padding: 4rem 1.5rem 3rem;
    }

    .dancheong-corner {
        display: none;
    }
}

/* ============================================================
   Prefers Reduced Motion
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .hero-letter,
    .hero-ai,
    .monopole-icon-wrapper,
    .scroll-hint,
    .dancheong-corner {
        opacity: 1 !important;
    }

    .hero-letter {
        filter: none !important;
        transform: none !important;
    }

    .monopole-icon {
        animation: none;
    }

    .tendril,
    .underline-path,
    .root-path {
        stroke-dashoffset: 0 !important;
    }

    .specimen-card {
        opacity: 1 !important;
        transform: rotate(var(--card-rotation, -0.3deg)) !important;
    }

    .iso-icon {
        opacity: 1 !important;
        transform: scale(1) !important;
    }

    .sprout {
        opacity: 1 !important;
        transform: scale(1) !important;
    }

    .footer-monopole-icon {
        opacity: 1 !important;
    }
}
