/* SpendRule — sign in. Values follow the "Sunrise" frame in Spendrule Product Design (Figma). */

:root {
  /* Figma: Neutral scale */
  --neutral-50: #f5f6f7;
  --neutral-100: #f0f0f0;
  --neutral-400: #9a9b9d;
  --neutral-500: #777b83;
  --neutral-700: #3e424a;
  --neutral-800: #252931;
  --text-dark: #25272e;
  --legal: #9196a4;
  --accent: #ff4f00;
  --accent-press: #e84800;

  --font: 'Switzer', 'Switzer Variable', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);

  /* Driven every frame by main.js from what's actually painted behind the text */
  --sky-ink: 37 41 49;
  --sky-ink-soft: 62 66 74;
  --pill-ink: 37 41 49;
  --pill-bg: .15;
  --ambient: 255 186 120;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: #fff;
  color: var(--neutral-800);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.2;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
button, input { font: inherit; color: inherit; }
img { display: block; }

/* ------------------------------------------------------------------ layout */
.shell {
  display: grid;
  grid-template-columns: minmax(0, 619fr) minmax(0, 849fr);   /* Figma: 619 / 849 */
  padding: 16px;
  min-height: 100dvh;
}

/* ------------------------------------------------------------- auth panel */
.panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: calc(100dvh - 32px);
  padding: 48px 24px 28px;
}
.panel__inner {
  flex: 1;
  width: 100%;
  max-width: 343px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 56px;
  padding-bottom: 64px;          /* Figma: block sits 32px above centre */
}
.logo { display: inline-flex; width: max-content; border-radius: 4px; }
.logo img { width: 121.304px; height: 23.6097px; }

.views { display: grid; }
.view { grid-area: 1 / 1; transition: opacity .5s var(--ease-out), transform .6s var(--ease-out), filter .5s var(--ease-out); }
.view--success { opacity: 0; transform: translateY(12px); filter: blur(6px); pointer-events: none; }
body.is-success .view--form { opacity: 0; transform: translateY(-10px); filter: blur(6px); pointer-events: none; }
body.is-success .view--success { opacity: 1; transform: none; filter: none; pointer-events: auto; }

.intro { margin-bottom: 32px; }
.intro h1 {
  margin: 0 0 10px;
  font-weight: 500;
  font-size: 20px;
  line-height: 1;
  letter-spacing: -0.4px;
  color: var(--neutral-800);
}
.intro p {
  margin: 0;
  font-size: 14px;
  line-height: normal;
  color: var(--neutral-500);
}

#auth { display: flex; flex-direction: column; gap: 20px; }

/* collapsible rows (workspace name / divider / password) animate open & shut */
.collapse {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  margin-bottom: -20px;          /* cancel the form gap while closed */
  transition: grid-template-rows .5s var(--ease-out), opacity .35s var(--ease-out), margin .5s var(--ease-out);
}
.collapse.open { grid-template-rows: 1fr; opacity: 1; margin-bottom: 0; }
.collapse__inner { min-height: 0; overflow: hidden; }
.collapse--password .collapse__inner,
.collapse--org .collapse__inner { margin: -4px; padding: 4px; }   /* room for focus rings */

/* buttons */
.btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border: 0;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  letter-spacing: -0.14px;
  transition: background-color .2s, transform .2s var(--ease-out), box-shadow .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.985); }
.btn--sso {
  height: 41px;
  padding: 12px 20px;
  border-radius: 26px;
  background: var(--neutral-50);
  color: #000;
  line-height: 1.2;
  letter-spacing: -0.28px;
}
.btn--sso:hover { background: #eceef0; }
.btn--primary {
  height: 40px;
  padding: 13px 12px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  overflow: hidden;
  isolation: isolate;
}
.btn--primary::before {           /* soft light that follows the cursor */
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(160px circle at var(--mx, 50%) var(--my, 50%), rgb(255 255 255 / .28), transparent 60%);
  opacity: 0;
  transition: opacity .3s;
  z-index: -1;
}
.btn--primary:hover::before { opacity: 1; }
.btn--primary:hover { box-shadow: 0 8px 22px -12px rgb(255 79 0 / .9); }
.btn--primary:active { background: var(--accent-press); }
.btn__spinner {
  position: absolute;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1.6px solid rgb(255 255 255 / .35);
  border-top-color: #fff;
  opacity: 0;
  transform: scale(.6);
  transition: opacity .25s, transform .3s var(--ease-out);
}
.btn.is-loading { pointer-events: none; }
.btn.is-loading .btn__label { opacity: 0; transform: translateY(-6px); }
.btn.is-loading .btn__spinner { opacity: 1; transform: none; animation: spin .8s linear infinite; }
.btn__label { transition: opacity .2s, transform .3s var(--ease-out), filter .2s; }
@keyframes spin { to { transform: rotate(360deg); } }

.divider {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 12px;
  font-size: 12px;
  line-height: 1;
  color: var(--neutral-500);
  white-space: nowrap;
}
.divider img { flex: 1 0 0; min-width: 1px; height: 1px; }

/* fields */
.field { display: flex; flex-direction: column; gap: 8px; }
.field label {
  font-size: 14px;
  line-height: 1.2;
  letter-spacing: -0.14px;
  color: var(--text-dark);
}
.field__row { display: flex; align-items: flex-start; justify-content: space-between; white-space: nowrap; }
.field__hint { font-size: 12px; line-height: normal; color: var(--neutral-500); display: none; }
.field input {
  width: 100%;
  height: 38px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--neutral-100);
  background: var(--neutral-50);
  font-size: 14px;
  line-height: 1;
  letter-spacing: -0.14px;
  color: var(--neutral-800);
  outline: none;
  transition: background-color .2s, border-color .2s, box-shadow .25s var(--ease-out);
}
.field input::placeholder { color: var(--neutral-400); opacity: 1; }
.field input:hover { border-color: #e6e7e9; }
.field input:focus { background: #fff; border-color: rgb(255 79 0 / .5); box-shadow: 0 0 0 3px rgb(255 79 0 / .12); }
.field.is-invalid input { border-color: #e5484d; background: #fffafa; }
.field.is-invalid input:focus { box-shadow: 0 0 0 3px rgb(229 72 77 / .14); }
.field__error {
  margin: -2px 0 0;
  font-size: 12px;
  line-height: 1.3;
  color: #d93036;
  min-height: 0;
}
.field__error:empty { display: none; }
.field.shake { animation: shake .42s var(--ease-out); }
@keyframes shake { 20% { transform: translateX(-5px); } 45% { transform: translateX(4px); } 70% { transform: translateX(-2px); } }

.input-wrap { position: relative; }
.input-wrap input { padding-right: 40px; }
.reveal {
  position: absolute; right: 4px; top: 50%;
  width: 30px; height: 30px;
  transform: translateY(-50%);
  display: grid; place-items: center;
  border: 0; border-radius: 6px; background: transparent;
  color: var(--neutral-400);
  cursor: pointer;
  transition: color .2s, background-color .2s;
}
.reveal:hover { color: var(--neutral-700); background: rgb(0 0 0 / .04); }
.reveal svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.reveal .slash { stroke-dasharray: 19; stroke-dashoffset: 0; transition: stroke-dashoffset .3s var(--ease-out); }
.reveal[aria-pressed="true"] .slash { stroke-dashoffset: 19; }

.link {
  color: var(--accent);
  text-decoration: none;
  border-radius: 3px;
  transition: color .2s;
}
.link:hover { color: var(--accent-press); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.link--small { font-size: 12px; line-height: normal; }

.switch {
  margin: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  font-weight: 500;
  font-size: 14px;
  line-height: normal;
  color: #000;
  white-space: nowrap;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.field input:focus-visible { outline: none; }

/* mode-specific bits */
body[data-mode="signup"] #forgotLink { display: none; }
body[data-mode="signup"] .field__hint { display: inline; }

/* success */
.view--success { display: flex; flex-direction: column; align-items: flex-start; }
.view--success h1 { margin: 22px 0 10px; font-weight: 500; font-size: 20px; line-height: 1; letter-spacing: -0.4px; outline: none; }
.view--success > p { margin: 0; font-size: 14px; line-height: normal; color: var(--neutral-500); }
.check { width: 44px; height: 44px; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.check circle { stroke: rgb(255 79 0 / .18); stroke-width: 2; }
.check path { stroke: var(--accent); stroke-width: 2.6; stroke-dasharray: 34; stroke-dashoffset: 34; }
body.is-success .check path { transition: stroke-dashoffset .7s .25s var(--ease-out); stroke-dashoffset: 0; }
.progress { width: 100%; height: 2px; margin: 24px 0 18px; border-radius: 2px; background: var(--neutral-50); overflow: hidden; }
.progress i { display: block; height: 100%; width: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; }
body.is-success .progress i { transition: transform 2.4s .3s var(--ease-io); transform: scaleX(1); }
.prototype-note { margin: 0 0 14px !important; font-size: 12px !important; color: var(--neutral-400) !important; }

/* legal */
.legal {
  margin: 0;
  max-width: 343px;
  text-align: center;
  font-size: 14px;
  line-height: normal;
  color: var(--legal);
  text-wrap: balance;
}
.legal a {
  color: #000;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-skip-ink: none;
  text-underline-position: from-font;
}

/* text swaps: blur out, change, blur in */
.swap { display: inline-block; transition: opacity .22s var(--ease-out), filter .22s var(--ease-out), transform .3s var(--ease-out); }
p.swap, h1.swap { display: block; }
.swap.is-swapping { opacity: 0; filter: blur(4px); transform: translateY(-3px); }

/* ---------------------------------------------------------------- the sky */
.sky {
  position: sticky;
  top: 16px;
  height: calc(100dvh - 32px);
  min-height: 560px;
  border-radius: 24px;
  overflow: hidden;
  isolation: isolate;
  background: #eef1f4;            /* paper while the first plate loads */
  box-shadow: 0 40px 100px -60px rgb(var(--ambient) / .65);
  transition: box-shadow 1.2s;
}
.sky canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.sky.no-webgl {
  background-size: cover;
  background-position: center 30%;
}

/* condition pills — Figma: right/top 16, gap 16, 12px medium uppercase */
.conditions {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 16px;
  z-index: 2;
}
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 28px;
  padding: 8px 12px;
  border: 0;
  border-radius: 999px;
  background: rgb(255 255 255 / var(--pill-bg));
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
  backdrop-filter: blur(12px) saturate(1.3);
  color: rgb(var(--pill-ink));
  font-weight: 500;
  font-size: 12px;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .12);
}
.pill--city { height: 32px; cursor: default; }
.pill--city.can-locate { cursor: pointer; }
.pill--city.can-locate:hover { background: rgb(255 255 255 / calc(var(--pill-bg) + .12)); }
.pill__locate { width: 10px; height: 10px; fill: currentColor; opacity: .75; display: none; }
.pill--city.can-locate .pill__locate { display: block; }
.pill--city.is-locating .pill__locate { animation: pulse 1s var(--ease-io) infinite alternate; }
@keyframes pulse { to { opacity: .2; } }
.pill__dot {                      /* Figma "Ellipse 364", tinted to follow the ink */
  width: 4px; height: 4px;
  background: currentColor;
  -webkit-mask: url(assets/dot.svg) center / 4px 4px no-repeat;
  mask: url(assets/dot.svg) center / 4px 4px no-repeat;
}
.pill__icon { font-size: 12px; line-height: 1; }
.pill.is-preview { box-shadow: inset 0 0 0 1px rgb(255 79 0 / .55); }

/* headline — Figma: left/bottom 40, width 352, 48px / 16px */
.sky__copy {
  position: absolute;
  left: 40px;
  bottom: 40px;
  width: 352.443px;
  max-width: calc(100% - 80px);
  z-index: 1;
}
.sky__copy h2 {
  margin: 0 0 16px;
  font-weight: 500;
  font-size: 48px;
  line-height: 1;
  letter-spacing: -0.96px;
  color: rgb(var(--sky-ink));
}
.sky__copy .line { display: block; overflow: hidden; padding-bottom: .06em; margin-bottom: -.06em; }
.sky__copy .line > span { display: block; }
.sky__sub {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
  color: rgb(var(--sky-ink-soft));
}

/* atmosphere preview */
.atmo {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
.atmo__btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 12px 0 10px;
  border: 0;
  border-radius: 999px;
  background: rgb(255 255 255 / var(--pill-bg));
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
  backdrop-filter: blur(12px) saturate(1.3);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .12);
  color: rgb(var(--pill-ink));
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  cursor: pointer;
  opacity: .75;
  transition: opacity .2s, background-color .2s;
}
.atmo__btn:hover, .atmo__btn[aria-expanded="true"] { opacity: 1; background: rgb(255 255 255 / calc(var(--pill-bg) + .12)); }
.atmo__btn svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.atmo__btn svg path { fill: currentColor; stroke: none; }

/* sound toggle: equaliser bars rest low when off, dance while playing */
.atmo__bar { display: flex; align-items: center; gap: 8px; }
.atmo__sound[hidden] { display: none; }
.atmo__sound[aria-pressed="true"] { opacity: 1; }
.atmo__sound svg rect {
  fill: currentColor;
  stroke: none;
  transform-box: fill-box;
  transform-origin: center bottom;
  transform: scaleY(.3);
  transition: transform .4s var(--ease-out);
}
.atmo__sound[aria-pressed="true"] svg rect { transform: scaleY(.75); }
.atmo__sound.is-playing svg rect { animation: eq .9s var(--ease-io) infinite alternate; }
.atmo__sound.is-playing svg rect:nth-child(2) { animation-duration: .7s; animation-delay: -.35s; }
.atmo__sound.is-playing svg rect:nth-child(3) { animation-duration: 1.05s; animation-delay: -.6s; }
.atmo__sound.is-playing svg rect:nth-child(4) { animation-duration: .8s; animation-delay: -.2s; }
@keyframes eq { from { transform: scaleY(.25); } to { transform: scaleY(1); } }

.atmo__panel {
  width: 300px;
  padding: 14px;
  border-radius: 16px;
  background: rgb(255 255 255 / .82);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  box-shadow: 0 20px 50px -20px rgb(20 24 40 / .35), inset 0 0 0 1px rgb(255 255 255 / .6);
  color: var(--neutral-800);
  transform-origin: bottom right;
  animation: panelIn .35s var(--ease-out);
}
.atmo__panel[hidden] { display: none; }
@keyframes panelIn { from { opacity: 0; transform: translateY(6px) scale(.97); } }
.atmo__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; font-weight: 500; font-size: 13px; }
.atmo__live {
  border: 0; background: none; padding: 4px 6px; margin: -4px -6px;
  font-size: 12px; color: var(--accent); cursor: pointer; border-radius: 6px;
}
.atmo__live:disabled { color: var(--neutral-400); cursor: default; }
.atmo__row { display: flex; justify-content: space-between; align-items: baseline; margin: 2px 0 8px; font-size: 12px; color: var(--neutral-500); }
.atmo__row output { font-variant-numeric: tabular-nums; color: var(--neutral-800); font-weight: 500; }
.atmo input[type="range"] {
  width: 100%;
  margin: 0 0 10px;
  height: 18px;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.atmo input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 4px;
  background: linear-gradient(90deg, #12204a 0%, #3b3f86 18%, #f0a070 26%, #9ccaf0 40%, #7fbaf0 60%, #f08a50 74%, #4f2c74 82%, #12204a 100%);
}
.atmo input[type="range"]::-moz-range-track {
  height: 4px; border-radius: 4px;
  background: linear-gradient(90deg, #12204a 0%, #3b3f86 18%, #f0a070 26%, #9ccaf0 40%, #7fbaf0 60%, #f08a50 74%, #4f2c74 82%, #12204a 100%);
}
.atmo input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px; margin-top: -6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgb(0 0 0 / .3), inset 0 0 0 1px rgb(0 0 0 / .06);
}
.atmo input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgb(0 0 0 / .3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chips:last-child { margin-bottom: 0; }
.chip {
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--neutral-100);
  background: #fff;
  font-size: 12px;
  color: var(--neutral-700);
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: #dcdee2; }
.chip[aria-pressed="true"] { background: var(--neutral-800); border-color: var(--neutral-800); color: #fff; }
.chip small { color: inherit; opacity: .6; margin-left: 4px; font-size: 11px; }

/* --------------------------------------------------------------- entrance */
[data-enter] {
  opacity: 0;
  transform: translateY(10px);
  filter: blur(6px);
}
body.is-ready [data-enter] {
  opacity: 1;
  transform: none;
  filter: none;
  transition: opacity .9s var(--ease-out), transform 1s var(--ease-out), filter .9s var(--ease-out);
  transition-delay: calc(var(--d, 0) * 70ms + 150ms);
}
/* collapse rows must keep their own open/closed opacity once revealed */
body.is-ready .collapse[data-enter]:not(.open) { opacity: 0; }

.pill { opacity: 0; transform: translateY(-6px); }
body.is-ready .pill {
  opacity: 1; transform: none;
  transition: opacity .8s var(--ease-out), transform .9s var(--ease-out), background-color .3s;
  transition-delay: calc(var(--d, 0) * 90ms + 900ms);
}
.sky__copy .line > span { transform: translateY(105%); }
.sky__sub, .atmo { opacity: 0; }
body.is-ready .sky__copy .line > span { transform: none; transition: transform 1.2s var(--ease-out); }
body.is-ready .sky__copy .line:nth-child(1) > span { transition-delay: 1.1s; }
body.is-ready .sky__copy .line:nth-child(2) > span { transition-delay: 1.2s; }
body.is-ready .sky__sub { opacity: 1; transition: opacity 1s 1.45s; }
body.is-ready .atmo { opacity: 1; transition: opacity 1s 1.8s; }

/* ------------------------------------------------------------- responsive */
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; padding: 12px; gap: 8px; }
  .sky {
    order: -1;
    position: relative;
    top: auto;
    height: 52svh;
    min-height: 380px;
    border-radius: 20px;
  }
  .panel { min-height: 0; padding: 36px 8px 24px; }
  .panel__inner { padding-bottom: 0; gap: 40px; }
  .legal { margin-top: 48px; }
  .sky__copy { left: 24px; bottom: 24px; }
  .sky__copy h2 { font-size: 38px; letter-spacing: -0.76px; margin-bottom: 12px; }
  .sky__sub { font-size: 14px; }
  .atmo__btn span { display: none; }
  .atmo__btn { padding: 0 8px; }
  .atmo__panel { width: min(300px, calc(100vw - 56px)); }
}
@media (max-width: 420px) {
  .sky__copy h2 { font-size: 32px; letter-spacing: -0.64px; }
  .sky__sub br { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  [data-enter], .pill, .sky__copy .line > span, .view, .swap { transform: none !important; filter: none !important; }
}
