/* ============================================
   ggaji.com — Mid-Century Ceramic Exhibition Catalogue
   ============================================ */

/* ============================================
   Design Palette — from DESIGN.md
   ============================================
   Aged Linen:    #F5EDE0 — primary background
   Roasted Earth: #3B2F25 — headlines
   Warm Sepia:    #5A4A3A — body copy
   Muted Clay:    #8B7B6B — captions, metadata
   Celadon Jade:  #7BA38E — accent color
   Barley Gold:   #8B6B4A — rules, progress bar
   Kiln Ash:      #D4C5B0 (#D4C5B0 at 30% opacity for gutter lines)
   Charcoal Ink:  #2A231C — colophon background
   Celadon Edge:  #B8D4C4 — celadon gradient edge
   Vermillion:    #C84032 — inkan seal

   Typography: DM Serif Display, Source Serif 4 (Google Fonts),
   IBM Plex Sans" (Google Fonts), Cormorant Garamond
   Layout uses a 12-column grid with visible 1px gutter in warm gray

   Interior Spreads (scrolling sequence):
   Interior Spreads:** Each spread uses a **12-column grid**
   grid** layout with
   visible gutter. Source Serif 4 at the narrow column measure.
   IBM Plex Sans small caps appears with a 400ms delay:
   "A CATALOGUE OF FORM AND SURFACE".
   At the very bottom center below the colophon text,
   the inkan seal mark appears centered below.
   ============================================ */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    --celadon-jade: #7BA38E;
    --celadon-edge: #B8D4C4;
    --vermillion: #C84032;
    --kiln-ash: #D4C5B0;
}

body {
    background-color: #F5EDE0;
    color: #3B2F25;
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

/* ---------- Paper Grain Overlay ---------- */
body::before {
    content: '';
    position: fixed;
    top: -2px;
    left: -2px;
    width: calc(100% + 4px);
    height: calc(100% + 4px);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23g)' opacity='0.05'/%3E%3C/svg%3E");
    background-repeat: repeat;
    pointer-events: none;
    z-index: 10000;
    opacity: 0.5;
}

/* ---------- Progress Bar ---------- */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0%;
    background-color: #8B6B4A;
    z-index: 9999;
    transition: width 0.1s linear;
}

/* ---------- Page Number ---------- */
.page-number {
    position: fixed;
    bottom: 30px;
    right: 40px;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: #8B7B6B;
    z-index: 9998;
    font-variant-numeric: tabular-nums;
}

/* ---------- Spreads (General) ---------- */
.spread {
    min-height: 100vh;
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---------- COVER ---------- */
.cover-spread {
    flex-direction: column;
    background-color: #F5EDE0;
}

.cover-border {
    position: absolute;
    top: 40px;
    left: 40px;
    right: 40px;
    bottom: 40px;
    pointer-events: none;
}

.border-svg {
    width: 100%;
    height: 100%;
}

.border-outer,
.border-inner {
    stroke-dasharray: 3200;
    stroke-dashoffset: 3200;
    transition: stroke-dashoffset 1.2s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.border-svg.animate .border-outer,
.border-svg.animate .border-inner {
    stroke-dashoffset: 0;
}

.cover-content {
    text-align: center;
    opacity: 0;
    transition: opacity 0.8s cubic-bezier(0.25, 0.1, 0.25, 1.0);
    z-index: 1;
}

.cover-content.visible {
    opacity: 1;
}

.cover-title {
    font-family: 'DM Serif Display', serif;
    font-weight: 400;
    font-size: clamp(4rem, 10vw, 8rem);
    letter-spacing: 0.03em;
    line-height: 1.08;
    color: #3B2F25;
    margin-bottom: 1.5rem;
}

.cover-subtitle {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #8B7B6B;
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.cover-subtitle.visible {
    opacity: 1;
}

.cover-colophon {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
}

.colophon-pub {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #8B7B6B;
}

.scroll-chevron {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    animation: chevronPulse 3s ease-in-out infinite;
}

@keyframes chevronPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* ---------- Interior Spreads ---------- */
.interior-spread {
    padding: 0 60px;
    opacity: 0.15;
    transform: scale(0.97);
    transition: opacity 0.6s cubic-bezier(0.25, 0.1, 0.25, 1.0),
                transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.interior-spread.in-view {
    opacity: 1;
    transform: scale(1);
}

.spread-grid {
    display: grid;
    grid-template-columns: 7fr 1fr 4fr;
    gap: 0;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    align-items: center;
    min-height: 80vh;
}

.spread-grid.reverse {
    grid-template-columns: 4fr 1fr 7fr;
}

/* ---------- Visual Side ---------- */
.spread-visual {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.vessel {
    width: 100%;
    max-width: 340px;
    height: auto;
    transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.vessel path[stroke],
.vessel ellipse[stroke] {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 2s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.in-view .vessel path[stroke],
.in-view .vessel ellipse[stroke] {
    stroke-dashoffset: 0;
}

.vessel path[fill]:not([fill="none"]),
.vessel ellipse[fill]:not([fill="none"]) {
    opacity: 0;
    transition: opacity 1.5s cubic-bezier(0.25, 0.1, 0.25, 1.0) 2.5s;
}

.in-view .vessel path[fill]:not([fill="none"]),
.in-view .vessel ellipse[fill]:not([fill="none"]) {
    opacity: 0.6;
}

.decorative-numeral {
    position: absolute;
    top: 10%;
    left: 10%;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(6rem, 12vw, 14rem);
    color: #8B6B4A;
    opacity: 0;
    line-height: 1;
    pointer-events: none;
    transition: opacity 0.8s cubic-bezier(0.25, 0.1, 0.25, 1.0);
    z-index: 0;
}

.in-view .decorative-numeral {
    opacity: 0.08;
}

/* ---------- Text Side ---------- */
.spread-text {
    padding: 40px 0;
}

.text-right {
    padding-left: 0;
}

.text-left {
    padding-right: 0;
}

.spread-heading {
    font-family: 'DM Serif Display', serif;
    font-weight: 400;
    font-size: clamp(2.4rem, 5.5vw, 5rem);
    letter-spacing: 0.03em;
    line-height: 1.08;
    color: #3B2F25;
    margin-bottom: 2rem;
    text-decoration-color: #7BA38E;
}

/* Celadon accent for vessel glow */
.vessel-teabowl {
    filter: drop-shadow(0 0 40px rgba(123, 163, 142, 0.12));
}

/* Celadon edge highlight — #B8D4C4 */
.foldout-caption::first-letter {
    color: #B8D4C4;
}

.spread-body {
    max-width: 38ch;
}

.spread-body p {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    color: #5A4A3A;
    margin-bottom: 1.2em;
}

.spread-body p:last-child {
    margin-bottom: 0;
}

.spread-meta {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 0.5px solid rgba(139, 107, 74, 0.4);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.spread-meta span {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8B7B6B;
}

/* ---------- Double Rule Dividers ---------- */
.interior-spread::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 60px;
    right: 60px;
    height: 6px;
    border-top: 0.5px solid rgba(139, 107, 74, 0.4);
    border-bottom: 1px solid rgba(139, 107, 74, 0.4);
}

/* ---------- Catalogue Stamps ---------- */
.catalogue-stamp {
    position: absolute;
    top: 30px;
    right: 40px;
    text-shadow: 0 1px 2px #D4C5B0;
}

.stamp-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #8B7B6B;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.in-view .stamp-circle {
    transform: rotate(-15deg);
}

.stamp-circle span {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-size: 0.7rem;
    color: #8B7B6B;
}

/* ---------- Baseline Grid ---------- */
.baseline-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 23px,
        rgba(212, 197, 176, 0.05) 23px,
        rgba(212, 197, 176, 0.05) 24px
    );
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease-out;
    z-index: 0;
}

.in-view .baseline-grid {
    animation: gridFlash 2s ease-out forwards;
}

@keyframes gridFlash {
    0% { opacity: 1; }
    70% { opacity: 0.5; }
    100% { opacity: 0; }
}

/* ---------- Foldout Spreads ---------- */
.foldout-spread {
    min-height: 60vh;
    width: 100vw;
    flex-direction: column;
    background-color: #F5EDE0;
    padding: 80px 0;
    overflow: hidden;
}

.foldout-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.foldout-procession {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: clamp(30px, 5vw, 80px);
    padding: 0 40px;
    margin-bottom: 3rem;
}

.foldout-vessel {
    width: clamp(50px, 8vw, 80px);
    height: auto;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.5s cubic-bezier(0.25, 0.1, 0.25, 1.0),
                transform 0.5s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.foldout-spread.in-view .foldout-vessel {
    opacity: 1;
    transform: translateY(0);
}

.foldout-spread.in-view .foldout-vessel:nth-child(1) { transition-delay: 0ms; }
.foldout-spread.in-view .foldout-vessel:nth-child(2) { transition-delay: 150ms; }
.foldout-spread.in-view .foldout-vessel:nth-child(3) { transition-delay: 300ms; }
.foldout-spread.in-view .foldout-vessel:nth-child(4) { transition-delay: 450ms; }
.foldout-spread.in-view .foldout-vessel:nth-child(5) { transition-delay: 600ms; }
.foldout-spread.in-view .foldout-vessel:nth-child(6) { transition-delay: 750ms; }
.foldout-spread.in-view .foldout-vessel:nth-child(7) { transition-delay: 900ms; }

.foldout-caption {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    color: #5A4A3A;
    text-align: center;
    letter-spacing: 0.02em;
}

/* ---------- Linen Thread Dividers ---------- */
.linen-thread-divider {
    width: 80%;
    margin: 3rem auto 0;
}

.thread-svg {
    width: 100%;
    height: 20px;
}

.thread-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 1.8s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.in-view .thread-path {
    stroke-dashoffset: 0;
}

/* ---------- Colophon ---------- */
.colophon-spread {
    background: linear-gradient(
        to bottom,
        #F5EDE0 0%,
        #2A231C 40%,
        #2A231C 100%
    );
    flex-direction: column;
    padding: 0 40px;
}

.colophon-content {
    text-align: center;
    max-width: 28ch;
    margin: auto;
    padding-top: 45vh;
}

.colophon-text {
    color: #F5EDE0;
}

.colophon-text p {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: 0.85rem;
    line-height: 2;
    color: #F5EDE0;
    margin-bottom: 1.5em;
}

.colophon-title {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #F5EDE0;
    margin-bottom: 1.5rem;
}

.colophon-rule {
    width: 40px;
    margin: 1.5rem auto;
    border: none;
    border-top: 0.5px solid rgba(245, 237, 224, 0.3);
    border-bottom: 1px solid rgba(245, 237, 224, 0.3);
    height: 5px;
}

.colophon-details {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    line-height: 1.8;
    color: rgba(245, 237, 224, 0.6);
}

.colophon-edition {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 500;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(245, 237, 224, 0.5);
    margin-top: 2rem;
}

.inkan-seal {
    margin: 3rem auto 1.5rem;
    opacity: 0;
    transition: opacity 1.5s cubic-bezier(0.25, 0.1, 0.25, 1.0);
    color: #C84032;
}

.inkan-seal.visible {
    opacity: 1;
}

.colophon-press {
    font-family: 'DM Serif Display', serif;
    font-weight: 400;
    font-size: 1rem;
    letter-spacing: 0.05em;
    color: rgba(245, 237, 224, 0.4);
    text-align: center;
    margin-top: 0.5rem;
    padding-bottom: 60px;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .spread-grid,
    .spread-grid.reverse {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .spread-visual {
        order: -1;
    }

    .interior-spread {
        padding: 40px 30px;
    }

    .cover-border {
        top: 20px;
        left: 20px;
        right: 20px;
        bottom: 20px;
    }

    .cover-title {
        font-size: clamp(3rem, 12vw, 5rem);
    }

    .page-number {
        bottom: 15px;
        right: 20px;
    }

    .spread-body {
        max-width: 100%;
    }

    .foldout-procession {
        gap: 15px;
        flex-wrap: wrap;
    }

    .catalogue-stamp {
        top: 15px;
        right: 20px;
    }

    .interior-spread::after {
        left: 30px;
        right: 30px;
    }

    .colophon-content {
        max-width: 90%;
    }
}
