/* Topic pages: /topics (all topics) and /topics/<topic>. Light and dark themes use the site variables. */

/* Hero */
.tp-hero .tp-badge { display: inline-grid; place-items: center; width: 56px; height: 56px; margin-bottom: 14px; border-radius: 16px;
  background: rgba(63,211,191,.14); color: #3FD3BF; font-size: 1.5rem; }
.tp-hero-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; padding: 0; list-style: none; }
.tp-hero-stats li { display: flex; align-items: baseline; gap: 6px; padding: 8px 14px; border: 1px solid rgba(255,255,255,.14); border-radius: 999px;
  background: rgba(255,255,255,.05); color: rgba(255,255,255,.75); font-size: .82rem; }
.tp-hero-stats strong { color: #fff; font-size: 1rem; font-weight: 600; }
.tp-hero-stats a { color: inherit; text-decoration: none; }
.tp-hero-stats a:hover strong { color: #3FD3BF; }
.tp-search { display: flex; align-items: center; gap: 10px; max-width: 460px; margin-top: 22px; padding: 10px 16px; border-radius: 999px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); color: rgba(255,255,255,.7); }
.tp-search input { flex: 1; border: 0; outline: 0; background: transparent; color: #fff; font: inherit; font-size: .95rem; }
.tp-search input::placeholder { color: rgba(255,255,255,.55); }

/* Section headings */
.tp-sec { margin: 0 0 44px; }
.tp-sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.tp-sec-head h2 { margin: 0; font-size: 1.3rem; font-weight: 500; color: var(--navy); }
.tp-sec-head p { margin: 4px 0 0; color: var(--text-muted); font-size: .88rem; }
.tp-sec-head .card-link { white-space: nowrap; }

/* Category mix bar */
.tp-mix { display: flex; height: 12px; overflow: hidden; border-radius: 999px; background: var(--line); margin: 6px 0 10px; }
.tp-mix span { display: block; height: 100%; }
.tp-mix-key { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; padding: 0; list-style: none; font-size: .8rem; color: var(--text-muted); }
.tp-mix-key i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 3px; vertical-align: -1px; }
.tp-c0 { background: #0D9B8A; } .tp-c1 { background: #1A5FA8; } .tp-c2 { background: #7C5CC4; } .tp-c3 { background: #E0A800; } .tp-c4 { background: #D9534F; }

/* Card grids */
.tp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tp-card { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: #fff;
  color: var(--text); text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
a.tp-card:hover, a.tp-card:focus-visible { border-color: var(--teal); box-shadow: 0 12px 28px rgba(11,31,58,.08); transform: translateY(-2px); color: var(--text); }
.tp-card h3 { margin: 0; font-size: .98rem; font-weight: 600; line-height: 1.35; color: var(--navy); }
.tp-card p { margin: 0; font-size: .84rem; line-height: 1.5; color: var(--text-muted); }
.tp-card .tp-go { margin-top: auto; font-size: .82rem; font-weight: 600; color: var(--teal); }
.tp-tag { align-self: flex-start; padding: 3px 9px; border-radius: 6px; font-size: .72rem; font-weight: 600; color: #fff; }
.tp-spark { display: block; width: 100%; height: 46px; margin: 2px 0; }
.tp-spark-line { fill: none; stroke: var(--teal); stroke-width: 2; vector-effect: non-scaling-stroke; }
.tp-spark-fill { fill: rgba(13,155,138,.1); stroke: none; }
.tp-story { padding: 0; overflow: hidden; }
.tp-story img, .tp-story .tp-noimg { display: block; width: 100%; height: 140px; object-fit: cover; }
.tp-story .tp-noimg { background: linear-gradient(135deg, var(--navy), var(--blue)); }
.tp-story > div { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px 18px; flex: 1; }

/* Companies */
.tp-cos { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.tp-co { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff;
  color: var(--text); text-decoration: none; font-size: .86rem; }
.tp-co:hover, .tp-co:focus-visible { border-color: var(--teal); color: var(--text); }
.tp-co img, .tp-co .tp-co-ic { flex: none; width: 32px; height: 32px; border-radius: 8px; object-fit: contain; background: #fff; border: 1px solid var(--line); }
.tp-co .tp-co-ic { display: grid; place-items: center; color: var(--gray-400); font-size: .8rem; }
.tp-co b { display: block; font-weight: 600; line-height: 1.25; }
.tp-co small { color: var(--text-muted); font-size: .74rem; }

/* Chips: markets by category, related topics */
.tp-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; padding: 0; list-style: none; }
.tp-chips a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff;
  color: var(--navy); font-size: .82rem; text-decoration: none; }
.tp-chips a:hover, .tp-chips a:focus-visible { border-color: var(--teal); color: var(--teal); }
.tp-chips i { color: var(--teal); }
.tp-cat-name { margin: 0 0 8px; font-size: .78rem; font-weight: 600; color: var(--text-muted); }

/* CTA band */
.tp-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; padding: 26px 28px; border-radius: 18px;
  background: linear-gradient(135deg, var(--navy), var(--navy-mid)); color: rgba(255,255,255,.8); }
.tp-cta h2 { margin: 0 0 4px; color: #fff; font-size: 1.2rem; font-weight: 500; }
.tp-cta p { margin: 0; font-size: .9rem; }
.tp-cta-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* All-topics page */
.tp-feature { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 44px; }
.tp-feature .tp-card { background: linear-gradient(160deg, #fff 60%, rgba(13,155,138,.07)); }
.tp-icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: rgba(13,155,138,.1); color: var(--teal); font-size: 1.05rem; }
.tp-counts { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; padding: 0; list-style: none; font-size: .78rem; color: var(--text-muted); }
.tp-counts b { color: var(--navy); font-weight: 600; }
.tp-group { margin: 0 0 34px; }
.tp-group h2 { margin: 0 0 14px; font-size: 1.1rem; font-weight: 500; color: var(--navy); }
.tp-mini { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.tp-mini a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff;
  color: var(--text); text-decoration: none; }
.tp-mini a:hover, .tp-mini a:focus-visible { border-color: var(--teal); color: var(--text); }
.tp-mini strong { display: block; font-size: .92rem; font-weight: 600; color: var(--navy); }
.tp-mini [hidden], .tp-group[hidden] { display: none; }
.tp-empty { color: var(--text-muted); }

/* Dark theme */
html[data-theme="dark"] .tp-card, html[data-theme="dark"] .tp-co, html[data-theme="dark"] .tp-chips a, html[data-theme="dark"] .tp-mini a { background: #0F1A2B; }
html[data-theme="dark"] .tp-feature .tp-card { background: linear-gradient(160deg, #0F1A2B 60%, rgba(13,155,138,.14)); }
html[data-theme="dark"] .tp-card h3, html[data-theme="dark"] .tp-sec-head h2, html[data-theme="dark"] .tp-group h2,
html[data-theme="dark"] .tp-mini strong, html[data-theme="dark"] .tp-chips a, html[data-theme="dark"] .tp-counts b { color: var(--text); }

@media (max-width: 700px) { .tp-sec-head { flex-direction: column; align-items: flex-start; } }
@media (prefers-reduced-motion: reduce) { .tp-card { transition: none; transform: none !important; } }

/* The search sits on the dark hero in both themes: no box of its own (the dark theme gives inputs a dark fill) */
.tp-search input, html[data-theme="dark"] .tp-search input { background: transparent !important; border: 0 !important; box-shadow: none !important; padding: 0; -webkit-appearance: none; appearance: none; }
.tp-search input::-webkit-search-cancel-button { filter: invert(1); opacity: .6; }
.tp-search:focus-within { border-color: #3FD3BF; box-shadow: 0 0 0 3px rgba(63,211,191,.18); }
/* The bottom band stays dark in both themes (keep-dark keeps --navy dark) */
.tp-cta { background: linear-gradient(135deg, #0B1F3A, #13305A); }
.tp-cta h2 { color: #fff; } .tp-cta p { color: rgba(255,255,255,.78); }
.tp-cta .btn-teal { background: var(--btn-teal, #2A8A80); border-color: var(--btn-teal, #2A8A80); color: #fff; }
.tp-cta .btn-teal:hover { background: var(--btn-teal-hover, #237A71); border-color: var(--btn-teal-hover, #237A71); }

/* ── Market statistics list and Top markets (pages/market-stats.php, pages/top-markets.php) ── */
.ms-lock { display: flex; gap: 10px; align-items: center; margin: 0 0 32px; padding: 12px 16px; border-radius: 12px; background: rgba(13,155,138,.08); color: var(--text-muted); font-size: .88rem; }
.ms-lock i { color: var(--teal); }
.ms-caticon { width: 34px; height: 34px; font-size: .9rem; color: #fff; vertical-align: -9px; margin-right: 6px; }
.ms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.ms-card { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff;
  color: var(--text); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.ms-card:hover, .ms-card:focus-visible { border-color: var(--teal); box-shadow: 0 8px 20px rgba(11,31,58,.07); color: var(--text); }
.ms-card strong { font-size: .93rem; font-weight: 600; line-height: 1.35; color: var(--navy); }
.ms-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .76rem; color: var(--text-muted); }
.ms-meta i { color: var(--teal); margin-right: 2px; }
.ms-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.ms-tags span { padding: 2px 8px; border-radius: 999px; background: rgba(13,155,138,.1); color: var(--teal); font-size: .7rem; font-weight: 600; }
.ms-card[hidden] { display: none; }
.top-cats { display: grid; gap: 18px; margin-bottom: 36px; }
.top-cat { padding: 22px 24px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.top-cat-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.top-cat-head h2 { margin: 0; font-size: 1.15rem; font-weight: 500; color: var(--navy); }
.top-cat-head p { margin: 2px 0 0; font-size: .82rem; color: var(--text-muted); }
.top-cat-head .card-link { margin-left: auto; white-space: nowrap; }
.top-places { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; padding: 0; list-style: none; }
.top-places a { display: inline-flex; align-items: center; gap: 7px; padding: 6px 8px 6px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--off-white, #F7F9FC); color: var(--navy); font-size: .82rem; text-decoration: none; }
.top-places a:hover, .top-places a:focus-visible { border-color: var(--teal); color: var(--teal); }
.top-places b { min-width: 24px; padding: 1px 7px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: .72rem; font-weight: 600; text-align: center; color: var(--text-muted); }
html[data-theme="dark"] .ms-card, html[data-theme="dark"] .top-cat { background: #0F1A2B; }
html[data-theme="dark"] .top-places a { background: #0B1424; color: var(--text); }
html[data-theme="dark"] .top-places b { background: #0F1A2B; }
html[data-theme="dark"] .ms-card strong, html[data-theme="dark"] .top-cat-head h2 { color: var(--text); }
@media (max-width: 700px) { .top-cat-head { flex-wrap: wrap; } .top-cat-head .card-link { margin-left: 0; } }
/* Category icon squares: solid category colour with a white icon (beats .tp-icon's pale fill) */
.tp-icon.ms-caticon.tp-c0 { background: #0D9B8A; } .tp-icon.ms-caticon.tp-c1 { background: #1A5FA8; } .tp-icon.ms-caticon.tp-c2 { background: #7C5CC4; }
.tp-icon.ms-caticon.tp-c3 { background: #E0A800; } .tp-icon.ms-caticon.tp-c4 { background: #D9534F; }
.tp-icon.ms-caticon { color: #fff; flex: none; }
