/* === AI App Marketplace Tracker === */
/* AdamGTM brand fonts: Instrument Serif, Inter, Spline Sans Mono */

:root {
  --bg: #030712;
  --bg-surface: #0a0e17;
  --bg-card: #111827;
  --text: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #484f58;
  --grid: #1b2232;
  --grid-strong: #2a3444;

  --claude: #f97316;
  --claude-dim: rgba(249, 115, 22, 0.15);
  --chatgpt: #10b981;
  --chatgpt-dim: rgba(16, 185, 129, 0.15);
  --both: #008bf9;
  --both-dim: rgba(0, 139, 249, 0.15);
  --missing-red: #f87171;
  --missing-dim: rgba(248, 113, 113, 0.08);
  --accent: lab(92.1406% -20.4979 84.7726);
  --accent-dim: rgba(200, 238, 0, 0.15);

  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'Inter', -apple-system, sans-serif;
  --mono: 'Spline Sans Mono', 'SF Mono', monospace;
  --transition: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.page { max-width: 1100px; margin: 0 auto; }
.grid-row { border-bottom: 1px solid var(--grid); padding: 0 24px; }

/* === Brand === */
.brand-row { padding: 14px 24px; position: sticky; top: 0; z-index: 50; background: var(--bg); display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 28px; height: 28px; filter: invert(1); }
.brand-text { font-family: var(--mono); font-size: 0.7rem; color: var(--text-muted); }
.brand-text a { color: var(--text-secondary); text-decoration: none; border-bottom: 1px solid var(--grid-strong); }
.brand-text a:hover { color: var(--text); }

/* === Title + Stats === */
.title-row { display: flex; align-items: stretch; }

.title-cell {
  flex: 1;
  padding: 20px 24px 20px 0;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.title-cell h1 {
  font-family: var(--serif);
  font-size: 2.3rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.updated-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--grid);
  padding: 3px 10px;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background: #22c55e;
  display: inline-block;
  animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; box-shadow: 0 0 4px rgba(34, 197, 94, 0.6); }
  50% { opacity: 0.3; box-shadow: none; }
}

.stat-cell {
  padding: 14px 24px;
  border-left: 1px solid var(--grid);
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 90px;
}

.stat-number {
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-family: var(--mono);
  font-size: 0.55rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* === Chart === */
.chart-row { padding: 16px 24px 24px; }

.chart-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.chart-legend {
  display: flex;
  gap: 16px;
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--text-muted);
}

.legend-bar {
  display: inline-block;
  width: 12px;
  height: 8px;
  margin-right: 4px;
  vertical-align: middle;
}

.timeline-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 200px;
  padding-bottom: 28px;
  position: relative;
}

.timeline-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 36px;
  height: 100%;
  justify-content: flex-end;
  position: relative;
  cursor: pointer;
}

.timeline-bar:hover .bar-stack { opacity: 0.8; }

.bar-stack { width: 100%; display: flex; flex-direction: column-reverse; gap: 1px; transition: opacity var(--transition); }
.bar-seg-claude { background: var(--claude); width: 100%; }
.bar-seg-chatgpt { background: var(--chatgpt); width: 100%; }

.timeline-bar.forecast .bar-seg-claude {
  background: repeating-linear-gradient(-45deg, var(--claude), var(--claude) 2px, transparent 2px, transparent 5px);
  opacity: 0.45;
}
.timeline-bar.forecast .bar-seg-chatgpt {
  background: repeating-linear-gradient(-45deg, var(--chatgpt), var(--chatgpt) 2px, transparent 2px, transparent 5px);
  opacity: 0.45;
}

.bar-count { font-family: var(--mono); font-size: 0.5rem; color: var(--text-secondary); margin-bottom: 2px; }
.timeline-bar.forecast .bar-count { color: var(--text-muted); }
.bar-label { font-family: var(--mono); font-size: 0.45rem; color: var(--text-muted); position: absolute; bottom: -20px; white-space: nowrap; }

.bar-logos { display: flex; flex-wrap: wrap; gap: 1px; justify-content: center; margin-bottom: 2px; max-width: 100%; overflow: hidden; }
.bar-logo { width: 14px; height: 14px; object-fit: contain; background: #fff; }
.bar-logo.placeholder { background: var(--bg-card); border: 1px dashed var(--grid-strong); color: var(--text-muted); font-family: var(--mono); font-size: 0.45rem; display: flex; align-items: center; justify-content: center; }

.forecast-divider { width: 1px; height: 100%; background: var(--grid-strong); min-width: 1px; align-self: stretch; position: relative; }
.forecast-divider::after { content: 'FORECAST'; position: absolute; top: 0; left: 6px; font-family: var(--mono); font-size: 0.45rem; color: var(--text-muted); letter-spacing: 0.08em; white-space: nowrap; }

.timeline-cta { text-align: center; font-family: var(--serif); font-size: 0.95rem; color: var(--text-muted); margin-top: 14px; }

/* Chart hover tooltip */
.chart-tooltip {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--grid-strong);
  padding: 8px 12px;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text);
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s;
  white-space: nowrap;
}
.chart-tooltip.visible { opacity: 1; }

/* === Ticker === */
.ticker-row { overflow: hidden; padding: 0; height: 48px; }

.ticker-track {
  display: flex;
  animation: tickerScroll 120s linear infinite;
  width: max-content;
}

@keyframes tickerScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ticker-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-right: 1px solid var(--grid);
  white-space: nowrap;
  flex-shrink: 0;
  height: 48px;
  cursor: pointer;
  transition: background var(--transition);
}

.ticker-card:hover { background: var(--bg-surface); }

.ticker-logo { width: 24px; height: 24px; background: #fff; object-fit: contain; }
.ticker-name { font-family: var(--mono); font-size: 0.65rem; color: var(--text); }
.ticker-meta { font-family: var(--mono); font-size: 0.55rem; }

.platform-tag { padding: 1px 5px; font-size: 0.5rem; font-family: var(--mono); }
.platform-tag.tag-claude { background: var(--claude-dim); color: var(--claude); }
.platform-tag.tag-chatgpt { background: var(--chatgpt-dim); color: var(--chatgpt); }
.platform-tag.tag-both { background: var(--both-dim); color: var(--both); }

.ticker-date { font-size: 0.5rem; color: var(--text-muted); margin-left: 4px; }

/* === Explore (centered) === */
.explore-row { padding: 32px 24px; }

.explore-inner {
  max-width: 520px;
  margin: 0 auto;
  text-align: center;
}

.explore-label {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.dropdown-wrap { position: relative; display: flex; align-items: center; }

.dropdown-icon { position: absolute; left: 16px; color: var(--accent); z-index: 1; pointer-events: none; display: flex; }

.category-select {
  width: 100%;
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
  padding: 16px 48px 16px 48px;
  background: var(--bg-surface);
  border: 2px solid var(--accent);
  color: var(--text);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: all var(--transition);
  box-shadow: 0 0 24px var(--accent-dim), 0 0 60px rgba(200, 238, 0, 0.06);
}

.category-select:hover { box-shadow: 0 0 32px rgba(200, 238, 0, 0.25); }
.category-select:focus { outline: none; box-shadow: 0 0 40px rgba(200, 238, 0, 0.3); }
.category-select option { background: var(--bg-card); color: var(--text); }

.dropdown-arrow { position: absolute; right: 16px; color: var(--accent); pointer-events: none; }

.rotate-indicator { width: 100%; height: 2px; background: var(--grid); margin-top: 6px; overflow: hidden; position: relative; }
.rotate-indicator .progress { position: absolute; left: 0; top: 0; height: 100%; background: var(--accent); width: 0; transition: width linear; }

/* === Story === */
.story-row { padding: 20px 24px; }
.story-label { font-family: var(--mono); font-size: 0.6rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 6px; }
.story-text { font-family: var(--sans); font-size: 0.85rem; color: var(--text-secondary); line-height: 1.65; max-width: 720px; }

/* === Platform Bar === */
.bar-row { padding: 14px 24px; }
.platform-bar { display: flex; height: 4px; overflow: hidden; }
.platform-bar .seg-claude { background: var(--claude); }
.platform-bar .seg-both { background: var(--both); }
.platform-bar .seg-chatgpt { background: var(--chatgpt); }
.platform-legend { display: flex; gap: 20px; margin-top: 6px; font-size: 0.6rem; color: var(--text-muted); font-family: var(--mono); }
.platform-legend .dot { display: inline-block; width: 8px; height: 8px; margin-right: 4px; vertical-align: middle; }

/* === Players === */
.players-row { padding: 24px; }
.players-title { font-family: var(--mono); font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: 20px; }
.platform-section { margin-bottom: 24px; }
.platform-section-title { font-family: var(--mono); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--grid); display: flex; align-items: center; gap: 8px; }
.platform-section-title .count { color: var(--text-secondary); }
.company-grid { display: flex; flex-wrap: wrap; gap: 8px; }

/* === Tiles === */
.company-tile { width: 72px; text-align: center; cursor: pointer; transition: transform var(--transition); }
.company-tile:hover { transform: translateY(-3px); }

.tile-logo-wrap {
  width: 64px; height: 64px; margin: 0 auto 4px; background: #fff;
  display: flex; align-items: center; justify-content: center;
  position: relative; border: 2px solid var(--grid); transition: all var(--transition); overflow: hidden;
}
.tile-logo-wrap img { width: 44px; height: 44px; object-fit: contain; }
.tile-logo-wrap .fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 1.4rem; font-weight: 700; color: #fff; }
.tile-badge { position: absolute; top: 0; right: 0; width: 10px; height: 10px; z-index: 1; }
.tile-name { font-family: var(--sans); font-size: 0.58rem; color: var(--text-muted); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 72px; }

.company-tile.platform-both .tile-logo-wrap { border-color: var(--both); }
.company-tile.platform-claude .tile-logo-wrap { border-color: var(--claude); }
.company-tile.platform-chatgpt .tile-logo-wrap { border-color: var(--chatgpt); }
.company-tile.platform-both:hover .tile-logo-wrap { box-shadow: 0 0 16px var(--both-dim); }
.company-tile.platform-claude:hover .tile-logo-wrap { box-shadow: 0 0 16px var(--claude-dim); }
.company-tile.platform-chatgpt:hover .tile-logo-wrap { box-shadow: 0 0 16px var(--chatgpt-dim); }
.company-tile.platform-both .tile-badge { background: var(--both); }
.company-tile.platform-claude .tile-badge { background: var(--claude); }
.company-tile.platform-chatgpt .tile-badge { background: var(--chatgpt); }

/* === Gap === */
.gap-row { padding: 0; }
.gap-section { padding: 24px; border-top: 1px dashed var(--missing-red); background: var(--missing-dim); }
.gap-header { margin-bottom: 20px; }
.gap-label { font-family: var(--mono); font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--missing-red); margin-bottom: 6px; }
.gap-stat { font-family: var(--mono); font-size: 0.95rem; font-weight: 700; }
.gap-stat span { color: var(--missing-red); }
.gap-desc { font-family: var(--sans); font-size: 0.75rem; color: var(--text-secondary); margin-top: 4px; }
.gap-grid { display: flex; flex-wrap: wrap; gap: 8px; }

.company-tile.missing .tile-logo-wrap { border-color: var(--grid); filter: grayscale(1); opacity: 0.35; }
.company-tile.missing:hover .tile-logo-wrap { filter: grayscale(0); opacity: 1; border-color: var(--missing-red); box-shadow: 0 0 12px rgba(248, 113, 113, 0.2); }
.company-tile.missing .tile-name { color: var(--text-muted); }
.company-tile.missing:hover .tile-name { color: var(--text-secondary); }

/* === Tooltip === */
.tooltip { position: fixed; background: var(--bg-card); border: 1px solid var(--grid-strong); padding: 8px 12px; font-size: 0.7rem; color: var(--text); max-width: 260px; z-index: 100; pointer-events: none; opacity: 0; transition: opacity 0.1s; box-shadow: 0 4px 24px rgba(0,0,0,0.5); font-family: var(--sans); }
.tooltip.visible { opacity: 1; }
.tooltip .tt-company { font-weight: 600; font-family: var(--mono); margin-bottom: 2px; }
.tooltip .tt-desc { color: var(--text-secondary); line-height: 1.3; font-size: 0.65rem; }
.tooltip .tt-platforms { margin-top: 4px; font-size: 0.55rem; color: var(--text-muted); font-family: var(--mono); }

/* === Footer === */
.footer-row { padding: 32px 24px; text-align: center; font-size: 0.6rem; color: var(--text-muted); font-family: var(--mono); }
.footer-row a { color: var(--text-secondary); text-decoration: none; border-bottom: 1px solid var(--grid); }
.footer-row a:hover { color: var(--text); }

/* ===== COMPANY DETAIL PAGE ===== */
.back-row { padding: 16px 24px; }
.back-link { font-family: var(--mono); font-size: 0.75rem; color: var(--text-secondary); text-decoration: none; }
.back-link:hover { color: var(--text); }

.company-hero-row { padding: 32px 24px; display: flex; align-items: center; gap: 24px; }
.co-logo { width: 80px; height: 80px; background: #fff; display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.co-logo img { width: 56px; height: 56px; object-fit: contain; }
.co-info h2 { font-family: var(--serif); font-size: 2.3rem; font-weight: 600; }
.co-meta { font-family: var(--mono); font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; display: flex; gap: 16px; flex-wrap: wrap; }

.company-marketplace-row { padding: 24px; display: flex; gap: 16px; flex-wrap: wrap; }

.marketplace-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border: 2px solid var(--grid-strong);
  text-decoration: none;
  color: var(--text);
  transition: all var(--transition);
  flex: 1;
  min-width: 240px;
}

.marketplace-link:hover { border-color: var(--text-secondary); background: var(--bg-surface); }
.marketplace-link.link-claude { border-color: var(--claude); }
.marketplace-link.link-claude:hover { box-shadow: 0 0 20px var(--claude-dim); }
.marketplace-link.link-chatgpt { border-color: var(--chatgpt); }
.marketplace-link.link-chatgpt:hover { box-shadow: 0 0 20px var(--chatgpt-dim); }

.ml-icon { flex-shrink: 0; }
.ml-icon img { width: 28px; height: 28px; object-fit: contain; }
.ml-text { font-family: var(--mono); font-size: 0.85rem; white-space: nowrap; }

.company-strategy-row { padding: 24px; }
.strategy-label { font-family: var(--mono); font-size: 0.6rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 10px; }
.strategy-text { font-family: var(--sans); font-size: 0.9rem; color: var(--text-secondary); line-height: 1.7; max-width: 720px; }

.company-details-row { padding: 24px; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0; }
.detail-cell { padding: 14px 16px; border: 1px solid var(--grid); }
.detail-label { font-family: var(--mono); font-size: 0.55rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; }
.detail-value { font-family: var(--mono); font-size: 0.8rem; color: var(--text); }
.detail-value a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent-dim); }
.detail-value a:hover { border-color: var(--accent); }

.marketplace-link.link-disabled {
  opacity: 0.3;
  pointer-events: none;
  border-color: var(--grid);
}

/* === Subscribe Button === */
.subscribe-btn {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.subscribe-btn:hover {
  background: var(--accent);
  color: var(--bg);
}

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
  align-items: flex-start;
  padding-top: 10vh;
}

.modal {
  background: var(--bg);
  border: 1px solid var(--grid-strong);
  padding: 32px;
  max-width: 440px;
  width: 90%;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover { color: var(--text); }

.modal-title {
  font-family: var(--serif);
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.form-group select,
.form-group input {
  width: 100%;
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--grid-strong);
  color: var(--text);
  transition: border-color var(--transition);
}

.form-group select:focus,
.form-group input:focus {
  outline: none;
  border-color: var(--accent);
}

.form-group select option {
  background: var(--bg-card);
  color: var(--text);
}

.form-hint {
  font-family: var(--sans);
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 4px;
  display: block;
}

.form-submit {
  width: 100%;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 12px;
  background: var(--accent);
  border: none;
  color: var(--bg);
  cursor: pointer;
  transition: opacity var(--transition);
  margin-top: 8px;
}

.form-submit:hover { opacity: 0.9; }

.form-success {
  text-align: center;
  padding: 24px 0;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--text);
}

.success-check {
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 8px;
}

/* === Responsive === */
@media (max-width: 768px) {
  .title-row { flex-wrap: wrap; }
  .title-cell { flex: 1 1 100%; padding: 16px 0; }
  .title-cell h1 { font-size: 1.3rem; }
  .stat-cell { flex: 1; padding: 10px 14px; min-width: 70px; }
  .stat-cell:first-of-type { border-left: none; }
  .stat-number { font-size: 1.2rem; }
  .explore-label { font-size: 1.2rem; }
  .category-select { font-size: 0.85rem; padding: 14px 40px; }
  .timeline-chart { height: 150px; }
  .timeline-bar { min-width: 28px; }
  .company-tile { width: 64px; }
  .tile-logo-wrap { width: 56px; height: 56px; }
  .tile-logo-wrap img { width: 36px; height: 36px; }
  .company-hero-row { flex-direction: column; align-items: flex-start; }
  .company-marketplace-row { flex-direction: column; }
}
