/* /categories/ (#51). Its own sheet so it stays clear of pages.css, which the
   gallery pages share. Tokens come from editorial.css, which loads after this
   one; anything defined here uses the cx- prefix so the two cannot collide. */

main.cx {
  max-width: 1200px;
  background-color: transparent;
  border: 0;
  box-shadow: none;
  padding: 0 24px;
  margin: 32px auto 64px;
}

main.cx h1 {
  margin: 18px 0 10px;
  font-size: 52px;
  line-height: 1.05;
  font-weight: 500;
  letter-spacing: -0.035em;
  text-align: left;
}

.cx-meta {
  margin: 0;
  font-family: var(--ed-mono, monospace);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ed-muted, #5f5f5c);
}

main.cx p.cx-intro {
  margin: 18px 0 0;
  max-width: 68ch;
  font-size: 18px;
  line-height: 1.6;
  text-align: left;
}

/* Controls */

.cx-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin: 28px 0 0;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--ed-rule, rgba(10, 10, 10, 0.14));
}

.cx-filter {
  flex: 1 1 300px;
  min-width: 0;
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 0 16px;
  background: var(--ed-card, #fff);
  border: 1px solid var(--ed-rule-strong, rgba(10, 10, 10, 0.3));
  border-radius: 999px;
}

.cx-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.cx-filter input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 16px;
  color: inherit;
  padding: 11px 0;
}

.cx-views {
  display: flex;
  gap: 8px;
}

.cx-view {
  min-height: 46px;
  padding: 0 18px;
  background: var(--ed-card, #fff);
  color: inherit;
  border: 1px solid rgba(10, 10, 10, 0.2);
  border-radius: 999px;
  font-family: var(--ed-mono, monospace);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

.cx-view:hover,
.cx-view.on {
  background: var(--ed-ink, #0a0a0a);
  border-color: var(--ed-ink, #0a0a0a);
  color: var(--ed-paper, #faf9f6);
}

.cx-count {
  margin: 0 0 0 auto;
  font-family: var(--ed-mono, monospace);
  font-size: 11px;
  color: var(--ed-muted, #5f5f5c);
}

/* Groups */

.cx-group {
  margin-top: 40px;
}

main.cx .cx-group h2 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ed-rule, rgba(10, 10, 10, 0.14));
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.cx-group h2 .cx-n {
  font-family: var(--ed-mono, monospace);
  font-size: 11px;
  font-weight: 400;
  color: var(--ed-muted, #5f5f5c);
}

.cx-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.cx-cat {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 60px;
  padding: 0 16px;
  background: var(--ed-card, #fff);
  border: 1px solid rgba(10, 10, 10, 0.18);
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
}

.cx-cat:hover {
  background: var(--ed-ink, #0a0a0a);
  border-color: var(--ed-ink, #0a0a0a);
  color: var(--ed-paper, #faf9f6);
}

.cx-name {
  font-size: 15px;
  font-weight: 500;
}

.cx-cat .cx-n {
  margin-left: auto;
  font-family: var(--ed-mono, monospace);
  font-size: 11px;
  color: var(--ed-muted, #5f5f5c);
}

.cx-cat:hover .cx-n {
  color: var(--ed-paper, #faf9f6);
}

.cx-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cx-chip {
  min-height: 44px;
  border-radius: 999px;
  padding: 0 16px;
}

.cx-empty {
  margin: 40px 0;
  font-size: 18px;
  color: var(--ed-body, #3a3a37);
}

/* Narrower screens: fewer columns, then one. */

@media (max-width: 1024px) {
  .cx-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  main.cx { padding: 0 18px; margin-top: 22px; }
  main.cx h1 { font-size: 34px; }
  main.cx p.cx-intro { font-size: 16px; }
  .cx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cx-cat { min-height: 54px; padding: 0 11px; gap: 8px; }
  .cx-name { font-size: 13px; line-height: 1.2; }
  main.cx .cx-group h2 { font-size: 22px; }
  /* The filter is the point of the page on a phone: keep it reachable. */
  .cx-controls {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--ed-paper, #faf9f6);
    padding-top: 10px;
  }
  .cx-count { width: 100%; margin-left: 0; }
}

/* Dark mode: same shapes, the tokens theme.css already ships. */

:root[data-theme='dark'] main.cx .cx-filter,
:root[data-theme='dark'] main.cx .cx-view,
:root[data-theme='dark'] main.cx .cx-cat {
  background-color: #26262b;
  border-color: #33333a;
  color: #e6e6e6;
}

:root[data-theme='dark'] main.cx .cx-view:hover,
:root[data-theme='dark'] main.cx .cx-view.on,
:root[data-theme='dark'] main.cx .cx-cat:hover {
  background-color: #f2f2f2;
  border-color: #f2f2f2;
  color: #121214;
}

:root[data-theme='dark'] main.cx .cx-cat:hover .cx-n {
  color: #121214;
}

@media (max-width: 768px) {
  :root[data-theme='dark'] .cx-controls { background: #121214; }
}
