/* ==========================================
   senggack.net - Generative Pastoral Engine
   ========================================== */

/* --- CSS Custom Properties --- */
:root {
    --deep-plum: #2D1B36;
    --hot-coral: #FF6B8A;
    --bubblegum-rose: #F7C8D0;
    --lemon-fizz: #FFE156;
    --mint-cream: #C8F5E2;
    --meadow-sage: #7BAF8E;
    --warm-parchment: #FFF5E6;
    --lavender-mist: #D4B8E0;
    --plum-text: #4A3252;
    --mauve-accent: #8B4A6B;
    --sand-light: #E8D5C8;

    --font-display: 'Poiret One', cursive;
    --font-secondary: 'Cormorant Infant', serif;
    --font-body: 'Nunito', sans-serif;

    --bg-color: var(--warm-parchment);
    --text-primary: var(--deep-plum);
    --text-secondary: var(--plum-text);
    --frame-outer: var(--bubblegum-rose);
    --frame-inner: var(--hot-coral);
}

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

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

body {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--text-secondary);
    background-color: var(--bg-color);
    line-height: 1.75;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- Meadow Canvas --- */
#meadow-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* --- Click Bloom Layer --- */
.click-bloom-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}

/* --- Floating Navigation Pill --- */
.nav-pill {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
    background: rgba(255, 245, 230, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid var(--hot-coral);
    border-radius: 30px;
    padding: 8px 20px;
    cursor: pointer;
    opacity: 0.3;
    transition: opacity 0.4s ease, border-color 0.4s ease, background-color 0.4s ease;
    user-select: none;
}

.nav-pill:hover {
    opacity: 1;
}

.nav-pill-text {
    font-family: var(--font-secondary);
    font-weight: 400;
    font-size: 0.9rem;
    color: var(--deep-plum);
    letter-spacing: 0.04em;
    transition: color 0.4s ease;
}

.nav-radial {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-radial.visible {
    pointer-events: auto;
    opacity: 1;
}

.nav-radial.hidden {
    pointer-events: none;
    opacity: 0;
}

.nav-radial-item {
    position: absolute;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--warm-parchment);
    border: 1px solid var(--hot-coral);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-secondary);
    font-size: 0.75rem;
    color: var(--deep-plum);
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.3s ease;
}

.nav-radial-item:hover {
    background: var(--bubblegum-rose);
    transform: scale(1.15);
}

/* Sunburst arrangement for radial items */
.nav-radial-item:nth-child(1) { top: 0; left: 50%; transform: translateX(-50%); }
.nav-radial-item:nth-child(2) { top: 25%; right: 0; }
.nav-radial-item:nth-child(3) { bottom: 10%; right: 10%; }
.nav-radial-item:nth-child(4) { bottom: 10%; left: 10%; }
.nav-radial-item:nth-child(5) { top: 25%; left: 0; }

/* --- Section Base --- */
.section {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Opening Sequence --- */
.section-opening {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.opening-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.opening-stem {
    width: 60px;
    height: 200px;
    opacity: 0;
}

.opening-stem.animate {
    opacity: 1;
}

.opening-flower {
    position: relative;
    width: 120px;
    height: 120px;
    margin-top: -30px;
    margin-bottom: 30px;
}

.opening-flower .petal {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 50px;
    border-radius: 50%;
    transform-origin: center bottom;
    transform: translate(-50%, -100%) scale(0);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.opening-flower .petal.bloom {
    transform: translate(-50%, -100%) scale(1);
}

.opening-flower .flower-center {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--lemon-fizz);
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 5;
}

.opening-flower .flower-center.bloom {
    transform: translate(-50%, -50%) scale(1);
}

.site-title {
    font-family: var(--font-display);
    font-size: clamp(2.8rem, 6vw, 5.5rem);
    font-weight: 400;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--deep-plum);
    opacity: 0;
    transition: opacity 0.8s ease, letter-spacing 0.8s ease;
}

.site-title.animate {
    opacity: 1;
    letter-spacing: 0.12em;
}

.site-tagline {
    font-family: var(--font-secondary);
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--mauve-accent);
    letter-spacing: 0.02em;
    text-align: center;
    max-width: 500px;
    margin-top: 16px;
    opacity: 0;
    transition: opacity 1s ease;
}

.site-tagline.animate {
    opacity: 1;
}

/* --- Vine Spacers --- */
.vine-spacer {
    position: relative;
    z-index: 2;
    height: 25vh;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.vine-svg {
    width: 60px;
    height: 100%;
    opacity: 0.7;
}

.vine-path {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 1.5s ease-out;
}

.vine-path.grow {
    stroke-dashoffset: 0;
}

/* --- Sunburst Divider --- */
.sunburst-divider {
    width: 80px;
    height: 80px;
    position: relative;
    margin: 20px auto;
    opacity: 0.4;
}

.sunburst-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    background: var(--bubblegum-rose);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

/* --- Content Islands --- */
.section-island {
    min-height: auto;
    padding: 10vh 5vw;
    display: flex;
    justify-content: center;
}

.island-offset-right {
    justify-content: flex-end;
    padding-right: 12vw;
}

.island-offset-left {
    justify-content: flex-start;
    padding-left: 12vw;
}

.island-frame {
    position: relative;
    max-width: 65vw;
    width: 600px;
    padding: 12px;
    background: transparent;
    border: 0.5px solid var(--bubblegum-rose);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.island-frame.visible {
    opacity: 1;
    transform: translateY(0);
}

.island-frame::after {
    content: '';
    position: absolute;
    inset: 12px;
    border: 2px solid var(--hot-coral);
    pointer-events: none;
    transition: border-color 0.4s ease;
}

/* --- Frame Corners --- */
.frame-corner {
    position: absolute;
    width: 24px;
    height: 24px;
    color: var(--hot-coral);
    z-index: 3;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.4s ease;
}

.frame-corner-tl { top: -2px; left: -2px; }
.frame-corner-tr { top: -2px; right: -2px; }
.frame-corner-bl { bottom: -2px; left: -2px; }
.frame-corner-br { bottom: -2px; right: -2px; }

.island-frame:hover .frame-corner {
    transform: rotate(15deg);
}

/* --- Island Content --- */
.island-content {
    padding: 40px 36px;
    position: relative;
}

.island-heading {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 5vw, 4rem);
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--deep-plum);
    margin-bottom: 24px;
    transition: letter-spacing 0.2s ease, color 0.4s ease;
}

.island-heading:hover {
    letter-spacing: 0.16em;
}

.island-body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.75;
    color: var(--plum-text);
    margin-bottom: 16px;
    transition: color 0.4s ease;
}

.island-caption {
    font-weight: 300;
    font-style: italic;
    font-family: var(--font-secondary);
    font-size: clamp(0.9rem, 1.5vw, 1.05rem);
    color: var(--mauve-accent);
}

.island-extra {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.8s ease, opacity 0.6s ease;
}

.island-extra.revealed {
    max-height: 600px;
    opacity: 1;
}

.hidden-content {
    padding-top: 8px;
}

/* --- Decorative Elements --- */
.beaded-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px 0;
    margin: 10px 0;
}

.beaded-line::before {
    content: '';
    display: block;
    width: 100%;
    height: 3px;
    background: repeating-linear-gradient(
        to right,
        var(--bubblegum-rose) 0px,
        var(--bubblegum-rose) 3px,
        transparent 3px,
        transparent 11px
    );
    background-size: 11px 3px;
    background-repeat: repeat-x;
    border-radius: 50%;
}

.chevron-border {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 0;
    margin: 10px 0;
    background: repeating-linear-gradient(
        90deg,
        transparent 0px,
        transparent 4px,
        var(--bubblegum-rose) 4px,
        transparent 8px,
        transparent 12px
    );
    background-size: 16px 100%;
    height: 12px;
    opacity: 0.5;
    clip-path: polygon(
        0% 50%, 4% 0%, 8% 50%, 12% 0%, 16% 50%, 20% 0%, 24% 50%, 28% 0%, 32% 50%, 36% 0%, 40% 50%, 44% 0%, 48% 50%, 52% 0%, 56% 50%, 60% 0%, 64% 50%, 68% 0%, 72% 50%, 76% 0%, 80% 50%, 84% 0%, 88% 50%, 92% 0%, 96% 50%, 100% 0%, 100% 100%, 96% 50%, 92% 100%, 88% 50%, 84% 100%, 80% 50%, 76% 100%, 72% 50%, 68% 100%, 64% 50%, 60% 100%, 56% 50%, 52% 100%, 48% 50%, 44% 100%, 40% 50%, 36% 100%, 32% 50%, 28% 100%, 24% 50%, 20% 100%, 16% 50%, 12% 100%, 8% 50%, 4% 100%, 0% 50%
    );
}

/* --- Continue Indicator --- */
.continue-indicator {
    display: flex;
    justify-content: center;
    padding-top: 16px;
    cursor: pointer;
    animation: pulse-chevron 2s ease-in-out infinite;
}

@keyframes pulse-chevron {
    0%, 100% { opacity: 0.5; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(4px); }
}

/* --- Nav Pill Border Pulse --- */
@keyframes pill-border-pulse {
    0%, 100% { border-color: var(--hot-coral); }
    50% { border-color: var(--lavender-mist); }
}

.nav-pill {
    animation: pill-border-pulse 4s ease-in-out infinite;
}

/* --- Final Spacer --- */
.final-spacer {
    height: 15vh;
    position: relative;
    z-index: 2;
}

/* --- Twilight Mode (applied via JS) --- */
body.twilight .nav-pill {
    background: rgba(45, 27, 54, 0.85);
}

body.twilight .nav-pill-text {
    color: var(--warm-parchment);
}

body.twilight .island-heading {
    color: var(--warm-parchment);
}

body.twilight .island-body {
    color: var(--sand-light);
}

body.twilight .island-frame {
    border-color: rgba(247, 200, 208, 0.3);
}

body.twilight .island-frame::after {
    border-color: rgba(255, 107, 138, 0.5);
}

body.twilight .frame-corner {
    color: rgba(255, 107, 138, 0.6);
}

body.twilight .site-title {
    color: var(--warm-parchment);
}

body.twilight .island-caption {
    color: var(--lavender-mist);
}

body.twilight .beaded-line::before {
    background: repeating-linear-gradient(
        to right,
        var(--lavender-mist) 0px,
        var(--lavender-mist) 3px,
        transparent 3px,
        transparent 11px
    );
    opacity: 0.4;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .island-offset-right,
    .island-offset-left {
        justify-content: center;
        padding-left: 5vw;
        padding-right: 5vw;
    }

    .island-frame {
        max-width: 90vw;
        width: 100%;
    }

    .island-content {
        padding: 28px 24px;
    }

    .nav-pill {
        top: 12px;
        right: 12px;
        padding: 6px 14px;
    }

    .nav-radial-item {
        width: 30px;
        height: 30px;
        font-size: 0.65rem;
    }

    .opening-flower {
        width: 90px;
        height: 90px;
    }

    .vine-spacer {
        height: 18vh;
    }
}

@media (max-width: 480px) {
    .island-content {
        padding: 20px 16px;
    }

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