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

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

body {
    background-color: #F4F1EC;
    color: #2C2A27;
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 400;
    font-size: 1.125rem;
    line-height: 1.75;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ===== SVG Filters (Hidden) ===== */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ===== Home Asterisk ===== */
.home-asterisk {
    position: fixed;
    top: 1.5rem;
    left: 2rem;
    font-family: 'Caveat', cursive;
    font-size: 1.8rem;
    color: #6B6560;
    text-decoration: none;
    z-index: 100;
    opacity: 0.6;
    transition: opacity 0.4s cubic-bezier(0.25, 0.1, 0.25, 1.0);
    filter: url(#wobble);
}

.home-asterisk:hover {
    opacity: 1;
    color: #C4A882;
}

/* ===== Floating Decorative Elements ===== */
.floating-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

.floating-el {
    position: absolute;
    opacity: 0;
    transition: opacity 1.5s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.floating-el.visible {
    opacity: 0.5;
}

.float-crosshair {
    top: 15vh;
    right: 12vw;
    transform: rotate(2deg);
    animation: float-drift-1 8s ease-in-out infinite;
}

.float-dimension {
    top: 35vh;
    left: 6vw;
    transform: rotate(-1.5deg);
    animation: float-drift-2 10s ease-in-out infinite;
}

.float-grid {
    top: 55vh;
    right: 8vw;
    transform: rotate(3deg);
    animation: float-drift-3 7s ease-in-out infinite;
}

.float-asterisk-deco {
    top: 70vh;
    left: 10vw;
    transform: rotate(-2deg);
    animation: float-drift-1 9s ease-in-out infinite;
}

.float-angle {
    top: 85vh;
    right: 15vw;
    transform: rotate(1deg);
    animation: float-drift-2 6s ease-in-out infinite;
}

@keyframes float-drift-1 {
    0%, 100% { transform: translateY(0) rotate(2deg); }
    50% { transform: translateY(-4px) rotate(2.5deg); }
}

@keyframes float-drift-2 {
    0%, 100% { transform: translateY(0) rotate(-1.5deg); }
    50% { transform: translateY(-3px) rotate(-1deg); }
}

@keyframes float-drift-3 {
    0%, 100% { transform: translateY(0) rotate(3deg); }
    50% { transform: translateY(-5px) rotate(3.5deg); }
}

/* ===== Vellum Sheet (Base) ===== */
.vellum-sheet {
    position: relative;
    width: 100%;
    padding: 0 8vw;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.25, 0.1, 0.25, 1.0),
                transform 0.8s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.vellum-sheet.revealed {
    opacity: 1;
    transform: translateY(0);
}

.sheet-inner {
    max-width: 720px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    border: 1px solid #D4CFC8;
    padding: 3rem 2.5rem;
    position: relative;
}

/* Halftone texture overlay */
.sheet-inner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, #2C2A27 0.5px, transparent 0.5px);
    background-size: 4px 4px;
    opacity: 0.05;
    pointer-events: none;
}

/* ===== Sheet Variants ===== */

/* Title Sheet */
.sheet-title {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 0;
    padding-bottom: 0;
}

.sheet-title .sheet-inner {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    text-align: center;
}

.sheet-title .sheet-inner::before {
    display: none;
}

.sheet-title.revealed .sheet-inner {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    border: 1px solid #D4CFC8;
    transition: background 1.5s ease, border-color 1.5s ease, backdrop-filter 1.5s ease;
}

.sheet-title.revealed .sheet-inner::before {
    display: block;
}

.title-container {
    padding: 3rem 0;
}

.title-svg {
    width: 100%;
    max-width: 440px;
    height: auto;
    overflow: visible;
}

.title-text-svg {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    transition: stroke-dashoffset 2.5s cubic-bezier(0.25, 0.1, 0.25, 1.0),
                fill 1s cubic-bezier(0.25, 0.1, 0.25, 1.0) 2s;
}

.title-text-svg.drawn {
    stroke-dashoffset: 0;
    fill: #2C2A27;
}

/* Statement Sheet */
.sheet-statement {
    margin-top: -60px;
    z-index: 2;
}

.statement-text {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 1.125rem;
    line-height: 1.75;
    color: #2C2A27;
    text-align: left;
}

.statement-text .word {
    display: inline-block;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.statement-text .word.visible {
    opacity: 1;
}

/* Detail Sheets */
.sheet-detail {
    margin-top: -40px;
    z-index: 3;
}

.sheet-detail-1 {
    z-index: 3;
}

.sheet-detail-2 {
    margin-top: -50px;
    z-index: 4;
}

.sheet-detail-3 {
    margin-top: -45px;
    z-index: 5;
}

/* Sheet offsets for stacked paper effect */
.sheet-statement .sheet-inner {
    transform: translateX(3px);
}

.sheet-detail-1 .sheet-inner {
    transform: translateX(-4px);
}

.sheet-detail-2 .sheet-inner {
    transform: translateX(5px);
}

.sheet-detail-3 .sheet-inner {
    transform: translateX(-2px);
}

.sheet-colophon .sheet-inner {
    transform: translateX(3px);
}

/* Deep vellum ghost layer */
.sheet-detail .sheet-inner::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    width: 100%;
    height: 100%;
    background: #E8E4DFAA;
    border: 1px solid #D4CFC8;
    z-index: -1;
    pointer-events: none;
}

/* Detail Layout */
.detail-layout {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.detail-layout-reverse {
    flex-direction: row-reverse;
}

.detail-text {
    flex: 1;
    min-width: 0;
}

.detail-drawing {
    flex: 0 0 220px;
    position: relative;
}

/* ===== Typography ===== */
.section-heading {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(1.4rem, 3vw, 2rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #2C2A27;
    margin-bottom: 1.618rem;
}

.body-text {
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 400;
    font-size: 1.125rem;
    line-height: 1.75;
    color: #2C2A27;
    margin-bottom: 1.618rem;
}

.annotation {
    display: block;
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: 0.875rem;
    color: #6B6560;
    font-style: normal;
    padding-left: 1rem;
    border-left: 2px solid #C4A882;
    margin-top: 0.5rem;
}

/* ===== SVG Drawings ===== */
.arch-drawing,
.column-drawing,
.section-drawing {
    display: block;
    margin: 0 auto;
}

.arch-drawing path,
.arch-drawing line,
.column-drawing path,
.column-drawing line,
.column-drawing rect,
.section-drawing path,
.section-drawing line,
.section-drawing rect {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.sheet-detail.revealed .arch-drawing path,
.sheet-detail.revealed .arch-drawing line,
.sheet-detail.revealed .column-drawing path,
.sheet-detail.revealed .column-drawing line,
.sheet-detail.revealed .column-drawing rect,
.sheet-detail.revealed .section-drawing path,
.sheet-detail.revealed .section-drawing line,
.sheet-detail.revealed .section-drawing rect {
    stroke-dashoffset: 0;
}

/* ===== Photo Fragments ===== */
.photo-fragment {
    width: 120px;
    height: 100px;
    position: absolute;
    background: linear-gradient(135deg, #D4CFC8 0%, #B8CCD8 40%, #E8E4DF 100%);
    filter: grayscale(80%) contrast(1.1) opacity(0.7);
    border: 1px solid #D4CFC8;
    box-shadow: 2px 2px 8px rgba(44, 42, 39, 0.08);
}

.photo-fragment-1 {
    bottom: -20px;
    right: -10px;
    transform: rotate(2.5deg);
}

.photo-fragment-2 {
    top: -15px;
    left: 10px;
    transform: rotate(-1.8deg);
}

/* ===== Hand-drawn Dividers ===== */
.hand-divider {
    display: block;
    width: 100%;
    max-width: 600px;
    height: 10px;
    margin: 1rem auto;
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.hand-divider.revealed {
    opacity: 0.6;
}

/* ===== Colophon ===== */
.sheet-colophon {
    margin-top: -30px;
    z-index: 6;
    padding-bottom: 10vh;
}

.sheet-colophon .sheet-inner {
    background: rgba(255, 255, 255, 0.6);
    text-align: center;
}

.colophon-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.colophon-asterisk {
    opacity: 0.5;
}

.colophon-text {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: 1.125rem;
    color: #6B6560;
}

.colophon-attribution {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: 0.875rem;
    color: #B8CCD8;
}

/* ===== Scroll Depth Separation ===== */
.vellum-sheet {
    transition: opacity 0.8s cubic-bezier(0.25, 0.1, 0.25, 1.0),
                transform 0.8s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .vellum-sheet {
        padding: 0 5vw;
    }

    .sheet-inner {
        padding: 2rem 1.5rem;
    }

    .detail-layout,
    .detail-layout-reverse {
        flex-direction: column;
    }

    .detail-drawing {
        flex: 0 0 auto;
        width: 100%;
        display: flex;
        justify-content: center;
    }

    .photo-fragment {
        width: 90px;
        height: 75px;
    }

    .photo-fragment-1 {
        bottom: -10px;
        right: 0;
    }

    .photo-fragment-2 {
        top: -10px;
        left: 0;
    }

    .floating-elements {
        display: none;
    }

    .title-svg {
        max-width: 300px;
    }

    .sheet-statement,
    .sheet-detail,
    .sheet-colophon {
        margin-top: -20px;
    }
}

@media (max-width: 480px) {
    .sheet-inner {
        padding: 1.5rem 1rem;
    }

    .section-heading {
        font-size: 1.3rem;
    }

    .body-text {
        font-size: 1rem;
    }
}
