/* ============================================================
   tsundere.download — Victorian Pastel Dreamscape
   Palette: Parchment Blush #FDF0F8, Lavender Mist #F0E8FC,
            Wisteria Shadow #E2D0F0, Deep Dusk #4A3060,
            Faded Iris #8B7BA8, Dusk Prose #5C4B72,
            Rose Petal #F2C4D8, Moonstone #C8E0F0,
            Gilded Pale #F0E0B0, Pale Heliotrope #C4B0D8
   Fonts: Playfair Display (display), Cormorant Garamond (labels),
          Cormorant SC (metadata), Lora (body)
   ============================================================ */

/* ---- CSS Variables (Design Token Reference) ---- */
:root {
    --color-parchment-blush: #FDF0F8;
    --color-lavender-mist: #F0E8FC;
    --color-wisteria-shadow: #E2D0F0;
    --color-wisteria-pale: #E8D5F0;
    --color-deep-dusk: #4A3060;
    --color-faded-iris: #8B7BA8;
    --color-dusk-prose: #5C4B72;
    --color-rose-petal: #F2C4D8;
    --color-moonstone: #C8E0F0;
    --color-gilded-pale: #F0E0B0;
    --color-pale-heliotrope: #C4B0D8;
    --color-surface-light: #F8F4FC;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: #FDF0F8;
    background-image:
        radial-gradient(circle, #E2D0F0 1px, transparent 1px);
    background-size: 20px 20px;
    background-attachment: fixed;
    color: #5C4B72;
    font-family: 'Lora', Georgia, serif;
    font-size: 17px;
    line-height: 1.8;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ---- Fixed Identity Lozenge ---- */
.identity-lozenge {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 300ms ease;
}

.identity-lozenge:hover {
    opacity: 1;
}

/* ---- Bounce-Enter Animation ---- */
@keyframes bounceEnter {
    0%   { transform: translateY(40px) scale(0.92); opacity: 0; }
    60%  { transform: translateY(-6px) scale(1.01); opacity: 0.9; }
    80%  { transform: translateY(3px) scale(0.99); opacity: 1; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* ---- Prelude Section ---- */
.prelude {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, #F0E8FC 0%, #FDF0F8 65%, #F8F4FC 100%);
    overflow: hidden;
    padding: 80px 40px;
}

.prelude-frame {
    position: relative;
    width: min(680px, 90vw);
    padding: 80px 64px;
    border: 1px solid #E2D0F0;
    outline: 1px solid #E2D0F0;
    outline-offset: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: rgba(253, 240, 248, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    clip-path: polygon(
        4px 0%, calc(100% - 4px) 0%,
        100% 4px, 100% calc(100% - 4px),
        calc(100% - 4px) 100%, 4px 100%,
        0% calc(100% - 4px), 0% 4px
    );
}

/* Corner ornaments */
.corner-ornament {
    position: absolute;
    width: 48px;
    height: 48px;
}

.corner-ornament--tl { top: -2px; left: -2px; }
.corner-ornament--tr { top: -2px; right: -2px; }
.corner-ornament--bl { bottom: -2px; left: -2px; }
.corner-ornament--br { bottom: -2px; right: -2px; }

/* Ornamental corner accent using Wisteria Pale */
.corner-ornament svg ellipse {
    stroke: #E8D5F0;
    stroke-width: 0.5;
}

/* Prelude central abstract shape */
.prelude-shape {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    height: 240px;
    pointer-events: none;
    opacity: 0.8;
}

.prelude-shape svg {
    width: 100%;
    height: 100%;
}

/* Prelude content */
.prelude-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.prelude-label {
    font-family: 'Cormorant Garamond', 'Garamond', serif;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: #8B7BA8;
    margin-bottom: 8px;
}

.prelude-title {
    font-family: 'Playfair Display', 'Georgia', serif;
    font-size: clamp(56px, 10vw, 96px);
    font-weight: 400;
    font-variation-settings: 'wght' 400;
    line-height: 0.9;
    color: #4A3060;
    letter-spacing: -0.02em;
    transition: font-variation-settings 400ms ease;
}

.prelude-title:hover {
    font-variation-settings: 'wght' 700;
}

.prelude-title-ext {
    display: block;
    font-size: 0.65em;
    color: #8B7BA8;
    font-style: italic;
    font-variation-settings: 'wght' 300;
    letter-spacing: 0.05em;
}

.prelude-subtitle {
    font-family: 'Lora', Georgia, serif;
    font-size: 15px;
    font-style: italic;
    color: #8B7BA8;
    margin-top: 8px;
}

.prelude-caption {
    font-family: 'Cormorant SC', 'Garamond', serif;
    font-size: 12px;
    letter-spacing: 0.2em;
    color: #C4B0D8;
    margin-top: 8px;
    text-transform: uppercase;
}

/* ---- Ornamental Rules ---- */
.ornamental-rule {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 200px;
    margin: 0 auto;
}

.ornamental-rule--coda {
    max-width: 300px;
    margin-bottom: 24px;
}

.rule-line {
    flex: 1;
    height: 1px;
    background: #E2D0F0;
}

/* ---- Card Gallery Sections ---- */
.gallery {
    padding: 80px 0;
    position: relative;
}

.gallery--lower {
    padding-top: 40px;
}

/* ---- Card Grid ---- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto;
    gap: 32px;
    padding: 0 64px;
    max-width: 1440px;
    margin: 0 auto;
}

.card-grid--dense {
    gap: 24px;
}

/* ---- Cards ---- */
.card {
    position: relative;
    background: #F0E8FC;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid #E2D0F0;
    outline: 1px solid rgba(226, 208, 240, 0.4);
    outline-offset: 3px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 0;
    transition:
        transform 350ms cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 350ms cubic-bezier(0.22, 1, 0.36, 1);
    clip-path: polygon(
        4px 0%, calc(100% - 4px) 0%,
        100% 4px, 100% calc(100% - 4px),
        calc(100% - 4px) 100%, 4px 100%,
        0% calc(100% - 4px), 0% 4px
    );
    /* Animate in via JS — start invisible */
    opacity: 0;
    will-change: transform, opacity;
}

.card.is-visible {
    animation: bounceEnter 600ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow:
        0 20px 48px rgba(74, 48, 96, 0.1),
        0 8px 20px rgba(74, 48, 96, 0.06);
}

/* Card size variants */
.card--portrait {
    aspect-ratio: 3 / 4;
}

.card--wide {
    grid-column: span 2;
    aspect-ratio: 16 / 5;
    flex-direction: row;
    gap: 40px;
}

.card--tall {
    grid-row: span 2;
    aspect-ratio: 2 / 5;
}

/* Card shape visual area */
.card-shape {
    width: 100%;
    height: 180px;
    overflow: hidden;
    flex-shrink: 0;
    margin-bottom: 24px;
}

.card-shape--wide {
    width: 45%;
    height: 100%;
    margin-bottom: 0;
    margin-right: 0;
}

.card-shape--tall {
    height: 280px;
}

.card-shape svg {
    width: 100%;
    height: 100%;
}

/* Card body text area */
.card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.card--wide .card-body {
    justify-content: center;
}

/* Card typography */
.card-label {
    font-family: 'Cormorant Garamond', 'Garamond', serif;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: #8B7BA8;
    display: block;
}

.card-rule {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 2px 0;
}

.card-rule .rule-line {
    max-width: 60px;
}

.card-headline {
    font-family: 'Playfair Display', 'Georgia', serif;
    font-size: clamp(20px, 2.2vw, 32px);
    font-weight: 400;
    font-variation-settings: 'wght' 400;
    line-height: 1.2;
    color: #4A3060;
    transition: font-variation-settings 400ms ease;
    margin: 2px 0;
}

.card:hover .card-headline {
    font-variation-settings: 'wght' 700;
}

.card-text {
    font-family: 'Lora', Georgia, serif;
    font-size: 15px;
    line-height: 1.8;
    color: #5C4B72;
    margin: 4px 0;
}

.card-meta {
    font-family: 'Cormorant SC', 'Garamond', serif;
    font-size: 12px;
    letter-spacing: 0.18em;
    color: #C4B0D8;
    display: block;
    margin-top: 8px;
    text-transform: uppercase;
}

/* ---- Intermezzo Sticky Band ---- */
.intermezzo {
    position: sticky;
    top: 0;
    z-index: 0;
    width: 100%;
    height: 200px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    pointer-events: none;
}

/* The gallery sections need to be above intermezzo to layer correctly */
.gallery--upper {
    position: relative;
    z-index: 2;
}

.gallery--lower {
    position: relative;
    z-index: 2;
}

.intermezzo-shapes {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

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

.intermezzo-text {
    position: relative;
    z-index: 1;
    font-family: 'Cormorant SC', 'Garamond', serif;
    font-size: 13px;
    letter-spacing: 0.6em;
    color: #C4B0D8;
}

/* ---- Coda Footer ---- */
.coda {
    background: radial-gradient(ellipse at 50% 100%, #F0E8FC 0%, #FDF0F8 70%);
    padding: 80px 40px 60px;
    text-align: center;
    position: relative;
    z-index: 2;
}

.coda-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    max-width: 480px;
    margin: 0 auto;
}

.coda-crown {
    margin-bottom: 16px;
    opacity: 0.7;
}

.coda-title {
    font-family: 'Playfair Display', 'Georgia', serif;
    font-size: clamp(28px, 5vw, 52px);
    font-weight: 400;
    font-variation-settings: 'wght' 400;
    color: #4A3060;
    letter-spacing: -0.01em;
    transition: font-variation-settings 400ms ease;
}

.coda-title:hover {
    font-variation-settings: 'wght' 700;
}

.coda-caption {
    font-family: 'Lora', Georgia, serif;
    font-size: 15px;
    font-style: italic;
    color: #8B7BA8;
    line-height: 1.7;
}

.coda-meta {
    margin-top: 8px;
}

.coda-year {
    font-family: 'Cormorant SC', 'Garamond', serif;
    font-size: 12px;
    letter-spacing: 0.3em;
    color: #C4B0D8;
    text-transform: uppercase;
}

/* ---- Responsive Breakpoints ---- */

/* Tablet: 2-column */
@media (max-width: 1024px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 0 40px;
        gap: 24px;
    }

    .card--tall {
        grid-row: span 1;
        aspect-ratio: 3 / 4;
    }

    .card--wide {
        grid-column: span 2;
    }

    .card--wide .card-shape--wide {
        width: 40%;
    }

    .prelude-title {
        font-size: clamp(44px, 8vw, 72px);
    }
}

/* Mobile: 1-column */
@media (max-width: 640px) {
    .card-grid {
        grid-template-columns: 1fr;
        padding: 0 24px;
        gap: 20px;
    }

    .card--portrait,
    .card--tall {
        aspect-ratio: 3 / 4;
    }

    .card--wide {
        grid-column: span 1;
        aspect-ratio: 3 / 4;
        flex-direction: column;
    }

    .card--wide .card-shape--wide {
        width: 100%;
        height: 160px;
    }

    .card-grid {
        padding: 0 16px;
    }

    .gallery {
        padding: 48px 0;
    }

    .prelude {
        padding: 48px 16px;
    }

    .prelude-frame {
        padding: 48px 32px;
    }

    .prelude-title {
        font-size: clamp(40px, 12vw, 64px);
    }

    .card-headline {
        font-size: 22px;
    }
}
