/* Kato & Christoph · the invitation gate ("/"): scan the QR code or type the code.
   Taken over unchanged from the first site design (site.css), with the palette and base it needs. */

:root {
    --green: #6E7B5B;
    --green-dark: #4F5A40;
    --rose: #B18B8B;
    --rose-dark: #946F6F;
    --burgundy: #6E201C;   /* the save-the-date card's ink and frame */
    --paper: #E6E4DD;
    --card-ink: #F0EFEC;
    --ink: #2F2F2B;
    --muted: #6F6F68;
    --hair: rgba(47, 47, 43, 0.16);
    --red: #8A2E3B;

    /* Slight (Up Up Creative, self-hosted webfont) is the design's own script */
    --font-display: 'Slight', cursive;
    --font-body: 'Gotham', 'Montserrat', system-ui, sans-serif;
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    /* Long, feathered settle for reveals; a pen-like ease for "ink" writing */
    --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-ink: cubic-bezier(0.45, 0.05, 0.25, 1);

    /* One design pixel. cqi resolves against the nearest .stage-wrap. */
    --u: calc(100cqi / 1024);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* overflow-x: clip forbids sideways panning without creating a scroll
   container (which would break sticky/containment). The green paints the
   iOS rubber-band area above the hero. The page scrollbar is hidden at all
   times; wheel scrolling is eased by site.js instead. */
html {
    overflow-x: clip;
    background: var(--green);
    touch-action: pan-x pan-y;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
/* Section-by-section scrolling (wheel, keys and touch swipes) is driven by
   site.js; no rubber-band or pull-to-refresh bounce between sections. */
html, body { overscroll-behavior-y: none; }

html::-webkit-scrollbar,
body::-webkit-scrollbar { display: none; width: 0; height: 0; }

::selection { background: rgba(177, 139, 139, 0.32); color: inherit; }

/* One continuous sheet of paper behind every section. The tile is mirrored
   2×2 from the design's paper, so it repeats without visible seams. */
body {
    font-family: var(--font-body);
    font-weight: 300;
    color: var(--ink);
    background: var(--paper) url('../images/paper-tile.jpg') top center / 1200px repeat;
    line-height: 1.6;
    letter-spacing: 0.01em;
    overflow-x: clip;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--green-dark); text-decoration: none; }
img { max-width: 100%; display: block; }
.nowrap { white-space: nowrap; }
button { cursor: pointer; }


/* ═══════════════════ INVITATION GATE ("/") ═══════════════════ */
.gate {
    position: relative;
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    background: var(--green);
    color: var(--card-ink);
}

/* Curtain that fades in once a code is accepted. It matches the hero's
   green, so the handover to the invitation reads as one continuous beat. */
.gate-exit {
    position: fixed;
    inset: 0;
    z-index: 900;
    background: var(--green);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.45s ease, visibility 0.45s;
}
.gate-exit.is-on { opacity: 1; visibility: visible; pointer-events: auto; }

.gate-bg { display: none; }

.gate-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: 40px 32px 34px;
    text-align: center;
    color: var(--ink);
    background: var(--paper) url('../images/paper-tile.jpg') center / 1200px;
    rotate: -1.5deg;
    box-shadow: 0 18px 50px rgba(20, 24, 16, 0.28);
    animation: gateIn 1s var(--ease-out-expo) both;
}
@keyframes gateIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: none; }
}
.gate-card > * { rotate: 1.5deg; }

.gate-monogram {
    font-family: var(--font-display);
    font-size: 2rem;
    line-height: 1.1;
    color: var(--green);
}
.gate-monogram span { color: var(--rose); }

.gate-eyebrow {
    margin-top: 4px;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    color: var(--rose-dark);
}

.gate-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 3rem;
    line-height: 1.15;
    color: var(--green);
    margin: 8px 0 10px;
    animation: ink 2.4s var(--ease-ink) 0.5s backwards;
}
.gate-monogram { animation: ink 2s var(--ease-ink) 0.2s backwards; }

/* Same nib-writing reveal as the invitation's script titles */
@keyframes ink {
    from { clip-path: inset(-60% 100% -60% 0%); }
    to   { clip-path: inset(-60% -60% -60% -60%); }
}
@media (prefers-reduced-motion: reduce) {
    .gate-title, .gate-monogram { animation: none; }
}

.gate-lead {
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0 auto 24px;
    max-width: 34ch;
}

.gate-scanner {
    position: relative;
    width: 100%;
    max-width: 300px;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(29, 29, 27, 0.12);
}
.gate-scanner video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease;
}
.gate-scanner.is-live video { opacity: 1; }

.gate-frame { position: absolute; inset: 16px; pointer-events: none; opacity: 0; transition: opacity 0.4s ease; }
.gate-scanner.is-live .gate-frame { opacity: 1; }
.gate-frame span { position: absolute; width: 28px; height: 28px; border: 2px solid rgba(255, 255, 255, 0.95); }
.gate-frame span:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.gate-frame span:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.gate-frame span:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.gate-frame span:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; }

.gate-scanner.is-live::after {
    content: '';
    position: absolute;
    left: 16px;
    right: 16px;
    height: 1px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 10px 1px rgba(255, 255, 255, 0.6);
    animation: gateScan 2.4s ease-in-out infinite;
}
@keyframes gateScan { 0%, 100% { top: 18%; } 50% { top: 82%; } }

.gate-cam-start {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 22px;
    background: none;
    border: none;
    color: var(--green-dark);
    font-family: var(--font-body);
    font-size: 0.88rem;
}
.gate-cam-icon { font-size: 2rem; }

.gate-cam-msg {
    position: relative;
    z-index: 2;
    padding: 20px;
    font-size: 0.85rem;
    color: var(--red);
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}
.gate-cam-retry {
    background: none;
    border: 1px solid var(--green);
    color: var(--green-dark);
    border-radius: 999px;
    padding: 6px 16px;
    font-family: var(--font-body);
    font-size: 0.8rem;
}

.gate-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 22px auto 18px;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--rose-dark);
}
.gate-divider::before,
.gate-divider::after { content: ''; flex: 1; height: 1px; background: rgba(29, 29, 27, 0.15); }

.gate-form { text-align: left; }
.gate-label {
    display: block;
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--rose-dark);
    margin-bottom: 6px;
}
.gate-input-row { display: flex; gap: 8px; }
.gate-input {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
    font-family: var(--font-body);
    font-size: 1rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(29, 29, 27, 0.14);
    border-radius: 2px;
    outline: none;
    transition: border-color 0.25s ease;
}
.gate-input::placeholder { color: #a9a79f; }
.gate-input:focus { border-color: var(--green); }
.gate-input.is-invalid { border-color: var(--red); }

.gate-go {
    flex: 0 0 auto;
    padding: 0 20px;
    font-family: var(--font-body);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--card-ink);
    background: var(--green);
    border: none;
    border-radius: 999px;
    transition: background 0.3s ease;
}
.gate-go:hover:not(:disabled) { background: var(--green-dark); }
.gate-go:disabled { opacity: 0.6; cursor: default; }

.gate-error { margin-top: 10px; font-size: 0.8rem; color: var(--red); }

@media (max-width: 420px) {
    .gate-card { padding: 32px 22px 26px; }
}

/* The couple's portal, out of the way at the foot of the gate */
.gate-admin {
    position: absolute;
    bottom: 14px;
    left: 50%;
    translate: -50% 0;
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--card-ink);
    opacity: 0.45;
    transition: opacity 0.2s;
}
.gate-admin:hover, .gate-admin:focus-visible { opacity: 0.9; }
