:root {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --text: #1c1e26;
  --muted: #5e6272;
  --accent: #4f5bd5;
  --card-fallback: linear-gradient(135deg, #4f5bd5, #2a2f6b);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 4px 10px rgba(0, 0, 0, 0.12), 0 12px 28px rgba(0, 0, 0, 0.12);
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121319;
    --surface: #1c1e27;
    --text: #eceef4;
    --muted: #a2a6b6;
    --accent: #8b95ff;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.5);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

main {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

.site-header {
  text-align: center;
  padding: 56px 16px 32px;
}

.site-header h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -0.02em;
}

.tagline {
  margin: 8px 0 0;
  color: var(--muted);
}

/* ---------- Grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
}

/* ---------- Card ---------- */

.card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover,
.card:focus-visible {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.card:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--card-fallback);
  overflow: hidden;
}

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

.card:hover .card__media img,
.card:focus-visible .card__media img {
  transform: scale(1.04);
}

.card__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.7);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.card:hover .card__overlay,
.card:focus-visible .card__overlay {
  opacity: 1;
}

.card__description {
  margin: 0;
  color: #fff;
  text-align: center;
  font-size: 0.95rem;
  transform: translateY(8px);
  transition: transform 0.25s ease;
}

.card:hover .card__description,
.card:focus-visible .card__description {
  transform: translateY(0);
}

.card__title {
  margin: 0;
  padding: 14px 16px;
  font-size: 1.1rem;
  font-weight: 600;
}

/* Touch devices have no hover: show the description on a partial overlay instead. */
@media (hover: none) {
  .card__overlay {
    opacity: 1;
    align-items: flex-end;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0) 70%);
  }

  .card__description {
    transform: none;
    text-align: left;
    font-size: 0.875rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .card__media img,
  .card__overlay,
  .card__description {
    transition: none;
  }
}

/* ---------- Footer ---------- */

.site-footer {
  text-align: center;
  padding: 24px 16px;
  color: var(--muted);
  font-size: 0.875rem;
}
