/* ======================================
   quirk.bar — A Celestial Cocktail Atlas
   ====================================== */

:root {
    --cream: #f4f1eb;
    --frost: #e8e8f0;
    --ink: #2c2c3a;
    --charcoal: #3d3d4a;
    --chrome: #b8b8c8;
    --chrome-bright: #d4d4e0;
    --gold: #c9a54e;
    --gunmetal: #6a6a7e;
    --chrome-muted: #a0a0b4;
    --plate-height: 100vh;
    --gap-height: 8vh;
    --col-margin: 180px;
    --col-aside: 220px;
}

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

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

body {
    background-color: var(--cream);
    color: var(--charcoal);
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.15vw, 1.2rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    overflow-x: hidden;
    position: relative;
}

/* ---- Star Scatter Background ---- */
.star-scatter {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
}

/* ---- Plate Structure ---- */
.plate {
    min-height: var(--plate-height);
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
}

.plate-grid {
    display: grid;
    grid-template-columns: var(--col-margin) 1fr var(--col-aside);
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 60px 40px;
    min-height: var(--plate-height);
    align-items: start;
    gap: 0 40px;
}

/* ---- Marginalia ---- */
.marginalia {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-top: 80px;
    position: sticky;
    top: 80px;
    align-self: start;
}

.nav-anchor {
    font-family: 'Playfair Display SC', serif;
    font-weight: 400;
    font-size: 11px;
    letter-spacing: 0.15em;
    color: var(--chrome-muted);
    text-decoration: none;
    text-transform: lowercase;
    transition: color 0.3s ease;
}

.nav-anchor:hover {
    color: var(--chrome-bright);
}

.annotation {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: clamp(0.85rem, 1vw, 1.05rem);
    line-height: 1.5;
    color: #7a7a8e;
    font-style: italic;
}

.annotation-lower {
    margin-top: auto;
    padding-top: 40px;
}

/* ---- Plate Content ---- */
.plate-content {
    padding-top: 80px;
    padding-right: 40px;
}

.plate-content p {
    margin-bottom: 1.4em;
    text-align: left;
}

/* ---- Plate Aside ---- */
.plate-aside {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 80px;
    gap: 40px;
}

/* ---- Typography ---- */
.hero-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(4rem, 10vw, 8rem);
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--ink);
    margin-bottom: 0.3em;
}

.hero-subtitle {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    color: var(--gunmetal);
    line-height: 1.5;
}

.plate-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(2.4rem, 5vw, 4.2rem);
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--ink);
    margin-bottom: 1.2em;
}

/* ---- Plate I — The Observatory ---- */
.plate-i {
    background-color: var(--cream);
}

.plate-i-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: calc(var(--plate-height) - 120px);
    padding-top: 0;
}

.compass-rose {
    width: 180px;
    height: 180px;
    opacity: 0.85;
}

/* ---- Typewriter Effect ---- */
.typewriter {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid var(--gold);
    animation: typing 2.5s steps(44, end) 0.5s both,
               blink-caret 0.75s step-end infinite,
               fade-caret 1s ease 3.5s forwards;
    width: 0;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--gold); }
}

@keyframes fade-caret {
    to { border-color: transparent; }
}

/* ---- Plate Dividers ---- */
.plate-divider {
    height: var(--gap-height);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10%;
    position: relative;
    z-index: 1;
}

.plate-divider svg {
    width: 100%;
    height: 10px;
}

/* ---- Plate II — The Catalog ---- */
.plate-ii {
    background-color: var(--cream);
}

.constellation {
    width: 160px;
    max-width: 100%;
}

/* ---- Plate III — The Recipes ---- */
.plate-iii {
    background-color: var(--cream);
}

.recipe {
    margin-bottom: 2em;
}

.recipe-name {
    font-family: 'Playfair Display SC', serif;
    font-weight: 400;
    font-size: clamp(1.1rem, 1.5vw, 1.4rem);
    letter-spacing: 0.08em;
    color: var(--ink);
    margin-bottom: 0.5em;
}

.recipe-ingredients {
    font-family: 'Lora', serif;
    font-style: italic;
    font-size: clamp(0.9rem, 1vw, 1rem);
    color: var(--gunmetal);
    margin-bottom: 0.8em;
    line-height: 1.6;
}

.recipe-description {
    color: var(--charcoal);
}

.flourish {
    display: block;
    width: 200px;
    height: 20px;
    margin: 1.5em 0;
}

.constellation-upper {
    width: 160px;
}

.constellation-lower {
    width: 140px;
}

/* ---- Plate IV — The Astronomer's Notes ---- */
.plate-iv {
    background-color: var(--frost);
}

.astronomer-text {
    color: var(--charcoal);
    font-style: italic;
}

.astronomer-text em {
    font-style: italic;
}

.astrolabe {
    width: 180px;
    max-width: 100%;
    opacity: 0.9;
}

/* ---- Plate V — Closing Time ---- */
.plate-v {
    background-color: var(--cream);
    min-height: 60vh;
}

.plate-v-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 50vh;
    padding-top: 0;
}

.closing-star {
    width: 60px;
    height: 60px;
    margin-bottom: 2em;
}

.closing-star svg {
    width: 100%;
    height: 100%;
}

.closing-phrase {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    color: var(--ink);
    letter-spacing: -0.02em;
    margin-bottom: 2em;
}

.colophon {
    margin-top: 1em;
}

.colophon-text {
    font-family: 'Playfair Display SC', serif;
    font-weight: 400;
    font-size: 11px;
    letter-spacing: 0.12em;
    color: var(--chrome-muted);
    margin-bottom: 0.8em;
    line-height: 1.6;
}

/* ---- Chrome Metallic Effects ---- */
.recipe {
    position: relative;
    padding: 1.5em;
    border-radius: 2px;
}

.recipe::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 1px solid transparent;
    border-image: linear-gradient(135deg, var(--chrome) 0%, var(--frost) 40%, var(--chrome) 100%) 1;
    pointer-events: none;
    opacity: 0.6;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    :root {
        --col-margin: 140px;
        --col-aside: 180px;
    }

    .plate-grid {
        gap: 0 24px;
        padding: 40px 24px;
    }
}

@media (max-width: 768px) {
    .plate-grid {
        grid-template-columns: 1fr;
        padding: 32px 20px;
        min-height: auto;
    }

    .plate {
        min-height: auto;
    }

    .marginalia {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px 16px;
        padding-top: 20px;
        padding-bottom: 8px;
        border-left: 2px solid var(--chrome);
        padding-left: 16px;
        margin-bottom: 16px;
    }

    .annotation-lower {
        padding-top: 0;
        margin-top: 0;
    }

    .plate-content {
        padding-top: 20px;
        padding-right: 0;
    }

    .plate-i-content {
        min-height: 60vh;
        padding-top: 20px;
    }

    .plate-aside {
        padding-top: 24px;
        order: 3;
    }

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

    .compass-rose {
        width: 140px;
        height: 140px;
    }

    .constellation {
        width: 140px;
    }

    .astrolabe {
        width: 150px;
    }

    .plate-divider {
        height: 4vh;
    }

    .plate-v-content {
        min-height: 40vh;
    }
}

@media (max-width: 480px) {
    .typewriter {
        white-space: normal;
        overflow: visible;
        border-right: none;
        animation: none;
        width: auto;
    }

    .hero-title {
        font-size: clamp(2.2rem, 14vw, 3.5rem);
    }

    .plate-grid {
        padding: 24px 16px;
    }
}

/* ---- Selection ---- */
::selection {
    background-color: rgba(201, 165, 78, 0.2);
    color: var(--ink);
}

/* ---- Links in content ---- */
a {
    color: var(--gold);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--ink);
}
