:root {
  --bg: #0b0d10;
  --fg: #f4f1ea;
  --muted: #b9b4a8;
  --accent: #ffcf6b;
  --glass: rgba(11, 13, 16, .55);
  --line: rgba(244, 241, 234, .18);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); overflow: hidden; }
a { color: var(--accent); }

.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--safe-top)) 16px 10px;
  background: linear-gradient(to bottom, rgba(0,0,0,.55), transparent);
  pointer-events: none;
}
.bar > * { pointer-events: auto; }
.brand { color: var(--fg); text-decoration: none; font-weight: 700; font-size: 1.15rem; letter-spacing: -.01em; }
.brand span, h1 span { color: var(--accent); }
.bar-actions { display: flex; gap: 8px; }
.pill {
  font: inherit; font-size: .85rem; color: var(--fg); background: var(--glass);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.pill[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.pill:focus-visible, .card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.feed {
  height: 100dvh; overflow-y: auto; scroll-snap-type: y mandatory;
  overscroll-behavior-y: contain; scrollbar-width: none; outline: none;
}
.feed::-webkit-scrollbar { display: none; }

.card {
  position: relative; height: 100dvh; width: 100%;
  scroll-snap-align: start; scroll-snap-stop: always;
  overflow: hidden; display: grid; place-items: center; background: #000;
}
.card .backdrop {
  position: absolute; inset: -40px; background-size: cover; background-position: center;
  filter: blur(36px) brightness(.45) saturate(1.2); transform: scale(1.1);
}
.card .media {
  position: relative; max-width: 100%; max-height: 100%; width: 100%; height: 100%;
  object-fit: contain; border: 0; display: block;
  opacity: 0; transition: opacity .6s ease;
}
.card .media.ready { opacity: 1; }
/* Pin stills and videos to the card box so object-fit: contain always shows the whole frame
   (a grid row has no definite height, so height: 100% alone let tall images overflow and crop). */
.card img.media, .card video.media { position: absolute; inset: 0; }
.card iframe.media { opacity: 1; max-width: min(100%, 177.78dvh); aspect-ratio: 16 / 9; height: auto; }
.card iframe.media.vertical { aspect-ratio: 9 / 16; height: 100%; width: auto; max-width: 100%; }
.card .facade {
  position: relative; width: min(100%, 177.78dvh); aspect-ratio: 16/9; border: 0; padding: 0;
  background: center / cover no-repeat; cursor: pointer;
}
.card .facade::after {
  content: "▶"; position: absolute; inset: 0; margin: auto; width: 72px; height: 72px;
  display: grid; place-items: center; border-radius: 50%; font-size: 28px; color: var(--fg);
  background: var(--glass); border: 1px solid var(--line);
}

.info {
  position: absolute; inset: auto 0 0 0; z-index: 2;
  padding: 64px 84px calc(22px + var(--safe-bottom)) 18px;
  background: linear-gradient(to top, rgba(0,0,0,.82) 0%, rgba(0,0,0,.55) 55%, transparent);
  pointer-events: none;
}
.info > * { pointer-events: auto; max-width: 680px; }
.topic {
  display: inline-block; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--bg); background: var(--accent); border-radius: 4px; padding: 2px 6px; margin-bottom: 8px;
}
.topic.discovery { background: #9fd8ff; }
.info h2 { margin: 0 0 2px; font-size: clamp(1.2rem, 4.6vw, 1.6rem); line-height: 1.2; }
.info .sub { margin: 0 0 8px; color: var(--muted); font-style: italic; font-size: .9rem; }
.info .caption { margin: 0 0 10px; font-size: clamp(.98rem, 3.8vw, 1.08rem); line-height: 1.45; }
/* "Helped?" sits in the bottom-right corner as a small vertical stack; the info text keeps clear of it. */
.helped {
  position: absolute; z-index: 3; right: 14px; bottom: calc(22px + var(--safe-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-size: .78rem; color: var(--muted); text-shadow: 0 1px 3px rgba(0,0,0,.8);
}
.vote {
  font-size: 1.15rem; line-height: 1; padding: 8px 12px; min-width: 44px; min-height: 40px; cursor: pointer;
  background: var(--glass); border: 1px solid var(--line); border-radius: 999px; color: var(--fg);
  filter: grayscale(.6); transition: transform .15s ease, filter .15s ease, border-color .15s ease;
}
.vote:hover { filter: none; }
.vote[aria-pressed="true"] { filter: none; border-color: var(--accent); background: rgba(255, 207, 107, .18); transform: scale(1.06); }
.vote:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.info .credit { margin: 0; font-size: .75rem; color: var(--muted); }
.info .credit a { color: var(--muted); }

.intro { background: radial-gradient(ellipse at 50% 35%, #263a2f 0%, var(--bg) 70%); }
.intro-inner { text-align: center; padding: 24px; }
.intro h1 { font-size: clamp(2.4rem, 11vw, 4rem); margin: 0 0 8px; letter-spacing: -.02em; }
.intro p { margin: 0; color: var(--muted); font-size: 1.1rem; }
.intro .hint { margin-top: 48px; font-size: .9rem; animation: bob 2.4s ease-in-out infinite; }
.intro .hint::after { content: ""; display: block; margin: 8px auto 0; width: 10px; height: 10px;
  border-left: 2px solid var(--muted); border-top: 2px solid var(--muted); transform: rotate(45deg); }
@keyframes bob { 50% { transform: translateY(-8px); } }

dialog {
  max-width: min(560px, calc(100% - 32px)); background: #15181d; color: var(--fg);
  border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px; line-height: 1.5;
}
dialog::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(4px); }
dialog h2 { margin-top: 0; }
.noscript { padding: 80px 24px; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .intro .hint { animation: none; }
  .card .media { transition: none; }
}
