:root {
  --page-background: #f4f5f7;
  --surface: #ffffff;
  --surface-soft: #f8f9fb;
  --surface-hover: #f1f3f6;

  --text-primary: #17191d;
  --text-secondary: #656b75;
  --text-light: #969ca6;

  --border: #e4e7ec;
  --border-strong: #d8dce3;

  --accent: #20242c;
  --accent-hover: #343943;

  --danger: #a94141;

  --shadow-small:
    0 2px 8px rgba(17, 24, 39, 0.05);

  --shadow-medium:
    0 12px 30px rgba(17, 24, 39, 0.09);

  --radius-small: 10px;
  --radius-medium: 16px;
  --radius-large: 22px;

  --content-width: 1480px;
  --header-height: 72px;
}

/* =========================
   基础重置
   ========================= */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 280px;
  min-height: 100vh;

  background: var(--page-background);
  color: var(--text-primary);

  font-family:
    "PingFang SC",
    "Microsoft YaHei UI",
    "Microsoft YaHei",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;

  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body,
button,
input {
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

/* =========================
   顶部导航
   ========================= */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;

  min-height: var(--header-height);

  background:
    rgba(255, 255, 255, 0.88);

  border-bottom: 1px solid rgba(220, 224, 231, 0.86);

  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.header-inner {
  width: min(
    calc(100% - 40px),
    var(--content-width)
  );

  min-height: var(--header-height);
  margin: 0 auto;

  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  flex: 0 0 auto;

  display: inline-flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  width: 40px;
  height: 40px;

  display: grid;
  place-items: center;

  border-radius: 12px;

  background: var(--accent);
  color: #ffffff;

  font-size: 18px;
  font-weight: 700;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text strong {
  font-size: 16px;
  letter-spacing: 0.04em;
}

.brand-text small {
  margin-top: 4px;

  color: var(--text-light);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.breadcrumbs {
  min-width: 0;

  display: flex;
  align-items: center;
  gap: 8px;

  color: var(--text-secondary);
  font-size: 14px;

  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}

.breadcrumbs::-webkit-scrollbar {
  display: none;
}

.breadcrumb-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.breadcrumb-item:not(:last-child)::after {
  content: "/";
  color: #c2c6cd;
}

.breadcrumb-item a:hover {
  color: var(--text-primary);
}

.breadcrumb-current {
  color: var(--text-primary);
  font-weight: 600;
}

.main-site-link {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 8px 14px;

  border: 1px solid var(--border-strong);
  border-radius: 10px;

  background: var(--surface);
  color: var(--text-secondary);

  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;

  transition:
    background 150ms ease,
    color 150ms ease,
    border-color 150ms ease;
}

.main-site-link:hover {
  border-color: #b8bdc6;
  background: var(--surface-hover);
  color: var(--text-primary);
}

/* =========================
   主页面
   ========================= */

.app {
  width: min(
    calc(100% - 40px),
    var(--content-width)
  );

  min-height: calc(100vh - 160px);
  margin: 0 auto;
  padding: 46px 0 80px;
}

.page {
  animation: page-enter 180ms ease-out;
}

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================
   页面标题
   ========================= */

.page-hero {
  margin-bottom: 34px;
}

.page-kicker {
  margin: 0 0 8px;

  color: var(--text-light);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.page-title {
  margin: 0;

  font-size: clamp(30px, 5vw, 52px);
  line-height: 1.18;
  letter-spacing: -0.035em;
}

.page-description {
  max-width: 720px;
  margin: 14px 0 0;

  color: var(--text-secondary);
  font-size: 16px;
}

.page-count {
  margin-left: 8px;

  color: var(--text-light);
  font-size: 0.55em;
  font-weight: 500;
  vertical-align: middle;
}

/* =========================
   栏目目录
   ========================= */

.section-grid,
.category-grid {
  display: grid;
  grid-template-columns:
    repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
}

.section-card,
.category-card {
  position: relative;

  min-height: 174px;
  padding: 24px;

  display: flex;
  flex-direction: column;

  border: 1px solid var(--border);
  border-radius: var(--radius-large);

  background: var(--surface);
  box-shadow: var(--shadow-small);

  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.section-card:not(.is-disabled):hover,
.category-card:hover {
  transform: translateY(-3px);

  border-color: var(--border-strong);
  box-shadow: var(--shadow-medium);
}

.section-card.is-disabled {
  cursor: default;
  opacity: 0.58;
}

.section-icon {
  width: 46px;
  height: 46px;

  display: grid;
  place-items: center;

  margin-bottom: 26px;

  border-radius: 14px;
  background: var(--surface-soft);

  font-size: 22px;
}

.section-card h2,
.category-card h2 {
  margin: 0;

  font-size: 20px;
  line-height: 1.35;
}

.section-card p,
.category-card p {
  margin: 8px 0 0;

  color: var(--text-secondary);
  font-size: 14px;
}

.section-status {
  margin-top: auto;
  padding-top: 18px;

  color: var(--text-light);
  font-size: 13px;
}

.category-number {
  margin-top: auto;
  padding-top: 20px;

  font-size: 30px;
  font-weight: 700;
  line-height: 1;
}

.category-number small {
  margin-left: 5px;

  color: var(--text-light);
  font-size: 13px;
  font-weight: 400;
}

/* =========================
   搜索
   ========================= */

.search-panel {
  margin-bottom: 30px;
}

.search-box {
  position: relative;

  max-width: 780px;
}

.search-input {
  width: 100%;
  height: 54px;

  padding: 0 54px 0 48px;

  border: 1px solid var(--border-strong);
  border-radius: 17px;

  outline: none;

  background: var(--surface);
  color: var(--text-primary);

  box-shadow: var(--shadow-small);

  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.search-input:focus {
  border-color: #969da8;

  box-shadow:
    0 0 0 4px rgba(43, 48, 58, 0.07),
    var(--shadow-small);
}

.search-input::placeholder {
  color: #a5aab3;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 18px;

  width: 18px;
  height: 18px;

  transform: translateY(-50%);

  color: var(--text-light);
  pointer-events: none;
}

.search-clear {
  position: absolute;
  top: 50%;
  right: 12px;

  width: 34px;
  height: 34px;

  display: grid;
  place-items: center;

  transform: translateY(-50%);

  border: 0;
  border-radius: 50%;

  background: transparent;
  color: var(--text-secondary);

  cursor: pointer;
}

.search-clear:hover {
  background: var(--surface-hover);
}

.search-summary {
  margin: 14px 2px 0;

  color: var(--text-secondary);
  font-size: 14px;
}

/* =========================
   相册图库
   ========================= */

.gallery {
  columns: 4 270px;
  column-gap: 18px;
}

.gallery-card {
  width: 100%;
  margin: 0 0 18px;

  break-inside: avoid;
  overflow: hidden;

  border: 1px solid var(--border);
  border-radius: var(--radius-medium);

  background: var(--surface);
  box-shadow: var(--shadow-small);

  content-visibility: auto;
  contain-intrinsic-size: 320px 500px;

  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.gallery-card:hover {
  transform: translateY(-2px);

  border-color: var(--border-strong);
  box-shadow: var(--shadow-medium);
}

.gallery-image-wrap {
  position: relative;

  display: block;
  overflow: hidden;

  background: #e9ebef;
}

.gallery-image {
  width: 100%;
  height: auto;

  transition: transform 220ms ease;
}

.gallery-card:hover .gallery-image {
  transform: scale(1.008);
}

.gallery-caption {
  padding: 15px 16px 16px;
}

.gallery-title {
  margin: 0;

  display: -webkit-box;
  overflow: hidden;

  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.55;

  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  -line-clamp: 2;
}

.gallery-meta {
  margin-top: 11px;

  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;

  color: var(--text-light);
  font-size: 12px;
}

.badge {
  max-width: 100%;
  padding: 4px 9px;

  overflow: hidden;

  border-radius: 999px;

  background: var(--surface-soft);
  color: var(--text-secondary);

  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================
   图片详情
   ========================= */

.detail-layout {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr)
    minmax(280px, 370px);

  align-items: start;
  gap: 28px;
}

.detail-image-panel {
  padding: 16px;

  display: flex;
  justify-content: center;

  border: 1px solid var(--border);
  border-radius: var(--radius-large);

  background: #e8eaee;
}

.detail-image-link {
  display: block;
  width: 100%;
}

.detail-image {
  width: 100%;
  max-height: none;

  border-radius: 10px;
  background: #ffffff;
}

.detail-sidebar {
  position: sticky;
  top: calc(var(--header-height) + 24px);

  padding: 24px;

  border: 1px solid var(--border);
  border-radius: var(--radius-large);

  background: var(--surface);
  box-shadow: var(--shadow-small);
}

.detail-title {
  margin: 0;

  font-size: 21px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.detail-meta {
  margin: 18px 0 0;

  display: grid;
  gap: 12px;
}

.detail-meta-row {
  display: grid;
  grid-template-columns: 66px 1fr;
  gap: 10px;

  font-size: 14px;
}

.detail-meta-label {
  color: var(--text-light);
}

.detail-meta-value {
  min-width: 0;

  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.detail-actions {
  margin-top: 24px;

  display: grid;
  gap: 10px;
}

.button {
  min-height: 46px;
  padding: 0 17px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  border: 1px solid var(--border-strong);
  border-radius: 13px;

  background: var(--surface);
  color: var(--text-primary);

  font-weight: 600;
  cursor: pointer;

  transition:
    background 150ms ease,
    transform 150ms ease;
}

.button:hover {
  background: var(--surface-hover);
}

.button:active {
  transform: scale(0.985);
}

.button-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.button-primary:hover {
  background: var(--accent-hover);
}

.context-details {
  margin-top: 22px;

  border-top: 1px solid var(--border);
  padding-top: 18px;
}

.context-details summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.context-text {
  margin: 14px 0 0;

  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.85;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* =========================
   空状态、错误、加载
   ========================= */

.loading-state,
.empty-state,
.error-state {
  min-height: 360px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  text-align: center;
}

.loading-state p,
.empty-state p,
.error-state p {
  color: var(--text-secondary);
}

.loading-dot {
  width: 28px;
  height: 28px;

  border: 3px solid #d9dde4;
  border-top-color: var(--accent);
  border-radius: 50%;

  animation: loading-spin 700ms linear infinite;
}

@keyframes loading-spin {
  to {
    transform: rotate(360deg);
  }
}

.empty-icon,
.error-icon {
  margin-bottom: 12px;

  color: var(--text-light);
  font-size: 42px;
}

/* =========================
   页脚和提示
   ========================= */

.site-footer {
  padding: 25px 20px 35px;

  color: var(--text-light);
  font-size: 12px;
  text-align: center;
}

.toast {
  position: fixed;
  z-index: 500;
  right: 20px;
  bottom: 20px;

  max-width: min(360px, calc(100vw - 40px));
  padding: 12px 16px;

  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;

  background: rgba(27, 30, 36, 0.94);
  color: #ffffff;

  box-shadow: var(--shadow-medium);

  font-size: 14px;
}

/* =========================
   平板
   ========================= */

@media (max-width: 900px) {
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .detail-sidebar {
    position: static;
  }
}

/* =========================
   手机
   ========================= */

@media (max-width: 640px) {
  :root {
    --header-height: 62px;
  }

  .header-inner {
    width: min(calc(100% - 24px), var(--content-width));
    min-height: var(--header-height);
    gap: 15px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 11px;
  }

  .brand-text {
    display: none;
  }

  .breadcrumbs {
    font-size: 13px;
  }

  .main-site-link {
    padding: 7px 10px;
    font-size: 12px;
  }

  .app {
    width: min(calc(100% - 24px), var(--content-width));
    padding: 30px 0 55px;
  }

  .page-hero {
    margin-bottom: 25px;
  }

  .page-title {
    font-size: 32px;
  }

  .page-description {
    font-size: 14px;
  }

  .section-grid,
  .category-grid {
    grid-template-columns: 1fr;
    gap: 13px;
  }

  .section-card,
  .category-card {
    min-height: 150px;
    padding: 20px;
  }

  .gallery {
    columns: 1;
  }

  .gallery-card {
    margin-bottom: 14px;
  }

  .search-input {
    height: 50px;
  }

  .detail-image-panel {
    padding: 8px;
    border-radius: 14px;
  }

  .detail-sidebar {
    padding: 20px;
  }

  .detail-meta-row {
    grid-template-columns: 58px 1fr;
  }

  .toast {
    right: 12px;
    bottom: 12px;

    max-width: calc(100vw - 24px);
  }
}

/* =========================
   减少动画设置
   ========================= */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}