/* ============================================================================
   landscape.css  —  Competitive-landscape map for the COMPS <GO> PWA
   Scoped under .lscape-* so it never collides with the base terminal styles.
   Durable: lives outside index.html, so the daily in-place rebuild can't touch it.

   LEGIBILITY PASS (21-Jul-26). The panel was previously near-unreadable: every
   logo was tinted to the same amber, every label was uppercased with tracking,
   and all 31 tiles carried their own border. Changes:
     1. Logos render in FULL COLOUR on a light chip — brand recognition is
        colour recognition, and the tint filter destroyed it.
     2. No text-transform anywhere. The source data in landscape.js is already
        sentence case ("AI ad engine", "UA / self-serve DSP"), so simply not
        uppercasing it restores the intended reading — no JS change needed.
     3. Tile borders removed. Category now reads from a faint background tint,
        so the grid stops competing with its own contents.
     4. Body text 11-13px instead of 8.5-10px.
     5. Market cap on its own line, accent-coloured, so caps scan as a column.
   ========================================================================== */

:root {
  /* Panel-local additions. The four brand colours + surfaces live in the
     :root block inside index.html; these are the extras this panel needs. */
  --gate:       #FFC24B;              /* gatekeepers — neither rival nor owned */
  --gate-well:  rgba(255,194,75,0.09);
  --own-well:   rgba(0,229,255,0.10);
  --neutral-well: rgba(255,255,255,0.05);
  --logo-chip:  #FFFFFF;
}

/* ---- header ---- */
.lscape-subtitle {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.45;
  margin: 0 0 10px 0;
}

/* ---- legend ---- */
.lscape-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 0 0 12px 0;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  color: var(--text-muted);
}
.lscape-legend .item { display: inline-flex; align-items: center; gap: 6px; }
.lscape-legend .sw {
  width: 9px; height: 9px; border-radius: 2px;
  background: currentColor; display: inline-block;
}
.lg-own        { color: var(--accent); }
.lg-compete    { color: var(--text-muted); }
.lg-gatekeeper { color: var(--gate); }
.lg-measure    { color: var(--accent-soft); }
.lg-demand     { color: var(--up); }
.lg-supply     { color: var(--text-muted); }

/* ---- grid of boxes ---- */
.lscape-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 18px;
}
.lscape-box.span-full { grid-column: 1 / -1; }

/* Boxes are now grouping only — no chrome. Whitespace does the separating. */
.lscape-box {
  background: none;
  border: 0;
  display: flex;
  flex-direction: column;
}
.lscape-box-head {
  background: none;
  border: 0;
  padding: 0 0 9px 0;
  font-family: var(--font-head);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.lscape-box-head .cnt { display: none; }   /* tile count was noise — the tiles are right there */

.lscape-box.layer-red  .lscape-box-head { color: var(--gate); }
.lscape-box.layer-blue .lscape-box-head { color: var(--accent-soft); }
/* The owned-stack box should lead the eye. Matched by content rather than by a
   class the renderer doesn't emit — degrades to plain white if :has() is absent. */
.lscape-box:has(.rel-own) .lscape-box-head { color: var(--accent); }

.lscape-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 7px;
  padding: 0;
}

/* ---- tile ---- */
.lscape-tile {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  background: var(--neutral-well);
  border: 0;
  border-radius: 7px;
  padding: 10px;
  cursor: pointer;
  position: relative;
  font-family: var(--font-body);
  color: var(--text-soft);
  text-align: left;
  transition: background 0.12s;
}
.lscape-tile:hover { background: rgba(255,255,255,0.10); }
.lscape-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- logo: full colour, on a light chip so dark marks stay visible ---- */
.lscape-logo {
  height: 26px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--logo-chip);
  border-radius: 4px;
  padding: 3px 6px;
  margin-bottom: 8px;
}
.lscape-logo img {
  max-height: 20px;
  max-width: 100%;
  object-fit: contain;
  filter: none;              /* full colour — the whole point of having logos */
  opacity: 1;
}
/* Two marks are near-white artwork (mean luminance 234 and 200) and would
   disappear on a white chip. Give those a dark chip instead. Matched on the
   filename fragment; src is URL-encoded so the space-free part is used. */
.lscape-logo:has(img[src*="ATT-SKAdNetwork"]),
.lscape-logo:has(img[src*="AppsFlyer"]) {
  background: #14101F;
}

/* Fallback wordmark when the PNG is absent or 404s: drop the chip, use accent text */
.lscape-tile.is-missing .lscape-logo {
  background: none;
  padding: 0;
  justify-content: flex-start;
  height: auto;
  margin-bottom: 4px;
}
.lscape-tile.is-missing .lscape-logo img { display: none; }
.lscape-tile.is-missing .lscape-logo::after { content: none; }

.lscape-tile-main { display: flex; flex-direction: column; gap: 3px; }
.lscape-name {
  font-family: var(--font-head);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.25;
  color: var(--text);
}
.lscape-sub {
  font-size: 11px;
  color: var(--text-soft);
  text-transform: none;          /* data is already sentence case */
  letter-spacing: 0;
  line-height: 1.35;
  opacity: 0.75;
}
.lscape-cap {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  margin-top: 6px;
}
.lscape-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  background: none;
  color: var(--text-muted);
  padding: 0;
  margin-left: 5px;
  border-radius: 0;
  letter-spacing: 0;
  vertical-align: baseline;
  text-transform: none;
}

/* ---- category tint replaces the old per-tile border ---- */
.lscape-tile.rel-own        { background: var(--own-well); }
.lscape-tile.rel-own:hover  { background: rgba(0,229,255,0.16); }
.lscape-tile.rel-own        .lscape-cap { color: var(--accent); }

.lscape-tile.rel-gatekeeper       { background: var(--gate-well); }
.lscape-tile.rel-gatekeeper:hover { background: rgba(255,194,75,0.15); }
.lscape-tile.rel-gatekeeper .lscape-cap { color: var(--gate); }

.lscape-tile.rel-measure    { background: rgba(0,229,255,0.05); }
.lscape-tile.rel-measure    .lscape-cap { color: var(--accent-soft); }

.lscape-tile.rel-demand     { background: rgba(61,220,151,0.07); }
.lscape-tile.rel-demand     .lscape-cap { color: var(--up); }

.lscape-tile.rel-compete    { background: var(--neutral-well); }
.lscape-tile.rel-supply     { background: var(--neutral-well); }
/* "Private" / "Mobvista" etc. aren't figures — mute them so real caps stand out */
.lscape-tile.rel-compete .lscape-cap,
.lscape-tile.rel-supply  .lscape-cap { color: var(--accent); }

/* ---- popover detail card ---- */
.lscape-section { position: relative; }
.lscape-pop {
  position: absolute;
  z-index: 60;
  width: 268px;
  max-width: 88vw;
  background: var(--bg-surface);
  border: 1px solid var(--accent-soft);
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.7);
  padding: 12px 14px;
  display: none;
}
.lscape-pop.show { display: block; }
.lscape-pop .pop-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.lscape-pop .pop-name {
  font-family: var(--font-head);
  color: var(--text); font-weight: 600; font-size: 13.5px; letter-spacing: 0;
}
.lscape-pop .pop-cap { color: var(--accent); font-size: 11.5px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lscape-pop .pop-meta {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
  margin: 4px 0 9px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.lscape-pop .pop-rel {
  display: inline-block;
  padding: 1px 7px;
  border: 0;
  border-radius: 10px;
  background: rgba(255,255,255,0.10);
  color: var(--text-soft);
  font-size: 10.5px;
  font-weight: 500;
}
.lscape-pop .pop-angle { color: var(--text-soft); font-size: 12px; line-height: 1.55; }
.lscape-pop .pop-angle .lbl {
  color: var(--accent); font-weight: 600; text-transform: none;
  font-size: 11px; letter-spacing: 0; display: block; margin-bottom: 3px;
  font-family: var(--font-head);
}

/* popover action buttons: Learn more (internal) + Website (external) */
.lscape-pop .pop-actions {
  display: flex; gap: 8px; margin-top: 11px; padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}
.lscape-pop .pop-btn {
  flex: 1; text-align: center; text-decoration: none;
  font-family: var(--font-head); font-size: 11.5px; font-weight: 600;
  padding: 7px 8px; border-radius: 6px;
  background: rgba(255,255,255,0.08); color: var(--text);
  border: 1px solid var(--line); transition: background 0.12s, border-color 0.12s;
}
.lscape-pop .pop-btn:hover { background: rgba(255,255,255,0.14); border-color: var(--line-strong); }
.lscape-pop .pop-btn.primary {
  background: var(--accent-well); color: var(--accent); border-color: var(--accent-soft);
}
.lscape-pop .pop-btn.primary:hover { background: rgba(0,229,255,0.18); }

/* ---- company summary page (#co/<slug>) --------------------------------- */
.copage-header { display: flex; flex-direction: column; gap: 10px; }
.copage-top { display: flex; align-items: center; gap: 12px; }
.copage-logo {
  flex-shrink: 0; height: 40px; min-width: 56px; padding: 5px 9px;
  background: #FFFFFF; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.copage-logo img { max-height: 30px; max-width: 120px; object-fit: contain; }
.copage-name {
  font-family: var(--font-head); font-weight: 700; font-size: 20px;
  letter-spacing: 0.02em; color: var(--accent);
}
.copage-tag { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.copage-site {
  align-self: flex-start; text-decoration: none;
  font-family: var(--font-head); font-size: 11.5px; font-weight: 600;
  color: var(--accent); padding: 5px 11px; border-radius: 6px;
  background: var(--accent-well); border: 1px solid var(--accent-soft);
}
.copage-site:hover { background: rgba(0,229,255,0.18); }

.copage-facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px; background: var(--line-soft); margin: 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.copage-fact {
  display: flex; justify-content: space-between; gap: 10px;
  background: var(--bg-page); padding: 8px 12px;
}
.copage-fact .k { color: var(--text-muted); font-size: 11px; }
.copage-fact .v {
  color: var(--text); font-size: 11.5px; font-weight: 500;
  text-align: right; font-variant-numeric: tabular-nums;
}

.copage-body p { font-size: 12.5px; line-height: 1.6; color: var(--text-soft); margin: 0 0 12px; }
.copage-body p:last-of-type { margin-bottom: 0; }
.copage-body b { color: var(--text); font-weight: 600; }
.copage-angle {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft);
  font-size: 12px; line-height: 1.55; color: var(--text-soft);
}
.copage-angle .lbl {
  display: block; margin-bottom: 3px; font-family: var(--font-head);
  color: var(--accent); font-weight: 600; font-size: 11px;
}

.lscape-foot {
  color: var(--text-faint);
  font-size: 10.5px;
  margin-top: 16px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  letter-spacing: 0;
  text-transform: none;
  text-align: left;
}

/* ---- mobile ---- */
@media (max-width: 720px) {
  .lscape-grid { grid-template-columns: 1fr; gap: 18px; }
  .lscape-box.span-full { grid-column: auto; }
  .lscape-tiles { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 6px; }
  .lscape-tile { padding: 9px; }
  .lscape-pop { width: 250px; }
}
@media (max-width: 420px) {
  .lscape-tiles { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
  .lscape-name { font-size: 12px; }
  .lscape-sub  { font-size: 10.5px; }
  .lscape-cap  { font-size: 11px; }
}
