/* ============================================================
   PompomHub WordPress Theme — Main Stylesheet
   ============================================================ */

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

/* ---- Dark theme (default) ---- */
:root {
  --bg:        #0f0f0f;
  --bg2:       #181818;
  --bg3:       #272727;
  --border:    #333;
  --text:      #f1f1f1;
  --text2:     #aaa;
  --accent:    #ff3d57;
  --accent-h:  #e02a44;
  --shadow:    0 2px 12px rgba(0,0,0,.45);
  --radius:    8px;
  --header-h:  58px;
  --sidebar-w: 220px;
}

/* ---- Light theme ---- */
html.light {
  --bg:       #f5f5f5;
  --bg2:      #ffffff;
  --bg3:      #ebebeb;
  --border:   #ddd;
  --text:     #111;
  --text2:    #555;
  --shadow:   0 2px 12px rgba(0,0,0,.1);
}

/* ---- Smooth theme transitions ---- */
body,
.site-header,
.sidebar,
.site-footer,
.video-card__thumb,
.action-btn,
.btn,
.category-chip,
.video-description,
.upnext-card__thumb,
.form-control,
.header-search input {
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

/* ---- Base ---- */
html {
  scroll-behavior: smooth;
  font-size: 15px;
  /* overflow-x: clip clips sideways overflow WITHOUT creating a new scroll
     container — critical because overflow:hidden on <html> breaks
     position:sticky on any descendant (sidebar falls back to relative,
     stays in the flex flow, and squeezes the main content to ~170px). */
  overflow-x: clip;
}
body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  width: 100%;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
input, textarea, select { min-width: 0; } /* prevent flex/grid inputs from overflowing */
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }

/* ---- Utility ---- */
.container { max-width: 1380px; width: 100%; margin: 0 auto; padding: 0 16px; }

/* ---- Header ---- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  will-change: transform;
}
.site-header .container { display: flex; align-items: center; gap: 12px; width: 100%; }

.mobile-nav-toggle {
  display: none; padding: 6px; color: var(--text2);
  border-radius: var(--radius); flex-shrink: 0;
}
.mobile-nav-toggle:hover { background: var(--bg3); color: var(--text); }

.site-logo {
  font-size: 1.35rem; font-weight: 800; letter-spacing: -.5px;
  color: var(--text); white-space: nowrap; flex-shrink: 0;
}
.site-logo span { color: var(--accent); }

.header-search {
  flex: 1; max-width: 540px; margin: 0 auto;
  display: flex;
}
.header-search input {
  flex: 1; padding: 7px 14px;
  background: var(--bg3); border: 1px solid var(--border);
  border-right: none; border-radius: var(--radius) 0 0 var(--radius);
  color: var(--text); outline: none; font-size: .88rem;
}
.header-search input:focus { border-color: var(--accent); }
.header-search button {
  padding: 7px 14px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text2); transition: color .15s;
}
.header-search button:hover { color: var(--text); }

.header-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-shrink: 0; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: var(--radius);
  font-size: .85rem; font-weight: 600; cursor: pointer;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); }
.btn-ghost { background: var(--bg3); color: var(--text2); }
.btn-ghost:hover { background: var(--border); color: var(--text); }
.btn-sm { padding: 5px 12px; font-size: .8rem; }

/* ---- Icon button ---- */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg3); color: var(--text2);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--border); color: var(--text); }

/* ---- Theme toggle icons ---- */
.icon-moon { display: none; }
html.light .icon-sun  { display: none; }
html.light .icon-moon { display: block; }

/* ---- Avatar ---- */
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; flex-shrink: 0; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---- Sidebar overlay (mobile) ---- */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,.6); backdrop-filter: blur(2px);
}
.sidebar-overlay.visible { display: block; }

/* ---- Layout ---- */
.site-body {
  display: flex;
  width: 100%;           /* always fill full viewport width */
  min-height: calc(100vh - var(--header-h));
}

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  padding: 16px 0;
  border-right: 1px solid var(--border);
  position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto; background: var(--bg);
  scrollbar-width: thin;
}
.sidebar-nav { list-style: none; }
.sidebar-nav li a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; color: var(--text2); font-size: .875rem;
  transition: background .12s, color .12s;
}
.sidebar-nav li a:hover,
.sidebar-nav li.current-menu-item a {
  background: var(--bg3); color: var(--text);
}
.sidebar-divider { border: none; border-top: 1px solid var(--border); margin: 10px 0; }
.sidebar-heading { padding: 6px 16px; font-size: .72rem; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .06em; }

/* ---- Sidebar dark/light toggle button ---- */
.sidebar-theme-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 16px;
  color: var(--text2); font-size: .875rem;
  text-align: left; border-radius: 0;
  transition: background .12s, color .12s;
}
.sidebar-theme-btn:hover { background: var(--bg3); color: var(--text); }
.sidebar-theme-label { flex: 1; }

.main-content { flex: 1; padding: 24px 24px 60px; min-width: 0; }

/* ---- Section heading ---- */
.section-heading { font-size: 1.05rem; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }
.section-heading a { font-size: .78rem; color: var(--accent); font-weight: 500; }

/* ---- Category chips ---- */
.category-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.category-chip {
  padding: 5px 14px; border-radius: 20px;
  background: var(--bg3); color: var(--text2);
  font-size: .8rem; font-weight: 500;
  border: 1px solid var(--border);
  transition: background .12s, color .12s, border-color .12s;
}
.category-chip:hover, .category-chip.active {
  background: var(--text); color: var(--bg); border-color: var(--text);
}

/* ---- Video Grid ---- */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

/* ---- Video Card ---- */
.video-card { display: flex; flex-direction: column; gap: 9px; }
.video-card__thumb {
  position: relative; aspect-ratio: 16/9; overflow: hidden;
  border-radius: var(--radius); background: var(--bg3);
}
.video-card__thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .3s ease;
  will-change: transform;
}
.video-card:hover .video-card__thumb img { transform: scale(1.05); }
.duration {
  position: absolute; bottom: 5px; right: 5px;
  background: rgba(0,0,0,.82); color: #fff;
  font-size: .7rem; font-weight: 600; padding: 1px 5px;
  border-radius: 3px; pointer-events: none;
}
.play-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.3); opacity: 0;
  transition: opacity .2s;
}
.video-card:hover .play-overlay { opacity: 1; }
.play-overlay svg { width: 44px; height: 44px; fill: rgba(255,255,255,.92); }

.video-card__info { display: flex; gap: 9px; }
.video-card__meta { flex: 1; min-width: 0; }
.video-card__title {
  font-size: .875rem; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.video-card__channel, .video-card__stats { font-size: .77rem; color: var(--text2); margin-top: 2px; }

/* ---- Watch Layout ---- */
.watch-layout { display: flex; gap: 24px; align-items: flex-start; }
.watch-main { flex: 1; min-width: 0; }
.watch-sidebar { width: 340px; flex-shrink: 0; }

.video-player-wrap {
  position: relative; aspect-ratio: 16/9;
  background: #000; border-radius: var(--radius); overflow: hidden;
}
.video-player-wrap iframe,
.video-player-wrap video {
  width: 100%; height: 100%; border: none; display: block;
}
.no-video {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; color: var(--text2); gap: 10px; font-size: .9rem;
}

.video-info { margin-top: 14px; }
.video-info h1 { font-size: 1.2rem; font-weight: 700; line-height: 1.3; }

.video-meta {
  display: flex; align-items: center; gap: 12px;
  margin-top: 5px; font-size: .8rem; color: var(--text2); flex-wrap: wrap;
}
.meta-cat { color: var(--accent); }

.video-actions {
  display: flex; align-items: center; gap: 7px;
  margin-top: 12px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.action-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 20px;
  background: var(--bg3); color: var(--text2);
  font-size: .83rem; font-weight: 500;
  transition: background .12s, color .12s;
}
.action-btn:hover { background: var(--border); color: var(--text); }
.action-btn.liked { background: var(--accent); color: #fff; }
.action-btn.copy-done { background: #1a6b3a; color: #fff; }

.channel-row {
  display: flex; align-items: center; gap: 12px;
  margin-top: 12px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.channel-row__name { font-weight: 600; font-size: .9rem; }
.channel-row__sub  { font-size: .78rem; color: var(--text2); }

.video-description {
  margin-top: 12px; padding: 12px 14px;
  background: var(--bg3); border-radius: var(--radius);
  font-size: .86rem; line-height: 1.65; color: var(--text2);
  white-space: pre-line;
  max-height: 82px; overflow: hidden; position: relative;
}
.video-description.expanded { max-height: none; }
.video-description:not(.expanded)::after {
  content: ""; position: absolute; bottom: 0; left: 0; right: 0;
  height: 36px; background: linear-gradient(transparent, var(--bg3));
}
.show-more-btn {
  margin-top: 6px; font-size: .82rem; color: var(--text2); cursor: pointer;
  transition: color .12s;
}
.show-more-btn:hover { color: var(--text); }

.video-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.video-tags .category-chip { font-size: .74rem; padding: 3px 10px; }

/* ---- Up Next ---- */
.upnext-heading { font-size: .88rem; font-weight: 700; margin-bottom: 12px; }
.upnext-list { display: flex; flex-direction: column; gap: 10px; }
.upnext-card { display: flex; gap: 8px; }
.upnext-card__thumb {
  width: 150px; flex-shrink: 0; aspect-ratio: 16/9;
  border-radius: 6px; overflow: hidden; background: var(--bg3); position: relative;
}
.upnext-card__thumb img { width: 100%; height: 100%; object-fit: cover; }
.upnext-card__info { flex: 1; min-width: 0; }
.upnext-card__title {
  font-size: .8rem; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.upnext-card__channel, .upnext-card__meta { font-size: .74rem; color: var(--text2); margin-top: 2px; }

/* ---- Comments ---- */
.comments-section { margin-top: 24px; }
.comments-section h3 { font-size: .95rem; font-weight: 700; margin-bottom: 14px; }
.comment-item { display: flex; gap: 10px; margin-bottom: 16px; }
.comment-body { flex: 1; }
.comment-author { font-weight: 600; font-size: .85rem; }
.comment-date { font-size: .76rem; color: var(--text2); margin-left: 8px; }
.comment-text { font-size: .85rem; color: var(--text2); margin-top: 3px; line-height: 1.5; }
#respond { margin-top: 24px; }
#respond h3 { font-size: .95rem; font-weight: 700; margin-bottom: 14px; }
.comment-form p label { font-size: .83rem; display: block; margin-bottom: 4px; }
.comment-form p input[type="text"],
.comment-form p input[type="email"],
.comment-form p input[type="url"],
.comment-form p textarea {
  width: 100%; padding: 8px 12px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); outline: none; color: var(--text); margin-bottom: 10px;
}
.comment-form p input:focus,
.comment-form p textarea:focus { border-color: var(--accent); }
.form-submit .submit {
  background: var(--accent); color: #fff; padding: 8px 20px;
  border-radius: var(--radius); font-weight: 600; font-size: .88rem;
  cursor: pointer; border: none;
}
.form-submit .submit:hover { background: var(--accent-h); }

/* ---- Empty State ---- */
.empty-state {
  text-align: center; padding: 70px 20px; color: var(--text2);
}
.empty-state svg { margin: 0 auto 14px; opacity: .3; }
.empty-state p { font-size: .9rem; }

/* ---- Pagination ---- */
.pagination { display: flex; gap: 5px; justify-content: center; margin-top: 36px; flex-wrap: wrap; }
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; padding: 0 8px;
  border-radius: var(--radius); background: var(--bg3);
  color: var(--text2); font-size: .83rem; border: 1px solid var(--border);
}
.pagination .current, .pagination a:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---- Search ---- */
.search-header { margin-bottom: 20px; }
.search-header h1 { font-size: 1.15rem; font-weight: 700; }
.search-header p  { font-size: .82rem; color: var(--text2); margin-top: 3px; }

/* ---- 404 Keyframes ---- */
@keyframes glitch-1 {
  0%,100% { clip-path: inset(0 0 96% 0); transform: translateX(0); }
  20%      { clip-path: inset(30% 0 50% 0); transform: translateX(-4px); }
  40%      { clip-path: inset(60% 0 20% 0); transform: translateX(4px); }
  60%      { clip-path: inset(80% 0 5%  0); transform: translateX(-3px); }
  80%      { clip-path: inset(10% 0 75% 0); transform: translateX(2px); }
}
@keyframes glitch-2 {
  0%,100% { clip-path: inset(96% 0 0 0); transform: translateX(0); }
  20%      { clip-path: inset(50% 0 30% 0); transform: translateX(4px); }
  40%      { clip-path: inset(20% 0 60% 0); transform: translateX(-4px); }
  60%      { clip-path: inset(5%  0 80% 0); transform: translateX(3px); }
  80%      { clip-path: inset(75% 0 10% 0); transform: translateX(-2px); }
}
@keyframes float-reel {
  0%,100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-10px) rotate(2deg); }
}
@keyframes pulse-slash {
  0%,100% { opacity: 1; }
  50%      { opacity: .3; }
}
@keyframes film-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Player loading skeleton ---- */
@keyframes shimmer {
  from { background-position: -400px 0; }
  to   { background-position: 400px 0; }
}
.player-skeleton {
  width: 100%; height: 100%;
  background: linear-gradient(90deg, var(--bg3) 25%, var(--border) 50%, var(--bg3) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
  display: flex; align-items: center; justify-content: center;
}
.player-skeleton svg { opacity: .25; animation: pulse-slash 1.5s ease-in-out infinite; }

/* ---- 404 Page ---- */
.error-page { text-align: center; padding: 60px 20px 40px; }

.error-page__code {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; margin-bottom: 22px;
  animation: fade-in-up .6s ease both;
}
.error-digit {
  font-size: 7rem; font-weight: 900; color: var(--accent);
  line-height: 1; letter-spacing: -4px; position: relative;
  display: inline-block;
}
/* Glitch pseudo-layers */
.error-digit::before,
.error-digit::after {
  content: attr(data-text);
  position: absolute; inset: 0;
  color: var(--accent);
}
.error-digit::before {
  color: #00ffe5;
  animation: glitch-1 2.8s infinite steps(1);
  animation-delay: .3s;
  mix-blend-mode: screen;
}
.error-digit::after {
  color: #ff003c;
  animation: glitch-2 2.8s infinite steps(1);
  animation-delay: .9s;
  mix-blend-mode: screen;
}

.error-icon {
  display: flex; align-items: center; justify-content: center;
  color: var(--text2); opacity: .85;
}
.broken-reel {
  animation: float-reel 3.6s ease-in-out infinite;
  filter: drop-shadow(0 0 12px rgba(255,61,87,.35));
}
.slash-line { animation: pulse-slash 1.8s ease-in-out infinite; }

.error-page__title {
  font-size: 1.6rem; font-weight: 800; margin-bottom: 10px;
  animation: fade-in-up .6s ease .15s both;
}
.error-page__msg {
  color: var(--text2); font-size: .95rem; max-width: 420px;
  margin: 0 auto 28px; line-height: 1.6;
  animation: fade-in-up .6s ease .25s both;
}
.error-page__actions {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; flex-wrap: wrap; margin-bottom: 28px;
  animation: fade-in-up .6s ease .35s both;
}
.error-search {
  display: flex; max-width: 420px; margin: 0 auto;
  animation: fade-in-up .6s ease .45s both;
}
.error-search input[type="search"] {
  flex: 1; padding: 9px 14px;
  background: var(--bg3); border: 1px solid var(--border);
  border-right: none; border-radius: var(--radius) 0 0 var(--radius);
  color: var(--text); outline: none; font-size: .9rem;
}
.error-search input[type="search"]:focus { border-color: var(--accent); }
.error-search button {
  padding: 9px 16px;
  background: var(--accent); border: 1px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: #fff; cursor: pointer; transition: background .15s;
}
.error-search button:hover { background: var(--accent-h); }

/* ---- Film strip ticker ---- */
.film-strip-wrap {
  overflow: hidden; max-width: 100%;
  margin: 32px auto 0;
}
.film-strip {
  display: flex; gap: 12px; width: max-content;
  animation: film-scroll 6s linear infinite;
}
.film-hole {
  width: 20px; height: 14px; border-radius: 3px;
  border: 2px solid var(--border); opacity: .4; flex-shrink: 0;
}

/* ---- Ad Slots ---- */
.pompom-ad-slot {
  width: 100%; overflow: hidden;
  text-align: center;
}
.ad-header-banner {
  padding: 8px 0 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.ad-below-player {
  margin-top: 14px; margin-bottom: 4px;
}
.ad-sidebar-top {
  margin-bottom: 16px;
}
.ad-in-feed {
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 10px 0;
}
.ad-above-footer {
  padding: 16px 0;
  border-top: 1px solid var(--border);
  background: var(--bg2);
  text-align: center;
}

/* ---- Pre-Roll Overlay ---- */
.preroll-overlay {
  position: absolute; inset: 0; z-index: 20;
  background: #000;
  display: flex; flex-direction: column;
  border-radius: var(--radius); overflow: hidden;
}
.preroll-ad-area {
  flex: 1; display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.preroll-ad-area iframe,
.preroll-ad-area video,
.preroll-ad-area img {
  width: 100%; height: 100%; object-fit: contain; border: none;
}
.preroll-bar {
  flex-shrink: 0; height: 42px;
  background: rgba(0,0,0,.75);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; gap: 10px;
}
.preroll-label {
  font-size: .72rem; font-weight: 700; color: #ffcc00;
  background: rgba(255,204,0,.15); border: 1px solid rgba(255,204,0,.4);
  padding: 2px 7px; border-radius: 3px; letter-spacing: .06em;
  flex-shrink: 0;
}
.preroll-skip {
  margin-left: auto; padding: 5px 14px;
  background: rgba(255,255,255,.12); color: #fff;
  border: 1px solid rgba(255,255,255,.25); border-radius: 4px;
  font-size: .8rem; font-weight: 600; cursor: pointer;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
}
.preroll-skip:not(:disabled):hover { background: rgba(255,255,255,.22); }
.preroll-skip:disabled { opacity: .55; cursor: default; }

/* ---- Footer ---- */
.site-footer {
  background: var(--bg2); border-top: 1px solid var(--border);
  padding: 36px 0 20px;
}
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 28px; margin-bottom: 28px;
}
.footer-brand .site-logo { margin-bottom: 10px; }
.footer-brand p { font-size: .83rem; color: var(--text2); line-height: 1.6; }
.footer-col h4 { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; color: var(--text2); }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.footer-col ul li a { font-size: .83rem; color: var(--text2); transition: color .12s; }
.footer-col ul li a:hover { color: var(--text); }
.footer-bottom {
  border-top: 1px solid var(--border); padding-top: 18px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: .78rem; color: var(--text2); flex-wrap: wrap; gap: 8px;
}

/* ---- WP login page ---- */
body.login { background: var(--bg) !important; }

/* ================================================================
   Responsive
   ================================================================ */

/* 1100px — narrow watch sidebar, 2-col footer */
@media (max-width: 1100px) {
  .watch-sidebar { width: 280px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

/* 900px — collapse sidebar into slide-out, stack watch layout */
@media (max-width: 900px) {
  /* Remove sidebar from layout completely when closed */
  .sidebar {
    display: none;
    position: fixed; top: var(--header-h); left: 0; bottom: 0;
    z-index: 95;
    transition: transform .25s ease;
    width: var(--sidebar-w);
  }
  /* Only show sidebar when JS adds .open */
  .sidebar.open {
    display: block;
    transform: none;
  }
  .mobile-nav-toggle { display: flex; }

  /* Hard-lock main content to fill the entire width */
  .site-body {
    display: block !important;
    width: 100% !important;
  }
  .main-content {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 16px 12px 60px !important;
    box-sizing: border-box !important;
  }

  .watch-layout { display: block; }
  .watch-layout > * { width: 100% !important; }
  .watch-sidebar { width: 100% !important; margin-top: 20px; }
  /* Up-next becomes a 2-col grid when below the player */
  .upnext-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
}

/* 768px — auto-fit grid: 3 per row when full, collapses empties */
@media (max-width: 768px) {
  .video-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
}

/* 640px — 2-col video grid, compact everything */
@media (max-width: 640px) {
  /* Taller header: row-1 logo+actions (~44px) + row-2 search (~38px) + gaps */
  :root { --header-h: 90px; }

  /* ---- Header — two-row layout ---- */
  .site-header .container {
    flex-wrap: wrap;          /* allow items to wrap onto a second line */
    align-content: center;
    gap: 0;
    padding-top: 6px;
    padding-bottom: 6px;
    row-gap: 6px;
  }

  /* Row 1: hamburger + logo + spacer + actions */
  .mobile-nav-toggle { order: 1; flex-shrink: 0; }
  .site-logo         { order: 2; flex-shrink: 0; font-size: 1rem; margin-left: 8px; }
  .header-actions    { order: 3; margin-left: auto; flex-shrink: 0; }

  /* Row 2: search bar spans full width below */
  .header-search {
    order: 4;
    flex: 0 0 100%;      /* full width on its own line */
    max-width: 100%;
    margin: 0;
  }
  .header-search input  { padding: 6px 10px; font-size: .85rem; flex: 1; }
  .header-search button { padding: 6px 12px; }

  /* Hide "Upload" label on mobile – keep only the + icon */
  .btn-primary .btn-label { display: none; }

  /* ---- Category chips — single horizontal scrollable row ---- */
  .category-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
    margin-bottom: 14px;
    gap: 6px;
  }
  .category-chips::-webkit-scrollbar { display: none; }
  .category-chip { white-space: nowrap; flex-shrink: 0; }

  /* ---- Grid — auto-fit collapses empty columns so 1 video fills full width ---- */
  .video-grid { grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 10px; }
  .video-card__title { font-size: .82rem; }
  .video-card__channel, .video-card__stats { font-size: .72rem; }

  /* ---- Main content padding — !important beats the 900px rule ---- */
  .main-content { padding: 12px 10px 40px !important; }

  /* ---- Section heading ---- */
  .section-heading { font-size: .95rem; margin-bottom: 10px; }

  /* ---- Footer ---- */
  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
  .site-footer { padding: 24px 0 16px; }
  .footer-bottom { padding-top: 14px; flex-direction: column; align-items: flex-start; gap: 4px; }

  /* ---- Watch page ---- */
  .video-info { margin-top: 10px; }
  .video-info h1 { font-size: 1.05rem; line-height: 1.3; }
  .video-meta { font-size: .75rem; gap: 8px; }
  .video-actions { gap: 6px; margin-top: 10px; }
  .action-btn { padding: 6px 12px; font-size: .8rem; }
  .channel-row { margin-top: 10px; padding-bottom: 10px; }

  /* ---- Up-next cards (in 2-col grid on mobile) ---- */
  .upnext-card__thumb { width: 110px; }
  .upnext-card__title { font-size: .78rem; }
  .upnext-card__channel, .upnext-card__meta { font-size: .7rem; }

  /* ---- Comments ---- */
  .comments-section { margin-top: 18px; }
}

/* 480px — small phones */
@media (max-width: 480px) {
  /* Search is already full-width on row 2 — just tighten the input padding */
  .header-search input  { font-size: .82rem; padding: 5px 8px; }
  .header-search button { padding: 5px 10px; }

  /* ---- Grid ---- */
  .video-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
  .main-content { padding: 10px 8px 32px !important; }

  /* ---- Up-next: single column stack on tiny screens ---- */
  .upnext-list { grid-template-columns: 1fr; }
  .upnext-card__thumb { width: 130px; }
}

/* 400px — single column grid */
@media (max-width: 400px) {
  .video-grid { grid-template-columns: 1fr; }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---- SEO-only tag links: invisible to users, crawlable by Google ----
   Uses the accessibility "sr-only" pattern — position:absolute + clip
   keeps the <a> elements in the DOM and HTTP response so Googlebot
   crawls and follows them, but they are completely invisible on screen.
   WARNING: do NOT use display:none or visibility:hidden — those can
   cause Google to ignore the links entirely.                          */
.pompom-seo-tags {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    pointer-events: none;
    user-select: none;
}
