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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: #f5efe6;
    color: #3d2b1f;
    /* palette refs: #1f1408 #c97d4a */
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.72;
    min-height: 100vh;
    padding: 8vw;
    overflow-x: hidden;
    position: relative;
    opacity: 0;
    animation: pageReveal 400ms 400ms ease forwards;
}

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

/* === Manuscript Border (wide viewports) === */
.manuscript-border {
    display: none;
}

@media (min-width: 1200px) {
    .manuscript-border {
        display: block;
        position: fixed;
        top: 3vw;
        left: 3vw;
        right: 3vw;
        bottom: 3vw;
        border: 0.5px solid #ece4d6;
        outline: 0.5px solid #ece4d6;
        outline-offset: 4px;
        pointer-events: none;
        z-index: 0;
    }
}

/* === Typography === */
.site-title {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 7rem);
    color: #b5450a;
    letter-spacing: -0.02em;
    line-height: 0.95;
    margin-bottom: 0.3em;
    max-width: 50%;
    position: relative;
    z-index: 2;
}

.site-title .letter {
    display: inline-block;
    opacity: 0;
    transform: scale(0.6);
    animation: bounceIn 500ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes bounceIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.site-title .letter:nth-child(1) { animation-delay: 1000ms; }
.site-title .letter:nth-child(2) { animation-delay: 1060ms; }
.site-title .letter:nth-child(3) { animation-delay: 1120ms; }
.site-title .letter:nth-child(4) { animation-delay: 1180ms; }
.site-title .letter:nth-child(5) { animation-delay: 1240ms; }
.site-title .letter:nth-child(6) { animation-delay: 1300ms; }
.site-title .letter:nth-child(7) { animation-delay: 1360ms; }
.site-title .letter:nth-child(8) { animation-delay: 1420ms; }
.site-title .letter:nth-child(9) { animation-delay: 1480ms; }
.site-title .letter:nth-child(10) { animation-delay: 1540ms; }
.site-title .letter:nth-child(11) { animation-delay: 1600ms; }

.subtitle {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 2vw, 1.35rem);
    color: #8b6f4e;
    max-width: 38em;
    margin-left: 5%;
    margin-bottom: 140px;
    line-height: 1.72;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease, transform 600ms ease;
}

.subtitle.visible {
    opacity: 1;
    transform: translateY(0);
}

/* === Hero Quill === */
.hero-quill {
    position: absolute;
    top: 6vw;
    right: 10vw;
    width: clamp(100px, 15vw, 200px);
    height: auto;
    transform: rotate(-35deg);
    opacity: 0;
    animation: quillFadeIn 600ms 1000ms ease forwards;
    z-index: 1;
}

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

/* === Content Blocks === */
.content-block {
    max-width: 38em;
    margin-bottom: 60px;
    position: relative;
    z-index: 2;
}

.content-block p {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    color: #3d2b1f;
    line-height: 1.72;
}

.block-left {
    margin-left: 0;
    margin-right: auto;
}

.block-center-right {
    margin-left: 25%;
    margin-right: 0;
}

.block-left-narrow {
    max-width: 24em;
    margin-left: 5%;
}

.block-right {
    margin-left: auto;
    margin-right: 5%;
}

.block-center-left {
    margin-left: 10%;
}

.poetry-excerpt {
    font-family: 'Source Serif 4', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    line-height: 2;
    color: #3d2b1f;
}

mark {
    background-color: #e8a83e;
    color: #3d2b1f;
    padding: 0.05em 0.2em;
    border-radius: 2px;
}

/* === Closing Passage === */
.closing-passage {
    text-align: center;
    margin: 120px auto 40px;
    max-width: 60%;
    position: relative;
    z-index: 2;
}

.closing-text {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: clamp(2.2rem, 5vw, 4.5rem);
    color: #b5450a;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

/* === Annotations (Marginalia) === */
.annotation {
    position: relative;
    z-index: 2;
    margin-bottom: 40px;
}

.annotation-text {
    font-family: 'Kalam', cursive;
    font-weight: 300;
    font-style: italic;
    font-size: 0.85rem;
    color: #8b6f4e;
    display: inline-block;
    transition: transform 200ms ease, color 200ms ease;
}

.annotation-text:hover {
    transform: scale(1.05);
    color: #3d2b1f;
}

.annotation-right {
    text-align: right;
    margin-right: 5%;
    margin-left: auto;
}

.annotation-left {
    text-align: left;
    margin-left: 2%;
}

.annotation.animate-annotation {
    opacity: 0;
    transform: translateX(10px);
    transition: opacity 200ms ease, transform 200ms ease;
}

.annotation.animate-annotation.visible {
    opacity: 1;
    transform: translateX(0);
}

.annotation-right.animate-annotation {
    transform: translateX(10px);
}

.annotation-left.animate-annotation {
    transform: translateX(-10px);
}

/* === Swirl Flourishes === */
.swirl-flourish {
    display: block;
    margin: 80px auto;
    position: relative;
    z-index: 1;
}

.swirl-1 { width: clamp(120px, 25vw, 200px); margin-left: 15%; }
.swirl-2 { width: clamp(140px, 28vw, 220px); margin-right: 10%; margin-left: auto; }
.swirl-3 { width: clamp(150px, 30vw, 240px); margin-left: 20%; }
.swirl-4 { width: clamp(120px, 22vw, 180px); margin-left: auto; margin-right: 20%; }
.swirl-5 { width: clamp(200px, 40vw, 340px); }
.swirl-signature { width: clamp(250px, 50vw, 400px); margin-bottom: 100px; }

.swirl-flourish path {
    stroke-dasharray: var(--path-length, 500);
    stroke-dashoffset: var(--path-length, 500);
    transition: stroke-dashoffset 1.2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.swirl-signature path {
    transition-duration: 2s;
}

.swirl-flourish.visible path {
    stroke-dashoffset: 0;
}

/* === Book & Ink Bottle Motifs === */
.book-motif {
    display: block;
    width: clamp(60px, 10vw, 120px);
    margin: 40px 0 40px auto;
    margin-right: 15%;
    position: relative;
    z-index: 1;
}

.ink-bottle-motif {
    width: clamp(35px, 6vw, 60px);
    margin-left: 8%;
    margin-right: auto;
}

/* === Ink Drops === */
.ink-drop {
    position: absolute;
    z-index: 1;
    transition: transform 200ms ease-out, opacity 200ms ease-out;
    cursor: default;
}

.ink-drop:hover {
    transform: scale(1.3);
}

.ink-drop:hover circle {
    opacity: 1;
}

.ink-drop-1 { top: 22vh; left: 42%; width: 10px; }
.ink-drop-2 { top: 25vh; left: 45%; width: 7px; }
.ink-drop-3 { top: 23vh; left: 48%; width: 5px; }
.ink-drop-4 { top: 55%; left: 60%; width: 12px; }
.ink-drop-5 { top: 57%; left: 63%; width: 7px; }
.ink-drop-6 { position: relative; display: block; width: 9px; margin: 20px 0 20px 30%; }

/* === Grid Fillers === */
.grid-filler {
    position: absolute;
    z-index: 0;
    pointer-events: none;
}

.grid-filler-1 {
    width: 80px;
    top: 38%;
    right: 8%;
}

.grid-filler-2 {
    width: 100px;
    top: 62%;
    left: 4%;
}

/* === Animate Block (bounce-enter) === */
.animate-block {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 600ms ease, transform 600ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.animate-block.visible {
    opacity: 1;
    transform: translateY(0);
}

/* === Scroll to Top Button === */
.scroll-top {
    position: fixed;
    bottom: 3vw;
    right: 3vw;
    background: none;
    border: none;
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: 2rem;
    color: #8b6f4e;
    cursor: pointer;
    z-index: 10;
    opacity: 0;
    transition: opacity 300ms ease, color 200ms ease;
    line-height: 1;
}

.scroll-top.show {
    opacity: 1;
}

.scroll-top:hover {
    color: #b5450a;
    background-color: transparent;
}

/* Footer-level deep ink color */
.scroll-top::after {
    color: #1f1408;
}

/* Terracotta hover accent */
a:hover {
    color: #c97d4a;
}

/* === Responsive adjustments === */
@media (max-width: 768px) {
    body {
        padding: 6vw;
    }

    .site-title {
        max-width: 80%;
    }

    .hero-quill {
        width: 80px;
        top: 4vw;
        right: 4vw;
    }

    .block-center-right {
        margin-left: 5%;
    }

    .block-right {
        margin-left: 5%;
        margin-right: 0;
    }

    .closing-passage {
        max-width: 90%;
    }

    .annotation-right {
        margin-right: 0;
        text-align: left;
    }

    .grid-filler {
        display: none;
    }

    .ink-drop-4, .ink-drop-5 {
        display: none;
    }
}
