/* Pulse Park reception check-in screen (checkin-display.html).
   Built for a landscape TV/tablet read from 2-3 metres; portrait tablets stack. */

:root {
    --ci-accent: #2e5aac;
    --ci-accent-strong: #1e3f7d;
    --ci-accent-soft: rgba(46, 90, 172, 0.1);
    --ci-green: #16a34a;
    --ci-green-soft: #dcfce7;
    --ci-red: #b91c1c;
    --ci-text: #0f172a;
    --ci-muted: #475569;
    --ci-subtle: #94a3b8;
    --ci-line: #e2e8f0;
    --ci-bg: #f5f8fd;
    --ci-card: #ffffff;
    --ci-gap: clamp(16px, 2.6vmin, 40px);
    --ci-qr-size: min(66vh, 44vw);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    height: 100%;
}

body.checkin-body {
    font-family: 'Public Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--ci-text);
    background:
        radial-gradient(circle at 8% 10%, rgba(46, 90, 172, 0.09), transparent 42%),
        radial-gradient(circle at 96% 96%, rgba(22, 163, 74, 0.07), transparent 38%),
        linear-gradient(160deg, #ffffff 0%, var(--ci-bg) 100%);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

body.checkin-body.is-idle {
    cursor: none;
}

[hidden] {
    display: none !important;
}

.checkin-shell {
    height: 100vh;
    height: 100dvh;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    padding:
        max(clamp(14px, 2.2vmin, 32px), env(safe-area-inset-top))
        max(clamp(20px, 3.4vmin, 56px), env(safe-area-inset-right))
        max(clamp(12px, 1.8vmin, 26px), env(safe-area-inset-bottom))
        max(clamp(20px, 3.4vmin, 56px), env(safe-area-inset-left));
    gap: clamp(8px, 1.6vmin, 24px);
}

/* Header */
.checkin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ci-gap);
    /* leave room for the corner controls */
    padding-right: 260px;
}

.checkin-logo {
    height: clamp(56px, 11vmin, 132px);
    width: auto;
    display: block;
}

.checkin-clock {
    text-align: right;
    line-height: 1.05;
}

.checkin-clock-time {
    font-size: clamp(28px, 6vmin, 76px);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.checkin-clock-date {
    margin-top: 4px;
    font-size: clamp(14px, 2.2vmin, 26px);
    font-weight: 600;
    color: var(--ci-muted);
}

/* Corner controls: small, dimmed until the screen is touched */
.checkin-controls {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    display: flex;
    gap: 8px;
    z-index: 20;
    opacity: 0.55;
    transition: opacity 0.3s ease;
}

.checkin-controls:hover,
.checkin-controls:focus-within,
body:not(.is-idle) .checkin-controls {
    opacity: 1;
}

body.is-idle .checkin-controls {
    opacity: 0.18;
}

.checkin-control {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 8px 14px;
    border: 1px solid var(--ci-line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--ci-muted);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
}

.checkin-control:hover {
    color: var(--ci-text);
    border-color: #cbd5e1;
}

.checkin-control:focus-visible,
.checkin-overlay-btn:focus-visible {
    outline: 3px solid var(--ci-accent);
    outline-offset: 2px;
}

.checkin-control svg,
.checkin-control span:not(.checkin-exit-fill) {
    position: relative;
}

.checkin-control .icon-exit,
.checkin-control.is-fullscreen .icon-enter {
    display: none;
}

.checkin-control.is-fullscreen .icon-exit {
    display: inline;
}

.checkin-exit-fill {
    position: absolute;
    inset: 0;
    background: rgba(185, 28, 28, 0.16);
    transform: scaleX(0);
    transform-origin: left center;
}

.checkin-exit.is-holding .checkin-exit-fill {
    transform: scaleX(1);
    transition: transform var(--ci-hold-ms, 1200ms) linear;
}

.checkin-exit.is-holding {
    color: var(--ci-red);
}

/* Main layout: landscape = intro + recent on the left, QR on the right */
.checkin-main {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
        "intro qr"
        "recent qr";
    column-gap: clamp(24px, 5vmin, 88px);
    row-gap: clamp(12px, 2.4vmin, 36px);
    align-items: start;
}

.checkin-intro {
    grid-area: intro;
    min-width: 0;
}

.checkin-qr-panel {
    grid-area: qr;
    align-self: center;
    display: flex;
    justify-content: center;
}

.checkin-recent {
    grid-area: recent;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.checkin-title {
    margin: 0 0 clamp(10px, 2.4vmin, 34px);
    font-size: clamp(40px, 9.6vmin, 124px);
    font-weight: 900;
    line-height: 0.98;
    letter-spacing: -0.035em;
    color: var(--ci-text);
}

.checkin-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: clamp(8px, 1.7vmin, 22px);
}

.checkin-steps li {
    display: flex;
    align-items: center;
    gap: clamp(12px, 2vmin, 26px);
    font-size: clamp(20px, 4vmin, 50px);
    font-weight: 700;
    line-height: 1.15;
}

.checkin-step-num {
    flex: 0 0 auto;
    width: 1.55em;
    height: 1.55em;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--ci-accent);
    color: #fff;
    font-size: 0.82em;
    font-weight: 800;
    box-shadow: 0 6px 16px rgba(46, 90, 172, 0.28);
}

/* QR card */
.checkin-qr-card {
    background: var(--ci-card);
    border-radius: clamp(20px, 3vmin, 40px);
    padding: clamp(12px, 2vmin, 28px);
    box-shadow:
        0 1px 0 rgba(15, 23, 42, 0.04),
        0 24px 60px rgba(15, 23, 42, 0.12);
    border: 1px solid rgba(46, 90, 172, 0.12);
    width: calc(var(--ci-qr-size) + 2 * clamp(12px, 2vmin, 28px));
    max-width: 100%;
}

.checkin-qr-box {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #ffffff;
    border-radius: clamp(10px, 1.6vmin, 20px);
}

.checkin-qr-image {
    position: absolute;
    inset: 0;
}

.checkin-qr-image svg {
    display: block;
    width: 100%;
    height: 100%;
    shape-rendering: crispEdges;
}

.checkin-qr-status {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(10px, 2vmin, 22px);
    padding: 12%;
    text-align: center;
    background: #ffffff;
    border-radius: inherit;
}

.checkin-qr-box[data-state="loading"] .checkin-qr-status,
.checkin-qr-box[data-state="reconnecting"] .checkin-qr-status {
    display: flex;
}

.checkin-qr-box[data-state="loading"] .checkin-qr-image,
.checkin-qr-box[data-state="reconnecting"] .checkin-qr-image {
    visibility: hidden;
}

.checkin-qr-status-title {
    font-size: clamp(22px, 4.4vmin, 52px);
    font-weight: 800;
    color: var(--ci-text);
}

.checkin-qr-status-text {
    font-size: clamp(14px, 2.4vmin, 28px);
    font-weight: 600;
    color: var(--ci-muted);
    max-width: 22ch;
}

.checkin-qr-status-text:empty {
    display: none;
}

.checkin-spinner {
    width: clamp(40px, 8vmin, 88px);
    height: clamp(40px, 8vmin, 88px);
    border-radius: 50%;
    border: clamp(4px, 0.8vmin, 9px) solid var(--ci-accent-soft);
    border-top-color: var(--ci-accent);
    animation: checkin-spin 0.9s linear infinite;
}

@keyframes checkin-spin {
    to {
        transform: rotate(360deg);
    }
}

.checkin-progress {
    margin: clamp(10px, 1.8vmin, 22px) clamp(4px, 1vmin, 12px) 0;
    height: clamp(6px, 1vmin, 12px);
    border-radius: 999px;
    background: #e8eef8;
    overflow: hidden;
}

.checkin-progress-bar {
    height: 100%;
    width: 100%;
    background: var(--ci-accent);
    border-radius: inherit;
    transform-origin: left center;
    transform: scaleX(0);
    transition: transform 0.25s linear;
}

.checkin-qr-box[data-state="reconnecting"] ~ .checkin-progress .checkin-progress-bar,
.checkin-qr-box[data-state="loading"] ~ .checkin-progress .checkin-progress-bar {
    transform: scaleX(0) !important;
}

.checkin-qr-caption {
    margin: clamp(6px, 1.2vmin, 14px) 0 0;
    text-align: center;
    font-size: clamp(13px, 2vmin, 24px);
    font-weight: 600;
    color: var(--ci-muted);
}

/* Just checked in */
.checkin-recent-title {
    margin: 0 0 clamp(8px, 1.4vmin, 18px);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: clamp(16px, 2.6vmin, 32px);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ci-muted);
}

.checkin-recent-dot {
    width: 0.55em;
    height: 0.55em;
    border-radius: 50%;
    background: var(--ci-green);
    box-shadow: 0 0 0 0.22em rgba(22, 163, 74, 0.18);
}

.checkin-recent-list {
    list-style: none;
    margin: 0;
    padding: 0;
    min-height: 0;
    flex: 1 1 auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: clamp(6px, 1.1vmin, 14px);
    -webkit-mask-image: linear-gradient(to bottom, #000 78%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 78%, transparent 100%);
}

.checkin-recent-item {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: clamp(10px, 1.8vmin, 22px);
    padding: clamp(8px, 1.4vmin, 18px) clamp(12px, 2vmin, 24px);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--ci-line);
    border-radius: clamp(12px, 1.8vmin, 22px);
    transition: background-color 1.2s ease, border-color 1.2s ease, box-shadow 1.2s ease;
}

.checkin-recent-check {
    width: clamp(28px, 4.4vmin, 52px);
    height: clamp(28px, 4.4vmin, 52px);
    border-radius: 50%;
    background: var(--ci-green-soft);
    color: var(--ci-green);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.checkin-recent-check svg {
    width: 58%;
    height: 58%;
}

.checkin-recent-main {
    min-width: 0;
}

.checkin-recent-name {
    font-size: clamp(17px, 3vmin, 38px);
    font-weight: 800;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.checkin-recent-meta {
    font-size: clamp(13px, 2.1vmin, 26px);
    font-weight: 600;
    color: var(--ci-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.checkin-recent-time {
    font-size: clamp(14px, 2.3vmin, 28px);
    font-weight: 700;
    color: var(--ci-subtle);
    font-variant-numeric: tabular-nums;
}

.checkin-recent-item.is-new {
    background: var(--ci-green-soft);
    border-color: rgba(22, 163, 74, 0.45);
    box-shadow: 0 10px 28px rgba(22, 163, 74, 0.18);
    animation: checkin-arrive 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

.checkin-recent-item.is-new .checkin-recent-time {
    color: var(--ci-green);
}

@keyframes checkin-arrive {
    from {
        opacity: 0;
        transform: translateY(-14px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.checkin-recent-empty {
    padding: clamp(10px, 2vmin, 24px) 0;
    font-size: clamp(16px, 2.6vmin, 32px);
    font-weight: 600;
    color: var(--ci-subtle);
}

/* Footer */
.checkin-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 24px;
    font-size: clamp(13px, 2vmin, 24px);
    font-weight: 600;
    color: var(--ci-muted);
}

.checkin-connection {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #b45309;
    font-size: 0.85em;
}

.checkin-connection-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #f59e0b;
}

/* Full-screen overlay (signed out / no permission) */
.checkin-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 12% 14%, rgba(46, 90, 172, 0.1), transparent 40%),
        linear-gradient(160deg, #ffffff 0%, var(--ci-bg) 100%);
}

.checkin-overlay-card {
    width: min(760px, 100%);
    text-align: center;
    background: #fff;
    border: 1px solid rgba(46, 90, 172, 0.14);
    border-radius: 32px;
    padding: clamp(28px, 6vmin, 64px);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
}

.checkin-overlay-logo {
    height: clamp(72px, 14vmin, 140px);
    width: auto;
}

.checkin-overlay-title {
    margin: clamp(12px, 2vmin, 24px) 0 12px;
    font-size: clamp(28px, 5.6vmin, 60px);
    font-weight: 900;
    line-height: 1.08;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

.checkin-overlay-text {
    margin: 0 auto clamp(20px, 3.4vmin, 36px);
    max-width: 40ch;
    font-size: clamp(16px, 2.6vmin, 26px);
    font-weight: 500;
    color: var(--ci-muted);
    line-height: 1.45;
}

.checkin-overlay-btn {
    border: none;
    border-radius: 999px;
    background: var(--ci-accent);
    color: #fff;
    font: inherit;
    font-size: clamp(16px, 2.4vmin, 24px);
    font-weight: 800;
    padding: 0.8em 1.8em;
    cursor: pointer;
}

.checkin-overlay-btn:hover {
    background: var(--ci-accent-strong);
}

/* Portrait tablets / narrow screens: stack QR under the title */
@media (orientation: portrait), (max-aspect-ratio: 5/4) {
    :root {
        --ci-qr-size: min(78vw, 46vh);
    }

    .checkin-main {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto minmax(0, 1fr);
        grid-template-areas:
            "intro"
            "qr"
            "recent";
        row-gap: clamp(14px, 2.6vmin, 32px);
    }

    .checkin-intro {
        text-align: center;
    }

    .checkin-title {
        font-size: clamp(40px, 9vmin, 110px);
        margin-bottom: clamp(10px, 2vmin, 24px);
    }

    .checkin-steps {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: clamp(8px, 2vmin, 24px);
    }

    .checkin-steps li {
        flex-direction: column;
        text-align: center;
        gap: 8px;
        font-size: clamp(16px, 3.4vmin, 38px);
    }

    .checkin-recent-list {
        -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent 100%);
        mask-image: linear-gradient(to bottom, #000 70%, transparent 100%);
    }
}

/* Very small phones: controls drop their labels */
@media (max-width: 520px) {
    .checkin-control span:not(.checkin-exit-fill) {
        display: none;
    }

    .checkin-header {
        padding-right: 104px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .checkin-spinner {
        animation: none;
    }

    .checkin-progress-bar,
    .checkin-recent-item,
    .checkin-controls {
        transition: none !important;
    }

    .checkin-recent-item.is-new {
        animation: none;
    }

    .checkin-exit.is-holding .checkin-exit-fill {
        transition: none;
    }
}
