/* Apple-inspired overlay. Loaded after site.css. Reversible: remove the link to restore the original. */

:root {
  --sf: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Helvetica, Arial, sans-serif;
  --apple-blue: #007aff;
  --apple-blue-press: #0062cc;
  --apple-red: #ff3b30;
  --apple-green: #34c759;
  --apple-orange: #ff9500;

  --bg: #ffffff;
  --bg-2: #f5f5f7;
  --bg-3: #fbfbfd;
  --surface: rgba(255, 255, 255, 0.72);
  --text: #1d1d1f;
  --text-muted: #6e6e73;
  --text-subtle: #86868b;
  --border: rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.08);

  --r-md: 12px;
  --r-lg: 18px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-2: #1c1c1e;
    --bg-3: #111113;
    --surface: rgba(28, 28, 30, 0.72);
    --text: #f5f5f7;
    --text-muted: #aeaeb2;
    --text-subtle: #8e8e93;
    --border: rgba(255, 255, 255, 0.10);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.5);
  }
}

/* Base */
body {
  background: var(--bg) !important;
  color: var(--text) !important;
  font-family: var(--sf) !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  cursor: auto !important;
  line-height: 1.47;
}

a, button, input, select, textarea, label { cursor: auto !important; }

/* Kill the decorative noise (divs may also be removed from base.html, but defense in depth) */
.cursor-dot, .cursor-ring, .grain, .marquee-strip { display: none !important; }
.hero-copy::before { display: none !important; }

/* Typography: replace Syne, normalize scale */
.brand-mark,
.hero-title,
.section-title,
.section-subtitle,
.action-card h2,
.result-title,
.stat-value {
  font-family: var(--sf) !important;
  font-weight: 700 !important;
  letter-spacing: -0.022em !important;
  color: var(--text) !important;
}

.hero-title {
  font-size: clamp(2.25rem, 6vw, 3.75rem) !important;
  line-height: 1.05 !important;
  max-width: none !important;
}
.section-title { font-size: clamp(1.75rem, 4vw, 2.5rem) !important; line-height: 1.1 !important; }
.section-subtitle { font-size: clamp(1.125rem, 2vw, 1.5rem) !important; line-height: 1.2 !important; }

.hero-subtitle, .section-copy {
  color: var(--text-muted) !important;
  font-size: 1.0625rem !important;
  line-height: 1.5 !important;
  font-weight: 400 !important;
}

.eyebrow, .section-meta, .micro-badge {
  color: var(--apple-blue) !important;
  font-size: 0.8125rem !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
}

/* Nav */
.site-nav {
  background: var(--surface) !important;
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border) !important;
  min-height: 56px !important;
}
.brand-mark { font-size: 1.0625rem !important; }
.nav-link {
  color: var(--text-muted) !important;
  font-size: 0.9375rem !important;
  font-weight: 400 !important;
}
.nav-link:hover, .nav-link:focus { color: var(--text) !important; }
.nav-lang .nav-link { letter-spacing: 0 !important; font-size: 0.8125rem !important; }
.navbar-toggler { border-radius: var(--r-md) !important; border-color: var(--border) !important; }

/* Cards: rounded, soft shadows, no gold gradient */
.page-card, .action-card, .result-card, .audit-row,
.info-strip, .privacy-banner, .flash-panel {
  background: var(--bg-2) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--r-lg) !important;
  box-shadow: var(--shadow-sm) !important;
  transition: transform 240ms var(--ease), box-shadow 240ms var(--ease) !important;
}
.page-card::before, .action-card::before, .result-card::before { display: none !important; }
.action-card:hover, .result-card:hover, .page-card.interactive-panel:hover {
  background: var(--bg-2) !important;
  border-color: var(--border) !important;
  box-shadow: var(--shadow-md) !important;
  transform: translateY(-2px) !important;
}
.page-card-secondary { background: var(--bg-3) !important; }

.card-icon {
  border-radius: var(--r-md) !important;
  border-color: var(--border) !important;
  background: var(--bg) !important;
  color: var(--apple-blue) !important;
  margin-bottom: 1.25rem !important;
}
.action-card:hover .card-icon { color: var(--apple-blue) !important; border-color: var(--border) !important; }

/* Stat cards */
.trust-panel { background: transparent !important; border: none !important; padding: 0 !important; gap: 0.75rem !important; }
.stat-card {
  background: var(--bg-2) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--r-lg) !important;
  min-height: auto !important;
  padding: 1.25rem !important;
  box-shadow: var(--shadow-sm) !important;
}
.stat-value { font-size: clamp(1.75rem, 4vw, 2.5rem) !important; }
.stat-label { color: var(--text-muted) !important; font-weight: 500 !important; }

/* Buttons: pill shape, system blue */
.btn {
  border-radius: 980px !important;
  font-family: var(--sf) !important;
  font-weight: 590 !important;
  letter-spacing: 0 !important;
  padding: 0.7rem 1.4rem !important;
  min-height: 44px !important;
  transition: background-color 160ms var(--ease), transform 160ms var(--ease), opacity 160ms var(--ease) !important;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--apple-blue) !important;
  border-color: var(--apple-blue) !important;
  color: #ffffff !important;
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--apple-blue-press) !important;
  border-color: var(--apple-blue-press) !important;
  color: #ffffff !important;
}

.btn-ghost, .btn-outline-dark {
  background: transparent !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
}
.btn-ghost:hover, .btn-ghost:focus,
.btn-outline-dark:hover, .btn-outline-dark:focus {
  background: var(--bg-2) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

.btn-sm { min-height: 38px !important; padding: 0.45rem 1rem !important; font-size: 0.9375rem !important; }

/* Mobile: full-width primary CTA */
@media (max-width: 575px) {
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .btn { width: 100%; }
  form .btn-primary { width: 100%; }
}

/* Forms */
.form-control, .form-select {
  border-radius: var(--r-md) !important;
  border: 1px solid var(--border) !important;
  background-color: var(--bg-2) !important;
  color: var(--text) !important;
  min-height: 44px !important;
  font-size: 1rem !important;
  padding: 0.75rem 1rem !important;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease) !important;
}
.form-control:focus, .form-select:focus {
  border-color: var(--apple-blue) !important;
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.18) !important;
  background-color: var(--bg-2) !important;
  color: var(--text) !important;
}
.form-control::placeholder { color: var(--text-subtle) !important; }
.form-label { color: var(--text-muted) !important; font-size: 0.9375rem !important; font-weight: 500 !important; margin-bottom: 0.4rem !important; }
.form-text { color: var(--text-subtle) !important; }

/* Alerts: minimal, system colors, soft */
.alert { border-radius: var(--r-md) !important; padding: 0.875rem 1rem !important; background: var(--bg-2) !important; color: var(--text) !important; border: 1px solid var(--border) !important; }
.alert-success { border-left: 3px solid var(--apple-green) !important; }
.alert-danger { border-left: 3px solid var(--apple-red) !important; }
.alert-warning { border-left: 3px solid var(--apple-orange) !important; }
.alert-info { border-left: 3px solid var(--apple-blue) !important; }
.btn-close { filter: none !important; }

/* Privacy banner / info strip */
.privacy-banner { color: var(--text-muted) !important; padding: 0.875rem 1rem !important; font-size: 0.9375rem !important; }
.info-strip { color: var(--text-muted) !important; padding: 0.75rem 1rem !important; }
.status-live { background: var(--apple-green) !important; box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.18) !important; }
.status-text-live { color: var(--apple-green) !important; }
.attempt-pill { background: var(--bg-2) !important; border-radius: 999px !important; border: 1px solid var(--border) !important; padding: 0.2rem 0.7rem !important; }

/* Lists */
.clean-list li { color: var(--text-muted) !important; }
.clean-list li::before {
  background: var(--apple-blue) !important;
  border-radius: 50%;
  width: 6px !important;
  height: 6px !important;
  top: 0.7em !important;
}

/* Tables */
.table thead th {
  color: var(--text-muted) !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  font-weight: 600 !important;
  font-size: 0.875rem !important;
}
.table { color: var(--text) !important; }
.audit-row strong { color: var(--apple-blue) !important; letter-spacing: 0 !important; text-transform: none !important; font-size: 0.875rem !important; font-weight: 600 !important; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border) !important;
  color: var(--text-subtle) !important;
  font-style: normal !important;
}

/* Focus visibility (accessibility) */
:focus-visible {
  outline: 3px solid rgba(0, 122, 255, 0.5) !important;
  outline-offset: 2px;
  border-radius: 6px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  .animate-in { animation: none !important; opacity: 1 !important; transform: none !important; }
}

/* ==================================================================
   Wizard chooser (home page) + premium glow card
   ================================================================== */

.wizard-shell { padding-top: 3rem; padding-bottom: 3rem; }
.wizard-header { text-align: center; margin: 0 auto 2.25rem; max-width: 38rem; }
.wizard-header .eyebrow { display: inline-flex; }

.wizard-title {
  font-family: var(--sf) !important;
  font-weight: 700 !important;
  letter-spacing: -0.025em !important;
  font-size: clamp(2rem, 5.5vw, 3rem);
  line-height: 1.05;
  margin: 0.5rem 0 0.75rem;
  color: var(--text);
}
.wizard-subtitle {
  color: var(--text-muted);
  font-size: 1.0625rem;
  line-height: 1.5;
  margin: 0 auto;
}

.wizard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.wizard-card.glow-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 2rem;
  text-decoration: none !important;
  color: var(--text) !important;
  border-radius: 22px;
}
.wizard-card h2 {
  font-family: var(--sf) !important;
  font-size: 1.5rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.022em !important;
  margin: 0;
  color: var(--text);
}
.wizard-card p {
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.5;
  margin: 0;
}
.wizard-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(0, 122, 255, 0.10);
  color: var(--apple-blue);
  margin-bottom: 0.4rem;
  transition: transform 320ms var(--ease);
}
.wizard-icon svg { width: 22px; height: 22px; display: block; }
.wizard-card:hover .wizard-icon { transform: scale(1.04); }

.wizard-cta {
  color: var(--apple-blue);
  font-weight: 600;
  font-size: 0.9375rem;
  margin-top: 0.4rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.wizard-cta span { transition: transform 200ms var(--ease); display: inline-block; }
.wizard-card:hover .wizard-cta span { transform: translateX(4px); }

.wizard-trust { display: flex; justify-content: center; }
.trust-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Glow card — the premium hover */
.glow-card {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--border);
  overflow: hidden;
  isolation: isolate;
  transition: transform 320ms var(--ease), box-shadow 320ms var(--ease), border-color 320ms var(--ease);
  box-shadow: var(--shadow-sm);
}
.glow-card::before {
  content: "";
  position: absolute;
  inset: -2px;
  background: radial-gradient(640px circle at 30% 20%, rgba(0, 122, 255, 0.16), transparent 45%);
  opacity: 0;
  transition: opacity 320ms var(--ease);
  pointer-events: none;
  z-index: 0;
}
.glow-card > * { position: relative; z-index: 1; }
.glow-card:hover, .glow-card:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(0, 122, 255, 0.20);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 12px 40px rgba(0, 0, 0, 0.06),
    0 0 0 1px rgba(0, 122, 255, 0.14),
    0 24px 56px -10px rgba(0, 122, 255, 0.22);
}
.glow-card:hover::before, .glow-card:focus-visible::before { opacity: 1; }

@media (prefers-color-scheme: dark) {
  .glow-card:hover, .glow-card:focus-visible {
    box-shadow:
      0 1px 2px rgba(0, 0, 0, 0.5),
      0 12px 40px rgba(0, 0, 0, 0.4),
      0 0 0 1px rgba(0, 122, 255, 0.34),
      0 24px 64px -10px rgba(0, 122, 255, 0.32);
  }
  .wizard-icon { background: rgba(0, 122, 255, 0.18); }
}

@media (max-width: 575px) {
  .wizard-shell { padding-top: 1.5rem; padding-bottom: 1.5rem; }
  .wizard-card.glow-card { padding: 1.5rem; }
}

/* Step indicator pill (for upload page header) */
.step-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: rgba(0, 122, 255, 0.10);
  color: var(--apple-blue);
  font-size: 0.8125rem;
  font-weight: 600;
}
.step-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--apple-blue);
}

/* OCR processing state */
.btn[disabled], .btn:disabled { opacity: 0.65 !important; cursor: progress !important; }
.btn .spinner-border-sm {
  width: 14px;
  height: 14px;
  border-width: 2px;
  margin-right: 8px;
  vertical-align: -2px;
  display: inline-block;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.processing-note {
  margin-top: 1rem;
  padding: 0.875rem 1rem;
  border-radius: var(--r-md);
  background: rgba(0, 122, 255, 0.08);
  color: var(--text-muted);
  font-size: 0.9375rem;
  display: none;
}
.processing-note.is-active { display: block; }
