@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400&family=Outfit:wght@300;400;500&display=swap');

/* ─── Variables ──────────────────────────────────────────────────────────── */
:root {
  --bg-deep:     var(--bg);
  --bg-card:     var(--surface);
  --bg-raised:   #101222;
  --gold:        var(--accent);
  --gold-lt:     var(--accent-hover);
  --gold-dim:    rgb(var(--accent-rgb) / 0.10);
  --gold-glow:   rgb(var(--accent-rgb) / 0.18);
  --gold-border: rgb(var(--accent-rgb) / 0.20);
  --cream:       var(--text);
  --text-mid:    var(--text-muted);
  --error:       #c45a3a;
  --error-bg:    color-mix(in srgb, var(--danger) 10%, transparent);
  --ff-display:  'Cormorant Garamond', Georgia, serif;
  --ff-body:     'Outfit', system-ui, sans-serif;
}

/* ─── Reset & Base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg-deep);
  color: var(--cream);
  font-family: var(--ff-body);
  font-weight: 300;
  font-size: 1rem;
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Ambient Suits ──────────────────────────────────────────────────────── */
.ambient-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ambient-glow {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(ellipse at center, var(--border-soft) 0%, transparent 70%);
  border-radius: 50%;
}

.suit {
  position: absolute;
  font-size: clamp(1.2rem, 2.5vw, 2rem);
  color: rgb(var(--accent-rgb) / 0.04);
  user-select: none;
  animation: drift linear infinite;
  will-change: transform;
}
.suit:nth-child(2)  { left:  8%; top: 15%; font-size: 1.4rem; animation-duration: 28s; animation-delay: -4s; }
.suit:nth-child(3)  { left: 22%; top: 70%; font-size: 1rem;   animation-duration: 34s; animation-delay: -12s; }
.suit:nth-child(4)  { left: 75%; top: 20%; font-size: 1.8rem; animation-duration: 22s; animation-delay: -7s; }
.suit:nth-child(5)  { left: 88%; top: 65%; font-size: 1.1rem; animation-duration: 30s; animation-delay: -18s; }
.suit:nth-child(6)  { left: 50%; top: 85%; font-size: 1.5rem; animation-duration: 26s; animation-delay: -2s; }
.suit:nth-child(7)  { left: 35%; top: 10%; font-size: 1.2rem; animation-duration: 38s; animation-delay: -9s; }
.suit:nth-child(8)  { left: 63%; top: 50%; font-size: 0.9rem; animation-duration: 32s; animation-delay: -15s; }

@keyframes drift {
  0%   { transform: translateY(0)   rotate(0deg); }
  50%  { transform: translateY(-30px) rotate(8deg); }
  100% { transform: translateY(0)   rotate(0deg); }
}

/* ─── Layout ─────────────────────────────────────────────────────────────── */
.auth-page {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6rem 1.25rem 4rem;
}

/* ─── Header: logo badge, eyebrow, title (templates/layout/auth.html.twig) ── */
.auth-card-header {
  position: relative;
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--gold-border);
}

/* The in-app forms (goals/new.html.twig and others) reuse auth.css for an icon above their title. */
.auth-page > .auth-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-logo {
  display: inline-block;
  text-decoration: none;
  margin-bottom: 1.25rem;
}

/* The logo is pale, so it sits on a small dark badge to stand out in both themes. */
.auth-card-header .auth-logo {
  display: inline-flex;
  padding: 0.55rem 0.8rem;
  margin-bottom: 1.1rem;
  background: #12151c;
  border: 1px solid rgb(var(--accent-rgb) / 0.4);
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
  transition: border-color 0.2s;
}

.auth-card-header .auth-logo:hover { border-color: var(--gold); }
.auth-card-header .auth-logo:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* The image has wide transparent margins: crop to the M. */
.auth-logo-img {
  display: block;
  width: 76px;
  height: 58px;
  object-fit: cover;
}

.auth-title {
  font-family: var(--ff-display);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 400;
  line-height: 1.1;
  color: var(--cream);
  margin: 0;
}

.auth-title em {
  font-style: italic;
  color: var(--gold);
}

.auth-eyebrow {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.5rem;
}

.auth-subtitle {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-muted);
}

/* ─── Card ───────────────────────────────────────────────────────────────── */
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--gold-border);
  padding: 2.5rem 2rem;
  position: relative;
  animation: card-reveal 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgb(var(--accent-rgb) / 0.04) 0%, transparent 60%);
  pointer-events: none;
}

@keyframes card-reveal {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── The card is the front of a closed pack of cards ──────────────────── */
.auth-card--pack {
  margin-top: 44px; /* room for the flap once it opens */
  padding-top: 4.5rem; /* the closed flap covers the top of the front */
  border-color: var(--gold);
  border-radius: 6px;
  box-shadow:
    inset 0 0 0 7px var(--bg-card),
    inset 0 0 0 8px var(--gold-border),
    0 18px 40px rgba(0, 0, 0, 0.25);
}

/* Closed, the tuck flap is folded down over the front and held by a seal. */
.auth-pack-flap {
  position: absolute;
  z-index: 3;
  top: -1px;
  left: -1px;
  right: -1px;
  height: 44px;
  border-radius: 0 0 40px 40px / 0 0 28px 28px;
  background: linear-gradient(to bottom, var(--surface-2), var(--bg-card));
  border: 1px solid var(--gold);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  transform-origin: top center;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.3, 0.7, 0.3, 1);
}

.auth-pack-flap::after {
  content: '♠';
  position: absolute;
  left: 50%;
  bottom: -14px;
  width: 28px;
  height: 28px;
  margin-left: -14px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--on-accent);
  font-family: Georgia, serif;
  font-size: 0.85rem;
  line-height: 28px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  backface-visibility: hidden;
}

.auth-pack-corner {
  position: absolute;
  font-family: Georgia, serif;
  font-size: 1rem;
  line-height: 1;
  color: var(--gold);
  pointer-events: none;
}

.auth-pack-corner--top    { top: 56px; left: 16px; }
.auth-pack-corner--bottom { bottom: 16px; right: 16px; transform: rotate(180deg); }

/* Sending the form: the seal breaks and the flap lifts open while the next page loads. */
.auth-card--opening .auth-pack-flap { transform: perspective(800px) rotateX(180deg); }

/* Wrong password: the pack shakes. */
.auth-card--shake {
  animation:
    card-reveal 0.6s cubic-bezier(0.22, 1, 0.36, 1) both,
    pack-shake 0.45s ease-in-out 0.5s;
}

@keyframes pack-shake {
  0%, 100% { translate: 0; }
  20%      { translate: -8px; }
  40%      { translate: 7px; }
  60%      { translate: -5px; }
  80%      { translate: 3px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-card--shake { animation: none; }
  .auth-pack-flap   { transition: none; }
}

/* ─── Flash Alerts ───────────────────────────────────────────────────────── */
.auth-alert {
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  line-height: 1.5;
  border-left: 2px solid var(--error);
  background: var(--error-bg);
  color: #e8836a;
}

.auth-alert-link-btn {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
  margin-left: 0.4rem;
}

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

.form-group { display: flex; flex-direction: column; gap: 0.35rem; }

.form-label {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mid);
}

.form-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.form-label-link {
  font-size: 0.72rem;
  color: var(--gold);
  text-underline-offset: 3px;
  text-decoration: none;
  cursor: pointer;
}

.form-label-link:hover { color: var(--gold-lt); }
button.form-label-link { background: none; border: 0; padding: 0; font-family: inherit; }

/* Two-step sign-in code page. */
.form-hint { margin: -0.5rem 0 1.25rem; }

.form-label .optional {
  font-weight: 300;
  letter-spacing: 0;
  text-transform: none;
  font-size: 0.9em;
  color: var(--text-muted);
}

.form-input {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid rgb(var(--accent-rgb) / 0.15);
  color: var(--cream);
  font-family: var(--ff-body);
  font-size: 0.95rem;
  font-weight: 300;
  padding: 0.75rem 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}

.form-input::placeholder { color: var(--text-muted); }

.form-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}

.form-input.is-invalid {
  border-color: var(--error);
  box-shadow: 0 0 0 3px var(--error-bg);
}

.auth-field-hint {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-muted);
}

/* ─── Field Errors ───────────────────────────────────────────────────────── */
.field-errors {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.field-error {
  font-size: 0.8rem;
  color: #e8836a;
}

/* ─── Checkbox Consent ───────────────────────────────────────────────────── */
.form-divider {
  border: none;
  border-top: 1px solid var(--gold-border);
  margin: 0.25rem 0;
}

.form-check {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
}

.form-check-input {
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.15rem;
  background: var(--bg-raised);
  border: 1px solid rgb(var(--accent-rgb) / 0.25);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  position: relative;
  transition: border-color 0.2s, background 0.2s;
}

.form-check-input:checked {
  background: var(--gold);
  border-color: var(--gold);
}

.form-check-input:checked::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpolyline points='1,5 4.5,8.5 11,1' fill='none' stroke='%2307080d' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/70% no-repeat;
}

.form-check-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--gold-dim);
}

.form-check-label {
  font-size: 0.85rem;
  color: var(--text-mid);
  line-height: 1.5;
}

.form-check-label a {
  color: var(--gold);
  text-underline-offset: 3px;
  text-decoration-color: rgb(var(--accent-rgb) / 0.4);
}

.form-check-label a:hover { color: var(--gold-lt); }

/* ─── Card intro / message / hint ───────────────────────────────────────── */
.auth-card-intro {
  font-size: 0.88rem;
  color: var(--text-mid);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.auth-card--message { text-align: center; }

.auth-icon {
  color: var(--gold);
  margin-bottom: 1.25rem;
}

.auth-card-message {
  font-size: 0.9rem;
  color: var(--text-mid);
  line-height: 1.7;
  margin-bottom: 1rem;
}

.auth-card-message strong { color: var(--cream); font-weight: 400; }

.auth-card-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: 0.25rem;
}

.auth-card-hint a {
  color: var(--gold);
  text-underline-offset: 3px;
}

.auth-card-hint a:hover { color: var(--gold-lt); }

/* ─── Submit Button ──────────────────────────────────────────────────────── */
.auth-submit {
  width: 100%;
  padding: 0.9rem 1.5rem;
  background: var(--gold);
  border: 1px solid var(--gold);
  color: var(--on-accent);
  font-family: var(--ff-body);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  margin-top: 0.25rem;
}

.auth-submit:hover {
  background: var(--gold-lt);
  border-color: var(--gold-lt);
}

.auth-submit:active { transform: translateY(1px); }

/* ─── Footer Link ────────────────────────────────────────────────────────── */
.auth-footer-link {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.auth-footer-link a {
  color: var(--gold);
  text-underline-offset: 3px;
  text-decoration-color: rgb(var(--accent-rgb) / 0.4);
}

.auth-footer-link a:hover { color: var(--gold-lt); }

/* ─── Suits Divider ──────────────────────────────────────────────────────── */
.suits-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.25rem 0;
}

.suits-divider-line {
  flex: 1;
  height: 1px;
  background: var(--gold-border);
}

.suits-divider-text {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--text-muted);
}

/* ─── Light mode overrides ───────────────────────────────────────────────── */
html[data-theme="light"] { --bg-raised: var(--surface-2); }

html[data-theme="light"] .form-input {
  background: var(--input-bg);
  border-color: var(--input-border);
  color: var(--text);
}
html[data-theme="light"] .form-input::placeholder { color: var(--text-dim); }
html[data-theme="light"] .form-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / 0.15);
}
html[data-theme="light"] .form-check-input {
  background: var(--input-bg);
  border-color: rgba(0,0,0,0.18);
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .auth-card { padding: 2rem 1.25rem; }
  .auth-title { font-size: 1.8rem; }
}

/* ── Continue with Google ─────────────────────────────────────────────────── */
.auth-google-btn,
.auth-passkey-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.8rem 1.25rem;
  background: var(--bg-raised);
  border: 1px solid var(--gold-border);
  color: var(--cream);
  font-family: var(--ff-body);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  position: relative;
  transition: border-color 0.2s, background 0.2s;
}

.auth-google-btn:hover,
.auth-passkey-btn:hover { border-color: var(--gold); background: var(--gold-dim); }
.auth-google-btn:focus-visible,
.auth-passkey-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.auth-google-icon { width: 18px; height: 18px; flex-shrink: 0; }

.auth-or {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0;
  color: var(--text-mid);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.auth-or::before,
.auth-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gold-border);
}

.auth-google-account {
  margin: 0 0 1.5rem;
  font-size: 0.85rem;
  color: var(--text-mid);
  line-height: 1.5;
  position: relative;
}

.auth-google-account strong { color: var(--cream); font-weight: 500; }
.auth-google-email { display: block; font-size: 0.78rem; }

/* Passkey sign-in (#30): sits above the Google button. */
.auth-passkey-btn { margin-bottom: 0.75rem; cursor: pointer; }
.auth-passkey-btn .auth-google-icon { color: var(--gold); font-size: 1rem; line-height: 18px; text-align: center; }
