/* Страницы до входа (вход, регистрация, восстановление пароля). Цвета, шрифты и радиусы — из theme.css. */
:root {
  --nocturne-art-ratio: 1.2496; /* 1402 × 1122 — пропорции иллюстрации */
}
html, body { min-height: 100%; margin: 0; }
body.nocturne-login {
  color: var(--c-text);
  background: var(--c-auth-bg);
  font: 15px/1.5 var(--f-sans);
}
.nocturne-login *, .nocturne-login *::before, .nocturne-login *::after { box-sizing: border-box; }

/* ── Раскладка. ПК и альбомная ориентация: иллюстрация целиком слева, форма справа ─────────── */
.nocturne-page {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100svh;
}
.nocturne-art {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  /* вписываем целиком: по высоте экрана, но оставляем форме не меньше 440 px */
  width: min(calc(100vh * var(--nocturne-art-ratio)), calc(100vw - 440px));
  width: min(calc(100svh * var(--nocturne-art-ratio)), calc(100vw - 440px));
  background: var(--c-auth-bg) url("img/mozaika-login.61cc234abb9d.webp") left center / contain no-repeat;
}
/* светлая тема: мягкий светлый оверлей поверх иллюстрации (в тёмной прозрачный) */
.nocturne-art::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--c-art-veil);
  pointer-events: none;
}
/* угловой переключатель темы */
.nocturne-theme-corner { position: fixed; top: max(14px, env(safe-area-inset-top)); right: 14px; z-index: 5; }
/* мягкий переход от иллюстрации к фону формы */
.nocturne-art::after {
  content: "";
  position: absolute;
  inset: 0 0 0 auto;
  width: 10%;
  background: linear-gradient(90deg, rgba(var(--c-auth-bg-rgb), 0), var(--c-auth-bg));
  pointer-events: none;
}
.nocturne-mobile-shade { display: none; }
.nocturne-panel {
  position: relative;
  z-index: 1;
  container-type: inline-size;
  justify-self: center;
  align-self: center;
  width: min(100% - 48px, 440px);
  margin: 32px 0;
  text-align: center;
}

/* ── Оформление ─────────────────────────────────────────────────────────────────────────────── */
.nocturne-heading { margin: 0 0 14px; }
.nocturne-tagline {
  margin: 0;
  color: var(--c-gold-light);
  font: italic 500 clamp(30px, 2.4vw, 40px)/1.08 var(--f-serif);
  text-shadow: var(--shadow-text);
}
.nocturne-flourish {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 78%;
  margin: 12px auto 0;
  color: var(--c-gold);
}
.nocturne-flourish span {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--c-gold));
}
.nocturne-flourish span:last-child { transform: rotate(180deg); }
.nocturne-flourish b { font-size: 13px; font-weight: 400; }
.nocturne-card {
  padding: 28px 28px 24px;
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-lg);
  background: var(--g-card);
  box-shadow: var(--shadow-card);
}
.nocturne-card h1 {
  margin: 0;
  color: var(--c-text);
  font: 500 32px/1.1 var(--f-serif);
}
.nocturne-intro { margin: 8px 0 22px; color: var(--c-muted); font-size: 14px; }
.nocturne-text { margin: 14px 0 20px; color: var(--c-text); font-size: 15px; text-align: left; }
.nocturne-form { display: grid; gap: 16px; text-align: left; }
.nocturne-field { display: grid; gap: 7px; }
.nocturne-field > label {
  margin: 0;
  padding-left: 3px;
  color: var(--c-label);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
}
.nocturne-input-wrap {
  display: flex;
  align-items: center;
  min-height: 58px;
  padding: 0 14px;
  border: 1px solid var(--c-line-field);
  border-radius: var(--r-md);
  background: var(--c-field);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.nocturne-input-wrap:focus-within {
  border-color: var(--c-gold-light);
  background: var(--c-field-focus);
  box-shadow: var(--focus-ring);
}
.nocturne-input-wrap > svg {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  margin-right: 12px;
  fill: none;
  stroke: var(--c-gold-light);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* 16 px и больше: iOS не увеличивает страницу при касании поля */
.nocturne-input-wrap input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--c-text-strong);
  background: transparent;
  font: 17px var(--f-sans);
}
.nocturne-input-wrap input::placeholder { color: var(--c-placeholder); }
.nocturne-input-wrap input:-webkit-autofill {
  -webkit-text-fill-color: var(--c-text-strong);
  box-shadow: 0 0 0 40px var(--c-bg) inset;
  caret-color: var(--c-text-strong);
}
.nocturne-password-toggle {
  display: grid;
  flex: 0 0 34px;
  place-items: center;
  width: 34px;
  height: 38px;
  padding: 4px;
  border: 0;
  color: var(--c-gold-light);
  background: transparent;
  cursor: pointer;
}
.nocturne-password-toggle svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.nocturne-password-toggle .slash { opacity: 0; }
.nocturne-password-toggle[aria-pressed="true"] .slash { opacity: 1; }
.nocturne-check {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  color: var(--c-text);
  font-size: 14px;
  cursor: pointer;
}
.nocturne-check input { flex: 0 0 auto; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--c-gold); }
.nocturne-help { color: var(--c-muted); font-size: 13px; padding-left: 3px; }
.nocturne-help ul { margin: 2px 0 0; padding-left: 18px; }
.nocturne-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 17px;
  min-height: 56px;
  margin-top: 6px;
  padding: 0 22px;
  border: 1px solid var(--c-gold-light);
  border-radius: var(--r-pill);
  color: var(--c-on-gold);
  background: var(--g-gold);
  box-shadow: var(--shadow-button);
  font: 700 16px var(--f-sans);
  text-decoration: none;
  cursor: pointer;
  transition: filter .2s, transform .2s;
}
.nocturne-submit:hover { filter: brightness(1.07); transform: translateY(-1px); }
.nocturne-submit .arrow { font-size: 25px; line-height: 12px; font-weight: 400; }
.nocturne-submit.ghost { color: var(--c-gold-light); background: transparent; box-shadow: none; }
.nocturne-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 13px;
  margin-top: 18px;
  color: var(--c-gold-muted);
  font-size: 14px;
}
.nocturne-links form { margin: 0; }
.nocturne-links a, .nocturne-text a { color: var(--c-gold-pale); text-decoration: none; }
.nocturne-links a:hover, .nocturne-text a:hover { color: var(--c-text-strong); text-decoration: underline; text-underline-offset: 4px; }
.nocturne-link-button { padding: 0; border: 0; color: var(--c-gold-pale); background: none; font: inherit; cursor: pointer; }
.nocturne-link-button:hover { color: var(--c-text-strong); text-decoration: underline; text-underline-offset: 4px; }
/* Сноска во всю ширину формы: размер шрифта считается от ширины панели (cqw) */
.nocturne-footnote {
  margin: 14px 0 0;
  color: var(--c-footnote);
  font-size: 13px;
  font-size: 3.5cqw;
  letter-spacing: .035em;
  white-space: nowrap;
  text-shadow: var(--shadow-footnote);
}
.nocturne-field-error, .nocturne-error-summary { color: var(--c-bad-soft); font-size: 13px; }
.nocturne-field-error ul, .nocturne-error-summary ul { margin: 0; padding: 0; list-style: none; }
.nocturne-error-summary, .nocturne-messages li {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--c-bad-line);
  border-radius: var(--r-sm);
  background: var(--c-bad-bg);
  list-style: none;
  text-align: left;
}
.nocturne-messages { margin: 0 0 14px; padding: 0; }
.nocturne-messages li { font-size: 14px; }
.nocturne-messages li.success { border-color: var(--c-ok-line); background: var(--c-ok-bg); color: var(--c-ok-soft); }
.nocturne-messages li:not(.success) { color: var(--c-bad-soft); }
.nocturne-login button:focus-visible, .nocturne-login a:focus-visible, .nocturne-check input:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 3px;
}

/* ── Планшет в портрете: иллюстрация целиком сверху, форма под ней ──────────────────────────── */
@media (min-width: 521px) and (orientation: portrait) {
  .nocturne-page { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; align-content: start; }
  .nocturne-art {
    position: relative;
    width: 100%;
    height: auto;
    aspect-ratio: 1402 / 1122;
    max-height: 62svh;
    background-position: center top;
  }
  .nocturne-art::after { inset: auto 0 0 0; width: auto; height: 22%; background: linear-gradient(180deg, rgba(var(--c-auth-bg-rgb), 0), var(--c-auth-bg)); }
  .nocturne-panel { margin: -24px 0 40px; align-self: start; }
}

/* ── Смартфон: картинка сверху (кадрирована), форма снизу ───────────────────────────────────── */
@media (max-width: 520px) {
  .nocturne-page {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(230px, 42svh) auto;
    align-content: start;
    position: relative;
    padding: 0 14px max(18px, env(safe-area-inset-bottom));
  }
  .nocturne-art {
    position: relative;
    top: auto;
    width: calc(100% + 28px);
    height: 42svh;
    min-height: 230px;
    margin: 0 -14px;
    background-position: 53% 43%;
    background-size: cover;
  }
  .nocturne-art::after { display: none; }
  .nocturne-mobile-shade {
    display: block;
    position: absolute;
    inset: 0 0 auto;
    height: 46svh;
    min-height: 250px;
    pointer-events: none;
    background: linear-gradient(180deg, transparent 55%, var(--c-auth-bg) 100%);
  }
  .nocturne-panel { width: 100%; margin: -4px 0 0; align-self: start; }
  .nocturne-heading { margin-bottom: 10px; }
  .nocturne-tagline { font-size: 29px; }
  .nocturne-flourish { margin-top: 8px; }
  .nocturne-card { padding: 20px 17px 18px; border-radius: var(--r-lg); }
  .nocturne-card h1 { font-size: 27px; }
  .nocturne-intro { margin: 6px 0 16px; }
  .nocturne-form { gap: 13px; }
  .nocturne-input-wrap { min-height: 54px; }
  .nocturne-submit { min-height: 52px; }
  .nocturne-links { margin-top: 15px; }
  .nocturne-footnote { margin-top: 12px; }
}
