/* =========================================================================
   Login: two halves. Reading-start side: the next event's hall in 3D with
   floating figures. Other side: a rounded panel where one card hangs on a
   lanyard, logo side out; it flips over to the sign-in form.
   Colours invert by theme: light = softly tinted panel + dark card,
   dark = black panel + white card. Class prefix lg-; grid columns follow
   dir, so Arabic mirrors for free.
   ========================================================================= */
body.signed-out :is(.shell, #drawer, #drawer-scrim, #spot) { display: none; }
#login[hidden] { display: none; }
#login {
  --lg-strap-w: 22px; --lg-w: 380px; --lg-h: 600px; --s: 1; --L: clamp(36px, 9vh, 96px);
  --lg-panel: color-mix(in oklab, var(--accent) 7%, #EEF0F5); --lg-on: #0B1020; --lg-on-2: rgba(11, 16, 32, .58); --lg-chip: rgba(255, 255, 255, .62); --lg-chip-line: rgba(11, 16, 32, .12);
  min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1fr 1fr;
  background: var(--lg-panel); transition: opacity .45s ease;
}
:root[data-theme="dark"] #login { --lg-panel: #000; --lg-on: #fff; --lg-on-2: rgba(255, 255, 255, .5); --lg-chip: rgba(255, 255, 255, .05); --lg-chip-line: rgba(255, 255, 255, .14); }
#login.lg-leaving { opacity: 0; pointer-events: none; }
#login.lg-nodrop .lg-hang, #login.lg-nodrop .iso.rise .iso-booth { animation: none; }

/* ---------- the 3D half: a rounded tile sitting on the card panel's colour ---------- */
.lg-world { position: relative; overflow: hidden; isolation: isolate; display: flex; flex-direction: column; min-width: 0;
  margin: 12px; margin-inline-end: 0; border-radius: var(--r-xl); border: 1px solid rgba(11, 16, 32, .06); box-shadow: 0 30px 60px -40px rgba(11, 16, 32, .35);
  background: radial-gradient(60% 50% at 50% 48%, color-mix(in oklab, var(--accent) 14%, transparent), transparent 70%), #F8F9FC; }
:root[data-theme="dark"] .lg-world { background: radial-gradient(60% 50% at 50% 48%, color-mix(in oklab, var(--accent) 30%, transparent), transparent 70%), #0B1124; border-color: rgba(255, 255, 255, .07); box-shadow: none; color: #fff; }
.lg-top { position: relative; z-index: 3; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: clamp(20px, 3vw, 36px) clamp(20px, 3.4vw, 48px) 0; }
.lg-mark { display: flex; align-items: center; gap: 10px; font-size: 17px; }
.lg-tools { display: flex; gap: 8px; }
:root[data-theme="dark"] .lg-world .icon-btn { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .12); color: #fff; }

.lg-scene { position: relative; flex: 1; min-height: 340px; perspective: 1400px; display: grid; place-items: center; }
.lg-tilt { position: relative; width: min(92%, 680px); aspect-ratio: 1.45; transform-style: preserve-3d;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .6s var(--spring); animation: lg-float 7s ease-in-out infinite; }
@keyframes lg-float { 50% { translate: 0 -10px; } }
.lg-plan { position: absolute; inset: 0; display: grid; place-items: center; transform: translateZ(0); }
.lg-plan .iso { width: 100%; height: auto; filter: drop-shadow(0 40px 50px rgba(11, 16, 32, .28)); }
:root[data-theme="dark"] .lg-plan .iso { filter: drop-shadow(0 40px 60px rgba(0, 0, 0, .6)); }
.lg-chip { position: absolute; left: var(--x); top: var(--y); transform: translateZ(calc(var(--z) * 1px)); display: flex; flex-direction: column; gap: 1px; padding: 10px 14px; border-radius: 14px;
  background: color-mix(in oklab, var(--surface-solid) 72%, transparent); backdrop-filter: blur(14px) saturate(160%); -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid color-mix(in oklab, var(--ink) 10%, transparent); box-shadow: 0 18px 40px -16px rgba(11, 16, 32, .35); color: var(--ink); }
:root[data-theme="dark"] .lg-chip { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .14); color: #fff; }
.lg-chip b { font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.lg-chip small { font-size: 12.5px; opacity: .7; }
[dir="rtl"] .lg-chip { left: auto; right: var(--x); }

.lg-story { position: relative; z-index: 2; padding: 0 clamp(20px, 3.4vw, 48px) clamp(24px, 4vh, 44px); max-width: 560px; }
.lg-kicker { color: var(--ink-3); font-size: 13.5px; margin: 0 0 8px; }
.lg-story .lg-head { font-size: clamp(26px, 2.4vw, 36px); line-height: 1.1; font-weight: 700; letter-spacing: -.025em; margin: 0 0 10px; }
.lg-story p:last-child { color: var(--ink-2); font-size: 15.5px; margin: 0; max-width: 46ch; }
:root[data-theme="dark"] .lg-story :is(.lg-kicker, p:last-child) { color: rgba(255, 255, 255, .66); }

/* ---------- the card panel: full bleed; colours invert with the theme (tokens on #login) ---------- */
.lg-dark {
  position: relative; color: var(--lg-on); display: flex; flex-direction: column; align-items: center; overflow: hidden; isolation: isolate;
  background: radial-gradient(70% 45% at 50% 38%, color-mix(in oklab, var(--accent) 14%, transparent), transparent 75%), var(--lg-panel);
  padding-top: calc(var(--L) + 14px + var(--lg-h) * var(--s) + 26px); padding-bottom: 24px; }
:root[data-theme="dark"] .lg-dark { background: #000; }

.lg-hang { position: absolute; top: 0; left: 50%; width: calc(var(--lg-w) * var(--s)); margin-left: calc(var(--lg-w) * var(--s) / -2); perspective: 1600px; animation: lg-drop 1.1s var(--spring) .15s backwards; }
@keyframes lg-drop { from { translate: 0 -110vh; } }
.lg-pend { position: absolute; top: 0; inset-inline: 0; transform-origin: 50% 0; transform-style: preserve-3d; will-change: transform; }
.lg-strap { position: absolute; top: 0; left: 50%; margin-left: calc(var(--lg-strap-w) / -2); width: var(--lg-strap-w); height: var(--L); transform-origin: 50% 0; transform: scaleY(var(--sy, 1));
  background: repeating-linear-gradient(90deg, var(--accent) 0 3px, color-mix(in oklab, var(--accent) 75%, #000) 3px 4px); }
.lg-clip { position: absolute; top: calc(var(--L) - 3px); left: 50%; margin-left: -17px; width: 34px; height: 22px; border-radius: 6px; background: linear-gradient(#F2F3F6, #A6ACB8); box-shadow: inset 0 1px 0 #fff, 0 2px 3px rgba(0, 0, 0, .4); transform: translateY(var(--p, 0px)); z-index: 1; }

/* the card: dark in light mode, white in dark mode */
.lg-card { position: absolute; top: calc(var(--L) + 14px); left: 50%; width: var(--lg-w); height: var(--lg-h); margin-left: calc(var(--lg-w) / -2); transform-origin: 50% 0; transform-style: preserve-3d;
  translate: 0 var(--p, 0px); transform: scale(var(--s)); transition: transform .75s var(--spring);
  color-scheme: dark; --lg-card: #0E1220; --surface-solid: #171C2C; --surface-2: #1B2133; --ink: #F3F5F9; --ink-2: #C5CBD8; --ink-3: #8E96A9; --line: rgba(255, 255, 255, .14); --line-2: rgba(255, 255, 255, .07); --bad: #FF8A8A; --ok: #3FD19A;
  --lg-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 50px 80px -30px rgba(11, 16, 32, .55), 0 18px 34px -16px rgba(11, 16, 32, .4);
  color: var(--ink); }
:root[data-theme="dark"] .lg-card { color-scheme: light; --lg-card: #fff; --surface-solid: #fff; --surface-2: #F3F4F7; --ink: #0B1020; --ink-2: #3B4356; --ink-3: #697184; --line: rgba(11, 16, 32, .14); --line-2: rgba(11, 16, 32, .06); --bad: #C93B3B; --ok: #188A5D;
  --lg-shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 50px 90px -30px rgba(255, 255, 255, .12), 0 30px 60px -20px rgba(0, 0, 0, .9); }
.lg-card.lg-open { transform: scale(var(--s)) rotateY(180deg); }

.lg-face { position: absolute; inset: 0; border-radius: 24px; background: var(--lg-card); overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  box-shadow: var(--lg-shadow); cursor: grab; touch-action: pan-y; }
.lg-face:active { cursor: grabbing; }
.lg-slot { position: absolute; top: 14px; left: 50%; width: 54px; height: 9px; margin-left: -27px; border-radius: 99px; background: var(--lg-panel); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .45); z-index: 1; }

/* logo side */
.lg-cover { display: flex; flex-direction: column; align-items: center; text-align: center; border: 0; padding: 0; font: inherit; color: inherit; user-select: none; -webkit-user-select: none; }
.lg-cover:focus-visible { outline: 3px solid var(--accent); outline-offset: 5px; }
.lg-logo { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: auto; padding: 18px 40px 6px;
  background: radial-gradient(closest-side, var(--lg-card) 62%, transparent); }
/* embossed booth linework: a light line and a dark line offset by 1px read as pressed into the card */
.lg-lines { position: absolute; inset: 0 0 auto; width: 100%; height: 330px; fill: none; stroke: color-mix(in oklab, var(--ink) 7%, transparent); stroke-width: 1.2;
  filter: drop-shadow(0 1px 0 color-mix(in oklab, var(--lg-card) 60%, #000 40%)) drop-shadow(0 -1px 0 color-mix(in oklab, var(--ink) 6%, transparent));
  -webkit-mask: linear-gradient(#000 40%, transparent); mask: linear-gradient(#000 40%, transparent); }
/* holographic foil: the rainbow slides as the card swings and leans */
.lg-holo { position: absolute; top: 34px; inset-inline-end: 24px; width: 46px; height: 58px; border-radius: 9px; overflow: hidden; z-index: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35), 0 2px 6px rgba(0, 0, 0, .25); }
.lg-holo i { position: absolute; inset: -60% -120%;
  background: linear-gradient(115deg, #9cf 0%, #c9f 14%, #f9c 28%, #fd9 42%, #9fc 56%, #9cf 70%, #c9f 84%, #f9c 100%);
  transform: translateX(calc(var(--sheen, 0) * 38%)) rotate(8deg); transition: transform .12s linear; opacity: .9; }
.lg-holo::after { content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .28) 0 1px, transparent 1px 4px), radial-gradient(circle at 50% 46%, transparent 9px, rgba(255, 255, 255, .5) 10px 11px, transparent 12px); mix-blend-mode: overlay; }
.lg-logo .brand-mark { width: 84px; height: 84px; border-radius: 24px; font-size: 38px; margin-bottom: 10px; box-shadow: 0 18px 36px -14px color-mix(in oklab, var(--accent) 80%, transparent); }
.lg-logo b { font-size: 30px; font-weight: 700; letter-spacing: -.025em; line-height: 1.1; }
.lg-logo small { color: var(--ink-3); font-size: 13.5px; }
.lg-meta { display: grid; grid-template-columns: repeat(3, 1fr); align-self: stretch; margin: 0 28px 22px; padding-top: 14px; border-top: 1px solid var(--line-2); text-align: start; }
.lg-meta span { display: flex; flex-direction: column; gap: 2px; }
.lg-meta span + span { padding-inline-start: 14px; border-inline-start: 1px solid var(--line-2); }
.lg-meta small { color: var(--ink-3); font-size: 11.5px; }
.lg-meta b { font-size: 14px; font-weight: 600; }
.lg-tap { position: relative; z-index: 1; margin: 22px 0 auto; padding: 8px 16px; border-radius: 99px; border: 1px solid var(--line); color: var(--ink-2); font-size: 13.5px; font-weight: 600; transition: border-color .2s, color .2s, background .2s; }
.lg-cover:hover .lg-tap { border-color: var(--accent); color: var(--ink); background: color-mix(in oklab, var(--accent) 12%, transparent); }
.lg-bar { position: relative; align-self: stretch; margin-top: auto; padding: 22px 28px 24px; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 9px; }
.lg-bar::before { content: ''; position: absolute; top: -2px; inset-inline: 28px; height: 3px; border-radius: 3px; opacity: .85;
  background: linear-gradient(90deg, #9cf, #c9f, #f9c, #fd9, #9fc, #9cf) calc(50% + var(--sheen, 0) * 120px) 0 / 200% 100%; }
.lg-bar i { display: block; height: 80px;
  background: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 4px, var(--ink) 4px 7px, transparent 7px 9px, var(--ink) 9px 10px, transparent 10px 13px, var(--ink) 13px 16px, transparent 16px 17px, var(--ink) 17px 18px, transparent 18px 21px, var(--ink) 21px 22px, transparent 22px 25px); }
.lg-bar small { color: var(--ink-3); font-size: 12px; letter-spacing: .32em; }

/* form side */
.lg-back { transform: rotateY(180deg); }
.lg-close { position: absolute; top: 12px; inset-inline-end: 12px; z-index: 2; width: 34px; height: 34px; border-radius: 50%; border: 0; display: grid; place-items: center; background: transparent; color: var(--ink-3); cursor: pointer; transition: background .15s, color .15s; }
.lg-close:hover { background: var(--line-2); color: var(--ink); }
.lg-close svg { width: 17px; height: 17px; }
.lg-inner { height: 100%; transition: transform .17s cubic-bezier(.4, 0, .6, 1); }
.lg-inner.lg-turning { transform: rotateY(90deg); }
.lg-pane { height: 100%; display: flex; flex-direction: column; gap: 13px; padding: 44px 28px 24px; text-align: start; overflow: hidden auto; scrollbar-width: none; }
.lg-pane[data-pane="signup"] { gap: 9px; }
.lg-pane[data-pane="signup"] .field { gap: 4px; }
.lg-face :is(input, button, a, label) { cursor: auto; touch-action: manipulation; }
.lg-face :is(button, .lg-cover) { cursor: pointer; }
.lg-title { margin: 4px 0 2px; }
.lg-title h2 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin: 0; outline: none; }
.lg-title p { color: var(--ink-3); font-size: 13.5px; margin: 4px 0 0; }
.lg-face .field input { height: 42px; }
.lg-pw-label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.lg-pw-label label { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.lg-link { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; font-size: 13px; color: color-mix(in oklab, var(--accent) 55%, #fff); cursor: pointer; text-underline-offset: 3px; }
:root[data-theme="dark"] .lg-link { color: var(--accent); }
.lg-link:hover { text-decoration: underline; }
.lg-submit { height: 46px; font-size: 15px; margin-top: 4px; flex: none; }
.lg-alt { text-align: center; font-size: 13.5px; color: var(--ink-3); margin: 2px 0 0; }
.lg-sign { display: flex; align-items: center; justify-content: center; gap: 8px; margin: auto -28px -24px; padding: 14px 28px; border-top: 1px dashed var(--line); color: var(--ink-3); font-size: 12.5px; }
.lg-sign .brand-mark { width: 22px; height: 22px; border-radius: 7px; font-size: 11px; box-shadow: none; }
.lg-back-link { display: inline-flex; align-items: center; gap: 6px; align-self: center; margin-top: auto; }
.lg-back-ic { width: 15px; height: 15px; transform: scaleX(-1); }
[dir="rtl"] .lg-back-ic { transform: none; }
.lg-sent .lg-done { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: color-mix(in oklab, var(--ok) 14%, var(--lg-card)); color: var(--ink-2); font-size: 13.5px; line-height: 1.45; }
.lg-sent .lg-done svg { width: 18px; height: 18px; flex: none; color: var(--ok); margin-top: 1px; }
.lg-sent :is(.field, .lg-submit) { display: none; }

/* demo accounts, under the card */
.lg-demo { position: relative; z-index: 1; width: min(100% - 32px, 560px); text-align: center; }
.lg-demo p { color: var(--lg-on-2); font-size: 12.5px; margin: 0 0 8px; }
.lg-demo div { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.lg-demo button { flex: 1 1 calc(50% - 6px); min-width: 0; display: inline-flex; flex-direction: column; align-items: flex-start; padding: 7px 11px; border-radius: 12px; border: 1px solid var(--lg-chip-line); background: var(--lg-chip); color: var(--lg-on); cursor: pointer; text-align: start; transition: background .15s, border-color .15s; }
.lg-demo button:hover { border-color: var(--accent); }
.lg-demo button:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.lg-demo b { font-size: 12.5px; font-weight: 600; }
.lg-demo span { font-size: 11.5px; color: var(--lg-on-2); }

/* ---------- shorter windows: the card scales so the demo line stays on screen ---------- */
@media (max-height: 840px) and (min-width: 901px) { #login { --s: .86; } }
@media (max-height: 760px) and (min-width: 901px) { #login { --s: .72; --L: 34px; } }

/* ---------- narrow screens: hall as a band on top, card panel below ---------- */
@media (max-width: 900px) {
  #login { grid-template-columns: 1fr; --L: 40px; }
  .lg-world { min-height: 0; margin: 10px 10px 0; }
  .lg-scene { min-height: 220px; flex: none; height: 240px; }
  .lg-tilt { width: min(80%, 420px); }
  .lg-chip { padding: 7px 10px; } .lg-chip b { font-size: 16px; } .lg-chip small { font-size: 11px; }
  .lg-story { display: none; }
  .lg-chip:nth-of-type(4) { display: none; }
}
@media (max-width: 420px) { #login { --s: .9; } }
@media (max-width: 380px) { #login { --s: .82; } }
@media (max-width: 350px) { #login { --s: .76; } }
@media (prefers-reduced-motion: reduce) {
  .lg-hang, .lg-tilt { animation: none; }
  .lg-card, .lg-tilt, .lg-inner { transition: none; }
}
