/* ============================================================
   Nuval — landing + login
   ============================================================ */

:root {
  --cream:        #fdf4e6;
  --cream-dim:    rgba(253, 244, 230, 0.72);
  --ember:        #ff8a3d;
  --ember-deep:   #e4571b;
  --ink:          #140a06;

  --card-w:       clamp(320px, 30vw, 452px);
  --edge:         clamp(20px, 4.2vw, 64px);   /* page margin for button + brand */

  --ease:         cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { overflow: hidden; }

/* ------------------------------------------------------------
   Page layer — everything here blurs when the modal opens
   ------------------------------------------------------------ */
.page {
  position: fixed;
  inset: 0;
  transition: filter 0.55s var(--ease), transform 0.55s var(--ease);
  will-change: filter, transform;
}

body.modal-open .page {
  filter: blur(16px) saturate(1.08) brightness(0.82);
  /* slight overscan so the blur does not reveal soft edges */
  transform: scale(1.045);
}

.bg {
  position: absolute;
  inset: 0;
  background: url("Nuval_login_warm.png") center / cover no-repeat;
}

/* deepen the dark corner so the wordmark always has contrast */
.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 8% 92%, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0) 55%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.28) 0%, rgba(0, 0, 0, 0) 30%);
  pointer-events: none;
}

/* ------------------------------------------------------------
   Top right — Try Nuval
   ------------------------------------------------------------ */
.topbar {
  position: absolute;
  top: var(--edge);
  right: var(--edge);
  z-index: 2;
}

.try-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  padding: 0.82em 1.55em;
  font: 600 clamp(15px, 1.15vw, 18px)/1 "Inter", sans-serif;
  letter-spacing: 0.01em;
  color: var(--cream);
  background: rgba(38, 12, 2, 0.22);
  border: 1.5px solid rgba(255, 240, 220, 0.85);
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(8px) saturate(1.2);
  -webkit-backdrop-filter: blur(8px) saturate(1.2);
  box-shadow:
    0 0 26px rgba(255, 168, 82, 0.45),
    0 0 60px rgba(255, 120, 40, 0.22),
    inset 0 0 18px rgba(255, 255, 255, 0.10);
  transition: transform 0.28s var(--ease), background 0.28s var(--ease),
              box-shadow 0.28s var(--ease), border-color 0.28s var(--ease);
  animation: rise-in 0.9s var(--ease) 0.1s both;
}

.try-btn:hover {
  background: rgba(255, 240, 220, 0.16);
  border-color: #fff6ea;
  transform: translateY(-2px);
  box-shadow:
    0 0 34px rgba(255, 186, 110, 0.62),
    0 0 80px rgba(255, 120, 40, 0.32),
    inset 0 0 22px rgba(255, 255, 255, 0.16);
}

.try-btn:active { transform: translateY(0); }

.try-btn .arrow {
  width: 1.15em;
  height: 1.15em;
  transition: transform 0.28s var(--ease);
}

.try-btn:hover .arrow { transform: translateX(4px); }

/* ------------------------------------------------------------
   Bottom left — wordmark + tagline
   ------------------------------------------------------------ */
.brand {
  position: absolute;
  left: var(--edge);
  bottom: clamp(24px, 5vh, 68px);
  z-index: 2;
  animation: rise-in 1.1s var(--ease) 0.18s both;
}

.wordmark {
  display: block;
  width: clamp(240px, 33vw, 520px);
  height: auto;
  color: var(--cream);
  filter: drop-shadow(0 4px 34px rgba(0, 0, 0, 0.55));
}

.tagline {
  margin: clamp(10px, 1.4vh, 20px) 0 0 0.35em;
  font-family: "Jost", "Inter", sans-serif;
  font-weight: 300;
  font-size: clamp(16px, 1.75vw, 30px);
  letter-spacing: 0.005em;
  color: var(--cream);
  text-shadow: 0 2px 22px rgba(0, 0, 0, 0.55);
}

/* ------------------------------------------------------------
   Scrim + modal layer
   ------------------------------------------------------------ */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(14, 6, 2, 0.42);
  opacity: 0;
  transition: opacity 0.45s var(--ease);
}

.scrim.is-open { opacity: 1; }

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: flex-end;      /* card sits on the right, as in the mockup */
  padding: 4vh var(--edge);
  pointer-events: none;           /* clicks fall through to the scrim */
}

.login-card {
  pointer-events: auto;
  position: relative;
  width: var(--card-w);
  max-height: 92vh;
  overflow-y: auto;
  padding: clamp(26px, 2.6vw, 38px) clamp(22px, 2.4vw, 34px) clamp(28px, 2.8vw, 38px);
  border-radius: 22px;
  border: 1px solid rgba(255, 214, 170, 0.18);
  background:
    linear-gradient(155deg, rgba(58, 25, 10, 0.86) 0%, rgba(26, 12, 6, 0.90) 45%,
                            rgba(16, 8, 4, 0.92) 100%);
  backdrop-filter: blur(26px) saturate(1.3);
  -webkit-backdrop-filter: blur(26px) saturate(1.3);
  box-shadow:
    0 40px 90px -20px rgba(0, 0, 0, 0.75),
    0 0 60px rgba(255, 110, 40, 0.12),
    inset 0 1px 0 rgba(255, 235, 210, 0.10);
  opacity: 0;
  transform: translateY(22px) scale(0.965);
  transition: opacity 0.42s var(--ease), transform 0.42s var(--ease);
}

.login-card.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.login-card.shake { animation: shake 0.42s var(--ease); }

/* close */
.close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--cream-dim);
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}

.close-btn svg { width: 18px; height: 18px; }
.close-btn:hover { color: var(--cream); background: rgba(255, 255, 255, 0.08); }

/* headings */
.login-title {
  margin: 0.2em 0 0;
  text-align: center;
  font-size: clamp(21px, 1.55vw, 26px);
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--cream);
}

.login-sub {
  margin: 0.55em 0 1.9em;
  text-align: center;
  font-size: clamp(13px, 0.95vw, 15px);
  color: rgba(253, 244, 230, 0.58);
}

/* fields */
.field { margin-bottom: 1.15rem; }

.field label,
.label-row label {
  display: block;
  margin-bottom: 0.55em;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.005em;
  color: rgba(253, 244, 230, 0.88);
}

.label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.link-btn {
  padding: 0;
  font: 500 12.5px/1 "Inter", sans-serif;
  color: var(--ember);
  background: none;
  border: 0;
  cursor: pointer;
  transition: color 0.2s var(--ease);
}

.link-btn:hover { color: #ffb37a; text-decoration: underline; }

.field input {
  width: 100%;
  padding: 0.95em 1.05em;
  font: 400 15px/1.2 "Inter", sans-serif;
  color: var(--cream);
  background: rgba(255, 235, 210, 0.055);
  border: 1px solid rgba(255, 214, 170, 0.16);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.22s var(--ease), background 0.22s var(--ease),
              box-shadow 0.22s var(--ease);
}

.field input::placeholder { color: rgba(253, 244, 230, 0.34); }

.field input:hover { border-color: rgba(255, 214, 170, 0.28); }

.field input:focus {
  background: rgba(255, 235, 210, 0.085);
  border-color: rgba(255, 138, 61, 0.75);
  box-shadow: 0 0 0 3px rgba(255, 138, 61, 0.16);
}

.field input.invalid {
  border-color: rgba(255, 96, 72, 0.8);
  box-shadow: 0 0 0 3px rgba(255, 96, 72, 0.14);
}

/* keep autofill from painting a white box over the dark card */
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--cream);
  -webkit-box-shadow: 0 0 0 1000px rgba(46, 20, 8, 0.98) inset;
  caret-color: var(--cream);
}

/* message */
.form-msg {
  margin: 0 0 0.9rem;
  min-height: 1.15em;
  font-size: 13px;
  line-height: 1.35;
  color: #ff8d76;
  opacity: 0;
  transition: opacity 0.22s var(--ease);
}

.form-msg.show { opacity: 1; }
.form-msg.ok   { color: #ffc48a; }

/* submit */
.submit-btn {
  width: 100%;
  padding: 1em 1.2em;
  font: 600 15px/1 "Inter", sans-serif;
  letter-spacing: 0.01em;
  color: #fff;
  background: linear-gradient(100deg, var(--ember) 0%, var(--ember-deep) 100%);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 8px 26px -8px rgba(255, 110, 40, 0.7);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease),
              filter 0.2s var(--ease);
}

.submit-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 12px 32px -8px rgba(255, 110, 40, 0.85);
}

.submit-btn:active { transform: translateY(0); }

.submit-btn[disabled] {
  cursor: not-allowed;
  filter: saturate(0.55) brightness(0.85);
  transform: none;
}

/* shared focus ring */
.try-btn:focus-visible,
.close-btn:focus-visible,
.link-btn:focus-visible,
.submit-btn:focus-visible {
  outline: 2px solid rgba(255, 200, 150, 0.9);
  outline-offset: 3px;
}

/* ------------------------------------------------------------
   Animations
   ------------------------------------------------------------ */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(7px); }
  60%      { transform: translateX(-5px); }
  80%      { transform: translateX(3px); }
}

/* ------------------------------------------------------------
   Responsive — below 820px the card centers and the brand shrinks
   ------------------------------------------------------------ */
@media (max-width: 820px) {
  .modal-layer {
    justify-content: center;
    padding: 20px;
  }

  .login-card { width: min(100%, 420px); }

  .brand { bottom: 26px; }
  .wordmark { width: min(62vw, 300px); }
}

@media (max-height: 620px) {
  .brand { bottom: 18px; }
  .tagline { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
