/* คลิปฮับ — dark screening-room UI. One family: Kanit. Four source colors. */

:root {
  --bg: #120c10;
  --surface: #1b1316;
  --surface-2: #241a1e;
  --text: #f4edea;
  --muted: #a6918f;
  --line: rgba(244, 237, 234, 0.1);
  --accent: #ff3d6e;
  --amber: #ffb43d;
  --yeddi: #ff3d6e;
  --rakhee: #ff8a3d;
  --hingap: #4cc9f0;
  --syiw: #b98cff;
  --header-h: 58px;
  --radius: 6px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Kanit, "Noto Sans Thai", Tahoma, sans-serif;
  font-weight: 400;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; }

.wrap {
  max-width: 1340px;
  margin: 0 auto;
  padding: 0 18px;
}

/* ---------- header ---------- */

header.site {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  background: rgba(18, 12, 16, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.site .wrap {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 18px;
}

.wordmark {
  font-weight: 800;
  font-size: 21px;
  letter-spacing: 0.2px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}
.wordmark b { color: var(--accent); font-weight: 800; }
.wordmark .bars { display: flex; gap: 3px; }
.wordmark .bars i {
  width: 14px;
  height: 4px;
  border-radius: 2px;
  display: block;
}

nav.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}
nav.tabs::-webkit-scrollbar { display: none; }

.tab {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.tab i { width: 7px; height: 7px; border-radius: 50%; display: block; }
.tab:hover { color: var(--text); border-color: rgba(244, 237, 234, 0.28); }
.tab.on { color: var(--bg); background: var(--text); border-color: var(--text); }
.tab.on i { outline: 2px solid rgba(18, 12, 16, 0.35); }

form.search {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 0 6px 0 14px;
  width: 240px;
  transition: border-color 0.15s;
}
form.search:focus-within { border-color: rgba(255, 61, 110, 0.55); }
form.search input {
  border: 0;
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 8px 0;
  min-width: 0;
  flex: 1;
  outline: none;
}
form.search input::placeholder { color: var(--muted); }
form.search button {
  border: 0;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
  padding: 6px 13px;
  cursor: pointer;
}

/* ---------- strip (home intro) ---------- */

.strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 22px 0 6px;
}
.strip h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}
.strip h1 span { color: var(--accent); }
.strip .legend { display: flex; gap: 8px; flex-wrap: wrap; }
.legend a {
  font-size: 12.5px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 11px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s, border-color 0.15s;
}
.legend a:hover { color: var(--text); border-color: rgba(244, 237, 234, 0.3); }
.legend i { width: 7px; height: 7px; border-radius: 50%; }

/* ---------- sections / shelves ---------- */

section.block { padding: 16px 0 6px; }

.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.block-head h2 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 9px;
}
.block-head h2 i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.block-head h2 small {
  color: var(--muted);
  font-weight: 400;
  font-size: 13px;
}
.more {
  font-size: 13.5px;
  color: var(--muted);
  transition: color 0.15s;
  white-space: nowrap;
}
.more:hover { color: var(--accent); }

.shelf {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 224px;
  gap: 13px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(244, 237, 234, 0.18) transparent;
}
.shelf::-webkit-scrollbar { height: 6px; }
.shelf::-webkit-scrollbar-thumb { background: rgba(244, 237, 234, 0.18); border-radius: 3px; }
.shelf > * { scroll-snap-align: start; }

/* ---------- cards ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 16px 13px;
}
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }

.card { display: block; }

.card .thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}
.card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease, filter 0.2s ease;
}
.card:hover .thumb img { transform: scale(1.04); filter: brightness(1.08); }

.badge {
  position: absolute;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 4px;
  background: rgba(18, 12, 16, 0.78);
  color: var(--text);
  backdrop-filter: blur(4px);
}
.badge.dur { right: 6px; bottom: 6px; font-variant-numeric: tabular-nums; }
.badge.views {
  left: 6px;
  top: 6px;
  color: var(--amber);
  display: flex;
  align-items: center;
  gap: 4px;
}
.badge.views::before { content: "▶"; font-size: 8.5px; }

.card h3 {
  margin: 8px 0 5px;
  font-size: 13.8px;
  font-weight: 500;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.8em;
}
.card:hover h3 { color: var(--accent); }

.card .meta {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}
.card .meta i { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.card .meta span { overflow: hidden; text-overflow: ellipsis; }
.card .meta .cat { color: rgba(244, 237, 234, 0.55); }

/* ---------- browse chips ---------- */

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 0 4px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 13.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.chip:hover { color: var(--text); border-color: rgba(244, 237, 234, 0.3); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.page-title {
  padding: 20px 0 2px;
  display: flex;
  align-items: center;
  gap: 11px;
}
.page-title h1 { margin: 0; font-size: 20px; font-weight: 700; }
.page-title .dot { width: 11px; height: 11px; border-radius: 50%; }
.page-title small { color: var(--muted); font-size: 13px; font-weight: 400; }

/* ---------- watch ---------- */

.watch { padding: 22px 0 40px; }

.player-shell {
  max-width: 1060px;
  margin: 0 auto;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  position: relative;
}
.player-shell video,
.player-shell iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #000;
}
.player-note {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
  background: var(--surface);
}

.watch-info {
  max-width: 1060px;
  margin: 16px auto 0;
}
.watch-info h1 {
  margin: 0 0 10px;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.4;
}
.watch-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 14px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 13px;
  color: var(--text);
}
.pill i { width: 7px; height: 7px; border-radius: 50%; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.solid { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.solid:hover { filter: brightness(1.1); color: #fff; }

.desc {
  color: var(--muted);
  font-size: 14.5px;
  max-width: 860px;
  margin: 4px 0 0;
}

.backlink {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 14px;
  transition: color 0.15s;
}
.backlink:hover { color: var(--accent); }

/* ---------- states ---------- */

.state {
  text-align: center;
  color: var(--muted);
  padding: 46px 10px;
  font-size: 14.5px;
}
.state button { margin-top: 14px; }

.skeleton .thumb,
.skel {
  background: linear-gradient(100deg, var(--surface) 40%, var(--surface-2) 50%, var(--surface) 60%);
  background-size: 200% 100%;
  animation: sweep 1.1s linear infinite;
}
.skeleton h3,
.skel {
  background: var(--surface);
  border-radius: 4px;
}
.skeleton h3 { height: 38px; margin-top: 8px; }
.skeleton .meta { height: 16px; width: 60%; margin-top: 6px; background: var(--surface); border-radius: 4px; }
@keyframes sweep { to { background-position: -200% 0; } }

#sentinel { height: 1px; }
.loadmore {
  display: flex;
  justify-content: center;
  padding: 26px 0 40px;
}
.dots { display: flex; gap: 6px; }
.dots i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  animation: blink 0.9s ease-in-out infinite;
}
.dots i:nth-child(2) { animation-delay: 0.15s; background: var(--amber); }
.dots i:nth-child(3) { animation-delay: 0.3s; background: var(--hingap); }
@keyframes blink { 0%, 100% { opacity: 0.25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

#toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 90;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- age gate ---------- */

#gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: radial-gradient(120% 100% at 50% 0%, #241119 0%, var(--bg) 60%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
#gate.hide { display: none; }
.gate-card {
  max-width: 430px;
  text-align: center;
}
.gate-card .wordmark { justify-content: center; font-size: 34px; margin-bottom: 4px; }
.gate-card .bars { justify-content: center; margin-bottom: 26px; }
.gate-card .bars i { width: 26px; height: 5px; }
.gate-card h2 { font-size: 19px; font-weight: 600; margin: 0 0 10px; }
.gate-card p { color: var(--muted); font-size: 14.5px; margin: 0 0 26px; }
.gate-card .btn { width: 100%; justify-content: center; padding: 13px 18px; font-size: 15.5px; font-weight: 600; }
.gate-card .out {
  display: inline-block;
  margin-top: 16px;
  color: var(--muted);
  font-size: 13.5px;
  background: none;
  border: 0;
  cursor: pointer;
}
.gate-card .out:hover { color: var(--text); }

/* ---------- footer ---------- */

footer.site {
  border-top: 1px solid var(--line);
  margin-top: 30px;
  padding: 20px 0 34px;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  form.search { width: 170px; }
  nav.tabs { order: 3; flex-basis: 100%; }
  header.site { position: static; height: auto; }
  .site .wrap { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; gap: 8px 10px; }
  .strip .legend { display: none; }
}

@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 14px 10px; }
  .shelf { grid-auto-columns: 72vw; }
  .card h3 { font-size: 13.2px; }
  form.search { flex: 1; width: auto; }
  .watch-info h1 { font-size: 17.5px; }
  .strip { padding-top: 16px; }
}
