:root {
  --navy: #173b61;
  --navy-deep: #0f2a47;
  --champagne: #b89b6a;
  --ink: #22292b;
  --muted: #6b706c;
  --cream: #f7f3ec;
  --line: #e3dacb;
  --clay: #9c4434;
  --clay-bg: #faedea;
  --serif: "Cormorant Garamond", "Cormorant", Georgia, serif;
  --sans: "Manrope", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}

.login {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 100svh;
  display: flex;
  align-items: center;
  background: #f9f6f1 url("/assets/login/background.jpg") center / cover no-repeat;
}

.login::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(249,246,241,.96) 0%, rgba(249,246,241,.82) 28%, rgba(249,246,241,.18) 52%, rgba(249,246,241,0) 72%);
}

/* Illustrated scene */

.scene {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}

.scene img { position: absolute; display: block; height: auto; }

.tree-left {
  left: 12%;
  bottom: -13%;
  width: clamp(540px, 45vw, 900px);
  z-index: 4;
  transform-origin: 50% 100%;
  animation: tree-left 5.8s ease-in-out 1s infinite alternate;
}

.tree-right {
  right: -12%;
  bottom: -12%;
  width: clamp(540px, 45vw, 900px);
  z-index: 4;
  transform-origin: 50% 100%;
  animation: tree-right 6.4s ease-in-out .65s infinite alternate;
}

.wind {
  left: 31%;
  top: 10%;
  width: 74%;
  z-index: 5;
  opacity: .46;
  animation: wind 8s linear .8s infinite;
}

.sign {
  left: 50%;
  bottom: 8%;
  width: clamp(112px, 9.6vw, 146px);
  z-index: 3;
  opacity: 0;
  transform-origin: 50% 100%;
  filter: drop-shadow(0 8px 10px rgba(39,48,51,.14));
  animation: sign-in .9s cubic-bezier(.18,.89,.32,1.28) .3s forwards;
}

.group {
  left: 55.5%;
  bottom: -0.75%;
  width: clamp(440px, 39vw, 560px);
  opacity: 0;
}

.group-base { z-index: 6; animation: group-in .78s cubic-bezier(.2,.75,.3,1) 1.02s forwards; }

.agent-arm {
  z-index: 5;
  transform-origin: 26% 18%;
  animation: group-in .78s cubic-bezier(.2,.75,.3,1) 1.02s both, agent-wave 1.18s ease-in-out 1.92s 6;
}

.wife-arm {
  z-index: 5;
  transform-origin: 85% 27.5%;
  animation: group-in .78s cubic-bezier(.2,.75,.3,1) 1.02s both, wife-wave 1.18s ease-in-out 2.02s 6;
}

@keyframes tree-left { from { transform: rotate(-.7deg); } to { transform: rotate(1deg); } }
@keyframes tree-right { from { transform: rotate(.7deg); } to { transform: rotate(-1deg); } }
@keyframes wind {
  0% { transform: translate3d(-7%,0,0); opacity: 0; }
  12% { opacity: .46; }
  85% { opacity: .34; }
  100% { transform: translate3d(8%,0,0); opacity: 0; }
}
@keyframes sign-in {
  0% { opacity: 0; transform: translateY(34px) scale(.94); }
  65% { opacity: 1; transform: translateY(-5px) scale(1.015); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes group-in { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes agent-wave { 0%, 100% { transform: rotate(0); } 38% { transform: rotate(-3.5deg); } 72% { transform: rotate(2deg); } }
@keyframes wife-wave { 0%, 100% { transform: rotate(0); } 38% { transform: rotate(3.5deg); } 72% { transform: rotate(-2deg); } }

/* Sign-in panel */

.panel {
  position: relative;
  z-index: 10;
  width: clamp(330px, 30vw, 410px);
  margin-left: clamp(26px, 6vw, 96px);
  padding: 30px 30px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(23, 59, 97, .05), 0 18px 48px rgba(23, 59, 97, .1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.logo { width: auto; max-height: 72px; align-self: flex-start; }

h1 {
  margin: 4px 0 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 30px;
  line-height: 1.15;
  color: var(--navy);
}
h1::after { content: ""; display: block; width: 36px; height: 1px; margin-top: 12px; background: var(--champagne); }

.form { display: flex; flex-direction: column; gap: 6px; }
.form[hidden] { display: none; }

label { font-size: 13px; font-weight: 600; letter-spacing: .02em; color: var(--ink); margin-top: 6px; }

input[type="text"], input[type="password"], input[type="email"] {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
input[type="text"]:focus, input[type="password"]:focus, input[type="email"]:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(23, 59, 97, .12);
}

button:focus-visible, a:focus-visible, .check input:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}

.checks { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 4px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; letter-spacing: 0; margin: 0; color: var(--muted); cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--navy); }

button[type="submit"] {
  width: 100%;
  min-height: 48px;
  margin-top: 10px;
  border: 0;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .02em;
  cursor: pointer;
  transition: background .15s;
}
button[type="submit"]:hover { background: var(--navy-deep); }
button[type="submit"]:disabled { opacity: .7; cursor: wait; }

.link {
  align-self: center;
  margin-top: 2px;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--navy);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

.message { margin: 6px 0 0; padding: 10px 12px; font-size: 13.5px; line-height: 1.45; border-radius: 8px; background: #eef2f7; color: var(--navy); }
.message.error { background: var(--clay-bg); color: var(--clay); }

.intro { margin: 0; font-size: 14px; line-height: 1.5; color: var(--muted); }

.foot { margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--line); }
.contact { margin: 0; font-size: 13px; line-height: 1.6; }
.contact a { color: var(--ink); text-decoration: none; }
.contact a:hover { color: var(--navy); }
.legal { margin: 8px 0 0; font-size: 10.5px; line-height: 1.5; color: var(--muted); }
.legal a { color: var(--navy); }

/* Set-password and callback pages: centered card, no scene */
.login.plain { justify-content: center; }
.login.plain .panel { margin: 24px 16px; }

@media (max-width: 767px) {
  .login { align-items: flex-start; background-position: 58% bottom; }
  .login::after {
    background: linear-gradient(180deg, rgba(249,246,241,.98) 0%, rgba(249,246,241,.92) 38%, rgba(249,246,241,.24) 63%, rgba(249,246,241,0) 82%);
  }
  .panel { position: absolute; top: clamp(12px, 2.2svh, 24px); left: 16px; width: calc(100% - 32px); margin: 0; padding: 18px 18px 16px; gap: 8px; }
  .login.plain .panel { position: relative; top: auto; left: auto; margin: 16px; }
  .logo { max-height: 40px; }
  h1 { font-size: 24px; }
  h1::after { margin-top: 8px; }
  input[type="text"], input[type="password"] { min-height: 42px; padding: 8px 12px; }
  button[type="submit"] { min-height: 44px; }
  .tree-left { left: -34vw; bottom: -5%; width: clamp(260px, 38svh, 340px); }
  .tree-right { right: -34vw; bottom: -5%; width: clamp(260px, 38svh, 340px); }
  .wind { left: -10%; top: 49%; width: 120%; }
  .sign { left: auto; right: 4%; bottom: calc(clamp(12px, calc(60svh - 372px), 96px) + 44px); width: 20vw; }
  .group { left: 14%; bottom: clamp(6px, 1svh, 10px); width: 72vw; }
  .agent-arm, .wife-arm { z-index: 7; }
  .group-base { z-index: 8; }
  .login:not(.plain) .foot { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .scene * { animation: none !important; opacity: 1 !important; transform: none !important; }
}
