/* ── reset & base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:      #f8f5f0;
  --surface: #ffffff;
  --border:  #e8e2d9;
  --text:    #2a2a2a;
  --muted:   #888078;
  --accent:  #7a9e7e;

  /* tag colors */
  --tag-song:    #fde8dc;
  --tag-album:   #fce8f4;
  --tag-movie:   #dce8f8;
  --tag-show:    #e8e2f8;
  --tag-book:    #f4e8dc;
  --tag-podcast: #dcf4ee;
  --tag-recipe:  #fdf4dc;
  --tag-other:   #ededec;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
}

a { color: inherit; }

/* ── nav ──────────────────────────────────────────────── */
nav {
  padding: 1.1rem 2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-logo {
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-links li {
  list-style: none;
}

.nav-links a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.9rem;
  transition: color 0.15s;
}

.nav-links a:hover,
.nav-links a.active { color: var(--text); }

/* ── landing ──────────────────────────────────────────── */
body.landing {
  display: flex;
  min-height: 100vh;
}

.landing-main {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 2rem;
}

.landing-content {
  text-align: center;
}

.landing-title {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.landing-sub {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

.landing-links {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.landing-links a {
  text-decoration: none;
  font-size: 0.9rem;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.4rem 1rem;
  border-radius: 999px;
  transition: all 0.15s;
}

.landing-links a:hover {
  color: var(--text);
  border-color: var(--accent);
}

/* ── page header ──────────────────────────────────────── */
.page-header {
  padding: 3rem 2rem 2rem;
  max-width: 900px;
  margin: 0 auto;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 0.4rem;
}

.page-header p {
  color: var(--muted);
  font-size: 0.95rem;
}

/* ── main ─────────────────────────────────────────────── */
main {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 2rem 4rem;
}

/* ── filters ──────────────────────────────────────────── */
#filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
}

.filter-btn {
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
}

.filter-btn:hover { border-color: var(--accent); color: var(--text); }

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── gallery ──────────────────────────────────────────── */
#gallery-grid {
  columns: 3 180px;
  gap: 1.5rem;
}

.gallery-card {
  break-inside: avoid;
  margin-bottom: 1.5rem;
  background: var(--surface);
  box-shadow: 0 2px 16px rgba(0,0,0,0.08), 0 0 0 1px var(--border);
  border-radius: 2px;
}

.gallery-frame {
  width: 100%;
  background: #f0ede8;
  overflow: hidden;
}

.gallery-frame img {
  width: 100%;
  height: auto;
  display: block;
}

.gallery-frame.no-img,
.gallery-frame:has(.no-img) {
  aspect-ratio: 4 / 3;
}

.gallery-frame .no-img {
  width: 100%;
  height: 100%;
  min-height: 160px;
}

.gallery-label {
  padding: 0.7rem 0.85rem 0.8rem;
  border-top: 1px solid var(--border);
}

.gallery-title {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.gallery-artist {
  font-size: 0.78rem;
  color: var(--muted);
}

.gallery-artist a {
  text-decoration: none;
  color: var(--muted);
}

.gallery-artist a:hover {
  text-decoration: underline;
}

.gallery-medium {
  opacity: 0.65;
}

/* ── resource grid ────────────────────────────────────── */
#resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}

.resource-card {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}

.resource-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.resource-card:hover img {
  transform: scale(1.04);
}

/* ── overlay ──────────────────────────────────────────── */
.resource-overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 18, 16, 0.72);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0.9rem;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 0.2s ease;
  color: #fff;
}

.resource-card:hover .resource-overlay,
.resource-overlay.always-visible {
  opacity: 1;
}

/* no-cover fallback */
.resource-overlay.always-visible {
  background: var(--bg);
  color: var(--text);
  justify-content: flex-start;
  padding: 1rem;
}

.tag {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
  width: fit-content;
}

.tag-song    { background: var(--tag-song); }
.tag-album   { background: var(--tag-album); }
.tag-movie   { background: var(--tag-movie); }
.tag-show    { background: var(--tag-show); }
.tag-book    { background: var(--tag-book); }
.tag-podcast { background: var(--tag-podcast); }
.tag-recipe  { background: var(--tag-recipe); }
.tag-other   { background: var(--tag-other); }

.resource-title {
  font-weight: 600;
  font-size: 0.88rem;
  line-height: 1.3;
}

.resource-author {
  font-size: 0.78rem;
  opacity: 0.75;
}

.resource-desc {
  font-size: 0.78rem;
  opacity: 0.8;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.resource-by {
  font-size: 0.72rem;
  opacity: 0.55;
  margin-top: 0.15rem;
}

/* ── empty state ──────────────────────────────────────── */
.empty {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 1rem 0;
}

/* ── responsive ───────────────────────────────────────── */
@media (max-width: 600px) {
  nav, .page-header, main { padding-left: 1rem; padding-right: 1rem; }
  #resources-grid { grid-template-columns: 1fr; }
}
