/* =========================================================
   20241204.com — an almanac entry
   forest-green · isometric · flowing-curves · warm-inviting
   ========================================================= */

:root {
    --cedar:      #2A3B2C;
    --moss:       #4F6B43;
    --sage:       #7E956A;
    --lichen:     #B6BFA0;
    --cream:      #E9DFC7;
    --persimmon:  #C9885A;
    --tobacco:    #7A4A2A;

    --font-display: 'Fraunces', Georgia, serif;
    --font-body:    'Newsreader', Georgia, serif;
    --font-mono:    'DM Mono', ui-monospace, monospace;

    --panel-pad-x: clamp(88px, 11vw, 220px);
    --panel-pad-y: clamp(64px, 8vh, 140px);
}

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

html, body {
    background: var(--cream);
    color: var(--cedar);
    font-family: var(--font-body);
    font-feature-settings: "kern", "liga", "onum";
    line-height: 1.65;
    cursor: none;
    overflow-x: hidden;
}

body {
    min-height: 100vh;
}

/* ---------- Cursor ---------- */

.cursor-dot,
.cursor-halo {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1000;
    transform: translate(-50%, -50%);
    will-change: transform;
}

.cursor-dot {
    width: 8px;
    height: 8px;
    background: var(--persimmon);
    border-radius: 50%;
    transition: width 0.25s cubic-bezier(0.2, 0.8, 0.2, 1),
                height 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.cursor-halo {
    width: 24px;
    height: 24px;
    background: var(--lichen);
    border-radius: 50%;
    opacity: 0.4;
    transition: width 0.3s cubic-bezier(0.2, 0.8, 0.2, 1),
                height 0.3s cubic-bezier(0.2, 0.8, 0.2, 1),
                opacity 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

body.cursor-magnetic .cursor-halo {
    width: 56px;
    height: 56px;
    opacity: 0.55;
}
body.cursor-magnetic .cursor-dot {
    width: 12px;
    height: 12px;
}

/* ---------- Grain overlay (fixed, never animated) ---------- */

.grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 999;
    mix-blend-mode: multiply;
    opacity: 0.08;
}
.grain svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* ---------- Spine (flowing-curve progress on left) ---------- */

.spine {
    position: fixed;
    left: clamp(24px, 4vw, 56px);
    top: 10vh;
    height: 80vh;
    width: 60px;
    z-index: 50;
    pointer-events: none;
}
.spine svg {
    width: 100%;
    height: 100%;
    display: block;
}
.spine-label {
    position: absolute;
    bottom: -2.4rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.18em;
    color: var(--tobacco);
    text-transform: uppercase;
    white-space: nowrap;
}

#spineFill {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ---------- Zoom transition overlay ---------- */

.zoom-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 800;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.7, 0, 0.3, 1);
}
.zoom-overlay.active {
    opacity: 1;
}
.zoom-halo {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60vmax;
    height: 60vmax;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(201,136,90,0.25) 0%, rgba(201,136,90,0.12) 30%, rgba(201,136,90,0) 70%);
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.8s cubic-bezier(0.7, 0, 0.3, 1);
}
.zoom-overlay.active .zoom-halo {
    transform: translate(-50%, -50%) scale(1);
}

/* ---------- Panel base ---------- */

.reel {
    position: relative;
    z-index: 10;
}

.panel {
    position: relative;
    min-height: 100vh;
    padding: var(--panel-pad-y) var(--panel-pad-x);
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.panel-header {
    margin-bottom: 3rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.caption-mono {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--tobacco);
    font-weight: 400;
}

.chapter-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4.4vw, 4rem);
    line-height: 1.05;
    color: var(--cedar);
    font-weight: 380;
    font-variation-settings: "opsz" 144, "SOFT" 50, "WONK" 0;
    letter-spacing: -0.01em;
    max-width: 22ch;
}

.chapter-title.chapter-wonky {
    font-variation-settings: "opsz" 144, "SOFT" 80, "WONK" 1;
    font-weight: 600;
}

.panel-body {
    font-family: var(--font-body);
    font-size: clamp(1.05rem, 1.4vw, 1.3rem);
    font-variation-settings: "opsz" 18;
    line-height: 1.7;
    max-width: 64ch;
    color: var(--cedar);
}

/* ---------- Panel 1: Cover Plate ---------- */

.panel-cover {
    justify-content: space-between;
    align-items: stretch;
}
.cover-meta {
    align-self: flex-start;
}
.cover-date {
    font-family: var(--font-display);
    font-size: clamp(96px, 18vw, 320px);
    line-height: 0.85;
    color: var(--cedar);
    font-variation-settings: "opsz" 144, "wght" 220, "SOFT" 60, "WONK" 0;
    letter-spacing: -0.03em;
    text-align: center;
    align-self: center;
    user-select: none;
    will-change: font-variation-settings;
}
.cover-date .date-segment {
    display: inline-block;
}
.cover-date .date-dot {
    color: var(--persimmon);
    display: inline-block;
    padding: 0 0.05em;
}
.cover-date .year {
    color: var(--moss);
}
.cover-sub {
    font-family: var(--font-body);
    font-style: italic;
    font-size: clamp(1.05rem, 1.4vw, 1.3rem);
    font-variation-settings: "opsz" 18;
    color: var(--moss);
    text-align: center;
    max-width: 38ch;
    margin: 1rem auto 0;
    line-height: 1.6;
}
.cover-stamp {
    align-self: flex-end;
}
.cover-stamp svg {
    width: 64px;
    height: 64px;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.cover-stamp svg:hover {
    transform: scale(1.04);
}
.cover-hint {
    align-self: center;
    margin-top: auto;
    opacity: 0.7;
    animation: cover-hint-breathe 3.6s ease-in-out infinite;
}
@keyframes cover-hint-breathe {
    0%, 100% { opacity: 0.45; }
    50%      { opacity: 0.8; }
}

/* ---------- Panel 2: Almanac Strip ---------- */

.panel-almanac {
    justify-content: center;
}

.almanac-frieze {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: clamp(20px, 2.5vw, 48px);
    align-items: end;
    margin: 3rem 0;
}

.iso-figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    cursor: none;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.iso-figure svg {
    width: 100%;
    max-width: 120px;
    height: auto;
    display: block;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.iso-figure:hover svg {
    transform: scale(1.04);
}
.iso-figure figcaption {
    text-align: center;
}

.almanac-body {
    font-style: italic;
    color: var(--moss);
    margin-top: 2rem;
    max-width: 54ch;
    align-self: flex-start;
}

/* ---------- Panel 3: The Long Look ---------- */

.panel-longlook {
    padding-left: 0;
    padding-right: 0;
    padding-top: var(--panel-pad-y);
    padding-bottom: var(--panel-pad-y);
}

.longlook-header {
    padding: 0 var(--panel-pad-x);
    margin-bottom: 2rem;
}

.diorama {
    width: 100%;
    height: 60vh;
    min-height: 420px;
    overflow: hidden;
    position: relative;
}
.diorama-svg {
    width: 100%;
    height: 100%;
    display: block;
}

[data-layer] {
    will-change: transform;
    transition: transform 0.05s linear;
}

.longlook-body {
    padding: 0 var(--panel-pad-x);
    margin-top: 2rem;
    font-style: italic;
    color: var(--moss);
    max-width: 56ch;
    align-self: flex-start;
}

/* ---------- Panel 4: Chapter Margins ---------- */

.panel-margins {
    justify-content: center;
}

.margins-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: clamp(40px, 5vw, 100px);
    align-items: start;
}
.margins-main {
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
    max-width: 60ch;
}
.margins-paragraph {
    font-family: var(--font-body);
    font-size: clamp(1.05rem, 1.45vw, 1.35rem);
    font-variation-settings: "opsz" 18;
    line-height: 1.75;
    color: var(--cedar);
}
.margins-paragraph::first-letter {
    font-family: var(--font-display);
    font-size: 2.4em;
    font-variation-settings: "opsz" 144, "wght" 500, "WONK" 1;
    line-height: 0.9;
    float: left;
    margin: 0.15em 0.18em 0 -0.05em;
    color: var(--persimmon);
}
.margins-paragraph:not(:first-child)::first-letter {
    font-size: 1em;
    font-family: inherit;
    float: none;
    margin: 0;
    color: inherit;
}

.margins-aside {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding-top: 2.4rem;
    border-left: 1px solid var(--sage);
    padding-left: clamp(20px, 2vw, 36px);
}
.margin-note {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
}
.margin-note::before {
    content: "";
    position: absolute;
    left: -20px;
    top: 0.4em;
    width: 8px;
    height: 8px;
    background: var(--persimmon);
    border-radius: 50%;
    transform: translateX(-50%);
}
.margin-note p {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--moss);
    max-width: 30ch;
}

/* ---------- Panel 5: Field Notes ---------- */

.panel-field {
    justify-content: center;
}

.field-stack {
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
    margin-top: 2rem;
    max-width: 800px;
}

.field-entry {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}
.field-entry header {
    display: flex;
    align-items: baseline;
    gap: 1.2rem;
    flex-wrap: wrap;
}
.field-entry h3 {
    font-family: var(--font-display);
    font-size: clamp(1.3rem, 1.8vw, 1.7rem);
    font-variation-settings: "opsz" 144, "wght" 480, "SOFT" 70, "WONK" 1;
    color: var(--cedar);
    font-weight: 480;
    line-height: 1.2;
}
.field-entry p {
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.3vw, 1.2rem);
    font-variation-settings: "opsz" 18;
    line-height: 1.7;
    max-width: 64ch;
    color: var(--cedar);
}

.curve-divider {
    width: 100%;
    height: 24px;
    display: block;
}

/* ---------- Panel 6: Closing Vignette ---------- */

.panel-vignette {
    padding: 0;
    background: var(--cedar);
    color: var(--cream);
}

.vignette-scene {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 600px;
    overflow: hidden;
}

.vignette-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.vignette-copy {
    position: absolute;
    left: 50%;
    bottom: 12vh;
    transform: translateX(-50%);
    text-align: center;
    z-index: 5;
    width: 100%;
    padding: 0 2rem;
}

.vignette-line {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 2.6vw, 2.4rem);
    font-variation-settings: "opsz" 144, "wght" 320, "SOFT" 80, "WONK" 0;
    line-height: 1.35;
    color: var(--cream);
    max-width: 30ch;
    margin: 0 auto;
    font-style: italic;
    letter-spacing: -0.005em;
}

/* ---------- Panel 7: Colophon ---------- */

.panel-colophon {
    background: var(--cream);
    color: var(--cedar);
    justify-content: center;
}

.colophon-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: clamp(40px, 5vw, 90px);
    align-items: start;
    max-width: 900px;
    margin: 0 auto;
}

.colophon-stamp svg {
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.colophon-stamp svg:hover {
    transform: scale(1.04);
}

.colophon-text {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.colophon-title {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 2.2vw, 2rem);
    font-variation-settings: "opsz" 144, "wght" 500, "SOFT" 70, "WONK" 1;
    color: var(--moss);
    margin-bottom: 0.8rem;
}

.colophon-line {
    font-family: var(--font-body);
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    font-variation-settings: "opsz" 18;
    color: var(--cedar);
    line-height: 1.55;
}

.colophon-meta {
    margin-top: 1.8rem;
}

.squiggle-link {
    position: relative;
    display: inline-block;
    color: var(--tobacco);
    padding: 0 2px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 6' preserveAspectRatio='none'><path d='M 0 4 C 20 1, 40 5, 60 3 S 100 5, 120 2' fill='none' stroke='%237A4A2A' stroke-width='1'/></svg>");
    background-repeat: repeat-x;
    background-position: 0 100%;
    background-size: 120px 4px;
    padding-bottom: 4px;
    transition: color 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.squiggle-link:hover {
    color: var(--persimmon);
}

/* ---------- Responsive shaping ---------- */

@media (max-width: 900px) {
    .almanac-frieze {
        grid-template-columns: repeat(3, 1fr);
        gap: 32px;
    }
    .margins-grid {
        grid-template-columns: 1fr;
    }
    .margins-aside {
        border-left: none;
        border-top: 1px solid var(--sage);
        padding-left: 0;
        padding-top: 2rem;
    }
    .colophon-grid {
        grid-template-columns: 1fr;
        text-align: left;
    }
    .spine {
        left: 8px;
        width: 28px;
    }
    :root {
        --panel-pad-x: clamp(24px, 6vw, 56px);
    }
}

@media (max-width: 560px) {
    .almanac-frieze {
        grid-template-columns: repeat(2, 1fr);
    }
    .cover-date {
        font-size: clamp(72px, 22vw, 180px);
    }
    .cursor-dot,
    .cursor-halo {
        display: none;
    }
    html, body {
        cursor: auto;
    }
    .spine {
        display: none;
    }
}

/* ---------- Subtle ambient motion (low-attention) ---------- */

.steam, .flame, .smoke {
    transform-origin: center bottom;
    animation: gentle-rise 6s ease-in-out infinite;
}
.flame {
    animation-duration: 4s;
}
.smoke {
    animation-duration: 7s;
}

@keyframes gentle-rise {
    0%, 100% { transform: translateY(0) scaleY(1); opacity: 0.7; }
    50%      { transform: translateY(-1.5px) scaleY(1.03); opacity: 0.85; }
}
