/* style.css — AI Voice Intelligence dashboard */

:root,
[data-theme='light'] {
  /* Surfaces */
  --color-bg: #f4f6f7;
  --color-surface: #ffffff;
  --color-surface-2: #fbfcfd;
  --color-surface-offset: #eceff1;
  --color-surface-offset-2: #e3e7ea;
  --color-divider: #dde2e5;
  --color-border: #cfd6da;

  /* Text */
  --color-text: #10171c;
  --color-text-muted: #5a6770;
  --color-text-faint: #97a3aa;
  --color-text-inverse: #f4f6f7;

  /* Primary accent — Hydra Cyan (brand: Predrag Petrovic) */
  --color-primary: #0e8a8f;
  --color-primary-hover: #0a6d71;
  --color-primary-active: #08575a;
  --color-primary-highlight: #d3ebe9;

  /* Semantic */
  --color-success: #3f8a4c;
  --color-success-highlight: #d9ecd9;
  --color-warning: #b1740f;
  --color-warning-highlight: #f0e2c6;
  --color-error: #b23b52;
  --color-error-highlight: #f0d7dd;

  /* Chart series (competitors + categories) */
  --chart-1: #0e8a8f; /* Predrag — teal */
  --chart-2: #a855c9; /* violet */
  --chart-3: #d99a2b; /* amber */
  --chart-4: #4d7ea8; /* slate blue */
  --chart-5: #c2564f; /* brick */
  --chart-6: #6b7280; /* neutral gray */

  --radius-sm: 0.375rem;
  --radius-md: 0.625rem;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;
  --radius-full: 9999px;

  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  --shadow-sm: 0 1px 2px oklch(0.2 0.02 200 / 0.06);
  --shadow-md: 0 4px 16px oklch(0.2 0.02 200 / 0.08);
  --shadow-lg: 0 16px 40px oklch(0.2 0.02 200 / 0.14);

  --content-default: 1180px;

  --font-display: 'JetBrains Mono', 'Courier New', monospace;
  --font-body: 'Inter', 'Helvetica Neue', sans-serif;
}

[data-theme='dark'] {
  --color-bg: #0a0f12;
  --color-surface: #10171b;
  --color-surface-2: #141c20;
  --color-surface-offset: #182126;
  --color-surface-offset-2: #1e282e;
  --color-divider: #223037;
  --color-border: #2a3a42;

  --color-text: #dfe7ea;
  --color-text-muted: #8a9aa1;
  --color-text-faint: #56676e;
  --color-text-inverse: #0a0f12;

  --color-primary: #3ddbd0;
  --color-primary-hover: #6be6dd;
  --color-primary-active: #8feee7;
  --color-primary-highlight: #16332f;

  --color-success: #74c584;
  --color-success-highlight: #1c3324;
  --color-warning: #e0af52;
  --color-warning-highlight: #3a2f1a;
  --color-error: #e17a8d;
  --color-error-highlight: #3a222a;

  --chart-1: #3ddbd0;
  --chart-2: #c98adf;
  --chart-3: #f0c064;
  --chart-4: #7fa8d6;
  --chart-5: #e08a83;
  --chart-6: #9aa5ab;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.3);
  --shadow-md: 0 4px 16px oklch(0 0 0 / 0.4);
  --shadow-lg: 0 16px 40px oklch(0 0 0 / 0.5);
}

:root {
  --text-xs: clamp(0.75rem, 0.72rem + 0.15vw, 0.8125rem);
  --text-sm: clamp(0.875rem, 0.83rem + 0.2vw, 0.9375rem);
  --text-base: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  --text-lg: clamp(1.125rem, 1.05rem + 0.4vw, 1.375rem);
  --text-xl: clamp(1.375rem, 1.2rem + 0.9vw, 1.875rem);
  --text-2xl: clamp(1.75rem, 1.3rem + 2vw, 2.75rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
}

/* ---------- Layout shell ---------- */

.wrap {
  max-width: var(--content-default);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

header.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in oklab, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-divider);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-4);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.brand-mark {
  width: 34px;
  height: 34px;
  color: var(--color-primary);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.brand-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  white-space: nowrap;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  background: var(--color-success);
  box-shadow: 0 0 0 3px var(--color-success-highlight);
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}
.theme-toggle:hover {
  color: var(--color-text);
  border-color: var(--color-primary);
}

main {
  padding-block: var(--space-10) var(--space-24);
}

section {
  padding-block: var(--space-10);
}
section + section {
  border-top: 1px solid var(--color-divider);
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.eyebrow {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: var(--space-2);
  display: block;
}

h1 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.01em;
}

h2 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
}

h3 {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-weight: 600;
}

.lede {
  color: var(--color-text-muted);
  font-size: var(--text-base);
  max-width: 62ch;
}

/* ---------- Hero ---------- */

.hero {
  display: grid;
  gap: var(--space-8);
  padding-block: var(--space-8) var(--space-4);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

/* ---------- KPI grid ---------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

@media (max-width: 900px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 520px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

.kpi-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.kpi-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
}

.kpi-value {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--color-text);
}

.kpi-value.accent {
  color: var(--color-primary);
}

.kpi-delta {
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

/* ---------- Cards / panels ---------- */

.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: var(--space-6);
}
@media (max-width: 900px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.chart-box {
  position: relative;
  height: 340px;
}
.chart-box.small {
  height: 260px;
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
  margin-top: var(--space-5);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

/* ---------- Category cards ---------- */

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-5);
}

.category-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.category-card h3 {
  font-size: var(--text-base);
  font-weight: 600;
}

.category-empty {
  border-style: dashed;
  border-color: var(--color-warning);
}

.share-bar-track {
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-surface-offset);
  overflow: hidden;
  display: flex;
}
.share-bar-seg {
  height: 100%;
}

.entity-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.entity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-sm);
}
.entity-name {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.entity-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.entity-pct {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}
.category-note {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  border-top: 1px solid var(--color-divider);
  padding-top: var(--space-3);
}

/* ---------- Table ---------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

table {
  min-width: 720px;
}

th,
td {
  text-align: left;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-divider);
  font-size: var(--text-sm);
  vertical-align: top;
}

th {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  background: var(--color-surface-offset);
}

tr:last-child td {
  border-bottom: none;
}

td a {
  color: var(--color-primary);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in oklab, var(--color-primary) 40%, transparent);
}
td a:hover {
  color: var(--color-primary-hover);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-family: var(--font-display);
  padding: 0.15rem var(--space-2);
  border-radius: var(--radius-full);
}
.pill-third-party {
  background: var(--color-success-highlight);
  color: var(--color-success);
}
.pill-self-published {
  background: var(--color-warning-highlight);
  color: var(--color-warning);
}
.pill-owned-property {
  background: var(--color-primary-highlight);
  color: var(--color-primary);
}

/* ---------- Insight list ---------- */

.insight-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
.insight-item {
  display: grid;
  grid-template-columns: 2.25rem 1fr;
  gap: var(--space-4);
}
.insight-num {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  color: var(--color-primary);
  font-weight: 700;
}
.insight-item p {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}
.insight-item h4 {
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: var(--space-1);
}

/* ---------- Alert stream ---------- */

.alert-stream {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.alert-row {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-surface-offset);
  border: 1px solid var(--color-divider);
}
.alert-row .dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  margin-top: 0.4rem;
  flex-shrink: 0;
  background: var(--color-text-faint);
}
.alert-row.baseline .dot {
  background: var(--color-primary);
}
.alert-meta {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: var(--space-1);
}

footer {
  border-top: 1px solid var(--color-divider);
  padding-block: var(--space-10);
  color: var(--color-text-faint);
  font-size: var(--text-xs);
}
