/* =========================================================
   JJUGGL.ai — ethereal woodland atelier
   palette: forest-green / gilded-dawn
   typography: art-deco display + serif body
   layout: centered cathedral / five cantos
   ========================================================= */

:root {
    --hemlock: #0E1A14;
    --moss-bed: #1B2E22;
    --fern-frond: #2F4A36;
    --vine-shadow: #3D5A47;
    --lichen-silver: #7FA88A;
    --gilded-dawn: #D9C58A;
    --tarnished-brass: #8B7340;
    --pollen-light: #F4ECD2;
    --abyss: #07100C;

    --font-display: 'Limelight', 'Inter', serif;
    --font-cinzel: 'Cinzel Decorative', 'Lora', serif;
    --font-body: 'Cormorant Garamond', 'Lora', serif;
    --font-italiana: 'Italiana', 'Cormorant', serif;

    --ease-cathedral: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-curtain: cubic-bezier(0.65, 0, 0.35, 1);

    --col-narrow: 620px;
}

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

html, body {
    width: 100%;
    overflow-x: hidden;
}

body {
    background: var(--hemlock);
    color: var(--lichen-silver);
    font-family: var(--font-body);
    font-size: clamp(1.05rem, 1.4vw, 1.2rem);
    line-height: 1.85;
    font-weight: 400;
    min-height: 100vh;
    position: relative;
}

/* ============================================
   GLOBAL ATMOSPHERIC LAYERS
   ============================================ */

.mist-layer {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
    opacity: 0.85;
}

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

.mist-band {
    transform-origin: center;
}

.mist-band-1 {
    animation: mist-drift-a 28s linear infinite;
}

.mist-band-2 {
    animation: mist-drift-b 36s linear infinite;
}

.mist-band-3 {
    animation: mist-drift-a 44s linear infinite reverse;
}

@keyframes mist-drift-a {
    0%   { transform: translateX(-80px); }
    50%  { transform: translateX(80px); }
    100% { transform: translateX(-80px); }
}

@keyframes mist-drift-b {
    0%   { transform: translateX(60px); }
    50%  { transform: translateX(-60px); }
    100% { transform: translateX(60px); }
}

.pollen-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
}

.pollen-dot {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--pollen-light);
    border-radius: 50%;
    opacity: 0;
    box-shadow: 0 0 6px rgba(244, 236, 210, 0.7);
    animation: pollen-fall var(--life, 22s) linear infinite;
    animation-delay: var(--delay, 0s);
}

@keyframes pollen-fall {
    0%   { transform: translate3d(0, -10vh, 0); opacity: 0; }
    8%   { opacity: 0.85; }
    25%  { transform: translate3d(8px, 25vh, 0); opacity: 0.5; }
    50%  { transform: translate3d(-12px, 50vh, 0); opacity: 0.9; }
    75%  { transform: translate3d(10px, 75vh, 0); opacity: 0.5; }
    92%  { opacity: 0.7; }
    100% { transform: translate3d(-6px, 110vh, 0); opacity: 0; }
}

/* ============================================
   CATHEDRAL CONTAINER
   ============================================ */

.cathedral {
    position: relative;
    z-index: 5;
    width: 100%;
}

.canto {
    position: relative;
    min-height: 100vh;
    padding: 8vh 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.canto-frame {
    position: relative;
    width: 100%;
    max-width: var(--col-narrow);
    margin: 0 auto;
    padding: 6rem 2rem 5rem;
}

/* deco hairline frame on left and right of canto-frame */
.canto-frame::before,
.canto-frame::after {
    content: "";
    position: absolute;
    top: 2rem;
    bottom: 2rem;
    width: 0.5px;
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(139, 115, 64, 0.6) 12%,
        rgba(139, 115, 64, 0.6) 88%,
        transparent 100%);
}

.canto-frame::before { left: 0; }
.canto-frame::after { right: 0; }

.frame-corner {
    position: absolute;
    width: 18px;
    height: 18px;
    border: 0.5px solid var(--tarnished-brass);
    opacity: 0.7;
}

.frame-corner.corner-tl { top: 1.4rem; left: -8px; border-right: none; border-bottom: none; }
.frame-corner.corner-tr { top: 1.4rem; right: -8px; border-left: none; border-bottom: none; }
.frame-corner.corner-bl { bottom: 1.4rem; left: -8px; border-right: none; border-top: none; }
.frame-corner.corner-br { bottom: 1.4rem; right: -8px; border-left: none; border-top: none; }

.frame-corner::after {
    content: "";
    position: absolute;
    inset: 4px;
    border: 0.5px solid var(--tarnished-brass);
    opacity: 0.6;
}

/* ============================================
   CANTO 1 — THE THRESHOLD
   ============================================ */

.canto-threshold {
    background: radial-gradient(ellipse at 50% 30%, var(--moss-bed) 0%, var(--hemlock) 70%);
    overflow: hidden;
    position: relative;
}

.threshold-aura {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90vmin;
    height: 90vmin;
    background: radial-gradient(circle, rgba(217, 197, 138, 0.06) 0%, transparent 60%);
    pointer-events: none;
    animation: aura-pulse 8s ease-in-out infinite;
}

@keyframes aura-pulse {
    0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
    50%      { opacity: 0.85; transform: translate(-50%, -50%) scale(1.05); }
}

.ginkgo {
    position: absolute;
    top: 18%;
    width: clamp(110px, 14vw, 220px);
    height: auto;
    opacity: 0.92;
    z-index: 3;
}

.ginkgo-left {
    left: clamp(1rem, 8vw, 8rem);
    transform: rotate(-6deg);
}

.ginkgo-right {
    right: clamp(1rem, 8vw, 8rem);
    transform: rotate(6deg) scaleX(-1);
}

.draw-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
}

.threshold-inner.entered .ginkgo-group .draw-path,
.canto-threshold.entered .ginkgo-group .draw-path {
    animation: draw-stroke 2.4s var(--ease-cathedral) forwards;
}

.canto-threshold.entered .draw-path {
    animation: draw-stroke 2.4s var(--ease-cathedral) forwards;
}

.canto.entered .draw-path {
    animation: draw-stroke 1.6s var(--ease-cathedral) forwards;
}

.canto.entered .draw-path:nth-child(2)  { animation-delay: 0.1s; }
.canto.entered .draw-path:nth-child(3)  { animation-delay: 0.2s; }
.canto.entered .draw-path:nth-child(4)  { animation-delay: 0.3s; }
.canto.entered .draw-path:nth-child(5)  { animation-delay: 0.4s; }
.canto.entered .draw-path:nth-child(6)  { animation-delay: 0.5s; }
.canto.entered .draw-path:nth-child(7)  { animation-delay: 0.6s; }
.canto.entered .draw-path:nth-child(8)  { animation-delay: 0.7s; }
.canto.entered .draw-path:nth-child(9)  { animation-delay: 0.8s; }
.canto.entered .draw-path:nth-child(10) { animation-delay: 0.9s; }

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

.threshold-inner {
    position: relative;
    z-index: 4;
    text-align: center;
}

.wordmark {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(4rem, 10vw, 9rem);
    color: var(--gilded-dawn);
    letter-spacing: 0.08em;
    line-height: 1;
    text-shadow: 0 0 24px rgba(217, 197, 138, 0.18);
    display: inline-block;
}

.wm-letter, .wm-dot {
    display: inline-block;
    opacity: 0;
    transform: translateY(0.2em);
    animation: wm-rise 1.2s var(--ease-cathedral) forwards;
}

.wm-letter:nth-child(1) { animation-delay: 0.1s; }
.wm-letter:nth-child(2) { animation-delay: 0.2s; }
.wm-letter:nth-child(3) { animation-delay: 0.3s; }
.wm-letter:nth-child(4) { animation-delay: 0.4s; }
.wm-letter:nth-child(5) { animation-delay: 0.5s; }
.wm-letter:nth-child(6) { animation-delay: 0.6s; }
.wm-dot                 { animation-delay: 0.75s; }
.wm-letter:nth-child(8) { animation-delay: 0.85s; }
.wm-letter:nth-child(9) { animation-delay: 0.95s; }

@keyframes wm-rise {
    to { opacity: 1; transform: translateY(0); }
}

.wm-dot {
    color: var(--pollen-light);
}

.wm-i {
    position: relative;
}

.dewdrop {
    position: absolute;
    top: -0.05em;
    left: 50%;
    width: 0.18em;
    height: 0.18em;
    border-radius: 50%;
    background: radial-gradient(circle, var(--pollen-light) 30%, rgba(244, 236, 210, 0.4) 70%);
    transform: translateX(-50%);
    box-shadow: 0 0 12px rgba(244, 236, 210, 0.7);
    animation: dewdrop-pulse 5s ease-in-out infinite;
    animation-delay: 1.4s;
    opacity: 0;
}

@keyframes dewdrop-pulse {
    0%, 100% { opacity: 0.6; }
    50%      { opacity: 1; }
}

.threshold-subtitle {
    margin-top: 1.6rem;
    font-family: var(--font-italiana);
    font-style: italic;
    font-size: clamp(1rem, 1.6vw, 1.35rem);
    color: var(--lichen-silver);
    letter-spacing: 0.04em;
    opacity: 0;
    animation: fade-up 1.4s var(--ease-cathedral) 1.1s forwards;
}

@keyframes fade-up {
    from { opacity: 0; transform: translateY(0.8em); }
    to   { opacity: 0.85; transform: translateY(0); }
}

.lantern-cue {
    position: absolute;
    bottom: 4vh;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--lichen-silver);
    transition: opacity 600ms var(--ease-cathedral), filter 600ms var(--ease-cathedral);
    opacity: 0.7;
}

.lantern-cue:hover {
    opacity: 1;
    filter: brightness(1.15);
}

.lantern-small {
    width: 38px;
    height: auto;
    animation: lantern-sway 7s ease-in-out infinite;
}

@keyframes lantern-sway {
    0%, 100% { transform: rotate(-2deg); }
    50%      { transform: rotate(2deg); }
}

.lantern-cue-label {
    font-family: var(--font-italiana);
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: lowercase;
    color: var(--tarnished-brass);
}

/* ============================================
   DIVIDERS — sun-burst between cantos
   ============================================ */

.divider {
    position: relative;
    z-index: 5;
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 1rem 0;
    pointer-events: none;
}

.divider-svg {
    width: 200px;
    height: 80px;
    opacity: 0.85;
    animation: divider-breath 12s ease-in-out infinite;
    transform-origin: center bottom;
}

@keyframes divider-breath {
    0%, 100% { transform: rotate(-0.5deg); }
    50%      { transform: rotate(0.5deg); }
}

/* ============================================
   CANTO COMMON — title, numeral, prose
   ============================================ */

.canto-numeral {
    font-family: var(--font-cinzel);
    font-weight: 700;
    font-size: 2.5rem;
    color: var(--fern-frond);
    letter-spacing: 0.14em;
    margin-bottom: 1rem;
    opacity: 0;
    transition: opacity 400ms var(--ease-cathedral);
}

.canto.entered .canto-numeral {
    opacity: 0.95;
    transition-delay: 0.1s;
}

.canto-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(2.4rem, 5vw, 4.2rem);
    letter-spacing: 0.08em;
    color: var(--gilded-dawn);
    margin-bottom: 3rem;
    line-height: 1.1;
}

/* slide-reveal mechanic — text emerges from behind a hairline */
.slide-reveal {
    position: relative;
    overflow: hidden;
    display: block;
}

.slide-reveal > * {
    display: inline-block;
}

.slide-reveal::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--gilded-dawn);
    box-shadow: 0 0 6px rgba(217, 197, 138, 0.6);
    z-index: 2;
    pointer-events: none;
    opacity: 0;
}

.slide-reveal::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    background: var(--hemlock);
    z-index: 1;
    pointer-events: none;
}

/* hairline starts on the LEFT for left-direction reveal */
.slide-reveal[data-direction="left"]::after {
    left: 0;
    right: 0;
}

.slide-reveal[data-direction="left"]::before {
    left: 0;
}

.slide-reveal[data-direction="right"]::after {
    left: 0;
    right: 0;
}

.slide-reveal[data-direction="right"]::before {
    right: 0;
}

/* the actual reveal animation */
.canto.entered .slide-reveal::after {
    animation: curtain-sweep 1.1s var(--ease-curtain) forwards;
    animation-delay: 0.3s;
}

.canto.entered .slide-reveal::before {
    animation: hairline-sweep 1.1s var(--ease-curtain) forwards;
    animation-delay: 0.3s;
}

.canto.entered .slide-reveal:nth-of-type(2)::after,
.canto.entered .slide-reveal:nth-of-type(2)::before { animation-delay: 0.55s; }
.canto.entered .slide-reveal:nth-of-type(3)::after,
.canto.entered .slide-reveal:nth-of-type(3)::before { animation-delay: 0.8s; }
.canto.entered .slide-reveal:nth-of-type(4)::after,
.canto.entered .slide-reveal:nth-of-type(4)::before { animation-delay: 1.05s; }
.canto.entered .slide-reveal:nth-of-type(5)::after,
.canto.entered .slide-reveal:nth-of-type(5)::before { animation-delay: 1.3s; }

.canto.entered .canto-prose .slide-reveal:nth-of-type(1)::after,
.canto.entered .canto-prose .slide-reveal:nth-of-type(1)::before { animation-delay: 0.6s; }
.canto.entered .canto-prose .slide-reveal:nth-of-type(2)::after,
.canto.entered .canto-prose .slide-reveal:nth-of-type(2)::before { animation-delay: 0.9s; }
.canto.entered .canto-prose .slide-reveal:nth-of-type(3)::after,
.canto.entered .canto-prose .slide-reveal:nth-of-type(3)::before { animation-delay: 1.2s; }

@keyframes curtain-sweep {
    0%   { left: 0; right: 0; opacity: 1; }
    50%  { opacity: 1; }
    100% { left: 100%; right: 0; opacity: 1; }
}

.slide-reveal[data-direction="right"].active-rev::after {
    left: 0; right: 0;
}

.canto.entered .slide-reveal[data-direction="right"]::after {
    animation: curtain-sweep-right 1.1s var(--ease-curtain) forwards;
    animation-delay: 0.3s;
}

@keyframes curtain-sweep-right {
    0%   { left: 0; right: 0; opacity: 1; }
    50%  { opacity: 1; }
    100% { left: 0; right: 100%; opacity: 1; }
}

@keyframes hairline-sweep {
    0%   { opacity: 1; transform: translateX(0); }
    100% { opacity: 0; transform: translateX(100vw); }
}

.canto.entered .slide-reveal[data-direction="right"]::before {
    animation: hairline-sweep-right 1.1s var(--ease-curtain) forwards;
    animation-delay: 0.3s;
}

@keyframes hairline-sweep-right {
    0%   { opacity: 1; transform: translateX(0); }
    100% { opacity: 0; transform: translateX(-100vw); }
}

.canto-prose {
    margin-top: 1rem;
}

.canto-prose p {
    margin-bottom: 1.6rem;
    color: var(--lichen-silver);
    text-align: left;
}

.canto-prose p em {
    color: var(--gilded-dawn);
    font-style: italic;
}

/* ============================================
   CANTO 2 — THE LISTENING
   ============================================ */

.canto-listening {
    background: linear-gradient(180deg, var(--hemlock) 0%, var(--moss-bed) 50%, var(--hemlock) 100%);
}

.botanical {
    position: absolute;
    width: clamp(80px, 12vw, 200px);
    height: auto;
    pointer-events: none;
}

.pine-arc {
    top: 20%;
    right: clamp(0.5rem, 4vw, 4rem);
    height: 60vh;
    width: auto;
    max-width: 200px;
    opacity: 0.85;
}

.waveform {
    margin: 3.5rem auto 0;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 6px;
    height: 40px;
}

.wf-bar {
    display: inline-block;
    width: 6px;
    background: var(--gilded-dawn);
    border-radius: 1px;
    height: 6px;
    opacity: 0.55;
    transition: height 800ms var(--ease-cathedral), opacity 800ms var(--ease-cathedral);
    transform-origin: bottom;
}

/* ============================================
   CANTO 3 — THE TENDING
   ============================================ */

.canto-tending {
    background: var(--hemlock);
}

.pull-quote {
    position: relative;
    margin: 2.4rem 0;
    padding: 1.6rem 2.4rem;
    font-family: var(--font-body);
    font-style: italic;
    font-size: clamp(1.1rem, 1.6vw, 1.35rem);
    color: var(--gilded-dawn);
    text-align: center;
    line-height: 1.7;
}

.pq-orn {
    display: inline-block;
    width: 18px;
    height: 12px;
    margin: 0 0.4em;
    vertical-align: middle;
    background:
        linear-gradient(45deg, transparent 45%, var(--tarnished-brass) 45%, var(--tarnished-brass) 55%, transparent 55%),
        linear-gradient(-45deg, transparent 45%, var(--tarnished-brass) 45%, var(--tarnished-brass) 55%, transparent 55%);
    opacity: 0.85;
}

.mycelium {
    position: absolute;
    bottom: 4rem;
    left: 0;
    width: 100%;
    height: 100px;
    pointer-events: none;
    opacity: 0.7;
}

/* ============================================
   CANTO 4 — THE RECIPROCITY
   ============================================ */

.canto-reciprocity {
    background: linear-gradient(180deg, var(--hemlock) 0%, var(--moss-bed) 100%);
}

.reciprocity-frame {
    position: relative;
    width: 100%;
    max-width: 880px;
    margin: 0 auto;
    padding: 7rem 2.5rem 4rem;
    border: 0.5px solid var(--tarnished-brass);
    background:
        linear-gradient(180deg, transparent 0%, rgba(217, 197, 138, 0.02) 50%, transparent 100%);
}

.reciprocity-frame::before,
.reciprocity-frame::after {
    content: "";
    position: absolute;
    width: 30px;
    height: 30px;
    border: 0.5px solid var(--gilded-dawn);
    opacity: 0.7;
}

.reciprocity-frame::before {
    top: -1px; left: -1px;
    border-right: none; border-bottom: none;
}

.reciprocity-frame::after {
    bottom: -1px; right: -1px;
    border-left: none; border-top: none;
}

.seedpods {
    position: absolute;
    top: -1.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: clamp(280px, 60%, 600px);
    height: auto;
    pointer-events: none;
    opacity: 0.9;
}

.reciprocity-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 2rem;
    text-align: left;
}

.rc-col {
    padding: 0 0.5rem;
    border-left: 0.5px solid rgba(139, 115, 64, 0.3);
}

.rc-col:first-child {
    border-left: none;
}

.rc-heading {
    display: block;
    font-family: var(--font-italiana);
    font-style: italic;
    font-size: 0.95rem;
    color: var(--gilded-dawn);
    letter-spacing: 0.06em;
    margin-bottom: 0.8rem;
    line-height: 1.4;
}

.rc-col p {
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    color: var(--lichen-silver);
    line-height: 1.75;
}

@media (max-width: 720px) {
    .reciprocity-columns {
        grid-template-columns: 1fr;
        gap: 2.4rem;
    }
    .rc-col {
        border-left: none;
        border-top: 0.5px solid rgba(139, 115, 64, 0.3);
        padding-top: 1.4rem;
    }
    .rc-col:first-child {
        border-top: none;
        padding-top: 0;
    }
}

/* ============================================
   CANTO 5 — THE LANTERN
   ============================================ */

.canto-lantern {
    background: linear-gradient(180deg, var(--hemlock) 0%, var(--abyss) 100%);
    min-height: 110vh;
    padding-bottom: 4rem;
}

.foxglove {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(calc(-50% - 250px));
    width: clamp(80px, 10vw, 160px);
    height: auto;
    opacity: 0.7;
    pointer-events: none;
}

.canto-title-lantern {
    margin-bottom: 2.5rem;
}

.lantern-prose {
    max-width: var(--col-narrow);
    margin: 0 auto 4rem;
}

.lantern-prose p {
    color: var(--lichen-silver);
    margin-bottom: 1.4rem;
    text-align: center;
    font-style: italic;
    font-size: clamp(1.05rem, 1.5vw, 1.25rem);
}

.lantern-benediction {
    color: var(--tarnished-brass);
    margin-top: 2rem;
    letter-spacing: 0.02em;
}

.final-lantern {
    position: relative;
    width: 200px;
    height: 280px;
    margin: 2rem auto 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lantern-halo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(244, 236, 210, 0.18) 0%, rgba(244, 236, 210, 0.05) 40%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: halo-pulse 6s ease-in-out infinite;
}

@keyframes halo-pulse {
    0%, 100% { opacity: 0.55; transform: translate(-50%, -50%) scale(1); }
    50%      { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
}

.lantern-large {
    position: relative;
    width: 200px;
    height: auto;
    z-index: 2;
    animation: lantern-sway 9s ease-in-out infinite;
}

.lantern-footer {
    margin-top: 3rem;
    text-align: center;
}

.footer-line {
    font-family: var(--font-italiana);
    font-size: 0.85rem;
    color: var(--vine-shadow);
    letter-spacing: 0.16em;
    opacity: 0.65;
}

/* ============================================
   REVEAL HELPERS
   ============================================ */

.reveal-fade {
    opacity: 0;
    transition: opacity 800ms var(--ease-cathedral);
}

.canto.entered .reveal-fade {
    opacity: 0.95;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 880px) {
    .ginkgo-left  { left: -2rem; opacity: 0.55; }
    .ginkgo-right { right: -2rem; opacity: 0.55; }
    .pine-arc { right: -3rem; opacity: 0.45; }
    .foxglove { transform: translateX(calc(-50% - 120px)); opacity: 0.5; }
    .canto-frame { padding: 5rem 1rem 4rem; }
    .reciprocity-frame { padding: 6rem 1.4rem 3rem; }
}

@media (max-width: 540px) {
    .ginkgo { display: none; }
    .canto-title { font-size: 2.2rem; }
    .wordmark { font-size: clamp(3rem, 16vw, 5rem); }
    .threshold-subtitle { font-size: 1rem; }
}

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