/* rollup.quest — Victorian-ornate exhibition of layer-two scaling */

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

:root {
    --vault-black: #0A0A0A;
    --imperial-gold: #C8A050;
    --ornate-amber: #D4B870;
    --ledger-cream: #E8DFD0;
    --blob-dark-gold: rgba(200, 160, 80, 0.08);
    --grid-line: rgba(200, 160, 80, 0.1);
    --deep-bronze: #8B6B35;
    --scroll: 0;
}

html,
body {
    background: var(--vault-black);
    color: var(--ledger-cream);
    font-family: "Crimson Pro", Georgia, serif;
    font-size: 18px;
    line-height: 1.8;
    overflow-x: hidden;
}

body {
    position: relative;
    min-height: 100vh;
}

/* ----- Grid-line ledger overlay ----- */
.grid-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    transform: translateY(calc(var(--scroll) * -0.1px));
}

/* ----- Organic blobs ----- */
.blobs {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.blob {
    position: absolute;
    background: var(--blob-dark-gold);
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    animation: morph 12s ease-in-out infinite;
    filter: blur(2px);
}

.blob-1 {
    width: 600px;
    height: 600px;
    top: -120px;
    left: -180px;
    animation-delay: 0s;
}

.blob-2 {
    width: 720px;
    height: 720px;
    top: 40%;
    right: -240px;
    animation-delay: -3s;
    animation-duration: 14s;
}

.blob-3 {
    width: 540px;
    height: 540px;
    bottom: 18%;
    left: -120px;
    animation-delay: -6s;
    animation-duration: 16s;
}

.blob-4 {
    width: 660px;
    height: 660px;
    bottom: -180px;
    right: -180px;
    animation-delay: -9s;
}

@keyframes morph {
    0% {
        border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
        transform: rotate(0deg) scale(1);
    }
    50% {
        border-radius: 70% 30% 30% 70% / 70% 70% 30% 30%;
        transform: rotate(8deg) scale(1.05);
    }
    100% {
        border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
        transform: rotate(0deg) scale(1);
    }
}

/* ----- Parallax layers ----- */
.parallax-layer {
    will-change: transform;
}

/* ----- Exhibition hall ----- */
.exhibition-hall {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4vh 6vw;
    z-index: 2;
}

.layer-frame {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    pointer-events: none;
}

.ornate-frame {
    width: min(88vw, 1100px);
    height: auto;
    max-height: 84vh;
}

.frame-stroke {
    stroke-dasharray: 2400;
    stroke-dashoffset: 2400;
    animation: drawStroke 2.4s ease-out forwards;
}

.frame-stroke:nth-child(odd) {
    animation-delay: 0.1s;
}

.frame-stroke:nth-child(even) {
    animation-delay: 0.3s;
}

@keyframes drawStroke {
    to {
        stroke-dashoffset: 0;
    }
}

.layer-content {
    position: relative;
    z-index: 2;
    text-align: center;
    opacity: 0;
    animation: fadeIn 1.4s ease-out 1.6s forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wordmark {
    font-family: "Abril Fatface", Georgia, serif;
    font-weight: 400;
    font-size: clamp(48px, 9vw, 120px);
    color: var(--imperial-gold);
    letter-spacing: 0.01em;
    line-height: 1;
    margin-bottom: 1.4rem;
    text-shadow: 0 0 30px rgba(200, 160, 80, 0.18);
}

.hall-subtitle {
    font-family: "Crimson Pro", Georgia, serif;
    font-style: italic;
    font-size: clamp(16px, 2vw, 22px);
    color: var(--ledger-cream);
    letter-spacing: 0.08em;
    margin-bottom: 1rem;
}

.hall-meta {
    font-family: "Space Mono", monospace;
    font-size: 13px;
    color: var(--ornate-amber);
    letter-spacing: 0.4em;
    text-transform: uppercase;
}

/* ----- Invention sections ----- */
.invention {
    position: relative;
    min-height: 90vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 12vh 8vw;
    z-index: 2;
}

.ornate-divider {
    width: 100%;
    max-width: 800px;
    margin: 0 auto 3rem;
    z-index: 3;
}

.ornate-divider svg {
    width: 100%;
    height: auto;
    display: block;
}

.invention-content {
    max-width: 720px;
    margin: 0 auto;
    text-align: center;
    z-index: 2;
}

.section-numeral {
    display: inline-block;
    font-family: "Abril Fatface", Georgia, serif;
    font-size: clamp(28px, 4vw, 44px);
    color: var(--ornate-amber);
    letter-spacing: 0.04em;
    margin-bottom: 1rem;
}

.invention-title {
    font-family: "Abril Fatface", Georgia, serif;
    font-weight: 400;
    font-size: clamp(36px, 6vw, 80px);
    color: var(--imperial-gold);
    line-height: 1.05;
    margin-bottom: 1.6rem;
    letter-spacing: 0.005em;
}

.invention-body {
    font-family: "Crimson Pro", Georgia, serif;
    font-weight: 400;
    font-size: clamp(16px, 1.5vw, 18px);
    line-height: 1.8;
    color: var(--ledger-cream);
    margin-bottom: 2.4rem;
    max-width: 56ch;
    margin-left: auto;
    margin-right: auto;
}

.data-block {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 1.2rem 2rem;
    border: 1px solid var(--imperial-gold);
    background: rgba(10, 10, 10, 0.4);
}

.data-block .data-label {
    font-family: "Crimson Pro", Georgia, serif;
    font-style: italic;
    font-size: 14px;
    color: var(--ornate-amber);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.data-block .data-value {
    font-family: "Space Mono", monospace;
    font-weight: 700;
    font-size: 13px;
    color: var(--ledger-cream);
    letter-spacing: 0.04em;
}

/* ----- The Gallery ----- */
.gallery {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14vh 8vw;
    z-index: 2;
    overflow: hidden;
}

.gallery-blob {
    position: absolute;
    width: 720px;
    height: 720px;
    background: rgba(200, 160, 80, 0.06);
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    animation: morph 14s ease-in-out infinite;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    pointer-events: none;
}

.gallery-content {
    position: relative;
    z-index: 2;
    max-width: 1100px;
    width: 100%;
    text-align: center;
}

.gallery-title {
    font-family: "Abril Fatface", Georgia, serif;
    font-weight: 400;
    font-size: clamp(36px, 6vw, 80px);
    color: var(--imperial-gold);
    margin-bottom: 4rem;
    line-height: 1.05;
}

.mechanism-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
    text-align: left;
}

.mechanism {
    padding: 2rem 1.6rem;
    border: 1px solid rgba(200, 160, 80, 0.35);
    background: rgba(10, 10, 10, 0.5);
    transition: border-color 0.4s ease, transform 0.4s ease, background 0.4s ease;
    position: relative;
}

.mechanism::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    bottom: 6px;
    border: 1px solid rgba(200, 160, 80, 0.2);
    pointer-events: none;
    transition: border-color 0.4s ease;
}

.mechanism:hover {
    border-color: var(--imperial-gold);
    background: rgba(200, 160, 80, 0.04);
    transform: translateY(-4px);
}

.mechanism:hover::before {
    border-color: var(--ornate-amber);
}

.mechanism.shake-error {
    animation: shakeError 0.3s ease-in-out;
}

@keyframes shakeError {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

.mechanism-name {
    font-family: "Abril Fatface", Georgia, serif;
    font-weight: 400;
    font-size: 26px;
    color: var(--imperial-gold);
    margin-bottom: 0.8rem;
}

.mechanism-desc {
    font-family: "Crimson Pro", Georgia, serif;
    font-size: 16px;
    line-height: 1.7;
    color: var(--ledger-cream);
    margin-bottom: 1.4rem;
}

.mechanism-mono {
    display: inline-block;
    font-family: "Space Mono", monospace;
    font-size: 13px;
    color: var(--ornate-amber);
    padding-top: 0.8rem;
    border-top: 1px solid rgba(200, 160, 80, 0.25);
    width: 100%;
    letter-spacing: 0.04em;
}

/* ----- Vault Footer ----- */
.vault-footer {
    position: relative;
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8vh 6vw;
    background: #050505;
    text-align: center;
    z-index: 2;
}

.footer-crown {
    width: min(80vw, 800px);
    height: auto;
    margin-bottom: 2.4rem;
}

.footer-mark {
    font-family: "Abril Fatface", Georgia, serif;
    font-weight: 400;
    font-size: clamp(28px, 4vw, 44px);
    color: var(--imperial-gold);
    margin-bottom: 0.8rem;
    letter-spacing: 0.01em;
}

.footer-meta {
    font-family: "Crimson Pro", Georgia, serif;
    font-style: italic;
    font-size: 16px;
    color: var(--ledger-cream);
    margin-bottom: 1.4rem;
    letter-spacing: 0.06em;
}

.footer-mono {
    font-family: "Space Mono", monospace;
    font-size: 13px;
    color: var(--ornate-amber);
    letter-spacing: 0.08em;
}

/* ----- Reveal animations ----- */
.invention-content,
.gallery-content {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 1s ease-out, transform 1s ease-out;
}

.invention-content.is-revealed,
.gallery-content.is-revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ----- Responsive ----- */
@media (max-width: 720px) {
    .exhibition-hall {
        padding: 6vh 4vw;
    }

    .ornate-frame {
        width: 96vw;
        max-height: 90vh;
    }

    .invention {
        padding: 10vh 6vw;
    }

    .gallery {
        padding: 10vh 5vw;
    }

    .mechanism-grid {
        grid-template-columns: 1fr;
        gap: 1.4rem;
    }

    .blob-1, .blob-2, .blob-3, .blob-4 {
        width: 360px;
        height: 360px;
    }

    .gallery-blob {
        width: 420px;
        height: 420px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .blob,
    .gallery-blob {
        animation: none;
    }

    .frame-stroke {
        animation: none;
        stroke-dashoffset: 0;
    }

    .layer-content,
    .invention-content,
    .gallery-content {
        animation: none;
        opacity: 1;
        transform: none;
        transition: none;
    }
}
