:root {
  --bg: #0f0f0f;
  --surface: #1c1c1c;
  --surface-2: #272727;
  --text: #f1f1f1;
  --text-dim: #aaaaaa;
  --accent: #ff0033;
  --header-bg: rgba(15, 15, 15, 0.92);
  --radius: 12px;
  --maxw: 1400px;
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --surface: #f4f4f5;
  --surface-2: #e3e3e7;
  --text: #18181b;
  --text-dim: #6b6b73;
  --header-bg: rgba(255, 255, 255, 0.9);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--surface-2);
  padding: 16px clamp(16px, 4vw, 48px) 12px;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: var(--maxw);
  margin: 0 auto;
}

.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  flex-shrink: 0;
}

.header-text {
  flex: 1;
  min-width: 0;
}

h1 {
  margin: 0;
  font-size: clamp(1.3rem, 3vw, 1.9rem);
  letter-spacing: -0.02em;
}

.stats {
  margin: 4px 0 0;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.yt-link {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}
.yt-link:hover {
  filter: brightness(1.1);
}
.sponsor-btn {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--text);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}
.sponsor-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* Light/dark theme toggle */
.theme-toggle {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--surface-2);
  background: transparent;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.theme-toggle:hover {
  border-color: var(--text-dim);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
}
.theme-toggle .icon-moon {
  display: none;
}
.theme-toggle .icon-sun {
  display: block;
}
:root[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}
:root[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: var(--maxw);
  margin: 14px auto 0;
  flex-wrap: wrap;
}

#search {
  flex: 1;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--surface-2);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.95rem;
}
#search:focus {
  outline: none;
  border-color: var(--accent);
}

#sort {
  background: var(--surface);
  border: 1px solid var(--surface-2);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: pointer;
}

.count {
  color: var(--text-dim);
  font-size: 0.85rem;
  white-space: nowrap;
}

/* Mobile header: drop the CTAs onto their own row so the title/stats and
   buttons stop fighting for one cramped line. */
@media (max-width: 600px) {
  .site-header {
    padding: 12px clamp(14px, 4vw, 48px) 10px;
  }
  .header-inner {
    flex-wrap: wrap;
    gap: 10px 14px;
  }
  .avatar {
    width: 50px;
    height: 50px;
  }
  h1 {
    font-size: 1.3rem;
  }
  .stats {
    font-size: 0.8rem;
  }
  .header-actions {
    order: 3;
    width: 100%;
    flex-wrap: wrap;
  }
  .header-actions .sponsor-btn,
  .header-actions .yt-link {
    flex: 1 1 auto;
    text-align: center;
  }
}

/* Feed — Pinterest-style masonry holding mixed 16:9 + 9:16 tiles */
.feed {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 26px clamp(16px, 4vw, 48px) 60px;
}

.masonry {
  position: relative;
  width: 100%;
}
.masonry > .card {
  position: absolute;
}

/* Featured tile — current-year long-form with strong viewership; spans 2 cols */
.m-badge.feat {
  background: var(--accent);
  padding: 3px 10px;
}
.card.featured .card-title {
  font-size: 1.12rem;
}

/* Footer links */
.footer-links {
  margin: 8px 0 0;
}
.footer-links a {
  color: var(--text-dim);
}
.footer-links a:hover {
  color: var(--accent);
}

/* Contact / sponsorship page */
.contact-wrap {
  max-width: 840px;
  margin: 0 auto;
  padding: 44px clamp(16px, 4vw, 32px) 72px;
}
.contact-hero {
  text-align: center;
  margin-bottom: 32px;
}
.contact-eyebrow {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 12px;
}
.contact-hero h1 {
  margin: 0 0 12px;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}
.contact-lede {
  margin: 0 auto;
  max-width: 560px;
  color: var(--text-dim);
  font-size: 1.02rem;
  line-height: 1.6;
}
.contact-cta {
  display: inline-block;
  margin-top: 24px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: 13px 28px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.98rem;
}
.contact-cta:hover {
  filter: brightness(1.1);
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin: 46px 0;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: var(--radius);
  padding: 24px 18px;
  text-align: center;
}
.stat-num {
  display: block;
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.stat-label {
  display: block;
  margin-top: 6px;
  font-weight: 600;
  font-size: 0.92rem;
}
.stat-sub {
  display: block;
  margin-top: 4px;
  color: var(--text-dim);
  font-size: 0.78rem;
}

.why-sponsor {
  margin: 46px 0;
}
.why-sponsor h2 {
  text-align: center;
  font-size: 1.4rem;
  margin: 0 0 22px;
}
.why-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}
.why-list li {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 20px;
  color: var(--text-dim);
  line-height: 1.55;
  font-size: 0.95rem;
}
.why-list strong {
  color: var(--text);
}

.contact-close {
  text-align: center;
  margin-top: 46px;
}
.contact-close h2 {
  font-size: 1.3rem;
  margin: 0 0 8px;
}
.contact-close p {
  color: var(--text-dim);
}
.contact-close a {
  color: #3ea6ff;
}

/* Shorts tile keeps its tall 9:16 shape inside the same column */
.thumb.short {
  aspect-ratio: 9 / 16;
}
.m-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px 3px 6px;
  border-radius: 7px;
}
.m-badge svg {
  width: 13px;
  height: 13px;
}

.card {
  background: transparent;
  border: none;
  padding: 0;
  text-align: left;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font: inherit;
}

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}
.card:hover .thumb img {
  transform: scale(1.04);
}

.duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.play-badge {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  background: rgba(0, 0, 0, 0.25);
}
.card:hover .play-badge {
  opacity: 1;
}
.play-badge svg {
  width: 54px;
  height: 54px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

.card-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.82rem;
}

/* Video detail page */
.back-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--surface-2);
}
.back-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 14px clamp(16px, 4vw, 32px);
  display: flex;
  align-items: center;
  gap: 16px;
}
.back-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
}
.back-link:hover {
  color: var(--accent);
}
.back-channel {
  margin-left: auto;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.88rem;
}
.back-channel:hover {
  color: var(--text);
}

.detail-wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 32px) 56px;
}

.embed-wrap {
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
}
.embed-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.embed-wrap.vertical {
  aspect-ratio: 9 / 16;
  max-width: 405px;
  margin: 0 auto;
}

.comment-btn {
  display: inline-block;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--text);
  text-decoration: none;
  padding: 9px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.88rem;
}
.comment-btn:hover {
  background: var(--accent);
  color: #fff;
}
.detail-actions .comment-btn {
  margin-left: auto;
}

.short-tag {
  display: inline-block;
  vertical-align: middle;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 999px;
  margin-right: 4px;
  position: relative;
  top: -2px;
}

.detail-wrap h1 {
  margin: 22px 0 8px;
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  line-height: 1.25;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 22px;
}
.watch-btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
}
.watch-btn:hover {
  filter: brightness(1.1);
}

.desc {
  margin: 0;
  padding: 18px 20px;
  background: var(--surface);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.65;
  word-break: break-word;
}
.desc a {
  color: #3ea6ff;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
.tag {
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 0.76rem;
  padding: 4px 11px;
  border-radius: 999px;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 40px;
  padding-top: 22px;
  border-top: 1px solid var(--surface-2);
}
.pager-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 46%;
  text-decoration: none;
  color: var(--text);
}
.pager-older {
  text-align: right;
  margin-left: auto;
}
.pager-label {
  font-size: 0.78rem;
  color: var(--text-dim);
}
.pager-title {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pager-link:hover .pager-title {
  color: var(--accent);
}
.site-footer a {
  color: var(--text-dim);
}

/* Footer + states */
.site-footer {
  text-align: center;
  padding: 30px 16px 50px;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.message {
  text-align: center;
  color: var(--text-dim);
  padding: 80px 20px;
  line-height: 1.7;
}
.message code {
  background: var(--surface-2);
  padding: 2px 7px;
  border-radius: 5px;
  color: var(--text);
}
