/* Strategic Moats in the Age of AI — shared styles
   Layered on top of Tailwind CDN. Keep minimal. */

:root {
  /* Moat-family color tokens */
  --moat-scale:        #0ea5e9;  /* sky-500 — Scale Economies */
  --moat-network:      #8b5cf6;  /* violet-500 — Network */
  --moat-counter:      #f59e0b;  /* amber-500 — Counter-Positioning */
  --moat-switching:    #ef4444;  /* red-500 — Switching Costs */
  --moat-brand:        #ec4899;  /* pink-500 — Branding */
  --moat-cornered:     #10b981;  /* emerald-500 — Cornered Resource */
  --moat-process:      #6366f1;  /* indigo-500 — Process Power */
  --moat-data:         #14b8a6;  /* teal-500 — Data Flywheel (AI-era) */
  --moat-agentic:      #f43f5e;  /* rose-500 — Agentic Workflow Lock-in (AI-era) */
  --moat-evaluator:    #7c3aed;  /* violet-600 — Evaluator Judgment Power (AI-era, Pass 1.5) */

  --ink:               #0b1220;
  --ink-soft:          #334155;
  --paper:             #fafaf7;
  --rule:              #e2e8f0;
}

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: ui-serif, Georgia, "Iowan Old Style", "Apple Garamond", Baskerville, "Times New Roman", serif;
  line-height: 1.55;
}

.display, h1, h2, h3, h4, .battle-card .name {
  font-family: ui-sans-serif, -apple-system, "Inter", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: -0.01em;
}

.prose-paper p { margin-bottom: 1em; }
.prose-paper h2 { margin-top: 2.5rem; }
.prose-paper h3 { margin-top: 1.75rem; }

/* Moat badge */
.moat-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: white;
}
.moat-badge.scale     { background: var(--moat-scale); }
.moat-badge.network   { background: var(--moat-network); }
.moat-badge.counter   { background: var(--moat-counter); }
.moat-badge.switching { background: var(--moat-switching); }
.moat-badge.brand     { background: var(--moat-brand); }
.moat-badge.cornered  { background: var(--moat-cornered); }
.moat-badge.process   { background: var(--moat-process); }
.moat-badge.data      { background: var(--moat-data); }
.moat-badge.agentic   { background: var(--moat-agentic); }
.moat-badge.evaluator { background: var(--moat-evaluator); }

/* Cards grid — fixed 750px cards, wraps as many as fit, centered.
   Row heights equalize via grid stretch. */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, 750px);
  justify-content: center;
  gap: 1.25rem;
  align-items: stretch;
  margin: 1.5rem 0;
}

/* Battle card */
.battle-card {
  background: white;
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 1.1rem 1.15rem;
  margin: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px -16px rgba(0,0,0,0.12);
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.battle-card .hero {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}
.battle-card .hero svg { flex: 0 0 64px; width: 64px; height: 64px; }
.battle-card .hero > div { min-width: 0; }
.battle-card .name { font-size: 1.25rem; font-weight: 800; line-height: 1.1; word-wrap: break-word; }
.battle-card .tagline { font-style: italic; color: var(--ink-soft); font-size: 0.82rem; line-height: 1.35; }
.battle-card .class-line {
  font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 700;
}
.battle-card .moat-badge { font-size: 0.6rem; padding: 1px 7px; }
.battle-card h3, .battle-card h4 {
  font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 700;
  margin-top: 0.85rem; margin-bottom: 0.4rem;
}

/* Stats bars */
.stats { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(60px, 1fr) 28px; gap: 4px 8px; align-items: center; }
.stats .label { font-size: 0.7rem; color: var(--ink-soft); font-family: ui-sans-serif, sans-serif; line-height: 1.2; }
.stats .bar { height: 8px; border-radius: 6px; background: #f1f5f9; overflow: hidden; }
.stats .bar > div { height: 100%; border-radius: 6px; background: linear-gradient(90deg, #0ea5e9, #6366f1); }
.stats .val { font-size: 0.7rem; font-weight: 700; text-align: right; font-family: ui-sans-serif, sans-serif; }

/* Special move callout */
.special-move {
  background: #fef3c7;
  border-left: 4px solid var(--moat-counter);
  padding: 0.6rem 0.8rem;
  margin: 0.75rem 0;
  border-radius: 6px;
  font-style: italic;
  font-family: ui-serif, Georgia, serif;
  font-size: 0.85rem;
  line-height: 1.4;
}

/* Battles table */
table.battles {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-family: ui-sans-serif, sans-serif; font-size: 0.74rem;
  margin-top: 0.75rem;
  table-layout: fixed;
}
table.battles th, table.battles td {
  padding: 5px 6px; text-align: left; border-bottom: 1px solid var(--rule);
  word-wrap: break-word; overflow-wrap: break-word;
  vertical-align: top;
  line-height: 1.3;
}
table.battles th {
  font-size: 0.62rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 700; background: #f8fafc;
}
.cell-win   { background: #dcfce7; color: #166534; font-weight: 700; }
.cell-lose  { background: #fee2e2; color: #991b1b; font-weight: 700; }
.cell-tie   { background: #fef9c3; color: #854d0e; font-weight: 700; }
.cell-asterisk { box-shadow: inset 0 0 0 2px #f97316; }

/* Tradeoff details */
details.tradeoff {
  margin: 0.4rem 0;
  border: 1px solid var(--rule);
  border-left: 3px solid #f97316;
  border-radius: 6px;
  padding: 0.4rem 0.7rem;
  background: #fff7ed;
}
details.tradeoff > summary {
  cursor: pointer; font-weight: 600; font-family: ui-sans-serif, sans-serif;
  font-size: 0.74rem;
}
details.tradeoff[open] > summary { margin-bottom: 0.4rem; }
details.tradeoff p { font-size: 0.78rem; color: var(--ink-soft); line-height: 1.45; }
.battle-card details.tradeoff { font-size: 0.78rem; }

/* Matchup matrix grid */
.matrix {
  display: grid;
  gap: 2px;
  background: var(--rule);
  border: 1px solid var(--rule);
  font-family: ui-sans-serif, sans-serif;
  font-size: 0.72rem;
}
.matrix .cell {
  background: white; padding: 8px; min-height: 64px;
  position: relative;
}
.matrix .head {
  background: #f8fafc; font-weight: 700; text-align: center;
  display: flex; align-items: center; justify-content: center;
  padding: 6px 4px;
}
.matrix .cell .verdict { font-weight: 700; font-size: 0.78rem; letter-spacing: 0.04em; }
.matrix .cell .mech { font-size: 0.66rem; color: var(--ink-soft); margin-top: 3px; line-height: 1.25; }
.matrix .cell-attacker { background: #dcfce7; }
.matrix .cell-defender { background: #fee2e2; }
.matrix .cell-tie       { background: #fef9c3; }
.matrix .cell-diag      { background: #e2e8f0; color: #475569; font-style: italic; }
.matrix .cell-asterisk  { box-shadow: inset 0 0 0 2px #f97316; }

/* Pass 2 — Part V: delta matrix treatments */
.matrix .cell-baseline  { opacity: 0.45; }                   /* 7×7 quadrant in delta view */
.matrix .cell-flipped   { box-shadow: inset 0 0 0 2.5px #7c3aed; } /* cell that flipped under 10×10 */
.matrix .cell-newdim    { background: #eef2ff; }              /* AI-era row/col cells */
.flip-arrow { display: inline-block; font-weight: 800; color: #7c3aed; margin-left: 4px; }

/* Bridge-chapter / 'the bridge' pill */
.pass-pill.bridge { background: #ede9fe; color: #5b21b6; }

/* Source-plan table */
table.sources {
  width: 100%; border-collapse: collapse; font-family: ui-sans-serif, sans-serif;
  font-size: 0.82rem;
}
table.sources th, table.sources td {
  border: 1px solid var(--rule); padding: 8px 10px; vertical-align: top;
}
table.sources th { background: #f1f5f9; }

/* Pass-indicator pill */
.pass-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-family: ui-sans-serif, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.pass-pill.live   { background: #fef3c7; color: #854d0e; }
.pass-pill.draft  { background: #e2e8f0; color: #475569; }
.pass-pill.future { background: #f1f5f9; color: #94a3b8; }

/* Print rules */
@media print {
  body { background: white; }
  .battle-card { break-inside: avoid; box-shadow: none; }
  details.tradeoff { break-inside: avoid; }
  details.tradeoff[open] summary::after { content: ""; }
  details.tradeoff { /* expand all on print */ }
  details.tradeoff > * { display: revert !important; }
  nav, .no-print { display: none !important; }
  a { color: inherit; text-decoration: none; }
}
