:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e3e6ea;
  --border-strong: #d2d7dd;
  --text: #12161c;
  --text-muted: #616b78;
  --text-faint: #8b94a1;
  --accent: #2f6bff;
  --accent-soft: #e8efff;
  --accent-text: #1d4ed8;
  --badge-bg: #eef0f4;
  --badge-text: #4a5361;
  --shadow: 0 1px 2px rgba(16, 22, 30, 0.05), 0 8px 24px rgba(16, 22, 30, 0.06);
  --shadow-hover: 0 2px 4px rgba(16, 22, 30, 0.07), 0 16px 40px rgba(16, 22, 30, 0.12);
  --radius: 14px;
  --radius-sm: 9px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1116;
  --surface: #161b22;
  --surface-2: #1c222b;
  --border: #262d38;
  --border-strong: #333c49;
  --text: #e8ecf2;
  --text-muted: #9aa4b2;
  --text-faint: #6e7986;
  --accent: #6b9bff;
  --accent-soft: #1b2740;
  --accent-text: #9dbcff;
  --badge-bg: #232a34;
  --badge-text: #aab4c2;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 2px 6px rgba(0, 0, 0, 0.5), 0 18px 44px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    "Apple Color Emoji", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

button, input, select { font: inherit; color: inherit; }

/* ---------- header ---------- */

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  height: 62px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: baseline; gap: 10px; }
.brand strong { font-size: 17px; letter-spacing: -0.02em; }
.brand span { font-size: 12px; color: var(--text-faint); }

.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a {
  padding: 6px 12px;
  white-space: nowrap;
  border-radius: 999px;
  font-size: 14px;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 550; }

.header-right { margin-left: auto; display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.updated { font-size: 12.5px; color: var(--text-faint); white-space: nowrap; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }

.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }

.filters-toggle { display: none; }

/* ---------- layout ---------- */

.layout {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 28px;
  max-width: 1360px;
  margin: 0 auto;
  padding: 26px 24px 64px;
}

.sidebar { display: flex; flex-direction: column; gap: 16px; align-self: start; position: sticky; top: 88px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.panel h2 {
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.search-input, .date-input {
  width: 100%;
  padding: 9px 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus, .date-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-input::placeholder { color: var(--text-faint); }

.quick-ranges { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.chip-btn {
  padding: 7px 4px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.chip-btn:hover { border-color: var(--border-strong); color: var(--text); }
.chip-btn.active { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); font-weight: 550; }

.platform-filter { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }

.date-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.date-row label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--text-faint); }

.pub-list { max-height: 340px; overflow-y: auto; margin: -4px -6px; padding: 4px 6px; }
.pub-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 7px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
  transition: background 0.12s;
}
.pub-item:hover { background: var(--surface-2); }
.pub-item input { accent-color: var(--accent); margin: 0; width: 15px; height: 15px; cursor: pointer; }
.pub-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pub-item .count {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text-faint);
  background: var(--badge-bg);
  border-radius: 999px;
  padding: 1px 7px;
}
.pub-item.empty { opacity: 0.45; }

/* ---------- content ---------- */

.content { min-width: 0; }

.content-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.content-head h1 { margin: 0; font-size: 21px; letter-spacing: -0.02em; }
.result-count { font-size: 13px; color: var(--text-faint); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.chips:empty { display: none; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 11px;
  font-size: 12.5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
}
.chip button {
  border: 0;
  background: none;
  padding: 0 2px;
  cursor: pointer;
  color: var(--text-faint);
  line-height: 1;
  font-size: 14px;
}
.chip button:hover { color: var(--text); }
.chip.clear-all { cursor: pointer; color: var(--accent-text); border-color: transparent; background: var(--accent-soft); padding: 4px 11px; }

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border-strong);
}

.shots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  background: var(--surface-2);
  padding: 3px;
}
.shot {
  position: relative;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: 7px;
  background: var(--surface-2);
}
.shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.shot img.loaded { opacity: 1; }
.shot.skeleton::after,
.skeleton-line {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }

.title-row { display: flex; align-items: flex-start; gap: 8px; }
.title-row .title {
  font-weight: 620;
  font-size: 14.5px;
  letter-spacing: -0.01em;
  line-height: 1.3;
  flex: 1;
  min-width: 0;
}
.title-row .title:hover { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }

.am-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--badge-bg);
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}
.am-btn:hover { background: var(--accent-soft); color: var(--accent-text); }

.dev { font-size: 13px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.meta-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }

.badge {
  font-size: 11px;
  font-weight: 550;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--badge-text);
}
.badge.hot { background: var(--accent-soft); color: var(--accent-text); }

.stores { display: flex; gap: 5px; margin-left: auto; }
.store-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  color: var(--text-faint);
  transition: background 0.15s, color 0.15s;
}
.store-glyph:hover { background: var(--surface-2); color: var(--text); }

.date-label { font-size: 11.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }

/* ---------- pagination / states ---------- */

.pagination { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 34px; flex-wrap: wrap; }
.page-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.page-btn:hover:not(:disabled) { border-color: var(--border-strong); color: var(--text); }
.page-btn[aria-current="page"] { background: var(--accent); border-color: transparent; color: #fff; font-weight: 600; }
.page-btn:disabled { opacity: 0.4; cursor: default; }
.page-gap { color: var(--text-faint); padding: 0 2px; }

.empty-state { text-align: center; padding: 72px 20px; color: var(--text-muted); }
.empty-state h3 { margin: 0 0 6px; font-size: 16px; color: var(--text); }
.empty-state p { margin: 0; font-size: 14px; }

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layout { grid-template-columns: 224px minmax(0, 1fr); gap: 20px; }
}

/* The sidebar stops fitting alongside the grid before the grid drops to one column. */
@media (max-width: 900px) {
  .header { padding: 0 12px; gap: 8px; }
  .brand span, .updated { display: none; }
  .brand strong { font-size: 15.5px; }
  .nav { margin-left: 0; }
  .nav a { padding: 5px 9px; font-size: 12.5px; }
  .filters-toggle { display: inline-flex; }
  .layout { grid-template-columns: minmax(0, 1fr); padding: 18px 14px 56px; }
  .sidebar { position: static; display: none; }
  .sidebar.open { display: flex; }
  .pub-list { max-height: 260px; }
}

@media (max-width: 640px) {
  .grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
}

/* Below this the wordmark, the nav and the toggle no longer fit on one line;
   the page heading already names the current view, so the wordmark gives way. */
@media (max-width: 480px) {
  .brand { display: none; }
}
