/* ============================================================
   bunny.quest — Blobitecture Warm-Burrow Diary
   Palette:
     #F5EFE0  Cream Paper      — dominant background
     #E8D7BA  Ochre Meadow     — burrow blob fills
     #8C5A2F  Warm Umber       — primary text / chapter ink
     #B68549  Hazel Brown      — rules & dates
     #7B8C5C  Mossy Sage       — leaves
     #C45B36  Clay Persimmon   — cursor halo inner ring
     #3A3026  Soil Deep        — italic field notes
   ============================================================ */

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

html, body {
    background: #F5EFE0;
    color: #8C5A2F;
    font-family: 'Quicksand', system-ui, -apple-system, sans-serif;
    overflow-x: hidden;
    cursor: none;
}

body {
    font-size: clamp(17px, 1.25vw, 20px);
    line-height: 1.7;
    font-weight: 400;
    background:
        radial-gradient(ellipse at 20% 10%, rgba(232, 215, 186, 0.35) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 80%, rgba(232, 215, 186, 0.28) 0%, transparent 55%),
        #F5EFE0;
    min-height: 100vh;
}

/* Subtle paper grain — done with a stacked gradient */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background-image:
        repeating-linear-gradient(125deg, rgba(140, 90, 47, 0.012) 0px, rgba(140, 90, 47, 0.012) 1px, transparent 1px, transparent 3px),
        repeating-linear-gradient(35deg, rgba(140, 90, 47, 0.010) 0px, rgba(140, 90, 47, 0.010) 1px, transparent 1px, transparent 4px);
    mix-blend-mode: multiply;
    opacity: 0.6;
}

/* ============================================================
   Cursor halo
   ============================================================ */
.cursor-halo {
    position: fixed;
    top: 0;
    left: 0;
    width: 24px;
    height: 24px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: width 240ms ease, height 240ms ease, opacity 400ms ease;
    mix-blend-mode: multiply;
}

.cursor-halo.visible {
    opacity: 1;
}

.cursor-halo .halo-outer {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, rgba(245, 239, 224, 0.86) 0%, rgba(245, 239, 224, 0.6) 40%, rgba(245, 239, 224, 0) 70%);
    box-shadow:
        0 2px 8px rgba(58, 48, 38, 0.10),
        inset 0 0 8px rgba(123, 140, 92, 0.14);
}

.cursor-halo .halo-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: transparent;
    border: 1.5px solid transparent;
    transition: border-color 240ms ease, width 240ms ease, height 240ms ease;
}

.cursor-halo.active {
    width: 36px;
    height: 36px;
}

.cursor-halo.active .halo-inner {
    width: 14px;
    height: 14px;
    border-color: rgba(196, 91, 54, 0.5);
}

/* ============================================================
   Sections
   ============================================================ */
.section {
    position: relative;
    width: 100%;
    z-index: 2;
    padding: 8vh 4vw;
}

.section-entrance {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-chapter {
    min-height: 140vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 14vh;
    padding-bottom: 14vh;
}

.section-observations {
    min-height: 160vh;
    padding: 14vh 4vw;
}

.section-signoff {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================
   Section 0 — Entrance
   ============================================================ */
.entrance-inner {
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
}

.leaf-header {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.leaf-header.small svg {
    width: 110px;
    height: auto;
}

.leaf-header svg {
    width: 160px;
    height: auto;
    overflow: visible;
}

.leaf-group .leaf-shape {
    transform-origin: center;
    transform-box: fill-box;
    transition: stroke-width 1400ms ease, transform 1400ms ease;
}

.entrance-sublabel {
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #B68549;
    font-variant-caps: small-caps;
}

.wordmark {
    font-family: 'Quicksand', sans-serif;
    font-weight: 600;
    font-size: clamp(40px, 7vw, 88px);
    letter-spacing: 0.005em;
    color: #8C5A2F;
    line-height: 1.05;
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
}

.wordmark .letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(0);
    transition: opacity 480ms ease;
    animation: letterReveal 720ms cubic-bezier(0.34, 1.4, 0.64, 1) forwards;
    animation-delay: calc(var(--i, 0) * 80ms + 600ms);
}

.wordmark .letter-dot {
    color: #C45B36;
}

@keyframes letterReveal {
    0%   { opacity: 0; transform: translateY(0); }
    35%  { opacity: 1; transform: translateY(-4px); }
    65%  { transform: translateY(2px); }
    100% { opacity: 1; transform: translateY(0); }
}

.burrow-entrance {
    width: clamp(280px, 50vw, 480px);
    height: auto;
    overflow: visible;
}

.burrow-entrance .ink-line,
.burrow-entrance .ink-fill {
    stroke-dasharray: var(--len, 600);
    stroke-dashoffset: var(--len, 600);
    animation: strokeReveal 1600ms ease-out forwards;
    animation-delay: 200ms;
}

.burrow-entrance .ink-fill {
    fill-opacity: 0;
    animation: strokeReveal 1600ms ease-out forwards, fillIn 800ms ease 1500ms forwards;
}

.entrance-bunny {
    opacity: 0;
    animation: fadeIn 800ms ease 1800ms forwards;
}

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

@keyframes fillIn {
    to { fill-opacity: 1; }
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.entrance-byline {
    font-size: 16px;
    color: #B68549;
    max-width: 460px;
    opacity: 0;
    animation: fadeUp 800ms ease 2000ms forwards;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.scroll-indicator {
    margin-top: 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    opacity: 0;
    animation: fadeIn 800ms ease 2400ms forwards, bobSlow 2.6s ease-in-out 2.6s infinite;
}

.scroll-text {
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #B68549;
    font-variant-caps: small-caps;
    font-weight: 500;
}

.scroll-arrow {
    width: 18px;
    height: auto;
}

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

/* ============================================================
   Chapter sections (1 & 3)
   ============================================================ */
.chapter-wrap {
    position: relative;
    max-width: 760px;
    width: 100%;
    margin: 0 auto;
    padding: 12vh 6vw 14vh 6vw;
    z-index: 1;
}

.burrow-blob {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: visible;
    filter: drop-shadow(0 18px 40px rgba(58, 48, 38, 0.10));
}

.burrow-blob .blob-path {
    stroke-dasharray: 4800;
    stroke-dashoffset: 4800;
    opacity: 0;
    transition: stroke-dashoffset 1400ms ease-out, opacity 600ms ease, fill 600ms ease, stroke-width 240ms ease;
}

.section.in-view .burrow-blob .blob-path {
    stroke-dashoffset: 0;
    opacity: 1;
}

.section-chapter.in-view .burrow-blob .blob-path,
.section-signoff.in-view .burrow-blob .blob-path {
    animation: blobDraw 1400ms ease-out forwards;
}

@keyframes blobDraw {
    0%   { stroke-dashoffset: 4800; opacity: 0; }
    20%  { opacity: 1; }
    100% { stroke-dashoffset: 0; opacity: 1; }
}

.chapter-head {
    margin-bottom: 36px;
    position: relative;
}

.chapter-head .sub-label,
.observations-head .sub-label,
.section-signoff .sub-label {
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #B68549;
    font-variant-caps: small-caps;
    margin-bottom: 14px;
    display: inline-block;
}

.display-headline {
    font-family: 'Quicksand', sans-serif;
    font-weight: 600;
    font-size: clamp(32px, 4.5vw, 60px);
    line-height: 1.12;
    letter-spacing: 0.005em;
    color: #8C5A2F;
    margin-top: 16px;
}

.display-headline .reveal-line {
    display: block;
}

.chapter-body {
    color: #8C5A2F;
    font-size: clamp(17px, 1.25vw, 20px);
    line-height: 1.78;
}

.chapter-body p {
    margin-bottom: 1.1em;
}

.chapter-body em {
    color: #3A3026;
    font-style: italic;
}

.date-stamp {
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: #B68549;
    font-size: 13px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-variant-caps: small-caps;
    border-top: 1px solid rgba(182, 133, 73, 0.35);
    border-bottom: 1px solid rgba(182, 133, 73, 0.35);
    padding: 10px 0;
    margin-bottom: 28px !important;
    display: block;
}

.date-stamp .num {
    font-weight: 500;
}

.field-note {
    margin-top: 1.5em;
    padding-top: 1.2em;
    border-top: 1px dashed rgba(182, 133, 73, 0.5);
    color: #3A3026;
    font-style: italic;
    font-size: 16px;
}

/* Reveal-line cascade — initial state */
.reveal-line {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 700ms ease, transform 700ms ease;
}

.section.in-view .reveal-line,
.section.in-view [data-cascade] .reveal-line {
    opacity: 1;
    transform: translateY(0);
}

/* Cascade ordering */
[data-cascade] > *:nth-child(1)  { transition-delay: 0ms; }
[data-cascade] > *:nth-child(2)  { transition-delay: 60ms; }
[data-cascade] > *:nth-child(3)  { transition-delay: 120ms; }
[data-cascade] > *:nth-child(4)  { transition-delay: 180ms; }
[data-cascade] > *:nth-child(5)  { transition-delay: 240ms; }
[data-cascade] > *:nth-child(6)  { transition-delay: 300ms; }
[data-cascade] > *:nth-child(7)  { transition-delay: 360ms; }
[data-cascade] > *:nth-child(8)  { transition-delay: 420ms; }
[data-cascade] > *:nth-child(9)  { transition-delay: 480ms; }
[data-cascade] > *:nth-child(10) { transition-delay: 540ms; }

/* Corner illustration (rabbit) */
.corner-illus {
    position: absolute;
    width: clamp(70px, 9vw, 110px);
    height: auto;
    z-index: 2;
}

.corner-illus-tr {
    top: -10px;
    right: -10px;
}

.corner-illus svg {
    width: 100%;
    height: auto;
    overflow: visible;
    transition: filter 280ms ease;
}

/* Gutter illustrations (fern, ch2) */
.gutter-illus {
    position: absolute;
    width: 70px;
    height: auto;
    top: 30%;
    z-index: 2;
    transition: filter 280ms ease;
}

.gutter-illus-left {
    left: -90px;
}

@media (max-width: 980px) {
    .gutter-illus {
        display: none;
    }
}

/* Leaf trail marginalia */
.leaf-trail {
    position: absolute;
    width: 32px;
    height: 220px;
    top: 30%;
    right: -56px;
    z-index: 1;
    opacity: 0.85;
}

.leaf-trail-left {
    right: auto;
    left: -56px;
}

.trail-leaf {
    transform-origin: center;
    transform-box: fill-box;
    transition: stroke-width 1400ms ease, transform 1400ms ease;
}

@media (max-width: 980px) {
    .leaf-trail {
        display: none;
    }
}

/* Chapter hover behaviour */
.section-chapter .burrow-blob:hover .blob-path {
    stroke-width: 2;
}

/* ============================================================
   Section 2 — Observations
   ============================================================ */
.observations-wrap {
    max-width: 820px;
    width: 100%;
    margin: 0 auto;
}

.observations-head {
    text-align: center;
    margin-bottom: 60px;
}

.observations-head .display-headline {
    margin-top: 14px;
}

.observation-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 36px;
    counter-reset: obs;
}

.observation {
    position: relative;
    padding: 28px 36px 28px 110px;
    min-height: 130px;
    display: flex;
    align-items: center;
    transition: transform 320ms ease;
}

.observation:hover {
    transform: translateY(-2px);
}

.observation .obs-blob {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    filter: drop-shadow(0 8px 18px rgba(58, 48, 38, 0.08));
}

.observation .obs-blob .blob-path {
    stroke-dasharray: 2400;
    stroke-dashoffset: 2400;
    opacity: 0;
    transition: stroke-width 240ms ease, fill 240ms ease;
}

.section-observations.in-view .observation .obs-blob .blob-path {
    animation: blobDrawObs 1400ms ease-out forwards;
    animation-delay: calc(var(--obs-i, 0) * 90ms);
}

@keyframes blobDrawObs {
    0%   { stroke-dashoffset: 2400; opacity: 0; }
    25%  { opacity: 1; }
    100% { stroke-dashoffset: 0; opacity: 1; }
}

.observation:hover .obs-blob .blob-path {
    stroke-width: 2;
}

.obs-illus {
    position: absolute;
    left: 26px;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    transition: filter 280ms ease;
}

.obs-illus svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.obs-content {
    flex: 1;
}

.obs-meta {
    font-size: 12.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #B68549;
    font-weight: 500;
    font-variant-caps: small-caps;
    font-variant-numeric: tabular-nums;
    margin-bottom: 6px;
}

.obs-species {
    color: #8C5A2F;
    font-size: 16px;
    line-height: 1.55;
}

.obs-species em {
    color: #3A3026;
    font-style: italic;
}

@media (max-width: 720px) {
    .observation {
        padding: 24px 24px 24px 96px;
    }
    .obs-illus {
        left: 20px;
        width: 48px;
        height: 48px;
    }
}

/* Hover illus halo glow */
.hover-illus {
    transition: filter 280ms ease;
}

.hover-illus.hover-glow {
    filter: drop-shadow(0 0 14px rgba(232, 215, 186, 0.95));
}

/* Hover ink-line thickening for leaves */
.leaf-shape.hover-thick {
    stroke-width: 2 !important;
}

/* ============================================================
   Section 4 — Sign-off
   ============================================================ */
.signoff-wrap {
    position: relative;
    max-width: 680px;
    width: 100%;
    padding: 12vh 6vw;
    margin: 0 auto;
}

.signoff-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 18px;
}

.signoff-rabbit {
    width: 100px;
    height: auto;
    margin: 8px 0 4px 0;
    transition: filter 280ms ease;
}

.signoff-rabbit svg {
    width: 100%;
    height: auto;
    overflow: visible;
}

.signoff-line {
    font-family: 'Quicksand', sans-serif;
    font-weight: 600;
    color: #8C5A2F;
    font-size: clamp(24px, 3vw, 36px);
    line-height: 1.2;
    letter-spacing: 0.005em;
}

.signoff-line:nth-of-type(2) {
    color: #3A3026;
    font-style: italic;
    font-weight: 500;
}

.signature {
    width: 280px;
    height: auto;
    margin-top: 12px;
    overflow: visible;
}

.signature .sig-path {
    stroke-dasharray: 1400;
    stroke-dashoffset: 1400;
}

.section-signoff.in-view .signature .sig-path {
    animation: sigDraw 2200ms ease-out 600ms forwards;
}

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

.signoff-attribution {
    margin-top: 16px;
    font-size: 14px;
    color: #B68549;
    font-style: italic;
    max-width: 380px;
}

/* ============================================================
   SVG stroke reveal — leaf clusters
   ============================================================ */
.leaf-cluster .leaf-shape {
    stroke-dasharray: 120;
    stroke-dashoffset: 120;
}

.section.in-view .leaf-cluster .leaf-shape {
    animation: leafDraw 1200ms ease-out forwards;
}

.section.in-view .leaf-cluster .leaf-shape:nth-child(1) { animation-delay: 0ms; }
.section.in-view .leaf-cluster .leaf-shape:nth-child(2) { animation-delay: 80ms; }
.section.in-view .leaf-cluster .leaf-shape:nth-child(3) { animation-delay: 160ms; }
.section.in-view .leaf-cluster .leaf-shape:nth-child(4) { animation-delay: 240ms; }
.section.in-view .leaf-cluster .leaf-shape:nth-child(5) { animation-delay: 320ms; }
.section.in-view .leaf-cluster .leaf-shape:nth-child(6) { animation-delay: 400ms; }
.section.in-view .leaf-cluster .leaf-shape:nth-child(7) { animation-delay: 480ms; }
.section.in-view .leaf-cluster .leaf-shape:nth-child(8) { animation-delay: 560ms; }

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

/* Hand-drawn illustration stroke-reveal — corner / signoff */
.corner-illus svg path,
.signoff-rabbit svg path,
.gutter-illus svg path,
.obs-illus svg path {
    stroke-dasharray: 280;
    stroke-dashoffset: 280;
}

.section.in-view .corner-illus svg path,
.section.in-view .signoff-rabbit svg path,
.section.in-view .gutter-illus svg path,
.section.in-view .obs-illus svg path {
    animation: illusDraw 1600ms ease-out forwards;
    animation-delay: 600ms;
}

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

/* Entrance bunny */
.entrance-bunny path {
    stroke-dasharray: 320;
    stroke-dashoffset: 320;
    animation: illusDraw 1600ms ease-out 1400ms forwards;
}

/* ============================================================
   Responsive tweaks
   ============================================================ */
@media (max-width: 720px) {
    .chapter-wrap {
        padding: 10vh 8vw;
    }
    .corner-illus {
        width: 72px;
        top: -6px;
        right: -6px;
    }
    .signoff-wrap {
        padding: 10vh 6vw;
    }
    body {
        cursor: auto;
    }
    .cursor-halo {
        display: none;
    }
}
