:root {
  --bg: #faf9f4;
  --surface: #faf9f4;
  --surface-low: #f4f4ee;
  --surface-high: #ffffff;
  --ink: #2f342d;
  --muted: #6f746d;
  --line: rgba(47, 52, 45, 0.12);
  --line-strong: rgba(47, 52, 45, 0.2);
  --accent: #4e6359;
  --accent-soft: rgba(78, 99, 89, 0.12);
  --shadow: 0 8px 30px rgba(32, 34, 29, 0.05);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Public Sans", "Avenir Next", "Segoe UI", "PingFang SC", sans-serif;
}

button,
input,
a {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.84);
  border-bottom: 1px solid rgba(47, 52, 45, 0.08);
  backdrop-filter: blur(12px);
}

.topbar-inner {
  width: min(1600px, calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto minmax(240px, 460px) auto;
  gap: 14px;
  align-items: center;
  padding: 10px 0;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 35% 35%, #e0b169 0%, #e0b169 20%, transparent 21%),
    linear-gradient(135deg, #62796d 0%, #415349 100%);
  box-shadow: 0 0 0 5px rgba(78, 99, 89, 0.08);
  flex: none;
}

.brand-name {
  font-family: "Noto Serif", "Iowan Old Style", "Songti SC", serif;
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
}

.search-box input {
  width: 100%;
  height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(47, 52, 45, 0.08);
  border-radius: 4px;
  background: #eef0e8;
  color: var(--ink);
}

.search-box input:focus {
  outline: 1px solid var(--accent);
  background: #fff;
}

.quick-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.action-pill {
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--surface-low);
  color: var(--ink);
  font-size: 0.78rem;
}

.action-pill.ghost {
  background: transparent;
  border: 1px solid rgba(78, 99, 89, 0.2);
  color: var(--accent);
}

.action-pill.ghost.is-active {
  background: var(--accent-soft);
}

.page-shell {
  width: min(1600px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 36px;
}

.filter-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.filter-stack {
  display: grid;
  gap: 8px;
}

.visibility-bar,
.category-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.scope-pill,
.category-pill {
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(47, 52, 45, 0.05);
  color: var(--muted);
  font-size: 0.76rem;
  transition: 160ms ease;
}

.scope-pill.is-active,
.category-pill.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.status-line {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.content-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(47, 52, 45, 0.08);
}

.page-title,
.collection-title {
  margin: 0;
  font-family: "Noto Serif", "Iowan Old Style", "Songti SC", serif;
}

.page-title {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  line-height: 1.05;
}

.page-copy {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 24px;
  align-items: start;
}

.collection-section {
  min-width: 0;
}

.collection-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-left: 10px;
  border-left: 2px solid var(--accent);
}

.collection-title {
  font-size: 1rem;
  line-height: 1.2;
}

.collection-count {
  color: rgba(47, 52, 45, 0.45);
  font-family: "SFMono-Regular", "JetBrains Mono", monospace;
  font-size: 0.68rem;
}

.resource-list {
  display: grid;
  gap: 2px;
}

.section-toggle {
  margin-top: 8px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 0.74rem;
  text-align: left;
}

.section-toggle:hover {
  text-decoration: underline;
}

.resource-link {
  display: block;
  padding: 8px 10px;
  border-radius: 4px;
  transition: background 120ms ease;
}

.resource-link:hover {
  background: var(--surface-high);
  box-shadow: var(--shadow);
}

.resource-link.is-disabled {
  opacity: 0.6;
}

.resource-link-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.resource-badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.resource-name {
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.35;
}

.resource-visibility {
  border-radius: 999px;
  padding: 2px 6px;
  background: rgba(47, 52, 45, 0.06);
  color: var(--muted);
  font-size: 0.62rem;
  line-height: 1;
}

.resource-star {
  color: var(--accent);
  font-size: 0.78rem;
  flex: none;
}

.resource-domain {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.4;
}

.empty-state {
  padding: 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.52);
  color: var(--muted);
  line-height: 1.7;
}

@media (max-width: 1360px) {
  .collection-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .topbar-inner {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .quick-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .collection-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .filter-row,
  .content-head {
    display: grid;
    grid-template-columns: 1fr;
  }

  .collection-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .topbar-inner,
  .page-shell {
    width: min(100% - 20px, 1600px);
  }

  .topbar-inner {
    grid-template-columns: 1fr;
  }

  .collection-grid {
    grid-template-columns: 1fr;
  }
}
