@import url("https://use.typekit.net/pxn0lkd.css");

:root {
  color-scheme: light;
  --ink: #2a211d;
  --ink-muted: rgba(42, 33, 29, 0.72);
  --glass: rgba(255, 248, 240, 0.6);
  --glass-border: rgba(255, 255, 255, 0.5);
  --shadow: 0 30px 80px rgba(16, 12, 9, 0.35);
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: "freight-text-pro", serif;
  color: var(--ink);
  overflow: hidden;
}

.bg-video-wrap {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
}

.bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(90%);
  transform: scale(1.08);
  opacity: 0;
  transition: opacity 1.2s ease;
}

.bg-video.is-active {
  opacity: 1;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 245, 236, 0.5), rgba(34, 27, 22, 0.35));
  z-index: -1;
}

.page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px 18px;
  transition: opacity 180ms ease, visibility 0s linear 180ms;
}

.login-panel {
  width: min(640px, 92vw);
}

.login-card {
  width: 100%;
  background: linear-gradient(160deg, rgba(255, 246, 238, 0.82) 0%, rgba(236, 225, 217, 0.78) 100%);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 34px;
  padding: 42px 44px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  display: grid;
  gap: 18px;
  animation: fade-up 0.9s ease both;
}

.login-logo {
  width: min(240px, 100%);
  margin: 6px 0 10px;
}

.login-overline {
  font-family: "neue-haas-grotesk-text", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.4em;
  font-size: 0.7rem;
  margin: 0;
  color: var(--accent-dark);
}

.field {
  display: grid;
  gap: 8px;
  font-family: "neue-haas-grotesk-text", sans-serif;
  font-size: 1.2rem;
  text-transform: none;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.1em;
  color: rgba(42, 33, 29, 0.65);
}

.field input {
  font-family: "neue-haas-grotesk-text", sans-serif;
  padding: 16px 20px;
  border-radius: 16px;
  border: 1px solid rgba(31, 26, 22, 0.18);
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  font-variant-caps: all-small-caps;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.92);
  color: #2a211d;
  box-shadow: inset 0 0 0 1px rgba(31, 26, 22, 0.08);
}

.field input::placeholder {
  font-family: "neue-haas-grotesk-text", sans-serif;
  color: rgba(42, 33, 29, 0.45);
  letter-spacing: 0.04em;
  font-variant-caps: all-small-caps;
  text-transform: uppercase;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  color: var(--ink-muted);
  font-family: "neue-haas-grotesk-text", sans-serif;
}

.primary-button,
.secondary-button {
  font-family: "neue-haas-grotesk-text", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border: none;
  cursor: pointer;
}

.primary-button {
  background: transparent;
  color: var(--ink);
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--ink);
  font-size: 0.82rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease, color 0.3s ease;
}

.primary-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(31, 26, 22, 0.2);
  background: var(--ink);
  color: #fff;
}

.login-error {
  margin: -8px 0 0;
  font-family: "neue-haas-grotesk-text", sans-serif;
  font-size: 0.98rem;
  line-height: 1.4;
  color: #6b0f1a;
}

.divider {
  position: relative;
  text-align: center;
  font-family: "neue-haas-grotesk-text", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.7rem;
  color: var(--ink-muted);
}

.divider::before,
.divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: rgba(31, 26, 22, 0.2);
}

.divider::before {
  left: 0;
}

.divider::after {
  right: 0;
}

.secondary-button {
  background: transparent;
  border: 1px solid rgba(31, 26, 22, 0.35);
  padding: 12px;
  border-radius: 12px;
  color: var(--ink);
  transition: border-color 0.3s ease, transform 0.3s ease;
}

.secondary-button:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.help-text {
  margin: 0;
  color: var(--ink-muted);
  font-size: 1rem;
  line-height: 1.6;
  font-family: "neue-haas-grotesk-text", sans-serif;
}

.help-text a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(42, 33, 29, 0.4);
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  .login-card {
    padding: 32px 26px;
  }
}

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

/* ===== Loading Overlay (Option B) ===== */
.loading-overlay {
  position: fixed;
  inset: 0;
  display: none; /* hidden by default */
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 44px;
  overflow: hidden;
  pointer-events: none;

  /* subtle dim */
  background: rgba(18, 13, 10, 0.26);

  /* glass blur */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  opacity: 0;
  transition: opacity 200ms ease;
}

.loading-overlay.is-visible {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.loading-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(155deg, rgba(255, 249, 240, 0), rgba(241, 228, 214, 0));
  opacity: 0;
  transition: opacity 420ms ease;
  pointer-events: none;
}

.loading-overlay.is-routing::before {
  opacity: 1;
  background: linear-gradient(155deg, rgba(255, 249, 240, 0.82), rgba(241, 228, 214, 0.92));
}

.loading-card {
  display: grid;
  justify-items: center;
  position: relative;
  z-index: 1;
  transition: opacity 320ms ease, transform 420ms cubic-bezier(0.22, 0.61, 0.36, 1), filter 320ms ease;

  width: min(560px, 92vw);
  padding: 58px 52px 46px;
  border-radius: 26px;

  /* warmer paper + gentler gradient */
  background: linear-gradient(
    145deg,
    rgba(255, 251, 246, 0.92),
    rgba(243, 232, 220, 0.86)
  );

  /* soften the border (this is a big reason it feels UI) */
  border: 1px solid rgba(42, 33, 29, 0.08);

  /* subtle inner highlight makes it feel like a card */
  box-shadow:
    0 26px 72px rgba(20, 14, 10, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);

  color: var(--ink);
}

.loading-overlay.is-routing .loading-card {
  opacity: 0;
  transform: translateY(-16px) scale(1.02);
  filter: blur(1.5px);
}

.loading-overlay.is-routing .loading-ellipsis span {
  animation-play-state: paused;
}

.loading-text {
  display: grid;
  gap: 6px;
  text-align: center;
  transform: translateY(-8px);
}

.loading-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.34em;
  margin-bottom: 10px;
  color: rgba(42, 33, 29, 0.62);
}

.loading-ellipsis span {
  font-size: 1.6rem;
  line-height: 1;
  font-weight: 400;
  animation: ellipsisBreath 1.9s ease-in-out infinite;
}

.loading-ellipsis span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-ellipsis span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes ellipsisBreath {
  0%, 100% {
    opacity: 0.35;
    transform: translateY(0) scale(0.96);
  }
  50% {
    opacity: 0.95;
    transform: translateY(-1px) scale(1);
  }
}

.loading-title {
  font-size: clamp(1.22rem, 2.8vw, 1.44rem);
  line-height: 1.15;
  letter-spacing: 0.085em;
  font-weight: 450;
  font-variant-caps: all-small-caps;
  text-transform: none;
  font-family: "freight-text-pro", serif;
  color: rgba(42, 33, 29, 0.92);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}

.loading-subtitle {
  margin-top: 2px;
  font-size: clamp(0.82rem, 1.6vw, 0.9rem);
  line-height: 1.45;
  letter-spacing: 0.11em;
  font-weight: 300;
  font-variant-caps: all-small-caps;
  font-family: "neue-haas-grotesk-text", sans-serif;
  color: rgba(42, 33, 29, 0.52);
}

/* Optional: prevent scrolling while loading */
body.is-loading {
  overflow: hidden;
}

body.is-loading .page {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 140ms ease, visibility 0s linear 0s;
}
