/* Pages of the identity service, "Spine" look: dark graphite, one lime accent for the primary action and the active language, blue as the
   second colour. No inline style, nothing from another host (CSP `style-src 'self'; font-src 'self'`): Inter and Space Grotesk are
   self-hosted variable fonts (SIL OFL 1.1, licence files beside the fonts). The font paths below are rewritten to hashed public paths by assets.ts. */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(/assets/inter-latin-ext.NLnFBMq3pz43.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; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(/assets/inter-latin.MQDndehhbNJh.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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 300 700; font-display: swap; src: url(/assets/space-grotesk-latin-ext.lS3dtF0vlvcc.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; }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 300 700; font-display: swap; src: url(/assets/space-grotesk-latin.BkCJBHb8EZir.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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #0a0b10; --glow: #141a2e; --card: #12141c; --card-line: #23273a; --field: #0e1017; --raised: #1a1d29;
  --text: #f2f4f8; --soft: #dde2ec; --muted: #a9b2c3; --faint: #8e98aa; --placeholder: #7a8499;
  --line: #2a2f3d; --option-bg: #161a26; --edge: #4a5168; --field-line: #5e6785;
  --accent: #c8ff3d; --accent-hover: #e4ff9a; --on-accent: #0a0b10; --blue: #4d7cff;
  --danger: #ff7b72; --ok: #56d364;
  --head: "Space Grotesk", Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--bg); font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 16px; line-height: 1.5; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; color: var(--text); background: radial-gradient(900px 600px at 50% 20%, var(--glow) 0%, var(--bg) 65%); }
h1, h2, h3, p { margin: 0; }
p { margin-bottom: 12px; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
input:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---- page frame: brand, language switch, card, trust line ---- */
.stage {
  min-height: 100vh; display: grid; align-items: start;
  grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto 1fr auto;
  grid-template-areas: "brand lang" "hero hero" "panel panel" "trust trust";
  padding: 40px 24px 24px; row-gap: 20px;
}
.brand { grid-area: brand; display: flex; align-items: center; gap: 10px; }
.logo { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 3px; flex: none; }
.logo i { display: block; width: 14px; height: 3px; border-radius: 2px; background: var(--on-accent); }
.logo i:nth-child(2) { width: 10px; }
.word { font-family: var(--head); font-weight: 700; font-size: 21px; letter-spacing: -0.5px; line-height: 1; }

.lang { grid-area: lang; display: flex; gap: 4px; justify-self: end; }
.lang a {
  min-width: 44px; height: 44px; padding: 0 10px; border-radius: 22px; border: 1px solid var(--edge); color: var(--soft); text-decoration: none;
  font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center;
}
.lang a:hover { border-color: var(--soft); color: var(--text); }
.lang a[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }

.panel { grid-area: panel; width: 100%; max-width: 480px; justify-self: center; }
.content { display: flex; flex-direction: column; }
.title { font-family: var(--head); font-size: 32px; font-weight: 700; letter-spacing: -1px; line-height: 1.1; margin-bottom: 10px; }
.sub { color: var(--muted); font-size: 15px; margin-bottom: 20px; }
.panel > .content > p:not(.message) { color: var(--muted); }
.message { color: var(--text); }

.trust { grid-area: trust; align-self: end; display: flex; flex-wrap: wrap; gap: 4px 20px; color: var(--faint); font-size: 13px; }

/* the hero: wide screens only (sign-in and invitation), and a short headline on phones (sign-in) */
.hero { grid-area: hero; display: none; }
.hero-title { font-family: var(--head); font-weight: 700; margin: 0; }
.hero-title span { display: block; }
.hero-sub { color: var(--muted); }
.hero-kicker { font-size: 13px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--accent); margin-bottom: 20px; }
.hero-short { display: block; margin-top: 12px; }
.hero-wide { display: none; }
.spine { display: flex; flex-direction: column; gap: 14px; }
.v { display: block; width: 72px; height: 10px; border-radius: 5px; animation: vert 6s ease-in-out infinite; }
.v:nth-child(even) { width: 56px; margin-left: 8px; }
.v:nth-child(1), .v:nth-child(7), .v:nth-child(4) { background: var(--accent); }
.v:nth-child(2), .v:nth-child(5), .v:nth-child(8) { background: var(--blue); }
.v:nth-child(3), .v:nth-child(6) { background: var(--line); }
.v:nth-child(2) { animation-delay: 0.15s; } .v:nth-child(3) { animation-delay: 0.3s; } .v:nth-child(4) { animation-delay: 0.45s; }
.v:nth-child(5) { animation-delay: 0.6s; } .v:nth-child(6) { animation-delay: 0.75s; } .v:nth-child(7) { animation-delay: 0.9s; } .v:nth-child(8) { animation-delay: 1.05s; }
@keyframes vert { 0%, 100% { transform: translateX(0); opacity: 0.6; } 50% { transform: translateX(6px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .v { animation: none; opacity: 1; } }

/* sign-in: the hero headline replaces the card title on phones */
.stage[data-shell="sign-in"] .hero { display: block; }
.stage[data-shell="sign-in"] .title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); margin: -1px; }
.stage[data-shell="sign-in"] .sub { display: none; }
.stage[data-shell="sign-in"] .hero-title { font-size: 36px; line-height: 1.05; letter-spacing: -1px; }
.stage[data-shell="sign-in"] .hero-sub { font-size: 15px; margin-top: 8px; }
.stage[data-shell="sign-in"] .spine { display: none; }
.stage[data-shell="card"] { grid-template-rows: auto 1fr auto; grid-template-areas: "brand lang" "panel panel" "trust trust"; }

/* cards from 640 px */
@media (min-width: 640px) {
  .stage { padding: 40px 56px 32px; }
  .logo { width: 36px; height: 36px; border-radius: 10px; gap: 3px; }
  .logo i { width: 16px; height: 4px; }
  .logo i:nth-child(2) { width: 11px; }
  .word { font-size: 24px; }
  .lang a { height: 36px; min-width: 44px; }
  .panel { background: var(--card); border: 1px solid var(--card-line); border-radius: 28px; padding: 44px 48px; }
  .stage[data-shell="sign-in"] .panel { margin-top: 12px; }
  .stage[data-shell="sign-in"] .hero { width: 100%; max-width: 480px; justify-self: center; }
}
@media (min-width: 640px) and (hover: none) { .lang a { height: 44px; } }

/* wide screens: hero on the left, the card as a full-height panel on the right (sign-in, invitation) */
@media (min-width: 1000px) {
  .stage[data-shell="sign-in"], .stage[data-shell="invite"] { padding: 0; row-gap: 0; align-items: stretch; grid-template-rows: auto 1fr auto; }
  .stage[data-shell="sign-in"] { grid-template-columns: minmax(0, 1fr) 520px; }
  .stage[data-shell="invite"] { grid-template-columns: 460px minmax(0, 1fr); }
  .stage[data-shell="sign-in"], .stage[data-shell="invite"] { grid-template-areas: "brand panel" "hero panel" "trust panel"; }
  .stage[data-shell="sign-in"] .brand, .stage[data-shell="invite"] .brand { padding: 48px 56px 0; align-self: start; }
  .stage[data-shell="sign-in"] .hero, .stage[data-shell="invite"] .hero { padding: 0 56px; align-self: center; max-width: none; justify-self: stretch; }
  .stage[data-shell="sign-in"] .trust, .stage[data-shell="invite"] .trust { padding: 0 56px 48px; }
  .stage[data-shell="invite"] .hero { display: block; }
  .stage[data-shell="sign-in"] .panel, .stage[data-shell="invite"] .panel {
    grid-row: 1 / 4; max-width: none; margin: 24px 24px 24px 0; justify-self: stretch; padding: 96px 48px 40px; display: flex; flex-direction: column; justify-content: center;
  }
  .stage[data-shell="sign-in"] .panel { margin-top: 24px; }
  .stage[data-shell="sign-in"] .lang, .stage[data-shell="invite"] .lang { grid-area: 1 / 2; align-self: start; margin: 56px 72px 0 0; z-index: 1; }
  .stage[data-shell="sign-in"] .title { position: static; width: auto; height: auto; overflow: visible; clip: auto; margin: 0 0 8px; }
  .stage[data-shell="sign-in"] .sub { display: block; }
  .stage[data-shell="sign-in"] .title { font-size: 36px; }
  .stage[data-shell="sign-in"] .sub { margin-bottom: 22px; }
  .stage[data-shell="sign-in"] .hero { display: flex; gap: 48px; align-items: center; }
  .stage[data-shell="sign-in"] .spine { display: flex; flex: none; }
  .stage[data-shell="sign-in"] .hero-title { font-size: 64px; line-height: 1.02; letter-spacing: -2px; }
  .stage[data-shell="sign-in"] .hero-sub { font-size: 18px; line-height: 1.5; max-width: 420px; margin-top: 20px; }
  .stage[data-shell="sign-in"] .hero-short { display: none; }
  .stage[data-shell="sign-in"] .hero-wide { display: block; }
  .stage[data-shell="invite"] .hero-title { font-size: 48px; line-height: 1.05; letter-spacing: -1.5px; }
  .stage[data-shell="invite"] .hero-sub { font-size: 16px; line-height: 1.55; margin-top: 20px; max-width: 340px; }
  .trust { gap: 4px 12px; }
  .trust span + span::before { content: "·"; margin-right: 12px; }
  .stage[data-shell="sign-in"] .trust, .stage[data-shell="invite"] .trust { flex-wrap: wrap; }
}

/* the other pages: a centred card under the brand */
@media (min-width: 640px) {
  .stage[data-shell="card"] { grid-template-columns: minmax(0, 1fr) minmax(0, 480px) minmax(0, 1fr); grid-template-rows: auto 1fr auto; grid-template-areas: "brand . lang" ". panel ." "trust trust trust"; align-items: center; padding: 40px 56px 32px; row-gap: 0; }
  .stage[data-shell="card"] .brand { align-self: start; }
  .stage[data-shell="card"] .lang { align-self: start; }
  .stage[data-shell="card"] .panel { margin: 24px 0; }
  .stage[data-shell="card"] .trust { justify-content: center; }
}

/* ---- content ---- */
.stack { display: flex; flex-direction: column; gap: 14px; margin-bottom: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--soft); }
label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; cursor: pointer; }
label.check input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
input[type="email"], input[type="password"], input:not([type]), input[inputmode] {
  font: inherit; font-size: 16px; font-weight: 400; height: 50px; padding: 0 16px; border: 1px solid var(--field-line); border-radius: 12px; background: var(--field); color: var(--text); width: 100%;
}
input::placeholder { color: var(--placeholder); opacity: 1; }
input:focus-visible { border-color: var(--accent); }
input.otp { height: 64px; border-radius: 14px; font-family: var(--head); font-size: 30px; font-weight: 600; letter-spacing: 14px; text-align: center; padding: 0 0 0 14px; }
input.otp::placeholder { letter-spacing: 14px; }

button, a.button {
  font: inherit; font-size: 15px; font-weight: 600; min-height: 50px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--edge); background: var(--raised); color: var(--text);
  cursor: pointer; text-align: center; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
}
button:hover, a.button:hover { border-color: var(--soft); color: var(--text); }
button.primary, a.button { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; min-height: 54px; font-size: 16px; }
button.primary:hover, a.button:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
button.light { background: var(--text); border-color: var(--text); color: var(--on-accent); font-weight: 700; border-radius: 12px; }
button.light:hover { background: #fff; border-color: #fff; color: var(--on-accent); }
button.outline { background: transparent; border-color: var(--text); font-weight: 700; border-radius: 12px; }
button.danger { color: var(--danger); }
button.link { border: none; background: none; padding: 0 6px; min-height: 44px; font-weight: 500; color: var(--accent); }
button.link:hover { color: var(--accent-hover); border: none; }
button.link.danger { color: var(--danger); }
button:disabled { opacity: 0.6; cursor: progress; }
.stack > button.primary, .stack > button.light { width: 100%; }
#passkey-button.primary { min-height: 56px; border-radius: 16px; }
.provider { min-height: 56px; border-radius: 16px; font-size: 16px; width: 100%; }

.hint { color: var(--faint); font-size: 13px; line-height: 1.5; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 13px; margin: 8px 0 22px; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.links { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 16px; margin: 8px 0 0; font-size: 14px; }
.links a { display: inline-flex; align-items: center; min-height: 44px; }
.links a.button { font-size: 16px; }
.forgot { display: flex; justify-content: flex-end; margin: -4px 0 0; }
.message { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); font-size: 14px; margin-bottom: 14px; }
.message.error { border-color: var(--danger); color: var(--danger); }
.message.ok { border-color: var(--ok); color: var(--ok); }
.option { border: 1px solid var(--line); border-radius: 20px; background: var(--card); padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.option h2 { font-size: 18px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.option .hint { font-size: 14px; color: var(--muted); }
.option.recommended { border: 2px solid var(--accent); background: var(--option-bg); }
.badge { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 10px; background: var(--accent); color: var(--on-accent); }
.options { display: grid; grid-template-columns: 1fr; gap: 16px; }
.block { border-top: 1px solid var(--line); padding-top: 20px; margin-top: 20px; }
.block h2, .content > section > h2 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.list { list-style: none; padding: 0; margin: 0 0 12px; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.list small { display: block; color: var(--faint); }
.codes { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; columns: 2; padding-left: 24px; margin: 0 0 14px; }
code.secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; color: var(--text); }
canvas#qr { align-self: center; background: #fff; border-radius: 12px; padding: 8px; width: 232px; height: 232px; }
details { margin-top: 8px; }
details summary { cursor: pointer; color: var(--accent); min-height: 44px; display: flex; align-items: center; font-size: 14px; }
details summary:hover { color: var(--accent-hover); }

@media (min-width: 1000px) {
  .stage[data-shell="invite"] .options { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 639px) {
  .panel { padding: 0; }
  .stack { gap: 12px; }
  .title { font-size: 30px; }
  .codes { columns: 1; }
}
