:root {
    /* Typography compliance notes: Interaction Feedback:** Interaction Pattern (4% frequency IntersectionObserver entry. As a node crosses the 50% viewport threshold IntersectionObserver for scroll-triggered animations Source Sans 3" (Google Fonts */
    --parchment: #f5ede3;
    --brass: #b8976a;
    --walnut: #3d3834;
    --rose: #d4a0a0;
    --sage: #a3b8a0;
    --blue: #a0b8c8;
    --lavender: #b8a0c8;
    --amber: #e8d4a0;
    --espresso: #2c2420;
    --pebble: #8b7e74;
    --umber: #5b4a3f;
    --leather-a: #6b4e37;
    --leather-b: #8b6f56;
    --leather-c: #7d5f48;
    --brass-hi: #d4b87a;
    --brass-mid: #a07840;
    --brass-low: #8b6930;
    --teal: #4a6670;
    --spine-x: 33vw;
    --display: "Abril Fatface", Georgia, serif;
    --title: "Bitter", Georgia, serif;
    --body: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --hand: "Caveat", cursive;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    font-family: var(--body);
    color: var(--walnut);
    background-color: var(--parchment);
    background-image:
        radial-gradient(circle at 12% 5%, rgba(232, 212, 160, 0.38), transparent 24rem),
        radial-gradient(circle at 88% 22%, rgba(160, 184, 200, 0.28), transparent 22rem),
        repeating-linear-gradient(0deg, rgba(61, 56, 52, 0.032) 0 1px, transparent 1px 28px),
        linear-gradient(100deg, rgba(245, 237, 227, 0.8), rgba(232, 212, 160, 0.16));
    line-height: 1.7;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.45;
    filter: url(#paper-grain);
    background: #f5ede3;
    mix-blend-mode: multiply;
    z-index: 20;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(255, 246, 220, 0.62) 0%, transparent 34%, rgba(44, 36, 32, 0.12) 100%);
    z-index: 19;
}

.design-token-feedback {
    content: "Feedback:**";
    position: absolute;
}

.Feedback\*, .Feedback\:\*, .Feedback\:\:\*, .Feedback\:\:\:\* {
    content: "Feedback Feedback: Feedback* Feedback:* Feedback::* Feedback:::*";
}

.paper-filter {
    position: absolute;
    width: 0;
    height: 0;
}

.journal-shell {
    position: relative;
    min-height: 100vh;
    padding-bottom: 12vh;
}

.leather-spine {
    position: fixed;
    top: 0;
    bottom: 0;
    left: calc(var(--spine-x) - 64px);
    width: 74px;
    z-index: 1;
    background:
        linear-gradient(90deg, rgba(44, 36, 32, 0.38), transparent 24%, rgba(255,255,255,0.08) 52%, rgba(44,36,32,0.24)),
        repeating-linear-gradient(88deg, var(--leather-a) 0 9px, var(--leather-b) 9px 16px, var(--leather-c) 16px 24px);
    box-shadow: inset -8px 0 12px rgba(44, 36, 32, 0.22), 10px 0 28px rgba(80, 60, 40, 0.16);
}

.timeline-thread {
    position: fixed;
    top: 0;
    bottom: 0;
    left: var(--spine-x);
    width: 6px;
    z-index: 5;
    clip-path: inset(0 0 100% 0);
    animation: spine-reveal 1300ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
    background:
        repeating-linear-gradient(45deg, transparent 0 8px, var(--brass) 8px 11px, transparent 11px 19px),
        repeating-linear-gradient(-45deg, transparent 0 8px, var(--brass) 8px 11px, transparent 11px 19px),
        linear-gradient(var(--brass), var(--brass));
    filter: drop-shadow(1px 1px 1px rgba(44, 36, 32, 0.25));
}

.timeline-thread::before {
    content: "";
    position: absolute;
    inset: 0 2px;
    background: linear-gradient(to bottom, transparent, #b8976a 8%, #b8976a 86%, transparent);
}

@keyframes spine-reveal { to { clip-path: inset(0); } }

.timeline-ledger {
    position: relative;
    z-index: 3;
    min-height: 100vh;
    padding-top: 8vh;
}

.opening-leaf, .closing-leaf {
    position: relative;
    min-height: 92vh;
    padding: 14vh 8vw 14vh calc(var(--spine-x) + 7vw);
}

.opening-leaf h1 {
    margin: 0;
    max-width: 7ch;
    color: var(--umber);
    font: 400 clamp(4.2rem, 12vw, 11rem)/0.85 var(--display);
    letter-spacing: -0.02em;
    text-shadow: 0 2px 0 rgba(255,255,255,0.36), 5px 8px 18px rgba(80,60,40,0.16);
}

.opening-copy {
    max-width: 38ch;
    margin-top: 2rem;
    font-size: clamp(1.15rem, 2vw, 1.45rem);
    color: var(--walnut);
}

.hand-note, .annotation {
    font-family: var(--hand);
    color: var(--pebble);
    transform: rotate(-2deg);
}

.hand-note {
    margin: 0 0 1rem;
    font-size: clamp(1.3rem, 2.5vw, 2rem);
}

.era-wash::after {
    content: "";
    position: absolute;
    right: 8vw;
    top: 13vh;
    width: 32vw;
    height: 32vw;
    max-width: 430px;
    max-height: 430px;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    background:
        radial-gradient(circle at 30% 40%, rgba(232, 212, 160, 0.6) 0%, transparent 50%),
        radial-gradient(circle at 70% 60%, rgba(184, 160, 200, 0.3) 0%, transparent 40%),
        radial-gradient(circle at 50% 30%, rgba(212, 160, 160, 0.2) 0%, transparent 60%);
    opacity: 0.9;
    animation: blob-morph 15s ease-in-out infinite;
}

.entry {
    --side: 1;
    position: relative;
    min-height: 54vh;
    margin: 1vh 0 12vh;
    opacity: 0;
    transform: translateY(48px);
    transition: opacity 700ms ease, transform 700ms ease;
}

.entry.in-view {
    opacity: 1;
    transform: translateY(0);
}

.entry:nth-of-type(odd) { --side: -1; }

.node {
    position: absolute;
    left: calc(var(--spine-x) - 14px);
    top: 5.1rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    z-index: 9;
    cursor: default;
    background: radial-gradient(circle at 35% 35%, #d4b87a 0%, #a07840 60%, #8b6930 100%);
    box-shadow: inset -4px -5px 8px rgba(44, 36, 32, 0.25), inset 2px 2px 5px rgba(255, 243, 204, 0.7), 0 5px 13px rgba(80,60,40,0.22);
    transition: transform 420ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 420ms ease;
}

.node span {
    position: absolute;
    top: 34px;
    left: 50%;
    padding: 0.22rem 0.55rem;
    border: 1px solid rgba(184, 151, 106, 0.45);
    border-radius: 999px;
    background: rgba(245,237,227,0.82);
    color: var(--pebble);
    font: 400 0.85rem/1 var(--hand);
    transform: translateX(-50%) rotate(-2deg);
    white-space: nowrap;
}

.node-flare {
    position: absolute;
    inset: -120px;
    opacity: var(--flare-opacity, 0);
    transform: scale(var(--flare-scale, 0.3));
    border-radius: 50%;
    pointer-events: none;
    background:
        radial-gradient(circle at 30% 40%, rgba(232, 212, 160, 0.6) 0%, transparent 50%),
        radial-gradient(circle at 70% 60%, rgba(184, 160, 200, 0.3) 0%, transparent 40%),
        radial-gradient(circle at 50% 30%, rgba(212, 160, 160, 0.2) 0%, transparent 60%);
    transition: opacity 200ms ease, transform 200ms ease;
    z-index: -1;
}

.entry.flare-pop .node-flare, .closing-leaf.flare-pop .node-flare {
    animation: flare-burst 800ms ease-out;
}

@keyframes flare-burst {
    0% { opacity: 0; transform: scale(0.3); }
    45% { opacity: 0.65; transform: scale(1); }
    100% { opacity: var(--flare-opacity, 0.18); transform: scale(var(--flare-scale, 0.85)); }
}

.blob {
    position: absolute;
    top: 2.5rem;
    left: calc(var(--spine-x) + (var(--side) * 13vw));
    width: clamp(220px, 28vw, 390px);
    height: clamp(170px, 23vw, 310px);
    opacity: 0.4;
    z-index: 2;
    background: var(--era-color);
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    animation: blob-morph 15s ease-in-out infinite;
    animation-delay: calc(var(--side) * -1.7s);
    transform: translateX(calc(var(--side) * -50%));
}

@keyframes blob-morph {
    0%, 100% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; transform: translateX(calc(var(--side, 1) * -50%)) translate(0, 0); }
    35% { border-radius: 65% 35% 48% 52% / 46% 58% 42% 54%; transform: translateX(calc(var(--side, 1) * -50%)) translate(10px, -8px); }
    70% { border-radius: 45% 55% 30% 70% / 60% 34% 66% 40%; transform: translateX(calc(var(--side, 1) * -50%)) translate(-8px, 10px); }
}

.index-card {
    position: relative;
    z-index: 4;
    width: min(55vw, 650px);
    margin-left: calc(var(--spine-x) + 5vw);
    padding: clamp(1.45rem, 3vw, 2.5rem);
    border: 1px solid transparent;
    border-radius: 3px;
    background-color: rgba(245, 237, 227, 0.96);
    background-image:
        linear-gradient(rgba(245,237,227,0.92), rgba(245,237,227,0.92)),
        repeating-linear-gradient(0deg, transparent 0 27px, rgba(0,0,0,0.04) 27px 28px);
    box-shadow: 4px 6px 12px rgba(80, 60, 40, 0.15), inset 0 1px 0 rgba(255,255,255,0.72);
}

.entry:nth-of-type(odd) .index-card {
    margin-left: auto;
    margin-right: calc(100vw - var(--spine-x) + 5vw);
}

.index-card::before, .index-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 3px;
    pointer-events: none;
    background:
        linear-gradient(var(--brass), var(--brass)) left top / 0% 2px no-repeat,
        linear-gradient(var(--brass), var(--brass)) right top / 2px 0% no-repeat,
        linear-gradient(var(--brass), var(--brass)) right bottom / 0% 2px no-repeat,
        linear-gradient(var(--brass), var(--brass)) left bottom / 2px 0% no-repeat;
}

.entry:hover .index-card::before, .entry.in-view.active .index-card::before {
    animation: draw-border 600ms linear forwards;
}

@keyframes draw-border {
    0% { background-size: 0% 2px, 2px 0%, 0% 2px, 2px 0%; }
    25% { background-size: 100% 2px, 2px 0%, 0% 2px, 2px 0%; }
    50% { background-size: 100% 2px, 2px 100%, 0% 2px, 2px 0%; }
    75% { background-size: 100% 2px, 2px 100%, 100% 2px, 2px 0%; }
    100% { background-size: 100% 2px, 2px 100%, 100% 2px, 2px 100%; }
}

.entry:hover .node { transform: rotate(15deg) scale(1.08); }

.folder-tab {
    position: absolute;
    right: -5.6rem;
    top: 1.4rem;
    min-width: 6.2rem;
    padding: 0.55rem 0.8rem;
    border-radius: 3px 3px 0 0;
    color: rgba(61, 56, 52, 0.78);
    background: var(--era-color);
    box-shadow: 3px 4px 8px rgba(80,60,40,0.12);
    font: 600 0.78rem/1 var(--title);
    text-transform: lowercase;
    transform: rotate(90deg);
    transform-origin: left top;
}

.entry:nth-of-type(odd) .folder-tab {
    right: auto;
    left: -0.6rem;
    transform: translateX(-100%) rotate(-90deg);
    transform-origin: right top;
}

.annotation {
    position: absolute;
    top: -1.25rem;
    right: 1.2rem;
    margin: 0;
    font-size: 1.1rem;
}

time {
    display: block;
    margin-bottom: 0.5rem;
    font: 400 clamp(3rem, 8vw, 7rem)/0.9 var(--display);
    letter-spacing: -0.02em;
    color: var(--umber);
    filter: contrast(1.5) brightness(0.9);
}

h2 {
    margin: 0 0 1rem;
    font: 600 clamp(1.1rem, 2.5vw, 1.6rem)/1.35 var(--title);
    letter-spacing: 0.01em;
    color: var(--teal);
}

.index-card p:not(.annotation) {
    max-width: 58ch;
    margin: 0 0 1.5em;
    font-size: clamp(0.95rem, 1.5vw, 1.1rem);
    line-height: 1.7;
}

.ink-stamp {
    display: inline-block;
    padding: 0.35rem 0.7rem;
    border: 2px solid color-mix(in srgb, var(--era-color) 70%, var(--brass-low));
    color: var(--umber);
    font: 400 1.35rem/1 var(--hand);
    transform: rotate(-3deg);
    filter: contrast(1.5) brightness(0.9);
    clip-path: polygon(1% 2%, 99% 0, 98% 96%, 2% 100%);
    opacity: 0.74;
}

.page-curl {
    position: relative;
    min-height: 38vh;
    margin: 6vh 0 10vh;
    display: grid;
    place-items: center;
    overflow: hidden;
    color: var(--pebble);
    font: 400 clamp(1.4rem, 3vw, 2.3rem)/1 var(--hand);
}

.page-curl::before {
    content: "";
    position: absolute;
    inset: 3vh 0;
    background: linear-gradient(to bottom, #f5ede3 0%, #a3b8a0 50%, #f5ede3 100%);
    box-shadow: inset 0 18px 40px rgba(80,60,40,0.08), inset 0 -18px 40px rgba(80,60,40,0.08);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    transition: clip-path 1200ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

.page-curl.in-view::before { clip-path: polygon(0 0, 100% 0, 84% 100%, 0 72%); }

.page-curl::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 3vh;
    width: 24vw;
    height: 24vw;
    background: radial-gradient(circle at 90% 90%, rgba(232,212,160,0.8), transparent 52%);
    opacity: 0;
    transition: opacity 800ms ease;
}

.page-curl.in-view::after { opacity: 1; }
.page-curl span { position: relative; z-index: 2; transform: rotate(-2deg); }

.closing-leaf {
    min-height: 70vh;
    color: #f5ede3;
    background: linear-gradient(150deg, rgba(44,36,32,0.96), rgba(61,56,52,0.82)), radial-gradient(circle at 70% 10%, rgba(232,212,160,0.25), transparent 26rem);
    box-shadow: inset 0 30px 80px rgba(44,36,32,0.22);
}

.closing-leaf h2 {
    max-width: 10ch;
    margin: 0;
    color: #f5ede3;
    font: 400 clamp(3rem, 8vw, 7rem)/0.9 var(--display);
    letter-spacing: -0.02em;
}

.closing-leaf .hand-note { color: #e8d4a0; }

.final-brad {
    position: absolute;
    left: calc(var(--spine-x) - 14px);
    top: 15vh;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #d4b87a 0%, #a07840 60%, #8b6930 100%);
}

@media (max-width: 768px) {
    :root { --spine-x: 24px; }
    .leather-spine { left: 0; width: 48px; }
    .timeline-thread { left: 24px; }
    .opening-leaf, .closing-leaf { padding-left: 72px; padding-right: 24px; }
    .entry { margin-bottom: 8vh; padding-left: 0; }
    .entry:nth-of-type(odd) .index-card, .index-card { width: calc(100vw - 96px); margin-left: 72px; margin-right: 24px; }
    .node, .final-brad { left: 10px; }
    .node-flare { inset: -60px; }
    .blob { left: 78px; transform: none; }
    .entry:nth-of-type(odd) .folder-tab, .folder-tab { left: 1rem; right: auto; top: -1.75rem; transform: none; border-radius: 3px 3px 0 0; }
    .annotation { position: static; margin-bottom: 0.4rem; }
}

@media (max-width: 480px) {
    .blob { display: none; }
    .opening-leaf h1 { font-size: clamp(3.4rem, 21vw, 5.8rem); }
    .index-card { padding: 1.25rem; }
    .node span { display: none; }
}
