/* ============================================================
   sarampass.com — Thresholds of Passage
   Split-screen passport / passage experience.
   Palette:
     Document Ivory   #EDE8D8   Left panel ground
     Concrete Grey    #2A2A2E   Right panel ground
     Stamp Red        #C23B22   Visa stamps, accents
     Stamp Blue       #1B4B7A   Annotations, links
     Transit Violet   #6B5B8A   Liminal accents
     Ink Black        #0A0A0A   Document text
     Passage Cream    #E8E0D0   Right panel body text
     Foil Bronze      #B8956A   Borders, embossed
   Fonts:
     Oswald (stamps / labels)
     Merriweather (narrative body)
     Indie Flower (handwritten annotations)
   ============================================================ */

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

html, body {
    height: 100%;
    background: #2A2A2E;
    color: #E8E0D0;
    font-family: "Merriweather", Georgia, serif;
    font-weight: 400;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body {
    min-height: 100vh;
}

/* ============================================================
   PRIMARY GRID — Document (40%) + Passage (60%)
   ============================================================ */
.passport {
    display: grid;
    grid-template-columns: 40% 60%;
    width: 100%;
    min-height: 100vh;
    position: relative;
}

/* ============================================================
   LEFT PANEL — THE DOCUMENT
   ============================================================ */
.document {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    overflow: hidden;
    background: #EDE8D8;
    color: #0A0A0A;
    border-right: 1px solid rgba(10, 10, 10, 0.18);
    box-shadow: inset -18px 0 36px -24px rgba(10, 10, 10, 0.45),
                4px 0 24px -8px rgba(10, 10, 10, 0.55);
    padding: 36px 38px 28px 38px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    z-index: 2;
}

/* Subtle warm vignette to suggest aged paper */
.document::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(120% 100% at 100% 0%, rgba(184, 149, 106, 0.10), transparent 55%),
        radial-gradient(120% 100% at 0% 100%, rgba(194, 59, 34, 0.07), transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* Security micropattern overlay */
.document-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.18;
    pointer-events: none;
    z-index: 0;
    mix-blend-mode: multiply;
}

.document-pattern svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Faint horizontal "ribbon" edges across the document */
.document-edge {
    position: absolute;
    left: 0;
    right: 0;
    height: 6px;
    pointer-events: none;
    z-index: 1;
    background: repeating-linear-gradient(
        90deg,
        rgba(184, 149, 106, 0.45) 0 6px,
        transparent 6px 14px
    );
}

.document-edge-top { top: 0; }
.document-edge-bottom { bottom: 0; }

/* All direct children sit above the pattern */
.document > header,
.document > section,
.document > footer,
.document-stamps,
.document-annotations {
    position: relative;
    z-index: 2;
}

/* --- Document Header (issuer / title / meta) --- */
.document-header {
    border: 1.5px solid #0A0A0A;
    padding: 14px 16px 16px 16px;
    background: rgba(237, 232, 216, 0.5);
    backdrop-filter: blur(0.5px);
}

.doc-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    font-family: "Oswald", "Arial Narrow", Arial, sans-serif;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.doc-row-top {
    font-size: 11px;
    color: #1B4B7A;
    border-bottom: 1px dashed rgba(10, 10, 10, 0.4);
    padding-bottom: 8px;
    margin-bottom: 12px;
}

.doc-issuer { color: #C23B22; }
.doc-type { color: #0A0A0A; opacity: 0.85; }

.doc-title {
    font-family: "Oswald", "Arial Narrow", Arial, sans-serif;
    font-weight: 600;
    font-size: clamp(34px, 3.6vw, 52px);
    letter-spacing: 0.04em;
    line-height: 1;
    color: #0A0A0A;
    margin-bottom: 14px;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.doc-title-sub {
    font-size: 0.42em;
    letter-spacing: 0.32em;
    color: #C23B22;
    transform: translateY(-0.3em);
}

.doc-row-meta {
    font-size: 10px;
    color: #0A0A0A;
    opacity: 0.85;
    margin-top: 4px;
}

.doc-meta-label { color: #1B4B7A; }
.doc-meta-value { font-variant-numeric: tabular-nums; }

/* --- Portrait section --- */
.document-portrait {
    display: flex;
    gap: 16px;
    align-items: stretch;
}

.portrait-frame {
    position: relative;
    width: 96px;
    height: 120px;
    border: 1.5px solid #0A0A0A;
    background:
        linear-gradient(180deg, rgba(237, 232, 216, 0.0) 0%, rgba(184, 149, 106, 0.10) 100%),
        #EDE8D8;
    flex-shrink: 0;
}

.portrait-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.portrait-corner {
    position: absolute;
    width: 8px;
    height: 8px;
    border: 1.5px solid #C23B22;
}
.portrait-corner-tl { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.portrait-corner-tr { top: -1px; right: -1px; border-left: none; border-bottom: none; }
.portrait-corner-bl { bottom: -1px; left: -1px; border-right: none; border-top: none; }
.portrait-corner-br { bottom: -1px; right: -1px; border-left: none; border-top: none; }

.portrait-caption {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 6px;
    padding-bottom: 4px;
    flex: 1;
}

.caption-label {
    font-family: "Oswald", "Arial Narrow", Arial, sans-serif;
    font-weight: 500;
    font-size: 10px;
    letter-spacing: 0.22em;
    color: #1B4B7A;
    text-transform: uppercase;
}

.caption-value {
    font-family: "Oswald", "Arial Narrow", Arial, sans-serif;
    font-weight: 500;
    font-size: 16px;
    letter-spacing: 0.18em;
    color: #0A0A0A;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(10, 10, 10, 0.4);
    padding-bottom: 4px;
}

/* --- Progress block --- */
.document-progress {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-family: "Oswald", "Arial Narrow", Arial, sans-serif;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.progress-label {
    font-size: 10px;
    color: #1B4B7A;
}

.progress-value {
    font-size: 14px;
    color: #C23B22;
    font-variant-numeric: tabular-nums;
}

.progress-track {
    height: 4px;
    background: rgba(10, 10, 10, 0.12);
    border: 1px solid rgba(10, 10, 10, 0.5);
    position: relative;
    overflow: hidden;
}

.progress-fill {
    position: absolute;
    inset: 0 100% 0 0;
    background: repeating-linear-gradient(
        90deg,
        #C23B22 0 6px,
        #1B4B7A 6px 12px
    );
    transition: right 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* --- Stamp accumulation surface --- */
.document-stamps {
    position: absolute;
    inset: 168px 24px 96px 24px;
    pointer-events: none;
    z-index: 3;
}

@keyframes stamp-appear {
    0% {
        transform: var(--stamp-rotate, rotate(0deg)) scale(1.6);
        opacity: 0;
        filter: blur(2px);
    }
    60% {
        transform: var(--stamp-rotate, rotate(0deg)) scale(0.94);
        opacity: 1;
        filter: blur(0);
    }
    100% {
        transform: var(--stamp-rotate, rotate(0deg)) scale(1);
        opacity: var(--stamp-opacity, 0.85);
        filter: blur(0);
    }
}

.visa-stamp {
    position: absolute;
    border: 2.4px solid #C23B22;
    border-radius: 4px;
    padding: 8px 12px 9px 12px;
    background: rgba(237, 232, 216, 0.05);
    color: #C23B22;
    font-family: "Oswald", "Arial Narrow", Arial, sans-serif;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    line-height: 1.05;
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: inset 0 0 0 1px rgba(194, 59, 34, 0.3);
    animation: stamp-appear 0.5s cubic-bezier(0.18, 0.9, 0.3, 1.05) forwards;
    /* opacity & transform are driven by inline custom props */
    opacity: 0;
}

.visa-stamp.is-blue {
    border-color: #1B4B7A;
    color: #1B4B7A;
    box-shadow: inset 0 0 0 1px rgba(27, 75, 122, 0.3);
}

.visa-stamp::before {
    content: "";
    position: absolute;
    inset: 3px;
    border: 1px solid currentColor;
    border-radius: 2px;
    opacity: 0.55;
    pointer-events: none;
}

.visa-stamp .stamp-line-1 {
    display: block;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.18em;
}

.visa-stamp .stamp-line-2 {
    display: block;
    font-size: 9px;
    margin-top: 4px;
    letter-spacing: 0.22em;
    opacity: 0.85;
}

.visa-stamp .stamp-line-3 {
    display: block;
    font-size: 9px;
    margin-top: 2px;
    letter-spacing: 0.22em;
    opacity: 0.7;
}

/* --- Margin annotations (handwritten) --- */
.document-annotations {
    position: absolute;
    inset: 168px 18px 92px 18px;
    pointer-events: none;
    z-index: 4;
}

@keyframes annotation-appear {
    from { opacity: 0; transform: translateY(6px) rotate(var(--note-rotate, 0deg)); }
    to { opacity: 0.5; transform: translateY(0) rotate(var(--note-rotate, 0deg)); }
}

.annotation {
    position: absolute;
    font-family: "Indie Flower", "Comic Sans MS", cursive;
    font-size: 14px;
    color: #1B4B7A;
    opacity: 0;
    line-height: 1.25;
    max-width: 160px;
    animation: annotation-appear 0.6s ease-out 0.15s forwards;
}

/* --- MRZ footer --- */
.document-footer {
    margin-top: auto;
    border-top: 1.5px solid #0A0A0A;
    padding-top: 10px;
}

.mrz {
    font-family: "Courier New", "Lucida Console", monospace;
    font-size: 11px;
    line-height: 1.55;
    color: #0A0A0A;
    letter-spacing: 0.06em;
    word-break: break-all;
    overflow: hidden;
    white-space: nowrap;
}

.mrz-line {
    overflow: hidden;
    text-overflow: clip;
}

/* ============================================================
   RIGHT PANEL — THE PASSAGE
   ============================================================ */
.passage {
    position: relative;
    background: #2A2A2E;
    color: #E8E0D0;
    z-index: 1;
}

/* Concrete-noise overlay (constant) */
.concrete-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.55;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='7'/><feColorMatrix values='0 0 0 0 0.16 0 0 0 0 0.16 0 0 0 0 0.18 0 0 0 0.55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.8'/></svg>");
    mix-blend-mode: overlay;
}

/* --- Threshold sections --- */
.threshold {
    position: relative;
    min-height: 100vh;
    padding: 110px 9% 110px 9%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    z-index: 2;
}

/* Atmospheric color bleed (per-threshold radial gradient) */
.threshold::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(
        80% 60% at 70% 40%,
        color-mix(in srgb, var(--accent, #B8956A) 14%, transparent) 0%,
        transparent 70%
    );
    opacity: 0.55;
    z-index: 0;
}

/* Fallback for browsers without color-mix: layered explicit accents */
.threshold-one::before { background: radial-gradient(80% 60% at 70% 40%, rgba(184, 149, 106, 0.16), transparent 70%); }
.threshold-two::before { background: radial-gradient(80% 60% at 30% 50%, rgba(107, 91, 138, 0.22), transparent 70%); }
.threshold-three::before { background: radial-gradient(80% 60% at 70% 40%, rgba(194, 59, 34, 0.18), transparent 70%); }
.threshold-four::before { background: radial-gradient(80% 60% at 30% 60%, rgba(27, 75, 122, 0.22), transparent 70%); }
.threshold-five::before { background: radial-gradient(80% 60% at 70% 40%, rgba(184, 149, 106, 0.18), transparent 70%); }
.threshold-zero::before { background: radial-gradient(80% 60% at 50% 30%, rgba(184, 149, 106, 0.10), transparent 75%); }
.threshold-colophon::before { background: radial-gradient(80% 60% at 50% 50%, rgba(184, 149, 106, 0.08), transparent 75%); }

.threshold > * {
    position: relative;
    z-index: 2;
}

/* Section divider line at top */
.threshold + .threshold {
    border-top: 1px solid rgba(232, 224, 208, 0.08);
}

/* Threshold marker (numeral + dashed line + label) */
.threshold-marker {
    margin-bottom: 56px;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 28px;
    align-items: center;
}

.threshold-numeral {
    grid-row: 1 / span 2;
    font-family: "Oswald", "Arial Narrow", Arial, sans-serif;
    font-weight: 500;
    font-size: 96px;
    line-height: 0.85;
    letter-spacing: 0.06em;
    color: #6B5B8A;
    opacity: 0.32;
    text-transform: uppercase;
}

.threshold-numeral-end {
    font-size: 56px;
    color: #B8956A;
    opacity: 0.55;
}

.threshold-rule {
    grid-column: 2;
    grid-row: 1;
    width: 60%;
    max-width: 460px;
    height: 2px;
    display: block;
}

.threshold-label {
    grid-column: 2;
    grid-row: 2;
    margin-top: 10px;
    font-family: "Oswald", "Arial Narrow", Arial, sans-serif;
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: #C23B22;
}

.threshold-two .threshold-label,
.threshold-four .threshold-label {
    color: #1B4B7A;
}

.threshold-two .threshold-numeral { color: #6B5B8A; }
.threshold-three .threshold-numeral { color: #C23B22; opacity: 0.30; }
.threshold-four .threshold-numeral { color: #1B4B7A; opacity: 0.32; }
.threshold-five .threshold-numeral { color: #B8956A; opacity: 0.36; }

/* Threshold body content */
.threshold-body {
    max-width: 640px;
}

.threshold-title {
    font-family: "Merriweather", Georgia, serif;
    font-weight: 700;
    font-size: clamp(26px, 2.6vw, 38px);
    line-height: 1.25;
    color: #EDE8D8;
    margin-bottom: 28px;
    letter-spacing: -0.005em;
}

.lead {
    font-family: "Merriweather", Georgia, serif;
    font-weight: 300;
    font-size: clamp(20px, 1.5vw, 24px);
    line-height: 1.65;
    color: #EDE8D8;
    margin-bottom: 22px;
    max-width: 640px;
}

.body {
    font-size: 18px;
    line-height: 1.75;
    color: #E8E0D0;
    margin-bottom: 18px;
    font-weight: 400;
    max-width: 640px;
}

.threshold-three .body,
.threshold-three .threshold-title {
    color: #EDE8D8;
}

/* Detail rows (key/value bureaucratic data) */
.threshold-detail {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 24px;
    padding: 14px 0;
    border-bottom: 1px dashed rgba(232, 224, 208, 0.18);
    align-items: baseline;
}

.threshold-detail:first-of-type {
    border-top: 1px dashed rgba(232, 224, 208, 0.18);
    margin-top: 36px;
}

.detail-key {
    font-family: "Oswald", "Arial Narrow", Arial, sans-serif;
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: #B8956A;
}

.detail-val {
    font-family: "Merriweather", Georgia, serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.5;
    color: #E8E0D0;
}

/* Threshold-zero: scroll cue */
.scroll-cue {
    margin-top: 56px;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    font-family: "Oswald", "Arial Narrow", Arial, sans-serif;
    font-weight: 500;
    color: #B8956A;
    letter-spacing: 0.32em;
    font-size: 12px;
    text-transform: uppercase;
}

.scroll-cue-arrow {
    font-size: 14px;
    animation: scroll-cue-bob 1.8s ease-in-out infinite;
}

@keyframes scroll-cue-bob {
    0%, 100% { transform: translateY(0); opacity: 0.55; }
    50% { transform: translateY(6px); opacity: 1; }
}

/* Colophon */
.threshold-colophon {
    min-height: 50vh;
    text-align: center;
    align-items: center;
}

.threshold-colophon .threshold-marker {
    grid-template-columns: auto;
    justify-content: center;
    text-align: center;
}

.threshold-colophon .threshold-numeral {
    grid-row: auto;
}

.colophon {
    font-family: "Oswald", "Arial Narrow", Arial, sans-serif;
    font-weight: 400;
    font-size: 13px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: #B8956A;
    line-height: 2;
}

/* Reveal animation for threshold body */
.threshold-body {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.threshold.is-active .threshold-body,
.threshold-zero .threshold-body {
    opacity: 1;
    transform: translateY(0);
}

.threshold-zero .threshold-body { /* always visible */ }

/* Threshold marker fade-in */
.threshold-marker {
    opacity: 0;
    transform: translateX(-12px);
    transition: opacity 0.7s ease 0.1s, transform 0.7s ease 0.1s;
}

.threshold.is-active .threshold-marker,
.threshold-zero .threshold-marker {
    opacity: 1;
    transform: translateX(0);
}

/* ============================================================
   MOBILE STRIP (hidden on desktop)
   ============================================================ */
.mobile-strip {
    display: none;
}

/* ============================================================
   RESPONSIVE — Below 768px: collapse to single column.
   The document becomes a fixed 60px header strip; the passage
   is the only scrollable content.
   ============================================================ */
@media (max-width: 768px) {
    .passport {
        display: block;
    }

    .document {
        display: none;
    }

    .passage {
        padding-top: 60px;
    }

    .threshold {
        padding: 90px 22px 90px 22px;
        min-height: 100vh;
    }

    .threshold-marker {
        margin-bottom: 36px;
        column-gap: 16px;
    }

    .threshold-numeral {
        font-size: 64px;
    }

    .threshold-rule {
        width: 70%;
    }

    .threshold-detail {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .mobile-strip {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: #EDE8D8;
        color: #0A0A0A;
        align-items: center;
        justify-content: space-between;
        padding: 0 18px;
        z-index: 100;
        border-bottom: 2px solid #0A0A0A;
        box-shadow: 0 4px 18px -10px rgba(0, 0, 0, 0.5);
    }

    .mobile-strip-label {
        font-family: "Oswald", "Arial Narrow", Arial, sans-serif;
        font-weight: 600;
        font-size: 18px;
        letter-spacing: 0.16em;
        color: #C23B22;
        text-transform: uppercase;
    }

    .mobile-strip-counter {
        font-family: "Oswald", "Arial Narrow", Arial, sans-serif;
        font-weight: 500;
        font-size: 12px;
        letter-spacing: 0.22em;
        color: #1B4B7A;
        text-transform: uppercase;
    }
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .visa-stamp { animation-duration: 0.01s; }
    .annotation { animation-duration: 0.01s; }
    .scroll-cue-arrow { animation: none; }
    .threshold-body, .threshold-marker {
        transition-duration: 0.01s;
    }
}
