/* Auth pages — editorial spread, mobile-first.
   Brand tokens come from homepage.css:
   --color-blue #172e45 · --color-pink #ce3758 · --color-white #f7f2e9 */

.auth-page {
  min-height: calc(100vh - 230px);
  /* top padding clears the fixed site header */
  padding: 6rem 1.25rem 4rem;
  display: flex;
  justify-content: center;
  background: var(--color-white);
}

.auth-shell {
  width: 100%;
  max-width: 430px;
}

/* Brand panel — desktop only */
.auth-aside {
  display: none;
}

/* Header */
.auth-header {
  position: relative;
  padding: 1.25rem 0 1.5rem;
}

.auth-header__icon {
  display: none;
}

.auth-header__eyebrow {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-pink);
}

.auth-header__hanzi {
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.1em;
}

.auth-header__eyebrow em {
  font-family: 'Playfair', serif;
  font-style: italic;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0.02em;
  color: rgba(23, 46, 69, 0.55);
}

.auth-header__title {
  font-family: 'Gready', serif;
  font-size: clamp(2rem, 8vw, 2.4rem);
  font-weight: 700;
  line-height: 1.1;
  margin: 0 0 0.6rem;
  padding-right: 3.5rem; /* room for the seal on mobile */
  color: var(--color-blue);
}

.auth-header__subtitle {
  font-size: 1rem;
  line-height: 1.5;
  margin: 0;
  color: rgba(23, 46, 69, 0.65);
}

/* Seal chop — the brand mark */
.auth-seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  background: var(--color-pink);
  color: var(--color-white);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  border-radius: 9px;
  writing-mode: vertical-rl;
  transform: rotate(-3deg);
  box-shadow: 0 3px 12px rgba(206, 55, 88, 0.35);
  user-select: none;
}

.auth-header__seal {
  position: absolute;
  top: 1.5rem;
  right: 0;
}

/* Form */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.auth-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* Errors */
.auth-form__errors {
  background: rgba(206, 55, 88, 0.08);
  border: 1px solid rgba(206, 55, 88, 0.35);
  border-radius: 12px;
  padding: 0.9rem 1rem;
}

.error-list {
  list-style: none;
  padding: 0;
  margin: 0;
  color: #a92845;
  font-size: 0.9rem;
  line-height: 1.45;
}

.error-list li {
  margin-bottom: 0.5rem;
}

.error-list li:last-child {
  margin-bottom: 0;
}

/* Fields */
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.auth-field__label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: rgba(23, 46, 69, 0.78);
}

.auth-field__optional {
  font-family: 'Playfair', serif;
  font-style: italic;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: none;
  color: rgba(23, 46, 69, 0.5);
}

.auth-field input[type="email"],
.auth-field input[type="text"],
.auth-field input[type="tel"],
.auth-field input[type="password"],
.auth-field textarea,
.auth-field select {
  width: 100%;
  min-height: 52px;
  padding: 0.85rem 1rem;
  border: 1.5px solid rgba(23, 46, 69, 0.25);
  border-radius: 12px;
  font-size: 1rem; /* ≥16px stops iOS zooming the page on focus */
  font-family: 'Avenir Next', sans-serif;
  background: #ffffff;
  color: var(--color-blue);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-field textarea {
  min-height: 110px;
  resize: vertical;
}

.auth-field input:focus,
.auth-field textarea:focus,
.auth-field select:focus {
  outline: none;
  border-color: var(--color-pink);
  box-shadow: 0 0 0 3px rgba(206, 55, 88, 0.15);
}

.auth-field input::placeholder,
.auth-field textarea::placeholder {
  color: rgba(23, 46, 69, 0.4);
  opacity: 1;
}

.auth-field .errorlist {
  list-style: none;
  padding: 0;
  margin: 0;
  color: #a92845;
  font-size: 0.83rem;
  line-height: 1.4;
}

.auth-field__help {
  font-size: 0.8rem;
  line-height: 1.45;
  margin: 0;
  color: rgba(23, 46, 69, 0.55);
}

/* Password show/hide */
.auth-input-wrap {
  position: relative;
}

.auth-input-wrap input {
  padding-right: 3.25rem;
}

.auth-field__toggle {
  position: absolute;
  top: 50%;
  right: 0.35rem;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 10px;
  color: rgba(23, 46, 69, 0.5);
  cursor: pointer;
  transition: color 0.15s ease;
}

.auth-field__toggle:hover {
  color: var(--color-blue);
}

.auth-field__toggle:focus-visible {
  outline: 2px solid rgba(206, 55, 88, 0.5);
  outline-offset: -2px;
}

.auth-field__toggle .eye-off {
  display: none;
}

.auth-field__toggle.is-visible .eye-on {
  display: none;
}

.auth-field__toggle.is-visible .eye-off {
  display: block;
}

/* Checkbox */
.auth-checkbox {
  position: relative;
}

.auth-checkbox__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.auth-checkbox__label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 0;
  cursor: pointer;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
}

.auth-checkbox__checkmark {
  position: relative;
  width: 22px;
  height: 22px;
  min-width: 22px;
  margin-top: 1px;
  border: 1.5px solid rgba(23, 46, 69, 0.4);
  border-radius: 6px;
  background: #ffffff;
  transition: background 0.15s ease, border-color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-checkbox__checkmark::after {
  content: '';
  position: absolute;
  display: none;
  width: 5px;
  height: 10px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}

.auth-checkbox__input:checked ~ .auth-checkbox__label .auth-checkbox__checkmark {
  background: var(--color-pink);
  border-color: var(--color-pink);
}

.auth-checkbox__input:checked ~ .auth-checkbox__label .auth-checkbox__checkmark::after {
  display: block;
}

.auth-checkbox__input:focus-visible ~ .auth-checkbox__label .auth-checkbox__checkmark {
  box-shadow: 0 0 0 3px rgba(206, 55, 88, 0.25);
}

.auth-checkbox__text {
  flex: 1;
  font-size: 0.88rem;
  line-height: 1.5;
  color: rgba(23, 46, 69, 0.8);
}

/* Submit */
.auth-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  min-height: 54px;
  margin-top: 0.35rem;
  padding: 0.9rem 2rem;
  border: 0;
  border-radius: 999px;
  background: var(--color-blue);
  color: var(--color-white);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.auth-button:hover {
  background: var(--color-pink);
  color: var(--color-white);
}

.auth-button:active {
  transform: scale(0.985);
}

.auth-button:focus-visible {
  outline: 3px solid rgba(206, 55, 88, 0.4);
  outline-offset: 2px;
}

/* Footer */
.auth-footer {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(23, 46, 69, 0.14);
  text-align: center;
}

.auth-footer__text {
  font-size: 0.9rem;
  color: rgba(23, 46, 69, 0.65);
  margin: 0.4rem 0;
}

.auth-footer__link {
  color: var(--color-pink);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.auth-footer__link:hover {
  color: var(--color-blue);
  text-decoration: underline;
}

.auth-footer__link--forgot {
  display: block;
  margin-top: 0.9rem;
  font-size: 0.9rem;
}

/* Page-load rhythm — a quiet stagger, skipped for reduced motion */
@media (prefers-reduced-motion: no-preference) {
  .auth-header > *,
  .auth-form > *,
  .auth-footer {
    animation: auth-rise 0.45s ease both;
  }

  .auth-header > :nth-child(1) { animation-delay: 0.03s; }
  .auth-header > :nth-child(2) { animation-delay: 0.06s; }
  .auth-header > :nth-child(3) { animation-delay: 0.09s; }
  .auth-header > :nth-child(4) { animation-delay: 0.12s; }
  .auth-form > :nth-child(2) { animation-delay: 0.15s; }
  .auth-form > :nth-child(3) { animation-delay: 0.18s; }
  .auth-form > :nth-child(4) { animation-delay: 0.21s; }
  .auth-form > :nth-child(5) { animation-delay: 0.24s; }
  .auth-form > :nth-child(6) { animation-delay: 0.27s; }
  .auth-form > :nth-child(7) { animation-delay: 0.3s; }
  .auth-form > :nth-child(8) { animation-delay: 0.33s; }
  .auth-footer { animation-delay: 0.38s; }
}

@keyframes auth-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-field input,
  .auth-field textarea,
  .auth-field select,
  .auth-checkbox__checkmark,
  .auth-field__toggle,
  .auth-button,
  .auth-footer__link {
    transition: none;
  }
}

/* From 900px up the page becomes a magazine spread:
   ink brand panel on the left, form on paper to the right */
@media (min-width: 900px) {
  .auth-page {
    padding: 8rem 2rem 6rem;
    align-items: flex-start;
  }

  .auth-shell {
    max-width: 920px;
    display: grid;
    grid-template-columns: 320px 1fr;
    background: #fffdf9;
    border: 1px solid rgba(23, 46, 69, 0.14);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 24px 60px -30px rgba(23, 46, 69, 0.35);
  }

  .auth-aside {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 2rem;
    position: relative;
    overflow: hidden;
    padding: 2.5rem 2.25rem;
    background: var(--color-blue);
  }

  .auth-aside__hanzi {
    position: absolute;
    top: -0.5rem;
    right: 0.75rem;
    margin: 0;
    writing-mode: vertical-rl;
    font-size: 9rem;
    line-height: 0.95;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: rgba(247, 242, 233, 0.09);
    user-select: none;
    pointer-events: none;
  }

  .auth-aside .auth-seal {
    position: relative;
    width: 54px;
    height: 54px;
    font-size: 1rem;
  }

  .auth-aside__quote {
    position: relative;
    margin: 0;
    font-family: 'Playfair', serif;
    font-style: italic;
    font-size: 1.2rem;
    line-height: 1.55;
    color: rgba(247, 242, 233, 0.92);
  }

  .auth-main {
    padding: 2.75rem 3.25rem 3rem;
    min-width: 0;
  }

  .auth-header {
    padding: 0 0 1.5rem;
  }

  /* the ink panel carries the brand on desktop */
  .auth-header__eyebrow,
  .auth-header__seal {
    display: none;
  }

  .auth-header__title {
    font-size: 2.3rem;
    padding-right: 0;
  }
}

/* Compatibility: edit_profile.html still uses the container/card layout */
.auth-container {
  width: 100%;
  max-width: 430px;
}

.auth-card {
  background: transparent;
  border: 0;
  padding: 0;
}

@media (min-width: 640px) {
  .auth-container {
    max-width: 460px;
  }

  .auth-card {
    background: #fffdf9;
    border: 1px solid rgba(23, 46, 69, 0.14);
    border-radius: 20px;
    padding: 2.25rem 2rem;
  }
}

/* Legacy support for old class names (password reset done/confirm/complete) */
.login-form {
  min-height: calc(100vh - 268px);
}

.login-form .fieldWrapper {
  margin-bottom: 20px;
  position: relative;
  width: 100%;
}

.login-form ul li {
  font-size: 14px;
}

.fieldWrapper .help,
.fieldWrapper .help ~ ul {
  opacity: 0;
  visibility: hidden;
  transition: all .3s ease;
  font-size: 12px;
  line-height: 1.3;
  margin-bottom: 0;
  position: absolute;
  right: -260px;
  top: 50%;
  transform: translateY(-50%);
  max-width: 240px;
  background-color: var(--color-blue);
  color: var(--color-white);
  padding: 10px;
  border-radius: 8px;
}

.fieldWrapper .help ~ ul {
  padding: 10px 10px 10px 20px;
}

.fieldWrapper .help ~ ul ~ p {
  display: none;
}

.fieldWrapper .help ~ ul li {
  font-size: 12px;
}

@media screen and (pointer: fine) {
  .fieldWrapper:hover .help,
  .fieldWrapper:hover .help ~ ul  {
    opacity: 1;
    visibility: visible;
  }
}
