/* CarGuy landing shell — neutral/generic placeholder styling. Design
   language lands later (see index.html header comment). Calm,
   numbers-forward, zero dark patterns per PRODUCT.md §4.2. Mobile-first:
   base styles target small viewports, a single breakpoint widens for
   desktop. No external fonts/assets — system font stack only. */

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #5a5a5a;
  --border: #d9d9d9;
  --accent: #14532d; /* calm, not salesy */
  --accent-contrast: #ffffff;
  --error: #8a1f11;
  --banner-bg: #f2f2f2;
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --fg: #f0f0f0;
    --muted: #a8a8a8;
    --border: #333333;
    --accent: #4ade80;
    --accent-contrast: #0a0a0a;
    --error: #ff8a75;
    --banner-bg: #1e1e1e;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-stack);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}

.site-header {
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.logo {
  font-weight: 700;
  font-size: 1.1rem;
}

.signin-link {
  color: var(--fg);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.9rem;
}

.signin-link:hover {
  border-color: var(--accent);
}

/* ADR 005: invite-code login form (replaces the parked Google sign-in
   link in the header). Minimal — input + button, same visual weight as
   the old signin-link so the header doesn't visually escalate. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.invite-login-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.invite-login-form input {
  font-family: var(--font-stack);
  font-size: 1rem; /* 16px minimum — avoids iOS Safari auto-zoom on focus */
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  width: 160px;
  max-width: 100%;
  min-width: 0;
}

.invite-login-form button {
  font-family: var(--font-stack);
  font-size: 0.9rem;
  padding: 10px 12px;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
}

.invite-login-form button:hover {
  border-color: var(--accent);
}

.invite-login-status {
  font-size: 0.85rem;
  color: var(--muted);
}

.invite-login-status.is-error {
  color: var(--error);
}

/* B.O.T. Act disclosure banner — always visible above the check form,
   never collapsible/dismissible (PRODUCT.md §7). */
.bot-disclosure {
  background: var(--banner-bg);
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 8px 16px;
}

.hero {
  padding: 32px 0 24px;
}

.hero h1 {
  font-size: 1.6rem;
  margin: 0 0 8px;
}

.hero-sub {
  color: var(--muted);
  margin: 0 0 24px;
}

.check-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.check-form label {
  font-weight: 600;
  font-size: 0.95rem;
}

.check-form textarea {
  width: 100%;
  font-family: var(--font-stack);
  font-size: 1rem; /* 16px minimum — avoids iOS Safari auto-zoom on focus */
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  resize: vertical;
  max-width: 100%;
}

.check-form textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.check-form button {
  align-self: flex-start;
  background: var(--accent);
  color: var(--accent-contrast);
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  min-height: 44px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.check-form button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.check-form textarea:disabled {
  opacity: 0.7;
}

.check-status {
  min-height: 1.2em;
  font-size: 0.9rem;
  color: var(--muted);
}

.check-status.is-error {
  color: var(--error);
}

/* --- Loading indicator: staged status text + CSS-only spinner --- */
.status-loading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2.4s;
  }
}

.check-result {
  margin-top: 8px;
  padding: 16px;
  background: var(--banner-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  overflow-x: auto;
  word-break: break-word;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.check-result[hidden] {
  display: none;
}

.check-result h2 {
  font-size: 1rem;
  margin: 0 0 8px;
}

.check-result h3 {
  font-size: 0.9rem;
  margin: 12px 0 6px;
}

/* --- Rating headline: badge + all-in monthly, THE number --- */
.rating-headline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.rating-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  color: #fff;
  background: var(--muted);
}

.all-in-monthly {
  display: flex;
  flex-direction: column;
}

.all-in-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.all-in-amount {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

/* --- Comparison grid --- */
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 16px;
  margin: 0;
}

.comparison-grid dt {
  color: var(--muted);
}

.comparison-grid dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

/* --- Flags list --- */
.flags-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flag-item {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 8px 10px;
  border-radius: 6px;
  border-left: 4px solid var(--border);
}

.flag-item.flag-red {
  border-left-color: var(--error);
  background: color-mix(in srgb, var(--error) 10%, transparent);
}

.flag-item.flag-yellow {
  border-left-color: #b7791f;
  background: color-mix(in srgb, #b7791f 10%, transparent);
}

.flag-item.flag-green {
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.flag-severity {
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  flex-shrink: 0;
}

.flag-message {
  font-size: 0.9rem;
}

/* --- Assumptions list --- */
.assumptions-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 0.85rem;
}

.assumptions-list li {
  margin-bottom: 4px;
}

/* --- Narration --- */
.narration-summary {
  margin: 0;
}

.next-moves-list {
  margin: 0;
  padding-left: 20px;
}

.next-moves-list li {
  margin-bottom: 4px;
}

.counter-email-box {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  padding: 10px;
}

.counter-email-text {
  margin: 0 0 10px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-stack);
  font-size: 0.85rem;
}

.copy-button {
  font-family: var(--font-stack);
  font-size: 0.85rem;
  padding: 8px 14px;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--banner-bg);
  color: var(--fg);
  cursor: pointer;
}

.copy-button:hover {
  border-color: var(--accent);
}

/* --- Editable extracted fields / re-check --- */
.recheck-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-row label {
  font-size: 0.8rem;
  color: var(--muted);
}

.field-row input {
  font-family: var(--font-stack);
  font-size: 1rem; /* 16px minimum — avoids iOS Safari auto-zoom on focus */
  padding: 10px;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  max-width: 100%;
}

.field-row input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.recheck-submit {
  align-self: flex-start;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 10px 16px;
  min-height: 44px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.recheck-submit:hover {
  background: var(--accent);
  color: var(--accent-contrast);
}

.recheck-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.recheck-status {
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 1.2em;
}

/* --- Partial-result state --- */
.partial-note {
  color: var(--muted);
  font-size: 0.9rem;
}

.missing-questions {
  margin: 0 0 12px;
  padding-left: 20px;
}

.missing-questions li {
  margin-bottom: 4px;
}

/* --- Mandatory disclosure lines (§7) --- */
.disclosures {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.disclosure-line {
  margin: 0 0 4px;
  font-size: 0.78rem;
  color: var(--muted);
}

.error-result p {
  margin: 0;
  color: var(--error);
}

@media (min-width: 600px) {
  .recheck-form {
    grid-template-columns: 1fr 1fr;
  }

  .recheck-submit {
    grid-column: 1 / -1;
  }
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 16px 0 32px;
  color: var(--muted);
  font-size: 0.8rem;
}

/* Desktop breakpoint — widen the content column slightly, otherwise the
   mobile-first layout already reads fine at desktop widths. */
@media (min-width: 768px) {
  .wrap {
    max-width: 800px;
    padding: 0 24px;
  }

  .hero h1 {
    font-size: 2rem;
  }
}
