:root {
  --color-bg-deep: #0f2e2b; /* deep teal, page background */
  --color-bg-mid: #173b36; /* lighter teal, gradient stop */
  --color-card: #faf8f3; /* warm off-white card surface */
  --color-ink: #16241f; /* near-black text on light surfaces */
  --color-ink-soft: #5b6e67; /* muted secondary text */
  --color-accent: #e8a33d; /* warm amber — primary action */
  --color-accent-dark: #c9852a; /* amber, pressed/hover state */
  --color-error: #d64545; /* coral-red — errors */
  --color-error-bg: #fcebea; /* pale error background */
  --color-success: #3e8e6b; /* green — valid state */
  --color-line: #e4e0d6; /* hairline borders on the card */

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;

  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --shadow-card: 0 30px 60px -20px rgba(15, 46, 43, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

body {
  font-family: var(--font-body);
  color: var(--color-ink);
  background: linear-gradient(
    160deg,
    var(--color-bg-deep) 0%,
    var(--color-bg-mid) 55%,
    #1f4a43 100%
  );
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow-x: hidden;
}

/* Decorative organic blobs floating in the background — the page's signature touch */
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.35;
  z-index: 0;
  pointer-events: none;
}
.blob--one {
  width: 420px;
  height: 420px;
  background: #2f6e63;
  top: -120px;
  left: -140px;
}
.blob--two {
  width: 380px;
  height: 380px;
  background: var(--color-accent);
  opacity: 0.18;
  bottom: -160px;
  right: -120px;
}

/* LAYOUT SHELL — split screen on desktop */
.shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 940px;
  min-height: 600px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--color-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* Left panel — brand / welcome side, decorative, hidden on small screens */
.brand-panel {
  background:
    radial-gradient(
      circle at 20% 15%,
      rgba(232, 163, 61, 0.35),
      transparent 55%
    ),
    linear-gradient(200deg, #16403a 0%, #0f2e2b 100%);
  color: #f3efe4;
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.brand-mark svg {
  flex-shrink: 0;
}

.brand-copy h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  line-height: 1.15;
  margin: 0 0 14px;
}

.brand-copy p {
  font-size: 0.98rem;
  line-height: 1.6;
  color: #cfe0d9;
  margin: 0;
  max-width: 32ch;
}

.brand-foot {
  font-size: 0.82rem;
  color: #9ab3ab;
}

/* Right panel — the actual form */
.form-panel {
  padding: 44px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.form-header h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.7rem;
  margin: 0 0 6px;
}

.form-header p {
  color: var(--color-ink-soft);
  font-size: 0.92rem;
  margin: 0 0 24px;
}

/* TOGGLE — sliding pill switch between Login / Sign up */
.toggle {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #efebe1;
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 28px;
}

.toggle-indicator {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  background: var(--color-card);
  border-radius: 999px;
  box-shadow: 0 4px 10px rgba(22, 36, 31, 0.12);
  transition: transform 0.35s cubic-bezier(0.65, 0, 0.35, 1);
}

.shell[data-mode="signup"] .toggle-indicator {
  transform: translateX(100%);
}

.toggle button {
  position: relative;
  z-index: 1;
  background: none;
  border: none;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-ink-soft);
  cursor: pointer;
  border-radius: 999px;
  transition: color 0.25s ease;
}

.toggle button[aria-selected="true"] {
  color: var(--color-ink);
}

/* FORM FIELDS */
form {
  display: none;
  flex-direction: column;
  gap: 18px;
}

form.active {
  display: flex;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--color-ink);
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.field input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.96rem;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-line);
  background: #ffffff;
  color: var(--color-ink);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.field input::placeholder {
  color: #b7b0a0;
}

.field input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 4px rgba(232, 163, 61, 0.18);
}

/* Error state */
.field.invalid input {
  border-color: var(--color-error);
  background: var(--color-error-bg);
}

.field.invalid input:focus {
  box-shadow: 0 0 0 4px rgba(214, 69, 69, 0.15);
}

/* Success state, once a field passes validation */
.field.valid input {
  border-color: var(--color-success);
}

.error-msg {
  font-size: 0.8rem;
  color: var(--color-error);
  min-height: 16px;
  display: none;
}

.field.invalid .error-msg {
  display: block;
}

/* Password show/hide toggle */
.toggle-visibility {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--color-ink-soft);
  display: flex;
  align-items: center;
}
.toggle-visibility:hover {
  color: var(--color-ink);
}

/* Password strength meter (signup only) */
.strength {
  display: flex;
  gap: 5px;
  margin-top: 2px;
}
.strength-bar {
  height: 4px;
  flex: 1;
  background: var(--color-line);
  border-radius: 4px;
  transition: background 0.25s ease;
}
.strength-label {
  font-size: 0.76rem;
  color: var(--color-ink-soft);
  margin-top: 2px;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-ink-soft);
}

.checkbox-line input {
  accent-color: var(--color-accent);
  width: 16px;
  height: 16px;
}

.link {
  color: var(--color-accent-dark);
  text-decoration: none;
  font-weight: 600;
}
.link:hover {
  text-decoration: underline;
}

/* Submit button */
.submit-btn {
  margin-top: 6px;
  padding: 13px 18px;
  background: var(--color-accent);
  color: #22190a;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.96rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    background 0.2s ease,
    transform 0.15s ease;
}
.submit-btn:hover {
  background: var(--color-accent-dark);
}
.submit-btn:active {
  transform: scale(0.98);
}
.submit-btn:disabled {
  background: #e7dfc9;
  color: #b2a98f;
  cursor: not-allowed;
}

/* Top-level form banner for success / general errors */
.banner {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 4px;
}
.banner.show {
  display: flex;
}
.banner.success {
  background: #e8f3ec;
  color: var(--color-success);
}
.banner.error {
  background: var(--color-error-bg);
  color: var(--color-error);
}

.switch-line {
  text-align: center;
  font-size: 0.87rem;
  color: var(--color-ink-soft);
  margin-top: 20px;
}

/* RESPONSIVE — collapse to single column */
@media (max-width: 820px) {
  .shell {
    grid-template-columns: 1fr;
    max-width: 460px;
  }
  .brand-panel {
    display: none;
  }
  .form-panel {
    padding: 36px 26px;
  }
}

@media (max-width: 400px) {
  body {
    padding: 12px;
  }
  .form-panel {
    padding: 28px 18px;
  }
  .form-header h2 {
    font-size: 1.4rem;
  }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  .toggle-indicator,
  .submit-btn,
  .field input {
    transition: none;
  }
}

/* Visible keyboard focus for accessibility */
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--color-accent-dark);
  outline-offset: 2px;
}
