/* Kairos v2 sign-in: the ColeHardik sign-up card in light mode, with the MatchLab
   glass orb (orbloom) where the reference holds its sphere. Sizes come from the
   reference frame (1920x1200, card 1445x870) as cqi of the card: 1 ref px = 0.0692cqi. */

/* Inter Tight (SIL OFL 1.1, see fonts/InterTight-OFL.txt), the face of Kairos' next design language. */
@font-face {
  font-family: 'Inter Tight';
  src: url('fonts/InterTight-Variable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #17130f;
  --ink-2: #4a443e;
  --muted: #69625b;
  --ground: #efede9;
  --card: #ffffff;
  --field: #f4f2ef;
  --hairline: rgb(23 19 15 / 0.1);
  --error: #b42318;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}

[data-accent='ember'] {
  --accent: #e4572e;
  --accent-ring: rgb(228 87 46 / 0.22);
  --beam-1: #ff6b35;
  --beam-2: #ffb45e;
  --stage: #fbf6f1;
  --stage-glow: #ffe3cf;
  --orb-1: #ff6b35;
  --orb-2: #ffb45e;
  --orb-deep: #1c110c;
}

[data-accent='sage'] {
  --accent: #23935f;
  --accent-ring: rgb(35 147 95 / 0.22);
  --beam-1: #2fb57c;
  --beam-2: #b5db6e;
  --stage: #f4f8f4;
  --stage-glow: #d9f0e0;
  --orb-1: #2fb57c;
  --orb-2: #b5db6e;
  --orb-deep: #0d1712;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-family: 'Inter Tight', system-ui, sans-serif;
  color: var(--ink);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 32px 24px;
}

::selection {
  background: var(--accent-ring);
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

@media (hover: hover) and (pointer: fine) {
  a:hover {
    text-decoration: underline;
    text-decoration-color: var(--accent);
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- card: 1445 x 870 of a 1920 x 1200 frame ---- */
.card {
  container-type: inline-size;
  position: relative;
  display: grid;
  grid-template-columns: 54.4% 1fr;
  --card-width: min(1445px, 75.26vw, calc((100svh - 64px) * 1.661));
  width: var(--card-width);
  min-width: min(960px, 100%);
  /* A minimum instead of aspect-ratio: the card keeps the reference proportions but grows when validation errors expand the form. */
  min-height: calc(var(--card-width) * 870 / 1445);
  /* The card's own cqi would resolve against the viewport, so its radius scales with its width instead. */
  border-radius: max(28px, calc(var(--card-width) * 0.0332));
  background: var(--card);
  overflow: hidden;
  box-shadow:
    0 0 0 1px var(--hairline),
    0 2px 4px rgb(23 19 15 / 0.04),
    0 36px 90px -36px rgb(60 40 20 / 0.28);
  animation: card-in 700ms var(--ease-out) both;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: scale(0.985);
    filter: blur(8px);
  }
}

/* ---- the orb stage (the reference's photo side) ---- */
.stage {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(60% 46% at 50% 43%, var(--stage-glow), transparent 72%),
    var(--stage);
}

.brand {
  position: absolute;
  z-index: 3;
  top: max(24px, 3.46cqi);
  left: max(24px, 3.67cqi);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.45em;
  font-size: max(18px, 1.8cqi);
  font-weight: 500;
  letter-spacing: -0.02em;
}

.mark {
  width: 1.05em;
  height: auto;
}

/* The reference's diagonal light streak, crossing behind the sphere from lower left to upper right. */
.beam {
  position: absolute;
  left: -20%;
  top: 46%;
  width: 140%;
  pointer-events: none;
  transform: rotate(-27deg);
  transform-origin: 50% 50%;
}

.beam-wide {
  height: 22%;
  margin-top: -11%;
  background: linear-gradient(90deg, transparent 4%, var(--beam-1) 34%, var(--beam-2) 58%, transparent 92%);
  opacity: 0.34;
  filter: blur(28px);
}

.beam-core {
  height: 3%;
  margin-top: -1.5%;
  background: linear-gradient(90deg, transparent 8%, var(--beam-2) 36%, #fff 50%, var(--beam-1) 64%, transparent 92%);
  opacity: 0.85;
  filter: blur(6px);
}

/* No hand: the orb hovers over its own soft contact shadow. */
.orb-floor {
  position: absolute;
  left: 50%;
  top: 75%;
  width: 34%;
  height: 4.5%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgb(23 19 15 / 0.24), rgb(23 19 15 / 0.08) 55%, transparent);
  filter: blur(6px);
}

.orb-seat {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 46%;
  width: 51%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
}

.orb-halo {
  position: absolute;
  inset: -16%;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--orb-1), color-mix(in oklab, var(--orb-2) 60%, transparent) 46%, transparent 72%);
  opacity: 0.32;
  filter: blur(18px);
  transition: opacity 120ms linear;
}

.orb-seat .orb-motion {
  --orb-diameter: 100%;
  --orb-motion-distance: -10px;
  --orb-motion-duration: 7s;
  --orb-entrance-delay: 120ms;
  width: 100%;
  height: 100%;
  /* orbloom contains paint here, which would clip the shell's drop shadow. */
  contain: layout style;
}

.orb-shell {
  border-radius: 50%;
  box-shadow:
    0 0 0 1px rgb(23 19 15 / 0.14),
    0 30px 60px -18px rgb(23 19 15 / 0.45),
    0 12px 24px -12px color-mix(in oklab, var(--orb-1) 60%, transparent);
}

.orb-clip {
  transition: filter 200ms ease, transform 260ms var(--ease-out);
}

.orb-seat .orb-chrome {
  opacity: 0.75;
}

/* Glass highlight ported from MatchLab's orb tokens (ORB_HIGHLIGHT), softened so the orbloom interior shows through. */
.orb-gloss {
  position: absolute;
  z-index: 3;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  background:
    radial-gradient(circle at 32% 24%, rgb(255 255 255 / 0.42) 0%, rgb(255 255 255 / 0.12) 16%, rgb(255 255 255 / 0) 34%),
    radial-gradient(circle at 70% 82%, rgb(255 255 255 / 0.1) 0%, rgb(255 255 255 / 0) 30%);
  mix-blend-mode: screen;
}

.orb-fallback {
  background:
    radial-gradient(circle at 32% 28%, rgb(255 255 255 / 0.9) 0%, var(--orb-2) 20%, var(--orb-1) 52%, var(--orb-deep) 100%);
}

/* ---- orb variations ---- */
.variations {
  position: absolute;
  z-index: 3;
  left: max(24px, 3.67cqi);
  bottom: max(22px, 3.2cqi);
  display: flex;
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.62);
  box-shadow: 0 0 0 1px var(--hairline), 0 6px 18px -10px rgb(23 19 15 / 0.3);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
}

.variations button,
.accent-switch button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px 0 7px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  transition: background-color 160ms ease, color 160ms ease, transform 120ms var(--ease-out);
}

.variations button:active,
.accent-switch button:active {
  transform: scale(0.97);
}

.variations [aria-pressed='true'],
.accent-switch [aria-pressed='true'] {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--hairline), 0 1px 3px rgb(23 19 15 / 0.1);
}

/* A mini glass orb per variation, in the MatchLab token recipe (light spot top left, deep rim bottom right). */
.chip-orb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  box-shadow: inset 0 -2px 4px rgb(0 0 0 / 0.25), inset 0 1px 2px rgb(255 255 255 / 0.7), 0 0 0 1px rgb(23 19 15 / 0.12);
}

[data-orb-choice='spiral'] .chip-orb {
  background: radial-gradient(circle at 32% 28%, rgb(255 255 255 / 0.9) 0%, var(--orb-2) 18%, var(--orb-deep) 64%);
}

[data-orb-choice='nebula'] .chip-orb {
  background:
    radial-gradient(circle at 62% 60%, var(--orb-1) 0%, transparent 46%),
    radial-gradient(circle at 32% 28%, rgb(255 255 255 / 0.8) 0%, var(--orb-deep) 52%);
}

[data-orb-choice='core'] .chip-orb {
  background:
    radial-gradient(circle at 52% 52%, #fff 0%, var(--orb-2) 16%, var(--orb-1) 30%, var(--orb-deep) 66%);
}

@media (hover: hover) and (pointer: fine) {
  .variations [aria-pressed='false']:hover,
  .accent-switch [aria-pressed='false']:hover {
    background: rgb(23 19 15 / 0.05);
    color: var(--ink);
  }
}

/* ---- accent switch (lab control, outside the card) ---- */
.accent-switch {
  position: fixed;
  z-index: 10;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.7);
  box-shadow: 0 0 0 1px var(--hairline), 0 6px 18px -10px rgb(23 19 15 / 0.25);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgb(23 19 15 / 0.12);
}

[data-accent-choice='ember'] .swatch {
  background: linear-gradient(135deg, #ffb45e, #e4572e);
}

[data-accent-choice='sage'] .swatch {
  background: linear-gradient(135deg, #b5db6e, #23935f);
}

/* ---- form panel ---- */
.panel {
  display: grid;
  place-items: center;
  padding: max(32px, 4cqi) 0;
}

.panel-inner {
  width: max(340px, 33.77cqi);
  max-width: calc(100% - 48px);
  text-align: center;
}

h1 {
  margin: 0;
  font-size: max(30px, 3.05cqi);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.lede {
  margin: max(8px, 0.7cqi) 0 0;
  font-size: max(15px, 1.18cqi);
  color: var(--muted);
}

.google,
.submit {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: max(12px, 0.97cqi);
  font-size: max(15px, 1.18cqi);
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: transform 120ms var(--ease-out), background-color 160ms ease, box-shadow 160ms ease;
}

.google:active,
.submit:active {
  transform: scale(0.98);
}

.google {
  margin-top: max(22px, 2.42cqi);
  height: max(46px, 3.74cqi);
  border: 0;
  background: var(--card);
  box-shadow: 0 0 0 1px rgb(23 19 15 / 0.14), 0 1px 2px rgb(23 19 15 / 0.05);
}

.google svg {
  width: 18px;
  height: 18px;
}

@media (hover: hover) and (pointer: fine) {
  .google:hover {
    background: var(--field);
  }

  .submit:hover {
    background: #2a241f;
  }
}

.or {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: max(20px, 2.35cqi) 0;
  font-size: max(13px, 1.12cqi);
  color: var(--muted);
}

.or::before,
.or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--hairline);
}

.form {
  display: grid;
  gap: max(10px, 0.97cqi);
  margin: 0;
}

.field {
  position: relative;
  display: grid;
  text-align: left;
}

.field input {
  width: 100%;
  height: max(44px, 3.32cqi);
  padding: 0 max(14px, 1.18cqi);
  border: 0;
  border-radius: max(12px, 0.97cqi);
  background: var(--field);
  font-size: max(15px, 1.18cqi);
  caret-color: var(--accent);
  box-shadow: inset 0 0 0 1px transparent;
  outline: none;
  transition: background-color 160ms ease, box-shadow 160ms ease;
}

.has-reveal input {
  padding-right: 48px;
}

.field input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.field input:focus {
  background: var(--card);
  box-shadow: inset 0 0 0 1px rgb(23 19 15 / 0.22), 0 0 0 4px var(--accent-ring);
}

.field input[aria-invalid='true'] {
  box-shadow: inset 0 0 0 1px var(--error);
}

.field input[aria-invalid='true']:focus {
  box-shadow: inset 0 0 0 1px var(--error), 0 0 0 4px rgb(180 35 24 / 0.16);
}

.reveal {
  position: absolute;
  top: calc(max(44px, 3.32cqi) / 2 - 18px);
  right: 6px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-2);
}

.reveal svg {
  width: 18px;
  height: 18px;
}

.reveal[aria-pressed='true'] {
  color: var(--accent);
}

.error {
  margin: 0;
  font-size: 13px;
  line-height: 1.3;
  color: var(--error);
}

.error:not(:empty) {
  padding: 6px 2px 0;
}

.submit {
  margin-top: max(14px, 1.38cqi);
  height: max(46px, 3.53cqi);
  border: 0;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 1px 2px rgb(23 19 15 / 0.2), 0 8px 20px -10px rgb(23 19 15 / 0.5);
}

.submit svg {
  width: 16px;
  height: 16px;
}

.submit[aria-busy='true'] {
  cursor: progress;
}

.status {
  margin: 0;
  font-size: 14px;
  color: var(--ink-2);
}

.status:not(:empty) {
  padding-top: 4px;
}

.switch {
  margin: max(18px, 2.4cqi) 0 0;
  font-size: max(15px, 1.18cqi);
  color: var(--muted);
}

.legal {
  margin: max(28px, 5.1cqi) 0 0;
  font-size: max(14px, 1.18cqi);
  color: var(--muted);
}

/* ---- narrow screens: the orb above, the form below ---- */
@media (max-width: 1000px) {
  .card {
    grid-template-columns: 1fr;
    width: min(560px, 100%);
    min-width: 0;
    aspect-ratio: auto;
    border-radius: 28px;
  }

  .stage {
    height: min(52svh, 440px);
  }

  .orb-seat {
    width: min(58%, 54svh * 0.62);
    top: 45%;
  }

  .orb-floor {
    top: 75%;
    width: 30%;
  }

  .panel {
    padding: 36px 0 32px;
  }

  .accent-switch {
    position: static;
    margin: 0 auto 16px;
    width: max-content;
  }

  body {
    display: block;
    padding: 16px 12px;
  }

  .card {
    margin: 0 auto;
  }
}

@media (max-width: 420px) {
  .variations button {
    padding: 0 10px 0 6px;
    gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card {
    animation: card-fade 200ms ease both;
  }

  .orb-clip {
    transition: none;
  }
}

@keyframes card-fade {
  from {
    opacity: 0;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .variations,
  .accent-switch {
    background: var(--card);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}
