/* ── Browsing: views, toolbar, filter sheet, justified grid, collections ──
   Tokens only. No decoration: hairlines and whitespace do the separating. */

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  z-index: 300;
  padding: 0.6rem 1rem;
  background: var(--color-accent);
  color: var(--color-accent-text);
  text-decoration: none;
}
.skip-link:focus {
  top: 0.5rem;
}

.app-main {
  max-width: 1600px;
  margin: 0 auto;
  padding: 1.5rem 2rem 4rem;
  outline: none;
}
@media (max-width: 600px) {
  .app-main { padding: 1rem 1rem 3rem; }
}

/* ── Search ─────────────────────────────────────────────────────────────── */
.search-bar {
  padding: 0.75rem 2rem;
  border-bottom: 1px solid var(--color-border-subtle);
}
.search-bar[hidden] { display: none; }
@media (max-width: 600px) {
  .search-bar { padding: 0.75rem 1rem; }
}
.search-bar input {
  width: 100%;
  max-width: 40rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: 0;
  background: var(--color-bg);
  color: var(--color-text-primary);
  font-size: 1rem;
}
.search-bar input:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

/* ── View header ────────────────────────────────────────────────────────── */
.view-header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin-bottom: 1.25rem;
}
.view-title {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  outline: none;
}
.view-blurb {
  flex-basis: 100%;
  max-width: 42rem;
  margin-top: 0.5rem;
  color: var(--color-text-secondary);
  font-size: 1rem;
  line-height: 1.5;
}
.view-count {
  color: var(--color-text-muted);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

/* ── Toolbar ────────────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  margin-bottom: 1rem;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--color-border);
}
.segmented__btn {
  padding: 0.5rem 0.9rem;
  border: 0;
  background: none;
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.segmented__btn + .segmented__btn {
  border-left: 1px solid var(--color-border);
}
.segmented__btn[aria-pressed="true"] {
  background: var(--color-accent);
  color: var(--color-accent-text);
}

.toolbar__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--color-border);
  background: none;
  color: var(--color-text-primary);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.toolbar__btn[aria-expanded="true"] {
  border-color: var(--color-accent);
}
.toolbar__badge:not(:empty) {
  min-width: 1.25rem;
  padding: 0 0.3rem;
  background: var(--color-accent);
  color: var(--color-accent-text);
  font-size: 0.7rem;
  line-height: 1.25rem;
  text-align: center;
}

/* ── Filter sheet ───────────────────────────────────────────────────────── */
.filter-sheet {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 1rem;
  padding: 1.25rem;
  border: 1px solid var(--color-border-subtle);
}
.filter-sheet[hidden] { display: none; }

.facet {
  border: 0;
  min-width: 0;
}
.facet__label {
  margin-bottom: 0.5rem;
  color: var(--color-text-muted);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.facet__values {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.facet__toggle {
  display: inline-flex;
  gap: 0.5rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--color-border-subtle);
  background: none;
  color: var(--color-text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
}
.facet__toggle:hover:not(:disabled) {
  border-color: var(--color-border);
  color: var(--color-text-primary);
}
.facet__toggle[aria-pressed="true"] {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: var(--color-accent-text);
}
.facet__toggle:disabled {
  opacity: 0.4;
  cursor: default;
}
.facet__count {
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
}

/* ── Active filters ─────────────────────────────────────────────────────── */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.active-filters[hidden] { display: none; }
.filter-chip {
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--color-border);
  background: none;
  color: var(--color-text-primary);
  font-size: 0.8rem;
  cursor: pointer;
}
.filter-chip:hover {
  background: var(--color-surface-hover);
}

/* ── Justified grid ─────────────────────────────────────────────────────── */
.art-grid {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}
.art-row {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.art-card {
  display: block;
  flex: 0 0 auto;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.art-card__frame {
  position: relative;
  display: block;
  width: 100%;
  background: var(--color-surface);
  overflow: hidden;
}
.art-card__frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.art-card__frame.has-error {
  display: grid;
  place-items: center;
  padding: 1rem;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  text-align: center;
}
.art-card__play {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  background: var(--color-bg);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
}
.art-card__caption {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding-top: 0.5rem;
}
.art-card__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
  font-weight: 500;
}
.art-card__meta {
  min-height: 1.2em;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}
.art-card:hover .art-card__title,
.art-card:focus-visible .art-card__title {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Neutral loading placeholder (respects reduced motion via the global rule) */
.shimmer {
  position: absolute;
  inset: 0;
  background: var(--color-surface-hover);
  animation: pulse 1.6s ease-in-out infinite;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.shimmer--done {
  animation: none;
  opacity: 0;
}
@keyframes pulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

/* ── Chronological: year headings + rail ────────────────────────────────── */
.year-rail {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 0.25rem;
  margin: 0 -2rem 1.5rem;
  padding: 0.5rem 2rem;
  overflow-x: auto;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border-subtle);
  scrollbar-width: none;
}
.year-rail::-webkit-scrollbar { display: none; }
@media (max-width: 600px) {
  .year-rail { margin: 0 -1rem 1.25rem; padding: 0.5rem 1rem; }
}
.year-rail__btn {
  flex-shrink: 0;
  padding: 0.35rem 0.6rem;
  border: 1px solid transparent;
  background: none;
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.year-rail__btn:hover {
  border-color: var(--color-border);
  color: var(--color-text-primary);
}
.year-section {
  margin-bottom: 2.5rem;
  scroll-margin-top: 3.5rem;
}
.year-heading {
  margin-bottom: 1rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.year-heading a {
  color: inherit;
  text-decoration: none;
}
.year-heading a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.year-heading__count {
  color: var(--color-text-muted);
  font-size: 0.8rem;
  font-weight: 400;
}

/* ── Collections ────────────────────────────────────────────────────────── */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  gap: 2rem 1.5rem;
}
.tile {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  color: inherit;
  text-decoration: none;
}
.tile__frame {
  display: block;
  aspect-ratio: 4 / 3;
  background: var(--color-surface);
  overflow: hidden;
}
.tile__frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.tile__name {
  margin-top: 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
}
.tile__count {
  color: var(--color-text-muted);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}
.tile:hover .tile__name {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Viewer details: links ──────────────────────────────────────────────── */
.chip--link {
  text-decoration: none;
  color: inherit;
}
.chip--link:hover {
  border-color: var(--color-accent);
}
.viewer-meta dd a {
  color: inherit;
  text-underline-offset: 3px;
}

.view.empty-state {
  padding: 3rem 0;
  text-align: left;
}
.view.empty-state p {
  margin: 0.5rem 0 1.25rem;
}

@media (pointer: coarse) {
  .segmented__btn,
  .toolbar__btn,
  .facet__toggle,
  .filter-chip,
  .year-rail__btn,
  .btn-text {
    min-height: 2.75rem;
  }
  .segmented__btn,
  .year-rail__btn {
    min-width: 2.75rem;
  }
  .facet__values {
    gap: 0.5rem;
  }
}
