/* Piazzolla and Roboto Condensed, SIL Open Font License 1.1 (fonts.google.com). */
@font-face {
    font-family: Piazzolla;
    src: url('assets/fonts/piazzolla-cyrillic-opsz.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: Piazzolla;
    src: url('assets/fonts/piazzolla-latin-opsz.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'Roboto Condensed';
    src: url('assets/fonts/roboto-condensed-cyrillic-400.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: 'Roboto Condensed';
    src: url('assets/fonts/roboto-condensed-latin-400.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'Roboto Condensed';
    src: url('assets/fonts/roboto-condensed-cyrillic-700.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: 'Roboto Condensed';
    src: url('assets/fonts/roboto-condensed-latin-700.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}

* { box-sizing: border-box; }
:root {
    color-scheme: light;
    --blue: #0f2d69;
    --night: #060f22;
    --paper: #f4f6f5;
    --sand: #e4dcd0;
    --ink: #14231d;
    --muted: #5b6b64;
    --mist: #93a0bc;
    --warning: #785805;
    --error: #ae2720;
    --serif: Piazzolla, Georgia, 'Times New Roman', serif;
    --sans: 'Roboto Condensed', 'Arial Narrow', Arial, sans-serif;
}
html { -webkit-text-size-adjust: 100%; }
/* Figma renders type with greyscale smoothing; match it. */
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
    margin: 0;
    font: 400 16px/1.5 var(--sans);
    color: var(--ink);
    background: var(--paper);
}
p, h1 { margin: 0; }
h1 {
    max-width: 310px;
    font: 400 36px/1.1 var(--serif);
    letter-spacing: -.72px;
    text-transform: uppercase;
    white-space: pre-line;
    overflow-wrap: break-word;
}
h1:focus { outline: none; }

/* The mockups are 390 px wide; wider screens get the same column, centred. */
.layout {
    position: relative;
    max-width: 480px;
    min-height: 100vh;
    min-height: 100svh;
    margin: 0 auto;
    padding-bottom: 32px;
    overflow: hidden;
    background: var(--paper);
}

.banner {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 20px;
    min-height: 372px;
    margin-bottom: -48px;
    padding: 20px 24px 72px;
    overflow: hidden;
    background: var(--night);
    color: #fff;
}
.banner-art {
    position: absolute;
    z-index: -1;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
    aspect-ratio: 390 / 372;
}
[data-state="thanks"] .banner, [data-state="before"] .banner { min-height: 300px; margin-bottom: -64px; }
[data-state="again"] .banner { min-height: 300px; margin-bottom: -56px; padding-bottom: 80px; }

.logos {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 134.805px;
    flex: none;
}
.logos img { display: block; flex: none; }
/* The HSE mark is drawn with its own margin and cropped to the circle, as in Figma. */
.logo-hse { position: relative; width: 35.009px; height: 35.009px; overflow: hidden; flex: none; }
.logo-hse img { position: absolute; top: -6.59px; left: -6.59px; width: 48.19px; height: 48.19px; }
.logo-butterfly { width: 39.38px; height: 23.498px; }
.logo-crest { width: 33.364px; height: 33.558px; }

.eyebrow {
    margin-bottom: 10px;
    font-size: 14px;
    line-height: normal;
    letter-spacing: -.14px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .85);
}
.lead {
    max-width: 320px;
    margin-top: 12px;
    line-height: 20px;
    letter-spacing: -.16px;
    white-space: pre-line;
    color: rgba(255, 255, 255, .88);
}

.content { position: relative; padding: 0 16px; }
.card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px;
    border: 1px solid #e1e7e4;
    border-radius: 20px;
    background: #fff;
}
.label { font-weight: 700; font-size: 15px; line-height: normal; }
.again-intro { display: block; }
textarea {
    display: block;
    width: 100%;
    /* Keeps the send button on the first screen down to 640 px tall phones. */
    height: clamp(120px, calc(100svh - 503px), 210px);
    padding: 14px;
    resize: none;
    border: 1.5px solid #c6d1cc;
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
    font: 400 16px/1.5 var(--sans);
    -webkit-appearance: none;
    appearance: none;
}
[data-state="again"] textarea { height: clamp(110px, calc(100svh - 470px), 150px); }
textarea::placeholder { color: #7c8a84; opacity: 1; }
textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(15, 45, 105, .18); }
textarea[aria-invalid="true"] { border-color: var(--error); }
textarea:disabled { background: #f7f8f8; color: var(--muted); }
.trap { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.field-info {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
    line-height: normal;
    color: var(--muted);
}
#counter { margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
#counter.near-limit { font-weight: 700; color: var(--warning); }
.error { font-size: 14px; line-height: 1.35; color: var(--error); }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 52px;
    padding: 0 20px;
    border: 1.5px solid transparent;
    border-radius: 14px;
    background: transparent;
    font: 700 15px/normal var(--sans);
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.button:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.primary { width: 100%; height: 56px; border: 0; background: var(--blue); color: #fff; font-size: 16px; }
[data-state="form"] .primary { margin-top: 6px; }
.primary:disabled { opacity: .45; color: var(--mist); cursor: default; }
.review[aria-busy="true"] .primary:disabled { opacity: .7; color: #fff; }
@media (hover: hover) and (pointer: fine) { .primary:not(:disabled):hover { background: #173a80; } }
.primary:not(:disabled):active { background: var(--night); }
.outline { border-color: var(--mist); color: var(--mist); }
@media (hover: hover) and (pointer: fine) { .outline:hover { background: #f1f3f8; } }
.outline:active { background: #e4e8f1; }
.deadline { padding: 18px 12px 0; font-size: 13px; text-align: center; color: var(--muted); }

.receipt { gap: 12px; padding: 24px 20px; }
.check { display: block; width: 56px; height: 56px; }
.receipt h1 { margin-top: 6px; color: var(--night); }
.receipt p { color: #3d4b45; }
.receipt .outline { width: 100%; margin-top: 12px; }

/* Closed screen: sand background, artwork on top, copy pinned to the bottom. */
[data-state="closed"], [data-state="closed"] .layout { background: var(--sand); }
[data-state="closed"] .layout { padding-bottom: 0; }
.final {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100svh;
    min-height: 560px;
    color: var(--blue);
}
/* On short screens the artwork gives way (cropped from the bottom), never the copy. */
.final-art {
    display: block;
    flex: 0 1 auto;
    width: 100%;
    min-height: 0;
    aspect-ratio: 390 / 589;
    object-fit: cover;
    object-position: center top;
}
.final .logos { position: absolute; top: 20px; left: 24px; }
.final-copy { flex: none; margin-top: auto; padding: 6px 24px 40px; }
.final-copy p {
    max-width: 320px;
    margin-top: 14px;
    line-height: 20px;
    letter-spacing: -.16px;
    white-space: pre-line;
    color: rgba(15, 45, 105, .88);
}
.final-copy .button { margin-top: 24px; border-color: rgba(15, 45, 105, .4); color: rgba(15, 45, 105, .7); }
@media (hover: hover) and (pointer: fine) { .final-copy .button:hover { background: rgba(15, 45, 105, .06); } }

.banner-art-wide, .final-art-pad, .final-art-wide { display: none; }

body:not([data-state="form"]) .form-only,
body:not([data-state="again"]) .again-only,
body:not([data-state="thanks"]) .thanks-only,
[data-state="thanks"] .review, [hidden] { display: none !important; }

@media (max-height: 700px) {
    .banner { gap: 14px; }
}

/* Tablet, from the 768 px mockups. */
@media (min-width: 600px) {
    .layout { max-width: none; }
    .banner-art, .final-art { display: none; }
    /* A 766x500 window onto the wide bird scene, positioned as in the Figma frame. */
    .banner-art-wide {
        display: block;
        position: absolute;
        z-index: -1;
        top: 0;
        left: 0;
        width: 100%;
        aspect-ratio: 766 / 500;
    }
    .banner-art-wide img { position: absolute; top: -25.102%; left: -28.307%; width: 220.99%; max-width: none; }
    .banner { min-height: 500px; margin-bottom: -48px; padding: 32px 48px 104px; }
    [data-state="thanks"] .banner, [data-state="before"] .banner { min-height: 420px; margin-bottom: -56px; }
    [data-state="again"] .banner { min-height: 400px; margin-bottom: -48px; padding-bottom: 104px; }
    .banner h1 { max-width: 480px; font-size: 44px; letter-spacing: -.88px; }
    .eyebrow { margin-bottom: 12px; font-size: 16px; letter-spacing: -.16px; }
    .lead { max-width: 480px; margin-top: 12px; white-space: normal; }
    .content { padding: 0 48px; }
    .card { gap: 12px; padding: 28px; border-radius: 24px; }
    .label { font-size: 16px; }
    textarea, [data-state="again"] textarea { height: 240px; padding: 16px; border-radius: 14px; font-size: 17px; line-height: 1.55; }
    [data-state="again"] textarea { height: 200px; }
    .field-info { font-size: 14px; }
    .primary, [data-state="form"] .primary { height: 58px; margin-top: 8px; font-size: 17px; }
    .again-intro, .receipt p { font-size: 18px; }
    .deadline { padding-top: 20px; font-size: 14px; text-align: left; }
    .receipt { padding: 28px; }
    .check { width: 64px; height: 64px; }
    .receipt h1 { max-width: none; font-size: 32px; letter-spacing: -.64px; }
    .receipt .outline { height: 58px; margin-top: 16px; font-size: 17px; }

    /* Closed screen, from the exported 768x1024 frame: artwork 768x820, copy overlaps its foot. */
    .final { min-height: 640px; }
    .final-art-pad {
        display: block;
        flex: 0 1 auto;
        width: 100%;
        min-height: 0;
        margin-bottom: -84px;
        aspect-ratio: 768 / 820;
        object-fit: cover;
        object-position: center top;
    }
    .final .logos { top: 32px; left: 48px; }
    .final-copy { position: relative; padding: 0 48px 64px; }
    .final-copy h1 { max-width: 480px; font-size: 44px; letter-spacing: -.88px; }
    .final-copy p { max-width: none; margin-top: 16px; font-size: 18px; line-height: 24px; letter-spacing: -.18px; }
    .final-copy .button { height: 64px; margin-top: 28px; padding: 0 26px; border-width: 1.9px; border-radius: 17px; font-size: 18px; }
}

/* Desktop, from the 1440x900 mockups: artwork panel 760, form panel 680. */
@media (min-width: 1024px) {
    .layout {
        display: grid;
        grid-template-columns: 760fr 680fr;
        padding: 0;
    }
    .banner, [data-state="thanks"] .banner, [data-state="again"] .banner, [data-state="before"] .banner {
        container-type: size;
        min-height: 100vh;
        min-height: 100svh;
        margin: 0;
        padding: 40px 64px;
    }
    .banner-art-wide {
        left: 50%;
        width: max(100cqw, 100cqh * 760 / 900);
        aspect-ratio: 760 / 900;
        translate: -50% 0;
    }
    .banner-art-wide img { top: -6.778%; left: -34.276%; width: 307.895%; }
    .banner h1 { max-width: 563px; font-size: 54px; letter-spacing: -1.08px; }
    .eyebrow { margin-bottom: 16px; font-size: 18px; letter-spacing: -.18px; }
    .lead { max-width: 418px; margin-top: 20px; font-size: 18px; line-height: 29px; letter-spacing: -.18px; white-space: pre-line; }

    .content { display: grid; grid-template-columns: minmax(0, 520px); place-content: center; padding: 40px; }
    .card, .receipt { padding: 0; border: 0; border-radius: 0; background: none; }
    .label { font-size: 17px; }
    textarea { height: 300px; padding: 20px; }
    [data-state="again"] textarea { height: 240px; }
    .primary, [data-state="form"] .primary { height: 60px; }
    .again-intro, .receipt p { font-size: 20px; line-height: 1.45; }
    .deadline { padding: 20px 0 0; }
    .receipt { gap: 16px; }
    .check { width: 72px; height: 72px; }
    .receipt h1 { margin-top: 8px; font-size: 42px; letter-spacing: -.84px; }
    .receipt .outline { height: 60px; border-color: var(--blue); color: var(--blue); }

    [data-state="closed"] .layout { display: block; }
    .final { position: relative; }
    .final-art-pad { display: none; }
    /* Artwork from the exported 1440x900 frame: a 944x900 panel flush with the right edge. */
    .final-art-wide {
        display: block;
        position: absolute;
        top: 0;
        right: 0;
        width: min(70%, 100svh * 944 / 900);
        height: 100%;
        object-fit: cover;
        object-position: left center;
    }
    .final .logos { top: 41px; left: 65px; }
    .final-copy { padding: 0 65px 73px; }
    .final-copy h1 { max-width: 640px; font-size: 56px; letter-spacing: -1.12px; text-transform: none; }
    .final-copy p { max-width: 640px; margin-top: 20px; font-size: 19.5px; line-height: 29px; letter-spacing: -.2px; }
    .final-copy h1 + p { margin-top: 20px; }
    .final-copy .button { height: 60px; margin-top: 36px; padding: 0 30px; border-width: 1.5px; border-radius: 14px; border-color: var(--blue); color: var(--blue); font-size: 17px; }
}

/* ---------- Motion ----------
   A guest sees this page once, so the entrance may take its time; everything they
   touch (button, field) answers within 200 ms. Only transform, opacity and filter move. */
:root {
    --ease-out: cubic-bezier(.23, 1, .32, 1);
    --ease-pop: cubic-bezier(.34, 1.45, .64, 1);
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes settle { from { opacity: 0; transform: translateY(10px); filter: blur(6px); } }
@keyframes art-in { from { opacity: 0; transform: scale(1.035); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.82); } }
@keyframes draw { from { stroke-dashoffset: 34; } }
@keyframes spin { to { transform: rotate(1turn); } }

/* Page entrance: artwork first, then the text top to bottom, then the card. */
.banner-art, .banner-art-wide img, .final-art, .final-art-pad, .final-art-wide { animation: art-in 1.2s var(--ease-out) backwards; }
.logos { animation: fade .6s ease backwards; }
.eyebrow, .banner h1, .lead, .review, .deadline, .final-copy > * { animation: rise .7s var(--ease-out) backwards; }
.eyebrow { animation-delay: 80ms; }
.banner h1, .final-copy h1 { animation-delay: 140ms; }
.lead, .final-copy p { animation-delay: 200ms; }
.review, .final-copy .button { animation-delay: 280ms; }
.deadline { animation-delay: 360ms; }

/* After the entrance, switching between form and thanks is quicker and has no queue. */
.ready .eyebrow, .ready .banner h1, .ready .lead, .ready .review, .ready .deadline { animation-duration: .35s; animation-delay: 0s; }

/* Thanks: the card settles out of a blur, the seal pops, the tick is drawn, the text follows. */
.receipt { animation: settle .5s var(--ease-out) backwards; }
.receipt > * { animation: rise .6s var(--ease-out) backwards; }
.receipt .check { overflow: visible; animation: none; }
.check circle { transform-box: fill-box; transform-origin: center; animation: pop .55s var(--ease-pop) 120ms backwards; }
.check path { stroke-dasharray: 34; animation: draw .4s var(--ease-out) 380ms backwards; }
.receipt h1 { animation-delay: 200ms; }
.receipt p { animation-delay: 260ms; }
.receipt .button { animation-delay: 320ms; }

/* Things the guest touches. */
.button { transition: transform 160ms var(--ease-out), background-color 200ms ease, color 200ms ease, opacity 200ms ease; }
.button:not(:disabled):active { transform: scale(.97); }
textarea { transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease; }
#counter { transition: color 200ms ease; }
.error { animation: rise .25s var(--ease-out); }
.review[aria-busy="true"] .primary::before {
    content: '';
    flex: none;
    width: 16px;
    height: 16px;
    margin-right: 10px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

/* Reduced motion: keep the fades and the spinner, drop everything that travels or scales. */
@media (prefers-reduced-motion: reduce) {
    @keyframes rise { from { opacity: 0; } }
    @keyframes settle { from { opacity: 0; } }
    @keyframes art-in { from { opacity: 0; } }
    @keyframes pop { from { opacity: 0; } }
    @keyframes draw { from { opacity: 0; } }
    .button:not(:disabled):active { transform: none; }
}
