/* =========================================================================
   Cinematic lamp login — standalone page styles
   One boolean (.scene.is-on) drives the lamp, the beam and the login panel.
   ========================================================================= */

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

/* Light theme is the base; dark is applied when the OS asks for it, or when
   <html data-theme="dark"> is set explicitly. */
:root {
  --ink: #f2ece0;          /* page background — warm off-white */
  --ink-2: #ffffff;        /* login panel */
  --field-bg: #f6f1e7;     /* inputs */
  --line: #e6ddcd;
  --text: #2a2520;
  --text-dim: #7c7469;
  --text-mute: #a79c8a;
  --warm: #ffc266;
  --warm-strong: #ffab3d;
  /* Accent for links + the Login button — gold to match the lamp light
     (named --violet* only so the rest of the file didn't have to change). */
  --violet: #dcae4b;
  --violet-2: #eec877;
  --violet-glow: rgba(220, 174, 75, .38);
  --danger: #c1502e;
  --danger-border: #efc7b8;
  --panel-bg: var(--ink-2);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #0c0d10;
    --ink-2: #141519;
    --field-bg: #101116;
    --line: #23252c;
    --text: #f4f4f6;
    --text-dim: #9a9ba4;
    --text-mute: #6b6c76;
    --warm: #ffcf8b;
    --warm-strong: #ffb54d;
    --violet: #e7c46a;
    --violet-2: #f4d98f;
    --violet-glow: rgba(231, 196, 106, .45);
    --danger: #e2735a;
    --danger-border: #4a2a22;
    --panel-bg: linear-gradient(180deg, rgba(24, 25, 30, .9), rgba(16, 17, 21, .92));
  }
}

:root[data-theme="dark"] {
  --ink: #0c0d10;
  --ink-2: #141519;
  --field-bg: #101116;
  --line: #23252c;
  --text: #f4f4f6;
  --text-dim: #9a9ba4;
  --text-mute: #6b6c76;
  --warm: #ffcf8b;
  --warm-strong: #ffb54d;
  --violet: #e7c46a;
  --violet-2: #f4d98f;
  --violet-glow: rgba(231, 196, 106, .45);
  --danger: #e2735a;
  --danger-border: #4a2a22;
  --panel-bg: linear-gradient(180deg, rgba(24, 25, 30, .9), rgba(16, 17, 21, .92));
}

html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--ink);
  color: var(--text);
  overflow: hidden;
}

/* ── Scene ─────────────────────────────────────────────────── */
.scene {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  align-items: center;   /* lamp and the login card both vertically centered */
  gap: 2rem;
  padding: 2rem clamp(1.25rem, 6vw, 6rem);
  background:
    radial-gradient(1200px 700px at 22% 34%, rgba(255, 180, 90, .04), transparent 60%),
    var(--ink);
  transition: background .8s ease;
}
.scene.is-on {
  background:
    radial-gradient(1100px 720px at 22% 30%, rgba(255, 184, 92, .16), transparent 62%),
    radial-gradient(900px 520px at 22% 32%, rgba(255, 150, 60, .10), transparent 60%),
    var(--ink);
}

/* ── Brand mark (top-left) ────────────────────────────────── */
.brand {
  position: absolute;
  top: clamp(1.1rem, 3vw, 2rem);
  left: clamp(1.25rem, 6vw, 6rem);
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  text-decoration: none;
}
.brand__img { width: 40px; height: 40px; flex-shrink: 0; }
.brand__text {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .16em;
  color: var(--text-dim);
}
.brand__text b { color: var(--text); font-weight: 700; }

/* ── Left stage: lamp + toggle ────────────────────────────── */
.stage {
  position: relative;
  height: min(78vh, 640px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lamp {
  position: relative;
  width: 260px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* halo behind the shade */
.lamp__glow {
  position: absolute;
  top: 2%;
  left: 50%;
  width: 420px;
  height: 420px;
  transform: translateX(-50%) scale(.6);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 197, 122, .9), rgba(255, 170, 80, .25) 42%, transparent 70%);
  filter: blur(24px);
  opacity: 0;
  transition: opacity .7s ease, transform .7s ease;
  pointer-events: none;
}
.scene.is-on .lamp__glow { opacity: .9; transform: translateX(-50%) scale(1); }

/* the downward light cone */
.lamp__beam {
  position: absolute;
  top: 46px;
  left: 50%;
  width: 260px;
  height: 70%;
  transform: translateX(-50%);
  clip-path: polygon(42% 0, 58% 0, 100% 100%, 0 100%);
  background: linear-gradient(to bottom, rgba(255, 206, 138, .55), rgba(255, 190, 110, .12) 55%, transparent 90%);
  filter: blur(6px);
  opacity: 0;
  transition: opacity .7s ease .05s;
  pointer-events: none;
}
.scene.is-on .lamp__beam { opacity: 1; }

.lamp__shade {
  position: relative;
  z-index: 2;
  width: 190px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(180deg, #e9e4da, #b9b3a7 60%, #8f8a80);
  box-shadow: inset 0 -6px 10px rgba(0, 0, 0, .25);
  transition: box-shadow .6s ease, filter .6s ease;
}
.scene.is-on .lamp__shade {
  filter: brightness(1.12);
  box-shadow: inset 0 -6px 10px rgba(0, 0, 0, .18), 0 10px 40px rgba(255, 190, 110, .45);
}
.lamp__shade::after {   /* the bulb glow at the underside */
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 60px;
  height: 16px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, var(--warm-strong), transparent 70%);
  opacity: 0;
  transition: opacity .6s ease;
}
.scene.is-on .lamp__shade::after { opacity: 1; }

.lamp__pole {
  z-index: 2;
  width: 2px;
  flex: 1;
  /* warm grey so it doesn't read as a blue line inside the amber beam */
  background: linear-gradient(to bottom, #6b5f4c, #342f28);
}
.lamp__base {
  z-index: 2;
  width: 120px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(180deg, #34343a, #1c1c20);
  box-shadow: 0 18px 30px rgba(0, 0, 0, .5);
}

/* toggle switch — sits to the left of the lamp */
.toggle {
  position: absolute;
  left: 4%;
  top: 42%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  border-radius: 999px;
  outline: none;
}
.toggle__track {
  display: block;
  width: 46px;
  height: 74px;
  border-radius: 999px;
  background: #17181c;
  border: 1px solid #2b2c33;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, .6);
  position: relative;
  transition: background .5s ease, border-color .5s ease, box-shadow .5s ease;
}
.toggle__knob {
  position: absolute;
  left: 50%;
  top: 34px;
  width: 34px;
  height: 34px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fbfbfd, #c9c9d0);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .5);
  transition: top .35s cubic-bezier(.34, 1.56, .64, 1), background .5s ease, box-shadow .5s ease;
}
.scene.is-on .toggle__track {
  background: #3a2a12;
  border-color: var(--warm-strong);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, .5), 0 0 22px rgba(255, 181, 77, .55);
}
.scene.is-on .toggle__knob {
  top: 6px;
  background: radial-gradient(circle at 35% 30%, #fff2dc, var(--warm-strong));
  box-shadow: 0 4px 14px rgba(255, 170, 70, .7);
}
.toggle:focus-visible .toggle__track { border-color: var(--violet-2); }

.stage__hint {
  position: absolute;
  left: 2%;
  top: calc(42% + 100px);   /* clear of the 74px switch track + breathing room */
  margin: 0;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-mute);
  transition: opacity .4s ease;
}
.scene.is-on .stage__hint { opacity: 0; }

/* ── Right: login panel ───────────────────────────────────── */
.panel {
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity .5s ease .15s, transform .5s ease .15s;
}
.scene.is-on .panel { opacity: 1; transform: translateY(0); pointer-events: auto; }

.panel__inner {
  max-width: 480px;
  /* sit toward the right of its column, but nudged in from the edge */
  margin-inline: auto clamp(2rem, 7vw, 7rem);
  padding: 3rem 2.8rem;
  border-radius: 22px;
  background: var(--panel-bg);
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .28), 0 0 0 1px rgba(255, 180, 100, .05);
  backdrop-filter: blur(6px);
}

.panel__brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  margin-bottom: 1.4rem;
}
.panel__brand img { width: 46px; height: 46px; }
.panel__brand span {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .16em;
  color: var(--text-dim);
}
.panel__brand b { color: var(--text); font-weight: 700; }

.panel__title {
  margin: 0;
  text-align: center;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 2.2rem;
  letter-spacing: .01em;
}
.panel__sub {
  margin: .4rem 0 1.9rem;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
}

.panel__error {
  margin-bottom: 1.1rem;
  padding: .6rem .85rem;
  font-size: 12px;
  color: var(--danger);
  border: 1px solid var(--danger-border);
  border-radius: 10px;
  background: rgba(226, 115, 90, .08);
}

.panel__form { display: flex; flex-direction: column; gap: 1.05rem; }

.field {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .1rem .95rem;
  height: 52px;
  border-radius: 12px;
  background: var(--field-bg);
  border: 1px solid var(--line);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.field:focus-within {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(231, 196, 106, .20);
}
.field__icon { display: flex; color: var(--text-mute); flex-shrink: 0; }
.field__icon svg { width: 17px; height: 17px; }
.field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: none;
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
}
.field input::placeholder { color: var(--text-mute); }
.field input:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 40px var(--field-bg) inset;
  caret-color: var(--text);
}
.field__eye {
  display: flex;
  padding: .3rem;
  border: 0;
  background: none;
  color: var(--text-mute);
  cursor: pointer;
  flex-shrink: 0;
}
.field__eye:hover { color: var(--text-dim); }
.field__eye svg { width: 17px; height: 17px; }

.panel__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  font-size: 12px;
  margin: .1rem 0 .25rem;
}
.remember {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}
.remember input {
  width: 15px;
  height: 15px;
  accent-color: var(--violet);
  cursor: pointer;
}
.panel__link {
  color: var(--violet-2);
  text-decoration: none;
}
.panel__link:hover { text-decoration: underline; }

.panel__submit {
  margin-top: .6rem;
  height: 52px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--violet-2), var(--violet));
  color: #2a2205;
  font-size: 14.5px;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: .02em;
  cursor: pointer;
  box-shadow: 0 10px 26px var(--violet-glow);
  transition: transform .12s ease, box-shadow .2s ease, filter .2s ease;
}
.panel__submit:hover { filter: brightness(1.06); box-shadow: 0 12px 32px var(--violet-glow); }
.panel__submit:active { transform: translateY(1px); }

.panel__foot {
  margin: 1.4rem 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 860px) {
  html, body { height: auto; }
  body { overflow-y: auto; overflow-x: hidden; }

  .brand { display: none; }               /* the in-panel brand covers it here */

  .scene {
    grid-template-columns: 1fr;
    align-items: start;                    /* stack + scroll from the top */
    gap: .25rem;
    padding: 1.75rem 1rem 2.5rem;
  }

  .stage { height: 300px; width: 100%; }
  .lamp { width: 190px; }

  /* switch anchored to the left of the stage — no magic offsets */
  .toggle { left: 1.25rem; top: 44%; }
  .stage__hint { left: 1.25rem; top: calc(44% + 98px); transform: none; }

  .panel { transform: none; }
  .scene.is-on .panel { transform: none; }
  .panel__inner {
    margin: 0 auto;
    max-width: 440px;
    width: 100%;
    padding: 2.25rem 1.5rem;
  }
  .panel__title { font-size: 1.9rem; }
  .panel__brand { margin-bottom: 1.15rem; }
  .panel__brand img { width: 40px; height: 40px; }
}

@media (max-width: 400px) {
  .scene { padding: 1.25rem .85rem 2rem; }
  .stage { height: 240px; }
  .lamp { width: 158px; }
  .toggle { top: 42%; }
  .stage__hint { top: calc(42% + 94px); font-size: 10px; }
  .panel__inner { padding: 1.9rem 1.15rem; }
  .panel__title { font-size: 1.6rem; }
  .field { height: 50px; padding-inline: .8rem; }
  .panel__submit { height: 50px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .001s !important; }
}
