/* =========================================
   desca.work — Ethereal Blue Watercolor
   ========================================= */

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

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

body {
    font-family: 'Cormorant Garamond', Georgia, serif;
    color: #2c3e50;
    background-color: #f0f4f8;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

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

/* --- Bookmark Ribbon --- */
.bookmark-ribbon {
    position: fixed;
    top: 0;
    left: 75%;
    z-index: 100;
    pointer-events: none;
}

/* --- Scroll Progress Indicator --- */
.scroll-progress {
    position: fixed;
    top: 0;
    right: 0;
    width: 2px;
    height: 0%;
    background-color: #e8c87a;
    z-index: 200;
    transition: height 50ms linear;
}

/* --- Navigation Compass --- */
.nav-compass {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 300;
    background: rgba(240, 244, 248, 0.6);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: transform 400ms ease-in-out;
}

.nav-compass:hover {
    transform: rotate(45deg);
}

.nav-compass:hover svg path {
    stroke: #e8c87a;
    transition: stroke 400ms ease-in-out;
}

.nav-compass svg path {
    transition: stroke 400ms ease-in-out;
}

/* --- Navigation Overlay --- */
.nav-overlay {
    position: fixed;
    inset: 0;
    z-index: 400;
    background-color: rgba(212, 232, 247, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 400ms ease-out;
}

.nav-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.nav-close {
    position: absolute;
    top: 24px;
    right: 24px;
    background: none;
    border: none;
    cursor: pointer;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    font-family: 'Bebas Neue', 'Arial Narrow', sans-serif;
    font-size: clamp(2rem, 5vw, 4rem);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #1a2840;
    text-decoration: none;
    transition: color 300ms ease;
}

.nav-link:hover {
    color: #e8c87a;
}

/* --- Z-Pattern Sections --- */
.z-section {
    position: relative;
    min-height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* Watercolor bleed between sections */
.z-section::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 15vh;
    pointer-events: none;
    z-index: 2;
}

/* Section 1 — Cerulean Mist */
.z-section--1 {
    background: linear-gradient(180deg, #f0f4f8 0%, #d4e8f7 60%, #d4e8f7 100%);
}

.z-section--1::after {
    background: linear-gradient(180deg, transparent, #8fa8c8);
}

/* Section 2 — Indigo Dusk */
.z-section--2 {
    background: linear-gradient(180deg, #8fa8c8 0%, #c5d8eb 40%, #8fa8c8 100%);
}

.z-section--2::after {
    background: linear-gradient(180deg, transparent, #f0f4f8);
}

/* Section 3 — Pearl Dawn */
.z-section--3 {
    background: linear-gradient(180deg, #f0f4f8 0%, #d4e8f7 50%, #f0f4f8 100%);
}

.z-section--3::after {
    background: linear-gradient(180deg, transparent, #0e1a2b);
}

/* Section 4 — Inkwell Shadow (dark) */
.z-section--4 {
    background: linear-gradient(180deg, #0e1a2b 0%, #1a2840 50%, #0e1a2b 100%);
}

/* --- Watercolor Background SVGs --- */
.watercolor-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.wash-svg {
    position: absolute;
    width: 100%;
    height: 100%;
}

/* --- Page Fold Corners --- */
.page-fold {
    position: absolute;
    width: 0;
    height: 0;
    z-index: 5;
}

.page-fold--tr {
    top: 0;
    right: 0;
    border-top: 40px solid #c5d8eb;
    border-left: 40px solid transparent;
    filter: drop-shadow(-2px 2px 3px rgba(26, 40, 64, 0.1));
}

.page-fold--bl {
    bottom: 0;
    left: 0;
    border-bottom: 40px solid #c5d8eb;
    border-right: 40px solid transparent;
    filter: drop-shadow(2px -2px 3px rgba(26, 40, 64, 0.1));
}

.page-fold--dark {
    border-bottom-color: #2c3e50;
}

/* --- Z-Pattern Content Grid --- */
.z-content {
    position: relative;
    z-index: 3;
    width: 100%;
    max-width: 960px;
    min-height: 100vh;
    margin: 0 auto;
    padding: 8vh 5vw;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr auto;
    gap: 2rem;
    align-content: start;
}

.z-top-left {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    justify-self: start;
}

.z-top-right {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    justify-self: end;
    text-align: right;
}

.z-mid-left {
    grid-column: 1;
    grid-row: 2;
    align-self: center;
    justify-self: start;
}

.z-bottom-right {
    grid-column: 2;
    grid-row: 3;
    align-self: end;
    justify-self: end;
    text-align: right;
}

/* --- Marginalia --- */
.marginalia {
    position: absolute;
    font-family: 'Lato', sans-serif;
    font-weight: 300;
    font-size: 1.5rem;
    color: #8fa8c8;
    opacity: 0.4;
    z-index: 4;
    pointer-events: none;
    user-select: none;
}

.marginalia--left {
    left: 2vw;
}

.marginalia--right {
    right: 2vw;
}

.marginalia--light {
    color: #c5d8eb;
    opacity: 0.3;
}

/* --- Typography: Display --- */
.title-display {
    font-family: 'Bebas Neue', 'Arial Narrow', sans-serif;
    font-weight: 400;
    font-size: clamp(3rem, 8vw, 6rem);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #1a2840;
    text-shadow: 0 1px 2px rgba(26, 40, 64, 0.15);
    line-height: 1;
}

.heading-chapter {
    font-family: 'Bebas Neue', 'Arial Narrow', sans-serif;
    font-weight: 400;
    font-size: clamp(2.8rem, 7vw, 5rem);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #1a2840;
    text-shadow: 0 1px 2px rgba(26, 40, 64, 0.15);
    line-height: 1.1;
}

.heading-chapter--light {
    color: #f0f4f8;
    text-shadow: 0 1px 4px rgba(14, 26, 43, 0.4);
}

/* --- Typography: Subtitle --- */
.subtitle-italic {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: #5a7a94;
    line-height: 1.5;
}

/* --- Typography: Body --- */
.body-prose {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.75;
    color: #2c3e50;
    max-width: 420px;
}

.body-prose--light {
    color: #c5d8eb;
}

/* --- Typography: Pull Quote --- */
.pull-quote {
    max-width: 420px;
}

.pull-quote p {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    line-height: 1.6;
    color: #1a2840;
    border-left: 3px solid #e8c87a;
    padding-left: 1.2rem;
    text-align: left;
}

/* --- Annotation Panels --- */
.annotation-panel {
    background: rgba(232, 240, 250, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 4px;
    padding: 1.2rem 1.4rem;
    max-width: 320px;
    transition: opacity 300ms ease, backdrop-filter 300ms ease, border-color 300ms ease;
    border: 1px solid transparent;
}

.annotation-panel:hover {
    background: rgba(232, 240, 250, 1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-color: rgba(143, 168, 200, 0.3);
}

.annotation-panel--dark {
    background: rgba(26, 40, 64, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.annotation-panel--dark:hover {
    background: rgba(26, 40, 64, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-color: rgba(197, 216, 235, 0.2);
}

.annotation-text {
    font-family: 'Lato', sans-serif;
    font-weight: 300;
    font-size: 14px;
    letter-spacing: 0.02em;
    line-height: 1.65;
    color: #5a7a94;
}

.annotation-text--light {
    color: #c5d8eb;
}

/* --- Closing Mark --- */
.closing-mark {
    font-family: 'Bebas Neue', 'Arial Narrow', sans-serif;
    font-weight: 400;
    font-size: clamp(2rem, 5vw, 3.5rem);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #e8c87a;
    line-height: 1.1;
}

.closing-sub {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: 1.1rem;
    color: #8fa8c8;
    margin-top: 0.5rem;
}

/* --- Ruled Line Accent (notebook lines behind text) --- */
.z-section--1 .z-mid-left,
.z-section--3 .z-mid-left {
    background-image: repeating-linear-gradient(
        180deg,
        transparent,
        transparent 27px,
        rgba(212, 232, 247, 0.3) 27px,
        rgba(212, 232, 247, 0.3) 28px
    );
}

/* --- Fade Reveal Animations --- */
.fade-reveal {
    opacity: 0;
    transition: opacity 500ms ease-out, transform 500ms ease-out;
}

.fade-from-left {
    transform: translateX(-20px);
}

.fade-from-right {
    transform: translateX(20px);
}

.fade-reveal.is-visible {
    opacity: 1;
    transform: translateX(0) translateY(0);
}

/* Opening animation — first section elements */
.z-section--1 .z-top-left.fade-reveal {
    transition-delay: 800ms;
}

.z-section--1 .z-top-right.fade-reveal {
    transition-delay: 1400ms;
}

.z-section--1 .z-mid-left.fade-reveal {
    transition-delay: 1700ms;
}

.z-section--1 .z-bottom-right.fade-reveal {
    transition-delay: 2000ms;
}

/* Watercolor bloom opening animation */
@keyframes watercolorBloom {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.z-section--1 .watercolor-bg {
    animation: watercolorBloom 1200ms ease-out 300ms both;
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    .fade-reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .z-section--1 .watercolor-bg {
        animation: none;
    }

    html {
        scroll-behavior: auto;
    }
}

/* --- Responsive: Mobile --- */
@media (max-width: 768px) {
    .z-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto;
        gap: 2.5rem;
        padding: 6vh 6vw;
    }

    .z-top-left {
        grid-column: 1;
        grid-row: 1;
    }

    .z-top-right {
        grid-column: 1;
        grid-row: 2;
        justify-self: start;
        text-align: left;
    }

    .z-mid-left {
        grid-column: 1;
        grid-row: 3;
    }

    .z-bottom-right {
        grid-column: 1;
        grid-row: 4;
        justify-self: start;
        text-align: left;
    }

    .body-prose {
        font-size: 16px;
        line-height: 1.7;
        max-width: 100%;
    }

    .pull-quote p {
        text-align: left;
    }

    .annotation-panel {
        max-width: 100%;
    }

    .bookmark-ribbon {
        left: 85%;
    }

    .marginalia {
        display: none;
    }
}
