/* Stadium View Dashboard -- cream-and-gold editorial aesthetic */

:root {
  /* Surfaces */
  --cream: #faf6ef;
  --cream-2: #f3ecde;
  --paper: #fffdf8;

  /* Ink */
  --ink: #1c1916;
  --ink-soft: #4a443c;
  --ink-muted: #7a7268;

  /* Accent (gold) */
  --gold: #b08842;
  --gold-soft: #d4b574;
  --gold-deep: #8a6628;

  /* Lines */
  --rule: #e8dfca;

  /* Status */
  --good: #5a7a4a;
  --warn: #b8651e;
  --crit: #a8362a;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--cream);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ============================================================
   LOADING + ERROR STATES
   ============================================================ */

#loading-state,
#error-state {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 64px 32px;
}

#loading-state .spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--rule);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 20px;
}

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

#loading-state p,
#error-state p {
  color: var(--ink-muted);
  font-size: 15px;
  margin: 0;
}

/* ============================================================
   COVER
   ============================================================ */

.cover {
  min-height: 56vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 72px 32px 56px;
  background: linear-gradient(180deg, var(--cream) 0%, var(--cream-2) 100%);
  position: relative;
  overflow: hidden;
}

.cover::before {
  content: '';
  position: absolute;
  top: -200px;
  right: -200px;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--gold-soft) 0%, transparent 70%);
  opacity: 0.15;
  pointer-events: none;
}

.cover-inner {
  max-width: 880px;
  margin: 0 auto;
  width: 100%;
}

.cover-eyebrow {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-deep);
  margin-bottom: 24px;
}

.cover-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 400;
  font-size: clamp(40px, 6vw, 72px);
  line-height: 1.05;
  margin: 0 0 20px;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.cover-title em {
  font-style: italic;
  color: var(--gold-deep);
  font-weight: 500;
}

.cover-sub {
  font-size: 18px;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 640px;
  font-weight: 300;
  margin: 0;
}

.cover-meta-row {
  max-width: 880px;
  margin: 40px auto 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  font-size: 12px;
  color: var(--ink-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-top: 1px solid var(--rule);
  padding-top: 20px;
  flex-wrap: wrap;
  gap: 8px;
}

/* ============================================================
   DEGRADED MODE BANNER
   ============================================================ */

.degraded-banner {
  background: #fff8d6;
  border-bottom: 2px solid #f0c000;
  padding: 14px 32px;
  font-size: 14px;
  color: #5a4700;
  display: none;
}

.degraded-banner.visible {
  display: block;
}

.degraded-banner strong {
  color: #3a2f00;
}

.degraded-banner-inner {
  max-width: 880px;
  margin: 0 auto;
}

/* ============================================================
   SECTIONS
   ============================================================ */

section {
  padding: 72px 0;
  border-top: 1px solid var(--rule);
  background: var(--paper);
}

section:nth-of-type(even) {
  background: var(--cream);
}

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-deep);
  margin-bottom: 16px;
}

h2 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 500;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.1;
  margin: 0 0 20px;
  letter-spacing: -0.01em;
  color: var(--ink);
}

h2 em {
  font-style: italic;
  color: var(--gold-deep);
  font-weight: 500;
}

.section-lead {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(18px, 2vw, 21px);
  line-height: 1.45;
  font-weight: 400;
  font-style: italic;
  color: var(--ink-soft);
  margin: -8px 0 32px;
  max-width: 720px;
  letter-spacing: 0.005em;
}

p { margin: 0 0 16px; color: var(--ink-soft); }
p:last-child { margin-bottom: 0; }
strong { color: var(--ink); font-weight: 600; }

/* ============================================================
   POSTURE SUMMARY SECTION
   ============================================================ */

.posture-summary-text {
  font-size: 18px;
  line-height: 1.65;
  color: var(--ink-soft);
  max-width: 680px;
  margin: 0 0 32px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin: 28px 0;
}

.stat {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 18px 20px;
}

.stat .label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 8px;
}

.stat .val {
  font-family: 'Cormorant Garamond', serif;
  font-size: 28px;
  font-weight: 500;
  line-height: 1.1;
  color: var(--ink);
}

.stat .note {
  font-size: 13px;
  color: var(--ink-muted);
  margin-top: 6px;
}

.stat.good .val { color: var(--good); }
.stat.warn .val { color: var(--warn); }
.stat.crit .val { color: var(--crit); }

.momentum-pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 100px;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink-muted);
  margin-bottom: 24px;
}

.momentum-pill.improving { background: #e8efe1; color: var(--good); border-color: #c8d9bc; }
.momentum-pill.declining { background: #f5dedb; color: var(--crit); border-color: #e8c2bf; }
.momentum-pill.steady { background: var(--cream-2); color: var(--ink-muted); }

/* ============================================================
   FINDINGS SECTION
   ============================================================ */

.findings-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.finding-item {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color 160ms ease;
}

.finding-item:hover {
  border-color: var(--gold-soft);
}

.finding-item.active {
  border-color: var(--gold);
}

.finding-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px;
  cursor: pointer;
  user-select: none;
}

.finding-category-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  margin-top: 2px;
}

.icon-missing-table,
.icon-dead-table { background: #f5dedb; color: var(--crit); }
.icon-dead-export { background: #fbebd8; color: var(--warn); }
.icon-unreachable-module { background: #fbebd8; color: var(--warn); }
.icon-low-coverage { background: #fbebd8; color: var(--warn); }
.icon-security-vuln { background: #f5dedb; color: var(--crit); }
.icon-stub-handler { background: var(--cream-2); color: var(--ink-muted); }

.finding-main {
  flex: 1;
  min-width: 0;
}

.finding-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 6px;
  line-height: 1.35;
}

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

.finding-location {
  font-size: 12px;
  color: var(--ink-muted);
  font-family: 'Inter', monospace;
  letter-spacing: 0.01em;
}

.confidence-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 100px;
}

.confidence-pill.high { background: #e8efe1; color: var(--good); }
.confidence-pill.needs-review { background: #fbebd8; color: var(--warn); }

.severity-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.severity-dot.high { background: var(--crit); }
.severity-dot.medium { background: var(--warn); }
.severity-dot.low { background: var(--gold-soft); }

.finding-rank {
  font-size: 11px;
  color: var(--ink-muted);
  font-weight: 600;
  white-space: nowrap;
  margin-top: 4px;
}

.finding-chevron {
  flex-shrink: 0;
  color: var(--ink-muted);
  font-size: 14px;
  margin-top: 6px;
  transition: transform 200ms ease;
}

.finding-item.active .finding-chevron {
  transform: rotate(90deg);
}

.finding-detail {
  display: none;
  padding: 0 20px 20px 66px;
  border-top: 1px solid var(--rule);
}

.finding-item.active .finding-detail {
  display: block;
}

.finding-why {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 16px 0 20px;
}

.walkthrough-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-deep);
  margin-bottom: 10px;
}

.walkthrough-steps {
  margin: 0 0 16px;
  padding-left: 20px;
}

.walkthrough-steps li {
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 6px;
  line-height: 1.5;
}

.prompt-block {
  background: var(--cream-2);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--gold);
  border-radius: 4px;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-soft);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'Inter', sans-serif;
  position: relative;
}

.prompt-block-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-deep);
  margin-bottom: 10px;
}

.copy-prompt-btn {
  display: inline-block;
  margin-top: 12px;
  padding: 7px 16px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-deep);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
  font-family: 'Inter', sans-serif;
}

.copy-prompt-btn:hover {
  background: var(--cream-2);
  border-color: var(--gold-soft);
}

.copy-prompt-btn.copied {
  color: var(--good);
  border-color: #c8d9bc;
}

/* expand toggle */
.expand-toggle {
  text-align: center;
  padding: 24px 0 8px;
}

.expand-btn {
  background: none;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 10px 24px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: border-color 160ms ease, color 160ms ease;
}

.expand-btn:hover {
  border-color: var(--gold-soft);
  color: var(--gold-deep);
}

/* ============================================================
   COMMIT TIMELINE SECTION
   ============================================================ */

.timeline-wrapper {
  overflow-x: auto;
  padding-bottom: 8px;
}

.timeline-track {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-width: max-content;
  padding: 16px 0 8px;
}

.timeline-entry {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 44px;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid transparent;
  flex-shrink: 0;
}

.timeline-dot.good { background: var(--good); }
.timeline-dot.warn { background: var(--warn); }
.timeline-dot.crit { background: var(--crit); }

.timeline-dot.delta-up { border-color: rgba(90, 122, 74, 0.4); }
.timeline-dot.delta-down { border-color: rgba(168, 54, 42, 0.4); }

.timeline-bar {
  width: 12px;
  border-radius: 2px 2px 0 0;
  background: var(--rule);
  min-height: 4px;
  transition: background 200ms ease;
}

.timeline-bar.good { background: var(--good); opacity: 0.7; }
.timeline-bar.warn { background: var(--warn); opacity: 0.7; }
.timeline-bar.crit { background: var(--crit); opacity: 0.7; }

.timeline-sha {
  font-size: 10px;
  color: var(--ink-muted);
  font-family: 'Inter', monospace;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transform: rotate(-45deg);
  transform-origin: top center;
  margin-top: 4px;
}

.timeline-date {
  font-size: 10px;
  color: var(--ink-muted);
  white-space: nowrap;
}

.timeline-score-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0;
  font-size: 13px;
  color: var(--ink-muted);
}

.timeline-score-badge {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 500;
  color: var(--ink);
}

/* ============================================================
   FOOTER
   ============================================================ */

footer {
  padding: 32px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-muted);
  letter-spacing: 0.05em;
  background: var(--cream);
  border-top: 1px solid var(--rule);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 640px) {
  .wrap { padding: 0 20px; }
  .cover { padding: 48px 20px 40px; }
  .cover-meta-row { flex-direction: column; align-items: flex-start; }
  section { padding: 48px 0; }
  .finding-detail { padding-left: 20px; }
  .status-grid { grid-template-columns: 1fr 1fr; }
}
