/*
Theme Name: MST88 News
Theme URI: https://mst88th.com
Author: MST88
Author URI: https://mst88th.com
Description: ธีมเว็บข่าวสารและบทความ MST88 ออกแบบโทนสีเข้ม-ทองสไตล์เว็บเกมมิ่งออนไลน์ รองรับ SEO และมือถือ
Version: 1.1.0
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: mst88news
Tags: news, dark, custom-menu, featured-images, threaded-comments
*/

:root {
  --bg: #0b0b0d;
  --bg-soft: #111214;
  --card: #17181c;
  --card-2: #1d1e23;
  --line: #2a2b31;
  --gold: #e9b033;
  --gold-2: #f2d638;
  --gold-dark: #b8860b;
  --red: #e93333;
  --green: #33e22f;
  --text: #f4f4f6;
  --muted: #a3a4ab;
  --muted-2: #7c7d85;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --grad-gold: linear-gradient(135deg, #f2d638 0%, #e9b033 45%, #c98f1a 100%);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Kanit', 'Noto Sans Thai', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 80% -150px, rgba(233, 176, 51, .08), transparent 60%),
    radial-gradient(900px 420px at 5% 5%, rgba(233, 51, 51, .05), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Kanit', 'Noto Sans Thai', sans-serif;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 .5em;
  color: #fff;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.55rem; }
h3 { font-size: 1.25rem; }

a { color: var(--gold); text-decoration: none; transition: color .2s ease; }
a:hover { color: var(--gold-2); }

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

.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 11, 13, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner { display: flex; align-items: center; gap: 22px; min-height: 68px; }

.site-branding { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.site-branding img { width: 46px; height: 46px; border-radius: 12px; }
.brand-text { font-family: 'Kanit', sans-serif; font-weight: 700; font-size: 1.3rem; color: #fff; letter-spacing: .5px; }
.brand-text span { color: var(--gold); }
.brand-sub { display: block; font-family: 'Kanit', sans-serif; font-weight: 400; font-size: .68rem; color: var(--muted-2); letter-spacing: 1.5px; text-transform: uppercase; }

.main-nav { margin-left: auto; }
.main-nav ul { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.main-nav a {
  display: block;
  padding: 9px 13px;
  color: var(--text);
  font-weight: 500;
  font-size: .95rem;
  border-radius: 10px;
}
.main-nav a:hover { background: var(--card); color: var(--gold-2); }
.main-nav .current-menu-item > a,
.main-nav .current_page_item > a { color: var(--gold); background: rgba(233, 176, 51, .1); }

.header-cta { display: flex; gap: 10px; flex-shrink: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: 'Kanit', sans-serif;
  font-weight: 600;
  font-size: .95rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
}
.btn-gold {
  background: var(--grad-gold);
  color: #241a02;
  box-shadow: 0 4px 18px rgba(233, 176, 51, .35);
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 8px 26px rgba(233, 176, 51, .5); color: #241a02; }
.btn-ghost { background: transparent; color: var(--gold); border: 1.5px solid rgba(233, 176, 51, .55); }
.btn-ghost:hover { background: rgba(233, 176, 51, .12); color: var(--gold-2); }
.btn-red { background: linear-gradient(135deg, #f5534d, #c81e1e); color: #fff; }
.btn-sm { padding: 7px 15px; font-size: .85rem; }
.btn-lg { padding: 14px 30px; font-size: 1.05rem; }

.nav-toggle { display: none; background: none; border: none; color: var(--gold); font-size: 1.6rem; cursor: pointer; padding: 6px 10px; }

/* ---------- Hero carousel ---------- */
.hero { padding: 26px 0 8px; }
.carousel { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); }
.carousel-track { position: relative; aspect-ratio: 1600 / 420; background: var(--card); }
.carousel-slide { position: absolute; inset: 0; opacity: 0; transition: opacity .7s ease; }
.carousel-slide.active { opacity: 1; }
.carousel-slide img { width: 100%; height: 100%; object-fit: cover; }
.carousel-slide a { display: block; width: 100%; height: 100%; }
.carousel-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 5; width: 42px; height: 42px; border-radius: 50%;
  background: rgba(10, 10, 12, .55); border: 1px solid rgba(255,255,255,.15);
  color: #fff; font-size: 1.15rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.carousel-arrow:hover { background: rgba(233, 176, 51, .8); }
.carousel-arrow.prev { left: 14px; }
.carousel-arrow.next { right: 14px; }
.carousel-dots { position: absolute; bottom: 14px; left: 0; right: 0; display: flex; justify-content: center; gap: 8px; z-index: 5; }
.carousel-dot { width: 26px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.35); border: none; cursor: pointer; transition: background .25s; }
.carousel-dot.active { background: var(--gold-2); }

.hero-strip {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px;
  margin: 14px 0 0; padding: 12px 18px;
  background: linear-gradient(90deg, rgba(233,176,51,.12), rgba(233,51,51,.08));
  border: 1px solid rgba(233, 176, 51, .3); border-radius: var(--radius-sm);
}
.hero-strip .strip-title { margin: 0; font-size: 1.05rem; font-weight: 600; color: var(--gold-2); }
.hero-strip p { margin: 0; font-size: .92rem; color: var(--muted); }
.hero-strip .actions { display: flex; gap: 10px; }

/* ---------- Sections ---------- */
.section { padding: 34px 0 6px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.section-title { position: relative; padding-left: 16px; margin: 0; font-size: 1.45rem; }
.section-title::before { content: ""; position: absolute; left: 0; top: .18em; bottom: .18em; width: 5px; border-radius: 3px; background: var(--grad-gold); }
.section-title .en { color: var(--gold); }
.section-more { font-size: .9rem; font-weight: 600; color: var(--muted); }
.section-more:hover { color: var(--gold); }

/* Category quick cards */
.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.cat-card {
  position: relative; display: flex; align-items: center; gap: 14px;
  padding: 18px 16px; border-radius: var(--radius);
  background: linear-gradient(145deg, var(--card-2), var(--card));
  border: 1px solid var(--line); overflow: hidden;
  transition: transform .18s ease, border-color .25s, box-shadow .25s;
}
.cat-card::after {
  content: ""; position: absolute; inset: auto -30% -60% auto; width: 130px; height: 130px; border-radius: 50%;
  background: radial-gradient(circle, rgba(233,176,51,.16), transparent 70%);
}
.cat-card:hover { transform: translateY(-4px); border-color: rgba(233,176,51,.5); box-shadow: 0 14px 30px rgba(0,0,0,.4); }
.cat-card img { width: 54px; height: 54px; object-fit: contain; flex-shrink: 0; }
.cat-card .name { font-family: 'Kanit', sans-serif; font-weight: 600; font-size: 1.08rem; color: #fff; display: block; }
.cat-card .desc { font-size: .8rem; color: var(--muted); display: block; margin-top: 2px; }

/* Article cards */
.post-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.post-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.post-card {
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: transform .18s ease, border-color .25s, box-shadow .25s;
}
.post-card:hover { transform: translateY(-5px); border-color: rgba(233,176,51,.45); box-shadow: 0 16px 34px rgba(0,0,0,.45); }
.post-card .thumb { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--card-2); }
.post-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.post-card:hover .thumb img { transform: scale(1.06); }
.post-card .thumb .cat-badge {
  position: absolute; left: 10px; top: 10px;
  padding: 3px 11px; border-radius: 999px;
  background: rgba(10,10,12,.72); border: 1px solid rgba(233,176,51,.5);
  color: var(--gold-2); font-size: .74rem; font-weight: 600;
}
.post-card .body { padding: 14px 15px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.post-card .entry-title { font-size: 1.02rem; margin: 0; line-height: 1.45; }
.post-card .entry-title a { color: #fff; }
.post-card .entry-title a:hover { color: var(--gold-2); }
.post-card .excerpt { font-size: .87rem; color: var(--muted); margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-card .meta { margin-top: auto; font-size: .78rem; color: var(--muted-2); display: flex; gap: 12px; }

/* Feature boxes */
.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.feature-box {
  padding: 22px 18px; border-radius: var(--radius); text-align: center;
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--line);
}
.feature-box .ico {
  width: 58px; height: 58px; margin: 0 auto 12px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(233,176,51,.12); border: 1px solid rgba(233,176,51,.35);
  font-size: 1.55rem;
}
.feature-box h3 { font-size: 1.02rem; margin-bottom: 6px; }
.feature-box p { font-size: .85rem; color: var(--muted); margin: 0; }

/* Game showcase */
.game-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.game-card { position: relative; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); background: var(--card); transition: transform .18s, border-color .25s; }
.game-card:hover { transform: translateY(-4px); border-color: rgba(233,176,51,.5); }
.game-card img { width: 100%; aspect-ratio: 10 / 14.5; object-fit: cover; }
.game-card .name {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 10px 8px;
  background: linear-gradient(transparent, rgba(5,5,6,.92) 65%);
  font-family: 'Kanit', sans-serif; font-size: .82rem; font-weight: 500; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.game-card .rtp {
  position: absolute; top: 8px; right: 8px; padding: 2px 9px; border-radius: 999px;
  background: rgba(53, 178, 60, .9); color: #fff; font-size: .72rem; font-weight: 700;
}

/* SEO text / content blocks */
.seo-block { padding: 26px 28px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.seo-block h2 { margin-top: 12px; }
.seo-block h2:first-child { margin-top: 0; }
.seo-block p { color: #d6d7dc; }
.seo-block ul { color: #d6d7dc; padding-left: 22px; }
.seo-block li { margin: 4px 0; }

/* FAQ */
.faq-list { display: flex; flex-direction: column; gap: 12px; }
.faq-item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.faq-item summary {
  list-style: none; cursor: pointer; padding: 15px 18px;
  font-family: 'Kanit', sans-serif; font-weight: 500; font-size: 1rem; color: #fff;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; color: var(--gold); font-size: 1.3rem; font-weight: 600; }
.faq-item[open] summary::after { content: "−"; }
.faq-item[open] summary { color: var(--gold-2); background: rgba(233,176,51,.05); }
.faq-item .faq-body { padding: 2px 18px 16px; color: var(--muted); font-size: .93rem; }

/* ---------- Page / single ---------- */
.page-hero { padding: 30px 0 10px; }
.breadcrumbs { font-size: .82rem; color: var(--muted-2); padding: 14px 0 4px; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--gold); }
.breadcrumbs .sep { margin: 0 7px; color: var(--muted-2); }

.layout-split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 26px; padding-bottom: 30px; }
.content-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.content-card > .entry-thumb { margin: -28px -28px 22px; border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; max-height: 430px; }
.content-card > .entry-thumb img { width: 100%; object-fit: cover; }

.entry-meta { display: flex; flex-wrap: wrap; gap: 16px; font-size: .82rem; color: var(--muted-2); margin: 4px 0 16px; }
.entry-content { color: #d8d9de; font-size: 1.02rem; }
.entry-content h2 { margin-top: 1.6em; padding-left: 14px; border-left: 4px solid var(--gold); }
.entry-content h3 { margin-top: 1.4em; }
.entry-content p { margin: 0 0 1.15em; }
.entry-content ul, .entry-content ol { padding-left: 24px; margin: 0 0 1.15em; }
.entry-content li { margin: 5px 0; }
.entry-content img { border-radius: var(--radius-sm); margin: 10px auto 18px; }
.entry-content table { width: 100%; border-collapse: collapse; margin: 0 0 1.3em; font-size: .95rem; }
.entry-content th, .entry-content td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; }
.entry-content th { background: var(--card-2); color: #fff; font-family: 'Kanit', sans-serif; }
.entry-content tr:nth-child(even) td { background: rgba(255,255,255,.02); }
.entry-content blockquote {
  margin: 1.4em 0; padding: 14px 20px; border-left: 4px solid var(--gold);
  background: rgba(233,176,51,.06); border-radius: 0 10px 10px 0; color: #e8e9ec; font-style: normal;
}
.entry-content a { text-decoration: underline; text-underline-offset: 3px; }

.post-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.post-tags a {
  padding: 5px 14px; border-radius: 999px; font-size: .8rem;
  background: var(--card-2); border: 1px solid var(--line); color: var(--muted);
}
.post-tags a:hover { border-color: var(--gold); color: var(--gold-2); }

/* Sidebar */
.sidebar .widget {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 20px;
}
.sidebar .widget-title { position: relative; font-size: 1.05rem; margin: 0 0 14px; padding-left: 13px; }
.sidebar .widget-title::before { content: ""; position: absolute; left: 0; top: .2em; bottom: .2em; width: 4px; border-radius: 2px; background: var(--grad-gold); }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li { padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: .92rem; }
.sidebar li:last-child { border-bottom: none; }
.sidebar li a { color: #d6d7dc; }
.sidebar li a:hover { color: var(--gold-2); }
.widget-promo {
  text-align: center; padding: 26px 18px;
  background: linear-gradient(160deg, rgba(233,176,51,.16), rgba(233,51,51,.1)), var(--card);
}
.widget-promo img { width: 74px; height: 74px; margin: 0 auto 10px; }
.widget-promo p { font-size: .88rem; color: #d6d7dc; margin: 0 0 14px; }

/* Archive header */
.archive-head {
  padding: 30px 28px; margin: 18px 0 24px;
  background: linear-gradient(145deg, rgba(233,176,51,.1), transparent 55%), var(--card);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.archive-head h1 { margin: 0 0 6px; }
.archive-head .desc { color: var(--muted); font-size: .95rem; }
.archive-head .desc p { margin: 0 0 .6em; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

/* Pagination */
.pagination { display: flex; justify-content: center; gap: 8px; margin: 30px 0 10px; }
.pagination .page-numbers {
  min-width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0 12px; border-radius: 10px; font-weight: 600; font-size: .9rem;
  background: var(--card); border: 1px solid var(--line); color: var(--muted);
}
.pagination .page-numbers.current { background: var(--grad-gold); color: #241a02; border-color: transparent; }
.pagination .page-numbers:hover:not(.current) { border-color: var(--gold); color: var(--gold-2); }

/* ---------- Footer ---------- */
.site-footer { margin-top: 40px; border-top: 1px solid var(--line); background: #08080a; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1.2fr; gap: 28px; padding: 38px 0 26px; }
.footer-col h3 { font-size: 1rem; color: var(--gold-2); margin-bottom: 14px; }
.footer-col p { font-size: .88rem; color: var(--muted); }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin: 7px 0; font-size: .9rem; }
.footer-col li a { color: var(--muted); }
.footer-col li a:hover { color: var(--gold-2); }
.footer-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.footer-brand img { width: 44px; height: 44px; border-radius: 10px; }
.footer-brand .t { font-family: 'Kanit', sans-serif; font-weight: 700; font-size: 1.2rem; color: #fff; }
.footer-brand .t span { color: var(--gold); }
.license-line { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 0; }
.license-chip { padding: 5px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); font-size: .76rem; color: var(--muted); }
.footer-bottom {
  border-top: 1px solid var(--line); padding: 16px 0; text-align: center;
  font-size: .8rem; color: var(--muted-2);
}
.footer-bottom a { color: var(--muted); }

/* 404 */
.error-404 { text-align: center; padding: 70px 20px 90px; }
.error-404 .code { font-family: 'Kanit', sans-serif; font-size: 5.5rem; font-weight: 700; line-height: 1; background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent; }
.error-404 h1 { margin: 10px 0 8px; }
.error-404 p { color: var(--muted); margin-bottom: 22px; }

/* Search form */
.search-form { display: flex; gap: 8px; }
.search-form input[type="search"] {
  flex: 1; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg-soft); color: var(--text); font-family: inherit; font-size: .92rem;
}
.search-form input:focus { outline: none; border-color: var(--gold); }
.search-form button { padding: 10px 18px; border-radius: 10px; border: none; background: var(--grad-gold); color: #241a02; font-weight: 700; cursor: pointer; font-size: .9rem; }

/* Sticky mobile bottom bar */
.mobile-bar {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 90;
  background: rgba(10,10,12,.96); border-top: 1px solid var(--line);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
}
.mobile-bar .row { display: flex; gap: 10px; }
.mobile-bar .btn { flex: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .post-grid, .post-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
  .game-grid { grid-template-columns: repeat(4, 1fr); }
  .layout-split { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .nav-toggle { display: block; margin-left: auto; }
  .header-cta { display: none; }
  .main-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: #0d0e10; border-bottom: 1px solid var(--line); padding: 10px 16px 16px;
  }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; align-items: stretch; gap: 2px; }
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .mobile-bar { display: block; }
  body { padding-bottom: 62px; }
}
@media (max-width: 620px) {
  .post-grid, .post-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
  .game-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 1fr; }
  .carousel-track { aspect-ratio: 1600 / 620; }
  h1 { font-size: 1.5rem; }
  .content-card { padding: 20px; }
  .content-card > .entry-thumb { margin: -20px -20px 18px; }
}

/* Accessibility */
.screen-reader-text {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%);
}
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--gold); color: #000; padding: 8px 14px; z-index: 999; }
.skip-link:focus { left: 0; }

::selection { background: rgba(233,176,51,.4); color: #fff; }
