/* ============================================
   daitoua.com — Magazine-Spread Design System
   Retro-Futuristic Japanese Metabolist Editorial
   ============================================ */

:root {
    --paper: #F5E6D3;
    --ink: #3B2A1A;
    --accent: #C4572A;
    --dust: #D9C4A8;
    --earth: #1E1410;
    --gold: #B8860B;
    --lichen: #7A8B6F;
    --wash: #E8D5BC;
    --spine-gap: 48px;
    --column-gap: 16px;
    --spread-height: 100vh;
    --spine-width: 1px;
}

/* ---- Reset & Base ---- */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow: hidden;
    height: 100%;
}

body {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw + 0.5rem, 1.35rem);
    line-height: 1.85;
    color: var(--ink);
    background-color: var(--paper);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
    height: 100%;
}

/* ---- Paper Grain Texture Overlay ---- */

.paper-grain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* ---- Fixed Spine Rule ---- */

.spine-rule {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: var(--spine-width);
    height: 100vh;
    background-color: var(--accent);
    z-index: 100;
    transition: width 200ms ease;
    pointer-events: none;
}

/* ---- Magazine Container ---- */

.magazine {
    width: 100%;
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
}

.magazine::-webkit-scrollbar {
    display: none;
}

/* ---- Spread Base ---- */

.spread {
    width: 100%;
    height: var(--spread-height);
    min-height: var(--spread-height);
    scroll-snap-align: start;
    position: relative;
    overflow: hidden;
    background-color: var(--paper);
}

.spread-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr) var(--spine-gap) repeat(6, 1fr);
    gap: 0 var(--column-gap);
    width: 100%;
    height: 100%;
    padding: 0 clamp(16px, 3vw, 48px);
}

/* ---- Folio Numbers ---- */

.folio {
    position: absolute;
    bottom: 24px;
    right: 32px;
    font-family: 'Space Mono', monospace;
    font-size: clamp(0.65rem, 0.8vw, 0.85rem);
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--ink);
    opacity: 0.6;
    z-index: 10;
}

.folio.active {
    color: var(--gold);
    opacity: 1;
    animation: folioPulse 2s cubic-bezier(0.37, 0, 0.63, 1) infinite;
}

@keyframes folioPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.015); }
}

/* ---- Spread Content - Reveal Animation ---- */

.spread .spread-grid,
.spread .feature-panoramic,
.spread .colophon-content {
    opacity: 0.85;
    filter: blur(0.5px);
    transition: opacity 600ms ease, filter 600ms ease;
}

.spread.in-view .spread-grid,
.spread.in-view .feature-panoramic,
.spread.in-view .colophon-content {
    opacity: 1;
    filter: blur(0);
}

/* ============================================
   SPREAD 1: Cover
   ============================================ */

.spread-cover {
    background-color: var(--paper);
}

.spread-cover .spread-grid {
    align-items: stretch;
}

.cover-image-area {
    grid-column: 1 / 7;
    grid-row: 1;
    position: relative;
    overflow: hidden;
}

.cover-image-fill {
    width: 100%;
    height: 100%;
    background-color: var(--dust);
    background-image:
        radial-gradient(ellipse at 30% 40%, rgba(196, 87, 42, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 70%, rgba(122, 139, 111, 0.08) 0%, transparent 50%);
    animation: heroBreath 8s cubic-bezier(0.37, 0, 0.63, 1) infinite;
    will-change: transform;
}

/* Halftone pattern overlay for cover image */
.cover-image-fill::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle, var(--ink) 0.5px, transparent 0.5px);
    background-size: 6px 6px;
    opacity: 0.06;
}

/* Architectural grid lines on cover image */
.cover-image-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(to right, rgba(59, 42, 26, 0.04) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(59, 42, 26, 0.04) 1px, transparent 1px);
    background-size: 60px 60px;
}

@keyframes heroBreath {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.015); }
}

.cover-title-area {
    grid-column: 8 / 14;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    padding-right: clamp(16px, 4vw, 64px);
    position: relative;
}

.cover-title {
    font-family: 'Josefin Sans', 'Futura', sans-serif;
    font-weight: 700;
    font-size: clamp(3rem, 10vw, 8rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    line-height: 1;
    margin-bottom: 2rem;
}

.title-char {
    display: inline-block;
    transition: color 300ms ease;
}

.cover-subtitle {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.2vw, 1.2rem);
    line-height: 1.6;
    color: var(--ink);
    text-align: right;
    opacity: 0.7;
}

.cover-date {
    font-family: 'Space Mono', monospace;
    font-size: clamp(0.6rem, 0.7vw, 0.75rem);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    margin-top: 1.5rem;
}

/* ---- Bubble Cluster ---- */

.bubble-cluster {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(
        circle at 35% 35%,
        rgba(245, 230, 211, 0.6) 0%,
        rgba(217, 196, 168, 0.3) 40%,
        rgba(196, 87, 42, 0.08) 80%,
        transparent 100%
    );
    box-shadow: 0 0 15px rgba(196, 87, 42, 0.15);
    border: 1px solid rgba(59, 42, 26, 0.08);
    will-change: transform;
}

.bubble-1 {
    width: 180px; height: 180px;
    right: -40px; top: 15%;
    animation: bubblePulse 3s cubic-bezier(0.37, 0, 0.63, 1) infinite;
}

.bubble-2 {
    width: 120px; height: 120px;
    right: 60px; top: 35%;
    animation: bubblePulse 3s cubic-bezier(0.37, 0, 0.63, 1) infinite 0.5s;
}

.bubble-3 {
    width: 80px; height: 80px;
    right: -20px; top: 55%;
    animation: bubblePulse 3s cubic-bezier(0.37, 0, 0.63, 1) infinite 1s;
}

.bubble-4 {
    width: 200px; height: 200px;
    right: 20px; top: 60%;
    animation: bubblePulse 3s cubic-bezier(0.37, 0, 0.63, 1) infinite 1.5s;
}

.bubble-5 {
    width: 60px; height: 60px;
    right: 100px; top: 25%;
    animation: bubblePulse 3s cubic-bezier(0.37, 0, 0.63, 1) infinite 2s;
}

.bubble-6 {
    width: 40px; height: 40px;
    right: 140px; top: 50%;
    animation: bubblePulse 3s cubic-bezier(0.37, 0, 0.63, 1) infinite 0.8s;
}

.bubble-7 {
    width: 100px; height: 100px;
    right: -10px; top: 80%;
    animation: bubblePulse 3s cubic-bezier(0.37, 0, 0.63, 1) infinite 2.2s;
}

@keyframes bubblePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.015); }
}

/* ============================================
   SPREAD 2: Table of Contents
   ============================================ */

.spread-toc {
    background-color: var(--paper);
}

.spread-toc .spread-grid {
    align-items: center;
}

.toc-list-area {
    grid-column: 1 / 7;
    grid-row: 1;
    padding: clamp(32px, 6vh, 80px) clamp(16px, 3vw, 48px);
}

.toc-entries {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.toc-entry {
    display: flex;
    align-items: baseline;
    gap: 1.5rem;
    padding: 0.4rem 0;
    border-bottom: 0.5px solid var(--dust);
    cursor: default;
    transition: border-color 300ms ease;
}

.toc-entry:hover {
    border-bottom-color: var(--accent);
}

.toc-entry:hover .toc-number {
    color: var(--gold);
}

.toc-number {
    font-family: 'Space Mono', monospace;
    font-size: clamp(0.6rem, 0.7vw, 0.75rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent);
    flex-shrink: 0;
    transition: color 300ms ease, transform 300ms ease;
}

.toc-name {
    font-family: 'Josefin Sans', 'Futura', sans-serif;
    font-weight: 700;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink);
    line-height: 3rem;
}

.toc-image-area {
    grid-column: 8 / 14;
    grid-row: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-right: clamp(16px, 4vw, 64px);
    position: relative;
}

.toc-circle-image {
    width: clamp(200px, 28vw, 400px);
    height: clamp(200px, 28vw, 400px);
    border-radius: 50%;
    background-color: var(--dust);
    background-image:
        radial-gradient(circle at 40% 40%, rgba(245, 230, 211, 0.8) 0%, transparent 50%),
        radial-gradient(circle at 60% 60%, rgba(196, 87, 42, 0.15) 0%, transparent 40%);
    box-shadow: 0 0 30px rgba(196, 87, 42, 0.1);
    border: 1px solid rgba(59, 42, 26, 0.06);
    position: relative;
    transform: translateX(-20%);
    animation: bubblePulse 3s cubic-bezier(0.37, 0, 0.63, 1) infinite;
}

/* Duotone bubble texture inside circle */
.toc-circle-image::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 10%;
    width: 80%;
    height: 80%;
    border-radius: 50%;
    background: radial-gradient(
        circle at 45% 45%,
        rgba(196, 87, 42, 0.12) 0%,
        rgba(232, 213, 188, 0.3) 50%,
        transparent 70%
    );
}

.toc-circle-image::after {
    content: '';
    position: absolute;
    top: 20%;
    left: 25%;
    width: 50%;
    height: 50%;
    border-radius: 50%;
    border: 0.5px solid rgba(59, 42, 26, 0.06);
    background: radial-gradient(
        circle at 40% 40%,
        rgba(245, 230, 211, 0.5) 0%,
        transparent 60%
    );
}

/* ============================================
   SPREAD 3: Feature
   ============================================ */

.spread-feature {
    background-color: var(--earth);
}

.feature-panoramic {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: flex-end;
}

.feature-image-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--earth);
    background-image:
        radial-gradient(ellipse at 20% 30%, rgba(196, 87, 42, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 60%, rgba(122, 139, 111, 0.1) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 80%, rgba(184, 134, 11, 0.08) 0%, transparent 40%);
}

/* Halftone for feature image */
.feature-image-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle, rgba(245, 230, 211, 0.08) 0.8px, transparent 0.8px);
    background-size: 8px 8px;
}

/* Grid lines across feature */
.feature-image-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(to right, rgba(245, 230, 211, 0.02) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(245, 230, 211, 0.02) 1px, transparent 1px);
    background-size: 80px 80px;
}

.feature-overlay-text {
    position: relative;
    z-index: 2;
    padding: clamp(24px, 5vw, 80px);
    padding-top: 0;
    max-width: 70%;
}

.feature-quote {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.2rem, 2vw, 2rem);
    line-height: 1.7;
    color: var(--paper);
    margin-bottom: 1.5rem;
}

.feature-attribution {
    font-family: 'Space Mono', monospace;
    font-size: clamp(0.6rem, 0.7vw, 0.75rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent);
}

.spread-feature .folio {
    color: var(--paper);
    opacity: 0.4;
}

.spread-feature .folio.active {
    color: var(--gold);
    opacity: 1;
}

/* Vine Border */
.vine-border {
    position: absolute;
    left: clamp(8px, 2vw, 24px);
    top: 0;
    width: 20px;
    height: 100%;
    z-index: 5;
    overflow: visible;
}

.vine-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 2s ease;
}

.spread-feature.in-view .vine-path {
    stroke-dashoffset: 0;
}

/* ============================================
   SPREAD 4: Botanical Plate
   ============================================ */

.spread-botanical {
    background-color: var(--paper);
}

.spread-botanical .spread-grid {
    align-items: center;
}

.herbarium-area {
    grid-column: 1 / 7;
    grid-row: 1;
    padding: clamp(24px, 4vh, 60px) clamp(16px, 3vw, 40px);
}

.herbarium-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 0;
}

.herbarium-cell {
    border: 0.5px solid var(--dust);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(8px, 1.5vh, 16px) clamp(4px, 1vw, 12px);
    aspect-ratio: 1;
    position: relative;
    transition: background-color 400ms ease;
}

.specimen {
    width: 70%;
    height: auto;
    max-height: 70%;
}

.specimen-label {
    font-family: 'Space Mono', monospace;
    font-size: 9px;
    letter-spacing: 0.08em;
    color: var(--ink);
    opacity: 0.6;
    font-style: italic;
    margin-top: 4px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    transition: opacity 300ms ease, color 300ms ease;
}

.botanical-text-area {
    grid-column: 8 / 14;
    grid-row: 1;
    padding: clamp(32px, 6vh, 80px) clamp(16px, 3vw, 48px);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.botanical-title {
    font-family: 'Josefin Sans', 'Futura', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4.5rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink);
    line-height: 1.1;
    margin-bottom: 2rem;
}

.botanical-columns {
    column-count: 2;
    column-gap: 2rem;
}

.botanical-columns p {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(0.85rem, 1vw + 0.3rem, 1.1rem);
    line-height: 1.85;
    color: var(--ink);
    margin-bottom: 1.2rem;
    text-indent: 2em;
}

.botanical-columns p:first-child {
    text-indent: 0;
}

/* ============================================
   SPREAD 5: Colophon
   ============================================ */

.spread-colophon {
    background-color: var(--paper);
    display: flex;
    justify-content: center;
    align-items: center;
}

.colophon-content {
    text-align: center;
    max-width: 480px;
    padding: 2rem;
}

.colophon-mark {
    display: block;
    font-size: 2.5rem;
    color: var(--accent);
    margin-bottom: 1.5rem;
    line-height: 1;
}

.colophon-title {
    font-family: 'Josefin Sans', 'Futura', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 2vw, 1.6rem);
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--ink);
    margin-bottom: 2.5rem;
}

.colophon-details {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    margin-bottom: 3rem;
}

.colophon-block {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.colophon-label {
    font-family: 'Space Mono', monospace;
    font-size: clamp(0.55rem, 0.65vw, 0.7rem);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    transition: color 300ms ease;
}

.colophon-value {
    font-family: 'Josefin Sans', 'Futura', sans-serif;
    font-weight: 300;
    font-size: clamp(0.7rem, 0.85vw, 0.9rem);
    letter-spacing: 0.1em;
    color: var(--ink);
}

.colophon-footer {
    border-top: 0.5px solid var(--dust);
    padding-top: 1.5rem;
}

.colophon-footer p {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-size: clamp(0.8rem, 0.9vw, 0.95rem);
    color: var(--ink);
    opacity: 0.5;
}

/* ============================================
   Transition Bubbles
   ============================================ */

.transition-bubbles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
    overflow: hidden;
}

.t-bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(
        circle at 35% 35%,
        rgba(245, 230, 211, 0.4) 0%,
        rgba(217, 196, 168, 0.2) 50%,
        transparent 80%
    );
    border: 0.5px solid rgba(59, 42, 26, 0.06);
    opacity: 0;
    will-change: transform;
}

.t-bubble.visible {
    opacity: 1;
}

.t-bubble-1 {
    width: 30px; height: 30px;
    left: 48%;
    animation: floatUp 8s linear infinite;
}

.t-bubble-2 {
    width: 20px; height: 20px;
    left: 52%;
    animation: floatUp 12s linear infinite 2s;
}

.t-bubble-3 {
    width: 35px; height: 35px;
    left: 46%;
    animation: floatUp 16s linear infinite 4s;
}

.t-bubble-4 {
    width: 25px; height: 25px;
    left: 54%;
    animation: floatUp 10s linear infinite 6s;
}

@keyframes floatUp {
    0% {
        transform: translateY(100vh);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-100vh);
        opacity: 0;
    }
}

/* ============================================
   Petal Scatter
   ============================================ */

.petal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 60;
    overflow: hidden;
}

.petal {
    position: absolute;
    width: 12px;
    height: 6px;
    background-color: var(--accent);
    opacity: 0;
    border-radius: 50%;
    top: -20px;
}

.petal.falling {
    animation: petalFall 6s ease-in forwards;
}

.petal-1 { left: 15%; transform: rotate(25deg); }
.petal-2 { left: 35%; transform: rotate(-15deg); }
.petal-3 { left: 55%; transform: rotate(40deg); }
.petal-4 { left: 70%; transform: rotate(-30deg); }
.petal-5 { left: 85%; transform: rotate(10deg); }
.petal-6 { left: 45%; transform: rotate(-45deg); }

@keyframes petalFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.2;
    }
    50% {
        opacity: 0.2;
    }
    100% {
        transform: translateY(110vh) rotate(360deg) translateX(40px);
        opacity: 0;
    }
}

/* ============================================
   Responsive / Mobile Adjustments
   ============================================ */

@media (max-width: 768px) {
    :root {
        --spine-gap: 24px;
    }

    .spread-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    /* Cover - stack vertically */
    .cover-image-area {
        grid-column: 1;
        grid-row: 1;
        height: 50vh;
    }

    .cover-title-area {
        grid-column: 1;
        grid-row: 2;
        align-items: center;
        padding-right: 0;
        padding: 1.5rem;
    }

    .cover-title {
        writing-mode: horizontal-tb;
        font-size: clamp(2.5rem, 12vw, 4rem);
        margin-bottom: 1rem;
    }

    .cover-subtitle {
        text-align: center;
    }

    /* TOC - stack vertically */
    .toc-list-area {
        grid-column: 1;
        grid-row: 1;
    }

    .toc-image-area {
        grid-column: 1;
        grid-row: 2;
        padding-right: 0;
    }

    .toc-circle-image {
        transform: none;
        width: clamp(150px, 40vw, 250px);
        height: clamp(150px, 40vw, 250px);
    }

    /* Feature */
    .feature-overlay-text {
        max-width: 90%;
    }

    /* Botanical - stack vertically */
    .herbarium-area {
        grid-column: 1;
        grid-row: 1;
        padding: 1rem;
    }

    .botanical-text-area {
        grid-column: 1;
        grid-row: 2;
        padding: 1rem 1.5rem;
    }

    .botanical-columns {
        column-count: 1;
    }

    .botanical-title {
        font-size: clamp(1.5rem, 8vw, 2.5rem);
        margin-bottom: 1rem;
    }

    .spine-rule {
        opacity: 0.3;
    }

    .bubble-cluster {
        opacity: 0.5;
    }
}

@media (max-width: 480px) {
    .herbarium-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(3, 1fr);
    }

    .specimen-label {
        font-size: 7px;
    }

    .toc-name {
        font-size: clamp(0.6rem, 3vw, 0.75rem);
        line-height: 2rem;
    }
}
