/* ============================================================
   lower.quest -- v2
   Retro quest descender :: earth-tones / baskerville+pixel
   Palette
     --earth-cream  #e4dcd0   primary background
     --earth-warm   #d4c8b8   secondary background
     --retro-amber  #c4943a   primary accent / CRT amber
     --retro-olive  #7a8a5a   secondary accent / green screen
     --earth-dark   #3a3428   primary text
     --earth-mid    #6a6050   secondary text
   ============================================================ */

:root {
    --earth-cream: #e4dcd0;
    --earth-warm: #d4c8b8;
    --retro-amber: #c4943a;
    --retro-olive: #7a8a5a;
    --earth-dark: #3a3428;
    --earth-mid: #6a6050;
    --pixel-border: #3a3428;
    --gen-line: rgba(196, 148, 58, 0.4);

    --font-serif: "Libre Baskerville", Georgia, "Times New Roman", serif;
    --font-pixel: "Press Start 2P", "Courier New", monospace;

    --px: 4px;
    --easing-elastic: cubic-bezier(.34, 1.56, .64, 1);

    --max-stage: 1440px;
}

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

html, body {
    background: var(--earth-cream);
    color: var(--earth-dark);
    font-family: var(--font-serif);
    font-size: clamp(16px, 1.5vw, 18px);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body::before {
    /* CRT scanline tint that warms the page very slightly */
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background:
        repeating-linear-gradient(
            to bottom,
            rgba(58, 52, 40, 0.025) 0,
            rgba(58, 52, 40, 0.025) 1px,
            transparent 1px,
            transparent 3px
        );
    mix-blend-mode: multiply;
}

.page {
    position: relative;
    z-index: 2;
    max-width: 100%;
}

/* ============================================================
   HERO -- asymmetric: arrow left 40%, title right 60%
   ============================================================ */
.hero {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 40% 60%;
    align-items: center;
    padding: 6vh 0;
    background: var(--earth-cream);
    position: relative;
    overflow: hidden;
}

.hero::before {
    /* faint corner pixel-mark */
    content: "lower.quest // v2";
    position: absolute;
    top: 24px;
    left: 24px;
    font-family: var(--font-pixel);
    font-size: 10px;
    color: var(--earth-mid);
    letter-spacing: 0.05em;
}

.hero::after {
    content: "ASYMMETRIC :: 40 / 60";
    position: absolute;
    top: 24px;
    right: 24px;
    font-family: var(--font-pixel);
    font-size: 10px;
    color: var(--retro-amber);
    letter-spacing: 0.05em;
}

.hero__arrow-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding-left: 6%;
}

.hero__caption {
    font-family: var(--font-pixel);
    font-size: 10px;
    color: var(--retro-olive);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.hero__title-wrap {
    padding-right: 8%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hero__title {
    font-family: var(--font-serif);
    font-weight: 700;
    line-height: 0.95;
    color: var(--earth-dark);
    display: flex;
    flex-direction: column;
    gap: clamp(4px, 1vw, 14px);
}

.hero__lower {
    font-size: clamp(48px, 8vw, 112px);
    letter-spacing: -0.01em;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 400ms ease-out, transform 400ms ease-out;
}

.hero__quest {
    font-size: clamp(40px, 6.4vw, 88px);
    letter-spacing: -0.01em;
    color: var(--retro-amber);
    margin-left: clamp(20px, 5vw, 80px);
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 400ms ease-out 200ms, transform 400ms ease-out 200ms;
}

.is-loaded .hero__lower,
.is-loaded .hero__quest {
    opacity: 1;
    transform: translateX(0);
}

.hero__sub {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 400;
    color: var(--earth-mid);
    font-size: clamp(15px, 1.4vw, 18px);
    max-width: 32em;
    margin-top: 12px;
}

.hero__chip {
    font-family: var(--font-pixel);
    font-size: 10px;
    color: var(--earth-dark);
    letter-spacing: 0.1em;
    margin-top: 16px;
    padding: 8px 12px;
    background: var(--earth-warm);
    border: 2px solid var(--pixel-border);
    align-self: flex-start;
}

/* ============================================================
   RETRO ARROW -- pixelated, descending
   ============================================================ */
.retro-arrow {
    --row-h: 8px;
    --row-w: 56px;
    --shaft-w: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: scale(0);
    transition: transform 600ms var(--easing-elastic);
    will-change: transform;
}

.retro-arrow--lg {
    --row-h: 12px;
    --row-w: 96px;
    --shaft-w: 36px;
}

.is-loaded .retro-arrow,
.is-visible .retro-arrow {
    transform: scale(1);
}

.retro-arrow__shaft,
.retro-arrow__head {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.retro-arrow__shaft {
    gap: 0;
}

.retro-arrow__head {
    gap: 0;
}

.px-row {
    display: block;
    background: var(--retro-amber);
    height: var(--row-h);
    border-bottom: 1px solid rgba(58, 52, 40, 0.25);
}

/* widths derived from row count, retro-pixel feel */
.px-row--w1 { width: calc(var(--shaft-w) / 7 * 1); }
.px-row--w3 { width: calc(var(--shaft-w) / 7 * 3); }
.px-row--w5 { width: calc(var(--shaft-w) / 7 * 5); }
.px-row--w7 { width: var(--shaft-w); }
.px-row--w9 { width: calc(var(--row-w) / 13 * 9); }
.px-row--w11 { width: calc(var(--row-w) / 13 * 11); }
.px-row--w13 { width: var(--row-w); }

/* descent oscillation */
.retro-arrow {
    animation: descent 4s ease-in-out infinite;
    animation-play-state: paused;
}

.is-loaded .retro-arrow,
.is-visible .retro-arrow {
    animation-play-state: running;
}

@keyframes descent {
    0%, 100% { translate: 0 -6px; }
    50% { translate: 0 6px; }
}

/* ============================================================
   SECTIONS / HEADS
   ============================================================ */
.section-head {
    margin-bottom: clamp(40px, 6vh, 72px);
    max-width: 28em;
}

.section-head--left {
    margin-left: 10%;
    margin-right: auto;
    text-align: left;
}

.section-head--right {
    margin-right: 10%;
    margin-left: auto;
    text-align: right;
}

.section-head__kicker {
    display: inline-block;
    font-family: var(--font-pixel);
    font-size: 10px;
    color: var(--retro-amber);
    letter-spacing: 0.15em;
    margin-bottom: 16px;
    padding: 6px 10px;
    border: 2px solid var(--retro-amber);
}

.section-head__title {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: clamp(28px, 4.4vw, 56px);
    color: var(--earth-dark);
    line-height: 1.1;
    margin-bottom: 18px;
}

.section-head__lede {
    font-family: var(--font-serif);
    font-style: italic;
    color: var(--earth-mid);
    font-size: clamp(16px, 1.5vw, 19px);
}

/* ============================================================
   BARRIERS  (content weighted left, generative on right)
   ============================================================ */
.barriers {
    background: var(--earth-cream);
    padding: clamp(80px, 14vh, 160px) 0;
    position: relative;
    overflow: hidden;
}

.barriers__inner {
    display: grid;
    grid-template-columns: 60% 40%;
    gap: 0;
    max-width: var(--max-stage);
    margin: 0 auto;
}

.barrier-list {
    list-style: none;
    margin-left: 10%;
    margin-right: 0;
    max-width: 28em;
    grid-column: 1 / 2;
    grid-row: 2 / 3;
    display: flex;
    flex-direction: column;
    gap: clamp(28px, 4vh, 48px);
}

.section-head--left {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
}

.barriers .generative {
    grid-column: 2 / 3;
    grid-row: 1 / 3;
    align-self: stretch;
}

.barrier {
    display: grid;
    grid-template-columns: 32px 1fr;
    gap: 20px;
    align-items: flex-start;
    opacity: 0;
    transform: translateX(-12px);
    transition: opacity 500ms ease-out, transform 500ms ease-out;
}

.barrier.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--pixel-border);
    background: var(--earth-warm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 4px;
    position: relative;
    flex: none;
    /* chunky pixel feel = no border-radius */
    border-radius: 0;
}

.checkbox::after {
    /* corner notch like a tactile keycap */
    content: "";
    position: absolute;
    top: -2px;
    left: -2px;
    width: 4px;
    height: 4px;
    background: var(--earth-cream);
}

.checkbox__mark {
    width: 14px;
    height: 14px;
    background: var(--retro-amber);
    transform: scale(0);
    transition: transform 400ms var(--easing-elastic);
    /* draw a chunky checkmark via clip-path */
    clip-path: polygon(
        0% 50%, 16% 50%,
        38% 75%, 38% 75%,
        100% 8%, 100% 24%,
        38% 100%, 24% 100%
    );
}

.barrier.is-checked .checkbox__mark {
    transform: scale(1);
}

.barrier__title {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: clamp(18px, 1.8vw, 22px);
    color: var(--earth-dark);
    margin-bottom: 6px;
}

.barrier__text {
    font-family: var(--font-serif);
    font-weight: 400;
    color: var(--earth-mid);
    font-size: clamp(15px, 1.4vw, 17px);
    line-height: 1.7;
}

/* generative pattern panel */
.generative {
    position: relative;
    margin-right: 6%;
    margin-left: 4%;
    border: 2px solid var(--pixel-border);
    background: var(--earth-warm);
    aspect-ratio: 1 / 1.2;
    overflow: hidden;
    align-self: center;
    max-height: 520px;
}

.generative canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.generative__caption {
    position: absolute;
    bottom: 10px;
    left: 10px;
    font-family: var(--font-pixel);
    font-size: 9px;
    color: var(--earth-dark);
    letter-spacing: 0.08em;
    background: var(--earth-cream);
    padding: 4px 6px;
    border: 1px solid var(--pixel-border);
}

/* ============================================================
   SOLUTIONS  (content weighted right; mirrored)
   ============================================================ */
.solutions {
    background: var(--earth-warm);
    padding: clamp(80px, 14vh, 160px) 0;
    position: relative;
    border-top: 2px solid var(--pixel-border);
    border-bottom: 2px solid var(--pixel-border);
}

.solutions__inner {
    max-width: var(--max-stage);
    margin: 0 auto;
}

.solution-list {
    list-style: none;
    margin-right: 10%;
    margin-left: auto;
    max-width: 36em;
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(36px, 5vh, 64px);
}

.solution {
    display: grid;
    grid-template-columns: 1fr 96px;
    gap: 28px;
    align-items: center;
    text-align: right;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 500ms var(--easing-elastic), transform 500ms var(--easing-elastic);
}

.solution.is-visible {
    opacity: 1;
    transform: scale(1);
}

.solution__icon {
    width: 96px;
    height: 96px;
    background: var(--earth-cream);
    border: 2px solid var(--pixel-border);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex: none;
}

.solution__icon::before {
    /* outer pixel-step */
    content: "";
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    border: 2px solid var(--retro-amber);
    pointer-events: none;
    opacity: 0;
    transition: opacity 300ms ease;
}

.solution.is-visible .solution__icon::before {
    opacity: 1;
}

.solution__title {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: clamp(18px, 2vw, 24px);
    color: var(--earth-dark);
    margin-bottom: 6px;
}

.solution__text {
    font-family: var(--font-serif);
    color: var(--earth-mid);
    font-size: clamp(15px, 1.4vw, 17px);
    line-height: 1.65;
}

/* ----- Wrench ----- */
.ic-wrench {
    position: relative;
    width: 56px;
    height: 56px;
}
.ic-wrench__shaft {
    position: absolute;
    width: 14px;
    height: 36px;
    left: 21px;
    bottom: 0;
    background: var(--retro-amber);
}
.ic-wrench__handle {
    position: absolute;
    width: 26px;
    height: 14px;
    left: 14px;
    bottom: 14px;
    background: var(--retro-amber);
}
.ic-wrench__head {
    position: absolute;
    width: 28px;
    height: 28px;
    top: 0;
    left: 14px;
    background: var(--retro-amber);
    border-radius: 50%;
    box-shadow: inset 0 0 0 8px var(--earth-cream);
}

/* ----- Door ----- */
.ic-door {
    position: relative;
    width: 56px;
    height: 56px;
}
.ic-door__frame {
    position: absolute;
    width: 36px;
    height: 50px;
    top: 0;
    left: 10px;
    background: var(--retro-amber);
    border-bottom: 4px solid var(--earth-dark);
}
.ic-door__knob {
    position: absolute;
    width: 6px;
    height: 6px;
    top: 28px;
    left: 36px;
    background: var(--earth-dark);
    border-radius: 50%;
}
.ic-door__threshold {
    position: absolute;
    width: 56px;
    height: 4px;
    bottom: 0;
    left: 0;
    background: var(--earth-dark);
}

/* ----- Bridge ----- */
.ic-bridge {
    position: relative;
    width: 64px;
    height: 56px;
}
.ic-bridge__pillar {
    position: absolute;
    width: 8px;
    height: 36px;
    bottom: 0;
    background: var(--retro-amber);
}
.ic-bridge__pillar--l { left: 8px; }
.ic-bridge__pillar--r { right: 8px; }

.ic-bridge__deck {
    position: absolute;
    width: 56px;
    height: 6px;
    top: 18px;
    left: 4px;
    background: var(--retro-amber);
}
.ic-bridge__arch {
    position: absolute;
    width: 40px;
    height: 22px;
    top: 14px;
    left: 12px;
    border: 4px solid var(--retro-olive);
    border-bottom: none;
    border-radius: 50% 50% 0 0 / 100% 100% 0 0;
    background: transparent;
}

/* ----- Lamp ----- */
.ic-lamp {
    position: relative;
    width: 56px;
    height: 56px;
}
.ic-lamp__bulb {
    position: absolute;
    width: 24px;
    height: 24px;
    top: 6px;
    left: 16px;
    background: var(--retro-amber);
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(196, 148, 58, 0.3);
}
.ic-lamp__base {
    position: absolute;
    width: 36px;
    height: 8px;
    bottom: 4px;
    left: 10px;
    background: var(--earth-dark);
}
.ic-lamp__glow {
    position: absolute;
    width: 12px;
    height: 18px;
    top: 30px;
    left: 22px;
    background: var(--retro-amber);
    opacity: 0.5;
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
    animation: lamp-flicker 2.4s ease-in-out infinite;
}

@keyframes lamp-flicker {
    0%, 100% { opacity: 0.4; transform: scaleY(1); }
    50% { opacity: 0.65; transform: scaleY(1.05); }
}

/* ============================================================
   FIELD NOTE / pull quote
   ============================================================ */
.fieldnote {
    background: var(--earth-cream);
    padding: clamp(80px, 14vh, 160px) 0;
    display: flex;
    justify-content: center;
}

.fieldnote__quote {
    max-width: 32em;
    margin: 0 auto;
    text-align: center;
    padding: 0 6%;
    position: relative;
}

.fieldnote__quote::before,
.fieldnote__quote::after {
    content: "";
    display: block;
    width: 48px;
    height: 4px;
    background: var(--retro-amber);
    margin: 0 auto 24px;
}

.fieldnote__quote::after {
    margin: 24px auto 0;
}

.fieldnote__line {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: clamp(22px, 3.2vw, 38px);
    color: var(--earth-dark);
    line-height: 1.35;
}

.fieldnote__attrib {
    font-family: var(--font-pixel);
    font-size: 10px;
    color: var(--earth-mid);
    letter-spacing: 0.1em;
    margin-top: 28px;
}

/* ============================================================
   BEGIN LOWERING -- centered (breaks asymmetry)
   ============================================================ */
.begin {
    background: var(--earth-cream);
    padding: clamp(80px, 16vh, 200px) 0 clamp(60px, 10vh, 120px);
    text-align: center;
    position: relative;
}

.begin__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
}

.begin__title {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: clamp(36px, 6vw, 80px);
    color: var(--earth-dark);
    line-height: 1;
}

.begin__motto {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: clamp(18px, 2vw, 26px);
    color: var(--earth-mid);
}

.begin__hint {
    font-family: var(--font-pixel);
    font-size: 10px;
    color: var(--retro-amber);
    letter-spacing: 0.12em;
    padding: 10px 14px;
    border: 2px solid var(--retro-amber);
    cursor: pointer;
    transition: background 200ms ease, color 200ms ease;
    user-select: none;
}

.begin__hint:hover {
    background: var(--retro-amber);
    color: var(--earth-cream);
}

.begin.is-pressed .retro-arrow {
    animation-duration: 1.2s;
}

/* ============================================================
   FOOT
   ============================================================ */
.foot {
    border-top: 2px solid var(--pixel-border);
    padding: 24px 6%;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
    background: var(--earth-warm);
    font-family: var(--font-pixel);
    font-size: 10px;
    color: var(--earth-dark);
    letter-spacing: 0.08em;
}

.foot__sep {
    color: var(--retro-amber);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 880px) {
    .hero {
        grid-template-columns: 1fr;
        padding: 14vh 6% 8vh;
        gap: 40px;
    }

    .hero__arrow-wrap {
        padding-left: 0;
    }

    .hero__title-wrap {
        padding-right: 0;
    }

    .hero__quest {
        margin-left: 32px;
    }

    .barriers__inner {
        grid-template-columns: 1fr;
    }

    .barriers .generative {
        grid-column: 1 / 2;
        grid-row: 3 / 4;
        margin: 40px 6% 0;
        max-height: 360px;
    }

    .barrier-list {
        margin-left: 6%;
        margin-right: 6%;
    }

    .section-head--left,
    .section-head--right {
        margin-left: 6%;
        margin-right: 6%;
        text-align: left;
    }

    .solution-list {
        margin-left: 6%;
        margin-right: 6%;
    }

    .solution {
        grid-template-columns: 80px 1fr;
        text-align: left;
    }

    .solution__body {
        order: 2;
    }

    .solution__icon {
        order: 1;
        width: 80px;
        height: 80px;
    }
}

@media (max-width: 520px) {
    .hero__title {
        gap: 6px;
    }

    .hero::before,
    .hero::after {
        font-size: 8px;
    }
}
