/*
 * Log in, sign up and password reset (resources/views/auth/**).
 * Two panels: a maroon panel that says where you are, and a short form.
 * On narrow screens the panel becomes a band above the form.
 */
:root {
  --a-ink: #1f1416;
  --a-ink-2: #3b2b2e;
  --a-muted: #75676a;
  --a-paper: #f7f3ef;
  --a-card: #ffffff;
  --a-line: #e9e0da;
  --a-maroon: #4a0a10;
  --a-maroon-2: #64141c;
  --a-gold: #d9a12b;
  --a-gold-2: #f0c25a;
  --a-ok: #1f6a3a;
  --a-ok-soft: #e4f3e9;
  --a-bad: #9b2226;
  --a-bad-soft: #fbe6e6;
  --a-font: var(--font-sans);
  --a-serif: var(--font-sans);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body.auth-page { margin: 0; background: var(--a-paper); color: var(--a-ink); font-family: var(--a-font); font-size: 15px; line-height: 1.5; }
a { color: var(--a-maroon); font-weight: 600; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--a-gold); outline-offset: 2px; }

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

/* Panel */
.auth-art {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
  padding: 2.5rem 3rem;
  color: #fff;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 85% 8%, rgba(217, 161, 43, 0.28), transparent 55%),
    radial-gradient(ellipse at 10% 100%, rgba(100, 20, 28, 0.9), transparent 60%),
    linear-gradient(150deg, #3a0a0f 0%, #230507 100%);
}
.auth-brand { display: flex; align-items: center; gap: 0.75rem; color: #fff; }
.auth-brand:hover { text-decoration: none; }
.auth-crest { width: 40px; height: 40px; border-radius: 50%; background: #fff; object-fit: cover; box-shadow: 0 0 0 2px var(--a-gold), 0 0 0 6px rgba(217, 161, 43, 0.18); }
.auth-brand b { display: block; font-size: 1.02rem; }
.auth-brand small { display: block; font-size: 0.74rem; font-weight: 400; color: #d9bcbc; }
.auth-art h1 { margin: 0; max-width: 15ch; font-family: var(--a-serif); font-weight: 600; font-size: clamp(2rem, 3vw, 2.6rem); line-height: 1.12; letter-spacing: -0.01em; }
.auth-art h1 em { font-style: normal; font-weight: 400; color: var(--a-gold-2); }
.auth-art p { margin: 0.9rem 0 0; max-width: 40ch; color: #e5cfcf; }
.auth-art__foot { margin: 0; font-size: 0.8rem; color: #c9a9a9; }

.auth-shelf { position: relative; height: 210px; }
.auth-spine { position: absolute; bottom: 0; width: 128px; height: 178px; padding: 0.85rem; border-radius: 3px 8px 8px 3px; display: flex; flex-direction: column; justify-content: flex-end; gap: 0.3rem; font-family: var(--a-serif); font-weight: 600; font-size: 0.9rem; line-height: 1.2; color: #fff; box-shadow: inset 4px 0 0 rgba(0, 0, 0, 0.2), 0 22px 40px -18px rgba(0, 0, 0, 0.8); }
.auth-spine small { font-family: var(--a-font); font-size: 0.6rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.8; }
.auth-spine--journal { left: 0; background: linear-gradient(160deg, #2f5a4d, #1d3a31); transform: rotate(-5deg); }
.auth-spine--ebook { left: 105px; bottom: 14px; z-index: 1; background: linear-gradient(160deg, #c9852a, #9a5f12); }
.auth-spine--notes { left: 210px; background: linear-gradient(160deg, #3a5288, #26375e); transform: rotate(5deg); }

/* Form side */
.auth-main { display: grid; place-items: center; padding: 3rem 1.5rem; }
.auth-card { width: 100%; max-width: 400px; display: grid; gap: 1.2rem; }
.auth-card h2 { margin: 0; font-family: var(--a-serif); font-weight: 600; font-size: 1.9rem; letter-spacing: -0.01em; }
.auth-lead { margin: 0.25rem 0 0; color: var(--a-muted); }
.auth-form { display: grid; gap: 1rem; }
.auth-form fieldset { margin: 0; padding: 0; border: 0; min-width: 0; display: grid; gap: 1rem; }
.auth-group { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--a-muted); padding-top: 0.25rem; }
.auth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.auth-grid > * { min-width: 0; }

.auth-field { display: grid; gap: 0.35rem; min-width: 0; }
.auth-field > label, .auth-label-row { font-size: 0.82rem; font-weight: 600; color: var(--a-ink-2); }
.auth-field label small { font-weight: 400; color: var(--a-muted); }
.auth-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem; }
.auth-label-row a { font-size: 0.8rem; }
.auth-input { display: flex; align-items: center; min-width: 0; border: 1px solid var(--a-line); border-radius: 10px; background: #fff; transition: border-color 150ms, box-shadow 150ms; }
.auth-input:focus-within { border-color: var(--a-gold); box-shadow: 0 0 0 3px rgba(217, 161, 43, 0.22); }
.auth-input.is-invalid { border-color: #e1a3a3; }
.auth-input input, .auth-input select { flex: 1; width: 100%; min-width: 0; border: 0; background: transparent; padding: 0.72rem 0.85rem; font: inherit; font-size: 0.98rem; color: var(--a-ink); outline: none; }
.auth-input select { appearance: none; cursor: pointer; background-image: linear-gradient(45deg, transparent 50%, var(--a-muted) 50%), linear-gradient(135deg, var(--a-muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2rem; }
.auth-prefix { padding: 0 0.65rem 0 0.85rem; border-right: 1px solid var(--a-line); color: var(--a-muted); font-size: 0.92rem; }
.auth-reveal { border: 0; background: none; padding: 0 0.85rem; font: inherit; font-size: 0.78rem; font-weight: 600; color: var(--a-muted); cursor: pointer; }
.auth-error { margin: 0; font-size: 0.8rem; color: var(--a-bad); }
.auth-hint { margin: 0; font-size: 0.78rem; color: var(--a-muted); }

.auth-check { display: flex; align-items: center; gap: 0.55rem; font-size: 0.88rem; color: var(--a-ink-2); cursor: pointer; }
.auth-check input { width: 17px; height: 17px; margin: 0; accent-color: var(--a-maroon); }

.auth-btn { display: inline-flex; align-items: center; justify-content: center; width: 100%; border: 0; border-radius: 10px; padding: 0.82rem 1rem; font: inherit; font-weight: 600; font-size: 0.98rem; cursor: pointer; }
.auth-btn--primary { background: var(--a-maroon); color: #fff; box-shadow: 0 10px 20px -12px rgba(74, 10, 16, 0.9); }
.auth-btn--primary:hover { background: var(--a-maroon-2); }
.auth-btn--ghost { background: #fff; border: 1px solid var(--a-line); color: var(--a-ink-2); }
.auth-btn--ghost:hover { text-decoration: none; background: #fbf8f5; }
.auth-divider { display: flex; align-items: center; gap: 0.75rem; font-size: 0.8rem; color: var(--a-muted); }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--a-line); }
.auth-switch { margin: 0; text-align: center; font-size: 0.9rem; color: var(--a-muted); }

.auth-alert { margin: 0; padding: 0.75rem 0.9rem; border-radius: 10px; font-size: 0.88rem; }
.auth-alert--error { background: var(--a-bad-soft); color: var(--a-bad); }
.auth-alert--ok { background: var(--a-ok-soft); color: var(--a-ok); }
.auth-alert ul { margin: 0; padding-left: 1.1rem; }

/* Check your email */
.auth-verify { display: grid; gap: 0.6rem; }
.auth-verify__icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: #fbf0d9; color: var(--a-maroon); margin-bottom: 0.4rem; }
.auth-verify__icon svg { width: 26px; height: 26px; }
.auth-verify__email { color: var(--a-ink); overflow-wrap: anywhere; }
.auth-tips { margin: 0; padding: 0.85rem 1rem 0.85rem 2rem; border: 1px solid var(--a-line); border-radius: 10px; background: var(--a-card); display: grid; gap: 0.3rem; font-size: 0.88rem; color: var(--a-muted); }

/* Student / author switch */
.auth-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: #efe8e2; }
.auth-seg a { display: grid; gap: 0.05rem; padding: 0.6rem 0.5rem; border-radius: 9px; text-align: center; font-size: 0.9rem; color: var(--a-muted); }
.auth-seg a:hover { text-decoration: none; color: var(--a-ink); }
.auth-seg a small { font-size: 0.72rem; font-weight: 400; }
.auth-seg a[aria-current="true"] { background: #fff; color: var(--a-ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }

/* Password strength */
.auth-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.auth-meter i { height: 4px; border-radius: 999px; background: var(--a-line); transition: background 150ms; }
.auth-meter[data-score="1"] i:nth-child(-n+1) { background: #c0392b; }
.auth-meter[data-score="2"] i:nth-child(-n+2) { background: var(--a-gold); }
.auth-meter[data-score="3"] i:nth-child(-n+3) { background: #7aa33a; }
.auth-meter[data-score="4"] i { background: var(--a-ok); }

@media (max-width: 900px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { position: static; height: auto; gap: 1rem; padding: 1.4rem 1.25rem 2.4rem; }
  .auth-shelf, .auth-art__foot { display: none; }
  .auth-art h1 { font-size: 1.6rem; max-width: none; }
  .auth-art p { font-size: 0.9rem; margin-top: 0.5rem; }
  .auth-main { place-items: start center; padding: 0 0.9rem 2.5rem; }
  .auth-card { margin-top: -1.2rem; padding: 1.4rem 1.2rem; background: var(--a-card); border-radius: 18px; box-shadow: 0 20px 40px -26px rgba(43, 6, 9, 0.6); }
  .auth-card h2 { font-size: 1.55rem; }
}

@media (max-width: 420px) {
  .auth-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .auth-input, .auth-meter i { transition: none; }
}
