@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,800&family=Manrope:wght@400;500;600;700&display=swap");

:root {
  --bg: #ffffff;
  --ink: #111111;
  --muted: #555555;
  --accent: #9d2235;
  --accent-dark: #7a1a2a;
  --accent-soft: rgba(157, 34, 53, 0.08);
  --paper: #f9f9f9;
  --paper-ink: #222222;
  --line: rgba(0, 0, 0, 0.08);
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.06);
  --radius: 12px;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Manrope", "Segoe UI", sans-serif;
  --cherry: #9d2235;
  --gold: #ffb81c;
  --slate: #3d5a80;
  --section-accent: var(--cherry);
}

/* Section-specific accent theming */
body.section-trains { --section-accent: var(--slate); }
body.section-dance { --section-accent: #6b2d5b; }
body.section-propaganda { --section-accent: var(--cherry); }
body.section-collections { --section-accent: var(--slate); }

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--sans);
  line-height: 1.7;
  font-size: 16px;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 10% 10%, rgba(157, 34, 53, 0.15), transparent 45%),
    radial-gradient(circle at 85% 15%, rgba(61, 90, 128, 0.10), transparent 45%),
    radial-gradient(circle at 10% 80%, rgba(196, 163, 90, 0.15), transparent 50%),
    linear-gradient(120deg, rgba(255, 255, 255, 0.6), rgba(245, 242, 236, 0.9));
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 220px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 200' preserveAspectRatio='none'%3E%3Cpath fill='%231a1a1a' d='M0,200 L0,165 L30,165 L30,155 L50,155 L50,160 L70,160 L70,145 L90,145 L90,155 L110,155 L110,135 L125,135 L125,120 L135,120 L135,105 L145,105 L145,90 L155,90 L155,105 L165,105 L165,125 L195,125 L195,115 L210,115 L210,100 L225,100 L225,85 L235,85 L235,75 L242,75 L242,65 L248,65 L248,55 L252,55 L252,45 L256,45 L256,35 L258,35 L258,20 L260,20 L260,8 L261,8 L261,3 L262,3 L262,8 L263,8 L263,20 L265,20 L265,35 L267,35 L267,45 L271,45 L271,55 L275,55 L275,65 L281,65 L281,75 L288,75 L288,85 L298,85 L298,100 L320,100 L320,85 L335,85 L335,65 L350,65 L350,40 L365,40 L365,65 L380,65 L380,50 L395,50 L395,30 L410,30 L410,50 L425,50 L425,65 L455,65 L455,80 L480,80 L480,95 L520,95 L520,75 L535,75 L535,55 L550,55 L550,35 L565,35 L565,55 L580,55 L580,75 L610,75 L610,90 L650,90 L650,105 L700,105 L700,115 L740,115 L740,105 L770,105 L770,120 L810,120 L810,130 L850,130 L850,140 L890,140 L890,135 L920,135 L920,145 L960,145 L960,150 L1000,150 L1000,145 L1030,145 L1030,155 L1060,155 L1060,150 L1090,150 L1090,158 L1120,158 L1120,152 L1150,152 L1150,160 L1180,160 L1180,165 L1200,165 L1200,200 Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: bottom center;
  background-size: 100% auto;
  opacity: 0.04;
  z-index: -1;
  pointer-events: none;
}

.wrap {
  width: min(1120px, 92vw);
  margin: 0 auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  backdrop-filter: blur(20px);
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 2px solid var(--cherry);
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--cherry);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.12em;
}

.brand-title {
  font-family: var(--serif);
  font-size: 1.25rem;
  margin: 0;
}

.brand-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.nav-link {
  text-decoration: none;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  transition: all 0.2s ease;
}

.nav-link:hover {
  background: var(--cherry);
  color: white;
  transform: translateY(-1px);
}

/* Dropdown */
.dropdown {
  position: relative;
  display: inline-block;
  padding-bottom: 10px;
  margin-bottom: -10px;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% - 10px);
  left: 50%;
  transform: translateX(-50%);
  background-color: white;
  min-width: 250px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  z-index: 1001;
  padding: 18px 0 8px;
  border: 1px solid var(--line);
}

.dropdown:hover .dropdown-menu,
.dropdown.open .dropdown-menu {
  display: block;
  animation: fadeup 0.2s ease forwards;
}

.dropdown-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--sans);
}

.dropdown-menu a {
  color: var(--ink);
  padding: 10px 20px;
  text-decoration: none;
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.1s;
}

.dropdown-menu a:hover {
  background-color: var(--accent-soft);
  color: var(--cherry);
}

/* Main */
.main {
  padding: 24px 0 96px;
}

.kicker,
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--section-accent, var(--accent-dark));
  font-size: 0.75rem;
  margin: 0 0 16px;
  font-weight: 700;
}

/* Hero */
.hero {
  padding: 64px 0 48px;
  animation: fadeup 0.8s ease both;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 4.4vw, 4rem);
  letter-spacing: -0.02em;
  margin: 0 0 20px;
  font-weight: 800;
}

.lead {
  font-size: 1.08rem;
  color: var(--muted);
  max-width: 720px;
  margin: 0 auto;
  text-align: left;
}

/* Hero — homepage variant */
.hero--home {
  padding: 80px 0 56px;
}

.hero--home::after {
  content: '';
  display: block;
  width: 80px;
  height: 4px;
  margin: 32px auto 0;
  background: linear-gradient(to right, var(--cherry), var(--gold));
  border-radius: 2px;
}

/* Hero — image variant (exhibit sections) */
.hero--image {
  position: relative;
  min-height: 420px;
  display: flex;
  align-items: flex-end;
  padding: 0;
  max-width: none;
  text-align: left;
  overflow: hidden;
}

.hero__backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero__backdrop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.75) 0%,
    rgba(0, 0, 0, 0.45) 40%,
    rgba(0, 0, 0, 0.2) 100%
  );
  z-index: 1;
}

.hero--image .wrap {
  position: relative;
  z-index: 2;
  padding: 48px 0;
}

.hero--image h1 {
  color: #fff;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.hero--image .eyebrow {
  color: var(--gold);
}

.hero--image .lead {
  color: rgba(255, 255, 255, 0.85);
}

.hero--image .badge {
  background: rgba(255, 255, 255, 0.15) !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
  backdrop-filter: blur(8px);
}

@media (max-width: 640px) {
  .hero--image {
    min-height: 320px;
  }
}

/* Section titles */
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.section-title h2 {
  font-family: var(--serif);
  font-size: 2.1rem;
  letter-spacing: -0.01em;
  margin: 0;
  position: relative;
  display: inline-block;
}

.section-title h2::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 60px;
  height: 3px;
  background: linear-gradient(to right, var(--section-accent, var(--cherry)), var(--gold));
  border-radius: 2px;
}

.section-title p {
  margin: 0;
  color: var(--muted);
}

/* Overview / Breakdowns */
.overview {
  padding: 40px 0;
}

.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.panel {
  background: var(--paper);
  padding: 22px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  position: relative;
}

.panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(to right, var(--cherry), var(--gold), var(--slate));
  border-radius: var(--radius) var(--radius) 0 0;
}

.panel h3 {
  margin: 0 0 14px;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent-dark);
}

.count-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.count-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 8px;
}

/* Collection browse grid */
.collections-browse {
  padding: 40px 0;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.collection-card {
  display: flex;
  background: white;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}

.collection-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  border-color: rgba(157, 34, 53, 0.3);
}

.collection-card:hover .collection-card-image img {
  transform: scale(1.03);
}

.collection-card-image {
  width: 140px;
  min-height: 160px;
  flex-shrink: 0;
  background: var(--bg);
  overflow: hidden;
  position: relative;
}

.collection-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.collection-card-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.collection-card-body h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.3;
}

.collection-card-body .summary {
  font-size: 0.88rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Gallery / Cards */
.gallery {
  padding: 40px 0;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.card {
  background: var(--paper);
  border-radius: calc(var(--radius) + 6px);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 22px 45px rgba(28, 26, 22, 0.1);
  display: flex;
  flex-direction: column;
  min-height: 100%;
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 28px 50px rgba(28, 26, 22, 0.14);
}

.card:hover .image-frame img {
  transform: scale(1.03);
}

.image-link {
  display: block;
  background: #ede7db;
}

.image-frame {
  position: relative;
  aspect-ratio: 3 / 4;
  background: linear-gradient(135deg, rgba(157, 34, 53, 0.08), rgba(15, 12, 9, 0.04));
  overflow: hidden;
}

.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.card-body {
  padding: 20px 20px 22px;
  display: grid;
  gap: 10px;
}

.card-body h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.38rem;
  line-height: 1.2;
}

.meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.summary {
  margin: 0;
  color: var(--paper-ink);
  font-size: 0.98rem;
}

/* Chips */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.78rem;
  text-decoration: none;
}

/* CTA */
.cta {
  padding: 40px 0 20px;
}

.cta-card {
  border-radius: calc(var(--radius) + 8px);
  border: 1px solid var(--line);
  background: #1f1b16;
  color: #f5f2ec;
  padding: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.cta-card h2 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 2.2rem;
}

.cta-card p {
  margin: 0;
  color: rgba(245, 242, 236, 0.8);
}

/* Footer */
.site-footer {
  background: #1a1a1a;
  color: rgba(255, 255, 255, 0.7);
  padding: 0;
  border-top: none;
  font-size: 0.9rem;
  position: relative;
}

.footer-skyline {
  height: 60px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 60' preserveAspectRatio='none'%3E%3Cpath fill='%231a1a1a' d='M0,60 L0,45 L50,45 L50,40 L80,40 L80,35 L100,35 L100,30 L115,30 L115,20 L120,20 L120,12 L122,12 L122,5 L123,5 L123,12 L125,12 L125,20 L130,20 L130,30 L150,30 L150,25 L170,25 L170,15 L185,15 L185,25 L200,25 L200,35 L250,35 L250,30 L280,30 L280,20 L295,20 L295,30 L310,30 L310,38 L400,38 L400,32 L430,32 L430,42 L500,42 L500,38 L550,38 L550,42 L600,42 L600,35 L650,35 L650,40 L700,40 L700,38 L750,38 L750,42 L800,42 L800,40 L850,40 L850,44 L900,44 L900,42 L950,42 L950,45 L1000,45 L1000,43 L1050,43 L1050,46 L1100,46 L1100,44 L1150,44 L1150,47 L1200,47 L1200,60 Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: bottom center;
  background-size: 100% auto;
  margin-top: -1px;
}

.footer-body {
  padding: 48px 0 24px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 40px;
}

.footer-credit p {
  margin: 0 0 6px;
  line-height: 1.6;
}

.footer-heading {
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  margin-bottom: 12px;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 20px 0;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
}

.site-footer a {
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}

.site-footer a:hover {
  border-bottom-color: var(--gold);
}

@media (max-width: 640px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
}

/* Inline links */
.lead a,
.cta-card a {
  color: var(--accent-dark);
  text-decoration: none;
  border-bottom: 1px solid rgba(157, 34, 53, 0.3);
  transition: border-color 0.15s ease;
}

.cta-card a {
  color: var(--gold);
  border-bottom-color: rgba(196, 163, 90, 0.3);
}

.lead a:hover,
.cta-card a:hover {
  border-bottom-color: var(--accent);
}

.cta-card a:hover {
  border-bottom-color: var(--gold);
}

/* Count-list links */
.count-list a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}

.count-list a:hover {
  border-bottom-color: var(--accent);
  color: var(--accent-dark);
}

/* Scroll-triggered reveal */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
  transition-delay: var(--delay, 0s);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Theme card hover */
.theme-card > div {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.theme-card:hover > div {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12) !important;
}

/* Animations */
@keyframes lift {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeup {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 900px) {
  .section-title {
    align-items: flex-start;
  }

  .header-nav .nav-link {
    font-size: 0.78rem;
    padding: 4px 8px;
  }
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--ink);
}

@media (max-width: 640px) {
  .nav-toggle {
    display: block;
  }

  .header-nav {
    display: none;
    flex-direction: column;
    width: 100%;
    gap: 4px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }

  .header-nav.open {
    display: flex;
  }

  .dropdown-menu {
    position: static;
    transform: none;
    box-shadow: none;
    border: none;
    padding: 0 0 0 16px;
    min-width: 0;
    margin-top: 0;
  }

  .site-header .wrap {
    flex-wrap: wrap;
  }

  .collection-card {
    flex-direction: column;
  }

  .collection-card-image {
    width: 100%;
    min-height: 200px;
    max-height: 250px;
  }

  .cta-card {
    padding: 24px;
  }
}

/* AI visual tag chips */
.chip.ai-tag {
  background: rgba(61, 90, 128, 0.1);
  color: var(--slate);
  border: 1px solid rgba(61, 90, 128, 0.2);
  font-size: 0.75rem;
  font-style: italic;
}

/* Source collection badge */
.source-badge {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.source-railroad {
  background: rgba(61, 90, 128, 0.1);
  color: var(--slate);
  border: 1px solid rgba(61, 90, 128, 0.2);
}

.source-warposters {
  background: rgba(157, 34, 53, 0.1);
  color: var(--accent);
  border: 1px solid rgba(157, 34, 53, 0.2);
}
.source-cityparks {
  background: rgba(34, 120, 80, 0.1);
  color: #1a6040;
  border: 1px solid rgba(34, 120, 80, 0.2);
}

.source-templehistory {
  background: rgba(180, 130, 40, 0.1);
  color: #8a6820;
  border: 1px solid rgba(180, 130, 40, 0.2);
}

/* Filter buttons */
.filter-btn {
  padding: 0.5rem 1.2rem;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-btn:hover {
  border-color: var(--cherry);
  color: var(--cherry);
}

.filter-btn.active {
  background: var(--cherry);
  color: white;
  border-color: var(--cherry);
}

/* Face detection badge overlaid on image frame */
.face-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 0.85rem;
  line-height: 1;
  backdrop-filter: blur(4px);
}

/* Visual similarity section */
.similar-browse {
  padding: 40px 0;
}

.similarity-row {
  display: grid;
  grid-template-columns: 1.3fr auto 1fr 1fr 1fr;
  gap: 16px;
  align-items: start;
  padding: 32px 0;
  border-top: 1px solid var(--line);
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}

.similarity-row:first-of-type {
  border-top: none;
}

.similarity-anchor {
  text-align: center;
  position: relative;
}

.similarity-anchor-badge {
  display: inline-block;
  margin-bottom: 8px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(157, 34, 53, 0.1);
  color: var(--cherry);
  border: 1px solid rgba(157, 34, 53, 0.2);
}

.similarity-anchor img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 10px;
  border: 3px solid var(--cherry);
  display: block;
}

.similarity-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 60px;
  color: var(--muted);
  font-size: 1.2rem;
}

.similarity-arrow::after {
  content: "\2192";
  font-size: 1.4rem;
  color: var(--muted);
  opacity: 0.5;
}

.similarity-label {
  margin: 8px 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.3;
  font-weight: 600;
}

.similarity-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.15s ease;
}

.similarity-thumb:hover {
  opacity: 0.8;
}

.similarity-thumb img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  display: block;
}

.similarity-thumb-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 640px) {
  .similarity-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .similarity-arrow {
    padding-top: 0;
    transform: rotate(90deg);
  }
}

/* Tag frequency bar charts */
.tag-dimension {
  padding: 40px 0;
  border-top: 1px solid var(--line);
}

.tag-dimension:first-of-type {
  border-top: none;
}

.tag-chart {
  display: grid;
  gap: 14px;
  margin-bottom: 28px;
}

.tag-bar-row {
  display: grid;
  grid-template-columns: 180px 1fr 40px;
  align-items: center;
  gap: 14px;
}

.tag-bar-label {
  font-size: 0.9rem;
  font-weight: 500;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag-bar-track {
  height: 18px;
  background: rgba(28, 26, 22, 0.07);
  border-radius: 999px;
  overflow: hidden;
}

.tag-bar-fill {
  height: 100%;
  background: linear-gradient(to right, var(--cherry), var(--gold));
  border-radius: 999px;
  transition: width 0.4s ease;
  min-width: 2px;
}

.tag-bar-count {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  text-align: right;
}

/* Tag sample thumbnails */
.tag-sample {
  margin-top: 4px;
}

.tag-sample-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 12px;
}

.tag-sample-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.tag-sample-thumb {
  display: block;
  aspect-ratio: 3 / 4;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  transition: opacity 0.15s ease;
}

.tag-sample-thumb:hover {
  opacity: 0.8;
}

.tag-sample-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media (max-width: 900px) {
  .tag-bar-row {
    grid-template-columns: 140px 1fr 36px;
  }

  .tag-sample-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 640px) {
  .tag-bar-row {
    grid-template-columns: 100px 1fr 32px;
    gap: 8px;
  }

  .tag-sample-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}