/* ============================================================
   Jarvis Ranks — Shared Brand System
   Sibling product to Jarvis Answers. Dark, technical, optimistic.
   ============================================================ */

:root {
  /* Surfaces */
  --bg-deep:        #0a0e1a;   /* page background */
  --bg-surface:     #131826;   /* cards */
  --bg-elevated:    #1a2030;   /* elevated cards, hover */
  --bg-input:       #0f1422;

  /* Lines & borders */
  --border:         #1f2740;
  --border-strong:  #2a3454;

  /* Text */
  --text:           #f1f5fb;
  --text-muted:     #94a3b8;
  --text-faint:     #5d6a85;

  /* Brand accents */
  --brand:          #4ade80;   /* growth green — primary accent */
  --brand-strong:   #22c55e;
  --brand-soft:     rgba(74, 222, 128, 0.12);

  /* Grade scale colors (report card) */
  --grade-a:        #22c55e;   /* 90-100  green */
  --grade-b:        #84cc16;   /* 80-89   lime */
  --grade-c:        #facc15;   /* 70-79   yellow */
  --grade-d:        #fb923c;   /* 60-69   orange */
  --grade-f:        #ef4444;   /* <60     red */

  /* Highlights */
  --accent-gold:    #fbbf24;
  --accent-cyan:    #22d3ee;

  /* Spacing & radius */
  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 22px;

  /* Shadows */
  --shadow-card:   0 1px 0 rgba(255,255,255,0.04) inset, 0 8px 30px rgba(0,0,0,0.4);
  --shadow-pop:    0 20px 60px rgba(0,0,0,0.55);

  /* Type */
  --font-display: 'Space Grotesk', 'Inter', system-ui, -apple-system, sans-serif;
  --font-body:    'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ----------------- Base ----------------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}
h1 { font-size: clamp(2.4rem, 5vw, 4rem); line-height: 1.05; }
h2 { font-size: clamp(1.8rem, 3vw, 2.6rem); line-height: 1.15; }
h3 { font-size: 1.25rem; line-height: 1.25; }

p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-strong); }

/* ----------------- Wordmark ----------------- */
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--text);
}
.wordmark-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand) 0%, #16a34a 100%);
  display: grid; place-items: center;
  color: #07140b;
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 6px 18px rgba(34,197,94,0.35);
}

/* ----------------- Buttons ----------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.98rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, background .2s ease, border .2s ease;
  text-decoration: none;
}
.btn-primary {
  background: var(--brand);
  color: #07140b;
}
.btn-primary:hover { background: var(--brand-strong); transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--bg-elevated); }

/* ----------------- Cards ----------------- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

/* ----------------- Grade Badges ----------------- */
.grade {
  display: inline-grid;
  place-items: center;
  width: 86px; height: 86px;
  border-radius: 24px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 3rem;
  line-height: 1;
  color: #0a0e1a;
  letter-spacing: -0.04em;
  position: relative;
  box-shadow: 0 12px 35px rgba(0,0,0,0.5), inset 0 0 0 2px rgba(255,255,255,0.1);
}
.grade.lg { width: 120px; height: 120px; font-size: 4.2rem; border-radius: 30px; }
.grade.sm { width: 52px; height: 52px; font-size: 1.6rem; border-radius: 14px; }

.grade-a { background: var(--grade-a); }
.grade-b { background: var(--grade-b); }
.grade-c { background: var(--grade-c); }
.grade-d { background: var(--grade-d); color: #1a0e02; }
.grade-f { background: var(--grade-f); color: #fff; }

/* Score donut (lighthouse-style) */
.score-donut {
  --pct: 0;
  --color: var(--brand);
  width: 70px; height: 70px;
  border-radius: 50%;
  background:
    radial-gradient(closest-side, var(--bg-surface) 65%, transparent 66%),
    conic-gradient(var(--color) calc(var(--pct) * 1%), rgba(255,255,255,0.06) 0);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text);
  font-size: 1.1rem;
}

/* ----------------- Tags ----------------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.tag-warn { background: rgba(251, 191, 36, 0.12); color: var(--accent-gold); }
.tag-bad  { background: rgba(239, 68, 68, 0.12);  color: var(--grade-f); }
.tag-info { background: rgba(34, 211, 238, 0.10); color: var(--accent-cyan); }

/* ----------------- Layout ----------------- */
.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}
.muted { color: var(--text-muted); }
.eyebrow {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--brand);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* ----------------- Findings list ----------------- */
.finding {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.finding:last-child { border-bottom: none; }
.finding-icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
}
.finding-icon.good { background: rgba(34,197,94,0.15); color: var(--grade-a); }
.finding-icon.warn { background: rgba(251,191,36,0.15); color: var(--accent-gold); }
.finding-icon.bad  { background: rgba(239,68,68,0.15);  color: var(--grade-f); }
.finding-title { font-weight: 600; }
.finding-desc  { color: var(--text-muted); font-size: 0.92rem; margin-top: 2px; }

/* ============================================================
   REPORT CARD LAYOUT
   ============================================================ */
.report { display: flex; flex-direction: column; gap: 24px; }

.report-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: flex-start;
  padding: 32px;
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-deep) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.report-title { font-size: clamp(1.8rem, 3vw, 2.4rem); margin-top: 6px; }
.report-subtitle { margin-top: 8px; max-width: 540px; }
.report-url { margin-top: 12px; font-size: 0.92rem; word-break: break-all; }
.report-grade {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.grade-score {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--text);
}
.grade-score span { color: var(--text-muted); font-size: 1rem; font-weight: 500; }

/* Category grid */
.report-categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 18px;
}
.category-card { padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.category-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.category-name { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; }
.category-desc { font-size: 0.85rem; margin-top: 4px; }
.category-meta {
  display: flex;
  align-items: center;
  gap: 14px;
}
.score-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-input);
  border-radius: 999px;
  overflow: hidden;
}
.score-fill { height: 100%; border-radius: 999px; transition: width .8s ease; }
.score-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  min-width: 70px;
  text-align: right;
}
.score-num span { color: var(--text-faint); font-size: 0.85rem; font-weight: 500; }

.findings { display: flex; flex-direction: column; }

/* Recommendations */
.rec-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.rec-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: flex-start;
}
.rec-num {
  width: 32px; height: 32px;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 10px;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
}
.rec-title { font-weight: 600; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.rec-desc { font-size: 0.92rem; margin-top: 4px; }

.report-footer {
  text-align: center;
  font-size: 0.85rem;
  padding: 16px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   BEFORE / AFTER COMPARISON
   ============================================================ */
.delta-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 22px;
  border-radius: var(--radius);
  background: var(--brand-soft);
  border: 1px solid rgba(74, 222, 128, 0.3);
}
.delta-num {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--brand);
  line-height: 1;
}
.delta-label { color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; }

.compare-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 32px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.compare-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.compare-label {
  font-family: var(--font-display);
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.compare-score {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2rem;
}
.compare-score span { color: var(--text-muted); font-size: 1rem; font-weight: 500; }
.compare-url { font-size: 0.85rem; word-break: break-all; max-width: 280px; }
.compare-arrow {
  font-size: 2rem;
  color: var(--brand);
  font-weight: 600;
}

.compare-categories { padding: 28px; }
.compare-row {
  display: grid;
  grid-template-columns: 200px 1fr 60px;
  gap: 18px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.compare-row:last-child { border-bottom: none; }
.compare-row-name { font-family: var(--font-display); font-weight: 600; font-size: 0.95rem; }
.compare-row-bar { display: flex; flex-direction: column; gap: 6px; }
.bar {
  position: relative;
  height: 14px;
  background: var(--bg-input);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill { height: 100%; border-radius: 999px; transition: width .8s ease; }
.bar span {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text);
  text-shadow: 0 0 4px rgba(0,0,0,0.5);
}
.compare-row-delta {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  text-align: right;
}
.compare-row-delta.pos { color: var(--brand); }
.compare-row-delta.neg { color: var(--grade-f); }

@media (max-width: 720px) {
  .report-header { grid-template-columns: 1fr; }
  .compare-grid { grid-template-columns: 1fr; }
  .compare-arrow { transform: rotate(90deg); }
  .compare-row { grid-template-columns: 1fr; gap: 8px; }
  .compare-row-delta { text-align: left; }
}

/* ----------------- Print (PDF-style) ----------------- */
@media print {
  body { background: #fff; color: #0a0e1a; }
  .card { background: #fff; border-color: #e5e7eb; box-shadow: none; }
  .no-print { display: none !important; }
  a { color: #0a0e1a; }
  .grade { box-shadow: none; }
  .muted { color: #4b5563; }
}
