/* reascan — dark SaaS theme. Tokens live in tokens.css; this file is components. */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(99, 102, 241, 0.07), transparent 60%),
    var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 var(--space-3); }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); overflow: hidden;
}

/* ---------- header: sticky, translucent, blur ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 13, 18, 0.72);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex; align-items: center; gap: var(--space-3);
  min-height: 64px;
}

.brand {
  display: inline-flex; align-items: center; gap: var(--space-1);
  color: var(--text-primary); font-family: var(--font-display);
  font-weight: 700; font-size: var(--text-lg); text-decoration: none;
  letter-spacing: -0.01em;
}
.brand-mark {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; border-radius: var(--radius-control);
  background: var(--accent-gradient); color: #fff; font-size: 14px;
  box-shadow: 0 0 16px var(--accent-glow);
}

.site-nav { display: flex; gap: var(--space-1); margin-left: var(--space-1); }
.nav-link {
  color: var(--text-secondary); text-decoration: none;
  font-size: var(--text-sm); font-weight: 500;
  padding: 8px 12px; border-radius: var(--radius-control);
  transition: color var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out);
}
.nav-link:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.04); }
.nav-link.is-active { color: var(--text-primary); background: rgba(255, 255, 255, 0.06); }

.tagline {
  margin-left: auto; color: var(--text-muted);
  font-size: var(--text-xs); font-family: var(--font-mono); letter-spacing: 0.02em;
}

/* ---------- hero ---------- */

.hero { padding: var(--space-16) 0 var(--space-12); text-align: center; }
.hero-inner { max-width: var(--content-width); margin: 0 auto; }

.eyebrow {
  display: inline-block; margin: 0 0 var(--space-3);
  font-family: var(--font-mono); font-size: var(--text-xs);
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 6px 14px; background: var(--bg-surface);
}

.hero h1 {
  margin: 0 0 var(--space-3);
  font-family: var(--font-display); font-weight: 800;
  font-size: var(--text-5xl); line-height: 1.1; letter-spacing: -0.02em;
  background: linear-gradient(180deg, var(--text-primary) 40%, var(--text-secondary));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.lede {
  margin: 0 auto var(--space-4); max-width: 62ch;
  color: var(--text-secondary); font-size: var(--text-lg); line-height: 1.6;
}

.hero-ctas { display: flex; gap: var(--space-2); justify-content: center; flex-wrap: wrap; }

.hero-points {
  list-style: none; display: flex; gap: var(--space-2); justify-content: center;
  flex-wrap: wrap; margin: var(--space-5) 0 0; padding: 0;
}
.hero-points li {
  font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 6px 14px; background: var(--bg-surface);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 12px 24px;
  border-radius: var(--radius-control); border: 1px solid transparent;
  font: 500 var(--text-base) var(--font-body); text-decoration: none; cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out);
}
.btn-primary {
  background: var(--accent-gradient); color: #fff; border: none;
  box-shadow: 0 0 24px rgba(99, 102, 241, 0.25);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 0 32px rgba(99, 102, 241, 0.4); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.55; cursor: default; transform: none; box-shadow: none; }
.btn-secondary {
  background: var(--bg-surface); color: var(--text-primary);
  border-color: var(--border-strong);
}
.btn-secondary:hover { border-color: var(--accent); background: var(--bg-elevated); }

/* ---------- cards / panels ---------- */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-4);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2), 0 8px 32px rgba(0, 0, 0, 0.25);
}
.panel { margin: var(--space-4) auto; max-width: var(--content-width); }
.panel h2 {
  margin: 0 0 var(--space-3);
  font-family: var(--font-display); font-weight: 700;
  font-size: var(--text-2xl); line-height: 1.25; letter-spacing: -0.01em;
}

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

.form-row { display: flex; gap: var(--space-2); }
input[type="url"] {
  flex: 1; min-width: 0; min-height: 44px;
  background: var(--bg-input); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--radius-control);
  padding: 12px 16px; font: 400 var(--text-base) var(--font-mono);
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}
input[type="url"]::placeholder { color: var(--text-muted); }
input[type="url"]:hover { border-color: var(--border-strong); }
input[type="url"]:focus {
  outline: none; border-color: var(--accent);
  box-shadow: var(--focus-ring);
}
#analyze-btn { white-space: nowrap; }

/* categories as selectable pills */
.categories {
  margin: var(--space-3) 0 0; border: none; padding: 0;
  display: flex; gap: var(--space-1); flex-wrap: wrap; align-items: center;
}
.categories legend {
  color: var(--text-muted); font-size: var(--text-xs);
  font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em;
  padding: 0; margin-bottom: var(--space-1);
}
.check { position: relative; cursor: pointer; }
.check input {
  position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer;
}
.check span {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 10px 16px;
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  background: var(--bg-elevated); color: var(--text-secondary);
  font-size: var(--text-sm); font-weight: 500;
  transition: border-color var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}
.check:hover span { border-color: var(--border-strong); color: var(--text-primary); }
.check input:checked + span {
  border-color: var(--accent); color: var(--text-primary);
  background: var(--accent-soft); box-shadow: 0 0 12px rgba(99, 102, 241, 0.15);
}
.check input:focus-visible + span { box-shadow: var(--focus-ring); outline: none; }
.check .tag {
  font-family: var(--font-mono); font-size: 11px; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px;
}
.check input:checked + span .tag { color: var(--accent-2); border-color: rgba(139, 92, 246, 0.4); }

/* ---------- status / spinner ---------- */

.status { margin-top: var(--space-2); color: var(--text-secondary); font-size: var(--text-sm); min-height: 24px; }
.status.error { color: var(--danger); }

.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid var(--border-strong); border-top-color: var(--accent);
  border-radius: 50%; margin-right: 10px;
  animation: spin 0.8s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; border-top-color: var(--border-strong); }
}

/* ---------- verdict ---------- */

.verdict { margin-bottom: var(--space-3); display: flex; flex-wrap: wrap; gap: var(--space-1); align-items: center; }
.badge {
  display: inline-block; padding: 4px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  font-size: var(--text-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.badge.high { border-color: rgba(52, 211, 153, 0.4); color: var(--ok); background: var(--ok-soft); }
.badge.medium { border-color: rgba(245, 166, 35, 0.4); color: var(--warn); background: var(--warn-soft); }
.badge.low { border-color: rgba(248, 113, 113, 0.4); color: var(--danger); background: var(--danger-soft); }

/* ---------- findings ---------- */

#findings-body h3 {
  font-family: var(--font-display); font-weight: 700;
  font-size: var(--text-xl); line-height: 1.25; letter-spacing: -0.01em;
  margin: var(--space-4) 0 var(--space-2);
  padding-top: var(--space-3); border-top: 1px solid var(--border);
}
#findings-body h3:first-child { margin-top: 0; padding-top: 0; border-top: none; }
#findings-body h4 { font-size: var(--text-sm); margin: var(--space-2) 0 8px; color: var(--text-secondary); }

.meta { color: var(--text-secondary); font-size: var(--text-sm); margin: 8px 0; }
.meta span { display: inline-block; }

table {
  width: 100%; border-collapse: collapse;
  margin: var(--space-2) 0 var(--space-3); font-size: var(--text-sm);
  display: block; max-height: 480px; overflow: auto;
  border: 1px solid var(--border); border-radius: var(--radius-control);
}
thead, tbody { display: table; width: 100%; }
tr:first-child {
  position: sticky; top: 0; z-index: 1;
  background: var(--bg-elevated);
}
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
td { overflow-wrap: anywhere; }
tbody tr { transition: background var(--duration-fast) var(--ease-out); }
tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
tbody tr:last-child td { border-bottom: none; }
th {
  color: var(--text-muted); font-weight: 500; font-size: var(--text-xs);
  text-transform: uppercase; letter-spacing: 0.05em; font-family: var(--font-mono);
  white-space: nowrap;
}
td code, .bundle .src, .endpoints code {
  font-family: var(--font-mono); font-size: var(--text-xs);
}

.bundle {
  border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: var(--space-2) var(--space-3); margin-bottom: var(--space-1);
  background: var(--bg-elevated);
  transition: border-color var(--duration-fast) var(--ease-out);
}
.bundle:hover { border-color: var(--border-strong); }
.bundle .src { color: var(--text-primary); word-break: break-all; }
.bundle .meta { margin-top: 4px; }
.bundle .endpoints { margin-top: 8px; }
.bundle .endpoints code {
  display: inline-block; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 2px 8px; margin: 2px 6px 2px 0; color: var(--text-secondary);
}

.limitations, .unknowns { margin-top: var(--space-2); }
.limitations h3, .unknowns h3 { font-size: var(--text-sm); margin: var(--space-3) 0 8px; color: var(--warn); }
.unknowns h3 { color: var(--text-secondary); }
.limitations ul, .unknowns ul { margin: 0; padding-left: 20px; color: var(--text-secondary); font-size: var(--text-sm); }
.limitations li, .unknowns li { margin-bottom: 6px; }

.screenshot {
  display: block; max-width: 100%; height: auto;
  border: 1px solid var(--border); border-radius: var(--radius-card);
  margin: var(--space-2) 0;
}

/* ---------- history ---------- */

#history-heading { display: flex; align-items: center; justify-content: space-between; }
.link-btn {
  background: none; border: none; color: var(--text-muted);
  font: 400 var(--text-sm) var(--font-body); padding: 8px; cursor: pointer;
  border-radius: var(--radius-control); min-height: 44px;
  transition: color var(--duration-fast) var(--ease-out);
}
.link-btn:hover { color: var(--danger); }

.history { list-style: none; margin: 0; padding: 0; }
.history li { border-bottom: 1px solid var(--border); }
.history li:last-child { border-bottom: none; }
.history button {
  display: flex; justify-content: space-between; align-items: center; gap: var(--space-2);
  width: 100%; min-height: 44px;
  background: none; border: none; border-radius: var(--radius-control);
  color: var(--text-primary); text-align: left; cursor: pointer;
  padding: 10px 12px; font: 400 var(--text-sm) var(--font-body);
  transition: background var(--duration-fast) var(--ease-out);
}
.history button:hover { background: rgba(255, 255, 255, 0.04); }
.history .url {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--font-mono); font-size: var(--text-xs);
}
.history .meta { color: var(--text-muted); white-space: nowrap; font-size: var(--text-xs); }
.history .history-notice {
  border-bottom: none; color: var(--warn);
  font-size: var(--text-sm); padding: 12px; list-style: none;
}

/* ---------- footer ---------- */

.site-footer { border-top: 1px solid var(--border); margin-top: var(--space-8); }
.footer-inner {
  display: flex; justify-content: space-between; align-items: center; gap: var(--space-2);
  flex-wrap: wrap; padding-top: var(--space-4); padding-bottom: var(--space-5);
  color: var(--text-muted); font-size: var(--text-sm); max-width: 70ch;
}
.footer-inner p { margin: 0; }
.footer-links a {
  color: var(--text-secondary); text-decoration: none; font-weight: 500;
  transition: color var(--duration-fast) var(--ease-out);
}
.footer-links a:hover { color: var(--accent-2); }

/* ---------- focus ---------- */

a:focus-visible, button:focus-visible, input:focus-visible,
.history button:focus-visible, .link-btn:focus-visible {
  outline: none; box-shadow: var(--focus-ring);
}

/* ---------- scroll reveal ---------- */

.reveal { opacity: 0; transform: translateY(16px); }
.reveal.is-visible {
  opacity: 1; transform: none;
  transition: opacity var(--duration-base) var(--ease-out),
              transform var(--duration-base) var(--ease-out);
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---------- responsive ---------- */

@media (max-width: 768px) {
  .hero { padding: var(--space-8) 0; }
  .hero h1 { font-size: var(--text-4xl); }
  .tagline { display: none; }
  .site-nav { margin-left: auto; }
}

@media (max-width: 560px) {
  .form-row { flex-direction: column; }
  #analyze-btn { width: 100%; }
  .hero-ctas .btn { width: 100%; }
  .history button { flex-direction: column; align-items: flex-start; gap: 2px; }
  .card { padding: var(--space-3); }
}

@media (min-width: 1440px) {
  .hero h1 { font-size: 3.5rem; }
}
