/* Self-hosted Inter, the design-system's single typeface. Subsets split
   latin / latin-ext by unicode-range (mirrors packages/design-system). */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC,
    U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/inter-latinExt.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}

:root {
  --grad-primary: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  --grad-primary-hover: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
  --primary: #4f46e5;

  --brand-mariana: #081e43;
  --ink: #111827;
  --ink-2: #6b7280;
  --border: #e5e7eb;
  --neutral-light: #f1f5f9;
  --fg-decor: #9ca3af;
  --danger: #d92d20;
  --surface: #ffffff;
  --tint-04: rgba(79, 70, 229, 0.04);

  --radius-md: 8px;
  --radius-xl: 12px;
  --radius-full: 9999px;
  --shadow-8: 0 12px 28px rgba(17, 24, 39, 0.1), 0 2px 6px rgba(17, 24, 39, 0.05);
  --focus-ring: 0 0 0 3px rgba(79, 70, 229, 0.25);
}

* {
  box-sizing: border-box;
}

/* `.step` may set `display`, which (author origin) would beat the UA
   `[hidden]` rule, so the inactive step stays visible without this. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--surface);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Mobile (default): plain white, top-anchored so the on-screen keyboard
   never re-centres the form. Desktop gets the card + wash below. */
.wrap {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0;
  background: var(--surface);
}

.card {
  width: 100%;
  max-width: 100%;
  padding: 3.75rem 1.75rem 2rem;
}

.brand-logo {
  display: block;
  height: 28px;
  width: auto;
  margin-bottom: 1.875rem;
}

h1 {
  margin: 0;
  font-size: 1.5625rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--brand-mariana);
}

.sub {
  margin: 0.625rem 0 0;
  color: var(--ink-2);
  font-size: 0.9375rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-top: 1.75rem;
}

label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink-2);
}

input[type="email"] {
  width: 100%;
  height: 46px;
  padding: 0 0.875rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--ink);
  /* 16px floor: iOS Safari auto-zooms a focused input below 16px. */
  font-size: 1rem;
  font-family: inherit;
  outline: none;
}

input[type="email"]::placeholder {
  color: var(--fg-decor);
}

input[type="email"]:focus-visible {
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}

input[type="email"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Collapses when empty so the field-to-button gap matches the region
   list; only takes space when there's an actual message. */
.error {
  margin: 0;
  color: var(--danger);
  font-size: 0.75rem;
  line-height: 1.4;
}

.error:empty {
  display: none;
}

.error a {
  color: var(--danger);
  text-decoration: underline;
}

.cta {
  width: 100%;
  height: 46px;
  margin-top: 0.625rem;
  padding: 0 1rem;
  background: var(--grad-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
}

.cta:hover:not(:disabled) {
  background: var(--grad-primary-hover);
}

.cta:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.cta:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.region-list {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-top: 1.5rem;
}

.region-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.region-option.is-selected {
  border-color: var(--primary);
  background: var(--tint-04);
}

.region-option:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.region-radio {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--fg-decor);
  border-radius: 50%;
}

.region-option.is-selected .region-radio {
  border-color: var(--primary);
  background:
    radial-gradient(circle, var(--primary) 0 4px, transparent 5px);
}

.region-text {
  flex: 1;
  min-width: 0;
}

.region-label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
}

.region-host {
  margin-top: 2px;
  font-size: 0.78125rem;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.region-code {
  flex: 0 0 auto;
  padding: 0.25rem 0.5625rem;
  background: var(--neutral-light);
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-2);
}

.linkish {
  display: block;
  width: 100%;
  margin-top: 1.125rem;
  padding: 0;
  background: none;
  border: none;
  color: var(--ink-2);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.linkish:hover {
  color: var(--ink);
}

.linkish:focus-visible {
  outline: none;
  border-radius: var(--radius-md);
  box-shadow: var(--focus-ring);
}

.legal {
  margin: 1.5rem 0 0;
  text-align: center;
  color: var(--ink-2);
  font-size: 0.75rem;
  line-height: 1.6;
}

.legal a {
  color: var(--primary);
  text-decoration: none;
}

.legal a:hover {
  text-decoration: underline;
}

@media (min-width: 600px) {
  .wrap {
    align-items: center;
    padding: 1.5rem;
    background: radial-gradient(
      130% 95% at 50% -12%,
      #ece9ff 0%,
      #fafaff 52%,
      #ffffff 100%
    );
  }

  .card {
    width: 408px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-8);
    padding: 2.5rem;
  }

  h1 {
    font-size: 1.875rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  input[type="email"],
  .region-option {
    transition: border-color 0.15s ease, background-color 0.15s ease,
      box-shadow 0.15s ease;
  }
  .cta {
    transition: background 0.15s ease, transform 0.06s ease;
  }
  .cta:active:not(:disabled) {
    transform: translateY(1px);
  }
}
