/* tangklon.com - hand-written stylesheet, no utility framework.
   Ink and papaya: a warm dark base with one accent, square-ish corners, hairline
   borders. Everything is driven by the tokens below. */
:root {
  --ink: #15110e;
  --ink-2: #1e1813;
  --ink-3: #2a221c;
  --line: #3a2f26;
  --sand: #efe3d4;
  --sand-dim: #b9a893;
  --pop: #ff7a45;
  --pop-dark: #d85b2a;
  --ok: #7fb069;
  --r: 4px;
  --w: 1200px;
  --gap: 18px;
  --head: 'Chakra Petch', 'Noto Sans Thai', system-ui, sans-serif;
  --text: 'Noto Sans Thai', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.tk-body {
  margin: 0;
  background: var(--ink);
  color: var(--sand);
  font: 400 15px/1.65 var(--text);
  letter-spacing: .1px;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.tk-skip { position: absolute; left: -999px; }
.tk-skip:focus { left: 8px; top: 8px; background: var(--pop); color: #1a1208; padding: 8px 12px; z-index: 50; }

/* ---------- header ---------- */
.tk-top { border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #1b1510, var(--ink)); position: sticky; top: 0; z-index: 20; }
.tk-top__in { max-width: var(--w); margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.tk-logo { display: inline-flex; align-items: center; gap: 9px; }
.tk-logo__mark { width: 16px; height: 16px; background: var(--pop); clip-path: polygon(0 0, 100% 28%, 72% 100%, 0 72%); }
.tk-logo__word { font: 700 20px/1 var(--head); letter-spacing: .4px; }
.tk-nav { display: flex; gap: 16px; font-size: 14px; }
.tk-nav a { color: var(--sand-dim); padding: 6px 0; border-bottom: 2px solid transparent; }
.tk-nav a:hover { color: var(--sand); border-bottom-color: var(--pop); }
.tk-seek { margin-left: auto; display: flex; gap: 6px; }
.tk-seek input {
  background: var(--ink-2); border: 1px solid var(--line); color: var(--sand);
  padding: 8px 11px; border-radius: var(--r); font: inherit; width: 190px; min-width: 120px;
}
.tk-seek input:focus { outline: 2px solid var(--pop-dark); outline-offset: 1px; }
.tk-seek button { background: var(--pop); color: #20160d; border: 0; padding: 8px 14px; border-radius: var(--r); font: 600 14px var(--head); cursor: pointer; }
.tk-seek button:hover { background: var(--pop-dark); color: var(--sand); }

/* ---------- layout ---------- */
.tk-main { max-width: var(--w); margin: 0 auto; padding: 22px 16px 54px; }
.tk-head { margin: 4px 0 18px; }
.tk-head h1 { font: 700 26px/1.3 var(--head); margin: 0 0 4px; }
.tk-head p { margin: 0; color: var(--sand-dim); font-size: 14px; }

.tk-hero { padding: 26px 20px; border: 1px solid var(--line); border-radius: var(--r); background: radial-gradient(1200px 300px at 15% -40%, rgba(255,122,69,.16), transparent), var(--ink-2); margin-bottom: 26px; }
.tk-hero__h { font: 700 30px/1.2 var(--head); margin: 0 0 6px; }
.tk-hero__p { margin: 0 0 14px; color: var(--sand-dim); }
.tk-hero__chips { display: flex; flex-wrap: wrap; gap: 7px; }
.tk-chip { border: 1px solid var(--line); background: var(--ink-3); padding: 5px 11px; border-radius: 999px; font-size: 13px; color: var(--sand-dim); }
.tk-chip:hover { border-color: var(--pop); color: var(--sand); }

.tk-band { margin: 0 0 30px; }
.tk-band__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 12px; padding-bottom: 7px; border-bottom: 1px solid var(--line); }
.tk-band__head h2 { font: 700 19px/1.2 var(--head); margin: 0; }
.tk-band__head a { font-size: 13px; color: var(--pop); }
.tk-band__head a:hover { text-decoration: underline; }

/* ---------- cards ---------- */
/* Fixed column counts rather than auto-fill: with auto-fill the number of
   columns changes with the viewport, so a rail of 18 cards left a short last
   row at most widths. The counts the routes ask for (24 and 12) divide evenly
   into every step below, so a row is never half empty. */
.tk-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--gap); }
@media (max-width: 1100px) { .tk-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 760px)  { .tk-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 480px)  { .tk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tk-card__hit { display: block; }
.tk-card__art { position: relative; display: block; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--ink-3); aspect-ratio: 2 / 3; }
.tk-card__art img { width: 100%; height: 100%; object-fit: cover; transition: opacity .2s ease; }
.tk-card__hit:hover .tk-card__art { border-color: var(--pop); }
.tk-card__hit:hover .tk-card__art img { opacity: .82; }
.tk-card__badge { position: absolute; left: 6px; top: 6px; background: rgba(21,17,14,.88); border: 1px solid var(--line); color: var(--sand); font-size: 11px; padding: 2px 6px; border-radius: 2px; }
.tk-card__name { display: block; margin: 8px 0 1px; font-size: 14px; line-height: 1.35; max-height: 2.7em; overflow: hidden; }
.tk-card__sub { display: block; font-size: 12px; color: var(--sand-dim); }

/* ---------- watch pages ---------- */
.tk-stage { border: 1px solid var(--line); border-radius: var(--r); background: #000; overflow: hidden; margin-bottom: 16px; }
.tk-stage__none { margin: 0; padding: 40px 16px; text-align: center; color: var(--sand-dim); }
.tk-meta { margin-bottom: 26px; }
.tk-meta__h { font: 700 24px/1.3 var(--head); margin: 0 0 6px; }
.tk-meta__sub { margin: 0; color: var(--sand-dim); }
.tk-facts { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 10px 0; }
.tk-facts li { border: 1px solid var(--line); background: var(--ink-2); padding: 3px 9px; border-radius: 2px; font-size: 13px; color: var(--sand-dim); }
.tk-synopsis { margin: 10px 0 0; max-width: 72ch; color: #d9cab8; }

.tk-showtop { display: flex; gap: 18px; margin-bottom: 26px; flex-wrap: wrap; }
.tk-showtop__art { width: 190px; border: 1px solid var(--line); border-radius: var(--r); }
.tk-showtop__txt { flex: 1 1 320px; }
.tk-showtop__txt h1 { font: 700 24px/1.3 var(--head); margin: 0 0 4px; }

.tk-eps h2 { font: 700 18px/1.2 var(--head); margin: 0 0 10px; }
.tk-eps__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.tk-eps__list a { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--ink-2); padding: 9px 11px; border-radius: var(--r); }
.tk-eps__list a:hover { border-color: var(--pop); background: var(--ink-3); }
.tk-eps__list li.is-now a { border-color: var(--pop); background: var(--ink-3); }
.tk-eps__no { font: 600 12px var(--head); color: var(--pop); min-width: 54px; }
.tk-eps__nm { font-size: 14px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-eps__q { font-size: 11px; color: var(--sand-dim); }

/* ---------- tiles, pager, misc ---------- */
.tk-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.tk-tiles--small { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.tk-tile { border: 1px solid var(--line); background: var(--ink-2); border-radius: var(--r); padding: 12px; }
.tk-tile:hover { border-color: var(--pop); }
.tk-tile b { display: block; font: 600 15px var(--head); }
.tk-tile span { font-size: 12px; color: var(--sand-dim); }

.tk-pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 26px 0 0; font-size: 14px; }
.tk-pager a { border: 1px solid var(--line); padding: 7px 14px; border-radius: var(--r); background: var(--ink-2); }
.tk-pager a:hover { border-color: var(--pop); }
.tk-empty { color: var(--sand-dim); padding: 28px 0; text-align: center; }

.tk-oops { text-align: center; padding: 60px 16px; }
.tk-oops h1 { font: 700 26px var(--head); margin: 0 0 8px; }
.tk-oops__act { display: flex; gap: 12px; justify-content: center; margin-top: 16px; }
.tk-oops__act a { border: 1px solid var(--line); padding: 8px 16px; border-radius: var(--r); background: var(--ink-2); }

.tk-foot { border-top: 1px solid var(--line); background: #110e0b; margin-top: 30px; }
.tk-foot__in { max-width: var(--w); margin: 0 auto; padding: 20px 16px 30px; }
.tk-foot__line { margin: 0 0 6px; font-size: 13px; }
.tk-foot__note { margin: 0; font-size: 12px; color: var(--sand-dim); }

@media (max-width: 720px) {
  .tk-top__in { gap: 10px; }
  .tk-nav { order: 3; width: 100%; justify-content: space-between; }
  .tk-seek { order: 2; margin-left: auto; }
  .tk-seek input { width: 140px; }
  .tk-grid { gap: 12px; }
  .tk-hero { padding: 20px 15px; }
  .tk-hero__h { font-size: 24px; }
  .tk-showtop__art { width: 130px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- skeleton while a poster is still on its way ----------
   The box already reserves 2:3, so nothing moves when the image lands; this
   only fills the empty space with a slow shimmer instead of a flat rectangle.
   Removed as soon as the image decodes, and never shown for the first row,
   which is fetched eagerly. */
@keyframes tk-wait {
  0%   { background-position: 120% 0; }
  100% { background-position: -20% 0; }
}
.tk-card__art.is-wait {
  background-image: linear-gradient(100deg, var(--ink-3) 30%, #3b312a 48%, var(--ink-3) 66%);
  background-size: 220% 100%;
  animation: tk-wait 1.5s linear infinite;
}
.tk-card__art.is-wait img { opacity: 0; }
.tk-card__art.is-ready { background-image: none; animation: none; }
.tk-card__art.is-ready img { opacity: 1; transition: opacity .22s ease; }

/* The counter needs its element in the page but not on screen. */
.tk-vcount { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (prefers-reduced-motion: reduce) {
  .tk-card__art.is-wait { animation: none; }
}

/* Footer carries the brand and nothing else; it is a link home on every page. */
.tk-foot__in { display: flex; justify-content: center; padding: 22px 16px 34px; }
.tk-foot__brand {
  font: 700 17px/1 var(--head);
  letter-spacing: .4px;
  color: var(--sand-dim);
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--ink-2);
}
.tk-foot__brand:hover { color: var(--pop); border-color: var(--pop); }
.tk-foot__brand:focus-visible { outline: 2px solid var(--pop); outline-offset: 2px; }

/* Breadcrumbs: the same trail the BreadcrumbList describes, so a reader and a
   crawler are told the same thing. Wraps instead of scrolling on a phone. */
.tk-crumbs { margin: 0 0 16px; font-size: 13px; }
.tk-crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 2px; margin: 0; padding: 0; }
.tk-crumbs li { display: flex; align-items: center; color: var(--sand-dim); min-width: 0; }
.tk-crumbs li + li::before { content: '›'; margin: 0 7px; color: var(--line); }
.tk-crumbs a { color: var(--sand-dim); }
.tk-crumbs a:hover { color: var(--pop); text-decoration: underline; }
.tk-crumbs span { color: var(--sand); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60vw; }


/* The freshness line, kept quiet: it matters to a crawler and to a reader
   deciding whether a page is current, but it is not the headline. */
.tk-when { margin: 6px 0 0; font-size: 12.5px; color: var(--sand-dim); }
.tk-when time { color: var(--sand); }


/* Rails below the fold are not laid out until they come near the viewport.
   The reserved height stops the scrollbar from jumping as they appear. */
.tk-band { content-visibility: auto; contain-intrinsic-size: auto 420px; }
.tk-band:first-of-type { content-visibility: visible; }
