/* ---------- Tokens ---------- */
:root {
  --bg: #f7f8fa;
  --bg-card: #ffffff;
  --bg-card-hover: #fbfcfd;
  --border: #e2e4e8;
  --border-strong: #c7ccd3;
  --text-primary: #16202e;
  --text-muted: #5b6472;
  --text-faint: #87909c;
  --accent: #1f3a5f;
  --accent-dim: #33547e;
  --accent-bg: #eef2f6;
  --link: #1d4ed8;

  /* category colors — tuned for contrast on a light background */
  --cat-ai: #0e7490;
  --cat-local: #b45309;
  --cat-ecom: #be185d;
  --cat-marketing: #6d28d9;
  --cat-physical: #a16207;
  --cat-digital: #047857;

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.5;
}

a { color: inherit; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Hero (compact 3-line header) ---------- */
.hero {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px 16px;
  text-align: center;
  background: #0d0d0d;
  color: #fff;
}
.hero-inner { max-width: 720px; margin: 0 auto; }

.title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.about-link {
  text-decoration: none;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  transition: color 0.15s, border-color 0.15s;
}
.about-link:hover { color: #fff; border-color: rgba(255, 255, 255, 0.7); }

.wordmark-link {
  display: inline-block;
  text-decoration: none;
}

.hero-title {
  margin: 0;
  min-height: clamp(30px, 5.2vw, 40px);
  display: flex;
  align-items: center;
}

.hero-logo-img {
  height: clamp(30px, 5.2vw, 40px);
  width: auto;
  max-width: 100%;
  display: block;
  /* If the file ever fails to load, fall back to readable white wordmark text
     instead of clipped/broken-icon alt text. */
  font-family: 'Archivo Black', 'Arial Black', Impact, var(--font-display), sans-serif;
  font-size: 1.6rem;
  color: #fff;
  letter-spacing: -0.01em;
}

.hero-sub {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  margin: 12px 0 0;
}

/* ---------- Tool section (search/controls, boxed by a double rule) ----------
   .controls-row must be a direct child of the tall .browse/#browse container
   (not nested in a short wrapper) for its position:sticky to actually work —
   sticky is bounded by its own parent's box, so a short parent stops it dead
   the moment you scroll past that parent, regardless of how tall any further
   ancestor is. The double-rule "boxed" look from the old .tool-section wrapper
   is recreated here as a top border on .controls-row (the box's top edge) and
   a bottom border + matching background on .tool-section-lower (the bottom
   edge), rather than one wrapping element around both. */
.tool-section-lower {
  background: var(--bg-card);
  border-bottom: 5px double var(--text-primary);
  padding: 0 0 4px;
}

/* ---------- Controls row (saved + search instruction + download) ---------- */
.browse { max-width: 1200px; margin: 0 auto; padding: 8px 24px 80px; background: #edeff2; }

/* Sticky on every screen size, including mobile — this is the one thing
   that should never scroll out of reach while browsing gig cards. */
/* No max-width/margin here on purpose — .browse (its parent) already caps
   content at 1200px and centers it, so duplicating that here would double
   the horizontal padding versus the card grid below it. */
.controls-row {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-top: 5px double var(--text-primary);
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  justify-items: center;
  gap: 14px;
  padding: 8px 0;
}
@media (max-width: 760px) {
  .controls-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    text-align: center;
    padding: 8px 4px;
  }
}

.saved-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  white-space: nowrap;
}

.search-row {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  flex: 1 1 320px;
  max-width: 460px;
  margin: 0 auto;
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-faint);
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1.5px solid var(--border-strong);
  border-right: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 12px 34px 12px 40px;
  border-radius: 10px 0 0 10px;
  outline: none;
  box-shadow: 0 1px 3px rgba(22, 32, 46, 0.06);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input::placeholder { color: var(--text-faint); }
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
  z-index: 1;
}

.clear-search-btn {
  position: absolute;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: color 0.15s, background 0.15s;
}
.clear-search-btn:hover { color: var(--accent); background: var(--accent-bg); }

.search-submit-btn {
  flex: 0 0 auto;
  background: var(--accent);
  color: #fff;
  border: 1.5px solid var(--accent);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0 20px;
  border-radius: 0 10px 10px 0;
  cursor: pointer;
  transition: background 0.15s;
}
.search-submit-btn:hover { background: var(--accent-dim); border-color: var(--accent-dim); }

.search-feedback {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 4px 0 0;
  min-height: 1.2em;
}

.search-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px 0;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
}
.search-loading[hidden] { display: none; }

.spinner {
  width: 17px;
  height: 17px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.saved-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.saved-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.saved-toggle input { accent-color: var(--accent); cursor: pointer; }

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.82rem;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.download-btn svg { flex-shrink: 0; }
.download-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
.download-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.db-links-row {
  text-align: center;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 10px 0 2px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.db-links-row .db-count { color: var(--text-primary); font-weight: 600; }
.db-links-row .db-sep { color: var(--border-strong); }
@media (max-width: 560px) {
  .db-links-row { flex-direction: column; gap: 4px; }
  .db-links-row .db-sep { display: none; }
}

.empty-state {
  color: var(--text-muted);
  font-size: 0.95rem;
  text-align: center;
  padding: 60px 20px;
}

/* ---------- Sort control ---------- */
.sort-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sort-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.sort-select {
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 3px 8px;
  cursor: pointer;
}
.sort-select:hover { border-color: var(--accent); }

.same-producer-note {
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--accent-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  margin: 0 0 14px;
}

/* ---------- Grid ---------- */
.grid {
  display: block;
  border-bottom: 3px solid var(--text-primary);
  min-width: 0;
}
.grid[hidden] { display: none; }

.card {
  border-top: 3px solid var(--text-primary);
  padding: 18px 0;
  min-width: 0;
}
.grid .card:first-child {
  border-top: none;
  padding-top: 4px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 0;
}

.card-title-block {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.12s;
}
.card-title-block:hover { background: var(--accent-bg); }
.card-title-block:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--border-strong);
}
.card-avatar-placeholder {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--accent-bg);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.card-avatar-placeholder[hidden] { display: none; }
@media (max-width: 760px) {
  .card-avatar-placeholder { width: 80px; height: 80px; font-size: 0.92rem; }
}

.card-title-text {
  min-width: 0;
  flex: 1 1 auto;
}

.card-details { margin-top: 8px; }

/* Slightly larger than .card-meta (0.9rem) below it — enough to read as
   the title, not dominant. Same size on every screen width, since the
   size relationship to .card-meta should hold regardless of viewport. */
.card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--text-primary);
}
@media (max-width: 760px) {
  .card-avatar { width: 80px; height: 80px; }
}

.card-meta {
  font-size: 0.9rem;
  line-height: 1.3;
  color: var(--text-muted);
  margin: 2px 0 0;
}

.card-date {
  font-size: 0.8rem;
  line-height: 1.3;
  color: var(--text-faint);
  margin: 2px 0 0;
}

.card-section {
  border-top: 1px solid var(--border-strong);
  padding-top: 6px;
  margin-top: 8px;
}
.card-section:first-of-type { margin-top: 0; }

.card-section-label {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-primary);
  margin-bottom: 3px;
  line-height: 1.1;
}

.card-text {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-primary);
  margin: 0;
}
.card-text a {
  color: var(--link);
  text-decoration: none;
  word-break: break-all;
}
.card-text a:hover { text-decoration: underline; }

/* ---------- Action row: save + copy (top-right of card) ---------- */
.card-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
@media (max-width: 640px) {
  .card-head { flex-direction: column; align-items: flex-start; }
  .card-actions { align-items: flex-start; }
}

.save-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.save-toggle input { accent-color: var(--accent); cursor: pointer; width: 16px; height: 16px; }
.save-toggle.saved { color: var(--accent); font-weight: 600; }
.save-toggle .bookmark-icon { flex-shrink: 0; }

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--text-faint);
  font-family: var(--font-body);
  font-size: 0.82rem;
  cursor: pointer;
  text-align: left;
  padding: 0;
  white-space: nowrap;
  transition: color 0.15s;
}
.copy-btn svg { flex-shrink: 0; }
.copy-btn:hover { color: var(--accent); }

.expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-bg);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 5px 10px;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.expand-btn:hover { background: var(--border); border-color: var(--accent); }
.expand-chevron { display: inline-flex; transition: transform 0.15s; }
.expand-btn[aria-expanded="true"] .expand-chevron { transform: rotate(180deg); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
}
.footer-inner {
  color: var(--text-faint);
  font-size: 0.85rem;
  max-width: 600px;
  margin: 0 auto;
}

/* ---------- Focus visibility ---------- */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Back to search button ---------- */
.back-to-search-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.88rem;
  padding: 12px 20px;
  border-radius: 30px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(22, 32, 46, 0.28);
  z-index: 45;
  transition: background 0.15s, transform 0.15s;
}
.back-to-search-btn:hover { background: var(--accent-dim); transform: translateY(-1px); }
.back-to-search-btn[hidden] { display: none; }

@media (max-width: 480px) {
  .back-to-search-btn {
    bottom: 16px;
    right: 16px;
    padding: 11px 16px;
    font-size: 0.82rem;
  }
}

/* ---------- Secondary-page header (About page) ---------- */
/* Previously undefined — logo rendered at native 1782x169px with no constraint. */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
}
.header-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.wordmark-logo {
  display: block;
  height: auto;
  width: min(30%, 220px);
}
.site-nav {
  display: flex;
  gap: 20px;
}
.site-nav a {
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.95rem;
}
.site-nav a:hover { color: var(--accent); }

@media (max-width: 480px) {
  .wordmark-logo { width: min(45%, 160px); }
  .site-nav a { font-size: 0.88rem; }
}
