/* Base tokens */
:root {
  --bg: #f6f8fc;
  --bg-strong: #eef4ff;
  --surface: #ffffff;
  --surface-soft: #f2f6ff;
  --text: #172033;
  --muted: #667085;
  --line: #d9e2ef;
  --primary: #1155cc;
  --primary-dark: #0f3d8f;
  --violet: #6554d9;
  --teal: #0f9f9a;
  --green: #14805e;
  --tag-bg: #eaf2ff;
  --tag-text: #184d8f;
  --shadow-sm: 0 8px 24px rgba(23, 32, 51, 0.06);
  --shadow-md: 0 18px 48px rgba(23, 32, 51, 0.1);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at top left, rgba(101, 84, 217, 0.14), transparent 28rem),
    linear-gradient(180deg, #edf5ff 0, #f8fafc 34rem, var(--bg) 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
}

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

img {
  display: block;
  max-width: 100%;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
}

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

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(217, 226, 239, 0.72);
  background: rgba(248, 250, 252, 0.9);
  backdrop-filter: blur(18px);
}

.nav {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.brand span {
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 15px;
}

.nav-links a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: var(--radius);
}

.nav-links a:hover,
.nav-links a:focus-visible,
.nav-links a[aria-current="page"] {
  color: var(--primary-dark);
  background: var(--surface-soft);
  outline: none;
}

/* Hero */
.hero {
  padding: 72px 0 28px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  align-items: end;
  gap: 40px;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(42px, 7vw, 78px);
  line-height: 1.04;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.25;
}

h3 {
  margin-bottom: 10px;
  font-size: 20px;
  line-height: 1.35;
}

.hero-text {
  max-width: 650px;
  margin-bottom: 26px;
  color: var(--muted);
  font-size: 18px;
}

.search-card {
  width: min(720px, 100%);
  margin-bottom: 16px;
  padding: 8px;
  border: 1px solid rgba(17, 85, 204, 0.15);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow-md);
}

.search-card input {
  width: 100%;
  min-height: 56px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.search-card input:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(17, 85, 204, 0.16);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.button-primary {
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), var(--violet));
}

.button-secondary {
  color: var(--primary-dark);
  background: var(--surface);
  border-color: var(--line);
}

.button:hover,
.button:focus-visible {
  transform: translateY(-1px);
  outline: none;
  box-shadow: 0 12px 26px rgba(17, 85, 204, 0.18);
}

.hero-panel {
  padding: 24px;
  border: 1px solid rgba(217, 226, 239, 0.9);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-md);
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  font-weight: 800;
}

.status-dot {
  width: 10px;
  height: 10px;
  display: inline-block;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(20, 128, 94, 0.12);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.metric-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.metric-grid strong,
.metric-grid span {
  display: block;
}

.metric-grid strong {
  color: var(--primary-dark);
  font-size: 26px;
  line-height: 1;
}

.metric-grid span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.hero-panel p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

/* Topic shortcuts */
.topic-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 12px 0 28px;
  scrollbar-width: thin;
}

.topic-strip a {
  min-height: 40px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--primary-dark);
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}

/* Resource library */
.resource-section {
  padding: 28px 0 76px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.result-count {
  margin: 0;
  color: var(--muted);
}

.resource-layout {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  min-width: 0;
}

.filter-sidebar {
  position: sticky;
  top: 96px;
  min-width: 0;
  max-width: 100%;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-sm);
}

.filter-sidebar-head {
  margin-bottom: 14px;
}

.filter-sidebar-head h3 {
  margin-bottom: 2px;
  font-size: 18px;
}

.filter-sidebar-head p,
.filter-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.filters {
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.resource-results {
  min-width: 0;
}

.filter-button {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.filter-button strong {
  min-width: 28px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--primary-dark);
  font-size: 12px;
}

.filter-button:hover,
.filter-button:focus-visible,
.filter-button.is-active {
  border-color: rgba(17, 85, 204, 0.35);
  background: var(--surface-soft);
  color: var(--primary-dark);
  outline: none;
}

.filter-note {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.resource-card {
  min-height: 394px;
  display: flex;
  flex-direction: column;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.resource-card:hover,
.resource-card:focus-within {
  border-color: rgba(17, 85, 204, 0.35);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.resource-cover {
  height: 126px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  overflow: hidden;
  border-radius: var(--radius);
  color: #ffffff;
  font-weight: 900;
}

.resource-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-side {
  background:
    linear-gradient(135deg, rgba(17, 85, 204, 0.88), rgba(15, 159, 154, 0.88)),
    repeating-linear-gradient(45deg, transparent 0 12px, rgba(255, 255, 255, 0.12) 12px 13px);
}

.cover-cognition {
  background:
    linear-gradient(135deg, rgba(101, 84, 217, 0.9), rgba(17, 85, 204, 0.88)),
    repeating-linear-gradient(135deg, transparent 0 12px, rgba(255, 255, 255, 0.12) 12px 13px);
}

.cover-ai {
  background:
    linear-gradient(135deg, rgba(15, 159, 154, 0.9), rgba(20, 128, 94, 0.88)),
    repeating-linear-gradient(135deg, transparent 0 12px, rgba(255, 255, 255, 0.12) 12px 13px);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.card-meta {
  color: var(--primary);
  font-size: 13px;
  font-weight: 900;
}

.status-badge {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border-radius: var(--radius);
  background: #eaf8f3;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.resource-card p {
  color: var(--muted);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: var(--radius);
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 13px;
  font-weight: 800;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 20px;
  color: var(--muted);
  font-size: 14px;
}

.card-action {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: var(--radius);
  background: var(--primary);
  color: #ffffff;
  font-weight: 900;
  white-space: nowrap;
}

.card-action:hover,
.card-action:focus-visible {
  background: var(--primary-dark);
  outline: none;
}

.empty-state,
.not-found,
.about-card,
.detail-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.empty-state {
  padding: 36px;
  text-align: center;
  color: var(--muted);
}

.empty-state strong,
.empty-state span {
  display: block;
}

.empty-state strong {
  margin-bottom: 6px;
  color: var(--text);
  font-size: 18px;
}

/* Detail and about pages */
.detail-main,
.about-main {
  padding: 56px 0 76px;
}

.detail-card,
.about-card,
.not-found {
  padding: 32px;
}

.back-link {
  display: inline-flex;
  margin-bottom: 24px;
  color: var(--primary);
  font-weight: 900;
}

.detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 28px;
  align-items: start;
  margin-bottom: 18px;
}

.detail-hero h1,
.about-card h1,
.not-found h1 {
  font-size: clamp(34px, 5vw, 56px);
}

.detail-summary {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 18px;
}

.detail-meta-box {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--primary-dark);
  font-weight: 900;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 28px;
  margin-top: 28px;
}

.detail-section {
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.detail-section + .detail-section {
  margin-top: 30px;
}

.detail-section p {
  color: var(--muted);
}

.content-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0;
  list-style: none;
}

.content-list li {
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.pan-panel {
  position: sticky;
  top: 96px;
  align-self: start;
  padding: 22px;
  border: 1px solid rgba(17, 85, 204, 0.16);
  border-radius: var(--radius);
  background: #eef8f8;
}

.pan-panel h2 {
  margin: 12px 0 8px;
}

.code-text {
  margin-bottom: 8px;
  color: var(--primary-dark);
  font-weight: 900;
}

.feedback-text {
  margin-bottom: 18px;
  color: var(--muted);
}

.pan-button {
  width: 100%;
  min-height: 52px;
}

.about-card {
  max-width: 780px;
}

.about-card p {
  color: var(--muted);
  font-size: 18px;
}

.about-declaration {
  margin: 26px 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.about-declaration h2 {
  margin-bottom: 10px;
  font-size: 22px;
}

.about-declaration p {
  margin-bottom: 0;
  font-size: 16px;
}

.not-found {
  text-align: center;
}

.not-found p {
  color: var(--muted);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.footer-layout {
  display: grid;
  gap: 8px;
  padding: 24px 0;
  color: var(--muted);
  font-size: 14px;
}

.footer-layout p {
  margin: 0;
}

.declaration-title {
  color: var(--text);
  font-weight: 900;
}

.declaration-text {
  max-width: 980px;
}

@media (max-width: 960px) {
  .hero-grid,
  .detail-hero,
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    max-width: 520px;
  }

  .resource-layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }

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

  .pan-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 24px, 1160px);
  }

  .nav {
    min-height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 0;
    gap: 12px;
  }

  .nav-links {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .hero {
    padding: 44px 0 20px;
  }

  h1 {
    font-size: 42px;
  }

  .hero-text,
  .detail-summary,
  .about-card p {
    font-size: 16px;
  }

  .hero-actions,
  .section-heading,
  .footer-layout {
    align-items: stretch;
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

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

  .resource-layout {
    grid-template-columns: 1fr;
  }

  .filter-sidebar {
    position: static;
    padding: 14px;
    overflow: hidden;
  }

  .filter-sidebar-head,
  .filter-note {
    display: none;
  }

  .filters {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .filter-button {
    width: auto;
    min-width: max-content;
    flex: 0 0 auto;
  }

  .resource-grid,
  .content-list {
    grid-template-columns: 1fr;
  }

  .resource-card {
    min-height: 0;
  }

  .resource-cover {
    height: 112px;
  }

  .detail-card,
  .about-card,
  .not-found {
    padding: 22px;
  }
}
