/* Login & register — Readers Bookshop: warm stage, elevated card, refined forms */

.auth-page main {
  flex: 1;
}

.auth-page__main {
  position: relative;
  flex: 1;
  width: 100%;
  min-width: 0;
  padding: clamp(1.75rem, 5vw, 3.25rem) var(--layout-gutter, clamp(0.9375rem, 2.85vw, 1.875rem))
    clamp(2.5rem, 6vw, 4.5rem);
  background:
    radial-gradient(120% 80% at 50% -20%, rgba(196, 30, 58, 0.07) 0%, transparent 55%),
    radial-gradient(ellipse 90% 60% at 100% 50%, rgba(92, 61, 139, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse 70% 50% at 0% 80%, rgba(230, 195, 74, 0.06) 0%, transparent 45%),
    linear-gradient(180deg, #f3f1ec 0%, #f7f6f3 38%, #f0eeea 100%);
}

.auth-page__main::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Ccircle cx='1' cy='1' r='0.65' fill='%231a1a1a' fill-opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  opacity: 0.85;
}

/* Login & register: peige stage — see body.auth-page--login / --register rules below */

.auth-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 29rem;
  margin: 0 auto;
  padding: 0;
}

.auth-shell__header {
  text-align: center;
  margin-bottom: clamp(1.35rem, 3vw, 1.85rem);
}

.auth-shell__title {
  margin: 0 0 0.5rem;
  font-family: "Playfair Display", "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.85rem, 1.35rem + 1.75vw, 2.35rem);
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.auth-shell__title::after {
  content: "";
  display: block;
  width: 3rem;
  height: 3px;
  margin: 0.85rem auto 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #c41e3a 0%, #e85a6b 100%);
  opacity: 0.95;
}

/* Clay + glass: soft depth, frosted surface, inset “molded” light */
.auth-card {
  --auth-card-glass-border: rgba(255, 255, 255, 0.75);
  --auth-card-clay-inset: rgba(55, 48, 42, 0.09);
  position: relative;
  z-index: 1;
  isolation: isolate;
  border-radius: 24px;
  background: linear-gradient(
    152deg,
    rgba(255, 255, 255, 0.88) 0%,
    rgba(255, 252, 247, 0.72) 45%,
    rgba(245, 240, 232, 0.78) 100%
  );
  backdrop-filter: blur(20px) saturate(1.15);
  -webkit-backdrop-filter: blur(20px) saturate(1.15);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow:
    0 2px 4px rgba(255, 255, 255, 0.9) inset,
    0 -3px 14px var(--auth-card-clay-inset) inset,
    0 22px 52px rgba(32, 28, 24, 0.1),
    0 10px 28px rgba(32, 28, 24, 0.07),
    0 4px 12px rgba(32, 28, 24, 0.05);
  padding: clamp(1.5rem, 3.5vw, 2rem) clamp(1.35rem, 3vw, 1.85rem);
}

/* Login page: same page canvas as product.html (#f7f6f3) */
body.auth-page--login {
  background: #f7f6f3;
}

body.auth-page--login .auth-page__main {
  background: #f7f6f3;
}

body.auth-page--login .auth-page__main::before {
  display: none;
}

/* Register page: same page canvas as product.html */
body.auth-page--register {
  background: #f7f6f3;
}

body.auth-page--register .auth-page__main {
  background: #f7f6f3;
}

body.auth-page--register .auth-page__main::before {
  display: none;
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    168deg,
    rgba(255, 255, 255, 0.55) 0%,
    rgba(255, 255, 255, 0.12) 32%,
    transparent 55%
  );
  box-shadow: 0 1px 0 rgba(196, 30, 58, 0.12) inset;
}

@media (prefers-reduced-transparency: reduce) {
  .auth-card {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: linear-gradient(160deg, #fffefb 0%, #faf7f2 100%);
    border-color: rgba(229, 226, 220, 0.95);
  }
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 5px;
  margin-bottom: 1.5rem;
  border-radius: 14px;
  background: #ebe8e2;
  border: 1px solid #e0dcd4;
  box-shadow: inset 0 1px 2px rgba(26, 26, 26, 0.05);
}

.auth-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.7rem 0.65rem;
  border: none;
  border-radius: 11px;
  background: transparent;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #555;
  cursor: pointer;
  transition:
    color 0.22s ease,
    background 0.22s ease,
    box-shadow 0.22s ease;
}

.auth-tab__icon {
  font-size: 0.95rem;
  opacity: 0.82;
}

.auth-tab:hover {
  color: #1a1a1a;
}

.auth-tab.is-active {
  background: #fff;
  color: #c41e3a;
  box-shadow:
    0 2px 8px rgba(26, 26, 26, 0.07),
    0 0 0 1px rgba(255, 255, 255, 0.9);
}

.auth-tab.is-active .auth-tab__icon {
  opacity: 1;
  color: #c41e3a;
}

.auth-tab:focus-visible {
  outline: 2px solid rgba(196, 30, 58, 0.45);
  outline-offset: 2px;
}

.auth-panel {
  display: none;
}

.auth-panel.is-active {
  display: block;
  animation: auth-panel-in 0.28s ease;
}

@keyframes auth-panel-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-panel.is-active {
    animation: none;
  }
}

.auth-field {
  margin-bottom: 1.125rem;
}

.auth-field label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #3a3a3a;
  letter-spacing: 0.01em;
}

.auth-field input {
  width: 100%;
  min-height: 48px;
  padding: 0.65rem 1rem;
  border: 1px solid #c9c6c0;
  border-radius: 12px;
  background: #faf9f7;
  font: inherit;
  font-size: 0.9375rem;
  color: #1a1a1a;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.auth-field input::placeholder {
  color: #94918c;
}

.auth-field input:hover {
  border-color: #b5b2ab;
  background: #fff;
}

.auth-field input:focus {
  outline: none;
  border-color: #c41e3a;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.14);
}

.auth-password {
  position: relative;
  display: flex;
  align-items: stretch;
}

.auth-password input {
  padding-right: 3.15rem;
}

.auth-password__toggle {
  position: absolute;
  top: 50%;
  right: 0.4rem;
  transform: translateY(-50%);
  width: 2.65rem;
  height: 2.4rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #666;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, background 0.15s ease;
}

.auth-password__toggle:hover {
  color: #c41e3a;
  background: rgba(196, 30, 58, 0.07);
}

.auth-password__toggle:focus-visible {
  outline: 2px solid rgba(196, 30, 58, 0.45);
  outline-offset: 1px;
}

.auth-submit {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin-top: 0.35rem;
  margin-left: auto;
  margin-right: auto;
  padding: 0.85rem 2.25rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, #e93142 0%, #e31e2f 45%, #c91828 100%);
  color: #fff;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(227, 30, 47, 0.35);
  transition:
    transform 0.18s ease,
    box-shadow 0.2s ease,
    filter 0.2s ease;
}

.auth-submit:hover {
  filter: brightness(1.04);
  box-shadow: 0 6px 20px rgba(227, 30, 47, 0.42);
}

.auth-submit:active {
  transform: translateY(1px);
  box-shadow: 0 2px 10px rgba(227, 30, 47, 0.3);
}

.auth-submit:focus-visible {
  outline: 2px solid rgba(196, 30, 58, 0.55);
  outline-offset: 3px;
}

.auth-newsletter {
  margin: 0 0 1.125rem;
  padding: 0;
  border: none;
  min-width: 0;
  width: 100%;
}

/* Match .auth-field label spacing above inputs */
.auth-newsletter__heading {
  display: block;
  margin: 0 0 0.4rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #3a3a3a;
  letter-spacing: 0.01em;
}

/* Same outer box as .auth-field input (full-width strip) */
.auth-newsletter__field {
  width: 100%;
  min-height: 48px;
  padding: 0.65rem 1rem;
  border: 1px solid #c9c6c0;
  border-radius: 12px;
  background: #faf9f7;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.auth-newsletter__field:hover {
  border-color: #b5b2ab;
  background: #fff;
}

.auth-newsletter__field:focus-within {
  border-color: #c41e3a;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.14);
}

.auth-newsletter__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.15rem;
  width: 100%;
  min-width: 0;
}

.auth-newsletter__subscribe {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #3a3a3a;
  letter-spacing: 0.01em;
  flex-shrink: 0;
}

.auth-newsletter__radios {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1.35rem;
  min-width: 0;
}

.auth-radio {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #1a1a1a;
  cursor: pointer;
  user-select: none;
}

.auth-radio input {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  flex-shrink: 0;
  accent-color: #c41e3a;
  cursor: pointer;
}

.auth-radio:focus-within {
  outline: none;
}

.auth-radio:has(input:focus-visible) {
  outline: 2px solid rgba(196, 30, 58, 0.45);
  outline-offset: 3px;
  border-radius: 6px;
}

.auth-error-box {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: #fff1f2;
  border: 1px solid rgba(196, 30, 58, 0.25);
  color: #9c1830;
  font-size: 0.875rem;
  line-height: 1.5;
}

.auth-error-box p {
  margin: 0;
}

.auth-error-box p + p {
  margin-top: 0.25rem;
}

.auth-forgot {
  margin: -0.35rem 0 1rem;
  text-align: right;
}

.auth-forgot__link {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #c41e3a;
  text-decoration: none;
  border-bottom: 1px solid rgba(196, 30, 58, 0.35);
  padding-bottom: 0.08em;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.auth-forgot__link:hover {
  color: #9c1830;
  border-bottom-color: rgba(156, 24, 48, 0.55);
}

.auth-forgot__link:focus-visible {
  outline: 2px solid rgba(196, 30, 58, 0.45);
  outline-offset: 3px;
  border-radius: 4px;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin-top: 1.35rem;
}

.auth-actions .auth-submit {
  margin-top: 0;
  margin-left: 0;
  margin-right: 0;
}

.auth-btn--secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.85rem 1.75rem;
  border-radius: 999px;
  border: 1px solid #c9c6c0;
  background: #faf9f7;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #444;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
}

.auth-btn--secondary:hover {
  border-color: #b5b2ab;
  background: #fff;
  color: #1a1a1a;
}

.auth-btn--secondary:focus-visible {
  outline: 2px solid rgba(196, 30, 58, 0.45);
  outline-offset: 3px;
}

/* Forgot / reset — same page canvas as product.html */
body.auth-page--recover-flow {
  background: #f7f6f3;
}

body.auth-page--recover-flow .auth-page__main {
  background: #f7f6f3;
}

body.auth-page--recover-flow .auth-page__main::before {
  display: none;
}

.auth-shell__lede {
  margin: 0 auto 1.25rem;
  max-width: 22rem;
  text-align: center;
  font-size: 0.875rem;
  line-height: 1.55;
  color: #5c5a56;
}

.auth-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.5rem;
  margin-top: 1.65rem;
  padding: 1rem 1.25rem;
  text-align: center;
  font-size: 0.875rem;
  color: #555;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(229, 226, 220, 0.9);
  border-radius: 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.auth-switch__text {
  color: #5c5a56;
}

.auth-switch__link {
  color: #c41e3a;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid rgba(196, 30, 58, 0.35);
  padding-bottom: 0.1em;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.auth-switch__link:hover {
  color: #9c1830;
  border-bottom-color: rgba(156, 24, 48, 0.55);
}

.auth-switch__link:focus-visible {
  outline: 2px solid rgba(196, 30, 58, 0.45);
  outline-offset: 3px;
  border-radius: 4px;
}

/* OTP modal */
.otp-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(22, 26, 34, 0.52);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.otp-modal.is-open {
  display: flex;
}

.otp-modal__dialog {
  position: relative;
  width: min(23rem, 100%);
  background: #fff;
  border: 1px solid #e8e5df;
  border-radius: 18px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 28px 64px rgba(0, 0, 0, 0.22);
  padding: 1.65rem 1.5rem 1.4rem;
  text-align: center;
}

.otp-modal__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  border-radius: 14px;
  background: linear-gradient(145deg, #fff5f5 0%, #fde8ea 100%);
  color: #c41e3a;
  font-size: 1.2rem;
  border: 1px solid rgba(196, 30, 58, 0.15);
}

.otp-modal__title {
  margin: 0 0 0.5rem;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.25;
}

.otp-modal__text {
  margin: 0 0 1.15rem;
  font-size: 0.875rem;
  line-height: 1.55;
  color: #5c5a56;
  text-align: center;
}

.otp-modal__field {
  margin-bottom: 1.15rem;
  text-align: left;
}

.otp-modal__field label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #666;
}

.otp-modal__input {
  width: 100%;
  padding: 0.95rem 1rem;
  border: 1px solid #c9c6c0;
  border-radius: 12px;
  background: #faf9f7;
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: 0.42em;
  text-align: center;
  text-indent: 0.2em;
  color: #1a1a1a;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.otp-modal__input:focus {
  outline: none;
  border-color: #c41e3a;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.14);
}

.otp-modal__actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
}

.otp-modal__apply {
  flex: 1 1 auto;
  min-width: 8rem;
  padding: 0.75rem 1.15rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, #e93142 0%, #e31e2f 45%, #c91828 100%);
  color: #fff;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(227, 30, 47, 0.32);
  transition: filter 0.2s ease, box-shadow 0.2s ease;
}

.otp-modal__apply:hover {
  filter: brightness(1.05);
  box-shadow: 0 6px 18px rgba(227, 30, 47, 0.4);
}

.otp-modal__cancel {
  padding: 0.75rem 1.15rem;
  border: 1px solid #c9c6c0;
  border-radius: 999px;
  background: #faf9f7;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: #444;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease;
}

.otp-modal__cancel:hover {
  border-color: #a8a5a0;
  background: #fff;
}

body.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

@media (prefers-reduced-motion: reduce) {
  .auth-tab,
  .auth-field input,
  .auth-newsletter__field,
  .auth-submit,
  .auth-btn--secondary,
  .auth-forgot__link,
  .auth-radio,
  .otp-modal__apply,
  .otp-modal__cancel {
    transition: none;
  }

  .auth-submit:active {
    transform: none;
  }
}
