:root {
  --bg: #fbf5ee;
  --bg-blush: #f6e6dc;
  --bg-butter: #f8f1c7;
  --bg-mint: #dcefe3;
  --card: rgba(255, 252, 247, 0.9);
  --card-strong: rgba(255, 250, 244, 0.97);
  --ink: #4c3a2f;
  --muted: #938171;
  --ink-soft: #6b5849;
  --border: rgba(127, 93, 67, 0.16);
  --chip: #f3e0d4;
  --chip-soft: #ece4f5;
  --chip-alt: #dfeee3;
  --hero-accent: #7fbf41;
  --hero-accent-soft: #a9d18e;
  --button-active-bg: linear-gradient(135deg, #f2e3d4 0%, #e7f2d2 100%);
  --button-active-text: #5e4c3c;
  --button-active-border: rgba(127, 191, 65, 0.26);
  --shadow: rgba(93, 58, 33, 0.12);
  --shadow-strong: rgba(93, 58, 33, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 255, 255, 0.95), transparent 24%),
    radial-gradient(circle at 88% 8%, rgba(169, 209, 142, 0.26), transparent 18%),
    radial-gradient(circle at 84% 28%, rgba(248, 241, 199, 0.35), transparent 16%),
    linear-gradient(180deg, #fffdfa 0%, var(--bg) 46%, #f2e7da 100%);
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
}

body.is-modal-open {
  overflow: hidden;
}

.page-header {
  position: relative;
  overflow: hidden;
  padding: 42px 0 28px;
}

.page-header::before,
.page-header::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(2px);
}

.page-header::before {
  top: -80px;
  right: 8%;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(169, 209, 142, 0.32), rgba(169, 209, 142, 0));
}

.page-header::after {
  top: 12px;
  right: 20%;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(248, 241, 199, 0.6), rgba(248, 241, 199, 0));
}

.wrap {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
}

.hero-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 360px);
  gap: 18px;
  align-items: end;
}

.hero-copy,
.hero-panel {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(76, 58, 47, 0.46);
}

.title {
  margin: 0;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 0.92;
  letter-spacing: -0.03em;
}

.subtitle {
  max-width: 620px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.hero-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(127, 93, 67, 0.12);
  background: rgba(255, 251, 246, 0.78);
  box-shadow: 0 8px 18px rgba(93, 58, 33, 0.06);
  font-size: 12px;
  color: var(--ink-soft);
}

.hero-panel {
  padding: 18px;
  border: 1px solid rgba(127, 93, 67, 0.12);
  border-radius: 30px;
  background:
    linear-gradient(135deg, rgba(255, 249, 241, 0.96), rgba(255, 255, 255, 0.78)),
    radial-gradient(circle at top right, rgba(169, 209, 142, 0.22), transparent 40%);
  box-shadow: 0 22px 48px rgba(93, 58, 33, 0.1);
}

.hero-panel-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.hero-stat {
  padding: 12px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  text-align: center;
}

.hero-stat-label {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.hero-stat-value {
  display: block;
  margin-top: 6px;
  font-size: 24px;
  line-height: 1;
}

.hero-panel-note {
  margin: 14px 2px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.controls {
  position: sticky;
  top: 10px;
  z-index: 10;
  margin: 10px 0 24px;
  padding: 20px;
  background:
    linear-gradient(180deg, rgba(255, 252, 248, 0.95), rgba(255, 249, 244, 0.9)),
    radial-gradient(circle at top left, rgba(248, 241, 199, 0.2), transparent 28%);
  border: 1px solid var(--border);
  border-radius: 30px;
  box-shadow: 0 22px 50px var(--shadow);
  backdrop-filter: blur(16px);
}

.search-label,
.filter-heading,
.meta-label {
  display: block;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.search-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 15px 18px;
  font: inherit;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.search-input:focus-visible,
.swatch:focus-visible,
.filter-chip:focus-visible,
.image-lightbox-close:focus-visible {
  outline: 2px solid rgba(58, 42, 28, 0.58);
  outline-offset: 2px;
}

.filter-panel {
  margin-top: 14px;
}

.active-filters {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(127, 93, 67, 0.1);
  border-radius: 20px;
  background: rgba(255, 251, 246, 0.62);
}

.active-filter-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.active-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.active-filter-chip {
  appearance: none;
  border: 1px solid rgba(127, 93, 67, 0.12);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink-soft);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.active-filter-chip-x {
  margin-left: 8px;
  color: var(--muted);
}

.clear-filters-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.filter-drawer {
  margin-top: 14px;
  border: 1px solid rgba(127, 93, 67, 0.1);
  border-radius: 20px;
  background: rgba(255, 252, 247, 0.55);
}

.filter-drawer-summary {
  padding: 12px 14px;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  user-select: none;
}

.filter-drawer-summary::marker,
.filter-drawer-summary::-webkit-details-marker {
  color: var(--muted);
}

.filter-drawer-body {
  padding: 0 14px 14px;
}

.filter-drawer-section + .filter-drawer-section {
  margin-top: 12px;
}

.filter-drawer-label {
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.filter-chips,
.meta-value {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip,
.chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
}

.filter-chip {
  appearance: none;
  padding: 9px 13px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(93, 58, 33, 0.04);
  transition: transform 120ms ease, background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.filter-chip:hover,
.filter-chip.is-active {
  background: var(--button-active-bg);
  color: var(--button-active-text);
  border-color: var(--button-active-border);
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(127, 191, 65, 0.12);
}

.filter-chip-light {
  background: rgba(255, 255, 255, 0.68);
}

.results-meta,
.meta,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.card {
  position: relative;
  margin: 18px 0;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 34px;
  background:
    linear-gradient(180deg, rgba(255, 253, 249, 0.96), rgba(255, 249, 243, 0.92)),
    var(--card);
  box-shadow: 0 24px 54px var(--shadow);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 24px;
  width: 90px;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--hero-accent), #f0c972, #a6d5ef);
}

.card-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.card-heading h2 {
  margin: 8px 0 0;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.02;
}

.type-badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border-radius: 999px;
  background: linear-gradient(135deg, #3a291d 0%, #856148 100%);
  color: #fff;
  font-size: 12px;
  letter-spacing: 0.08em;
  box-shadow: 0 10px 18px rgba(58, 41, 29, 0.16);
}

.meta-row-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.file {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.file-link {
  align-self: flex-start;
  text-decoration: none;
  border-bottom: 1px dashed rgba(127, 112, 101, 0.6);
}

.summary {
  max-width: 760px;
  margin: 16px 0 0;
  font-size: 15px;
  line-height: 1.7;
  color: rgba(76, 58, 47, 0.8);
}

.entry-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(0, 1.08fr);
  gap: 18px;
  margin-top: 18px;
}

.visual-panel,
.analysis-panel {
  min-width: 0;
}

.panel-title {
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.source-image-button {
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 26px;
  overflow: hidden;
  cursor: zoom-in;
  background: #fff;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.06),
    0 16px 30px rgba(93, 58, 33, 0.08);
}

.source-image {
  display: block;
  width: 100%;
  min-height: 280px;
  max-height: 560px;
  object-fit: cover;
  background: linear-gradient(180deg, #fbf7f1 0%, #efe4d5 100%);
}

.source-image-caption {
  display: block;
  padding: 13px 16px 15px;
  text-align: left;
  color: var(--muted);
  font-size: 12px;
}

.source-image-placeholder {
  min-height: 280px;
  padding: 24px;
  border: 1px dashed rgba(127, 112, 101, 0.28);
  border-radius: 26px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(239, 225, 210, 0.55)),
    repeating-linear-gradient(
      -45deg,
      rgba(127, 112, 101, 0.03),
      rgba(127, 112, 101, 0.03) 12px,
      rgba(255, 255, 255, 0.08) 12px,
      rgba(255, 255, 255, 0.08) 24px
    );
}

.source-image-placeholder-label {
  display: inline-flex;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(53, 38, 29, 0.08);
  font-size: 12px;
  color: var(--ink-soft);
}

.source-image-placeholder-text {
  max-width: 24em;
  margin: 14px 0 0;
  color: var(--ink-soft);
  line-height: 1.7;
}

.visual-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.swatches {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.swatch {
  appearance: none;
  border: 0;
  border-radius: 22px;
  padding: 14px;
  min-height: 120px;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  cursor: pointer;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.05),
    0 10px 18px rgba(93, 58, 33, 0.06);
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

.swatch:hover {
  transform: translateY(-2px);
  filter: saturate(1.05);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.05),
    0 16px 28px rgba(67, 53, 41, 0.15);
}

.swatch-copy-hint {
  margin-bottom: auto;
  font-size: 11px;
  text-transform: uppercase;
  opacity: 0.72;
}

.swatch-hex {
  font-weight: 700;
  letter-spacing: 0.03em;
}

.swatch-name,
.swatch-ratio {
  font-size: 12px;
  opacity: 0.92;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.detail-block {
  min-height: 100%;
  padding: 16px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 250, 244, 0.66));
  border: 1px solid rgba(116, 89, 64, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

.detail-block-compact {
  padding: 14px;
}

.detail-list {
  margin: 0;
  padding-left: 18px;
  color: rgba(76, 58, 47, 0.82);
}

.detail-list li + li {
  margin-top: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  background: var(--chip);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.chip-soft {
  background: var(--chip-soft);
}

.chip-alt {
  background: var(--chip-alt);
}

.muted-block {
  margin: 0;
}

.copy-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(76, 58, 47, 0.9);
  color: #fff;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.copy-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 30;
}

.image-lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(18, 14, 10, 0.7);
}

.image-lightbox-dialog {
  position: relative;
  z-index: 1;
  width: min(94vw, 1080px);
  margin: 3vh auto;
  padding: 18px;
  border-radius: 30px;
  background: rgba(255, 252, 248, 0.98);
  box-shadow: 0 32px 80px var(--shadow-strong);
}

.image-lightbox-close {
  display: block;
  margin-left: auto;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font: inherit;
  cursor: pointer;
}

.image-lightbox-image {
  display: block;
  width: 100%;
  max-height: 78vh;
  margin-top: 14px;
  border-radius: 18px;
  object-fit: contain;
  background: #f6f2ec;
}

.image-lightbox-caption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.empty {
  padding: 24px 0 40px;
  color: var(--muted);
}

.is-hidden {
  display: none !important;
}

@media (max-width: 860px) {
  .hero-shell {
    grid-template-columns: 1fr;
  }

  .hero-panel-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .entry-layout {
    grid-template-columns: 1fr;
  }

  .visual-meta-grid {
    grid-template-columns: 1fr;
  }

  .details-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .wrap {
    width: min(100vw - 20px, 1120px);
  }

  .controls,
  .card,
  .image-lightbox-dialog {
    padding: 16px;
  }

  .hero-panel {
    padding: 16px;
  }

  .active-filter-row {
    flex-direction: column;
  }

  .card-header {
    flex-direction: column;
  }
}
