/* dilemma.quest — A weighing chamber */

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

/* ===== Palette ===== */
:root {
    --chamber-stone: #e8e5df;
    --inscription-black: #1c1b18;
    --counter-inscription: #2e2d28;
    --fulcrum-iron: #8a8a7a;
    --erosion: #5c574f;
    --void: #d4d0c8;
    --absent-red: #6b3a3a;
    --fulcrum-position: 55%;
}

/* ===== Stone Texture via SVG Filter ===== */
body {
    background-color: var(--chamber-stone);
    color: var(--inscription-black);
    font-family: 'Cormorant Garamond', Georgia, serif;
    overflow: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: var(--fulcrum-position);
    bottom: 0;
    width: 1px;
    background: var(--fulcrum-iron);
    z-index: 10;
    pointer-events: none;
}

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

/* ===== Main Scroll Container ===== */
#chamber {
    width: 100%;
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 1;
}

/* ===== Section Base ===== */
.section {
    width: 100%;
    height: 100vh;
    scroll-snap-align: start;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ===== Opening Section: The Chamber ===== */
.section-opening {
    align-items: center;
    justify-content: center;
}

.opening-or {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: clamp(8rem, 18vw, 20rem);
    font-weight: 400;
    color: var(--inscription-black);
    opacity: 0;
    position: absolute;
    left: calc(var(--fulcrum-position) - 0.5em);
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    line-height: 1;
    pointer-events: none;
    animation: fadeInGhostOR 2000ms ease-in 600ms forwards;
}

.domain-name {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    text-transform: lowercase;
    font-variant: small-caps;
    color: var(--inscription-black);
    position: relative;
    z-index: 2;
    opacity: 0;
    animation: fadeInDomain 800ms ease-in 1200ms forwards;
}

@keyframes fadeInGhostOR {
    from { opacity: 0; }
    to { opacity: 0.08; }
}

@keyframes fadeInDomain {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===== Dilemma Sections ===== */
.section-dilemma {
    padding-top: 15vh;
    align-items: stretch;
    justify-content: flex-start;
}

/* Void space at top */
.section-dilemma::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 15vh;
    background-color: var(--void);
    z-index: 0;
}

/* Roman Numeral */
.numeral {
    font-family: 'Libre Bodoni', Georgia, serif;
    font-weight: 700;
    font-size: clamp(0.7rem, 1vw, 0.9rem);
    font-variant: small-caps;
    letter-spacing: 0.25em;
    color: var(--erosion);
    text-align: center;
    position: absolute;
    top: 4vh;
    left: var(--fulcrum-position);
    transform: translateX(-50%);
    z-index: 11;
}

/* Grid for propositions */
.dilemma-grid {
    display: grid;
    grid-template-columns: 1fr calc(var(--fulcrum-position) - 3rem) 3rem 1fr;
    flex: 1;
    align-items: center;
    padding: 0 2rem;
    position: relative;
    z-index: 2;
}

.proposition-a {
    grid-column: 2;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 500;
    font-size: clamp(1.1rem, 1.8vw, 1.4rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    color: var(--inscription-black);
    text-align: left;
    padding-right: 1.5rem;
    opacity: 0;
    transform: translateY(1rem);
    transition: opacity 600ms ease-in, transform 600ms ease-in;
}

.proposition-a.revealed {
    opacity: 1;
    transform: translateY(0);
}

.section-or {
    grid-column: 3;
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: clamp(4rem, 8vw, 6rem);
    font-weight: 400;
    color: var(--inscription-black);
    opacity: 0;
    text-align: center;
    line-height: 1;
    pointer-events: none;
    position: absolute;
    left: calc(var(--fulcrum-position) - 0.5em);
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
}

.proposition-b {
    grid-column: 4;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 600;
    font-size: clamp(1.1rem, 1.8vw, 1.4rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    color: var(--counter-inscription);
    text-align: right;
    padding-left: 1.5rem;
    opacity: 0;
    transform: translateY(1rem);
    transition: opacity 600ms ease-in, transform 600ms ease-in;
}

.proposition-b.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Ghost OR in sections */
.ghost-or {
    pointer-events: none;
    user-select: none;
}

.section-or.revealed {
    opacity: 0.05;
}

/* Horizontal Seal */
.horizontal-seal {
    width: 0%;
    height: 0.5px;
    margin: 0 auto 3vh;
    position: relative;
    z-index: 2;
    opacity: 0;
    transition: width 500ms ease-out, opacity 400ms ease-in;
    background: linear-gradient(
        to right,
        transparent 0%,
        var(--erosion) 15%,
        var(--erosion) 85%,
        transparent 100%
    );
}

.horizontal-seal.revealed {
    width: 70%;
    opacity: 1;
}

/* ===== Terminal Section: The Unresolved ===== */
.section-terminal {
    align-items: center;
    justify-content: center;
    position: relative;
}

.section-terminal::before {
    content: '';
    position: absolute;
    top: 0;
    left: calc(var(--fulcrum-position) - 0.5px);
    width: 1px;
    height: 100%;
    background: linear-gradient(
        to bottom,
        var(--fulcrum-iron) 0%,
        transparent 100%
    );
    z-index: 11;
}

.terminal-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1rem;
    font-weight: 500;
    color: var(--fulcrum-iron);
    text-align: center;
    width: 100%;
    position: relative;
    z-index: 2;
    margin-top: -20vh;
    opacity: 0;
    transition: opacity 800ms ease-in;
}

.terminal-text.revealed {
    opacity: 1;
}

.terminal-rest {
    text-decoration: underline;
    text-decoration-color: var(--absent-red);
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

/* ===== Hide Fulcrum on Terminal Section ===== */
/* The fixed fulcrum is hidden on terminal via JS class */
body.terminal-active::before {
    opacity: 0;
    transition: opacity 800ms ease-in;
}

/* ===== Scrollbar ===== */
#chamber::-webkit-scrollbar {
    display: none;
}

#chamber {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ===== Responsive: < 768px ===== */
@media (max-width: 768px) {
    :root {
        --fulcrum-position: 50%;
    }

    body::before {
        display: none;
    }

    .section-dilemma {
        padding-top: 8vh;
    }

    .section-dilemma::before {
        height: 8vh;
    }

    .numeral {
        top: 2vh;
        left: 50%;
    }

    .dilemma-grid {
        display: flex;
        flex-direction: column;
        padding: 0 1.5rem;
        gap: 0;
        justify-content: center;
    }

    .proposition-a {
        text-align: left;
        padding-right: 0;
        padding-bottom: 1rem;
    }

    .section-or {
        position: relative;
        left: auto;
        top: auto;
        transform: none;
        font-size: clamp(3rem, 10vw, 5rem);
        opacity: 0;
        text-align: center;
        margin: 0.5rem 0;
    }

    .proposition-b {
        text-align: left;
        padding-left: 0;
        padding-top: 1rem;
    }

    /* Mobile fulcrum: horizontal rule between propositions */
    .section-or::after {
        content: '';
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        width: 60%;
        height: 1px;
        background: var(--fulcrum-iron);
        z-index: -1;
    }

    .opening-or {
        left: 50%;
        transform: translate(-50%, -50%);
    }

    .horizontal-seal.revealed {
        width: 80%;
    }

    .section-terminal::before {
        display: none;
    }

    .terminal-text {
        margin-top: -10vh;
        padding: 0 2rem;
    }
}
