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

:root {
  --bg: #f9fafb;
  --text: #171717;
  --text-muted: #5a5f66;
  --button: #111111;
  --button-hover: #252525;
  --tr: 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

body {
  min-height: 100vh;
  font-family: 'Montserrat', sans-serif;
  background: var(--bg);
  color: var(--text);
}

.page {
  min-height: 100vh;
  padding: 42px clamp(16px, 3vw, 48px);
}

.hero {
  position: relative;
  width: min(1320px, 100%);
  min-height: calc(100vh - 84px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(320px, 560px) minmax(360px, 620px);
  align-items: center;
  justify-content: space-between;
  gap: clamp(28px, 4vw, 72px);
}

.brand-mark {
  position: absolute;
  top: 0;
  left: 0;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
}

.brand-mark-image {
  display: block;
  height: clamp(24px, 2vw, 30px);
  width: auto;
  max-width: min(180px, 34vw);
  object-fit: contain;
}

.hero-content {
  margin-top: clamp(40px, 6vw, 76px);
  animation: revealUp 0.55s var(--tr) both;
  max-width: 500px;
}

.title {
  font-family: 'Lora', serif;
  font-size: clamp(40px, 4.2vw, 62px);
  line-height: 1.02;
  font-weight: 400;
  letter-spacing: -0.02em;
  max-width: 11ch;
}

.lead {
  margin-top: 16px;
  font-size: clamp(16px, 1.05vw, 19px);
  line-height: 1.45;
  color: var(--text-muted);
  max-width: 100%;
}

.lead-line {
  display: block;
  white-space: nowrap;
}

.auth-card {
  margin-top: clamp(24px, 2.4vw, 30px);
  width: min(440px, 100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auth-mode-btn {
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(28, 35, 42, 0.12);
  background: rgba(255, 255, 255, 0.8);
  color: #3b4650;
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--tr), color var(--tr), border-color var(--tr);
}

.auth-mode-btn.is-active {
  background: #111111;
  border-color: #111111;
  color: #ffffff;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-label {
  font-size: 13px;
  line-height: 1.25;
  color: #4b5862;
  font-weight: 600;
}

.auth-input {
  width: 100%;
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid rgba(28, 35, 42, 0.14);
  padding: 0 12px;
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  color: #172026;
  background: rgba(255, 255, 255, 0.92);
  outline: none;
  transition: border-color var(--tr), box-shadow var(--tr);
}

.auth-input:focus-visible {
  border-color: #1e6ef7;
  box-shadow: 0 0 0 3px rgba(30, 110, 247, 0.14);
}

.login-button {
  margin-top: 4px;
  width: 100%;
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 15px;
  background: var(--button);
  color: #ffffff;
  border: none;
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform var(--tr), background var(--tr), box-shadow var(--tr);
  cursor: pointer;
  font-family: 'Montserrat', sans-serif;
}

.login-button:hover {
  transform: translateY(-1px);
  background: var(--button-hover);
}

.login-button:disabled,
.login-button[aria-busy="true"] {
  opacity: 0.82;
  cursor: wait;
  transform: none;
}

.login-button:focus-visible {
  outline: 2px solid #1e6ef7;
  outline-offset: 2px;
}

.auth-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(27, 31, 36, 0.34);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}
.auth-modal-backdrop[hidden] {
  display: none !important;
}

.auth-modal {
  position: relative;
  width: min(100%, 440px);
  border-radius: 24px;
  border: 1px solid rgba(28, 35, 42, 0.12);
  background: rgba(255, 255, 255, 0.97);
  padding: 20px 18px 16px;
  box-shadow: 0 24px 50px rgba(18, 24, 30, 0.2);
}

.auth-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(28, 35, 42, 0.12);
  background: rgba(255, 255, 255, 0.9);
  color: #2f3941;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.auth-modal-status {
  min-height: 18px;
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-muted);
}

.auth-modal-status[data-tone="success"] { color: #2f8c66; }
.auth-modal-status[data-tone="danger"] { color: #c45555; }

body.auth-modal-open {
  overflow: hidden;
}

.hero-image-wrap {
  justify-self: end;
  width: min(620px, 100%);
  animation: revealIn 0.65s var(--tr) both;
}

.hero-image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 28px;
  border: 1px solid #d9d9d9;
}

@keyframes revealUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes revealIn {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 1040px) {
  .hero {
    min-height: unset;
    grid-template-columns: 1fr;
    justify-items: start;
    gap: 24px;
  }

  .brand-mark {
    position: static;
  }

  .hero-content {
    margin-top: 0;
    order: 1;
  }

  .hero-image-wrap {
    order: 2;
    justify-self: stretch;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 22px 14px 20px;
  }

  .hero {
    justify-items: center;
  }

  .hero-content {
    text-align: center;
    max-width: 100%;
  }

  .title {
    font-size: clamp(36px, 9.2vw, 44px);
    margin-inline: auto;
  }

  .lead {
    font-size: 15px;
    margin-inline: auto;
  }

  .lead-line {
    white-space: normal;
  }

  .auth-card {
    width: 100%;
  }

  .brand-mark {
    align-self: flex-start;
    justify-self: flex-start;
  }

  .brand-mark-image {
    max-width: min(160px, 56vw);
  }

  .hero-image {
    border-radius: 18px;
  }

  .auth-modal {
    border-radius: 20px;
    padding: 18px 14px 14px;
  }
}
