/* portal/css/executive.css
 * =========================================================================
 * Styles for the Executive Summary page (Kyle Robbins C-level view).
 * Inherits typography + palette from seo-analytics.html (navy/gold/cream),
 * but uses larger metric typography and a more formal, print-friendly layout.
 * ========================================================================= */

:root {
  --gold:       #c5a059;
  --gold-dk:    #a68548;
  --navy:       #002846;
  --navy-dk:    #001a2e;
  --cream:      #0d1b2a;
  --dark:       #1a1a1a;
  --muted:      #666;
  --border:     #e5ded5;
  --row-alt:    #faf7f2;

  --green:      #1e7a3a;
  --green-bg:   #e8f5ec;
  --green-soft: #d4ebd9;

  --red:        #c0392b;
  --red-bg:     #fdecea;
  --red-soft:   #f5c9c3;

  --ch-gbp:     #10b981;
  --ch-organic: #2563eb;
  --ch-direct:  #6b7280;
  --ch-social:  #8b5cf6;
  --ch-other:   #d1d5db;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Helvetica, Arial, sans-serif;
  background: var(--cream);
  color: #e2e8f0;
  line-height: 1.55;
}

/* -----------------------------------------------------------------
 * Header (mirrors seo-analytics)
 * ----------------------------------------------------------------- */
header.site {
  background: var(--navy);
  color: white;
  padding: 1.25rem 2rem;
  border-bottom: 3px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
header.site h1 {
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 1.4rem;
  margin: 0;
  letter-spacing: 0.5px;
}
header.site .subtitle {
  color: #cfd6df;
  font-size: 0.85rem;
  margin-top: 2px;
}
header.site .meta {
  font-size: 0.78rem;
  color: #cfd6df;
  text-align: right;
}
header.site .meta strong { color: white; }

/* -----------------------------------------------------------------
 * Nav between portal sections
 * ----------------------------------------------------------------- */
nav.section-nav {
  background: #091523;
  border-bottom: 1px solid rgba(197,160,89,0.2);
  padding: 0.6rem 2rem;
  display: flex;
  gap: 1.25rem;
  font-size: 0.88rem;
}
nav.section-nav a {
  color: #7a9ab5;
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border-bottom: 2px solid transparent;
  font-weight: 600;
  transition: color 0.15s, border-color 0.15s;
}
nav.section-nav a:hover { color: #e2e8f0; }
nav.section-nav a.active {
  color: #e2e8f0;
  border-bottom-color: var(--gold);
}

/* -----------------------------------------------------------------
 * Layout
 * ----------------------------------------------------------------- */
main {
  max-width: 1200px;
  margin: 1.5rem auto;
  padding: 0 1.25rem 3rem;
}

.page-title {
  font-family: Georgia, serif;
  color: #e2e8f0;
  font-size: 2rem;
  margin: 0 0 0.25rem;
  letter-spacing: 0.3px;
}
.page-lede {
  color: #7a9ab5;
  font-size: 0.98rem;
  margin-bottom: 1.5rem;
}

section.exec-section {
  margin-bottom: 2.5rem;
}
section.exec-section > h2 {
  font-family: Georgia, serif;
  color: #e2e8f0;
  font-size: 1.35rem;
  margin: 0 0 0.25rem;
  letter-spacing: 0.2px;
}
section.exec-section .section-lede,
p.data-date {
  color: #7a9ab5;
  font-size: 0.88rem;
  margin: 0 0 1rem;
}

/* -----------------------------------------------------------------
 * Section 1 -- Metric cards
 * ----------------------------------------------------------------- */
.metric-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.1rem;
  margin-bottom: 1.25rem;
}
.metric-card {
  background: white;
  border: 1px solid var(--border);
  border-top: 3px solid var(--gold);
  color: var(--dark);
  border-radius: 6px;
  padding: 1.25rem 1.25rem 1.1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.06);
}
.metric-card.primary {
  border-top-color: var(--navy);
  background: linear-gradient(180deg, #ffffff 0%, #fbf8f3 100%);
}
.metric-card .metric-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  font-weight: 600;
}
.metric-card .metric-value {
  font-family: Georgia, serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.05;
}
.metric-card.primary .metric-value {
  font-size: 2.9rem;
  color: var(--navy-dk);
}
.metric-card .metric-delta {
  font-size: 0.9rem;
  font-weight: 600;
}
.metric-card .metric-note {
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
}

/* Delta states */
.delta-positive { color: var(--green); }
.delta-negative { color: var(--red); }
.delta-neutral  { color: var(--muted); }
.delta-positive::before { content: "\25B2 "; font-size: 0.72rem; }
.delta-negative::before { content: "\25BC "; font-size: 0.72rem; }

/* -----------------------------------------------------------------
 * YoY banner
 * ----------------------------------------------------------------- */
.yoy-banner {
  border-radius: 8px;
  padding: 1rem 1.25rem;
  font-size: 1rem;
  line-height: 1.45;
  border: 1px solid #1e3a5f;
  background: #132038;
  color: #e2e8f0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  align-items: baseline;
}
.yoy-banner strong { color: var(--gold); }
.yoy-banner.yoy-positive {
  background: var(--green-bg);
  border-color: var(--green-soft);
  color: #0f4a22;
}
.yoy-banner.yoy-positive strong { color: #0f4a22; }
.yoy-banner.yoy-negative {
  background: var(--red-bg);
  border-color: var(--red-soft);
  color: #7a1d13;
}
.yoy-banner.yoy-negative strong { color: #7a1d13; }

/* -----------------------------------------------------------------
 * Section 2 -- Channel donut + legend
 * ----------------------------------------------------------------- */
.channel-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 820px) {
  .channel-split { grid-template-columns: 1fr; }
}
.chart-wrap {
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  color: var(--dark);
}
.chart-wrap h3 {
  color: var(--navy);
  margin: 0 0 0.75rem;
  font-family: Georgia, serif;
  font-size: 1.05rem;
}
.chart-box {
  position: relative;
  height: 320px;
}
.chart-box.tall    { height: 380px; }
.chart-box.short   { height: 260px; }

.channel-legend {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  color: var(--dark);
}
.channel-legend thead th {
  background: var(--navy);
  color: white;
  text-align: left;
  padding: 0.55rem 0.85rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 600;
}
.channel-legend td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.channel-legend tbody tr:nth-child(even) td { background: var(--row-alt); }
.channel-legend tbody tr:last-child td { border-bottom: none; }
.channel-legend td.num { text-align: right; }
.channel-legend .swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 0.55rem;
  vertical-align: middle;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

/* -----------------------------------------------------------------
 * Section 3 -- Trend chart + narrative card + BoFu vs Homepage
 * ----------------------------------------------------------------- */
.narrative-card {
  background: #132038;
  border: 1px solid #1e3a5f;
  border-left: 4px solid var(--gold);
  border-radius: 6px;
  padding: 1.1rem 1.4rem;
  margin: 1.25rem 0;
  line-height: 1.65;
}
.narrative-card h3 {
  font-family: Georgia, serif;
  color: var(--gold);
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}
.narrative-card p {
  margin: 0 0 0.6rem;
  color: #c0cfe0;
  font-size: 0.95rem;
}
.narrative-card p:last-child { margin-bottom: 0; }
.narrative-card strong { color: #e2e8f0; }

/* -----------------------------------------------------------------
 * Loading / error states
 * ----------------------------------------------------------------- */
.state {
  padding: 1.25rem;
  text-align: center;
  color: #7a9ab5;
  font-size: 0.92rem;
}
.state.err { color: var(--red); }
.spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: exec-spin 0.8s linear infinite;
  margin-right: 0.5rem;
  vertical-align: middle;
}
@keyframes exec-spin { to { transform: rotate(360deg); } }

footer.site {
  text-align: center;
  padding: 2rem 1rem 1rem;
  color: #4a6080;
  font-size: 0.8rem;
  border-top: 1px solid #1a3050;
  margin-top: 2rem;
}

/* -----------------------------------------------------------------
 * Responsive
 * ----------------------------------------------------------------- */
@media (max-width: 720px) {
  header.site { padding: 1rem; }
  nav.section-nav { padding: 0.5rem 1rem; gap: 0.75rem; }
  main { padding: 0 1rem 2rem; }
  .page-title { font-size: 1.5rem; }
  .metric-card .metric-value { font-size: 2rem; }
  .metric-card.primary .metric-value { font-size: 2.3rem; }
  .chart-box { height: 280px; }
}

/* -----------------------------------------------------------------
 * Print -- hide chrome, force white, keep all sections on one flow
 * ----------------------------------------------------------------- */
@media print {
  body { background: white !important; color: black; }
  header.site,
  nav.section-nav,
  footer.site { display: none !important; }
  main { max-width: none; margin: 0; padding: 0; }
  .metric-card,
  .chart-wrap,
  .channel-legend,
  .narrative-card,
  .yoy-banner {
    box-shadow: none !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  section.exec-section { page-break-inside: avoid; margin-bottom: 1.5rem; }
  .page-title { color: black; }
  .metric-card .metric-value { color: black; }
  .yoy-banner.yoy-positive,
  .yoy-banner.yoy-negative {
    background: white !important;
    border: 1px solid #333 !important;
    color: black !important;
  }
  .chart-box { height: 260px; }
}
