/* Public category directory; loaded after the shared shell. */
body.page-categories {
  --cats-bg: #faf9fc;
  --cats-card: #fff;
  --cats-ink: #282238;
  --cats-muted: #736c80;
  --cats-line: #e9e4ee;
  --cats-primary: #70459b;
  --cats-soft: #f1ebf7;
}
body.page-categories,
body.page-categories .page-content { background: var(--cats-bg) !important; }
body.page-categories .cats-page {
  width: min(1180px, 100%);
  margin-inline: auto;
  padding: 32px 24px calc(96px + env(safe-area-inset-bottom, 0px));
}
body.page-categories .cats-header { display: flex; align-items: center; gap: 18px; margin-bottom: 28px; }
body.page-categories .cats-back {
  width: 44px; height: 44px; flex: 0 0 auto; display: grid; place-items: center;
  border: 1px solid var(--cats-line); border-radius: 14px;
  background: var(--cats-card); color: var(--cats-primary); cursor: pointer;
}
body.page-categories .cats-back svg { width: 20px; height: 20px; }
body.page-categories .cats-head-text { min-width: 0; }
body.page-categories .cats-head-text h1 {
  margin: 0 0 6px; color: var(--cats-ink) !important;
  font-size: clamp(24px, 2.6vw, 32px); font-weight: 850; line-height: 1.4;
}
body.page-categories .cats-head-text p { margin: 0; color: var(--cats-muted); font-size: 14px; line-height: 1.8; }
body.page-categories .cats-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
body.page-categories .cats-search {
  display: flex; align-items: center; gap: 12px; width: min(520px, 100%); min-width: 0;
  min-height: 56px; padding-inline: 16px 6px; background: var(--cats-card);
  border: 1px solid var(--cats-line); border-radius: 16px; color: var(--cats-primary);
  box-shadow: 0 3px 12px rgba(44, 25, 67, .025); transition: border-color .18s, box-shadow .18s;
}
body.page-categories .cats-search > svg { flex-shrink: 0; }
body.page-categories .cats-search .sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
body.page-categories .cats-search:focus-within {
  border-color: var(--cats-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cats-primary) 14%, transparent);
}
/* The shared shell sets input backgrounds and borders with !important. */
body.page-categories #cats-search {
  width: 100%; min-width: 0; min-height: 52px; padding: 0;
  border: 0 !important; border-radius: 0; background: transparent !important;
  box-shadow: none !important; outline: none; color: var(--cats-ink) !important;
  font: inherit; font-size: 14px;
}
body.page-categories #cats-search::placeholder { color: var(--cats-muted) !important; opacity: 1; }
body.page-categories #cats-search::-webkit-search-cancel-button { display: none; }
body.page-categories .cats-clear {
  flex: 0 0 44px; width: 44px; height: 44px; display: grid; place-items: center;
  border: 0; border-radius: 11px; background: transparent; color: var(--cats-muted); cursor: pointer;
}
body.page-categories .cats-clear:hover { background: var(--cats-soft); }
body.page-categories .cats-browse {
  display: inline-flex; align-items: center; gap: 12px; min-height: 44px;
  color: var(--cats-primary); font-size: 13px; font-weight: 750; text-decoration: none;
}
body.page-categories .cats-browse:hover span { text-decoration: underline; text-underline-offset: 5px; }
body.page-categories .cats-summary { min-height: 22px; margin: 23px 0 14px; color: var(--cats-muted); font-size: 12px; font-weight: 650; }
body.page-categories .cats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
body.page-categories .cat-card {
  --accent: #7850a7;
  position: relative; min-width: 0; min-height: 188px; padding: 22px 20px 17px;
  display: flex; flex-direction: column; align-items: flex-start;
  background: var(--cats-card); border: 1px solid var(--cats-line); border-radius: 22px;
  text-decoration: none; color: var(--cats-ink); box-shadow: 0 4px 16px rgba(35, 24, 47, .025);
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
body.page-categories .cat-card::before {
  content: ""; position: absolute; inset-inline-end: 20px; top: 22px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: .4;
}
body.page-categories .cat-ic {
  display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 17px;
  border-radius: 15px; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--cats-card));
}
body.page-categories .cat-ic svg { width: 25px; height: 25px; }
body.page-categories .cat-nm {
  margin: 0 0 20px; color: var(--cats-ink) !important; font-size: 15px !important;
  font-weight: 750 !important; line-height: 1.65; overflow-wrap: anywhere;
}
body.page-categories .cat-action {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  width: 100%; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--cats-line);
  color: var(--cats-muted); font-size: 11px; font-weight: 650;
}
body.page-categories .cat-arrow { width: 17px; height: 17px; flex-shrink: 0; color: var(--cats-primary); }
@media (hover: hover) {
  body.page-categories .cat-card:hover {
    transform: translateY(-4px);
    border-color: color-mix(in srgb, var(--accent) 45%, var(--cats-line));
    box-shadow: 0 14px 30px rgba(63, 38, 86, .09);
  }
  body.page-categories .cat-card:hover .cat-action { color: var(--cats-primary); }
}
body.page-categories :is(.cat-card, .cats-back, .cats-clear, .cats-browse, .cats-retry):focus-visible {
  outline: 3px solid var(--cats-primary); outline-offset: 4px;
}
body.page-categories .cat-skeleton {
  min-height: 224px; border: 1px solid var(--cats-line); border-radius: 22px;
  background: linear-gradient(100deg, var(--cats-soft) 25%, var(--cats-card) 45%, var(--cats-soft) 65%);
  background-size: 250% 100%; animation: cats-shimmer 1.5s ease infinite;
}
@keyframes cats-shimmer { to { background-position: -170% 0; } }
body.page-categories .cats-empty {
  padding: 48px 20px; border: 1px solid var(--cats-line); border-radius: 22px;
  text-align: center; background: var(--cats-card);
}
body.page-categories .cats-empty-mark {
  width: 60px; height: 60px; margin: 0 auto 18px; border-radius: 20px;
  display: grid; place-items: center; color: var(--cats-primary); background: var(--cats-soft);
}
body.page-categories .cats-empty h2 { margin: 0; font-size: 18px; color: var(--cats-ink) !important; }
body.page-categories .cats-empty p { margin: 8px 0 0; font-size: 13px; line-height: 1.9; color: var(--cats-muted); }
body.page-categories .cats-retry {
  min-height: 44px; margin-top: 20px; padding: 10px 22px;
  border: 1px solid var(--cats-line); border-radius: 12px; background: var(--cats-soft);
  color: var(--cats-primary); font: inherit; font-size: 13px; font-weight: 750; cursor: pointer;
}
body.page-categories .cats-page [hidden] { display: none !important; }
html[dir="ltr"] body.page-categories :is(.cats-back svg, .cats-browse svg, .cat-arrow) { transform: scaleX(-1); }
html[data-theme="dark"] body.page-categories {
  --cats-bg: #13101c; --cats-card: #201a2b; --cats-ink: #f3eef9;
  --cats-muted: #b4aabd; --cats-line: #393043; --cats-primary: #cfadef; --cats-soft: #30253e;
}
html[data-theme="dark"] body.page-categories .cat-ic { color: color-mix(in srgb, var(--accent) 55%, #fff); }
/* Keep this directory's surfaces distinct from the shell's broad dark overrides. */
html[data-theme="dark"] body.page-categories .cats-page { background: var(--cats-bg) !important; }
html[data-theme="dark"] body.page-categories .cat-card {
  background: var(--cats-card) !important;
  border-color: var(--cats-line) !important;
  box-shadow: none !important;
}
html[data-theme="dark"] body.page-categories .cat-action { color: var(--cats-muted) !important; }
html[data-theme="dark"] body.page-categories .cat-arrow { color: var(--cats-primary) !important; }
@media (max-width: 1000px) {
  body.page-categories .cats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  body.page-categories .cats-page { padding: 24px 16px 96px; }
  body.page-categories .cats-header { align-items: flex-start; gap: 12px; margin-bottom: 22px; }
  body.page-categories .cats-back { margin-top: 2px; }
  body.page-categories .cats-head-text h1 { font-size: 24px; }
  body.page-categories .cats-head-text p { font-size: 12px; }
  body.page-categories .cats-toolbar { flex-wrap: wrap; gap: 6px; }
  body.page-categories .cats-search { width: 100%; }
  body.page-categories .cats-browse { margin-inline-start: auto; font-size: 12px; }
  body.page-categories .cats-summary { margin: 8px 0 14px; }
  body.page-categories .cats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  body.page-categories .cat-card { min-height: 174px; padding: 18px 16px 14px; border-radius: 18px; }
  body.page-categories .cat-card::before { top: 20px; inset-inline-end: 16px; }
  body.page-categories .cat-ic { width: 44px; height: 44px; margin-bottom: 13px; border-radius: 13px; }
  body.page-categories .cat-nm { font-size: 13px !important; line-height: 1.65; margin-bottom: 14px; }
  body.page-categories .cat-action { font-size: 10px; }
  body.page-categories .cat-skeleton { min-height: 200px; border-radius: 18px; }
}
@media (max-width: 359px) {
  body.page-categories .cats-page { padding-inline: 12px; }
  body.page-categories .cats-header { gap: 10px; }
  body.page-categories .cats-head-text h1 { font-size: 21px; }
  body.page-categories .cat-card { padding-inline: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  body.page-categories :is(.cat-card, .cats-search) { transition: none; }
  body.page-categories .cat-card:hover { transform: none; }
  body.page-categories .cat-skeleton { animation: none; }
}
