:root {
  color-scheme: light;
  --ink: #181512;
  --muted: #746c63;
  --line: #ded7cd;
  --paper: #f7f2ea;
  --panel: #fffaf3;
  --accent: #9b1c31;
  --accent-ink: #ffffff;
  --green: #1d5f55;
  --shadow: 0 18px 46px rgba(30, 24, 16, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 76px;
  padding: 14px 28px;
  border-bottom: 1px solid rgba(24, 21, 18, 0.1);
  background: rgba(247, 242, 234, 0.92);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  padding: 8px 10px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-title {
  font-size: 24px;
  font-weight: 700;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(720px, 62vw);
}

.search {
  position: relative;
  flex: 1;
}

.search span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.search input,
.toolbar select {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  outline: none;
}

.search input {
  padding: 0 16px;
}

.toolbar select {
  max-width: 164px;
  padding: 0 12px;
}

.language-toggle {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  height: 44px;
  min-width: 116px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.language-button {
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.language-button.is-active {
  background: var(--ink);
  color: #fff;
}

.search input:focus,
.toolbar select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(155, 28, 49, 0.12);
}

.layout {
  display: grid;
  grid-template-columns: 276px 1fr;
  min-height: calc(100vh - 76px);
}

.sidebar {
  position: sticky;
  top: 76px;
  height: calc(100vh - 76px);
  overflow: auto;
  padding: 24px 16px 28px;
  border-right: 1px solid rgba(24, 21, 18, 0.1);
  background: #efe7da;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 12px;
  color: var(--muted);
}

.sidebar-head p {
  margin: 0;
  font-size: 13px;
}

.sidebar-head strong {
  font-size: 22px;
  color: var(--ink);
}

.ip-nav {
  display: grid;
  gap: 6px;
}

.ip-button {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 10px 12px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.ip-button:hover {
  background: rgba(255, 250, 243, 0.72);
}

.ip-button.is-active {
  background: var(--ink);
  color: #fff;
}

.ip-button span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ip-button span:last-child {
  color: currentColor;
  opacity: 0.72;
  font-size: 12px;
}

.content {
  padding: 34px 34px 56px;
}

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

.summary p {
  margin: 0 0 7px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.summary h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 62px);
  line-height: 1;
  letter-spacing: 0;
}

.stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stats span {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-height: 38px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  white-space: nowrap;
}

.stats strong {
  color: var(--ink);
  font-size: 18px;
}

.gallery {
  column-count: 4;
  column-gap: 18px;
}

.art-card {
  display: inline-block;
  width: 100%;
  margin: 0 0 18px;
  break-inside: avoid;
  border: 1px solid rgba(24, 21, 18, 0.1);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(24, 21, 18, 0.07);
  cursor: zoom-in;
}

.art-card img {
  display: block;
  width: 100%;
  min-height: 150px;
  background: #e3dbd0;
}

.art-card figcaption {
  padding: 12px;
}

.art-card strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.art-card span {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  margin: 70px auto;
  max-width: 360px;
  color: var(--muted);
  text-align: center;
}

.viewer {
  width: min(1160px, 94vw);
  max-width: none;
  height: min(820px, 92vh);
  max-height: none;
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: #14110f;
  color: #fff;
  box-shadow: var(--shadow);
}

.viewer::backdrop {
  background: rgba(10, 8, 6, 0.72);
  backdrop-filter: blur(6px);
}

.viewer figure {
  display: grid;
  grid-template-rows: 1fr auto;
  width: 100%;
  height: 100%;
  margin: 0;
}

.viewer img {
  align-self: center;
  justify-self: center;
  max-width: 100%;
  max-height: calc(92vh - 84px);
  object-fit: contain;
}

.viewer figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 70px;
  padding: 16px 74px;
  background: rgba(20, 17, 15, 0.94);
}

.viewer figcaption span {
  color: rgba(255, 255, 255, 0.68);
  text-align: right;
}

.viewer-close,
.viewer-nav {
  position: absolute;
  z-index: 2;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
}

.viewer-close {
  top: 14px;
  right: 14px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 30px;
  line-height: 1;
}

.viewer-nav {
  top: 50%;
  width: 48px;
  height: 70px;
  transform: translateY(-50%);
  border-radius: 6px;
  font-size: 46px;
  line-height: 1;
}

.viewer-prev {
  left: 16px;
}

.viewer-next {
  right: 16px;
}

@media (max-width: 1180px) {
  .gallery {
    column-count: 3;
  }
}

@media (max-width: 860px) {
  .topbar,
  .summary {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar {
    width: 100%;
  }

  .layout {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    max-height: 210px;
    border-right: 0;
    border-bottom: 1px solid rgba(24, 21, 18, 0.1);
  }

  .content {
    padding: 26px 18px 44px;
  }

  .gallery {
    column-count: 2;
    column-gap: 12px;
  }

  .art-card {
    margin-bottom: 12px;
  }

  .viewer figcaption {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 18px;
  }

  .viewer figcaption span {
    text-align: left;
  }
}

@media (max-width: 520px) {
  .topbar {
    padding: 14px 16px;
  }

  .toolbar {
    display: grid;
  }

  .toolbar select {
    max-width: none;
  }

  .language-toggle {
    width: 100%;
  }

  .gallery {
    column-count: 1;
  }

  .summary h1 {
    font-size: 34px;
  }
}
