/* bada.city - Brutalist Scholarly Design */

:root {
    --ink: #0a0a0a;
    --gold: #c9a43e;
    --charcoal: #1c1a17;
    --parchment: #f0e8d6;
    --bronze: #8a7340;
    --sienna: #3d2b1a;
    --amber: #d4b866;
}

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

html {
    scroll-snap-type: y mandatory;
    overflow-y: scroll;
    overflow-x: hidden;
}

body {
    background-color: var(--ink);
    color: var(--parchment);
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: 1.125rem;
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    filter: url(#noiseFilter);
    pointer-events: none;
    z-index: 9999;
}

.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ===== BOOK / MAIN CONTAINER ===== */
.book {
    width: 100%;
}

/* ===== SPREAD (EACH FULL-VIEWPORT PAGE) ===== */
.spread {
    height: 100vh;
    height: 100dvh;
    width: 100%;
    position: relative;
    scroll-snap-align: start;
    overflow: hidden;
}

/* ===== GUTTER LINE ===== */
.gutter-line {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    background-color: var(--gold);
    z-index: 10;
    animation: gutterPulse 4s ease-in-out infinite;
}

.gutter-line--cover {
    height: 0;
    transition: height 1.2s ease-out;
}

.gutter-line--cover.active {
    height: 100%;
}

@keyframes gutterPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ===== SPREAD GRID (VERSO/RECTO) ===== */
.spread-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: 100%;
    width: 100%;
    gap: 0;
}

.verso, .recto {
    padding: 4rem 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.verso {
    padding-right: 4rem;
    padding-left: 5rem;
}

.recto {
    padding-left: 4rem;
    padding-right: 5rem;
}

/* ===== COVER (SPREAD 1) ===== */
.spread-cover {
    background-color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cover-content {
    text-align: center;
    z-index: 5;
}

.cover-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    line-height: 0.9;
}

.cover-title-bada {
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: clamp(5rem, 12vw, 10rem);
    color: var(--gold);
    letter-spacing: -0.03em;
    display: block;
}

.cover-title-city {
    font-family: 'Nunito', sans-serif;
    font-weight: 200;
    font-size: clamp(5rem, 12vw, 10rem);
    color: transparent;
    -webkit-text-stroke: 2px var(--gold);
    letter-spacing: -0.03em;
    display: block;
}

/* ===== ABSTRACT (SPREAD 2) ===== */
.spread-abstract {
    background-color: var(--ink);
}

.section-headline {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(3rem, 7vw, 6rem);
    color: var(--gold);
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.body-text {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--parchment);
    max-width: 38em;
    margin-bottom: 1.25rem;
}

.annotation-caption {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--bronze);
    margin-top: 1rem;
    display: block;
}

.annotation-caption em {
    font-style: italic;
}

.footnote-num {
    color: var(--gold);
}

/* ===== GRADIENT MESH BACKGROUNDS ===== */
.recto-mesh--spread2 {
    background:
        radial-gradient(ellipse at 70% 30%, var(--amber) 0%, var(--gold) 30%, var(--ink) 80%);
    animation: meshDrift 20s ease-in-out infinite alternate;
}

.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(201, 164, 62, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(201, 164, 62, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

@keyframes meshDrift {
    0% { background-position: 0% 0%; }
    50% { background-position: 5% -5%; }
    100% { background-position: -5% 5%; }
}

/* Spread 3 background */
#spread-3 {
    background:
        conic-gradient(from 45deg at 60% 40%, var(--gold) 0%, var(--ink) 25%, var(--bronze) 50%, var(--ink) 75%, var(--gold) 100%),
        conic-gradient(from 90deg at 40% 60%, var(--charcoal) 0%, var(--ink) 50%, var(--charcoal) 100%);
    background-blend-mode: overlay;
}

#spread-3 .spread-grid {
    background-color: rgba(10, 10, 10, 0.85);
}

/* Spread 4 background */
#spread-4 {
    background:
        radial-gradient(circle at 10% 90%, var(--amber) 0%, var(--gold) 5%, var(--ink) 40%);
}

#spread-4 .spread-grid {
    background-color: rgba(10, 10, 10, 0.75);
}

/* Spread 5 background */
#spread-5 {
    background:
        radial-gradient(ellipse at 80% 80%, var(--sienna) 0%, var(--ink) 60%),
        radial-gradient(ellipse at 20% 20%, var(--charcoal) 0%, var(--ink) 70%);
}

/* ===== GOLD RULES ===== */
.gold-rule {
    position: absolute;
    height: 1px;
    background-color: var(--gold);
    opacity: 0.4;
    z-index: 5;
}

.rule-left {
    bottom: 2rem;
    left: 5rem;
    width: calc(50% - 5rem - 1px);
}

.rule-right {
    bottom: 2rem;
    right: 5rem;
    width: calc(50% - 5rem - 1px);
}

/* ===== ANNOTATION MARKERS ===== */
.annotation-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid var(--gold);
    background: transparent;
    display: inline-block;
    position: absolute;
    top: 3rem;
    left: 2rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    z-index: 15;
}

.annotation-marker:hover {
    background-color: var(--gold);
}

.annotation-marker::after {
    content: attr(data-note);
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    color: var(--bronze);
    opacity: 0;
    transition: opacity 0.3s ease;
    white-space: nowrap;
}

.annotation-marker:hover::after {
    opacity: 1;
}

.floating-marker {
    position: absolute;
    top: auto;
    left: auto;
    right: 2rem;
    bottom: 40%;
}

.floating-marker--right {
    right: auto;
    left: calc(50% + 2rem);
    top: 20%;
}

/* ===== CARD-FLIP ELEMENTS ===== */
.card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 1.5rem;
    height: 100%;
    align-items: center;
    justify-items: center;
}

.flip-card {
    width: 100%;
    max-width: 280px;
    height: 0;
    padding-bottom: min(360px, 45vh);
    perspective: 1200px;
    cursor: pointer;
    position: relative;
}

.flip-card-inner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    will-change: transform;
}

.flip-card:hover .flip-card-inner,
.flip-card:focus .flip-card-inner,
.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border: 2px solid var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.flip-card-front {
    background-color: var(--charcoal);
}

.flip-card-back {
    background-color: var(--ink);
    transform: rotateY(180deg);
    padding: 2rem;
    position: relative;
}

.flip-card-back::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    border: 1px solid var(--bronze);
    pointer-events: none;
}

.flip-card-back p {
    font-family: 'Nunito Sans', sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--parchment);
    text-align: left;
}

.card-glyph {
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: 6rem;
    color: var(--gold);
    line-height: 1;
}

/* ===== COLOPHON (SPREAD 6) ===== */
.spread-colophon {
    background-color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
}

.colophon-content {
    text-align: center;
    z-index: 5;
}

.colophon-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 2rem;
}

.colophon-line {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    color: var(--gold);
    letter-spacing: -0.03em;
    line-height: 1.1;
    display: block;
}

.colophon-line--1 { font-size: 4rem; opacity: 1; }
.colophon-line--2 { font-size: 3.5rem; opacity: 0.85; }
.colophon-line--3 { font-size: 3rem; opacity: 0.7; }
.colophon-line--4 { font-size: 2.5rem; opacity: 0.55; }
.colophon-line--5 { font-size: 2rem; opacity: 0.4; }
.colophon-line--6 { font-size: 1.5rem; opacity: 0.3; }
.colophon-line--7 { font-size: 1rem; opacity: 0.2; }
.colophon-line--8 { font-size: 0.5rem; opacity: 0.1; }

.colophon-tagline {
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    color: var(--bronze);
    letter-spacing: 0.05em;
}

/* ===== REVEAL ANIMATIONS ===== */
.reveal-element {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1), transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal-element.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== DEPTH SHADOWS ===== */
.verso, .recto {
    box-shadow: 0 4px 24px rgba(10, 10, 10, 0.6);
}

.annotation-marker, .gold-rule {
    box-shadow: 0 2px 8px rgba(201, 164, 62, 0.15);
}

/* ===== RESPONSIVE (MOBILE) ===== */
@media (max-width: 768px) {
    .spread {
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
        scroll-snap-align: start;
    }

    .spread-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
    }

    .gutter-line {
        position: relative;
        left: auto;
        transform: none;
        width: 100%;
        height: 2px;
        margin: 0 auto;
    }

    .gutter-line--cover {
        width: 0;
        height: 2px;
    }

    .gutter-line--cover.active {
        width: 100%;
        height: 2px;
    }

    .verso, .recto {
        padding: 2rem 1.5rem;
    }

    .section-headline {
        font-size: clamp(2rem, 8vw, 3.5rem);
    }

    .cover-title-bada, .cover-title-city {
        font-size: clamp(3rem, 15vw, 6rem);
    }

    .card-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
        padding: 1rem 0;
    }

    .flip-card {
        max-width: 100%;
        padding-bottom: min(280px, 50vh);
    }

    .card-glyph {
        font-size: 4rem;
    }

    .recto-mesh--spread2 {
        min-height: 40vh;
    }

    .colophon-line--1 { font-size: 2.5rem; }
    .colophon-line--2 { font-size: 2rem; }
    .colophon-line--3 { font-size: 1.75rem; }
    .colophon-line--4 { font-size: 1.5rem; }
    .colophon-line--5 { font-size: 1.25rem; }
    .colophon-line--6 { font-size: 1rem; }
    .colophon-line--7 { font-size: 0.75rem; }
    .colophon-line--8 { font-size: 0.5rem; }

    .rule-left, .rule-right {
        left: 1.5rem;
        right: 1.5rem;
        width: calc(100% - 3rem);
    }

    .floating-marker {
        display: none;
    }

    .annotation-marker {
        left: 1rem;
        top: 1rem;
    }
}