/* ═══════════════════════════════════════════════════════════════════════════════
   SaaS AI Citation Index — DataDab-Inspired Report Styles
   Design system aligned with datadab.com: warm editorial, serif display, bronze accents
   ═══════════════════════════════════════════════════════════════════════════════ */

:root {
  /* DataDab-inspired color palette */
  --color-ivory: #FDFBF7;
  --color-sand: #F5F1E8;
  --color-warm-gray: #D4CFC4;
  --color-charcoal: #2C2C2C;
  --color-deep-navy: #1A2332;
  --color-forest: #2F4538;
  --color-sage: #7B9B85;
  --color-bronze: #B8956A;
  --color-rust: #A85C49;
  --color-cream: #FAF8F3;

  /* Functional aliases */
  --blue: var(--color-bronze);
  --green: var(--color-forest);
  --yellow: var(--color-bronze);
  --red: var(--color-rust);
  --gray-50: var(--color-ivory);
  --gray-100: var(--color-sand);
  --gray-200: var(--color-warm-gray);
  --gray-400: #8A8478;
  --gray-600: var(--color-charcoal);
  --gray-800: #1A1A1A;
  --white: #FFFFFF;

  /* Typography */
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-accent: 'Instrument Serif', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 4rem;
  --space-xl: 6rem;
  --space-2xl: 8rem;

  /* Transitions */
  --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--color-ivory);
  color: var(--color-charcoal);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle noise texture overlay — matches DataDab */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  opacity: 0.03;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='4' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  z-index: 9999;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 3rem; }

/* ─── Header ─── */
.header {
  background: linear-gradient(145deg, var(--color-deep-navy) 0%, var(--color-forest) 100%);
  color: var(--color-ivory);
  padding: 6rem 0 5rem;
  position: relative;
  overflow: hidden;
}
.header::before {
  content: '';
  position: absolute;
  top: -50%; right: -20%;
  width: 80%; height: 150%;
  background: radial-gradient(circle, rgba(184,149,106,0.1) 0%, transparent 70%);
  animation: headerFloat 20s ease-in-out infinite;
}
@keyframes headerFloat {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(30px, -30px) rotate(2deg); }
  66% { transform: translate(-20px, 20px) rotate(-2deg); }
}
.header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 100%; height: 1px;
  background: linear-gradient(to right, transparent, rgba(184,149,106,0.3), transparent);
}

.pre-head {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-sage);
  margin-bottom: 1.5rem;
  opacity: 0.9;
  position: relative;
  z-index: 1;
}

.header h1 {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 500;
  line-height: 1.1;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
  position: relative;
  z-index: 1;
}

.header .subtitle {
  font-family: var(--font-accent);
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1.4;
  margin-bottom: 0.5rem;
  opacity: 0.9;
  position: relative;
  z-index: 1;
}

.subtitle-detail {
  font-size: 1rem;
  opacity: 0.7;
  max-width: 800px;
  line-height: 1.8;
  margin-bottom: 2rem;
  position: relative;
  z-index: 1;
}

.header .meta {
  display: flex;
  gap: 16px;
  font-size: 0.85rem;
  flex-wrap: wrap;
  align-items: center;
  position: relative;
  z-index: 1;
}

.badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 2px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}
.badge-blue { background: rgba(184,149,106,0.15); color: #D4B483; }
.badge-green { background: rgba(123,155,133,0.2); color: #A8C5B0; }
.badge-placeholder { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.6); }

/* ─── Navigation ─── */
.nav {
  background: rgba(253,251,247,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(212,207,196,0.3);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0;
}
.nav-inner {
  display: flex;
  gap: 0;
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.nav-inner::-webkit-scrollbar { display: none; }
.nav a {
  padding: 1.1rem 1.25rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--color-charcoal);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.3s var(--transition-smooth);
  opacity: 0.7;
}
.nav a:hover {
  opacity: 1;
  color: var(--color-bronze);
  border-bottom-color: var(--color-bronze);
}
.nav a.active {
  opacity: 1;
  color: var(--color-deep-navy);
  border-bottom-color: var(--color-bronze);
  font-weight: 600;
}

/* ─── Sections ─── */
.section {
  padding: 5rem 0;
  border-bottom: 1px solid rgba(212,207,196,0.3);
}
.section:last-of-type { border-bottom: none; }

.section-title {
  font-family: var(--font-display);
  font-size: 2.75rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--color-deep-navy);
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

.section-desc {
  font-size: 1.05rem;
  color: var(--color-charcoal);
  opacity: 0.75;
  margin-bottom: 2.5rem;
  max-width: 700px;
  line-height: 1.8;
}

/* ─── Cards ─── */
.card {
  background: var(--white);
  border-radius: 4px;
  border: 1px solid rgba(212,207,196,0.3);
  padding: 2rem;
  margin-bottom: 1.5rem;
  transition: all 0.4s var(--transition-smooth);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 0;
  background: var(--color-bronze);
  transition: height 0.4s var(--transition-smooth);
}
.card:hover {
  box-shadow: 0 12px 40px rgba(0,0,0,0.06);
  transform: translateY(-2px);
}
.card:hover::before { height: 100%; }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 12px;
}
.card-title {
  font-family: var(--font-accent);
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--color-deep-navy);
}

/* ─── Stat Boxes ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}
.stat-box {
  background: var(--white);
  border-radius: 4px;
  border: 1px solid rgba(212,207,196,0.3);
  padding: 1.5rem;
  text-align: center;
  transition: all 0.3s var(--transition-smooth);
}
.stat-box:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  transform: translateY(-3px);
}
.stat-value {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--color-bronze);
  line-height: 1;
  margin-bottom: 0.5rem;
}
.stat-label {
  font-size: 0.82rem;
  color: var(--color-charcoal);
  opacity: 0.7;
  line-height: 1.4;
}

/* ─── Tables ─── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th {
  background: var(--color-sand);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-charcoal);
  opacity: 0.7;
  border-bottom: 2px solid rgba(212,207,196,0.5);
}
td {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(212,207,196,0.2);
  color: var(--color-charcoal);
}
tr:hover { background: rgba(245,241,232,0.3); }
.rank-cell { font-weight: 700; color: var(--color-bronze); width: 50px; }
.grade-cell { font-weight: 700; min-width: 40px; text-align: center; }

/* Grade colors — DataDab palette */
.grade-A\+ { color: var(--color-forest); }
.grade-A { color: var(--color-forest); }
.grade-B\+ { color: var(--color-deep-navy); }
.grade-B { color: #4A6FA5; }
.grade-C\+ { color: var(--color-bronze); }
.grade-C { color: var(--color-rust); }
.grade-D { color: #C0392B; }

/* Score bar */
.score-bar {
  height: 6px;
  background: var(--color-sand);
  border-radius: 2px;
  overflow: hidden;
  width: 80px;
  display: inline-block;
  vertical-align: middle;
}
.score-bar-fill { height: 100%; border-radius: 2px; transition: width 0.5s ease; }
.score-bar-fill.high { background: var(--color-forest); }
.score-bar-fill.mid { background: var(--color-bronze); }
.score-bar-fill.low { background: var(--color-rust); }

/* ─── Chart Container ─── */
.chart-container {
  background: var(--white);
  border-radius: 4px;
  border: 1px solid rgba(212,207,196,0.3);
  padding: 2rem;
  margin-bottom: 1rem;
  position: relative;
}
.chart-container canvas { width: 100% !important; }

/* ─── Notice Banner ─── */
.notice {
  background: var(--color-sand);
  border: none;
  border-left: 4px solid var(--color-bronze);
  border-radius: 0 4px 4px 0;
  padding: 1rem 1.5rem;
  margin-bottom: 2rem;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.notice-icon { font-size: 1.2rem; flex-shrink: 0; }
.notice p { font-size: 0.9rem; color: var(--color-charcoal); opacity: 0.8; }
.notice strong { color: var(--color-deep-navy); }

/* ─── Findings Grid ─── */
.findings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}
.finding-card { position: relative; }
.finding-number {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 600;
  color: rgba(212,207,196,0.4);
  line-height: 1;
  margin-bottom: 0.5rem;
}
.finding-card h3 {
  font-family: var(--font-accent);
  font-size: 1.3rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
  line-height: 1.35;
  color: var(--color-deep-navy);
}
.finding-card p {
  color: var(--color-charcoal);
  opacity: 0.8;
  line-height: 1.75;
  font-size: 0.92rem;
}
.finding-implication {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  background: var(--color-sand);
  border-left: 3px solid var(--color-bronze);
  border-radius: 0 4px 4px 0;
  font-size: 0.88rem !important;
  color: var(--color-charcoal) !important;
  opacity: 0.9 !important;
}

/* ─── Finding Stats ─── */
.finding-stat {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
  margin: 1rem 0;
  padding: 1rem 1.25rem;
  background: var(--color-sand);
  border-radius: 4px;
}
.finding-stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-400);
}
.finding-stat-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--color-bronze);
  margin-left: 6px;
}

/* ─── Clean Table (Methodology) ─── */
.clean-table { width: 100%; border-collapse: collapse; }
.clean-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(212,207,196,0.2);
  font-size: 0.9rem;
  line-height: 1.7;
}
.clean-table tr:last-child td { border-bottom: none; }
.clean-table td:first-child { white-space: nowrap; color: var(--color-charcoal); opacity: 0.7; }

/* ─── Methodology Grid ─── */
.methodology-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}
.method-card {
  background: var(--white);
  border-radius: 4px;
  border: 1px solid rgba(212,207,196,0.3);
  padding: 1.5rem;
  transition: all 0.3s var(--transition-smooth);
}
.method-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  transform: translateY(-2px);
}
.method-card h4 {
  font-family: var(--font-accent);
  font-size: 1.15rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--color-deep-navy);
}
.method-card .weight {
  font-size: 0.78rem;
  color: var(--color-bronze);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}
.method-card p { font-size: 0.9rem; opacity: 0.75; line-height: 1.7; }

/* ─── Footer ─── */
.footer {
  background: var(--color-deep-navy);
  color: var(--color-ivory);
  padding: 4rem 0 2rem;
  margin-top: 3rem;
  position: relative;
}
.footer::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23FDFBF7' fill-opacity='0.015'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.footer a {
  color: #D4B483;
  text-decoration: none;
  transition: all 0.3s var(--transition-smooth);
}
.footer a:hover { color: var(--color-bronze); padding-left: 4px; }
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3rem;
  position: relative;
}
.footer h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  margin-bottom: 1rem;
}
.footer h4 {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-bronze);
  margin-bottom: 1rem;
}
.footer p { opacity: 0.6; font-size: 0.9rem; line-height: 1.7; }

/* ─── Responsive ─── */
@media (max-width: 1024px) {
  .container { padding: 0 2rem; }
  .header h1 { font-size: 2.75rem; }
  .section-title { font-size: 2.25rem; }
  .findings-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .container { padding: 0 1.5rem; }
  .header { padding: 4rem 0 3rem; }
  .header h1 { font-size: 2.25rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .findings-grid { grid-template-columns: 1fr; }
  .finding-stat { flex-direction: column; gap: 8px; }
  .finding-stat-label { margin-left: 0 !important; }
  .methodology-grid { grid-template-columns: 1fr; }
  .nav a { padding: 0.9rem 1rem; font-size: 0.82rem; }
  .section { padding: 3rem 0; }
  .section-title { font-size: 1.85rem; }
  .footer-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .header h1 { font-size: 1.85rem; }
  .stat-value { font-size: 2rem; }
  .section-title { font-size: 1.5rem; }
}

/* ─── Loading & Utility ─── */
.loading { text-align: center; padding: 3rem; color: var(--gray-400); }
.loading-spinner {
  display: inline-block;
  width: 32px; height: 32px;
  border: 3px solid var(--color-sand);
  border-top-color: var(--color-bronze);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Fade-in Animation ─── */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s var(--transition-smooth);
}
.fade-in.visible { opacity: 1; transform: translateY(0); }

/* ─── Select Dropdowns ─── */
select {
  padding: 8px 14px;
  border: 1px solid rgba(212,207,196,0.5);
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  background: var(--white);
  color: var(--color-charcoal);
  cursor: pointer;
  transition: border-color 0.2s;
}
select:hover { border-color: var(--color-bronze); }
select:focus { outline: none; border-color: var(--color-bronze); }

/* ─── Ordered Lists (Methodology) ─── */
ol { line-height: 2.2; }
ol li { color: var(--color-charcoal); opacity: 0.85; }
ol strong { opacity: 1; color: var(--color-deep-navy); }

/* ─── Code ─── */
code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--color-sand);
  padding: 2px 6px;
  border-radius: 2px;
  color: var(--color-rust);
}

/* ─── Links ─── */
a { color: var(--color-bronze); text-decoration: none; transition: all 0.2s; }
a:hover { color: var(--color-rust); }