/* Experiments index page styles. Shared tokens (.header, .btn-theme, .footer,
   --color-*, --radius-*, --font-*) come from ../shared/css/styles.css. */

/* The theme is grayscale end to end (shared/css/styles.css ships no accent and
   no --color-accent), so every state here is expressed with the existing
   neutral tokens — same idiom as var-simulator and image-filter:
     hover  -> --color-btn-hover / --color-text
     active -> --color-primary fill + --color-bg text
   Both themes flip those tokens, so nothing below needs a dark-mode override
   except --focus-ring, which has to stay light-on-dark. */
:root { --focus-ring: rgba(0, 0, 0, .10); }
body.dark-mode { --focus-ring: rgba(255, 255, 255, .16); }

/* Hover feedback on an already-selected pill pushes toward whichever end of the
   ramp means "more prominent" in that theme: darker charcoal on light, lighter on
   dark. Both ends are theme tokens, not new colours. */
:root { --pill-active-hover: var(--color-primary-dark); }
body.dark-mode { --pill-active-hover: var(--color-primary-light); }

.container { max-width: var(--max-width); margin: 0 auto; }

/* Breadcrumb */
.breadcrumb { font-size: var(--font-sm); margin-bottom: 10px; }
.breadcrumb a { color: var(--color-link); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* Hero */
.hero {
  text-align: center;
  padding: 10px 0 20px;
}
.hero .lead {
  color: var(--color-text-muted);
  font-size: var(--font-md);
  max-width: 700px;
  margin: 0 auto;
  line-height: 1.7;
}

/* Pipeline - compact inline */
.pipeline {
  text-align: center;
  margin: 12px auto 0;
  font-size: var(--font-sm);
  color: var(--color-text-muted);
}
.pipeline strong { color: var(--color-text); }

/* Search */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 520px;
  margin: 0 auto 10px;
}
.search-bar .search-input {
  flex: 1;
  background: var(--color-input-bg);
  border: 1px solid var(--color-input-border);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: var(--font-sm);
  font-family: inherit;
  color: var(--color-text);
  outline: none;
  transition: border-color var(--transition-normal) ease;
}
.search-bar .search-input::placeholder { color: var(--color-input-placeholder); }
.search-bar .search-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
/* Hide the native clear button; we render our own so both behave the same. */
.search-bar .search-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

.search-clear {
  background: var(--color-btn-bg);
  border: 1px solid var(--color-btn-border);
  border-radius: 999px;
  color: var(--color-text-muted);
  font-size: var(--font-sm);
  padding: 8px 14px;
  cursor: pointer;
  display: none;
  transition: all var(--transition-normal) ease;
}
/* Same hover shape as .btn-copy in the shared sheet. */
.search-clear:hover {
  background: var(--color-btn-hover);
  border-color: var(--color-input-border);
  color: var(--color-text);
}
.search-bar.has-query .search-clear { display: block; }

.result-count {
  text-align: center;
  font-size: var(--font-sm);
  color: var(--color-text-muted);
  margin: 0 auto 20px;
}
.result-count strong { color: var(--color-text); }

/* Search hits: one step darker than the card they sit on, plus a weight bump,
   so they stay findable without introducing a colour the theme does not use. */
mark {
  background: var(--color-input-border);
  color: var(--color-text);
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 0 2px;
}

/* Nav filter pills */
.nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 24px;
}
.nav button {
  background: var(--color-bg-secondary);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 6px 18px;
  font-size: var(--font-sm);
  cursor: pointer;
  transition: all .2s;
}
/* Hover: fill and label both step up one notch, so the pill reads as live even
   though there is no colour to light up with. */
.nav button:hover {
  background: var(--color-btn-hover);
  border-color: var(--color-input-border);
  color: var(--color-text);
}
/* Selected: filled charcoal in light mode, the inverse in dark mode - the theme
   already flips --color-primary and --color-bg together. */
.nav button.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-bg);
}
/* Selected + hovered stays filled, and steps further along the ramp. */
.nav button.active:hover {
  background: var(--pill-active-hover);
  border-color: var(--pill-active-hover);
  color: var(--color-bg);
}
.nav button:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Card grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.card h3 {
  font-size: var(--font-lg);
  margin: 0;
}
.card p {
  font-size: var(--font-sm);
  color: var(--color-text-muted);
  line-height: 1.55;
  margin: 0;
}
.card .tag {
  display: inline-block;
  font-size: var(--font-xs);
  font-family: monospace;
  background: var(--color-btn-bg);
  border: 1px solid var(--color-border);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  margin-top: 2px;
  width: fit-content;
}

/* Empty / error states span the whole grid */
.no-results,
.grid-status {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 20px;
  color: var(--color-text-muted);
  font-size: var(--font-md);
  line-height: 1.8;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
}
.no-results-query { color: var(--color-text); font-weight: 600; }
.no-results button {
  margin-top: 14px;
  background: var(--color-btn-bg);
  border: 1px solid var(--color-btn-border);
  border-radius: 999px;
  color: var(--color-text);
  font-size: var(--font-sm);
  padding: 7px 18px;
  cursor: pointer;
}
.no-results button:hover {
  background: var(--color-btn-hover);
  border-color: var(--color-input-border);
}
.grid-status.is-error { border-style: solid; }
.grid-status code {
  background: var(--color-bg-secondary);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  font-size: var(--font-sm);
}

@media (max-width: 768px) {
  .card-grid { grid-template-columns: 1fr; }
  .pipeline .arrow { display: none; }
  .search-bar { max-width: none; }
}
