/* Event RSVP: the public guest-response pages, in the Expeed Connect "Calm" theme.
   A misty canvas with white islands, soft shadows, a deep teal accent, Lexend for headings and Public Sans for text.
   The tokens mirror ExpeedConnect.Admin/wwwroot/css/bootstrap-overrides.css (this site doesn't share Admin's assets),
   so keep the two in step.
   Most guests open their invitation on a phone, so the layout is one column first: controls are at least 44px tall,
   inputs are 16px so iOS doesn't zoom on focus, and the gutters respect the safe-area insets. */
:root {
    --canvas: #D8DFE7;
    --surface: #FFFFFF;
    --surface-2: #EBEFF4;
    --surface-3: #E2E8EE;
    --ink: #14212E;
    --ink-2: #4D5B6A;
    --ink-3: #606D7B;
    --line: #D3DAE2;
    --line-strong: #C3CDD6;
    --accent: #136F8A;
    --accent-strong: #0C5469;
    --accent-soft: #DCEFF4;
    --on-accent: #FFFFFF;
    --good: #1B7A52;
    --good-soft: #DCF1E6;
    --warn: #9A5F0C;
    --warn-soft: #FAEED8;
    --bad: #B8352F;
    --bad-soft: #FAE3E1;
    --focus-ring: 0 0 0 3px rgb(19 111 138 / .22);
    --shadow: 0 0 0 1px rgb(20 33 46 / .06), 0 1px 3px rgb(20 33 46 / .08), 0 6px 22px rgb(20 33 46 / .09);
    --shadow-pop: 0 2px 6px rgb(20 33 46 / .08), 0 22px 56px rgb(20 33 46 / .18);
    --scrim: rgb(12 20 30 / .42);
    --font-display: "Lexend", "Segoe UI", system-ui, sans-serif;
    --font-body: "Public Sans", "Segoe UI", system-ui, sans-serif;
    --r-island: 22px;
    --r-card: 16px;
    --r-ctl: 12px;
    --gutter: max(16px, env(safe-area-inset-left, 0px));
    --gutter-r: max(16px, env(safe-area-inset-right, 0px));

    --bs-body-bg: var(--canvas);
    --bs-body-color: var(--ink);
    --bs-body-font-family: var(--font-body);
    --bs-link-color: var(--accent);
    --bs-link-hover-color: var(--accent-strong);
}

/* ---- Base --------------------------------------------------------------------------------------------------- */
html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--ink);
    background-color: var(--canvas);
    -webkit-text-size-adjust: 100%;
}

h1, h2, h3 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -.01em;
    color: var(--ink);
}

    /* FocusOnNavigate moves focus to the page's h1 for screen readers; it isn't a control, so no ring */
    h1:focus {
        outline: none;
    }

a {
    color: var(--accent);
}

    a:hover {
        color: var(--accent-strong);
    }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

::selection {
    background-color: var(--accent-soft);
}

/* ---- Page shell: one centred column of islands on the canvas -------------------------------------------------- */
.rsvp-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px var(--gutter-r) max(16px, env(safe-area-inset-bottom, 0px)) var(--gutter);
}

    .rsvp-page main {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 14px;
        width: 100%;
        max-width: 760px;
        margin: 0 auto;
    }

.rsvp-island {
    background-color: var(--surface);
    border-radius: var(--r-island);
    box-shadow: var(--shadow);
}

.rsvp-footer {
    padding: 4px 0;
    text-align: center;
    font-size: .8125rem;
    color: var(--ink-3);
}

/* ---- Event header: club logo, event name and the when / where / RSVP-by facts ------------------------------------ */
.rsvp-banner {
    padding: 20px 22px;
}

.rsvp-banner-head {
    display: flex;
    align-items: center;
    gap: 16px;
}

.rsvp-banner-logo {
    flex: none;
    width: auto;
    height: auto;
    max-width: 140px;
    max-height: 60px;
    object-fit: contain;
}

.rsvp-banner-text {
    min-width: 0;
}

.rsvp-banner-eyebrow {
    margin: 0 0 2px;
    font-family: var(--font-display);
    font-size: .75rem;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--accent);
}

.rsvp-banner-title {
    font-size: clamp(1.25rem, 1rem + 1.6vw, 1.75rem);
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.rsvp-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px 24px;
    margin: 16px 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

    .rsvp-facts dt {
        font-family: var(--font-display);
        font-size: .8125rem;
        font-weight: 500;
        color: var(--ink-3);
    }

    .rsvp-facts dd {
        margin: 0;
        overflow-wrap: anywhere;
    }

/* ---- The response form -------------------------------------------------------------------------------------- */
.rsvp-card {
    padding: 20px 22px;
}

.rsvp-card-title {
    font-size: 1.2rem;
}

.rsvp-card-lead {
    margin: 4px 0 0;
    font-size: .9375rem;
    color: var(--ink-2);
}

/* One tinted panel per guest. A single column on a phone; from 640px the name sits beside the attending choice and
   dietary beside comments. */
.rsvp-guest {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px 16px;
    margin-top: 16px;
    padding: 16px;
    background-color: var(--surface-2);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-card);
}

.rsvp-guest-heading {
    font-family: var(--font-display);
    font-size: .8125rem;
    font-weight: 500;
    color: var(--ink-3);
}

.rsvp-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

/* Also the attending fieldset's legend, so Bootstrap's legend float, size and margin are undone */
.rsvp-label {
    float: none;
    width: auto;
    margin: 0;
    padding: 0;
    font-family: var(--font-display);
    font-size: .8125rem;
    font-weight: 500;
    line-height: 1.5;
    color: var(--ink-2);
}

.rsvp-input {
    width: 100%;
    min-height: 44px;
    padding: .55rem .8rem;
    font: inherit;
    font-size: 1rem;
    color: var(--ink);
    background-color: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-ctl);
    appearance: none;
    transition: border-color .15s, box-shadow .15s;
}

    .rsvp-input:focus {
        outline: none;
        border-color: var(--accent);
        box-shadow: var(--focus-ring);
    }

textarea.rsvp-input {
    min-height: 68px;
    resize: vertical;
}

/* Attending? Yes / No: two radios drawn as pills. The inputs stay in the tab order (only hidden visually), and
   the chosen pill takes the good or bad tint plus a filled dot, so the choice doesn't rest on colour alone. */
.rsvp-choice {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.rsvp-choice-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.rsvp-choice-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: .4rem .75rem;
    font-size: .9375rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    color: var(--ink);
    background-color: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}

    .rsvp-choice-btn::before {
        content: "";
        flex: none;
        width: 14px;
        height: 14px;
        border: 2px solid var(--ink-3);
        border-radius: 50%;
        background-color: var(--surface);
    }

    .rsvp-choice-btn:hover {
        border-color: var(--ink-3);
    }

.rsvp-choice-input:focus-visible + .rsvp-choice-btn {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

.rsvp-choice-input:checked + .rsvp-choice-btn::before {
    border-color: currentColor;
    background-color: currentColor;
    box-shadow: inset 0 0 0 2px var(--surface);
}

.rsvp-choice-input:checked + .rsvp-choice-btn.yes {
    color: var(--good);
    background-color: var(--good-soft);
    border-color: var(--good);
}

.rsvp-choice-input:checked + .rsvp-choice-btn.no {
    color: var(--bad);
    background-color: var(--bad-soft);
    border-color: var(--bad);
}

.rsvp-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
}

/* The Admin primary button: an accent pill */
.rsvp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 48px;
    padding: .6rem 1.75rem;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 700;
    color: var(--on-accent);
    background-color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 999px;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, box-shadow .15s;
}

    .rsvp-btn:hover, .rsvp-btn:active {
        background-color: var(--accent-strong);
        border-color: var(--accent-strong);
    }

    .rsvp-btn:focus-visible {
        outline: none;
        box-shadow: var(--focus-ring);
    }

    .rsvp-btn:disabled {
        opacity: .55;
        cursor: default;
    }

/* ---- Message cards: thank you, already responded, deadline passed, bad link, error ----------------------------- */
.rsvp-status {
    padding: 36px 28px;
    text-align: center;
}

    /* A message with no event header above it (bad link, error) sits in the middle of the page */
    .rsvp-status.solo {
        width: 100%;
        max-width: 520px;
        margin: auto;
    }

.rsvp-status-icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 50%;
    color: var(--ink-2);
    background-color: var(--surface-3);
}

    .rsvp-status-icon.good {
        color: var(--good);
        background-color: var(--good-soft);
    }

    .rsvp-status-icon.warn {
        color: var(--warn);
        background-color: var(--warn-soft);
    }

    .rsvp-status-icon.bad {
        color: var(--bad);
        background-color: var(--bad-soft);
    }

.rsvp-status-title {
    margin: 0 0 8px;
    font-size: 1.4rem;
    line-height: 1.25;
}

.rsvp-status-body {
    max-width: 46ch;
    margin: 0 auto 8px;
    color: var(--ink-2);
    overflow-wrap: anywhere;
}

    .rsvp-status-body:last-child {
        margin-bottom: 0;
    }

.rsvp-status-ref {
    margin: 20px 0 0;
    font-family: ui-monospace, Consolas, monospace;
    font-size: .8125rem;
    color: var(--ink-3);
    overflow-wrap: anywhere;
}

.rsvp-contact {
    max-width: 420px;
    margin: 20px auto 0;
    padding: 16px;
    text-align: left;
    background-color: var(--surface-2);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-card);
}

    .rsvp-contact h3 {
        margin: 0 0 6px;
        font-size: .8125rem;
        font-weight: 500;
        letter-spacing: 0;
        color: var(--ink-2);
    }

    .rsvp-contact p {
        margin: 2px 0;
        overflow-wrap: anywhere;
    }

    .rsvp-contact .rsvp-contact-note {
        margin-top: 10px;
        font-size: .875rem;
        color: var(--ink-3);
    }

/* ---- Loading ------------------------------------------------------------------------------------------------ */
.rsvp-loading {
    flex: 1;
    display: grid;
    place-items: center;
    min-height: 50vh;
}

.rsvp-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--surface-3);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: rsvp-spin .7s linear infinite;
}

    /* Inside the submit button while the response saves */
    .rsvp-spinner.small {
        width: 18px;
        height: 18px;
        border-width: 2px;
        border-color: rgb(255 255 255 / .4);
        border-top-color: var(--on-accent);
    }

@keyframes rsvp-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---- "Please check your response" dialog -------------------------------------------------------------------- */
.rsvp-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 16px;
    background-color: var(--scrim);
}

.rsvp-modal {
    width: 100%;
    max-width: 420px;
    padding: 24px;
    background-color: var(--surface);
    border-radius: var(--r-island);
    box-shadow: var(--shadow-pop);
}

    .rsvp-modal h2 {
        margin: 0 0 8px;
        font-size: 1.15rem;
    }

    .rsvp-modal p {
        margin: 0 0 20px;
        color: var(--ink-2);
    }

.rsvp-modal-actions {
    display: flex;
    justify-content: flex-end;
}

/* ---- Blazor error boundary ---------------------------------------------------------------------------------- */
.blazor-error-boundary {
    padding: 1rem;
    color: var(--on-accent);
    background-color: var(--bad);
    border-radius: var(--r-card);
}

    .blazor-error-boundary::after {
        content: "An error has occurred.";
    }

/* ---- Wider screens ------------------------------------------------------------------------------------------ */
@media (min-width: 640px) {
    .rsvp-page {
        padding-top: 28px;
    }

    .rsvp-banner, .rsvp-card {
        padding: 24px 28px;
    }

    .rsvp-guest {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .rsvp-guest-heading {
        grid-column: 1 / -1;
    }
}

/* ---- Phones ------------------------------------------------------------------------------------------------- */
@media (max-width: 479.98px) {
    .rsvp-banner, .rsvp-card {
        padding: 16px;
    }

    .rsvp-banner-head {
        gap: 12px;
    }

    .rsvp-banner-logo {
        max-width: 88px;
        max-height: 48px;
    }

    .rsvp-guest {
        padding: 14px;
    }

    .rsvp-status {
        padding: 28px 18px;
    }

    .rsvp-actions .rsvp-btn, .rsvp-modal-actions .rsvp-btn {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .rsvp-spinner {
        animation-duration: 2s;
    }

    .rsvp-input, .rsvp-choice-btn, .rsvp-btn {
        transition: none;
    }
}
