:root {
  --bg-black: #0a0806;
  --bg-glow-1: #3d1d0c;
  --bg-glow-2: #1a0e07;
  --accent-orange-1: #ff7a29;
  --accent-orange-2: #e8460e;
  --white: #ffffff;
  --text-muted: #b9ada2;
  --text-faint: #7d7168;

  --paper: #f7f5f2;
  --card: #ffffff;
  --ink: #1c1712;
  --ink-muted: #6b6157;
  --border: #e8e2da;

  --minor-bg: #fdecc8;
  --minor-text: #92400e;
  --moderate-bg: #fde0c4;
  --moderate-text: #c2410c;
  --critical-bg: #fce0e0;
  --critical-text: #b91c1c;

  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--white);
}

a { color: inherit; }

/* ---------- Landing page ---------- */

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 700px at 32% 68%, var(--bg-glow-1) 0%, transparent 60%),
    radial-gradient(900px 500px at 45% 80%, var(--bg-glow-2) 0%, transparent 70%),
    var(--bg-black);
}

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
}

.title {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 800;
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  margin: 0 0 20px;
  letter-spacing: -0.01em;
}

.title .accent {
  background: linear-gradient(90deg, var(--accent-orange-1), var(--accent-orange-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--text-muted);
  margin: 0 0 40px;
  white-space: nowrap;
}

.audit-form {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 8px 8px 8px 24px;
  width: min(720px, 92vw);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

#url-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 1.05rem;
  padding: 14px 8px;
  color: var(--ink);
  background: transparent;
}

#url-input::placeholder { color: #8a8378; }

#submit-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 1rem;
  color: var(--white);
  background: linear-gradient(90deg, var(--accent-orange-1), var(--accent-orange-2));
  padding: 14px 24px;
  border-radius: 14px;
  transition: transform 0.15s ease, filter 0.15s ease;
  white-space: nowrap;
}

#submit-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
#submit-btn:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }

.error-msg {
  margin-top: 16px;
  color: #ff8f7a;
  font-size: 0.92rem;
  min-height: 1.2em;
}

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 32px;
  font-size: 0.85rem;
  color: var(--text-faint);
}

.footer .disclaimer { opacity: 0.8; }

@media (max-width: 640px) {
  .footer { flex-direction: column; gap: 8px; text-align: center; }
  .audit-form { flex-direction: column; align-items: stretch; padding: 16px; border-radius: var(--radius-md); }
  #submit-btn { justify-content: center; }
  .subtitle { white-space: normal; max-width: 360px; }
}

/* ---------- Results page ---------- */

.results-shell {
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
}

.results-hero {
  background:
    radial-gradient(1000px 500px at 25% 100%, var(--bg-glow-1) 0%, transparent 65%),
    var(--bg-black);
  padding: 28px 32px 32px;
  color: var(--white);
}

.results-hero-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.brand {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 800;
  font-size: 1.4rem;
  text-decoration: none;
}
.brand .accent {
  background: linear-gradient(90deg, var(--accent-orange-1), var(--accent-orange-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.new-audit-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.18);
  padding: 8px 16px;
  border-radius: 999px;
}
.new-audit-link:hover { color: var(--white); border-color: rgba(255,255,255,0.4); }

.audited-url {
  font-size: 1.6rem;
  font-weight: 600;
  margin: 0 0 4px;
  word-break: break-word;
}
.audited-url-sub {
  color: var(--text-muted);
  margin: 0 0 20px;
  font-size: 0.95rem;
}

.summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.summary-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  background: rgba(255,255,255,0.08);
  color: var(--white);
}
.summary-chip .dot { width: 9px; height: 9px; border-radius: 50%; }
.dot-critical { background: #ff5c5c; }
.dot-moderate { background: #ffab5c; }
.dot-minor { background: #ffe08a; }

.copy-all-btn {
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--white);
  background: linear-gradient(90deg, var(--accent-orange-1), var(--accent-orange-2));
  padding: 12px 20px;
  border-radius: 999px;
}
.copy-all-btn:hover { filter: brightness(1.08); }

/* Progress state */
.progress-panel {
  max-width: 640px;
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 24px;
}
.spinner {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: var(--accent-orange-1);
  margin: 0 auto 24px;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress-text { color: var(--text-muted); font-size: 0.95rem; }

.error-panel {
  max-width: 560px;
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 24px;
}
.error-panel h2 { font-family: 'Playfair Display', serif; margin-top: 4px; }
.error-panel a { color: var(--accent-orange-1); }
.error-panel a.error-brand { color: var(--ink); margin-bottom: 8px; }
.error-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
}
.error-panel .copy-all-btn { color: var(--white); }
.error-home-link { font-size: 0.9rem; }

.partial-failure-warning {
  max-width: 960px;
  margin: 20px auto 0;
  padding: 12px 20px;
  background: var(--moderate-bg);
  color: var(--moderate-text);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
}

/* Report content */
.report-body {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 24px 100px;
}

.page-group { margin-bottom: 48px; }

.page-group-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}
.page-group-title { font-size: 1.15rem; font-weight: 700; margin: 0; }
.page-group-url { font-size: 0.85rem; color: var(--ink-muted); }

.no-findings {
  color: var(--ink-muted);
  font-size: 0.9rem;
  font-style: italic;
}

.finding-card {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

.finding-screenshot {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  object-fit: cover;
  max-height: 220px;
}

.finding-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.severity-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.severity-Minor { background: var(--minor-bg); color: var(--minor-text); }
.severity-Moderate { background: var(--moderate-bg); color: var(--moderate-text); }
.severity-Critical { background: var(--critical-bg); color: var(--critical-text); }

.heuristic-tag {
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.section-tag {
  font-size: 0.75rem;
  color: var(--ink-muted);
  margin-left: auto;
  background: var(--paper);
  padding: 3px 10px;
  border-radius: 999px;
}

.finding-title { font-size: 1.02rem; font-weight: 700; margin: 0 0 6px; }
.finding-description { font-size: 0.92rem; color: var(--ink-muted); line-height: 1.5; margin: 0 0 12px; }

.copy-btn {
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.copy-btn:hover { background: #efe9e1; }
.copy-btn.copied { background: #1c1712; color: var(--white); border-color: #1c1712; }

@media (max-width: 640px) {
  .finding-card { grid-template-columns: 1fr; }
  .results-hero-top { flex-wrap: wrap; gap: 12px; }
}
