/* 1112 Cineplex — ธีมมืด เน้นแดงไตเติลหนัง */

:root {
  --bg: #090a0f;
  --bg-soft: #10121a;
  --surface: #161a24;
  --surface-2: #1e2431;
  --line: #262c3a;
  --text: #eef1f7;
  --muted: #9aa3b5;
  --accent: #ff4757;
  --accent-dim: #c9313f;
  --gold: #ffc857;
  --radius: 10px;
  --wrap: 1180px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans Thai", "Sarabun", "Leelawadee UI", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

.wrap { width: min(100% - 32px, var(--wrap)); margin-inline: auto; }

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

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

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

.top {
  position: sticky; top: 0; z-index: 40;
  background: rgba(9, 10, 15, .92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.top__bar {
  display: flex; align-items: center; gap: 12px;
  min-height: 60px;
}

.brand {
  display: inline-flex; align-items: center; gap: 9px;
  text-decoration: none; font-weight: 700; letter-spacing: 0;
  flex: 0 0 auto;
}
.brand__mark {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(140deg, var(--accent), #b3202f);
  color: #fff; font-size: 13px; font-weight: 800;
}
.brand__text { font-size: 17px; }
.brand__text em { font-style: normal; color: var(--accent); }

.search { display: flex; flex: 1 1 auto; max-width: 420px; margin-left: auto; }
.search input {
  flex: 1 1 auto; min-width: 0;
  height: 40px; padding: 0 14px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-right: 0;
  border-radius: 10px 0 0 10px;
  font: inherit; font-size: 15px;
}
.search input::placeholder { color: #6f7889; }
.search button {
  width: 46px; height: 40px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--line); border-radius: 0 10px 10px 0;
  cursor: pointer;
}
.search button:hover { color: var(--text); background: var(--surface-2); }

.menu-btn {
  display: none;
  width: 42px; height: 42px; flex: 0 0 auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; cursor: pointer;
}
.menu-btn span,
.menu-btn span::before,
.menu-btn span::after {
  display: block; width: 18px; height: 2px; margin-inline: auto;
  background: var(--text); border-radius: 2px; content: "";
  position: relative;
}
.menu-btn span::before { position: absolute; top: -6px; }
.menu-btn span::after { position: absolute; top: 6px; }

.nav { border-top: 1px solid var(--line); }
.nav[data-open="false"] { display: none; }
.nav ul {
  list-style: none; margin: 0; padding: 6px 0 10px;
  display: flex; flex-wrap: wrap; gap: 4px 8px;
}
.nav a {
  display: inline-block; padding: 8px 12px;
  border-radius: 8px; text-decoration: none;
  color: var(--muted); font-size: 14.5px;
}
.nav a:hover { color: var(--text); background: var(--surface); }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }

/* ---------- hero ---------- */

.hero { margin: 22px 0 8px; }
.hero__card {
  position: relative; overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  min-height: 340px;
  display: grid; grid-template-columns: 1.1fr .9fr;
}
.hero__body { padding: 28px 30px; display: flex; flex-direction: column; justify-content: center; gap: 12px; }
.hero__kicker {
  display: inline-block; align-self: flex-start;
  font-size: 12.5px; font-weight: 700; color: var(--accent);
  background: rgba(255, 71, 87, .12); border: 1px solid rgba(255, 71, 87, .3);
  padding: 3px 10px; border-radius: 999px;
}
.hero__title { margin: 0; font-size: clamp(22px, 3.2vw, 34px); line-height: 1.25; }
.hero__meta { margin: 0; color: var(--muted); font-size: 14px; }
.hero__text { margin: 0; color: #c3cad8; font-size: 15px; max-width: 46ch; }
.hero__actions { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.hero__art {
  position: relative; min-height: 300px;
  display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(160deg, #1a1220, #0d1017 70%);
}
.hero__blur {
  position: absolute; inset: -12%;
  background-size: cover; background-position: center;
  filter: blur(30px) saturate(1.15) brightness(.42);
  transform: scale(1.05);
}
.hero__art img {
  position: relative; z-index: 1;
  width: auto; height: calc(100% - 40px);
  aspect-ratio: 2 / 3; object-fit: cover;
  border-radius: 8px; display: block;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .65);
  margin-right: 12px;
}

@media (min-width: 901px) {
  .hero__card { min-height: 400px; }
}
.hero__art::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--surface) 0%, rgba(22, 26, 36, .55) 28%, transparent 65%);
  pointer-events: none;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px;
  border-radius: 10px; border: 1px solid transparent;
  background: var(--accent); color: #fff;
  font: inherit; font-weight: 600; font-size: 15px;
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--accent-dim); }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn--ghost:hover { background: var(--surface-2); }

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

.section { margin: 30px 0 40px; }
.section__head {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.section__title { margin: 0; font-size: 20px; }
.section__note { margin: 0; color: var(--muted); font-size: 14px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.toolbar .spacer { flex: 1 1 0; }

.chip {
  min-height: 38px; padding: 0 14px;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px;
  font: inherit; font-size: 14px; cursor: pointer;
}
.chip:hover { color: var(--text); border-color: #3a4358; }
.chip[aria-pressed="true"] {
  background: rgba(255, 71, 87, .14);
  border-color: var(--accent); color: #ffd7db;
}

.count { margin: 0 0 14px; color: var(--muted); font-size: 14px; }

/* ---------- grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 16px 14px;
}

.card { display: block; text-decoration: none; }
.card__art {
  position: relative; border-radius: 8px; overflow: hidden;
  background: var(--surface-2); aspect-ratio: 2 / 3;
}
.card__art img { width: 100%; height: 100%; object-fit: cover; display: block; transform: scale(1.07); }

/* ภาพปกจากต้นทางมีขอบสีมาด้วย — ขยายเล็กน้อยให้ขอบหลุดออกนอกกรอบ */
.card__badge {
  position: absolute; left: 6px; top: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: 0;
  padding: 2px 7px; border-radius: 999px;
  background: rgba(9, 10, 15, .82); color: var(--gold);
  border: 1px solid rgba(255, 200, 87, .35);
}
.card__ep {
  position: absolute; right: 6px; bottom: 6px;
  font-size: 11px; padding: 2px 7px; border-radius: 6px;
  background: rgba(9, 10, 15, .8); color: #dfe5ef;
}
.card__title {
  margin: 8px 0 2px; font-size: 14px; line-height: 1.35; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card__sub { margin: 0; font-size: 12.5px; color: var(--muted); }
.card:hover .card__art { outline: 2px solid var(--accent); outline-offset: -2px; }

.empty {
  padding: 40px 0; text-align: center; color: var(--muted);
}
.empty strong { display: block; color: var(--text); margin-bottom: 6px; }

.pager { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 26px; }
.pager button, .pager span {
  min-width: 40px; min-height: 40px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-size: 14px; cursor: pointer;
}
.pager button:hover { color: var(--text); background: var(--surface-2); }
.pager button[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager span { cursor: default; }

/* ---------- detail page ---------- */

.detail { display: grid; grid-template-columns: 300px 1fr; gap: 28px; margin: 26px 0 12px; }
.detail__poster { position: relative; overflow: hidden; border-radius: var(--radius); }
.detail__poster img { width: 100%; display: block; transform: scale(1.06); }
.detail__poster::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px var(--line); border-radius: var(--radius); pointer-events: none; }
.detail__body h1 { margin: 0 0 6px; font-size: clamp(22px, 3vw, 30px); line-height: 1.3; }
.detail__sub { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.detail__facts { margin: 0 0 18px; display: grid; gap: 6px; font-size: 14.5px; }
.detail__facts div { display: grid; grid-template-columns: 110px 1fr; gap: 10px; }
.detail__facts dt { color: var(--muted); margin: 0; }
.detail__facts dd { margin: 0; }
.detail__text { color: #c9d0dd; font-size: 15px; }

.player { margin: 8px 0 26px; }
.player__box {
  position: relative; background: #000;
  border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 16 / 9;
}
.player__box video, .player__box iframe { width: 100%; height: 100%; display: block; border: 0; }
.player__hint { margin: 8px 0 0; font-size: 13.5px; color: var(--muted); }

.lang-row, .ep-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.ep-row { max-height: 168px; overflow: auto; padding-right: 4px; }

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

.foot { margin-top: 50px; border-top: 1px solid var(--line); background: var(--bg-soft); }
.foot__inner {
  display: grid; grid-template-columns: 1fr 1.4fr; gap: 30px;
  padding: 30px 0 22px;
}
.foot h2 { font-size: 15px; margin: 0 0 10px; }
.foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.foot a { color: var(--muted); text-decoration: none; font-size: 14.5px; }
.foot a:hover { color: var(--text); }
.foot p { margin: 0 0 8px; color: var(--muted); font-size: 14.5px; }
.foot .muted { color: #6f7889; }
.foot__bottom {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 0 26px; color: #6f7889; font-size: 13.5px;
  border-top: 1px solid var(--line);
}

.page-head { margin: 26px 0 18px; }
.page-head h1 { margin: 4px 0 6px; font-size: clamp(22px, 3vw, 30px); }
.crumb { margin: 0; color: var(--muted); font-size: 13.5px; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--text); }

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

@media (max-width: 900px) {
  .hero__card { grid-template-columns: 1fr; }
  .hero__art { order: -1; min-height: 280px; max-height: 340px; }
  .hero__art img { height: calc(100% - 28px); margin: 0; }
  .hero__art::before { background: linear-gradient(0deg, var(--surface), transparent 55%); }
  .detail { grid-template-columns: 1fr; }
  .detail__poster { max-width: 220px; }
  .foot__inner { grid-template-columns: 1fr; gap: 22px; }
}

@media (max-width: 640px) {
  .brand__text { font-size: 15px; }
  .search { max-width: none; }
  .menu-btn { display: grid; place-items: center; }
  .nav[data-open="true"] { display: block; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 14px 10px; }
  .hero__body { padding: 20px; }
  .detail__facts div { grid-template-columns: 92px 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
