:root {
    --bg: #0e0d0e;
    --panel: #191719;
    --panel-2: #2b262c;
    --text: #dfe4f0;
    --muted: #bfa69c;
    --gold: #bd963c;
    --gold-soft: #d6bd77;
    --line: rgba(223, 228, 240, .11);
    --radius: 10px;
    --container: 1320px;
    --shadow-low: 0 2px 8px rgba(0, 0, 0, .24);
    --shadow-medium: 0 10px 28px rgba(0, 0, 0, .34);
    --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: "Noto Sans Thai", Tahoma, system-ui, sans-serif; line-height: 1.55; overflow-wrap: anywhere; }
a { color: inherit; text-decoration: none; }
img, iframe, video { max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; }
button, input { min-width: 0; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link:focus { position: fixed; z-index: 100; top: 10px; left: 12px; width: auto; height: auto; margin: 0; padding: 12px 18px; overflow: visible; clip-path: none; background: var(--panel); color: var(--text); }
.layout-container { width: min(calc(100% - 24px), var(--container)); margin-inline: auto; min-width: 0; }
.site-content { min-width: 0; }
.site-header { position: sticky; top: 0; z-index: 50; padding: 12px 0 6px; background: var(--bg); }
body.admin-bar .site-header { top: 32px; }
.site-header__bar { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-medium); }
.site-header__inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 62px; padding: 8px 10px; }
.heesuay-logo { display: inline-flex; align-items: center; justify-self: start; min-width: 0; min-height: 44px; color: var(--gold-soft); font-weight: 900; letter-spacing: .13em; font-size: 1rem; }
.menu-toggle { display: inline-grid; place-content: center; min-height: 44px; min-width: 44px; padding: 8px 12px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); }
.heesuay-navigation { display: grid; grid-column: 1 / -1; gap: 12px; min-width: 0; padding-top: 8px; }
.has-menu-toggle .heesuay-navigation { display: none; }
.has-menu-toggle .heesuay-navigation.is-open { display: grid; }
.primary-nav, .search-form { min-width: 0; }
.primary-nav__list, .footer-nav__list { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.primary-nav a, .footer-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 12px; color: var(--muted); border-radius: var(--radius); transition: color .15s var(--ease), background-color .15s var(--ease); }
.primary-nav a:hover, .footer-nav a:hover { color: var(--gold-soft); background: var(--panel-2); }
.search-form { display: flex; width: 100%; gap: 0; }
.search-form input { width: 100%; flex: 1 1 0; min-height: 44px; padding: 8px 12px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius) 0 0 var(--radius); }
.search-form input::placeholder { color: var(--muted); opacity: 1; }
.search-form button { flex: 0 0 auto; min-height: 44px; padding: 8px 12px; color: var(--bg); background: var(--gold-soft); border: 1px solid var(--gold-soft); border-radius: 0 var(--radius) var(--radius) 0; }
.site-footer { margin-top: 40px; border-top: 1px solid var(--line); background: var(--panel); color: var(--muted); box-shadow: var(--shadow-low); }
.site-footer__inner { display: grid; gap: 12px; padding-block: 28px; }
.footer-brand, .footer-notice { margin: 0; }
.footer-brand { color: var(--gold-soft); font-weight: 900; letter-spacing: .13em; }
.footer-nav a { padding-inline: 0; }

@media (max-width: 719px) {
    .site-header__inner { grid-template-columns: minmax(0, 1fr) auto; }
    body.admin-bar .site-header { top: 46px; }
    .site-footer__inner { grid-template-columns: minmax(0, 1fr); }
}

@media (min-width: 720px) and (max-width: 1099px) {
    .site-header__inner { grid-template-columns: minmax(0, 1fr) auto; }
    .heesuay-navigation { grid-template-columns: minmax(0, 1fr); }
    .search-form { max-width: 420px; }
}

@media (min-width: 1100px) {
    .site-header__inner { grid-template-columns: minmax(150px, auto) minmax(0, 1fr); }
    .menu-toggle { display: none; }
    .has-menu-toggle .heesuay-navigation, .heesuay-navigation { display: grid; grid-column: 2; grid-template-columns: minmax(0, 1fr) minmax(220px, 330px); align-items: center; padding-top: 0; }
    .site-footer__inner { grid-template-columns: minmax(0, 1fr) auto; }
    .footer-notice { grid-column: 1; }
    .footer-nav { grid-column: 2; grid-row: 1 / 3; align-self: center; }
}

@media (max-width: 420px) {
    .site-header__inner { gap: 8px; }
    .heesuay-logo { font-size: .92rem; letter-spacing: .1em; }
    .search-form button { padding-inline: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Homepage presentation; collection and public-content policy stay upstream. */
.home-hero { display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; gap: 28px; min-width: 0; margin-top: 20px; padding: clamp(26px, 5vw, 64px); border: 1px solid rgba(189, 150, 60, .2); border-radius: 16px; background: var(--panel); box-shadow: var(--shadow-medium); }
.home-hero__copy, .home-hero__mark { min-width: 0; }
.home-hero__eyebrow { margin: 0 0 16px; color: var(--gold-soft); font-size: .76rem; font-weight: 700; letter-spacing: .04em; }
.home-hero h1 { margin: 0; color: #f3eee7; font-size: clamp(2rem, 4.4vw, 4.3rem); line-height: 1.15; letter-spacing: -.045em; }
.home-hero__highlight { color: var(--gold); }
.home-hero__lead { margin: 18px 0 0; color: #c5bec2; font-size: clamp(.98rem, 1.4vw, 1.15rem); }
.home-hero__mark { display: grid; place-items: center; min-height: 120px; padding: 20px 10px; border: 1px solid rgba(189, 150, 60, .4); border-radius: var(--radius); color: var(--gold-soft); font-size: clamp(1.1rem, 2.5vw, 2rem); font-weight: 900; letter-spacing: .13em; }
.homepage-tags { min-width: 0; margin-top: 12px; }
.homepage-tags__rail { display: flex; gap: 8px; max-width: 100%; min-width: 0; padding: 12px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); scrollbar-color: var(--gold) var(--panel-2); }
.filter-chip { flex: 0 0 auto; max-width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); overflow-wrap: anywhere; }
.filter-chip:hover { border-color: var(--gold); }
.filter-chip.is-selected { color: var(--bg); background: var(--gold); border-color: var(--gold); font-weight: 800; }
.video-section { min-width: 0; padding: 26px 0 10px; scroll-margin-top: 100px; }
.section-heading { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; min-width: 0; margin-bottom: 16px; padding-left: 12px; border-left: 3px solid var(--gold); }
.section-heading > div { min-width: 0; }
.section-kicker { color: var(--gold); font-size: .68rem; font-weight: 800; letter-spacing: .07em; }
.section-heading h2 { margin: 0; font-size: clamp(1.24rem, 1.8vw, 1.52rem); line-height: 1.4; }
.section-heading a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--gold-soft); font-size: .86rem; }
.video-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; min-width: 0; align-items: stretch; }
.video-card { display: grid; grid-template-rows: auto 1fr; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow-low); }
.video-card__poster { display: block; min-width: 0; aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg); }
.video-card__poster img { display: block; width: 100%; height: 100%; max-width: 100%; object-fit: cover; }
.video-card__body { display: flex; flex-direction: column; min-width: 0; padding: 10px; }
.video-card__term { display: -webkit-box; min-height: 1.55em; margin-bottom: 5px; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 1; color: var(--gold-soft); font-size: .7rem; }
.video-card__title { display: -webkit-box; min-width: 0; min-height: 2.8em; max-height: 2.8em; margin: auto 0 0; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: .94rem; line-height: 1.4; overflow-wrap: anywhere; }
.video-card__title a:hover { color: var(--gold-soft); }
.result-state { margin: -4px 0 14px; color: var(--muted); font-size: .82rem; }
.empty-state { margin: 14px 0; padding: 24px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--muted); text-align: center; }
.catalog-pagination { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; min-width: 0; margin-top: 24px; }
.catalog-pagination a, .catalog-pagination [aria-current] { display: inline-flex; justify-content: center; align-items: center; min-width: 44px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; }
.catalog-pagination [aria-current] { background: var(--gold); color: var(--bg); }
.catalog-pagination a:hover { border-color: var(--gold); color: var(--gold-soft); }
.homepage-unavailable { padding-block: 32px; }

@media (min-width: 720px) {
    .video-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .video-grid--latest { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .video-grid--popular, .video-grid--rare { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1040px) {
    .video-grid--latest, .video-grid--catalog { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .home-hero { grid-template-columns: minmax(0, 1.3fr) minmax(0, .7fr); min-height: 330px; }
}

@media (max-width: 719px) {
    .home-hero { margin-top: 10px; padding: 26px 20px; border-radius: 12px; }
    .home-hero h1 { font-size: clamp(2rem, 10vw, 3.1rem); }
    .home-hero__mark { min-height: 80px; }
    .video-grid { gap: 12px; }
}

/* Watch presentation and the related-only layout follow the homepage rules. */
.watch-page, .watch-unavailable { padding-block: 24px; min-width: 0; }
.watch-breadcrumb { color: var(--muted); font-size: .82rem; overflow-wrap: anywhere; }
.watch-breadcrumb a { display: inline-flex; align-items: center; min-height: 44px; color: var(--gold-soft); }
.watch-header { margin-block: 10px 22px; }
.watch-header .section-kicker { margin: 0 0 8px; }
.watch-header h1 { margin: 0; font-size: clamp(1.55rem, 3vw, 2.5rem); line-height: 1.4; }
.watch-player { position: relative; width: 100%; min-width: 0; aspect-ratio: 16 / 9; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #000; box-shadow: var(--shadow-medium); }
.watch-player > *, .watch-player video, .watch-player iframe { width: 100%; height: 100%; max-width: 100%; max-height: 100%; }
.watch-player video { display: block; object-fit: contain; }
.watch-player iframe { display: block; border: 0; }
.watch-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-block: 18px 28px; }
.watch-actions a { display: inline-flex; justify-content: center; align-items: center; min-width: 0; min-height: 44px; padding: 10px 18px; border: 1px solid var(--gold); border-radius: 8px; color: var(--gold-soft); }
.watch-actions a:first-of-type { background: var(--gold); color: var(--bg); }
.watch-description, .watch-attributes, .watch-tags { min-width: 0; padding: 18px; margin-block: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.watch-description h2, .watch-tags h2 { margin: 0 0 12px; font-size: 1.15rem; }
.watch-description p { margin-block: 10px; white-space: pre-line; color: var(--muted); }
.watch-attributes dl { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0; }
.watch-attributes dt { color: var(--muted); }
.watch-attributes dd { margin: 0; color: var(--gold-soft); }
.watch-tags__links { display: flex; flex-wrap: wrap; gap: 8px; }
.watch-tags__links a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--gold-soft); }
.video-card__poster { position: relative; }
.video-card__wordmark { position: absolute; z-index: 2; right: 8px; bottom: 8px; padding: 3px 6px; border-radius: 4px; background: rgba(14, 13, 14, .86); color: var(--gold-soft); font-size: .65rem; font-weight: 900; letter-spacing: .08em; pointer-events: none; }
.video-card__preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; pointer-events: none; }
.is-previewing .video-card__preview { opacity: 1; }
.video-grid--related { grid-template-columns: minmax(0, 1fr); }

@media (min-width: 720px) {
    .video-grid--related { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1040px) {
    .video-grid--related { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1200px) {
    .video-grid--related { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 719px) {
    .watch-actions a { flex: 1 1 100%; }
}

/* Independent editorial routes. */
.article-archive, .article-single, .article-unavailable { min-width: 0; padding-block: 24px; }
.article-header { min-width: 0; margin-block: 12px 24px; }
.article-header h1 { margin: 0; font-size: clamp(1.6rem, 3vw, 2.6rem); line-height: 1.4; }
.article-header p { color: var(--muted); }
.article-breadcrumb { min-width: 0; color: var(--muted); font-size: .82rem; }
.article-breadcrumb a, .article-types a { display: inline-flex; align-items: center; min-height: 44px; color: var(--gold-soft); }
.article-types { display: flex; flex-wrap: wrap; gap: 12px; margin-block: 12px 24px; }
.article-types a { padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.article-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; min-width: 0; align-items: stretch; }
.article-card { display: flex; flex-direction: column; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow-low); }
.article-card__image { display: block; aspect-ratio: 16 / 9; overflow: hidden; }
.article-card__image img { display: block; width: 100%; height: 100%; object-fit: cover; }
.article-card__body { min-width: 0; padding: 16px; }
.article-card__type { margin: 0 0 8px; color: var(--gold-soft); font-size: .8rem; }
.article-card__title { margin: 0; font-size: 1.14rem; line-height: 1.5; }
.article-card__title a:hover { color: var(--gold-soft); }
.article-card__excerpt { margin: 10px 0 0; color: var(--muted); }
.article-body { min-width: 0; width: min(100%, 900px); max-width: 100%; margin-inline: auto; line-height: 1.85; }
.article-body > *, .article-body figure, .article-body img { max-width: 100%; }
.article-body figure { margin-inline: 0; }
.article-body img, .article-lead img { display: block; height: auto; }
.article-body a { color: var(--gold-soft); text-decoration: underline; text-underline-offset: .2em; }
.article-body table { display: block; max-width: 100%; overflow-x: auto; }
.article-lead { max-width: 900px; margin: 0 auto 28px; }
.article-lead figcaption, .article-body figcaption { margin-top: 8px; color: var(--muted); font-size: .86rem; }
.article-related { min-width: 0; margin-block: 36px 12px; }
.article-empty { padding: 24px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--muted); }
.article-pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 24px; }
.article-pagination a, .article-pagination [aria-current] { display: inline-flex; justify-content: center; align-items: center; min-width: 44px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; }
.article-pagination [aria-current] { background: var(--gold); color: var(--bg); }

@media (min-width: 720px) {
    .article-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1040px) {
    .article-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.route-unavailable, .route-list, .route-page { padding-block: 24px; min-width: 0; }
.route-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.route-empty { padding: 24px; color: var(--muted); }
.route-pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-block: 24px; }
.route-pagination a, .route-pagination [aria-current] { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); }
.route-pagination [aria-current] { background: var(--gold); color: var(--bg); }
.route-page__body { width: min(100%, 900px); margin-inline: auto; line-height: 1.85; }
.route-page__body a { color: var(--gold-soft); text-decoration: underline; }
@media (min-width: 720px) { .route-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1040px) { .route-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
