@font-face {
  font-family: "Noto Sans Thai";
  src: url("../fonts/NotoSansThai-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans Thai";
  src: url("../fonts/NotoSansThai-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f4efe6;
  --bg-deep: #efe6d8;
  --card: #fffdf9;
  --ink: #231c16;
  --muted: #5e534a;
  --line: #e3d6c6;
  --accent: #b23a28;
  --accent-dark: #8e2e20;
  --on-accent: #fffaf6;
  --chip: #fffdf9;
  --max: 1080px;
  --radius: 18px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans Thai", "Leelawadee UI", Thonburi, "Sukhumvit Set", Tahoma, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
a {
  font: inherit;
}

h1,
h2,
p {
  margin: 0;
}

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

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  background: var(--card);
  color: var(--ink);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 2;
}

.skip:focus {
  top: 12px;
}

.site-header {
  padding: 28px 0 18px;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.01em;
  margin-bottom: 8px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.seal {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  display: grid;
  place-items: center;
  font-weight: 700;
  flex: 0 0 auto;
}

h1 {
  font-size: 2rem;
  line-height: 1.25;
  font-weight: 700;
}

.tagline {
  margin-top: 8px;
  color: var(--muted);
}

.disclosure-bar {
  background: var(--bg-deep);
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.55;
}

.disclosure-bar p {
  padding: 12px 0;
}

main {
  padding: 20px 0 12px;
}

.loading {
  color: var(--muted);
}

.status {
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 12px;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  min-width: 0;
  max-width: 100%;
  padding-bottom: 6px;
  margin: 0 0 14px;
  scroll-snap-type: x proximity;
}

.chip {
  flex: 0 0 auto;
  scroll-snap-align: start;
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--ink);
  border-radius: 999px;
  min-height: 44px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.35;
}

.chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-accent);
}

.soon {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 4px 14px 8px;
  margin-bottom: 16px;
  background: transparent;
}

.soon summary {
  cursor: pointer;
  font-weight: 700;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.soon-list {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
}

.soon-list li {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: baseline;
}

.next-flag {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
}

.search {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.search input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  padding: 10px 12px;
  font-size: 16px;
}

.banner {
  background: #f8edd6;
  border: 1px solid #ead7ae;
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.count {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 12px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.card-open {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: start;
  cursor: pointer;
}

.media {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  background: var(--bg);
}

.media img,
.media .fallback {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.fallback {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-weight: 700;
  font-size: 1.4rem;
}

.badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #f6e2b8;
  color: #5a4314;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.3;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 12px 0;
}

.card-channel,
.detail-channel {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.card-name {
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-caption,
.detail-caption {
  color: var(--ink);
  white-space: pre-line;
}

.card-caption {
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
}

[hidden] {
  display: none !important;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  max-width: 100%;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--card);
  padding: 36px 18px;
  text-align: center;
}

.empty-mark {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}

.empty h2,
.section-title,
.detail-name {
  font-size: 1.35rem;
  line-height: 1.35;
  font-weight: 700;
}

.empty p {
  color: var(--muted);
  margin-top: 8px;
}

.empty .btn {
  margin-top: 16px;
}

.channels {
  margin-top: 36px;
  padding-top: 8px;
}

.section-title {
  margin-bottom: 8px;
}

.section-note {
  color: var(--muted);
  margin-bottom: 14px;
}

.channel-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.channel-list li {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}

.channel-family {
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 4px;
}

.channel-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.detail-back {
  margin-bottom: 16px;
}

.detail-grid {
  display: grid;
  gap: 18px;
  align-items: start;
}

.portrait {
  position: relative;
  display: block;
  width: min(100%, 320px);
  margin-inline: auto;
  aspect-ratio: 9 / 16;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.portrait img,
.portrait .fallback {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.detail-copy {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.detail-copy .actions {
  padding: 4px 0 0;
}

.clip-panel {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  padding: 16px;
}

.play {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  position: relative;
}

.play::after {
  content: "";
  position: absolute;
  left: 20px;
  top: 16px;
  border-style: solid;
  border-width: 10px 0 10px 16px;
  border-color: transparent transparent transparent var(--accent);
}

.missing {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.site-footer {
  margin-top: 28px;
  padding: 24px 0 40px;
  border-top: 1px solid var(--line);
}

.footer-brand {
  font-weight: 700;
  margin-bottom: 8px;
}

.fine {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 8px;
}

.noscript {
  padding: 12px 0 24px;
}

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

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

::selection {
  background: #f3c7bc;
}

@media (min-width: 640px) {
  .grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 800px) {
  h1 {
    font-size: 2.6rem;
  }

  .detail-grid {
    grid-template-columns: 320px 1fr;
    align-items: start;
    gap: 28px;
  }

  .portrait {
    margin-inline: 0;
  }
}

@media (min-width: 960px) {
  .grid {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .chips {
    flex-wrap: wrap;
    overflow: visible;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
