/* The split entry layout of fi.treat.health's sign-in (apps/web vision-host.css,
   "Public split entry layout"): the brand side on the gradient, one white panel for
   the step. Stacked below 1024px, side by side above. Values follow that file. */

.entry {
  --entry-edge: 28px;
  --entry-panel-inset: 8px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
}

.entry-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 16px;
  height: 64px;
  padding: 0 var(--entry-edge);
}
.entry-logo { height: 28px; width: auto; }

/* The FI / EN / SV switch of fi.treat.health's sign-in (vision.css .vision-signin-language). */
.entry-language {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(16, 32, 29, 0.11);
  border-radius: 999px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.32);
}
.entry-language a {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 10px;
  color: rgba(16, 32, 29, 0.62);
  font: 620 11px "Geist Mono", ui-monospace, monospace;
  letter-spacing: 0.06em;
  text-decoration: none;
}
.entry-language a[aria-current="true"] { color: #10201d; background: rgba(186, 245, 232, 0.48); }
.entry-language a:hover,
.entry-language a:focus-visible { outline: 0; background: rgba(186, 245, 232, 0.3); }
.entry-language a:focus-visible { box-shadow: 0 0 0 2px rgba(0, 126, 115, 0.22); }

.entry-shell {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  row-gap: 24px;
  padding: 0 var(--entry-panel-inset) var(--entry-panel-inset);
}

.entry-brand {
  min-width: 0;
  padding: 16px calc(var(--entry-edge) - var(--entry-panel-inset)) 0;
  text-align: center;
}

/* Weight, tracking and leading follow treat.health's hero h1. */
.entry-brand > h1 {
  max-width: 12.5em;
  margin: 0 auto;
  color: var(--ink);
  font-size: clamp(2.25rem, 1.2rem + 2.6vw, 3.5rem);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.entry-arc { display: none; }

.entry-panel-column {
  min-width: 0;
  display: grid;
  align-content: start;
  justify-items: center;
  border-radius: 24px;
  padding: 24px calc(var(--entry-edge) - var(--entry-panel-inset)) 40px;
  background: var(--surface);
}

.entry-card { width: 100%; display: grid; justify-items: center; }
.entry-card .entry-panel { width: min(100%, 560px); }
.entry-card a.btn { text-decoration: none; }
.entry-step { display: flex; flex-direction: column; gap: 16px; }
.entry-step > .back { align-self: flex-start; margin: -12px 0 -8px -6px; min-height: 44px; }
.entry-step .entry-intro > h2:focus { outline: none; }
/* "or" between the work accounts and the email field, on a hairline. */
.methods-or { display: flex; align-items: center; gap: 12px; margin: 8px 0; text-transform: none; letter-spacing: 0; font-family: var(--sans); font-size: 13px; }
.methods-or::before, .methods-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
/* Code guidance, like Slack's magic-code note: appears the first time the field is focused
   and then stays, so nothing moves under the pointer on the way to the button.
   Always read out with the field (aria-describedby), whether shown or not. */
.methods-hint { display: none; gap: 10px; margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--span-middle); color: var(--muted); font-size: 14px; line-height: 1.45; }
.methods-hint svg { flex: none; width: 18px; height: 18px; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
#email-method[data-hint] .methods-hint, #email-method:has(#email:not(:placeholder-shown)) .methods-hint { display: flex; }

/* Work-account buttons: centred, with an edge firm enough to read as a button (3:1). */
.entry-card .method { justify-content: center; min-height: 56px; border-color: var(--control); }
.entry-card .method:hover { background: color-mix(in srgb, var(--ink) 4%, var(--surface)); }
.entry-card .method-text { align-items: center; }

/* A field's own error, right under it: icon + words, never colour alone. */
.field-error { display: flex; align-items: flex-start; gap: 6px; margin: -8px 0 0; color: #8c1d18; font-size: 14px; line-height: 1.4; }
.field-error svg { flex: none; width: 15px; height: 15px; margin-top: 2px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
/* Greyed after an empty press, until the person types (Slack's pattern); the error says why. */
.entry-card .btn:disabled { opacity: 1; background: #e6e6e7; color: #55585e; box-shadow: none; }
.entry-card .btn:disabled svg { stroke: #55585e; }

.entry-panel {
  width: min(100%, 560px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.entry-intro { text-align: center; margin-bottom: 8px; }
.entry-intro > h2 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.03em;
}
.entry-intro > h2:focus { outline: none; }
.entry-intro > p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
  /* "pretty", not "balance": balance split two-line text into equal halves, breaking early. */
  text-wrap: pretty;
}

.entry-panel form { margin-top: 0; }
.entry-panel .method { background: #fff; }

.entry-footer {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}
.entry-footer p { margin: 0; }

.entry-legal {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}
.entry-legal a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.entry-legal a:hover { color: var(--ink); }
.entry-footer .link { font-size: 14px; }

@media (min-width: 1024px) {
  .entry {
    --entry-edge: 64px;
    --entry-panel-inset: 12px;
    display: block;
    position: relative;
  }

  /* The wordmark sits on the gradient, as on fi.treat.health. */
  .entry-header {
    position: absolute;
    top: calc(var(--entry-panel-inset) + 24px);
    right: 0;
    left: 0;
    height: 52px;
    padding-right: calc(var(--entry-panel-inset) + 24px);
    z-index: 1;
  }

  .entry-shell {
    min-height: 100dvh;
    grid-template-columns: minmax(0, 1fr) clamp(460px, 46vw, 720px);
    grid-template-rows: none;
    padding: var(--entry-panel-inset) var(--entry-panel-inset) var(--entry-panel-inset) 0;
  }

  .entry-brand {
    height: calc(100dvh - 2 * var(--entry-panel-inset));
    display: flex;
    flex-direction: column;
    justify-content: safe center;
    padding: 96px 48px 32px var(--entry-edge);
    text-align: start;
  }
  .entry-brand > h1 { max-width: 600px; margin: 0; }

  /* Graphic above the headline (visual order only), fading at top and bottom. */
  .entry-arc {
    position: relative;
    order: -1;
    flex: 0 1 472px;
    min-height: 200px;
    display: block;
    width: calc(100% + var(--entry-edge) + 48px);
    margin: 0 0 32px calc(-1 * var(--entry-edge));
    overflow: hidden;
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 16%, #000 84%, transparent 100%);
    mask-image: linear-gradient(180deg, transparent 0, #000 16%, #000 84%, transparent 100%);
  }

  .entry-panel-column {
    min-height: calc(100dvh - 2 * var(--entry-panel-inset));
    align-content: center;
    padding: 96px 48px 48px;
  }

  .entry-card .entry-panel { width: min(100%, 440px); }
}

/* The treat.health hero arc, as on fi.treat.health's sign-in: a 700 x 1020 design box
   (circle centre -380,510, radius 510) at 0.8 scale, the focused topic on --entry-edge.
   Topics step up the arc in a 15.6s loop of six 2.6s steps. Wide layouts only. */
.entry { --entry-arc-step: 2.6s; --entry-glass-soft: rgba(255, 255, 255, 0.6); }

.entry-arc-stage {
  position: absolute;
  top: 50%;
  left: 0;
  width: 700px;
  height: 1020px;
  transform-origin: 0 0;
  transform: translateX(calc(var(--entry-edge) - 126.4px)) scale(0.8) translateY(-507px);
}
.entry-arc-line { position: absolute; top: 0; left: -890px; width: 1020px; height: 1020px; border: 1.5px solid var(--control); border-radius: 50%; }
.entry-arc-dot { position: absolute; top: 501px; left: 121px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink); }
.entry-arc-stage > ul { margin: 0; padding: 0; list-style: none; }
.entry-arc-stage li {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.2;
  letter-spacing: -0.015em;
  white-space: nowrap;
  transform-origin: 0 50%;
}
.entry-arc-stage li > span { border-radius: 22px; padding: 10px 18px; }
.entry-arc-stage li > i {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 73px;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 29px;
  background: var(--entry-glass-soft);
}
.entry-arc-stage li > i > img { width: 23px; height: 23px; }

.entry-arc-stage li[data-slot="hidden"] { --entry-arc-phase: 5; opacity: 0; transform: translate(-12px, 861px) scale(0.7); }
.entry-arc-stage li[data-slot="far-bottom"] { --entry-arc-phase: 0; opacity: 0.5; transform: translate(86px, 742px) scale(0.842); }
.entry-arc-stage li[data-slot="near-bottom"] { --entry-arc-phase: 1; opacity: 0.8; transform: translate(140px, 614px); }
.entry-arc-stage li[data-slot="active"] { --entry-arc-phase: 2; color: var(--ink); transform: translate(158px, 481px) scale(1.158); }
.entry-arc-stage li[data-slot="near-top"] { --entry-arc-phase: 3; opacity: 0.8; transform: translate(140px, 348px); }
.entry-arc-stage li[data-slot="far-top"] { --entry-arc-phase: 4; opacity: 0.5; transform: translate(86px, 220px) scale(0.842); }
.entry-arc-stage li[data-slot="active"] > :is(span, i) { background: var(--surface); box-shadow: 0 8px 24px rgba(15, 16, 18, 0.08); }
.entry-arc-stage li[data-slot="active"] > span { font-weight: 500; }

@media (prefers-reduced-motion: no-preference) {
  .entry-arc-stage li,
  .entry-arc-stage li > span,
  .entry-arc-stage li > i {
    animation-duration: calc(var(--entry-arc-step) * 6);
    animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1);
    animation-iteration-count: infinite;
    animation-delay: calc(var(--entry-arc-phase) * var(--entry-arc-step) * -1 - 0.6s);
  }
  .entry-arc-stage li { animation-name: entry-arc-orbit; }
  .entry-arc-stage li > span { animation-name: entry-arc-label; }
  .entry-arc-stage li > i { animation-name: entry-arc-tile; }
}

@keyframes entry-arc-orbit {
  0% { opacity: 0; color: var(--muted); transform: translate(-12px, 861px) scale(0.7); }
  3.846%, 16.667% { opacity: 0.5; color: var(--muted); transform: translate(86px, 742px) scale(0.842); }
  20.513%, 33.333% { opacity: 0.8; color: var(--muted); transform: translate(140px, 614px) scale(1); }
  37.179%, 50% { opacity: 1; color: var(--ink); transform: translate(158px, 481px) scale(1.158); }
  53.846%, 66.667% { opacity: 0.8; color: var(--muted); transform: translate(140px, 348px) scale(1); }
  70.513%, 83.333% { opacity: 0.5; color: var(--muted); transform: translate(86px, 220px) scale(0.842); }
  87.179%, 95% { opacity: 0; color: var(--muted); transform: translate(-12px, 101px) scale(0.7); }
  95.1%, 100% { opacity: 0; color: var(--muted); transform: translate(-12px, 861px) scale(0.7); }
}
@keyframes entry-arc-label {
  0%, 33.333%, 53.846%, 100% { background: transparent; box-shadow: none; }
  37.179%, 50% { background: var(--surface); box-shadow: 0 8px 24px rgba(15, 16, 18, 0.08); }
}
@keyframes entry-arc-tile {
  0%, 33.333%, 53.846%, 100% { background: var(--entry-glass-soft); box-shadow: none; }
  37.179%, 50% { background: var(--surface); box-shadow: 0 8px 24px rgba(15, 16, 18, 0.08); }
}

/* Country combobox: flag beside the text, flags in the list. */
.combo-flag { position: absolute; left: 16px; top: 50%; width: 24px; height: 16px; transform: translateY(-50%); border-radius: 2px; box-shadow: 0 0 0 1px var(--line); pointer-events: none; }
.combo-box:has(.combo-flag:not([hidden])) input { padding-left: 52px; }
.country-option { flex-direction: row !important; align-items: center; gap: 12px !important; }
.country-option img { flex: none; width: 24px; height: 16px; border-radius: 2px; box-shadow: 0 0 0 1px var(--line); }
.country-option[aria-selected="true"] { background: var(--brand-subtle); }


/* Sign-in methods before a country of residence is chosen. */
.methods[data-waiting] .method,
.methods[data-waiting] .btn,
.methods[data-waiting] input { opacity: 0.45; cursor: not-allowed; }
.methods[data-waiting] .methods-or, .methods[data-waiting] .field-label { opacity: 0.55; }
.country-suggested { margin-bottom: 6px; box-shadow: 0 1px 0 var(--line); border-radius: 8px 8px 0 0; }

/* The emailed 6-digit code: one wide, spaced field (and the one Safari fills from Mail). */
.code-input { font: 500 24px/1 var(--mono); letter-spacing: 0.4em; text-align: center; }

/* Eligibility result badge: icon + word, never colour alone. */
.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 14px;
  padding: 6px 12px 6px 10px;
  border-radius: 999px;
  font: 500 13px/1 var(--sans);
}
.result-badge svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.result-badge.ok { background: var(--ok-bg); color: var(--ok-ink); }
.result-badge.wait { background: var(--warn-bg); color: var(--warn-ink); }
.result-badge.wait::before { content: ""; width: 12px; height: 12px; border: 2px solid currentColor; border-radius: 50%; box-sizing: border-box; }
.entry-panel > .entry-step { gap: 16px; }

/* Every button in the card: label and arrow centred together. */
.entry-card .btn { justify-content: center; gap: 8px; }


/* ---- One view (default; ?layout=steps for the earlier two steps) -----------------------
   Country and work email on one view, compact like Slack's sign-in: country, work email,
   Continue, then "or continue with" and the two work accounts side by side. */
#join-form[data-layout="single"] .entry-step[hidden] { display: flex !important; }
#join-form[data-layout="single"] #country-continue,
#join-form[data-layout="single"] #change-country,
#join-form[data-layout="single"] #step-verify > .entry-intro { display: none; }
#join-form[data-layout="single"] .entry-step { gap: 16px; }
#join-form[data-layout="single"] #step-verify { margin-top: 0; }
#join-form[data-layout="single"] { display: flex; flex-direction: column; gap: 16px; }
/* Email first, work accounts after: the email block's parts join the methods row-wrap. */
#join-form[data-layout="single"] #methods { flex-flow: row wrap; gap: 10px; }
#join-form[data-layout="single"] #methods > * { flex: 1 1 100%; }
#join-form[data-layout="single"] #email-method { display: contents; }
#join-form[data-layout="single"] #email-method > * { flex: 1 1 100%; }
#join-form[data-layout="single"] #consent-choice { order: 0; }
#join-form[data-layout="single"] #email-method > .field { order: 1; }
#join-form[data-layout="single"] #email-error { order: 2; margin: -2px 0 0; }
#join-form[data-layout="single"] #email-hint { order: 3; }
#join-form[data-layout="single"] #turnstile { order: 4; }
#join-form[data-layout="single"] #join-submit { order: 5; }
#join-form[data-layout="single"] #email-method > .methods-or { order: 6; margin: 6px 0 2px; }
#join-form[data-layout="single"] #methods > [data-provider] { order: 7; flex: 1 1 calc(50% - 5px); min-height: 48px; padding: 10px 12px; gap: 10px; }
#join-form[data-layout="single"] [data-provider] .method-label { font-size: 15px; }
