:root {
  --page-bg: #F1F4F8; /* theme-guardrail-allow: fixed market-map export canvas color */
  --card-bg: #FFFFFF;
  --text: #0F172A;
  --text-secondary: #1E293B;
  --text-muted: #334155;
  --border: rgba(15,23,42,0.08);
  --sc-panel: rgba(15,23,42,0.035); /* theme-guardrail-allow: local landscape token (these pages don't load the central theme) — scatter plot-area fill, kept subtler than the --border gridlines so it never competes with them */
  --group-card-bg: #FFFFFF;
  --group-card-border: rgba(15,23,42,0.08);
}
[data-theme="dark"] {
  --page-bg: #0F2147;
  --card-bg: #132A55;
  --text: #FFFFFF;
  --text-secondary: rgba(255,255,255,0.95);
  --text-muted: rgba(255,255,255,0.88);
  --border: rgba(255,255,255,0.08);
  --sc-panel: rgba(255,255,255,0.045); /* theme-guardrail-allow: local landscape token (these pages don't load the central theme) — scatter plot-area fill, kept subtler than the --border gridlines so it never competes with them */
  --group-card-bg: #132A55;
  --group-card-border: rgba(255,255,255,0.08);
}
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html { background: var(--page-bg); min-height: 100%; }
[data-theme="light"] html {
  background: var(--page-bg);
}
[data-theme="dark"] html {
  background:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(59,130,246,0.18), transparent 60%),
    radial-gradient(ellipse 70% 50% at 80% 100%, rgba(139,92,246,0.15), transparent 60%),
    linear-gradient(180deg, #0B1730 0%, #0F2147 100%);
  background-attachment: fixed;
}
body {
  font-family: 'Source Sans 3', system-ui, -apple-system, sans-serif;
  color: var(--text);
  display: flex;
  justify-content: center;
  padding: 32px 20px;
}
.outer { width: 100%; max-width: 1180px; }
/* Responsive expansion — kick in earlier + go wider so the map fills more of the
   page (and the embed iframe) instead of leaving big side gutters. */
@media (min-width: 1240px) { .outer { max-width: 1340px; } }
@media (min-width: 1500px) { .outer { max-width: 1540px; } }
@media (min-width: 1800px) { .outer { max-width: 1780px; } }
@media (min-width: 2100px) { .outer { max-width: 2000px; } }
.card { padding: 12px; position: relative; }
.title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin: 0 12px 10px;
}
.title {
  font-size: 44px;
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 1.08;
  color: var(--text);
  flex: 1;
  min-width: 0;
}
/* "View on Dealroom" header link retired (2026-06): it pointed at the
   login-walled app and crowded the export buttons next to the title. The
   generator no longer emits it; this hides the dead anchor on already-generated
   pages so it never renders unstyled before the next regen. */
.source-link { display: none !important; }

/* Export buttons ("Download image" / "Download PDF") — subtle secondary
   actions. Ghost / outline treatment (2026-06) so they sit quietly beside the
   title instead of shouting as solid-blue CTAs. */
.pdf-export-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 7px 13px;
  margin-top: 8px;
  border-radius: 999px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.pdf-export-btn:hover { transform: translateY(-1px); color: var(--text); border-color: var(--text-muted); }
.pdf-export-btn.is-busy { opacity: 0.85; }
.pdf-export-btn svg { width: 14px; height: 14px; }
.pdf-spin {
  width: 13px; height: 13px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  opacity: 0.7;
  display: inline-block;
  animation: pdfspin 0.7s linear infinite;
}
@keyframes pdfspin { to { transform: rotate(360deg); } }

.subtitle {
  font-size: 18px;
  font-weight: 400;
  color: var(--text-muted);
  margin: 0 12px 28px;
  line-height: 1.5;
  max-width: 820px;
}
/* Mobile: drop the export buttons onto their own row beneath the title so a
   long headline is never crushed into a sliver beside the ~270px-wide,
   non-shrinking export buttons (the flex:1 title otherwise collapses to ~0
   width when the two buttons can't fit on the same line). */
@media (max-width: 720px) {
  .title-row { flex-wrap: wrap; justify-content: flex-start; }
  .title { flex-basis: 100%; }
  .pdf-export-btn { margin-top: 0; }
}
/* Mobile: tighten title & subtitle so they don't eat half the screen, and trim
   the page/card/section padding so the cards use the full phone width (the
   default 20/12/22px paddings stack to ~108px of horizontal chrome on a 390px
   screen, leaving the content far too narrow). */
@media (max-width: 560px) {
  body { padding: 18px 8px; }
  .title { font-size: 28px; letter-spacing: -0.025em; }
  .subtitle { font-size: 15px; margin-bottom: 18px; }
  .title-row { gap: 10px; margin-bottom: 8px; }
  .card { padding: 6px; }
  .masonry { margin: 0 2px; }
  /* group-card / subgroup-card padding overrides live at the very end of the
     file (after their base rules) so source order lets them win. */
}
/* True masonry via CSS columns — cards flow vertically with no row-height
   gaps under short groups. Cards keep their natural heights, three columns
   on wide screens, two on medium, one on mobile. */
.masonry {
  column-count: 3;
  column-gap: 18px;
  margin: 0 4px;
}
@media (max-width: 880px) { .masonry { column-count: 2; } }
@media (max-width: 560px) { .masonry { column-count: 1; } }
/* More columns on wide viewports (fullscreen, large monitors) */
@media (min-width: 1400px) { .masonry { column-count: 4; } }
@media (min-width: 1800px) { .masonry { column-count: 5; } }
@media (min-width: 2200px) { .masonry { column-count: 6; } }
/* Scaled thumbnail previews (gallery cards, resources tiles) render the page at
   its wide breakpoint, so balanced multi-column flow strands the trailing
   column(s) empty when group cards are few or tall. landscape-app.js tags the
   card .is-thumb-preview in that mode; pin it to two columns so both fill from
   the top of the cropped viewport. Poster-layout maps keep their bespoke flow. */
.card.is-thumb-preview .masonry:not(.is-poster) { column-count: 2; }

/* Nested super-groups use the SAME masonry as flat maps: each super-group
   card is a column block that flows into the shortest column and stacks its
   sub-sections vertically inside — never a full-width band. The base .masonry
   (column-count) + .group-card (break-inside:avoid) rules below already do
   this, so .is-nested needs no layout override; the class is kept only as a
   render-state hook. Sub-sections stack vertically (their default flow). */
.group-card {
  position: relative;
  border-radius: 16px;
  padding: 22px 22px 20px;
  overflow: hidden;
  /* Required so column-based masonry doesn't split a group across columns. */
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
  display: inline-block;
  width: 100%;
  margin-bottom: 18px;
}
[data-theme="light"] .group-card {
  background: #FFFFFF;
  border: 1px solid rgba(15,23,42,0.08);
  box-shadow: 0 1px 2px rgba(15,23,42,0.04), 0 8px 24px -8px rgba(15,23,42,0.10);
}
[data-theme="dark"] .group-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2), 0 12px 32px -8px rgba(0,0,0,0.35);
}
.group-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
  /* Reserve the top-right gutter so a long card title never slides under the
     absolutely-positioned per-card download button (.card-png-btn). */
  padding-right: 36px;
}
.group-header-left { flex: 1; min-width: 0; }

/* Per-card PNG download — a quiet ghost button pinned to each segment card's
   top-right corner (added by landscape-pdf.js). Absolutely positioned so it
   adds zero height (the masonry/poster column balancing stays untouched), and
   it inherits the card's theme tokens so it reads correctly in light + dark.
   Hidden until the card is hovered/focused on pointer devices; always faintly
   visible on touch (no hover) so it stays discoverable. */
.card-png-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 9px;
  cursor: pointer;
  color: var(--text-muted);
  background: var(--group-card-bg);
  border: 1px solid var(--border);
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.group-card-nested > .card-png-btn { top: 18px; right: 18px; }
.group-card:hover > .card-png-btn,
.card-png-btn:focus-visible { opacity: 1; }
.card-png-btn:hover { transform: translateY(-1px); color: var(--text); border-color: var(--text-muted); }
.card-png-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card-png-btn svg { width: 15px; height: 15px; }
.card-png-btn.is-busy { opacity: 1; pointer-events: none; }
.card-png-btn .pdf-spin { width: 13px; height: 13px; }
@media (hover: none) {
  .card-png-btn { opacity: 0.62; }
}
.group-name {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.2;
  letter-spacing: -0.015em;
}
.pills-wrap { display: flex; flex-wrap: wrap; gap: 5px 6px; }
.company-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  line-height: 1;
  padding: 6px 12px 6px 7px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.company-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(15,23,42,0.10);
}
[data-theme="light"] .group-card > .pills-wrap .company-pill { background: #F1F5F9; }
[data-theme="dark"] .group-card > .pills-wrap .company-pill { background: rgba(255,255,255,0.07); }
.pill-logo {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  object-fit: contain;
  flex-shrink: 0;
  background: rgba(128,128,128,0.06);
}
.pill-initial {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  line-height: 1;
}
.pill-name { white-space: nowrap; }

/* Nested group cards (super-groups containing sub-sections) */
.group-card-nested { padding: 22px 20px 20px; }
.group-card-nested .group-header {
  padding-bottom: 12px;
  margin-bottom: 14px;
}
.group-card-nested .group-name { font-size: 22px; }
.group-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: -6px 0 14px;
  line-height: 1.4;
}
/* Long blurbs collapse to two lines behind a "View more" toggle; short ones
   (no .is-clampable) render in full. */
.group-subtitle.is-clampable .group-subtitle-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
.group-subtitle.is-clampable.is-expanded .group-subtitle-text {
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: unset;
  overflow: visible;
}
.group-subtitle-more {
  display: inline-block;
  margin-top: 4px;
  padding: 0;
  background: none;
  border: 0;
  font: inherit;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
}
.group-subtitle-more:hover { text-decoration: underline; }
.subgroups-wrap { display: flex; flex-direction: column; gap: 12px; }
.subgroup-card {
  position: relative;
  border-radius: 12px;
  padding: 12px 14px 12px;
}
[data-theme="light"] .subgroup-card { background: #F8FAFC; }
[data-theme="dark"]  .subgroup-card { background: rgba(255,255,255,0.04); }
.subgroup-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}
.subgroup-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}
[data-theme="light"] .subgroup-card .company-pill {
  background: #FFFFFF;
  border-color: rgba(15,23,42,0.07);
}
[data-theme="dark"] .subgroup-card .company-pill {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.06);
}

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 28px 8px 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.footer-logo { display: flex; align-items: center; }
.footer-logo svg { display: block; width: 110px; height: 26px; }
.footer-source { font-size: 12px; color: var(--text-muted); }
.logo-light { display: block; }
.logo-dark { display: none; }
[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: block; }

/* Mobile padding overrides — placed last so they beat the base .group-card /
   .group-card-nested / .subgroup-card padding rules (equal specificity, source
   order wins) and reclaim horizontal width on phones. */
@media (max-width: 560px) {
  .group-card { padding: 16px 14px 14px; }
  .group-card-nested { padding: 16px 14px 14px; }
  .subgroup-card { padding: 11px 12px; }
}
