/* All Fighting Arts - Learn Thai / Learn Chinese. Mobile-first, dark/light aware, no external resources. */
:root {
  color-scheme: dark light;
  --bg: #0c0d10;
  --surface: #15171c;
  --surface-2: #1c1f26;
  --border: rgb(255 255 255 / 0.09);
  --text: #f3f1ec;
  --muted: #a6a59f;
  --accent: #d8b25a;
  --accent-ink: #1a1405;
  --accent-soft: rgb(216 178 90 / 0.14);
  --focus: #8ab4ff;
  --shadow: 0 24px 60px -24px rgb(0 0 0 / 0.7);
  --radius: 18px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Noto Sans Thai", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Noto Serif", Georgia, serif;
}
html[data-site="thai"] { --bg: #0d1224; --surface: #141a31; --surface-2: #1b2340; --accent: #f0c15b; --accent-ink: #231a05; --accent-soft: rgb(240 193 91 / 0.15); }
html[data-site="chinese"] { --bg: #190c0b; --surface: #231211; --surface-2: #2d1817; --accent: #ef6a57; --accent-ink: #2a0a06; --accent-soft: rgb(239 106 87 / 0.16); }

@media (prefers-color-scheme: light) {
  :root { --bg: #f4f2ec; --surface: #ffffff; --surface-2: #f0ede5; --border: rgb(20 20 25 / 0.1); --text: #14151a; --muted: #5c5c57; --accent: #8a6a1c; --accent-ink: #fff; --accent-soft: rgb(138 106 28 / 0.1); --focus: #1d4ed8; --shadow: 0 24px 50px -28px rgb(40 30 10 / 0.35); }
  html[data-site="thai"] { --bg: #f6f3ea; --surface: #fff; --surface-2: #eeeadf; --accent: #8a5d06; --accent-ink: #fff; --accent-soft: rgb(138 93 6 / 0.1); }
  html[data-site="chinese"] { --bg: #f8f2ee; --surface: #fff; --surface-2: #f1e7e1; --accent: #b3261e; --accent-ink: #fff; --accent-soft: rgb(179 38 30 / 0.09); }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text); font-family: var(--font);
  line-height: 1.5; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
body.lang { background-image: radial-gradient(120% 60% at 50% -10%, var(--accent-soft), transparent 60%); background-repeat: no-repeat; }
img { max-width: 100%; display: block; }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 10; background: var(--accent); color: var(--accent-ink); padding: 10px 16px; border-radius: 10px; font-weight: 600; text-decoration: none; }
.skip:focus { top: 12px; }

/* ---------- Root placeholder ---------- */
body.root { display: flex; flex-direction: column; background-image: radial-gradient(90% 55% at 50% 0%, rgb(216 178 90 / 0.13), transparent 65%), radial-gradient(60% 40% at 90% 100%, rgb(216 178 90 / 0.06), transparent 70%); }
.root-main { flex: 1; width: min(100% - 2rem, 62rem); margin: 0 auto; display: flex; flex-direction: column; justify-content: center; gap: clamp(2rem, 6vw, 4rem); padding: clamp(3rem, 10vh, 6rem) 0 2rem; }
.root-hero { text-align: center; }
.eyebrow { margin: 0 0 .75rem; font-size: .8rem; letter-spacing: .28em; text-transform: uppercase; color: var(--accent); }
.wordmark { margin: 0; font-family: var(--serif); font-weight: 600; font-size: clamp(2.6rem, 9vw, 5.5rem); line-height: 1.02; letter-spacing: -.02em; text-wrap: balance; }
.lang-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 40rem) { .lang-cards { grid-template-columns: 1fr 1fr; gap: 1.5rem; } }
.lang-card {
  position: relative; display: grid; grid-template-columns: 1fr auto; align-content: end; gap: .15rem .75rem; min-height: 11rem; padding: 1.4rem 1.5rem; border-radius: 22px; text-decoration: none; overflow: hidden; isolation: isolate;
  border: 1px solid var(--border); box-shadow: var(--shadow); transition: transform .25s ease, border-color .25s ease;
}
.lang-card[data-lang="thai"] { background: linear-gradient(145deg, #1d2a4d, #0e1530); color: #f6f1e3; --c: #f0c15b; }
.lang-card[data-lang="chinese"] { background: linear-gradient(145deg, #8f2a22, #3f0f0c); color: #fbeee6; --c: #f6d58a; }
.lang-native { position: absolute; z-index: -1; right: 1rem; top: .2rem; font-size: clamp(5rem, 16vw, 7.5rem); font-weight: 700; color: var(--c); opacity: .13; line-height: 1; }
.lang-title { grid-column: 1; font-family: var(--serif); font-size: clamp(1.7rem, 4.5vw, 2.2rem); font-weight: 600; line-height: 1.1; }
.lang-sub { grid-column: 1; color: var(--c); font-size: .95rem; opacity: .9; }
.lang-go { grid-column: 2; grid-row: 1 / span 2; align-self: end; font-size: 1.6rem; color: var(--c); transition: transform .25s ease; }
.lang-card:hover, .lang-card:focus-visible { transform: translateY(-3px); border-color: var(--c); }
.lang-card:hover .lang-go, .lang-card:focus-visible .lang-go { transform: translateX(4px); }
.root-foot { text-align: center; padding: 1.5rem 1rem 2.25rem; }
.contact { color: var(--muted); text-decoration: none; font-size: 1rem; padding: .5rem .75rem; border-radius: 10px; }
.contact:hover { color: var(--text); text-decoration: underline; }

.offline .root-main { text-align: center; align-items: center; }
.offline .wordmark { font-size: clamp(2rem, 7vw, 3.5rem); }
.offline-note { color: var(--muted); margin: 0; }

/* ---------- Language pages ---------- */
.top { width: min(100% - 2rem, 80rem); margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 0; font-size: .92rem; }
.brand { text-decoration: none; font-family: var(--serif); font-weight: 600; letter-spacing: .01em; }
.brand:hover { color: var(--accent); }
.switch { text-decoration: none; color: var(--muted); padding: .45rem .8rem; border: 1px solid var(--border); border-radius: 999px; }
.switch:hover { color: var(--text); border-color: var(--accent); }
.wrap { width: min(100% - 2rem, 80rem); margin: 0 auto; padding-bottom: 3rem; }
.hero { padding: clamp(.75rem, 3vw, 2rem) 0 clamp(1rem, 3vw, 1.75rem); }
.page-title { margin: 0; font-family: var(--serif); font-weight: 600; font-size: clamp(2.3rem, 8vw, 4.2rem); line-height: 1.05; letter-spacing: -.02em; display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.native { font-family: var(--font); font-weight: 700; color: var(--accent); font-size: .62em; }
.tagline { margin: .6rem 0 0; color: var(--muted); font-size: clamp(1rem, 2.4vw, 1.2rem); max-width: 40rem; text-wrap: pretty; }
.banner { margin: 0 0 1.25rem; padding: .75rem 1rem; border-radius: 12px; border: 1px dashed var(--accent); background: var(--accent-soft); font-size: .92rem; }

.latest { display: grid; gap: 1.25rem; margin-bottom: 1.75rem; }
.player-wrap { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--border); background: #000; }
.player { position: relative; aspect-ratio: 16 / 9; width: 100%; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.latest-info { display: grid; gap: .35rem; align-content: start; }
.latest-title, .card-title, .page-title { overflow-wrap: anywhere; }
.latest-title { margin: .1rem 0 .1rem; font-size: clamp(1.35rem, 3.6vw, 2.1rem); line-height: 1.2; letter-spacing: -.01em; text-wrap: balance; }
.kicker { margin: 0; display: flex; align-items: center; gap: .55rem; font-size: .8rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.meta { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .55rem; color: var(--muted); font-size: .95rem; }
.channel { color: var(--text); font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--border); }
.channel:hover { color: var(--accent); border-color: var(--accent); }
.dot { opacity: .6; }
.topic { margin: .15rem 0 0; color: var(--muted); font-size: .92rem; }
.actions { margin: .75rem 0 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 46px; padding: .7rem 1.2rem; border-radius: 12px; border: 1px solid transparent; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; transition: filter .2s, transform .15s; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.empty { padding: 3rem 1rem; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius); color: var(--muted); }

@media (min-width: 64rem) {
  .latest { grid-template-columns: minmax(0, 2fr) minmax(16rem, 1fr); gap: 2rem; align-items: start; }
  .latest-info { padding-top: .25rem; }
}

.chip { display: inline-flex; align-items: center; padding: .15rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.chip-live { background: var(--accent); color: var(--accent-ink); }
.chip-day { position: absolute; left: .6rem; top: .6rem; background: rgb(10 10 12 / .72); color: #fff; backdrop-filter: blur(6px); }
.chip-time { position: absolute; right: .6rem; bottom: .6rem; background: rgb(10 10 12 / .78); color: #fff; letter-spacing: .02em; text-transform: none; font-variant-numeric: tabular-nums; }

.notify { display: flex; flex-direction: column; gap: 1rem; padding: 1.1rem 1.25rem; margin-bottom: 2.25rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.notify[hidden] { display: none; }
.notify-title { margin: 0 0 .15rem; font-size: 1.05rem; }
.notify-copy, .notify-ios, .notify-status { margin: .15rem 0 0; color: var(--muted); font-size: .93rem; }
.notify-ios { color: var(--text); background: var(--accent-soft); padding: .6rem .8rem; border-radius: 10px; margin-top: .6rem; }
.notify-status:empty { display: none; }
@media (min-width: 40rem) { .notify { flex-direction: row; align-items: center; justify-content: space-between; } .notify .btn { flex: none; } }

.section-title { margin: 0 0 1rem; font-family: var(--serif); font-size: clamp(1.4rem, 3.5vw, 1.9rem); letter-spacing: -.01em; }
.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.1rem; grid-template-columns: 1fr; }
@media (min-width: 40rem) { .grid { grid-template-columns: repeat(2, 1fr); gap: 1.25rem; } }
@media (min-width: 64rem) { .grid { grid-template-columns: repeat(3, 1fr); gap: 1.5rem; } }
@media (min-width: 88rem) { .grid { grid-template-columns: repeat(4, 1fr); } .wrap, .top { width: min(100% - 4rem, 96rem); } }
.card-item { display: flex; }
.card { display: flex; flex-direction: column; width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease; content-visibility: auto; contain-intrinsic-size: auto 22rem; }
.card:hover, .card:focus-within { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); box-shadow: var(--shadow); }
.thumb { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover .thumb img { transform: scale(1.04); }
.card-body { display: flex; flex-direction: column; gap: .3rem; padding: .95rem 1.05rem 1.1rem; flex: 1; }
.card .kicker { font-size: .72rem; }
.card-title { margin: 0; font-size: 1.05rem; line-height: 1.3; font-weight: 650; text-wrap: pretty; }
.card-title a { text-decoration: none; }
.card-title a:hover { color: var(--accent); text-decoration: underline; }
.card .meta { font-size: .88rem; }
.yt { margin: auto 0 0; padding-top: .5rem; font-size: .9rem; font-weight: 600; }
.yt a { color: var(--accent); text-decoration: none; }
.yt a:hover { text-decoration: underline; }

.foot { width: min(100% - 2rem, 80rem); margin: 0 auto; padding: 1.75rem 0 2.5rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .88rem; }
.foot p { margin: .25rem 0; }
.foot a { text-decoration: none; border-bottom: 1px solid var(--border); }
.foot a:hover { color: var(--text); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } .card:hover, .lang-card:hover { transform: none; } }
