:root {
  --bg:     #0D1117;
  --card:   #161B2E;
  --accent: #00D4C8;
  --text:   #E8EAF6;
  --subtle: #8892B0;
  --border: #1E2545;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Open Sans", sans-serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-variation-settings: "wdth" 100;
  line-height: 1.6;
}

/* ── Header ──────────────────────────────────────────── */
header {
  background: var(--bg);
  padding: 2.25rem 1.5rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-brand {
  grid-column: 2;
  display: flex;
  align-items: center;
  text-decoration: none;
}
.header-brand img {
  height: 96px;
  width: auto;
  display: block;
}
.burger {
  grid-column: 3;
  justify-self: end;
}
@media (max-width: 767px) {
  .header-brand img { height: 64px; }
  header { padding: 1.5rem 1.25rem; }
}
@media (max-width: 479px) {
  .header-brand img { height: 48px; }
  header { padding: 1rem; }
}

/* ── Burger menu ─────────────────────────────────────── */
.burger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
  position: relative;
}
.burger span {
  display: block;
  width: 26px;
  height: 2px;
  background: #ffffff;
  transition: background 0.15s;
}
.burger:hover span { background: var(--accent); }
.burger:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }

.burger-nav {
  position: absolute;
  top: 100%;
  right: 0;
  background: #000000;
  border: 1px solid #ffffff;
  display: none;
  flex-direction: column;
  min-width: 200px;
  z-index: 200;
}
.burger-nav.open { display: flex; }
.burger-nav a {
  padding: 1rem 1.5rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-bottom: none;
  transition: background 0.15s, color 0.15s;
}
.burger-nav a:hover { background: var(--bg); color: var(--accent); }

/* ── Logo gravel shake ───────────────────────────────── */
@keyframes gravel {
  0%   { transform: translate(0,0)     rotate(0deg);    }
  8%   { transform: translate(-2px,1px) rotate(-1.2deg); }
  16%  { transform: translate(2px,-2px) rotate(0.8deg);  }
  24%  { transform: translate(-1px,2px) rotate(-0.6deg); }
  32%  { transform: translate(2px,1px)  rotate(1.2deg);  }
  40%  { transform: translate(-2px,-1px)rotate(0deg);    }
  48%  { transform: translate(1px,2px)  rotate(-1deg);   }
  56%  { transform: translate(-1px,-2px)rotate(0.7deg);  }
  64%  { transform: translate(2px,1px)  rotate(-0.5deg); }
  72%  { transform: translate(-2px,1px) rotate(1deg);    }
  80%  { transform: translate(1px,-1px) rotate(-0.8deg); }
  90%  { transform: translate(-1px,1px) rotate(0.4deg);  }
  100% { transform: translate(0,0)     rotate(0deg);    }
}
.header-brand:hover img,
.header-brand:focus img {
  animation: gravel 0.6s ease-in-out;
  transform-origin: center;
}

/* ── Skeleton shimmer (GPU-composited via transform) ─── */
@keyframes shimmer {
  to { transform: translateX(200%); }
}

/* ── Masonry wall ────────────────────────────────────── */
.wall {
  columns: 1;
  column-gap: 8px;
  padding: 8px;
  column-fill: auto;
}
@media (min-width: 480px)  { .wall { columns: 2 200px; } }
@media (min-width: 768px)  { .wall { columns: 3 200px; } }
@media (min-width: 1100px) { .wall { columns: 4 220px; } }
@media (min-width: 1400px) { .wall { columns: 5 220px; } }

/* ── Card ────────────────────────────────────────────── */
.card {
  break-inside: avoid;
  margin-bottom: 8px;
  min-height: 160px;
  background: #3C3C3C;
  display: block;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}
/* Shimmer overlay via pseudo-element (GPU composited, no layout shift) */
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.06) 50%, transparent 100%);
  transform: translateX(-100%);
  animation: shimmer 1.6s infinite linear;
  pointer-events: none;
}
.card.img-loaded::before {
  display: none;
}
.card img {
  width: 100%;
  height: auto;
  display: block;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.card img.loaded {
  opacity: 1;
}
.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 55%);
  opacity: 0;
  transition: opacity 0.18s ease;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0.75rem;
}
.card:hover .card-overlay,
.card:focus  .card-overlay { opacity: 1; }
.card:focus  { outline: 3px solid var(--accent); outline-offset: 2px; }
.card-overlay h3 {
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-overlay .meta {
  margin-top: 0.3rem;
  font-size: 0.68rem;
  color: rgba(255,255,255,0.65);
  display: flex;
  justify-content: space-between;
}
.card-overlay .score { color: var(--accent); font-weight: 700; }

/* ── Infinite scroll loader ──────────────────────────── */
#sentinel {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#end-message {
  text-align: center;
  padding: 1.5rem;
  color: var(--subtle);
  font-size: 0.82rem;
  display: none;
}

/* ── Footer ──────────────────────────────────────────── */
footer {
  background: var(--bg);
  text-align: center;
  padding: 1.25rem 1.5rem;
  font-size: 0.82rem;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
footer .footer-copy {
  color: #ffffff;
}
footer .footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0;
}
footer a {
  color: #ffffff;
  text-decoration: none;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  padding-bottom: 1px;
}
footer a:hover,
footer a:focus {
  color: var(--accent);
  border-bottom-color: var(--accent);
  outline: none;
}
footer a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}
/* Material Design–style vertical divider */
.sep {
  display: inline-block;
  width: 1px;
  height: 0.9em;
  background: var(--border);
  vertical-align: middle;
  margin: 0 0.75rem;
  position: relative;
  top: -1px;
}

/* ── Cookie banner ───────────────────────────────────── */
#cookie-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #0a0e1a;
  color: #e8e8e8;
  padding: 1rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  z-index: 999;
  font-size: 0.82rem;
  border-top: 2px solid var(--accent);
}
#cookie-banner p { flex: 1; min-width: 200px; line-height: 1.55; }
#cookie-banner a { color: var(--accent); text-decoration: underline; }
.cookie-btns { display: flex; gap: 0.5rem; flex-shrink: 0; }
.btn-accept {
  background: var(--accent);
  color: #0D1117;
  border: none;
  padding: 0.5rem 1.2rem;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.03em;
}
.btn-accept:hover { filter: brightness(1.15); }
.btn-decline {
  background: transparent;
  color: var(--subtle);
  border: 1px solid var(--border);
  padding: 0.5rem 1.2rem;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
}
.btn-decline:hover { border-color: var(--subtle); color: var(--text); }

/* ── Content pages (about, cookie-policy) ────────────── */
.content {
  max-width: 720px;
  margin: 2.5rem auto;
  padding: 0 1.25rem 4rem;
}
.card-text {
  background: var(--card);
  padding: 1.75rem;
  margin-bottom: 1rem;
}
.card-text h2 {
  font-size: 1.15rem;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 0.65rem;
  letter-spacing: 0.02em;
}
.card-text p {
  color: var(--text);
  font-size: 0.88rem;
  margin-bottom: 0.75rem;
  line-height: 1.75;
}
.card-text ul {
  color: var(--text);
  padding-left: 1.25rem;
  font-size: 0.88rem;
  line-height: 1.75;
}
.card-text ul li { margin-bottom: 0.35rem; }
.card-text table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}
.card-text th {
  background: var(--bg);
  padding: 0.5rem 0.75rem;
  text-align: left;
  font-weight: 400;
  font-size: 0.95rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.card-text td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 0.88rem;
}
.card-text a { color: var(--accent); }
