/* ==========================================================================
   Log in / Sign up — split screen: an editorial photograph on one side, a
   quiet ivory (or Noir) form on the other. Scoped to body.auth-body.
   ========================================================================== */

body.auth-body {
  margin: 0;
  min-height: 100dvh;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
.auth-body svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.auth-body [hidden] {
  display: none !important;
}

.auth-split {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
}

/* ---------- Photograph ---------- */

.auth-visual {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2rem 2.5rem 2.25rem;
  overflow: hidden;
  isolation: isolate;
  background: #0e0c0a;
  color: #f5f0eb;
}
.auth-photo,
.auth-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.auth-photo {
  z-index: -2;
}
.auth-photo img {
  object-fit: cover;
  object-position: center 30%;
  transform: scale(1.06);
  animation: auth-drift 24s ease-in-out infinite alternate;
}
@keyframes auth-drift {
  to {
    transform: scale(1.14) translate3d(-1.5%, -1%, 0);
  }
}
.auth-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(10, 8, 6, 0.6) 0%, rgba(10, 8, 6, 0) 26%),
    linear-gradient(0deg, rgba(10, 8, 6, 0.9) 0%, rgba(10, 8, 6, 0.35) 38%, rgba(10, 8, 6, 0) 62%);
}
/* Thin gold frame, drawn in on load */
.auth-frame {
  position: absolute;
  inset: 1.1rem;
  border: 1px solid rgba(214, 185, 122, 0.45);
  pointer-events: none;
  clip-path: inset(0 100% 100% 0);
  animation: auth-frame 1.6s 0.2s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}
@keyframes auth-frame {
  to {
    clip-path: inset(0 0 0 0);
  }
}

.auth-visual-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.auth-wordmark:any-link {
  font-family: var(--font-serif);
  font-size: clamp(1.05rem, 1.5vw, 1.3rem);
  letter-spacing: 0.3em;
  line-height: 1;
  color: #e6cf8f;
  text-decoration: none;
  transition: color 0.3s ease;
}
.auth-wordmark:any-link:hover {
  color: #fff;
}
.auth-return:any-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(245, 240, 235, 0.28);
  background: rgba(14, 12, 10, 0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #f5f0eb;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.3s ease, border-color 0.3s ease;
}
.auth-return:any-link:hover {
  background: rgba(14, 12, 10, 0.5);
  border-color: rgba(214, 185, 122, 0.7);
}
.auth-return svg {
  width: 14px;
  height: 14px;
}

.auth-visual-bottom {
  max-width: 30rem;
  animation: auth-rise 0.9s 0.3s ease both;
}
.auth-visual-eyebrow {
  margin: 0 0 0.9rem;
  font-size: 0.68rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: #d6b97a;
}
.auth-visual-quote {
  margin: 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(2rem, 3.4vw, 3.3rem);
  line-height: 1.05;
  color: #fbf8f4;
}
.auth-visual-caption {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.4rem 0 0;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(245, 240, 235, 0.65);
}
.auth-visual-caption::before {
  content: "";
  width: 2.5rem;
  height: 1px;
  background: #d6b97a;
}

/* ---------- Form panel ---------- */

.auth-panel {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem clamp(1.5rem, 6vw, 6rem);
  background:
    radial-gradient(60% 50% at 100% 0%, rgba(var(--gold-rgb), 0.1), transparent 70%),
    var(--background);
  box-sizing: border-box;
}
.auth-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--deco-pattern);
  background-size: 80px 120px;
  opacity: 0.55;
  pointer-events: none;
  mask-image: linear-gradient(180deg, #000 0%, transparent 40%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 40%);
}
.auth-panel-inner {
  position: relative;
  width: min(100%, 26.5rem);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: min(100%, 40rem);
}

.auth-loading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.auth-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid rgba(var(--gold-rgb), 0.25);
  border-top-color: var(--gold);
  animation: auth-spin 0.8s linear infinite;
}
@keyframes auth-spin {
  to {
    transform: rotate(360deg);
  }
}
.auth-ready {
  animation: auth-rise 0.6s ease both;
}
@keyframes auth-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

.auth-eyebrow {
  margin: 0 0 0.85rem;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold-ink);
}
.auth-title {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(2.1rem, 3.2vw, 2.75rem);
  line-height: 1.1;
  color: var(--foreground);
}
.auth-lede {
  margin: 0.85rem 0 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--muted);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  margin-top: 2rem;
}
.auth-step {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  animation: auth-rise 0.45s ease both;
}
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.auth-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.auth-label {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.auth-inline-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--gold-ink);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}
.auth-inline-link:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.auth-control {
  position: relative;
  display: flex;
  align-items: center;
}
.auth-icon {
  position: absolute;
  left: 1rem;
  width: 17px;
  height: 17px;
  color: var(--muted2);
  pointer-events: none;
  transition: color 0.25s ease;
}
.auth-control input,
.auth-control select {
  width: 100%;
  height: 3.25rem;
  padding: 0 1rem 0 2.85rem;
  border: 1px solid rgba(var(--fg-rgb), 0.16);
  border-radius: 14px;
  background: rgba(var(--surface-rgb), 0.85);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 0.98rem;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}
.auth-control select {
  padding-right: 2.75rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a8823f' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1.1rem center;
}
.auth-control select:invalid,
.auth-control select option[value=""] {
  color: var(--muted2);
}
.auth-control select option {
  color: var(--foreground);
  background: var(--background);
}
.auth-control input::placeholder {
  color: var(--muted2);
}
.auth-control input:hover,
.auth-control select:hover {
  border-color: rgba(var(--fg-rgb), 0.28);
}
.auth-control input:focus,
.auth-control select:focus {
  outline: none;
  border-color: var(--gold);
  background-color: var(--background);
  box-shadow: 0 0 0 4px rgba(var(--gold-rgb), 0.16);
}
.auth-control:focus-within .auth-icon {
  color: var(--gold-ink);
}
.auth-control--password input {
  padding-right: 4.75rem;
}
.auth-reveal {
  position: absolute;
  right: 0.45rem;
  height: 2.35rem;
  padding: 0 0.85rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.auth-reveal:hover {
  background: rgba(var(--gold-rgb), 0.12);
  color: var(--gold-ink);
}
.auth-hint {
  margin: 0;
  font-size: 0.76rem;
  color: var(--muted2);
}

/* Password strength */
.auth-strength {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
  margin-top: 0.15rem;
}
.auth-strength > span {
  height: 4px;
  border-radius: 999px;
  background: rgba(var(--fg-rgb), 0.1);
  transition: background 0.3s ease;
}
.auth-strength small {
  grid-column: 1 / -1;
  margin-top: 0.2rem;
  font-size: 0.75rem;
  color: var(--muted2);
}
.auth-strength[data-strength="1"] > span:nth-child(-n + 1) {
  background: #c96e6e;
}
.auth-strength[data-strength="2"] > span:nth-child(-n + 2) {
  background: #d4a24c;
}
.auth-strength[data-strength="3"] > span:nth-child(-n + 3) {
  background: var(--gold);
}
.auth-strength[data-strength="4"] > span {
  background: #6f9f6a;
}

/* Email chip on step 2 */
.auth-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.9rem;
  border-radius: 14px;
  border: 1px dashed rgba(var(--gold-rgb), 0.5);
  background: rgba(var(--gold-rgb), 0.07);
  font-size: 0.88rem;
}
.auth-chip svg {
  width: 16px;
  height: 16px;
  color: var(--gold-ink);
}
.auth-chip span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Checkbox */
.auth-check {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--muted);
  cursor: pointer;
}
.auth-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.auth-check-box {
  width: 1.2rem;
  height: 1.2rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
  display: grid;
  place-items: center;
  border-radius: 6px;
  border: 1px solid rgba(var(--fg-rgb), 0.3);
  color: transparent;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.auth-check-box svg {
  width: 13px;
  height: 13px;
  stroke-width: 2.6;
}
.auth-check input:checked + .auth-check-box {
  background: var(--foreground);
  border-color: var(--foreground);
  color: var(--background);
}
.auth-check input:focus-visible + .auth-check-box {
  box-shadow: 0 0 0 3px rgba(var(--gold-rgb), 0.35);
}

/* Steps */
.auth-steps {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin-bottom: 1.6rem;
}
.auth-steps-bar {
  height: 3px;
  border-radius: 999px;
  background: rgba(var(--fg-rgb), 0.12);
  overflow: hidden;
  position: relative;
}
.auth-steps-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--gold-sheen);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s ease;
}
.auth-steps-bar.is-done::after {
  transform: scaleX(1);
}

/* Buttons */
.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.35rem;
}
.auth-submit {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  height: 3.25rem;
  padding: 0 1.75rem;
  border: none;
  border-radius: 999px;
  background: var(--foreground);
  color: var(--background);
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
}
.auth-submit::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--gold-sheen);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.auth-submit > * {
  position: relative;
}
.auth-submit svg {
  width: 16px;
  height: 16px;
  transition: transform 0.25s ease;
}
.auth-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px -14px rgba(var(--gold-rgb), 0.8);
}
.auth-submit:hover::before {
  opacity: 1;
}
.auth-submit:hover {
  color: #1a140c;
}
.auth-submit:hover svg {
  transform: translateX(3px);
}
.auth-submit:disabled {
  opacity: 0.55;
  cursor: default;
  transform: none;
  box-shadow: none;
}
.auth-submit:disabled::before {
  opacity: 0;
}
.auth-submit:disabled {
  color: var(--background);
}
.auth-submit.is-busy svg {
  display: none;
}
.auth-submit.is-busy::after {
  content: "";
  position: relative;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid rgba(var(--bg-rgb), 0.35);
  border-top-color: var(--background);
  animation: auth-spin 0.8s linear infinite;
}

.auth-secondary,
.auth-secondary:any-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 3.1rem;
  border-radius: 999px;
  border: 1px solid rgba(var(--fg-rgb), 0.22);
  background: transparent;
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
  transition: border-color 0.25s ease, background 0.25s ease, color 0.25s ease;
}
.auth-secondary:hover {
  border-color: var(--gold);
  background: rgba(var(--gold-rgb), 0.08);
  color: var(--gold-ink);
}
.auth-secondary:disabled {
  opacity: 0.5;
  cursor: default;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2rem 0 1rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted2);
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(var(--fg-rgb), 0.12);
}

.auth-quiet {
  align-self: center;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}
.auth-quiet:hover {
  color: var(--gold-ink);
}

.auth-message,
.auth-done-message {
  margin: 0;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(var(--gold-rgb), 0.35);
  background: rgba(var(--gold-rgb), 0.08);
  color: var(--foreground);
  font-size: 0.84rem;
  line-height: 1.5;
  animation: auth-rise 0.3s ease both;
}
.auth-message.is-error,
.auth-done-message.is-error {
  border-color: rgba(201, 110, 110, 0.45);
  background: rgba(201, 110, 110, 0.09);
  color: #a94f4f;
}
.auth-message.is-error,
.auth-done-message.is-error {
  color: #f0a6a6;
}
.auth-message.is-success,
.auth-done-message.is-success {
  border-color: rgba(111, 159, 106, 0.45);
  background: rgba(111, 159, 106, 0.1);
}

.auth-fineprint {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  line-height: 1.55;
  color: var(--muted2);
  text-align: center;
}
.auth-fineprint a:any-link {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.auth-fineprint a:hover {
  color: var(--gold-ink);
}

/* Confirmation sent */
.auth-done {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  margin-top: 2rem;
  padding: 1.75rem;
  border-radius: 20px;
  border: 1px solid rgba(var(--gold-rgb), 0.3);
  background: rgba(var(--surface-rgb), 0.9);
  animation: auth-rise 0.5s ease both;
}
.auth-done-icon {
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--gold-sheen);
  color: #1a140c;
}
.auth-done h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.6rem;
}
.auth-done p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--muted);
}
.auth-done strong {
  color: var(--foreground);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.auth-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  margin-top: auto;
  padding-top: 2.75rem;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--muted2);
}
.auth-legal span {
  margin-right: auto;
}
.auth-legal a:any-link {
  color: var(--muted2);
  text-decoration: none;
}
.auth-legal a:hover {
  color: var(--gold-ink);
}

.auth-body :focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
.auth-control input:focus-visible,
.auth-control select:focus-visible {
  outline: none;
}

/* ---------- Small screens: photo becomes a banner ---------- */

@media (max-width: 900px) {
  .auth-split {
    grid-template-columns: minmax(0, 1fr);
  }
  .auth-visual {
    position: relative;
    height: 38vh;
    min-height: 15rem;
    padding: 1.25rem 1.25rem 2.75rem;
  }
  .auth-frame {
    inset: 0.7rem 0.7rem 2rem;
  }
  .auth-visual-quote {
    font-size: clamp(1.6rem, 6.5vw, 2.2rem);
  }
  .auth-visual-eyebrow {
    margin-bottom: 0.5rem;
  }
  .auth-visual-caption {
    display: none;
  }
  .auth-return:any-link {
    padding: 0.5rem 0.8rem;
    font-size: 0.62rem;
  }
  .auth-panel {
    min-height: 0;
    margin-top: -1.5rem;
    padding: 2.25rem 1.25rem max(2rem, env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -12px 30px -18px rgba(0, 0, 0, 0.5);
    justify-content: flex-start;
  }
  .auth-panel-inner {
    min-height: 0;
  }
  .auth-form {
    margin-top: 1.6rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-body *,
  .auth-body *::before,
  .auth-body *::after {
    animation: none !important;
    transition: none !important;
  }
  .auth-frame {
    clip-path: none;
  }
}
