:root {
  color-scheme: light;
  --paper: #f5f6f2;
  --white: #fff;
  --ink: #18302d;
  --muted: #536761;
  --line: #dbe2dc;
  --deep: #143b38;
  --accent: #cceec1;
  --selected: #e1eee2;
  --focus: #42845f;
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 20px; }
body { margin: 0; min-width: 280px; }
h1, h2, h3, h4, p { margin: 0; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
.container { width: min(1280px, calc(100% - 84px)); margin-inline: auto; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.topbar { background: var(--white); border-bottom: 1px solid var(--line); }
.topbar-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 750; letter-spacing: .05em; }
.brand-mark {
  width: 32px;
  height: 32px;
  display: flex;
  gap: 3px;
  justify-content: center;
  align-items: center;
  background: var(--deep);
  border-radius: 7px;
}
.brand-mark i { display: block; width: 3px; border-radius: 1px; background: var(--accent); }
.brand-mark i:nth-child(1) { height: 8px; }
.brand-mark i:nth-child(2) { height: 16px; }
.brand-mark i:nth-child(3) { height: 12px; }
.top-link { padding: 9px 0; font-size: .875rem; color: var(--muted); }
.top-link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 5px; }

.hero {
  margin-block: 30px 48px;
  min-height: 320px;
  display: grid;
  grid-template-columns: minmax(265px, 1fr) minmax(0, 2.2fr);
  background: var(--deep);
  color: white;
  border-radius: 14px;
  overflow: hidden;
}
.hero-copy { padding: clamp(30px, 4vw, 64px); align-self: center; }
.hero h1 { font-size: clamp(2.1rem, 4.15vw, 4.05rem); letter-spacing: .035em; line-height: 1.2; }
.hero-count { color: var(--accent); margin-top: 22px; font-size: .95rem; }
.hero-count:empty { display: none; }
.feature {
  display: grid;
  align-items: end;
  justify-items: end;
  min-width: 0;
  min-height: 320px;
  position: relative;
  isolation: isolate;
  text-align: right;
  color: white;
  background: var(--deep);
  border: 0;
  padding: 16px 22px;
}
.feature:focus-visible { outline: 3px solid var(--accent); outline-offset: -7px; }
.feature img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; }
.feature-title {
  max-width: 100%;
  background: #0b251fd9;
  border-radius: 6px;
  padding: 7px 11px;
  font-size: .8125rem;
  overflow-wrap: anywhere;
}
.feature:hover .feature-title { background: #0b251f; }

.browse { margin-bottom: 60px; }
.browse-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}
.browse-head h2 { font-size: 1.7rem; letter-spacing: .02em; }
.search {
  display: flex;
  align-items: center;
  gap: 11px;
  width: min(100%, 320px);
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  padding: 0 14px;
}
.search:focus-within { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.search input {
  outline: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  width: 100%;
  min-height: 44px;
  padding: 0;
}
.search input:focus-visible { outline: none; }
.search input::placeholder { color: var(--muted); }
.search-icon {
  position: relative;
  flex: none;
  width: 14px;
  height: 14px;
  border: 1.6px solid var(--muted);
  border-radius: 50%;
}
.search-icon::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 1.6px;
  right: -4px;
  bottom: -2px;
  transform: rotate(45deg);
  background: var(--muted);
  border-radius: 1px;
}

.browse-body { display: grid; grid-template-columns: 196px minmax(0, 1fr); gap: 26px; }
.folders { border-right: 1px solid var(--line); padding-right: 16px; }
.folders h3 { margin: 5px 10px 12px; color: var(--muted); font-size: .875rem; font-weight: 650; }
.folder-list { display: grid; gap: 4px; }
.folder-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  min-height: 42px;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  text-align: left;
  font-size: .9rem;
  line-height: 1.4;
}
.folder-button:hover { background: #edf2ec; }
.folder-button[aria-pressed="true"] { background: var(--selected); font-weight: 700; border-color: #d3e5d5; }
.folder-count { color: var(--muted); font-size: .8125rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.results-head {
  min-height: 33px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.results-head h3 { font-size: 1.1rem; }
.results-head p { flex: none; font-size: .875rem; color: var(--muted); }
.results-message {
  padding: 38px 15px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  text-align: center;
  color: var(--muted);
}

.image-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; }
.card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  display: flex;
  min-width: 0;
  flex-direction: column;
}
.card-image {
  border: 0;
  padding: 0;
  width: 100%;
  aspect-ratio: 8 / 5;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  border-radius: 9px 9px 0 0;
  background: #e3e9e4;
}
.card-image img { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: cover; transition: transform .2s ease; }
@media (hover: hover) { .card-image:hover img { transform: scale(1.035); } }
.card-error { padding: 6px; color: var(--muted); font-size: .875rem; }
.card-caption {
  display: flex;
  align-items: center;
  flex: 1;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 10px 11px 13px;
}
.card-label { min-width: 0; }
.card-label h4 {
  font-size: .9rem;
  font-weight: 680;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  line-height: 1.4;
}
.card-label p { color: var(--muted); font-size: .8125rem; margin-top: 4px; line-height: 1.35; }
.icon-button {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 7px;
}
.icon-button:hover { background: var(--selected); }
.icon-button:disabled { opacity: .4; cursor: default; background: var(--white); }
.card-download { background: var(--paper); color: var(--deep); }
.download-icon {
  position: relative;
  display: inline-block;
  width: 16px;
  height: 16px;
  border-bottom: 1.6px solid currentColor;
}
.download-icon::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 0;
  width: 1.6px;
  height: 10px;
  background: currentColor;
}
.download-icon::after {
  content: "";
  position: absolute;
  left: 4.5px;
  top: 4px;
  width: 6.6px;
  height: 6.6px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg);
}
.load-more {
  display: block;
  margin: 24px auto 0;
  min-height: 44px;
  min-width: 138px;
  padding: 8px 18px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: .9rem;
  font-weight: 650;
}
.load-more:hover { background: var(--selected); }

body:has(.viewer[open]) { overflow: hidden; }
.viewer {
  width: min(1120px, calc(100% - 40px));
  max-width: none;
  max-height: calc(100% - 32px);
  border: 0;
  padding: 0;
  border-radius: 11px;
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 12px 58px #05161550;
}
.viewer[open] { display: flex; flex-direction: column; }
.viewer::backdrop { background: #0b211ed6; }
.viewer-head, .viewer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 16px;
  gap: 12px;
}
.viewer-label { min-width: 0; }
.viewer-head h2 { font-size: 1rem; overflow-wrap: anywhere; }
.viewer-head p { color: var(--muted); font-size: .8125rem; margin-top: 4px; }
.viewer-media {
  display: grid;
  place-items: center;
  height: min(68vh, 745px);
  min-height: 140px;
  overflow: hidden;
  background: #142825;
  color: white;
}
.viewer-media img { width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.viewer-media p { padding: 16px; text-align: center; }
.viewer-nav { display: flex; align-items: center; gap: 9px; }
.viewer-nav span#position { min-width: 56px; color: var(--muted); font-size: .875rem; text-align: center; font-variant-numeric: tabular-nums; }
.primary-download {
  min-height: 42px;
  padding: 7px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
  background: var(--deep);
  color: #fff;
  border-radius: 7px;
  font-size: .875rem;
  font-weight: 650;
}
.primary-download:hover { background: #23554d; }
.close-icon { position: relative; width: 18px; height: 18px; }
.close-icon::before, .close-icon::after {
  content: "";
  position: absolute;
  left: 8px;
  width: 1.6px;
  height: 18px;
  background: currentColor;
  transform: rotate(45deg);
}
.close-icon::after { transform: rotate(-45deg); }
.chevron { width: 8px; height: 8px; border-right: 1.6px solid; border-top: 1.6px solid; }
.chevron-left { transform: rotate(-135deg); }
.chevron-right { transform: rotate(45deg); }

@media (max-width: 1100px) {
  .browse-body { grid-template-columns: 165px minmax(0, 1fr); gap: 18px; }
  .image-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 740px) {
  .container { width: calc(100% - 32px); }
  .topbar-inner { min-height: 55px; }
  .hero { min-height: 0; margin-block: 16px 29px; grid-template-columns: minmax(0, 1fr); border-radius: 10px; }
  .hero-copy { padding: 19px 17px 17px; }
  .hero br { display: none; }
  .hero h1 { font-size: clamp(1.7rem, 5.4vw, 2.2rem); }
  .hero-count { margin-top: 7px; font-size: .875rem; }
  .feature { min-height: 0; aspect-ratio: 2 / 1; padding: 10px; }
  .browse-head { margin-bottom: 10px; gap: 12px; padding-bottom: 12px; }
  .browse-head h2 { flex: none; font-size: 1.35rem; }
  .search { width: min(100%, 260px); padding: 0 9px; }
  .browse-body { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .folders { border-right: 0; padding-right: 0; }
  .folders h3 { display: none; }
  .folder-list { display: flex; white-space: nowrap; overflow-x: auto; padding: 5px 4px 7px; margin-inline: -4px; }
  .folder-button { min-height: 40px; }
  .results-head { min-height: 29px; margin-bottom: 8px; }
  .image-grid { gap: 10px; }
  .card-caption { padding: 7px 6px 7px 8px; gap: 6px; }
  .card-download { width: 38px; height: 40px; }
  .viewer { width: calc(100% - 20px); }
  .viewer-media { height: min(65vh, 65svh); }
  .viewer-head, .viewer-actions { padding: 10px; gap: 7px; }
}
@media (max-width: 350px) {
  .image-grid { grid-template-columns: minmax(0, 1fr); }
  .viewer-nav { gap: 5px; }
  .viewer-nav span#position { min-width: 45px; }
}
@media (prefers-reduced-motion: reduce) {
  .card-image img { transition: none; }
}
