@font-face {
    font-family: "SF Pro Display";
    src: url("../fonts/SF-Pro-Display-Regular.otf") format("opentype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "SF Pro Display";
    src: url("../fonts/SF-Pro-Display-Bold.otf") format("opentype");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --blue: #001698;
    --cream: #e3e4db;
    --paper: #f2f2ed;
    color-scheme: light;
}

* { box-sizing: border-box; }

html {
    background: var(--paper);
    color: var(--blue);
    font-family: "SF Pro Display", sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    margin: 0;
    min-width: 280px;
    min-height: 100vh;
    min-height: 100svh;
    isolation: isolate;
}

::selection { background: var(--blue); color: var(--paper); }

.bg {
    --logo-width: 180px;
    --logo-row: calc(var(--logo-width) * 0.7297326);
    --logo-opacity: 0.8;
    --logo-rise-duration: 200s;
    position: fixed;
    inset: -160px;
    z-index: -2;
    pointer-events: none;
    opacity: var(--logo-opacity);
    transform: rotate(-9deg);
    -webkit-mask-image: radial-gradient(ellipse 50% 28% at 50% 50%, transparent 4%, #000 100%);
    mask-image: radial-gradient(ellipse 50% 28% at 50% 50%, transparent 4%, #000 100%);
    animation: background-enter 900ms ease-out both;
}

.bg::before,
.bg::after {
    content: "";
    position: absolute;
    inset: 0 -80px calc(-2 * var(--logo-row));
    background: url("../LOGO_white.svg") repeat center top / var(--logo-width) var(--logo-row);
    /* Move two rows per loop so neighboring rows keep their direction. */
    animation: logos-rise var(--logo-rise-duration) linear infinite;
}

.bg::before {
    -webkit-mask-image: repeating-linear-gradient(to bottom, #000 0 var(--logo-row), transparent var(--logo-row) calc(2 * var(--logo-row)));
    mask-image: repeating-linear-gradient(to bottom, #000 0 var(--logo-row), transparent var(--logo-row) calc(2 * var(--logo-row)));
    translate: var(--line-shift, 0px) 0;
}

.bg::after {
    -webkit-mask-image: repeating-linear-gradient(to bottom, transparent 0 var(--logo-row), #000 var(--logo-row) calc(2 * var(--logo-row)));
    mask-image: repeating-linear-gradient(to bottom, transparent 0 var(--logo-row), #000 var(--logo-row) calc(2 * var(--logo-row)));
    translate: calc(-1 * var(--line-shift, 0px)) 0;
}

.stage {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100svh;
}

.brand {
    position: absolute;
    top: clamp(54px, 7vh, 88px);
    left: 50%;
    width: clamp(98px, 10vw, 132px);
    transform: translateX(-50%) rotate(-4deg);
}

.brand img { display: block; width: 100%; height: auto; }

.brand img,
.headline,
#signup-form,
.footer-links a {
    animation: enter-up 650ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.brand img { animation-delay: 60ms; }
.headline { animation-delay: 140ms; }
#signup-form { animation-delay: 240ms; }
.footer-links a:nth-child(1) { animation-delay: 320ms; }
.footer-links a:nth-child(2) { animation-delay: 380ms; }
.footer-links a:nth-child(3) { animation-delay: 440ms; }

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 180px max(28px, 6vw) 112px;
}

.headline { position: relative; max-width: 100%; }

.star {
    position: absolute;
    top: -49px;
    right: -19px;
    width: clamp(28px, 3.2vw, 46px);
    height: auto;
    transform: rotate(14deg);
}

h1 {
    margin: 0;
    font-weight: 700;
    font-size: clamp(38px, 9.2vw, 144px);
    letter-spacing: -0.065em;
    line-height: 1.04;
    text-align: center;
    white-space: nowrap;
}

.domain { -webkit-text-stroke: 1.5px var(--blue); color: transparent; }

.error-page main { padding: 0 24px; }
.error-page .bg { --logo-rise-duration: 60s; }

.error-page h1 {
    font-size: clamp(88px, min(31vw, 40vh), 288px);
    line-height: 0.9;
}

.error-page .domain { -webkit-text-stroke-width: clamp(1.5px, 0.3vw, 3.5px); }

.error-home {
    position: absolute;
    top: calc(100% + 12px);
    left: 50%;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--blue);
    font-size: 14px;
    text-underline-offset: 4px;
    white-space: nowrap;
    transform: translateX(-50%);
}

.error-page .brand:focus-visible,
.error-home:focus-visible { outline: 2px solid var(--blue); outline-offset: 5px; }

form {
    position: relative;
    width: min(440px, 100%);
    margin-top: 36px;
}

.signup-intro {
    margin: 0 0 14px;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
}

.signup {
    display: flex;
    min-height: 58px;
    padding: 5px;
    border: 1px solid rgb(0 22 152 / 30%);
    background: var(--paper);
    color: var(--blue);
    transition: background-color 280ms ease, border-color 280ms ease, color 280ms ease;
}

.signup:focus-within {
    border-color: var(--blue);
}

form[data-state="submitting"] .signup,
form[data-state="pending"] .signup,
form[data-state="complete"] .signup {
    background: var(--blue);
    border-color: var(--blue);
    color: var(--paper);
}

.email-field {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 14px;
    transition: opacity 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

form[data-state="pending"] .email-field,
form[data-state="complete"] .email-field { opacity: 0.72; }

.email-icon {
    width: 19px;
    height: 19px;
    flex: 0 0 auto;
    stroke: currentColor;
    stroke-width: 1.4;
    opacity: 0.55;
}

input[type="email"] {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    margin: 0;
    padding: 12px 10px 12px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    font: 400 16px/1.3 "SF Pro Display", sans-serif;
    appearance: none;
}

input[type="email"]::placeholder { color: currentColor; opacity: 0.58; }

input[type="email"]:disabled {
    -webkit-text-fill-color: currentColor;
    opacity: 1;
    cursor: default;
}

button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 26px;
    min-height: 46px;
    margin: 0;
    padding: 12px 17px;
    border: 1px solid var(--blue);
    border-radius: 0;
    background: var(--blue);
    color: var(--paper);
    font: 700 14px/1.3 "SF Pro Display", sans-serif;
    cursor: pointer;
    transition: background-color 180ms ease, color 180ms ease, opacity 160ms ease;
}

button:disabled { opacity: 0.65; cursor: default; }

form[data-state="submitting"] button,
form[data-state="pending"] button,
form[data-state="complete"] button {
    background: var(--paper);
    border-color: var(--paper);
    color: var(--blue);
    opacity: 1;
}

button svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 1.5;
    transition: transform 180ms ease;
}

@media (hover: hover) {
    button:hover:not(:disabled) { background: var(--cream); color: var(--blue); }
    button:hover:not(:disabled) svg { transform: translateX(3px); }
}

button:active:not(:disabled) svg { transform: translateX(3px); }

input[type="email"]:focus-visible,
button:focus-visible,
.footer-links a:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

.note {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    margin: 16px 0 0;
    text-align: center;
    font-size: 14px;
    line-height: 1.4;
}

.note.error { text-decoration: underline; text-underline-offset: 4px; }
.note.ok { animation: enter-up 240ms ease-out backwards; }

.footer {
    flex: 0 0 auto;
    padding: 0 24px max(24px, env(safe-area-inset-bottom));
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    column-gap: clamp(20px, 3vw, 44px);
}

.footer-links a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--blue);
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    text-underline-offset: 5px;
}

.footer-links a:hover { text-decoration: underline; }

.sr, .hp {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@keyframes logos-rise {
    to { transform: translate3d(0, calc(-2 * var(--logo-row)), 0); }
}

@keyframes logo-rows-flow {
    from { translate: 0 0; }
    to { translate: var(--logo-width) 0; }
}

@keyframes background-enter {
    from { opacity: 0; }
    to { opacity: var(--logo-opacity); }
}

@keyframes enter-up {
    from { opacity: 0; transform: translate3d(0, 18px, 0); }
    to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@media (max-width: 640px) {
    .bg {
        --logo-width: 148px;
        --logo-opacity: 0.7;
        -webkit-mask-image: radial-gradient(ellipse 65% 24% at 50% 50%, transparent 4%, #000 100%);
        mask-image: radial-gradient(ellipse 65% 24% at 50% 50%, transparent 4%, #000 100%);
    }
    .brand { top: 54px; width: 102px; }
    main { padding: 180px 30px 64px; }
    h1 { font-size: clamp(30px, 10.4vw, 64px); letter-spacing: -0.06em; }
    .domain { -webkit-text-stroke-width: 1px; }
    .star { top: -42px; right: 0; }
    form { width: min(360px, 100%); margin-top: 28px; }
    .email-field { gap: 9px; padding-left: 10px; }
    button { gap: 14px; padding-inline: 13px; }
}

@media (max-width: 340px) {
    main { padding-inline: 25px; }
    .email-icon { display: none; }
    button { gap: 8px; padding-inline: 10px; }
}

@media (max-height: 540px) and (min-width: 641px) {
    .brand { top: 35px; width: 85px; }
    main { padding-block: 120px 50px; }
    h1 { font-size: min(8vw, 72px); }
    form { margin-top: 24px; }
    .star { top: -25px; width: 25px; }
}

@media (hover: none), (pointer: coarse) {
    .bg::before,
    .bg::after {
        inset-inline: calc(-1 * var(--logo-width) - 2px);
        animation: logos-rise var(--logo-rise-duration) linear infinite,
            logo-rows-flow 28s linear infinite;
    }
    .bg::after { animation-direction: normal, reverse; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .bg::before, .bg::after { translate: 0 0; }
}
