/*
Theme Name: ThaiTube Dark
Theme URI: https://avhosting.net/
Author: first9empire
Description: ธีมสไตล์เว็บทูบโทนมืด (dark tube layout) — Header โลโก้แดง + เมนูหมวดหมู่ + ช่องค้นหา, กริดวิดีโอ responsive, footer SEO. สร้างเป็นตัวอย่างดีไซน์ ไม่ผูกกับเนื้อหาใด ๆ
Version: 1.0.0
License: GNU General Public License v2 or later
Text Domain: thaitube
Tags: dark, grid, video, custom-menu, featured-images, translation-ready
*/

/* ============================================================
   Design tokens
   ============================================================ */
:root {
  --bg:        #0d0d0d;
  --bg-2:      #161616;  /* header / footer / cards */
  --bg-3:      #1f1f1f;  /* hover / inputs */
  --border:    #262626;
  --text:      #bebebe;  /* matches reference body color */
  --text-dim:  #8a8a8a;
  --title:     #d9d9d9;
  --accent:    #e50914;  /* logo red */
  --accent-2:  #ff9f1c;  /* orange notice bar */
  --neon:      #b026ff;  /* neon purple */
  --neon-2:    #7a2bff;  /* neon violet */
  --radius:    6px;
  --maxw:      1360px;
  --gap:       14px;
  --cols:      5;
  --font: "Sarabun", "Noto Sans Thai", "Segoe UI", Roboto, "Helvetica Neue",
          Helvetica, Arial, sans-serif;
}

/* ============================================================
   Reset / base
   ============================================================ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--text); text-decoration: none; transition: color .15s ease; }
a:hover { color: #fff; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
.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;
}

/* ============================================================
   Header
   ============================================================ */
.site-header {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 16px;
  max-width: var(--maxw);
  margin: 0 auto;
}
.brand {
  display: inline-flex;
  align-items: center;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: .3px;
  white-space: nowrap;
}
.brand .brand-red {
  background: var(--accent);
  color: #fff;
  padding: 3px 8px;
  border-radius: 4px;
  margin-right: 4px;
}
.brand .brand-light { color: #f2f2f2; }
.brand-logo { display: block; height: 34px; width: auto; }
/* WordPress custom logo (Appearance → Customize → Logo).
   NB: the_custom_logo() emits its own <a>, and header.php wraps it in <a class="brand">.
   Nested <a> is invalid, so the browser hoists the logo out of .brand — target the
   img by class directly (not via .brand) and use !important to beat the global img{} reset. */
.custom-logo-link { display: inline-block; line-height: 0; }
img.custom-logo { display: block; height: 40px !important; width: auto !important; max-width: 210px; }
@media (max-width: 600px) { img.custom-logo { height: 34px !important; } }

/* primary nav */
.primary-nav {
  flex: 1 1 auto;
  min-width: 0;
}
.primary-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
}
.primary-nav a {
  color: var(--text);
  font-size: 14px;
  padding: 6px 2px;
  white-space: nowrap;
}
.primary-nav a:hover {
  color: #c489ff;
  text-shadow: 0 0 8px rgba(176,38,255,.6);
}
.primary-nav .current-menu-item > a,
.primary-nav .current-menu-item > a:hover {
  color: #c489ff;
  text-shadow: 0 0 8px rgba(176,38,255,.7);
}

/* search */
.site-search {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}
.site-search input[type="search"] {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius) 0 0 var(--radius);
  padding: 7px 10px;
  font-size: 14px;
  width: 180px;
  outline: none;
}
.site-search input[type="search"]:focus { border-color: var(--accent); }
.site-search button {
  background: var(--neon);
  border: 1px solid var(--neon);
  color: #fff;
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 14px;
  box-shadow: 0 0 8px rgba(176,38,255,.7), inset 0 0 6px rgba(122,43,255,.4);
  text-shadow: 0 0 6px rgba(255,255,255,.5);
}
.site-search button:hover {
  filter: brightness(1.12);
  box-shadow: 0 0 14px rgba(176,38,255,.95), inset 0 0 7px rgba(122,43,255,.5);
}
.site-search input[type="search"]:focus { border-color: var(--neon); }

/* mobile menu toggle (hidden on desktop) */
.nav-toggle { display: none; }

/* ============================================================
   Notice bar (orange)
   ============================================================ */
.notice-bar {
  background: linear-gradient(90deg, #2a1c00, #3a2600);
  color: var(--accent-2);
  text-align: center;
  font-size: 13.5px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
}
.notice-bar a { color: #ffd27a; text-decoration: underline; }

/* ============================================================
   Main / grid
   ============================================================ */
.site-main { padding: 22px 0 40px; }
.section-title {
  font-size: 16px;
  color: var(--title);
  margin: 0 0 16px;
  padding: 6px 0 6px 12px;
  border-left: 3px solid var(--neon);
  box-shadow: -3px 0 10px -1px rgba(176,38,255,.8);
  font-weight: 700;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  gap: var(--gap);
}

/* card */
.video-card {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .18s ease, box-shadow .25s ease, border-color .25s ease;
  /* faint neon rest-glow */
  box-shadow: 0 0 0 1px rgba(176,38,255,.14), 0 0 10px rgba(176,38,255,.07);
}
/* gradient neon border (revealed on hover) */
.video-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: linear-gradient(135deg, var(--neon), var(--neon-2), var(--neon));
  background-size: 200% 200%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
  z-index: 2;
  animation: neon-pan 4s linear infinite;
}
.video-card:hover {
  transform: translateY(-3px);
  border-color: transparent;
  box-shadow:
    0 0 14px rgba(176,38,255,.6),
    0 0 30px rgba(122,43,255,.32),
    0 6px 18px rgba(0,0,0,.5);
}
.video-card:hover::before { opacity: 1; }
@keyframes neon-pan {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .video-card::before { animation: none; }
}
.thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, #232323, #121212);
  overflow: hidden;
}
.thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .35s ease;
}
.video-card:hover .thumb img { transform: scale(1.06); }

.badge-hd {
  position: absolute; top: 6px; left: 6px; z-index: 3;
  background: rgba(10,0,16,.55);
  color: #fff;
  font-size: 11px; font-weight: 800;
  padding: 1px 7px; border-radius: 3px;
  letter-spacing: 1px;
  border: 1px solid var(--neon);
  text-shadow: 0 0 6px var(--neon), 0 0 10px var(--neon);
  box-shadow: 0 0 7px rgba(176,38,255,.75), inset 0 0 6px rgba(176,38,255,.38);
}
.video-card:hover .badge-hd {
  border-color: var(--neon-2);
  text-shadow: 0 0 6px var(--neon-2), 0 0 12px var(--neon-2);
  box-shadow: 0 0 10px rgba(122,43,255,.85), inset 0 0 7px rgba(122,43,255,.42);
}
.badge-time {
  position: absolute; bottom: 6px; right: 6px;
  background: rgba(0,0,0,.78); color: #fff;
  font-size: 11px; padding: 1px 6px; border-radius: 3px;
}
.play-ico {
  position: absolute; inset: 0; margin: auto;
  width: 46px; height: 46px;
  display: grid; place-items: center;
  background: rgba(176,38,255,.92);
  border-radius: 50%;
  box-shadow: 0 0 16px rgba(176,38,255,.85), 0 0 30px rgba(122,43,255,.5);
  opacity: 0; transform: scale(.8);
  transition: opacity .18s ease, transform .18s ease;
}
.play-ico::after {
  content: ""; width: 0; height: 0; margin-left: 3px;
  border-left: 14px solid #fff;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
}
.video-card:hover .play-ico { opacity: 1; transform: scale(1); }

.card-title {
  display: block;
  font-size: 13px;
  color: var(--text);
  padding: 9px 10px 11px;
  line-height: 1.35;
  min-height: 2.7em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.video-card:hover .card-title { color: #fff; }

/* ============================================================
   Pagination
   ============================================================ */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 30px 0 0;
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  min-width: 38px;
  text-align: center;
  padding: 8px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
}
.pagination a:hover {
  border-color: var(--neon);
  color: #fff;
  box-shadow: 0 0 9px rgba(176,38,255,.5);
}
.pagination .current {
  background: var(--neon);
  border-color: var(--neon);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(176,38,255,.85), inset 0 0 7px rgba(122,43,255,.45);
  text-shadow: 0 0 6px rgba(255,255,255,.5);
}

/* ============================================================
   Single video
   ============================================================ */
.single-wrap { max-width: 980px; margin: 0 auto; padding: 24px 16px 50px; }
.single-title {
  font-size: 25px;
  line-height: 1.35;
  color: #fff;
  font-weight: 800;
  margin: 0 0 18px;
  padding: 8px 0 8px 14px;
  border-left: 4px solid var(--neon);
  box-shadow: -4px 0 16px -2px rgba(176,38,255,.7);
}
.player {
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid; place-items: center;
  color: var(--text-dim);
  overflow: hidden;
}
.player video, .player iframe { width: 100%; height: 100%; border: 0; }
.single-meta {
  display: flex; gap: 16px; color: var(--text-dim);
  font-size: 13px; margin: 12px 0 20px;
}
.single-content { color: var(--text); line-height: 1.7; }
/* cover (left) + text (right column) — text stays right, never wraps under the cover */
.post-layout { display: flex; gap: 18px; align-items: stretch; }
.post-layout .post-cover { flex: 0 0 200px; margin: 0; border-radius: 8px; overflow: hidden; }
.post-layout .post-cover img { display: block; width: 100%; height: 100%; min-height: 280px; object-fit: cover; object-position: center; border-radius: 8px; }
.post-layout .post-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
@media (max-width: 600px) { .post-layout { gap: 12px; } .post-layout .post-cover { flex-basis: 140px; } .post-layout .post-cover img { min-height: 210px; } }
/* กล่องข้อความ + กล่องข้อมูลหนัง (รหัส/นักแสดง/ผู้ผลิต) */
.post-box { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); border-radius: 10px; padding: 16px 18px; font-size: 16px; }
.movie-info { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.info-box { flex: 1 1 180px; min-width: 150px; background: rgba(176,38,255,.07); border: 1px solid rgba(176,38,255,.28); border-left: 4px solid var(--neon); border-radius: 10px; padding: 12px 14px; }
.info-k { display: block; font-size: 12px; color: #9aa0ad; margin-bottom: 5px; }
.info-v { display: block; font-size: 16px; font-weight: 700; color: #fff; word-break: break-word; }
.tags { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 8px; }
.tags a {
  background: var(--bg-2); border: 1px solid var(--border);
  padding: 4px 10px; border-radius: 20px; font-size: 12.5px;
}
.tags a:hover { border-color: var(--accent); color: #fff; }

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  margin-top: 30px;
  padding: 26px 0 34px;
}
.footer-seo {
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.7;
  max-width: var(--maxw);
  margin: 0 auto 18px;
  padding: 0 16px;
}
.footer-keywords { margin: 8px 0 0; font-size: 11.5px; color: #6a6a6a; }
.footer-links {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 8px 18px; padding: 0 16px 18px;
  border-bottom: 1px solid var(--border);
  max-width: var(--maxw); margin: 0 auto;
}
.footer-links a { font-size: 13px; color: var(--text); }
.footer-links a:hover { color: var(--accent); }
.copyright {
  text-align: center; color: var(--text-dim);
  font-size: 12px; padding-top: 16px;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1100px) { :root { --cols: 4; } }
@media (max-width: 860px) {
  :root { --cols: 3; }
  .header-inner { position: relative; }
  .primary-nav { position: static; }
  .primary-nav ul { display: none; }
  .primary-nav.open ul {
    display: flex; flex-direction: column; gap: 0;
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg-2); border-top: 1px solid var(--border);
    box-shadow: 0 10px 24px rgba(0,0,0,.5);
    padding: 4px 16px 10px; z-index: 50;
  }
  .primary-nav.open a { display: block; padding: 12px 2px; border-bottom: 1px solid var(--border); }
  .nav-toggle {
    display: inline-flex; background: var(--bg-3); border: 1px solid var(--border);
    color: var(--text); border-radius: var(--radius); padding: 7px 11px; cursor: pointer;
    font-size: 18px; line-height: 1;
  }
  .site-search input[type="search"] { width: 130px; }
}
@media (max-width: 560px) {
  :root { --cols: 2; --gap: 10px; }
  .brand { font-size: 18px; }
}
