:root {
  color-scheme: light;
  --paper: #f7f5ef;
  --card: #fffefa;
  --ink: #222b25;
  --muted: #59645b;
  --jade: #274b3c;
  --deep-jade: #1f382e;
  --pale-jade: #e9eee6;
  --vermilion: #9b4636;
  --line: #dedfd4;
  --serif: "Noto Serif SC", "Songti SC", STSong, SimSun, Georgia, serif;
  --sans: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.6 var(--sans);
}

button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--vermilion); outline-offset: 4px; }

.visually-hidden, .skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link:focus {
  position: absolute;
  z-index: 2;
  top: .75rem;
  left: .75rem;
  padding: .5rem .8rem;
  background: var(--card);
}

.page-width { width: min(1240px, calc(100% - 64px)); margin-inline: auto; }

.site-header { border-bottom: 1px solid var(--line); }

.header-inner, .header-nav, .brand, .footer-inner {
  display: flex;
  align-items: center;
}

.header-inner { justify-content: space-between; min-height: 74px; gap: 16px; }
.header-nav { gap: 25px; font-size: .875rem; }
.header-nav a, .brand { text-decoration: none; }
.header-nav > a:not(.submit-link):hover, .footer-inner a:hover { text-decoration: underline; }

.brand {
  gap: 12px;
  font-size: .96rem;
  font-weight: 680;
  letter-spacing: -.02em;
  white-space: nowrap;
}

.brand-seal {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  border-radius: 5px;
  background: var(--vermilion);
  color: #fff8e9;
  font: 700 1.25rem var(--serif);
}

.submit-link {
  display: inline-flex;
  gap: .5em;
  align-items: center;
  padding: 8px 13px;
  border: 1px solid #a9b4a9;
  border-radius: 6px;
  color: var(--deep-jade);
  white-space: nowrap;
}

.submit-link:hover { background: var(--pale-jade); }

.hero {
  display: grid;
  grid-template-columns: 1fr 1.06fr;
  margin-block: 36px 56px;
  overflow: hidden;
  border-radius: 13px;
  background: var(--deep-jade);
  color: #fff9eb;
}

.hero-copy { padding: clamp(34px, 5vw, 70px); }

.hero h1 {
  margin: 0;
  font: 700 clamp(2.1rem, 4.2vw, 4rem)/1.16 var(--serif);
  letter-spacing: -.055em;
}

.hero h1 span { font-family: Georgia, var(--serif); font-weight: 500; white-space: nowrap; }

.hero p {
  max-width: 24em;
  margin: 20px 0 26px;
  color: #dae5d8;
  line-height: 1.75;
  text-wrap: pretty;
}

.hero-art { position: relative; min-height: 100%; margin: 0; background: #c2ad91; }

.hero-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.hero-credit {
  position: absolute;
  right: 10px;
  bottom: 10px;
  max-width: calc(100% - 20px);
  padding: 4px 8px;
  border-radius: 4px;
  background: #fffdf2;
  color: #364a3d;
  font-size: .72rem;
}

.browse-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 9px 15px;
  border: 1px solid #b8c1ae;
  border-radius: 6px;
  background: var(--pale-jade);
  color: var(--deep-jade);
  text-decoration: none;
  font-size: .89rem;
  font-weight: 650;
}

.browse-link:hover { background: #d8e4d5; }
.hero .browse-link:focus-visible { outline-color: #f7d4a6; }

.directory { padding-bottom: 60px; scroll-margin-top: 20px; }

.directory-heading, .directory-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.directory h2 {
  margin: 0;
  font: 700 clamp(1.85rem, 3.1vw, 2.8rem)/1.25 var(--serif);
  letter-spacing: -.05em;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: min(100%, 370px);
  min-height: 48px;
  border: 1px solid #c4cbbf;
  border-radius: 8px;
  background: var(--card);
  color: var(--muted);
}

.search-box:focus-within { border-color: var(--jade); outline: 2px solid #718c79; outline-offset: 2px; }

.search-icon {
  position: absolute;
  left: 16px;
  width: 13px;
  height: 13px;
  border: 1.7px solid currentColor;
  border-radius: 50%;
  pointer-events: none;
}

.search-icon::after {
  position: absolute;
  top: 9px;
  left: 9px;
  width: 6px;
  height: 1.6px;
  background: currentColor;
  transform: rotate(45deg);
  transform-origin: left center;
  content: "";
}

.search-box input {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 0 42px;
  border: 0;
  border-radius: inherit;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1rem;
}

.search-box input::placeholder { color: #657164; }
.search-box input::-webkit-search-cancel-button { -webkit-appearance: none; }

.clear-search {
  position: absolute;
  right: 5px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--jade);
  font-size: 1.35rem;
  line-height: 1;
}

.clear-search:hover { background: var(--pale-jade); }
.directory-controls { margin: 22px 0 20px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }

.filter-button {
  min-height: 38px;
  padding: 6px 14px;
  border: 1px solid #cbd2c5;
  border-radius: 999px;
  background: var(--card);
  color: var(--jade);
  font-size: .88rem;
  white-space: nowrap;
}

.filter-button:hover { border-color: #879a87; background: var(--pale-jade); }
.filter-button[aria-pressed="true"] { border-color: var(--jade); background: var(--jade); color: white; }
.result-count { flex: none; margin: 0; color: var(--muted); font-size: .88rem; }

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

.project-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}

.card-art { overflow: hidden; aspect-ratio: 4 / 3; background: #eae5da; }
.card-art img { display: block; width: 100%; height: 100%; object-fit: contain; }

.card-body { display: flex; flex: 1; flex-direction: column; padding: 17px 18px 18px; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .75rem; }
.category-label { padding: 2px 8px; border-radius: 4px; background: var(--pale-jade); color: var(--jade); }
.app-label { color: #804434; }
.card-title { margin: 9px 0 1px; font: 700 1.38rem/1.35 var(--serif); overflow-wrap: anywhere; }
.card-author, .image-credit { margin: 0; color: var(--muted); font-size: .84rem; overflow-wrap: anywhere; }
.card-description { flex: 1; margin: 11px 0 14px; color: #3f4a40; font-size: .92rem; overflow-wrap: anywhere; }

.card-links { display: flex; flex-wrap: wrap; gap: 7px 14px; padding-top: 11px; border-top: 1px solid var(--line); }
.card-links a, .footer-inner a { color: var(--jade); font-size: .85rem; font-weight: 650; text-decoration: none; }
.card-links a:hover { text-decoration: underline; }
.card-links a span { margin-left: 3px; color: #526b5c; }
.image-credit { margin-top: 10px; font-size: .73rem; }
.image-credit a:hover { color: var(--jade); }

.empty-state, .load-error {
  margin: 12px 0 0;
  padding: 32px 18px;
  border: 1px dashed #bfc8b9;
  border-radius: 10px;
  background: var(--card);
  color: var(--muted);
  text-align: center;
}

.empty-state p { margin: 0 0 12px; }
.site-footer { border-top: 1px solid var(--line); }
.footer-inner { justify-content: space-between; gap: 16px; min-height: 76px; color: var(--muted); font-size: .82rem; }
.footer-inner a { flex: none; }

@media (max-width: 900px) {
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-width { width: calc(100% - 44px); }
  .hero-copy { padding: 36px 30px; }
}

@media (max-width: 680px) {
  .page-width { width: calc(100% - 32px); }
  .header-inner { min-height: 63px; }
  .header-nav { gap: 12px; }
  .brand { gap: 7px; font-size: .79rem; }
  .brand-seal { width: 29px; height: 29px; font-size: 1.12rem; }
  .submit-link { padding: 6px 9px; font-size: .78rem; }
  .header-nav > a:not(.submit-link) { display: none; }
  .hero { grid-template-columns: 1fr; margin-block: 22px 34px; }
  .hero-copy { padding: 27px 24px; }
  .hero p { margin: 13px 0 18px; font-size: .93rem; }
  .hero-art { min-height: 0; aspect-ratio: 16 / 8.3; }
  .directory-heading, .directory-controls { flex-direction: column; align-items: stretch; gap: 12px; }
  .directory-controls { margin: 15px 0; }
  .search-box { width: 100%; }
  .project-grid { gap: 14px; }
  .directory { padding-bottom: 35px; }
  .footer-inner { flex-wrap: wrap; padding-block: 16px; gap: 10px; }
  .footer-inner p { margin: 0; }
}

@media (max-width: 500px) {
  .project-grid { grid-template-columns: 1fr; }
}

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