/* AEO Scanner — shared design system.
   Used by both index.html (hero/landing) and report.html (scan results).
   Dark theme, system fonts only, no external assets. */

:root {
  --bg: #0f1115;
  --card: #171a21;
  --card-border: #2a2e37;
  --text: #e8ebf0;
  --muted: #9aa2ad;
  --accent-1: #6366f1;
  --accent-2: #22d3ee;
  --good: #3ecf8e;
  --med: #e0b23c;
  --bad: #e05c5c;
  --radius: 12px;
  --radius-sm: 10px;
  --radius-lg: 14px;
  --font: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Spacing scale */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2.5rem;

  /* Depth */
  --shadow-card: 0 10px 30px -18px rgba(0, 0, 0, 0.55);
  --shadow-card-hover: 0 16px 40px -16px rgba(0, 0, 0, 0.6);
  --focus-glow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

* {
  box-sizing: border-box;
}

html, body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  margin: 0;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-2);
}

img {
  max-width: 100%;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  border-color: var(--accent-2);
  transform: translateY(-1px);
}

.btn.secondary {
  background: transparent;
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  border: none;
  color: #0b0d11;
}

.btn.primary:hover {
  filter: brightness(1.08);
}

.btn:active {
  transform: translateY(0);
}

.btn.block {
  display: flex;
  width: 100%;
}

.btn:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

button.btn {
  font-family: inherit;
}

/* ---------- Cards ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

/* ---------- Landing: header/nav ---------- */

.site-header {
  padding: 1.5rem 0;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  flex-shrink: 0;
  display: block;
}

.brand span {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.user-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.logout-form {
  display: inline;
  margin: 0;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--accent-2);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
}

.link-btn:hover {
  color: var(--accent-1);
}

.link-btn:focus-visible,
a:focus-visible,
input:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  padding: 3rem 0 3.5rem;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: -220px;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 500px;
  background: radial-gradient(closest-side, rgba(99, 102, 241, 0.35), rgba(34, 211, 238, 0.12), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.hero-inner {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 780px;
  margin: 0 auto;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.15;
  margin: 0 0 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.hero h1 .grad {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero .subhead {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto 2rem;
}

/* ---------- Scan form ---------- */

.scan-form {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  max-width: 560px;
  margin: 0 auto;
  text-align: left;
  box-shadow: 0 20px 60px -30px rgba(0, 0, 0, 0.6);
}

.scan-form > .btn.block {
  margin-top: var(--sp-5);
}

/* ---------- Form components: .field / .input / .select ----------
   One component system, used by both the scan form and the login form.
   The safety-net selector below guarantees that ANY text-like input
   dropped inside a form surface gets styled, even if someone forgets
   to add the `.input` class — this is what fixed the unstyled-login-
   inputs bug (inputs were previously only styled via `.scan-form
   input[type="text"]`, which silently excluded email/password). */

.field {
  margin-top: var(--sp-4);
}

.field:first-of-type {
  margin-top: 0;
}

.field label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.field .hint,
.hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.4rem;
}

.input,
.select,
input.input,
select.select,
.scan-form input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]),
.auth-card input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]) {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus,
.select:focus,
input.input:focus,
select.select:focus,
.scan-form input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):focus,
.auth-card input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):focus {
  outline: none;
  border-color: var(--accent-1);
  box-shadow: var(--focus-glow);
}

.input:focus-visible,
.select:focus-visible,
input.input:focus-visible,
select.select:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 1px;
}

/* Password field + show/hide toggle */

.password-field {
  position: relative;
}

.password-field .input {
  padding-right: 2.9rem;
}

.toggle-password {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  font-family: inherit;
}

.toggle-password:hover {
  color: var(--accent-2);
}

.toggle-password:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 1px;
}

/* ---------- Auth gate (signed-out hero CTA) ---------- */

.auth-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  text-align: center;
  padding: 2.25rem 1.75rem;
}

.auth-gate-copy {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
}

.auth-gate-btn {
  padding: 0.85rem 2.2rem;
  font-size: 1.02rem;
}

/* ---------- Login page ---------- */

.auth-section {
  position: relative;
  padding: var(--sp-6) 0 4rem;
  overflow: hidden;
}

.auth-section::before {
  content: "";
  position: absolute;
  top: -220px;
  left: 50%;
  transform: translateX(-50%);
  width: 760px;
  height: 460px;
  background: radial-gradient(closest-side, rgba(99, 102, 241, 0.32), rgba(34, 211, 238, 0.1), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.auth-wrap {
  position: relative;
  z-index: 1;
  max-width: 400px;
  margin: 0 auto;
}

.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
  margin-bottom: var(--sp-5);
}

.auth-back:hover {
  color: var(--accent-2);
}

.auth-card {
  max-width: 400px;
  box-shadow: var(--shadow-card);
}

.auth-title {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  font-weight: 800;
}

.auth-subtitle {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-error {
  background: rgba(224, 92, 92, 0.12);
  border: 1px solid rgba(224, 92, 92, 0.4);
  color: #f3a5a5;
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

/* ---------- Stat band ---------- */

.stat-band {
  padding: 2.5rem 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
}

.stat-tile {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.stat-tile:hover {
  transform: translateY(-3px);
  border-color: var(--accent-2);
}

.stat-number {
  font-size: clamp(1.6rem, 3.5vw, 2.1rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.1;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text);
  margin-top: 0.4rem;
}

.stat-source {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.76rem;
}

.stat-source a {
  color: var(--muted);
  text-decoration: none;
}

.stat-source a:hover {
  color: var(--accent-2);
  text-decoration: underline;
}

/* ---------- Explainer cards ---------- */

.section {
  padding: 2.5rem 0;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
  margin: 0 0 0.5rem;
}

.section-subtitle {
  text-align: center;
  color: var(--muted);
  max-width: 620px;
  margin: 0 auto 2rem;
  font-size: 0.95rem;
}

.explainer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.25rem;
}

.explainer-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.explainer-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-2);
}

.explainer-card .tag {
  display: inline-block;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 0.6rem;
}

.explainer-card p {
  margin: 0 0 0.6rem;
  color: var(--text);
  font-size: 0.92rem;
}

.explainer-card .wins {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
}

.explainer-card .muted {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 0.6rem;
}

/* ---------- Confidence cards ("How much should you bet on this?") ---------- */

.confidence-card .tier {
  margin-bottom: 0.7rem;
}

.confidence-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: var(--text);
}

.confidence-card p {
  color: var(--muted);
  font-size: 0.88rem;
}

.trust-callout {
  max-width: 780px;
  margin: 1.75rem auto 0;
  text-align: center;
}

.trust-callout .trust-line {
  margin: 0;
}

/* ---------- Why section ---------- */

.why-card {
  max-width: 780px;
  margin: 0 auto;
  text-align: center;
  padding: 2rem;
}

.why-card p {
  color: var(--text);
  font-size: 1rem;
  margin: 0 0 0.75rem;
}

.why-card p:last-child {
  margin-bottom: 0;
}

.why-card-title {
  margin-bottom: var(--sp-4);
}

/* ---------- Landing: "How it works & why it's accurate" methodology ---------- */

.methodology-section {
  padding-top: 1rem;
}

.methodology-landing-card {
  max-width: 900px;
  margin: 2rem auto 0;
  padding: 2rem;
}

.methodology-heading {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 1.1rem;
}

.methodology-landing-card > .methodology-heading:not(:first-child) {
  margin-top: 2rem;
}

.pipeline-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 0.5rem;
}

.pipeline-step {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem 1rem;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.pipeline-step:hover {
  transform: translateY(-3px);
  border-color: var(--accent-2);
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #0b0d11;
  font-weight: 800;
  font-size: 0.85rem;
  margin-bottom: 0.6rem;
}

.pipeline-step h4 {
  margin: 0 0 0.4rem;
  font-size: 0.92rem;
  color: var(--text);
}

.pipeline-step p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.trust-line {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0.25rem 0 1.25rem;
}

.trust-line.order-line {
  text-align: center;
  max-width: 640px;
  margin: 1.5rem auto 0;
}

.sources-block {
  border-top: 1px solid var(--card-border);
  padding-top: 1rem;
}

.sources-label {
  margin: 0 0 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sources-block .sources-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  list-style: none;
  padding-left: 0;
  margin: 0;
}

/* ---------- Footer ---------- */

.site-footer {
  padding: 2rem 0 3rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--card-border);
  margin-top: 1rem;
}

.footer-meta {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* ---------- FAQ section ---------- */

.faq-item {
  margin-top: 1.75rem;
}

.faq-item:first-child {
  margin-top: 0;
}

.faq-item h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  color: var(--text);
}

.faq-item p,
.faq-item ul {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.faq-item ul {
  padding-left: 1.2rem;
}

.faq-item li {
  margin-bottom: 0.4rem;
}

.faq-item p:last-child,
.faq-item ul:last-child {
  margin-bottom: 0;
}

/* ---------- Loading overlay ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 16, 0.94);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
}

.overlay.visible {
  display: flex;
}

.overlay-card {
  max-width: 480px;
  width: 100%;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 2.25rem 1.75rem;
}

.spinner {
  width: 56px;
  height: 56px;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  border: 4px solid var(--card-border);
  border-top-color: var(--accent-2);
  animation: spin 0.9s linear infinite;
}

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

.overlay-status {
  font-size: 1rem;
  font-weight: 600;
  min-height: 1.4em;
  margin-bottom: 1rem;
}

.progress-track {
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  transition: width 0.4s ease;
}

.overlay-note {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0;
}

.overlay-error-wrap {
  display: none;
}

.overlay-error {
  color: var(--bad);
  font-size: 0.9rem;
  margin: 0.5rem 0 1rem;
}

.overlay.error .spinner,
.overlay.error .progress-track {
  display: none;
}

/* ---------- Report page ---------- */

.report-wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.report-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.report-header h1 {
  font-size: 1.4rem;
  margin: 0 0 0.3rem;
}

.report-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  word-break: break-all;
}

.report-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.download-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding-left: 0.75rem;
  margin-left: 0.25rem;
  border-left: 1px solid var(--card-border);
}

.download-label {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.report-card {
  margin-bottom: var(--sp-5);
}

.report-card h2 {
  font-size: 1.05rem;
  margin: 0 0 1rem;
}

.error-card {
  background: #2a1a1a;
  border: 1px solid #6b2b2b;
  color: #ffb4b4;
}

/* ---------- Score dashboard: ring gauge + labeled meters ---------- */

.score-dashboard {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
  flex-wrap: wrap;
}

.gauge {
  position: relative;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  flex-shrink: 0;
  background: conic-gradient(var(--gauge-color) calc(var(--pct, 0) * 1%), var(--card-border) 0);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gauge::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: var(--card);
}

.gauge.gauge-good { --gauge-color: var(--good); }
.gauge.gauge-ok { --gauge-color: var(--med); }
.gauge.gauge-bad { --gauge-color: var(--bad); }

.gauge-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gauge-value {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1;
}

.gauge-label {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.35rem;
}

.meters {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  flex: 1;
  min-width: 220px;
}

.meter-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 0.15rem;
  color: var(--text);
}

.meter-label .meter-name {
  font-weight: 600;
}

.meter-sublabel {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.scores-callout {
  margin-top: var(--sp-4);
  margin-bottom: 0;
}

.bar-bg {
  background: var(--card-border);
  border-radius: 6px;
  height: 10px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 6px;
}

.fill-good { background: var(--good); }
.fill-ok { background: var(--med); }
.fill-bad { background: var(--bad); }

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.8rem;
  font-size: 0.85rem;
  color: var(--text);
}

.meta-grid .k {
  color: var(--muted);
}

/* ---------- Finding cards ---------- */

.findings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--sp-4);
}

.finding-card {
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
  min-width: 0;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.finding-card:hover {
  border-color: var(--accent-2);
  transform: translateY(-2px);
}

.finding-head {
  margin-bottom: 0.6rem;
}

.finding-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.finding-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text);
}

.finding-body {
  min-width: 0;
}

.finding-line {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--text);
}

.finding-line-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.finding-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.9rem;
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--card-border);
  font-size: 0.78rem;
}

.finding-effort {
  color: var(--muted);
}

.finding-effort strong {
  color: var(--text);
}

.finding-page {
  word-break: break-all;
  margin-left: auto;
}

.sev {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.sev-high { background: #4a1f1f; color: #ff9b9b; }
.sev-med { background: #4a3c1f; color: #ffcf7a; }
.sev-low { background: #1f3a4a; color: #8fd0ff; }

.layer-tag {
  display: inline-block;
  background: var(--card-border);
  color: var(--text);
  border-radius: 5px;
  padding: 0.05rem 0.4rem;
  font-size: 0.7rem;
  margin-right: 0.2rem;
}

.site-wide-tag {
  color: var(--good);
  font-size: 0.72rem;
  font-style: italic;
}

.page-block {
  border-top: 1px solid var(--card-border);
  padding-top: 1rem;
  margin-top: 1rem;
}

.page-block:first-child {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.page-url {
  font-weight: 600;
  word-break: break-all;
}

.faq-list {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
  color: var(--text);
  font-size: 0.85rem;
}

.rewrite-box {
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 0.7rem;
  font-size: 0.85rem;
  color: var(--text);
  margin-top: 0.4rem;
}

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

.blocked-bot {
  color: var(--bad);
}

.crawl-note {
  margin-top: var(--sp-3);
}

.page-meta-grid {
  margin-top: var(--sp-2);
}

.page-subheading {
  margin-top: var(--sp-3);
}

.page-llm-note {
  margin-top: var(--sp-2);
}

/* ---------- Tier badges (Standard / Emerging / Heuristic) ---------- */

.tier {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.tier-standard { background: #16352a; color: var(--good); }
.tier-emerging { background: #4a3c1f; color: #ffcf7a; }
.tier-heuristic { background: #2c2a4a; color: #c3b8ff; }

/* ---------- Finding detail: why-it-matters / evidence / basis ---------- */

.why-it-matters {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.basis-line {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-style: italic;
}

.evidence-details {
  margin-top: 0.5rem;
}

.evidence-details summary {
  cursor: pointer;
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 600;
  user-select: none;
}

.evidence-details summary:hover {
  color: var(--accent-1);
}

.evidence-caption {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.evidence-box {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  margin: 0.25rem 0 0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.75rem;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 100%;
  max-height: 220px;
  overflow: auto;
}

/* ---------- Methodology ("How we analyze") panel ---------- */

.methodology-card summary {
  cursor: pointer;
  list-style: none;
}

.methodology-card summary::-webkit-details-marker {
  display: none;
}

.methodology-card summary h2,
.methodology-summary-title {
  display: inline;
}

.methodology-body {
  margin-top: 1rem;
}

.methodology-body p {
  color: var(--text);
  font-size: 0.9rem;
  margin: 0 0 0.85rem;
}

.tier-explain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.tier-explain p {
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.sources-list {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
  font-size: 0.85rem;
  color: var(--text);
}

.sources-list li {
  margin-bottom: 0.3rem;
}

.findings-intro {
  margin: -0.3rem 0 1rem;
}

/* ---------- AI brand recognition card ---------- */

.brand-card h2 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.callout {
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-left: 3px solid var(--accent-2);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 1.1rem;
}

.brand-note {
  margin: 0;
}

.brand-status {
  font-weight: 700;
  margin: 0 0 0.8rem;
}

.brand-status-good { color: var(--good); }
.brand-status-warn { color: var(--med); }
.brand-status-neutral { color: var(--muted); }

.brand-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 0 0 1rem;
}

.brand-compare-col {
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
}

.brand-compare-col p {
  margin: 0.3rem 0 0;
  font-size: 0.88rem;
  color: var(--text);
}

.brand-appearance {
  font-size: 0.9rem;
  margin: 0 0 0.9rem;
}

.brand-questions summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  font-size: 0.9rem;
}

.brand-question-list {
  list-style: none;
  margin: 0.8rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.brand-question-list li {
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
}

.brand-question-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.brand-question-text {
  font-size: 0.88rem;
  color: var(--text);
}

.brand-question-answer {
  margin: 0.35rem 0 0;
}

.brand-appeared-yes,
.brand-appeared-no {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.brand-appeared-yes { background: #16352a; color: var(--good); }
.brand-appeared-no { background: #2a2e37; color: var(--muted); }

@media (max-width: 640px) {
  .brand-compare {
    grid-template-columns: 1fr;
  }
}

/* ---------- Simple index card (fallback / legacy support) ---------- */

.card.simple {
  max-width: 480px;
  margin: 4rem auto;
  text-align: center;
}

.card.simple h1 {
  font-size: 1.4rem;
  margin: 0 0 0.6rem;
}

.card.simple .subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 1.5rem;
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
    border-top-color: var(--accent-2);
  }
  .progress-fill {
    transition: none;
  }
  .stat-tile:hover,
  .explainer-card:hover,
  .btn:hover,
  .pipeline-step:hover,
  .finding-card:hover {
    transform: none;
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .pipeline-steps {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .hero {
    padding: 2rem 0 2.5rem;
  }
  .report-header {
    flex-direction: column;
  }
  .report-actions {
    width: 100%;
  }
  .report-actions .btn {
    flex: 1;
  }
  .pipeline-steps {
    grid-template-columns: 1fr;
  }
  .methodology-landing-card {
    padding: 1.5rem 1.25rem;
  }
  .score-dashboard {
    justify-content: center;
    text-align: center;
  }
  .findings-grid {
    grid-template-columns: 1fr;
  }
  .download-group {
    border-left: none;
    padding-left: 0;
    margin-left: 0;
    width: 100%;
  }
  .download-group .btn {
    flex: 1;
  }
}

@media (max-width: 360px) {
  .gauge {
    width: 108px;
    height: 108px;
  }
  .gauge-value {
    font-size: 1.7rem;
  }
}

/* ---------- Header "My scans" link (index.html user-indicator) ---------- */

.history-link {
  color: var(--accent-2);
  text-decoration: underline;
}

.history-link:hover {
  color: var(--accent-1);
}

/* ---------- "Since your last scan..." diff banner (report.html) ---------- */

.diff-banner {
  border-left: 3px solid var(--accent-2);
}

.diff-banner.diff-up {
  border-left-color: var(--good);
}

.diff-banner.diff-down {
  border-left-color: var(--bad);
}

.diff-banner-head {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}

.diff-arrow {
  font-weight: 700;
  font-size: 1.05rem;
}

.diff-up .diff-arrow { color: var(--good); }
.diff-down .diff-arrow { color: var(--bad); }
.diff-flat .diff-arrow { color: var(--muted); }

.diff-banner-title {
  color: var(--muted);
  font-size: 0.88rem;
}

.diff-banner-summary {
  margin: 0;
  color: var(--text);
  font-size: 0.92rem;
}

/* ---------- History page (templates/history.html) ---------- */

.history-wrap .report-header p {
  word-break: normal;
}

.history-group {
  margin-bottom: var(--sp-5);
}

.history-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.history-url {
  font-size: 1.05rem;
  margin: 0;
  word-break: break-all;
}

.inline-form {
  display: inline;
  margin: 0;
}

.btn.danger {
  border-color: #6b2b2b;
  color: #ffb4b4;
}

.btn.danger:hover {
  background: #2a1a1a;
}

.btn.small {
  padding: 0.35rem 0.6rem;
  font-size: 0.78rem;
}

.score-progression {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.score-chip-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.score-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
}

.chip-good { background: #16352a; color: var(--good); }
.chip-ok { background: #3a2f14; color: var(--med); }
.chip-bad { background: #3a1f1f; color: var(--bad); }

.score-chip-date {
  font-size: 0.68rem;
  color: var(--muted);
}

.score-arrow {
  color: var(--muted);
  font-size: 1rem;
}

.history-diff-callout {
  margin-bottom: 1rem;
}

.history-scan-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.history-scan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
}

.history-scan-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.history-scan-date {
  font-weight: 600;
  font-size: 0.88rem;
}

.history-scan-scores {
  font-size: 0.78rem;
}

.history-scan-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.download-group.small-group {
  padding-left: 0.5rem;
  margin-left: 0;
}

@media (max-width: 640px) {
  .history-group-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .history-scan-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .history-scan-actions {
    width: 100%;
  }
  .download-group.small-group {
    border-left: none;
    padding-left: 0;
    margin-left: 0;
  }
}

@media (max-width: 360px) {
  .history-scan-actions .btn {
    flex: 1;
  }
}

/* ---------- AI crawler reachability ---------- */

.crawler-card h2 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.crawler-caveat code {
  background: var(--card-border);
  color: var(--text);
  border-radius: 4px;
  padding: 0.05rem 0.3rem;
  font-size: 0.82rem;
}

.crawler-note {
  margin: 0;
}

.crawler-summary {
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.crawler-summary-bad {
  color: var(--bad);
}

.crawler-table-wrap {
  overflow-x: auto;
}

.crawler-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.crawler-table th,
.crawler-table td {
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--card-border);
  vertical-align: top;
}

.crawler-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.crawler-table td code {
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  font-size: 0.85rem;
}

.crawler-row-server-blocked {
  background: rgba(224, 92, 92, 0.08);
}

.crawler-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.crawler-badge-good { background: #16352a; color: var(--good); }
.crawler-badge-bad { background: #3a1f1f; color: var(--bad); }
.crawler-badge-neutral { background: #2a2e37; color: var(--muted); }

.crawler-badge-server {
  outline: 1px solid var(--bad);
}

.crawler-evidence-code {
  display: inline-block;
  font-weight: 600;
  color: var(--text);
  margin-right: 0.4rem;
}

.crawler-evidence-rule {
  margin: 0.3rem 0 0;
  padding: 0.4rem 0.55rem;
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.crawler-evidence-note {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.78rem;
}

@media (max-width: 640px) {
  .crawler-table thead {
    display: none;
  }
  .crawler-table,
  .crawler-table tbody,
  .crawler-table tr,
  .crawler-table td {
    display: block;
    width: 100%;
  }
  .crawler-table tr {
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.7rem;
    padding: 0.4rem 0.2rem;
  }
  .crawler-table td {
    border-bottom: none;
    padding: 0.35rem 0.6rem;
  }
  .crawler-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    margin-bottom: 0.15rem;
  }
}

/* ---------- Where you appear (off-page mentions) ---------- */

.mentions-card h2 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.mentions-caveat code {
  background: var(--card-border);
  color: var(--text);
  border-radius: 4px;
  padding: 0.05rem 0.3rem;
  font-size: 0.82rem;
}

.mentions-note {
  margin: 0;
}

.mentions-summary {
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.mentions-sources {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.mentions-source {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
}

.mentions-source-unavailable {
  border-color: var(--med);
  background: rgba(224, 178, 60, 0.06);
}

.mentions-source-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.mentions-source-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.mentions-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.mentions-badge-ok { background: #16352a; color: var(--good); }
.mentions-badge-unavailable { background: #3a2f16; color: var(--med); }
.mentions-badge-skipped { background: #2a2e37; color: var(--muted); }

.mentions-source-note {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
}

.mentions-list {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.mentions-item {
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--card-border);
}

.mentions-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.mentions-item-title {
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  word-break: break-word;
}

.mentions-item-title:hover {
  color: var(--accent-2);
  text-decoration: underline;
}

.mentions-item-url {
  display: block;
  font-size: 0.78rem;
  word-break: break-all;
  margin-top: 0.1rem;
}

.mentions-item-meta {
  display: block;
  font-size: 0.78rem;
  margin-top: 0.15rem;
}

@media (max-width: 640px) {
  .mentions-source-head {
    align-items: flex-start;
  }
}

/* ---------- Site health (broken links + risky-download/insecure-content
   patterns) ---------- */
/* Two subsections kept visually distinct on purpose: broken links (where
   confirmed-broken vs. could-not-verify/blocked must never look the same,
   so nobody "fixes" a link that already works) and safety patterns (where
   the "not a malware scan" caveat needs to stay prominent). See
   scanner/health.py's module docstring for the full reasoning. */

.health-card h2 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.health-note {
  margin: 0;
}

.health-section {
  margin-top: 1.1rem;
}

.health-section:first-of-type {
  margin-top: 0;
}

.health-section-title {
  font-size: 1rem;
  margin: 0 0 0.6rem;
}

.health-caveat {
  font-size: 0.85rem;
}

.health-summary {
  font-size: 0.9rem;
  margin: 0 0 0.8rem;
}

.health-truncated {
  display: block;
  margin-top: 0.2rem;
  color: var(--med);
  font-weight: 600;
}

.health-links-group {
  margin-bottom: 0.9rem;
}

.health-links-group-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.4rem;
}

.health-links-group-title-broken {
  color: var(--bad);
}

.health-links-group-title-unverified {
  color: var(--muted);
}

.health-link-list,
.health-pattern-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.health-link-item,
.health-pattern-item {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
}

.health-link-item-broken {
  border-color: var(--bad);
  background: rgba(224, 92, 92, 0.06);
}

.health-link-item-unverified {
  background: rgba(154, 162, 173, 0.06);
}

.health-link-head,
.health-pattern-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.health-link-url {
  font-size: 0.88rem;
  font-weight: 600;
  word-break: break-all;
}

.health-link-meta {
  margin: 0.3rem 0 0;
  font-size: 0.78rem;
}

.health-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.health-badge-scored { background: #3a1f1f; color: var(--bad); }
.health-badge-info { background: #2a2e37; color: var(--muted); }
.health-badge-blocked { background: #3a2f16; color: var(--med); }
.health-badge-server-error { background: #3a2f16; color: var(--med); }
.health-badge-inconclusive { background: #2a2e37; color: var(--muted); }

.health-pattern-scored {
  border-color: var(--med);
  background: rgba(224, 178, 60, 0.06);
}

.health-pattern-detail {
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
  word-break: break-word;
}

.health-pattern-page {
  margin: 0.3rem 0 0;
  font-size: 0.78rem;
  word-break: break-all;
}

@media (max-width: 640px) {
  .health-link-head,
  .health-pattern-head {
    align-items: flex-start;
  }
  .health-link-url {
    word-break: break-all;
  }
}

/* ---------- AI summary & authority explainer (top-of-report card) ---------- */
/* Two distinct pieces, styled to stay visually distinguishable: the
   AI-generated per-score summaries (tier-heuristic, .summary-*) and the
   static, never-model-generated authority explainer (.authority-*) below
   them. See scanner/summarize.py's docstring for why they're kept separate. */

.summary-card h2 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.summary-ai-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 0 0 1rem;
  font-size: 0.85rem;
}

.summary-note {
  margin: 0 0 1rem;
}

.summary-score-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.9rem;
  margin: 0 0 1.3rem;
}

.summary-score-block {
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
}

.summary-score-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.summary-score-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
}

.summary-score-value {
  font-size: 0.85rem;
  color: var(--muted);
}

.summary-score-text {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.5;
}

.authority-explainer-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0 0 0.5rem;
}

.authority-callout {
  margin: 0;
}

.authority-callout p {
  margin: 0 0 0.75rem;
}

.authority-callout p:last-child {
  margin-bottom: 0;
}

@media (max-width: 640px) {
  .summary-score-grid {
    grid-template-columns: 1fr;
  }
}
