/* ==========================================================================
   Advertising the Future — Dataset Explorer (copyright-safe version)
   ========================================================================== */

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #1a1a1a;
  background: #faf9f6;
}
a { color: #2c5282; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Header ---------- */
header {
  background: #1b2a4a;
  color: #fff;
  padding: 1.5rem 2rem 1rem;
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
}
header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.subtitle {
  margin: 0;
  font-size: 0.95rem;
  opacity: 0.85;
}
#site-nav {
  margin-top: 0.75rem;
}
#site-nav a {
  color: #cbd5e0;
  margin-right: 1.2rem;
  font-size: 0.85rem;
  text-decoration: none;
}
#site-nav a:hover,
#site-nav a.active {
  color: #fff;
  text-decoration: underline;
}

/* ---------- About section ---------- */
.about-section {
  max-width: 1400px;
  margin: 1.5rem auto 0.5rem;
  padding: 0 2rem;
  font-size: 0.9rem;
  color: #333;
}
.about-section p {
  margin: 0 0 0.75rem;
  max-width: 80ch;
}
.repo-links a {
  font-weight: 500;
}

/* ---------- Controls bar ---------- */
.controls-bar {
  max-width: 1400px;
  margin: 1rem auto 0.5rem;
  padding: 0.75rem 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: flex-end;
  background: #f0ede8;
  border-radius: 6px;
}
.control-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.control-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.control-group input,
.control-group select {
  font-size: 0.85rem;
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
}
.row-count {
  font-size: 0.85rem;
  color: #666;
  margin-left: auto;
  align-self: flex-end;
  padding-bottom: 4px;
}

/* ---------- Table ---------- */
.table-wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  overflow-x: auto;
}
#main-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
#main-table th {
  position: sticky;
  top: 0;
  background: #e8e4dd;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #444;
  border-bottom: 2px solid #c4bfb6;
  white-space: nowrap;
  cursor: default;
  z-index: 2;
}
th.sortable { cursor: pointer; }
th.sortable:hover { background: #ddd8cf; }
.sort-arrow {
  font-size: 0.75rem;
  opacity: 0.4;
}
th.sort-active .sort-arrow { opacity: 1; }

#main-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #e5e2dc;
  vertical-align: top;
}
#main-table tbody tr:hover {
  background: #f5f3ee;
}
.status-cell {
  text-align: center;
  padding: 2rem;
  color: #888;
  font-style: italic;
}

/* Column widths */
.col-words { min-width: 250px; max-width: 400px; }
.col-ia { white-space: nowrap; }

/* Magazine badge */
.mag-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
  text-transform: capitalize;
}
.mag-forbes   { background: #2b6cb0; }
.mag-life     { background: #c53030; }
.mag-time     { background: #2f855a; }
.mag-variety  { background: #6b46c1; }
.mag-esquire  { background: #c05621; }
.mag-crisis   { background: #4a5568; }
.mag-cosmo    { background: #d53f8c; }
.mag-lhj      { background: #805ad5; }

/* Category tag */
.cat-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.75rem;
  background: #e2e8f0;
  color: #2d3748;
}

/* Object tags */
.obj-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
.obj-tag {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 2px;
  font-size: 0.72rem;
  background: #ebf4ff;
  color: #2b6cb0;
}

/* Ad type badges */
.spread-badge, .mixed-badge, .type-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.72rem;
}
.spread-badge {
  background: #bee3f8;
  color: #2a4365;
}
.mixed-badge {
  background: #fed7e2;
  color: #702459;
}
.type-badge {
  background: #f0f0f0;
  color: #555;
}

/* OCR snippet pills (legacy) */
.snippet-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  max-width: 400px;
}
.snippet-pill {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 999px;
  font-size: 0.62rem;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.snippet-pill-more {
  background: #eee;
  color: var(--text-muted);
  font-style: italic;
}
.snippet-empty {
  font-size: 0.7rem;
  color: #bbb;
  font-style: italic;
}

/* Word pills (bag-of-words from OCR) */
.word-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  max-width: 380px;
}
.word-pill {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  background: #e8eef4;
  color: #2c5282;
  border-radius: 4px;
  font-size: 0.65rem;
  white-space: nowrap;
}
.word-pill-more {
  background: #eee;
  color: var(--text-muted);
  font-style: italic;
}

/* IA link */
.ia-link {
  font-size: 0.8rem;
  white-space: nowrap;
}

/* ---------- Pagination ---------- */
.pagination-bar {
  max-width: 1400px;
  margin: 1rem auto 2rem;
  padding: 0 2rem;
  display: flex;
  justify-content: center;
  gap: 4px;
}
.page-btn {
  padding: 6px 12px;
  font-size: 0.8rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  color: #333;
}
.page-btn:hover:not(:disabled) { background: #f0ede8; }
.page-btn.active {
  background: #1b2a4a;
  color: #fff;
  border-color: #1b2a4a;
}
.page-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.page-ellipsis {
  padding: 6px 4px;
  color: #999;
}

/* ---------- Footer ---------- */
footer {
  background: #1b2a4a;
  color: #cbd5e0;
  padding: 1.5rem 2rem;
  margin-top: 2rem;
  font-size: 0.85rem;
}
.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
}
footer p {
  margin: 0 0 0.5rem;
  max-width: 80ch;
}
footer a {
  color: #90cdf4;
}
footer strong {
  color: #fff;
}

/* ---------- Examples page ---------- */
.examples-section {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 2rem;
}
.examples-intro {
  margin-bottom: 2rem;
  font-size: 0.9rem;
  color: #333;
  line-height: 1.6;
}
.example-card {
  margin-bottom: 2.5rem;
  padding: 1.5rem;
  background: #fff;
  border: 1px solid #e2e0da;
  border-radius: 6px;
}
.example-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  color: #1b2a4a;
}
.example-card .example-meta {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 0.75rem;
}
.example-card .example-meta a {
  color: #2c5282;
}
.example-card .example-context {
  font-size: 0.9rem;
  color: #333;
  line-height: 1.6;
  margin-top: 0.75rem;
}
.example-card .example-context p {
  margin: 0 0 0.5rem;
}
.example-placeholder {
  background: #f0ede8;
  border: 1px dashed #c4bfb6;
  border-radius: 4px;
  padding: 2rem;
  text-align: center;
  color: #888;
  font-style: italic;
  margin: 0.75rem 0;
}

/* ---------- Timeline ---------- */
.timeline-grid {
  max-width: 1400px;
  margin: 1rem auto;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}
.tl-decade {
  background: #fff;
  border: 1px solid #e2ddd5;
  border-radius: 6px;
  padding: 1rem;
}
.tl-decade-label {
  font-size: 1.3rem;
  font-weight: 700;
  color: #1b2a4a;
}
.tl-decade-count {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 0.75rem;
}
.tl-samples {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tl-sample {
  display: block;
  font-size: 0.75rem;
  padding: 0.25rem 0.4rem;
  background: #f7f5f2;
  border-radius: 4px;
  color: #444;
  text-decoration: none;
}
.tl-sample:hover { background: #eee; text-decoration: none; }
.tl-empty {
  font-size: 0.8rem;
  color: #bbb;
  font-style: italic;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  header { padding: 1rem; }
  .about-section,
  .controls-bar,
  .table-wrap,
  .pagination-bar { padding-left: 1rem; padding-right: 1rem; }
  .controls-bar { gap: 0.5rem; }
  .col-words { min-width: 180px; }
}
