/* ── Variables ── */
:root {
    --color-bg: #DDE0F0;
    --color-white: #FFFFFF;
    --color-black: #000000;
    --font-primary: "Orator Std", "Orator", monospace;
    --font-size-base: 13px;
    --font-size-small: 13px;
    --font-size-tiny: 10px;
    --letter-spacing-base: 0.1em;
    --letter-spacing-wide: 0.15em;
    --header-top: 40px;
    --header-left: 40px;
    --r2: "https://pub-3d823ba964c34faeab4d84e0106c851f.r2.dev";
}

/* ── Font — self-hosted from R2, Typekit as fallback ── */
@font-face {
    font-family: "Orator Std";
    src: url("https://pub-3d823ba964c34faeab4d84e0106c851f.r2.dev/OratorStd.otf") format("opentype");
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; }
a, [style*="text-decoration: underline"], .po-address, #soundLabel, #enterContainer .title {
    text-underline-offset: 4px;
}

body {
    margin: 0; padding: 0;
    background-color: var(--color-bg);
    font-family: var(--font-primary);
    display: flex; justify-content: center; align-items: center;
    height: 100vh; width: 100vw; overflow: hidden; color: var(--color-black);
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.5s ease;
}
body.white-bg { background-color: var(--color-white) !important; }
body.hide-cursor { cursor: none !important; }

/* ── Header ── */
.header-left {
    position: fixed; top: var(--header-top); left: var(--header-left);
    font-size: var(--font-size-base); letter-spacing: var(--letter-spacing-base);
    z-index: 20; text-decoration: none; color: inherit; cursor: default;
}
.header-right-video {
    position: fixed; top: 30px; right: var(--header-left);
    width: 50px; min-width: 50px; height: auto; z-index: 10;
}

/* ── Loading ── */
#loadingScreen {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--color-bg);
    z-index: 100;
    font-size: var(--font-size-base); letter-spacing: var(--letter-spacing-base);
    text-transform: uppercase;
    transition: opacity 0.4s ease;
}
#loadingScreen.hidden { opacity: 0; pointer-events: none; }

/* ── Signup form ── */
#inputContainer {
    text-align: left; display: none;
    margin: 0 auto; z-index: 15;
}
.title {
    font-size: var(--font-size-small); letter-spacing: 0.05em;
    margin-bottom: 12px; text-transform: uppercase;
    text-align: center;
    white-space: nowrap;
    overflow: visible;
}
@media (max-width: 900px) {
    .title { white-space: normal; }
}
.title-br { display: none; }
@media (max-width: 430px) {
    .title-br { display: inline; }
}
.form-group { display: flex; flex-direction: column; gap: 10px; width: 100%; }
@media (min-width: 650px) { .form-group { flex-direction: row; width: 100%; } }
.input-row { display: flex; gap: 10px; width: 100%; }
input {
    background: var(--color-white); border: none;
    padding: 13px 15px 8px;
    flex: 1;
    min-width: 0;
    font-family: inherit; font-size: var(--font-size-small);
    outline: none; text-transform: uppercase; color: var(--color-black);
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
}
input::placeholder { color: var(--color-black) !important; opacity: 1; text-transform: uppercase; }
input.invalid::placeholder { color: #cc0000 !important; }
button:not(#muteBtn) {
    background: var(--color-black); color: var(--color-white); border: none;
    padding: 13px 30px 8px;
    font-family: inherit; font-size: var(--font-size-small);
    cursor: pointer; font-weight: normal; letter-spacing: var(--letter-spacing-base);
    transition: background 0.2s ease, color 0.2s ease; outline: none;
    -webkit-font-smoothing: antialiased;
    appearance: none;
    -webkit-appearance: none;
}
button:not(#muteBtn):hover { background: var(--color-white); color: var(--color-black); font-weight: normal !important; font-synthesis: none; }
button:not(#muteBtn):disabled { opacity: 0.5; cursor: not-allowed; }
#errorMsg {
    font-size: var(--font-size-tiny); letter-spacing: 0.05em;
    text-transform: uppercase; margin-top: 8px;
    color: var(--color-black); min-height: 14px;
}
@media (max-width: 649px) { input, .input-row { width: 100%; } }

/* ── Legal copy ── */
#legalCopy {
    position: fixed; bottom: 24px; left: 0; right: 0;
    text-align: center; padding: 0 40px;
    font-size: var(--font-size-base); letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--color-black); opacity: 1;
    font-family: inherit; display: none;
}

/* ── Enter screen ── */
#enterContainer {
    display: none; position: fixed; top: 0; left: 0;
    width: 100%; height: 100%; cursor: pointer; z-index: 15;
}
#enterContainer .title {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-decoration: underline;
    padding-bottom: 2px;
    white-space: nowrap;
}
#enterContainer .title:hover { color: var(--color-black); text-decoration: none; }

/* ── Custom cursor ── */
#textCursor {
    position: fixed; top: 0; left: 0; z-index: 1000;
    pointer-events: none;
    font-family: var(--font-primary);
    font-size: var(--font-size-base); letter-spacing: var(--letter-spacing-base); color: var(--color-black);
    opacity: 0; visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    transform: translate(15px, 15px);
}
#textCursor.visible { opacity: 1; visibility: visible; }

/* ── Video container ── */
#mainVideoContainer {
    display: none;
    width: 100vw;
    height: 100vh;
    z-index: 5;
    opacity: 0;
    transition: opacity 1s ease;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
}
#mainVideoContainer video {
    width: 80%;
    max-width: 1000px;
    max-height: 70vh;
    height: auto;
    display: block;
}
@media (max-width: 430px) {
    #mainVideoContainer video {
        max-height: 65vh;
    }
}

/* Sound button */
#muteBtn {
    display: none;
    background: none;
    border: none;
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    letter-spacing: var(--letter-spacing-base);
    text-transform: uppercase;
    cursor: pointer;
    color: var(--color-black);
    padding: 0;
    margin-top: 24px;
    font-weight: normal;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
#muteBtn:hover { color: var(--color-black); }
#soundLabel { text-decoration: underline; }
#muteBtn:hover #soundLabel { text-decoration: none; }



/* PO address — fixed bottom */
.po-address {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: var(--font-size-base); letter-spacing: 0.05em; text-transform: uppercase;
    text-align: center;
    cursor: pointer;
    white-space: nowrap;
    display: none;
    z-index: 10;
}
.po-address:hover { opacity: 0.6; }


/* ═══════════════════════════════════════
   MOBILE — 768px (tablet and below)
═══════════════════════════════════════ */
@media (max-width: 768px) {

    /* Header */
    .header-left {
        top: 20px; left: 20px;
        font-size: var(--font-size-base);
    }
    .header-right-video {
        top: 16px; right: 20px;
    }

    /* Legal */
    #legalCopy {
        font-size: var(--font-size-base);
        padding: 0 20px;
        line-height: 1.6;
        text-align: center;
        bottom: 16px;
    }

    /* Form */
    #inputContainer { width: 85%; }

    /* Video */
    #mainVideoContainer video {
        width: 92%;
    }

    /* Notes */
    #sectionNotes { padding: 80px 0; }
    .po-address { margin-top: 40px; }

    /* Enter */
    .enter-halftone {
        width: 50%;
        right: 0; bottom: 0;
    }
}

/* ═══════════════════════════════════════
   MOBILE — 430px (phones)
═══════════════════════════════════════ */
@media (max-width: 430px) {

    /* Header — fixed stays but smaller */
    .header-left { top: 16px; left: 16px; }
    .header-right-video { top: 12px; right: 16px; }

    /* Form — stack inputs */
    #inputContainer { width: 100%; padding: 0 20px; box-sizing: border-box; }
    .form-group { flex-direction: column !important; }
    .input-row { flex-direction: column; }
    input { width: 100% !important; }
    button:not(#muteBtn) { width: 100%; }
    .input-row { gap: 8px; }

    /* Video — full width */
    #mainVideoContainer video { width: 100%; max-width: none; }


    /* Notes */
    #sectionNotes { padding: 48px 0 60px; }
    .po-address { bottom: 16px; white-space: normal; width: 100%; transform: none; left: 0; padding: 0 20px; }
    .po-break::after { content: '\A'; white-space: pre; }
    /* Hide the single-line redaction spans on mobile */
    .po-address > .r1,
    .po-address > .r2,
    .po-address > .r3 { display: none; }

    /* Enter — see mobile fix block below */
}

/* Desktop/mobile address visibility */
.mobile-addr { display: none; }
.desktop-addr { display: inline; }
@media (max-width: 430px) {
    .mobile-addr { display: inline-block; }
    .desktop-addr { display: none; }
}

/* Prevent iOS auto-zoom on input focus */
@media (max-width: 768px) {
    input, button, select, textarea {
        font-size: 16px !important;
    }
    /* Sound toggle exempt from 16px rule */
    #muteBtn {
        font-size: var(--font-size-base) !important;
    }
    /* Restore equal padding on mobile — font is 16px so centering works naturally */
    input { padding: 13px 15px !important; }
    button:not(#muteBtn) { padding: 13px 30px !important; }
}

/* ── Copy tooltip ── */
#copyTooltip {
    position: fixed;
    bottom: 80px;
    left: 0;
    right: 0;
    margin: 0 auto;
    width: fit-content;
    font-family: var(--font-primary);
    font-size: 13px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-align: center;
    color: var(--color-black);
    background: var(--color-white);
    border: 1px solid var(--color-black);
    padding: 0 16px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    white-space: nowrap;
}
#copyTooltip.visible { opacity: 1; }

/* ── Mobile Enter section fix ── */
@media (max-width: 430px) {
    #sectionEnter {
        flex-direction: column !important;
        justify-content: flex-end !important;
        align-items: center !important;
        padding: 0 !important;
        min-height: 70vh;
    }
    #sectionEnter .enter-text {
        order: 1;
        position: relative !important;
        bottom: auto !important;
        right: auto !important;
        padding: 40px 0 32px;
        text-decoration: underline;
    }
    #sectionEnter .enter-text::after { display: none; }
    .enter-halftone {
        order: 2;
        position: relative !important;
        width: 100% !important;
        max-width: none !important;
        bottom: auto !important;
        right: auto !important;
        display: block;
        opacity: 1 !important;
    }
}
