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

:root {
  /* กรมท่าเข้ม + ทองอ่อน — หรูแบบโรงหนัง */
  --bg: #081320;
  --bg-soft: #0c1a2b;
  --surface: #112436;
  --surface-2: #17304a;
  --line: #22405c;
  --text: #f3ecdd;
  --muted: #9db0c4;
  --accent: #d9b871;
  --accent-dim: #b8974f;
  --gold: #ecdcb4;
  --on-accent: #0a1524;
  --radius: 6px;
  --wrap: 1180px;
  --serif: "Noto Serif Thai", "Charm", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  overflow-x: hidden; /* กันล้นแนวนอนบนมือถือ */
  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: var(--on-accent); font-weight: 700; 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(8, 19, 32, .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;
  min-width: 34px; height: 30px; padding: 0 6px; border-radius: 6px;
  background: linear-gradient(145deg, var(--gold), var(--accent-dim));
  color: var(--on-accent); font-family: var(--serif); font-size: 15px; font-weight: 700; line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}
.brand__text { font-family: var(--serif); font-size: 18px; letter-spacing: .2px; }
.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(--gold); 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: 380px;
  display: block;
}
.hero__body {
  position: relative; z-index: 3;
  padding: 40px 34px; max-width: 60%;
  display: flex; flex-direction: column; justify-content: center; gap: 12px;
  min-height: 380px;
}
.hero__kicker {
  display: inline-block; align-self: flex-start;
  font-size: 12px; font-weight: 700;
  color: var(--gold);
  background: rgba(217, 184, 113, .1); border: 1px solid rgba(217, 184, 113, .35);
  padding: 4px 12px; border-radius: 2px;
}
.hero__title { margin: 0; font-family: var(--serif); font-weight: 600; font-size: clamp(22px, 3.2vw, 36px); line-height: 1.25; }
.hero__meta { margin: 0; color: var(--muted); font-size: 14px; }
.hero__text {
  margin: 0; color: #c9d3e0; font-size: 15px; max-width: 48ch;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero__actions { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.hero__art {
  position: absolute; inset: 0; z-index: 1;
  min-height: 0; display: block; overflow: hidden;
  background: linear-gradient(160deg, #12304b, #07111d 72%);
}
.hero__blur {
  position: absolute; inset: -4%;
  background-size: cover; background-position: center 22%;
  filter: blur(1px) saturate(1.08) brightness(.58);
  transform: scale(1.03);
}
.hero__art img { display: none; }

@media (min-width: 901px) {
  .hero__card { min-height: 400px; }
}
.hero__art::before {
  content: ""; position: absolute; inset: 0; z-index: 2;
  background: linear-gradient(90deg, rgba(8,19,32,.97) 0%, rgba(8,19,32,.86) 42%, rgba(8,19,32,.35) 78%, rgba(8,19,32,.2) 100%);
  pointer-events: none;
}
.hero__card { border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(0,0,0,.45); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 22px;
  border-radius: 4px; border: 1px solid transparent;
  background: linear-gradient(180deg, var(--gold), var(--accent));
  color: var(--on-accent);
  font: inherit; font-weight: 700; font-size: 15px;
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: linear-gradient(180deg, var(--accent), 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-family: var(--serif); font-size: 22px; font-weight: 600; }
.section__head { border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.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(217, 184, 113, .14);
  border-color: var(--accent); color: var(--gold);
}

.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: 10.5px; font-weight: 700;
  padding: 3px 7px; border-radius: 2px;
  background: rgba(8, 19, 32, .86); color: var(--gold);
  border: 1px solid rgba(217, 184, 113, .45);
}
.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: var(--on-accent); font-weight: 700; }
.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; }
.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-family: var(--serif); font-weight: 600; font-size: clamp(22px, 3vw, 32px); 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; overflow-wrap: anywhere; }
.detail__sub { overflow-wrap: anywhere; }
.card__title { overflow-wrap: anywhere; }
.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: linear-gradient(180deg, var(--bg-soft), #060e18); }
.foot__inner {
  display: grid; grid-template-columns: 1fr 1.4fr; gap: 30px;
  padding: 30px 0 22px;
}
.foot h2 { font-family: var(--serif); font-size: 16px; margin: 0 0 10px; color: var(--gold); }
.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-family: var(--serif); font-weight: 600; font-size: clamp(22px, 3vw, 32px); }
.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__card { min-height: 420px; }
  .hero__body { max-width: 100%; min-height: 420px; padding: 28px 22px; justify-content: flex-end; }
  .hero__art::before {
    background: linear-gradient(0deg, rgba(8,19,32,.98) 8%, rgba(8,19,32,.82) 48%, rgba(8,19,32,.35) 100%);
  }
  .foot__inner { grid-template-columns: 1fr; gap: 22px; }
}

@media (max-width: 700px) {
  .detail { grid-template-columns: 1fr; }
  .detail__poster { max-width: 200px; }
}

@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; }
}
