:root {
  color-scheme: light;
  --paper: #f1f0ea;
  --ink: #171714;
  --muted: #74736d;
  --line: rgba(23, 23, 20, 0.16);
  --accent: #ff4b26;
  --card-width: min(62vw, 760px);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.9), transparent 42%),
    var(--paper);
  font-family: "Manrope", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: fixed;
  z-index: 100;
  top: 0;
  left: 0;
  display: grid;
  grid-template-columns: minmax(270px, 1fr) auto minmax(160px, 1fr);
  align-items: center;
  width: 100%;
  height: 76px;
  padding: 12px 32px;
  background: var(--paper);
  border-bottom: 1px solid rgba(23, 23, 20, 0.08);
  font-family: "DM Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  pointer-events: none;
  isolation: isolate;
}

.brand-lockup {
  display: flex;
  flex-direction: column;
  justify-self: start;
  gap: 3px;
}

.brand {
  justify-self: start;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.06em;
  text-decoration: none;
  pointer-events: auto;
}

.brand span {
  color: var(--accent);
}

.brand-tagline {
  color: var(--muted);
  font-size: 7px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.header-views {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 7px;
}

.header-views strong {
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
}

.filters {
  position: static;
  display: flex;
  align-items: center;
  justify-self: center;
  gap: 10px;
  padding: 6px;
  border: 0;
  background: transparent;
  pointer-events: auto;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.filter-group + .filter-group {
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.filter-label {
  padding: 0 6px;
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.filter-pill {
  appearance: none;
  padding: 7px 11px;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: 99px;
  background: rgba(23, 23, 20, 0.055);
  font: 500 10px/1 "Manrope", sans-serif;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.filter-pill:hover,
.filter-pill:focus-visible {
  border-color: var(--line);
  outline: none;
}

.filter-pill[aria-pressed="true"] {
  color: #fff;
  background: var(--ink);
}

.coverflow {
  position: fixed;
  z-index: 0;
  inset: 76px 0 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-block: calc((100svh - 76px) / 2 - min(24vw, 270px));
  scroll-behavior: smooth;
  scrollbar-width: none;
  overscroll-behavior-y: contain;
  isolation: isolate;
}

.coverflow::-webkit-scrollbar {
  display: none;
}

.video-item {
  display: grid;
  min-height: min(48vw, 540px);
  place-items: center;
}

.video-item[hidden] {
  display: none;
}

.video-card {
  position: relative;
  z-index: 1;
  display: block;
  width: var(--card-width);
  text-decoration: none;
  opacity: var(--opacity, 1);
  outline: none;
  transform: scale(var(--scale, 1));
  transform-origin: 50% 50%;
  transition: opacity 180ms linear, filter 180ms linear;
  pointer-events: auto;
}

.video-frame {
  position: relative;
  overflow: hidden;
  width: 100%;
  margin: 0;
  aspect-ratio: 16 / 9;
  background: #d7d5ce;
  border-radius: 18px;
  box-shadow:
    0 2px 2px rgba(0, 0, 0, 0.06),
    0 26px 60px rgba(30, 29, 24, var(--shadow, 0.08));
  isolation: isolate;
}

.video-frame::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.24), transparent 26%, transparent 70%, rgba(0, 0, 0, 0.2));
  opacity: 0.65;
  transition: opacity 250ms ease;
}

.video-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.92) contrast(1.02);
  transition: filter 500ms ease, transform 700ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.video-card:hover .video-frame img,
.video-card:focus-visible .video-frame img {
  filter: saturate(1.05) contrast(1.02);
  transform: scale(1.018);
}

.video-card:hover .video-frame::after,
.video-card:focus-visible .video-frame::after {
  opacity: 0.85;
}

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

.rank,
.watch {
  position: absolute;
  z-index: 2;
  top: 18px;
  color: #fff;
  font-family: "DM Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rank {
  left: 20px;
}

.watch {
  right: 18px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 99px;
  background: rgba(15, 15, 13, 0.22);
  backdrop-filter: blur(10px);
  transition: background 200ms ease, border-color 200ms ease;
}

.watch svg {
  width: 12px;
  height: 12px;
}

.video-card:hover .watch,
.video-card:focus-visible .watch {
  border-color: var(--accent);
  background: var(--accent);
}

.video-copy {
  display: grid;
  grid-template-columns: minmax(150px, 0.32fr) 1fr;
  gap: 28px;
  align-items: start;
  padding-top: 18px;
}

.video-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 15px;
  padding-top: 5px;
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.02em;
  line-height: 1.5;
  text-transform: uppercase;
}

.channel {
  color: var(--ink);
}

.type-tag {
  padding: 3px 7px;
  color: var(--accent);
  border: 1px solid rgba(255, 75, 38, 0.34);
  border-radius: 99px;
  font-size: 9px;
  line-height: 1;
}

.type-tag[hidden] {
  display: none;
}

.category-tags {
  display: inline-flex;
  gap: 4px;
}

.category-tags[hidden] {
  display: none;
}

.category-tag {
  padding: 3px 7px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 99px;
  font-size: 9px;
  line-height: 1;
}

.views {
  color: var(--ink);
  font-family: "Manrope", sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
  text-transform: none;
}

.views::before {
  margin-right: 7px;
  color: var(--accent);
  content: "●";
  font-size: 7px;
  vertical-align: 1px;
}

.video-copy h2 {
  max-width: 750px;
  margin: 0;
  font-size: clamp(19px, 2vw, 30px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.14;
  text-wrap: balance;
}

.position {
  position: fixed;
  z-index: 20;
  right: 28px;
  bottom: 25px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "DM Mono", monospace;
  font-size: 9px;
}

.position-rule {
  position: relative;
  display: block;
  overflow: hidden;
  width: 72px;
  height: 1px;
  background: var(--line);
}

.position-rule i {
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
}

noscript {
  position: fixed;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
}

@media (max-width: 900px) {
  :root {
    --card-width: calc(100vw - 56px);
  }

  .topbar {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    height: 116px;
    padding: 9px 17px 8px;
    row-gap: 7px;
  }

  .brand-tagline {
    max-width: 230px;
    overflow: hidden;
    font-size: 6px;
    letter-spacing: 0.02em;
    text-overflow: ellipsis;
  }

  .header-views {
    gap: 5px;
    font-size: 8px;
  }

  .header-views strong {
    font-size: 11px;
  }

  .filters {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    overflow-x: auto;
    min-width: 0;
    width: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: linear-gradient(var(--paper) 62%, rgba(241, 240, 234, 0));
    box-shadow: none;
    backdrop-filter: none;
    transform: none;
    scrollbar-width: none;
  }

  .filters::-webkit-scrollbar,
  .filter-label {
    display: none;
  }

  .filter-group {
    flex: 0 0 auto;
  }

  .coverflow {
    inset: 116px 0 0;
    padding-block: calc((100svh - 116px) / 2 - 36vw);
  }

  .video-item {
    min-height: 72vw;
  }

  .video-frame {
    border-radius: 12px;
  }

  .video-copy {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 12px;
  }

  .video-meta {
    padding: 0;
  }

  .video-copy h2 {
    font-size: 18px;
  }

  .position {
    right: 17px;
    bottom: 16px;
  }

  .position-rule {
    width: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .coverflow {
    scroll-behavior: auto;
  }

  .video-card,
  .video-frame img {
    transition: none;
  }
}
