@import url('https://fonts.googleapis.com/css2?family=Gloock&display=swap');

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

:root {
  --bg: #fefaf9;
  --text: #1a1a1a;
  --muted: #888;
  --border: #e1e1e1;
  --orange: #e77728;
  --font: -apple-system, BlinkMacSystemFont, 'Inter', 'IBM Plex Sans', sans-serif;
  --serif: 'Gloock', Georgia, serif;
}

[data-theme="dark"] {
  --bg: #2b2b2c;
  --text: #e1e1e1;
  --muted: #a1a1a1;
  --border: #3a3a3b;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
  overflow-x: hidden;
}

/* ── Back button ──────────────────────────────────────────────────────────── */
.back-btn {
  position: fixed;
  top: 1.25rem;
  left: 1.25rem;
  z-index: 200;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
  opacity: 0.4;
  transition: opacity 0.2s;
  padding: 0.4rem 0.5rem;
}
.back-btn:hover { opacity: 1; }

/* ── Wrapper ──────────────────────────────────────────────────────────────── */
.manifesto {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.mf-header {
  padding: 7rem 0 4rem;
  border-bottom: 1px solid var(--border);
}

.mf-eyebrow {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 1.75rem;
  display: block;
}

.mf-title {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin-bottom: 1.5rem;
}

.mf-byline {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* ── Body copy ────────────────────────────────────────────────────────────── */
.mf-body {
  padding: 3.5rem 0;
}

.mf-para {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 1.75rem;
}

.mf-para:last-child { margin-bottom: 0; }

.mf-big {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-bottom: 2rem;
  color: var(--text);
}

.mf-accent { color: var(--orange); }

.mf-rule {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.75rem 0;
}

/* Useful / not useful side by side */
.mf-contrast {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 2rem 0 2.5rem;
}

.mf-contrast-col {
  padding: 1.25rem 1.4rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.mf-contrast-col.good  { border-color: #4a9f6e40; background: #4a9f6e08; }
.mf-contrast-col.bad   { border-color: #c44a4a40; background: #c44a4a08; }

.mf-contrast-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  display: block;
}

.mf-contrast-col.good .mf-contrast-label { color: #4a9f6e; }
.mf-contrast-col.bad  .mf-contrast-label { color: #c44a4a; }

.mf-contrast-col p {
  font-size: 0.87rem;
  color: var(--muted);
  line-height: 1.65;
}

.mf-body a {
  color: var(--orange);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(231,119,40,0.4);
  transition: text-decoration-color 0.15s;
}
.mf-body a:hover {
  text-decoration-color: var(--orange);
}

.mf-stat-inline {
  font-family: var(--serif);
  font-size: 1.1em;
  color: var(--orange);
}

/* ── Viz section ──────────────────────────────────────────────────────────── */
.mf-viz-section {
  border-top: 1px solid var(--border);
  padding: 4rem 0 1rem;
}

.mf-viz-hed {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 400;
  line-height: 1.2;
  margin-bottom: 0.6rem;
}

.mf-viz-sub {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 2rem;
  line-height: 1.65;
}

/* Filters — horizontal scroll on mobile */
.bubble-filters {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}

.bubble-btn {
  padding: 0.35rem 0.9rem;
  border-radius: 99px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.bubble-btn:hover,
.bubble-btn.active {
  border-color: var(--orange);
  color: var(--orange);
  background: rgba(231,119,40,0.07);
}

/* Full-bleed bubble chart */
#bubble-outer {
  width: 100vw;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 0.5rem;
}

#bubble-wrap {
  position: relative;
  width: 100%;
}

#bubble-wrap svg { display: block; }

/* Tooltip — fixed to bottom on mobile, floating on desktop */
.b-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  max-width: 230px;
  line-height: 1.55;
  box-shadow: 0 6px 24px rgba(0,0,0,0.09);
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 20;
}

.b-tooltip strong {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.88rem;
}

.b-tooltip .b-hrs {
  display: block;
  color: var(--orange);
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.b-tooltip p { color: var(--muted); }

@media (max-width: 640px) {
  .b-tooltip {
    position: fixed;
    bottom: 1.25rem;
    left: 1rem;
    right: 1rem;
    top: auto !important;
    max-width: none;
    border-radius: 12px;
    padding: 1rem 1.1rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.14);
  }
}

/* ── Combinations ─────────────────────────────────────────────────────────── */
.mf-combos {
  padding: 3rem 0 0;
  border-top: 1px solid var(--border);
}

.mf-combos-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.mf-combo-row {
  margin-bottom: 2.75rem;
}

.mf-combo-row-label {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.65rem;
}

/* Waffle grid */
.waffle-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 26), 1fr);
  gap: 2px;
  margin-bottom: 0.75rem;
  border-radius: 4px;
  overflow: hidden;
}

.waffle-cell {
  aspect-ratio: 1;
  border-radius: 1px;
  transition: opacity 0.15s;
}

.waffle-cell:hover { opacity: 0.7; }

.waffle-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1rem;
  margin-top: 0.5rem;
}

.waffle-leg-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  color: var(--muted);
}

.waffle-leg-dot {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  flex-shrink: 0;
}

.waffle-leg-hrs {
  font-weight: 600;
  font-size: 0.68rem;
  opacity: 0.6;
}

.waffle-total {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 0.55rem;
  letter-spacing: 0.04em;
}

/* ── Footer ───────────────────────────────────────────────────────────────── */
.mf-footer {
  padding: 2.5rem 0 5rem;
  border-top: 1px solid var(--border);
}

.mf-footer p {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 2;
}

.mf-footer a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--border);
  transition: color 0.15s;
}
.mf-footer a:hover { color: var(--text); }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 580px) {
  .mf-contrast { grid-template-columns: 1fr; }

  .mf-header { padding: 5rem 0 3rem; }

  .bubble-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.4rem;
    scrollbar-width: none;
    margin-left: -2rem;
    margin-right: -2rem;
    padding-left: 2rem;
    padding-right: 2rem;
  }
  .bubble-filters::-webkit-scrollbar { display: none; }

  .mf-combos { padding: 2rem 0 0; }
}
