@font-face {
    font-family: 'DIN Round Pro';
    src: url('/assets/fonts/DINRoundPro.woff2') format('woff2');
    font-display: swap;
}

@font-face {
    font-family: 'DIN Round Pro';
    src: url('/assets/fonts/DINRoundPro-Bold.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}

:root {
    --burgundy: #740f27;
    --red: #ae0a2f;
    --cream: #f5eee6;
    --stamp: linear-gradient(var(--cream), var(--cream)) center / 82.4% 82.4% no-repeat,
        url('/assets/christmas/stamp.png') center / 100% 100% no-repeat;
    font-family: 'DIN Round Pro', Arial, sans-serif;
    color: #161616;
    background: #fcfcfc;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
}

.intro {
    padding: clamp(1.5rem, 4.25vw, 4.25rem) 1rem;
    background: var(--burgundy);
    color: white;
    text-align: center;
}

.intro h1 {
    margin: 0 auto;
    font-size: clamp(1.85rem, 3.5vw, 3.45rem);
    line-height: 1.15;
}

.intro p {
    max-width: 75rem;
    margin: clamp(.75rem, 2.5vw, 2.5rem) auto 0;
    font-size: clamp(1rem, 2.2vw, 2.2rem);
    line-height: 1.25;
}

.board {
    --scene-width: 1600;
    --scene-height: 1159;
    --stamp-scale: 1;
    --stamp-offset-x: 0;
    --stamp-offset-y: 0;
    position: relative;
    background: #dcd3c9;
}

.board picture,
.board picture img {
    display: block;
    width: 100%;
}

.board picture img {
    height: auto;
}

.window {
    position: absolute;
    inset-inline-start: calc(100% * (var(--x) * var(--stamp-scale) + var(--stamp-offset-x)) / var(--scene-width));
    inset-block-start: calc(100% * (var(--y) * var(--stamp-scale) + var(--stamp-offset-y)) / var(--scene-height));
    width: calc(100% * var(--w) * var(--stamp-scale) / var(--scene-width));
    height: calc(100% * var(--h) * var(--stamp-scale) / var(--scene-height));
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.window:disabled {
    cursor: default;
}

.window:focus-visible {
    outline: 3px solid #ffe045;
    outline-offset: 3px;
    border-radius: .25rem;
}

.window-card {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.window-front,
.window-back {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
    filter: drop-shadow(0 .55rem .65rem #291c1a66);
}

/* Each face closes to an edge or opens from it in its own plane. */
.window-back,
.window.is-selected .window-front {
    transform: scaleX(0);
}

.window.is-selected .window-back {
    transform: scaleX(1);
}

@media (hover: hover) {
    .window:hover:not(:disabled) {
        z-index: 1;
    }

    @media (prefers-reduced-motion: no-preference) {
        .window:hover:not(:disabled, .is-selected) .window-card {
            transform: translateY(-3%) scale(1.04);
        }
    }
}

@media (prefers-reduced-motion: no-preference) {
    .window-card {
        transition: transform 180ms ease-out;
    }

    .window-front,
    .window-back {
        transition: transform 210ms ease-in;
    }

    .window:not(.is-selected) .window-front,
    .window.is-selected .window-back {
        transition: transform 210ms ease-out 210ms;
    }
}

.entry-dialog {
    --dialog-width: min(90vw, 43.75rem);
    --dialog-max-height: 90dvh;
    width: var(--dialog-width);
    max-width: none;
    max-height: var(--dialog-max-height);
    padding: 0;
    border: 0;
    background: var(--stamp);
    color: var(--burgundy);
    text-align: center;
    filter: drop-shadow(0 1rem 1.5rem #0006);
}

.entry-dialog-content {
    /* Use the stamp proportions as a minimum so the copy can determine the actual height. */
    min-height: min(calc(var(--dialog-width) * 587 / 700), var(--dialog-max-height));
    padding: clamp(.75rem, 5dvh, 4.25rem) clamp(1.75rem, 6vw, 4rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.entry-dialog:modal,
.entry-dialog::backdrop {
    overscroll-behavior: contain;
}

.entry-dialog::backdrop {
    overflow: hidden;
    background: #0007;
}

.entry-dialog:modal,
.entry-dialog:modal::backdrop {
    transition-property: opacity, display, overlay;
    transition-duration: 100ms;
    transition-timing-function: ease-out;
    transition-behavior: allow-discrete;
}

@starting-style {
    .entry-dialog:modal,
    .entry-dialog:modal::backdrop {
        opacity: 0;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .entry-dialog:modal,
    .entry-dialog:modal::backdrop {
        transition-duration: 180ms;
    }

    .entry-dialog:modal {
        transition-property: opacity, transform, display, overlay;
    }

    @starting-style {
        .entry-dialog:modal {
            transform: translateY(6px) scale(.97);
        }
    }
}

.entry-dialog h2 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.5rem);
}

.entry-dialog p {
    margin: .75rem 0 1.5rem;
    font-size: clamp(1.05rem, 2.25vw, 2rem);
}

.entry {
    width: min(calc(100% - 2rem), 68rem);
    margin: clamp(1.25rem, 2.5vw, 2.5rem) auto;
    padding: clamp(1rem, 3vw, 2.5rem);
    border-radius: 1.25rem;
    background: white;
    box-shadow: 0 3px 6px #0003;
}

.entry > * {
    max-width: 31.25rem;
    margin-inline: auto;
}

.entry > h2 {
    margin-block: 0 1rem;
    color: var(--red);
    font-size: clamp(1.25rem, 2vw, 1.875rem);
    text-align: center;
}

#selection-status {
    text-align: center;
}

.entry-confirmation:not([hidden]) {
    display: grid;
    align-items: center;
    min-block-size: clamp(24rem, 75vw, 56.625rem);
    background: var(--burgundy);
    color: white;
}

.confirmation-content {
    width: 100%;
}

.confirmation-content h2 {
    margin: 0;
    font-size: clamp(1.875rem, 3vw, 2.5rem);
    line-height: 1.2;
}

.confirmation-content p {
    margin: 1.5rem 0;
    font-size: clamp(1rem, 1.6vw, 1.25rem);
    line-height: 1.4;
}

fieldset {
    min-inline-size: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.field {
    margin-block-end: 1rem;
}

.field label {
    display: block;
    margin-block-end: .4rem;
}

.field input,
.field select {
    width: 100%;
    min-height: 3.65rem;
    border: 2px solid #c2c2c2;
    border-radius: .65rem;
    padding: .65rem 1.1rem;
    background: #f1f1f1;
    color: inherit;
    font: inherit;
}

.country-field {
    position: relative;
}

.country-options,
#country-no-results {
    position: absolute;
    z-index: 1;
    inset-inline: 0;
    max-height: 12rem;
    margin: .25rem 0 0;
    overflow-y: auto;
    border: 1px solid #c2c2c2;
    border-radius: .65rem;
    background: white;
    box-shadow: 0 3px 6px #0003;
}

.country-options {
    padding: .25rem;
    list-style: none;
}

.country-options li,
#country-no-results {
    padding: .65rem 1rem;
}

.country-options li {
    cursor: pointer;
}

.country-options li:hover,
.country-options li[aria-selected='true'] {
    background: var(--cream);
    color: var(--burgundy);
}

.consent label {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    font-weight: 700;
}

.consent input {
    flex: none;
    inline-size: 1.55rem;
    block-size: 1.55rem;
    margin: 0;
    accent-color: var(--burgundy);
}

.consent a {
    display: inline-block;
    margin: .65rem 0 1rem 2.2rem;
    color: inherit;
}

.cf-turnstile {
    margin-block-end: .75rem;
}

.action {
    min-height: 2.75rem;
    padding: .5rem 1rem;
    border: 0;
    border-radius: .25rem;
    background: var(--burgundy);
    color: white;
    font: 700 1rem 'DIN Round Pro', Arial, sans-serif;
    cursor: pointer;
}

.action:disabled {
    opacity: .65;
    cursor: default;
}

#submit-entry {
    width: 100%;
    text-transform: uppercase;
}

.confirmation-link {
    display: grid;
    place-items: center;
    background: white;
    color: var(--red);
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
}

.confirmation-link:hover {
    background: var(--cream);
}

#entry-error {
    margin-block-end: 0;
    color: var(--burgundy);
}

a:focus-visible,
input:focus-visible,
select:focus-visible,
.action:focus-visible {
    outline: 3px solid #14578c;
    outline-offset: 3px;
}

.confirmation-link:focus-visible {
    outline-color: white;
}

@media (max-width: 599px) {
    .intro {
        padding: 2.5rem 1rem;
    }

    .intro h1 {
        font-size: 1.875rem;
        line-height: 1.4;
    }

    .intro p {
        max-width: 19.375rem;
        margin-block-start: 2.5rem;
        font-size: clamp(1.125rem, 6.4vw, 1.5625rem);
        line-height: 1.12;
    }

    .board {
        /* The Figma mobile frame scales and repositions the desktop stamp group. */
        --scene-width: 390;
        --scene-height: 431;
        --stamp-scale: .27385;
        --stamp-offset-x: -23.861;
        --stamp-offset-y: 56.977;
    }

    main {
        border-block-end: 4px solid #bfa870;
    }

    .entry {
        width: calc(100% - 3rem);
        margin-block: 1.5rem;
        padding: 1.25rem 1.5rem;
        border-radius: .625rem;
    }

    .entry > h2 {
        margin-block-end: 1.5rem;
        font-size: 1.125rem;
        line-height: 1.625rem;
    }

    #selection-status {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .field {
        margin-block-end: .75rem;
    }

    .field input,
    .field select {
        min-height: 2.75rem;
        padding: .65rem .75rem;
        border-width: 1px;
        border-radius: .25rem;
    }

    .consent input {
        inline-size: 1.25rem;
        block-size: 1.25rem;
    }

    .consent a {
        margin-inline-start: 1.9rem;
    }
}
