:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-strong: rgba(255, 255, 255, 0.9);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --line-soft: #e8e8ed;
  --accent: #0066cc;
  --accent-strong: #004f9e;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "SF Pro Text",
    "Segoe UI",
    "PingFang SC",
    "Hiragino Sans GB",
    "Microsoft YaHei",
    "LXGW WenKai Screen",
    sans-serif;
  color: var(--text);
  background: var(--bg);
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  padding: 8px clamp(16px, 4vw, 44px);
  border-bottom: 1px solid rgba(210, 210, 215, 0.62);
  background: rgba(245, 245, 247, 0.78);
  backdrop-filter: saturate(180%) blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 700;
  letter-spacing: 0;
}

.brand img {
  width: 22px;
  height: 22px;
}

.brand span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 4px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
}

#content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.featured {
  position: relative;
  width: min(100% - 32px, 1500px);
  min-height: clamp(420px, 64vh, 720px);
  margin: 18px auto 50px;
  overflow: hidden;
  border-radius: 18px;
  background: #17211f;
  box-shadow: var(--shadow);
  isolation: isolate;
}

.featured img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: scale(1.01);
}

.featured-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0.08) 58%);
  z-index: 1;
}

.featured-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  min-height: inherit;
  padding: clamp(28px, 5vw, 64px);
  color: #fff;
  text-align: center;
}

.featured-date,
.section-label {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0;
}

.featured h1 {
  margin: 10px 0 12px;
  font-size: clamp(2.6rem, 6.2vw, 5.6rem);
  line-height: 1;
  font-weight: 700;
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "SF Pro Display",
    "SF Pro Text",
    "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

.featured-title {
  max-width: 760px;
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(1rem, 1.8vw, 1.25rem);
  line-height: 1.55;
}

.featured-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  font-weight: 600;
}

.primary-action {
  background: var(--accent);
  color: #fff;
}

.secondary-action {
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  backdrop-filter: blur(14px);
}

.gallery-section {
  width: min(100% - 32px, 1500px);
  margin: 0 auto 30px;
}

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

.section-label {
  color: var(--muted);
  text-transform: none;
}

.section-head h2 {
  margin: 6px 0 0;
  font-size: clamp(1.9rem, 3vw, 3rem);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: 0;
}

.gallery-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: right;
  white-space: nowrap;
}

#wallpapers-container {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.wallpaper-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.wallpaper-card:hover {
  border-color: rgba(0, 102, 204, 0.28);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.wallpaper-link {
  display: block;
  min-width: 0;
}

.wallpaper-media {
  position: relative;
  overflow: hidden;
  background: #e8e8ed;
}

.wallpaper-media img {
  aspect-ratio: 16/9;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 0.3s ease;
}

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

.date-badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  max-width: calc(100% - 20px);
  overflow: hidden;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.58);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

.wallpaper-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 122px;
  padding: 14px 14px 16px;
}

.wallpaper-body h3 {
  display: -webkit-box;
  min-height: 3.2em;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.6;
  font-weight: 600;
  letter-spacing: 0;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.wallpaper-credit {
  display: -webkit-box;
  min-height: 2.8em;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.card-actions {
  display: flex;
  gap: 1px;
  border-top: 1px solid var(--line-soft);
  background: var(--line-soft);
}

.card-actions a {
  flex: 1 1 0;
  min-width: 0;
  padding: 11px 10px;
  background: var(--surface);
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

.card-actions a:hover {
  color: #fff;
  background: var(--accent);
}

#pagination {
  display: none;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  align-items: center;
  width: min(100% - 32px, 1500px);
  margin: 0 auto 44px;
}

#pagination button {
  min-height: 40px;
  min-width: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background-color: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
}

#pagination button:disabled {
  background-color: #eef1ef;
  color: #9aa6a1;
  cursor: not-allowed;
}

#pagination > button {
  padding: 0 14px;
}

#pageNumbers {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

#pageNumbers button {
  padding: 0;
}

#pageNumbers button.active {
  background-color: var(--accent);
  color: white;
  border-color: var(--accent);
}

#pageNumbers span {
  display: inline-flex;
  align-items: center;
  color: #8b9793;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(0, 102, 204, 0.26);
  outline-offset: 3px;
}

@media (max-width: 900px) {
  .featured {
    min-height: 540px;
  }

  .featured-gradient {
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.12) 68%);
  }

  .featured-content {
    justify-content: flex-end;
  }
}

@media (max-width: 680px) {
  .site-header {
    min-height: 52px;
    padding: 10px 14px;
  }

  .brand span {
    max-width: 52vw;
  }

  .header-link {
    min-height: 32px;
    padding: 0 10px;
    font-size: 0.88rem;
  }

  .featured,
  .gallery-section,
  #pagination {
    width: calc(100% - 24px);
  }

  .featured {
    min-height: 520px;
    margin-top: 12px;
    margin-bottom: 36px;
    border-radius: 16px;
  }

  .featured-content {
    padding: 24px;
  }

  .featured h1 {
    font-size: clamp(2.25rem, 12vw, 3.7rem);
  }

  .featured-title {
    font-size: 1rem;
    line-height: 1.55;
  }

  .featured-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .section-head {
    display: block;
  }

  .gallery-meta {
    margin-top: 8px;
    text-align: left;
    white-space: normal;
  }

  #wallpapers-container {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .wallpaper-card:hover {
    transform: none;
  }

  .wallpaper-body {
    min-height: 0;
  }
}

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

  .wallpaper-card,
  .wallpaper-media img {
    transition: none;
  }
}
