:root {
  --background: #f7f8f8;
  --surface: #ffffff;
  --surface-soft: #f1f3f3;
  --text: #202326;
  --text-muted: #6d7479;
  --border: #e5e8e8;
  --accent: #e7f26b;
  --accent-strong: #dce94f;
  --shadow: 0 16px 42px rgba(25, 31, 35, 0.07);
  --page-width: 1280px;
  --category-nav-offset: 80px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--background);
  color: var(--text);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC",
    system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

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

.demo-section {
  width: min(calc(100% - 48px), var(--page-width));
  margin-inline: auto;
}

.demo-section {
  padding-block: clamp(28px, 4vw, 48px) clamp(64px, 8vw, 112px);
}

.category-menu {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(247, 248, 248, 0.96);
  backdrop-filter: blur(12px);
}

.category-toggle {
  display: none;
}

.category-nav {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  overflow: visible;
  padding-block: 12px;
  border-bottom: 1px solid var(--border);
}

.category-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background 180ms ease,
    border-color 180ms ease;
}

.category-nav a:hover {
  border-color: #d2d8d8;
  background: var(--accent);
}

.category-nav a[aria-current="true"] {
  border-color: var(--accent-strong);
  background: var(--accent);
}

.category-nav span {
  color: var(--text-muted);
  font-size: 12px;
}

.category-section {
  margin-top: clamp(42px, 6vw, 72px);
  scroll-margin-top: calc(var(--category-nav-offset) + 12px);
}

.category-section + .category-section {
  margin-top: clamp(72px, 9vw, 112px);
  padding-top: clamp(42px, 6vw, 72px);
  border-top: 1px solid var(--border);
}

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

.category-heading h2 {
  margin: 0;
  font-size: clamp(24px, 2.4vw, 32px);
  letter-spacing: -0.03em;
}

.site-count {
  margin: 0 0 6px;
  color: var(--text-muted);
  font-size: 14px;
}

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

.site-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 0 0 rgba(25, 31, 35, 0);
  transition:
    transform 220ms ease,
    box-shadow 220ms ease,
    border-color 220ms ease;
}

.site-card:hover {
  border-color: #d8dddd;
  box-shadow: var(--shadow);
  transform: translateY(-6px);
}

.site-card:focus-within {
  outline: 3px solid var(--accent-strong);
  outline-offset: 4px;
}

.card-link {
  height: 100%;
  display: flex;
  flex-direction: column;
  color: inherit;
  text-decoration: none;
}

.card-link:focus {
  outline: none;
}

.card-media {
  position: relative;
  aspect-ratio: 900 / 1532;
  overflow: hidden;
  background: var(--surface-soft);
}

.site-card--astra .card-media {
  aspect-ratio: 20 / 29;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform 350ms ease;
}

.site-card:hover .card-media img {
  transform: scale(1.035);
}

.card-index {
  position: absolute;
  top: 16px;
  left: 16px;
  display: grid;
  place-items: center;
  min-width: 42px;
  height: 30px;
  padding-inline: 10px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(8px);
}

.card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.card-body h3 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.025em;
}

.card-description {
  margin: 12px 0 24px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.7;
}

.card-footer {
  margin-top: auto;
  padding-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--border);
}

.card-domain {
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-action {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}

.card-arrow {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: var(--accent);
  font-size: 15px;
  transition: background 180ms ease;
}

.site-card:hover .card-arrow {
  background: var(--accent-strong);
}

.noscript-message {
  padding: 22px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
}

.back-to-top {
  position: fixed;
  right: clamp(16px, 3vw, 40px);
  bottom: clamp(16px, 3vw, 40px);
  z-index: 30;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--accent);
  color: var(--text);
  font: inherit;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    background 180ms ease;
}

.back-to-top:hover {
  background: var(--accent-strong);
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

a:focus-visible {
  outline: 3px solid var(--accent-strong);
  outline-offset: 4px;
}

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

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

@media (max-width: 760px) {
  .category-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .category-nav a {
    min-height: 42px;
    padding: 9px 11px;
    font-size: 13px;
  }
}

@media (max-width: 560px) {
  .demo-section {
    width: min(calc(100% - 32px), var(--page-width));
  }

  .category-menu {
    top: 0;
    width: 100vw;
    max-width: none;
    margin-top: 0;
    margin-inline: calc(50% - 50vw);
    padding-bottom: 12px;
  }

  .category-toggle {
    width: 100%;
    min-height: 48px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 0;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
  }

  .category-toggle-current {
    overflow: hidden;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .category-toggle-arrow {
    font-size: 18px;
    transition: transform 180ms ease;
  }

  .category-menu.is-open .category-toggle-arrow {
    transform: rotate(180deg);
  }

  .category-nav {
    display: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-top: 8px;
  }

  .category-menu.is-open .category-nav {
    display: grid;
  }

  .category-heading {
    align-items: start;
  }

  .site-count {
    margin-top: 10px;
    white-space: nowrap;
  }

  .site-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }

  .card-body {
    padding: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
