/* =====================================================================
   trinitycss09.css  —  Trinity Thailand revamp, step 1
   Scope: base reset, theme variables, top bar, language toggle,
          menubar (desktop + mobile), cookie consent bar, footer.
   Old pages keep using trinitycss08.css and are unaffected.
   ===================================================================== */

/* ---------- 1. THEMES ------------------------------------------------
   Each section of the site sets ONE class on <body> (e.g. theme-music).
   Everything below derives from these five variables.
   To add a new section: copy a block, change the five values. Done.
--------------------------------------------------------------------- */
:root,
body.theme-default {
	--c-primary:  #662367;   /* menubar, headings, active states   */
	--c-accent:   #e639b2;   /* buttons, links, highlights          */
	--c-menubar:  rgba(102, 35, 103, 0.92);
	--page-bg:    #f5f2f6;   /* behind the main content column      */
	--c-text:     #222;
}
body.theme-music {
	--c-primary:  #662367;
	--c-accent:   #e639b2;
	--c-menubar:  rgba(102, 35, 103, 0.92);
	--page-bg:    #f5f2f6;
	--c-text:     #222;
}
body.theme-rockpop {
	--c-primary:  #111111;
	--c-accent:   #db6414;
	--c-menubar:  rgba(10, 10, 10, 0.95);
	--page-bg:    #111111;
	--c-text:     #f0f0f0;
}
body.theme-gese {
	--c-primary:  #690008;
	--c-accent:   #ad1515;
	--c-menubar:  rgba(105, 0, 8, 0.92);
	--page-bg:    #f7f2f2;
	--c-text:     #222;
}
body.theme-drama {
	--c-primary:  #1f717a;
	--c-accent:   #36b8c7;
	--c-menubar:  rgba(31, 113, 122, 0.92);
	--page-bg:    #f0f6f7;
	--c-text:     #222;
}

/* ---------- 2. BASE -------------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	font-family: 'Sarabun', Arial, Helvetica, sans-serif;
	font-size: 16px;
	line-height: 1.65;
	color: var(--c-text);
	background-color: var(--page-bg);
}
img { max-width: 100%; height: auto; }
a { color: var(--c-accent); }

/* Central page column. Fluid, capped, replaces the fixed 900px. */
.page-wrap {
	max-width: 1100px;
	margin: 0 auto;
	background-color: transparent;
}

/* ---------- 3. LANGUAGE TOGGLE ---------------------------------------
   Default language is Thai. A tiny inline script in the <head> adds
   class "lang-en" to <html> before first paint, so there is no flash.
   Elements keep their natural display type (span stays inline, etc.)
   because we only ever hide the inactive language.
--------------------------------------------------------------------- */
html:not(.lang-en) .toggleen { display: none !important; }
html.lang-en       .toggleth { display: none !important; }

/* ---------- 4. TOP BAR ----------------------------------------------- */
.topbar {
	background-color: #fff;
	color: #222; /* fixed: topbar is always white, so never inherit
	                the theme text colour (near-white on theme-rockpop) */
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 16px;
}
.topbar-logo img {
	width: 240px;
	max-width: 56vw;
	display: block;
}
.topbar-right {
	display: flex;
	align-items: center;
	gap: 14px;
	font-size: 13px;
	font-weight: bold;
	white-space: nowrap;
}
.topbar-country {
	display: flex;
	align-items: center;
	gap: 6px;
}
.topbar-country img { width: 24px; height: 16px; }
.topbar-contact a { color: var(--c-primary); text-decoration: none; }
.topbar-contact a:hover { text-decoration: underline; }

.lang-switcher {
	display: flex;
	align-items: center;
	gap: 2px;
	border: 1px solid #ddd;
	border-radius: 999px;
	padding: 2px;
}
.lang-btn {
	border: 0;
	background: none;
	font: inherit;
	font-size: 12px;
	font-weight: bold;
	color: #888;
	padding: 3px 10px;
	border-radius: 999px;
	cursor: pointer;
}
html:not(.lang-en) .lang-btn[data-lang="th"],
html.lang-en       .lang-btn[data-lang="en"] {
	background-color: var(--c-primary);
	color: #fff;
}

/* On small screens hide the contact link (it lives in the menu too) */
@media (max-width: 640px) {
	.topbar-contact { display: none; }
}

/* ---------- 5. MENUBAR ------------------------------------------------
   One copy of the menu. Bilingual labels via .toggleth / .toggleen.
   Desktop: horizontal bar with hover/focus dropdowns.
   Mobile (<=768px): hamburger button + slide-down accordion.
--------------------------------------------------------------------- */
.nav {
	background-color: var(--c-menubar);
	position: relative;
	z-index: 50;
}
.nav-toggle {                    /* hamburger — hidden on desktop */
	display: none;
	width: 100%;
	border: 0;
	background: none;
	color: #fff;
	font: inherit;
	font-weight: bold;
	font-size: 15px;
	padding: 12px 16px;
	text-align: left;
	cursor: pointer;
}
.nav-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
}
.nav-item { position: relative; }
.nav-item > a,
.nav-item > button {
	display: block;
	width: 100%;
	border: 0;
	background: none;
	color: #fff;
	font: inherit;
	font-size: 15px;
	padding: 12px 18px;
	text-align: left;
	text-decoration: none;
	cursor: pointer;
	white-space: nowrap;
}
.nav-item > a:hover,
.nav-item > button:hover,
.nav-item.open > button {
	background-color: rgba(255, 255, 255, 0.14);
}
/* Active section: white tab with theme-coloured text (as today) */
.nav-item.active > a,
.nav-item.active > button {
	background-color: #fff;
	color: var(--c-primary);
	font-weight: bold;
}
.nav-caret { font-size: 11px; opacity: 0.8; }

/* Dropdown */
.nav-sub {
	list-style: none;
	margin: 0;
	padding: 6px 0;
	background-color: var(--c-menubar);
	min-width: 240px;
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
}
.nav-item.open > .nav-sub { display: block; }
.nav-sub a {
	display: block;
	color: #fff;
	text-decoration: none;
	font-size: 14px;
	padding: 9px 18px;
}
.nav-sub a:hover { background-color: rgba(255, 255, 255, 0.14); }

@media (min-width: 769px) {
	/* Hover also opens dropdowns on desktop. Keyboard users open
	   them via the button (Enter/Space -> .open class from JS);
	   a :focus-within rule here would keep a clicked dropdown
	   stuck open, so it is deliberately absent. */
	.nav-item:hover > .nav-sub { display: block; }
}

/* Mobile */
@media (max-width: 768px) {
	.nav-toggle { display: block; }
	.nav-list {
		display: none;
		flex-direction: column;
	}
	.nav.open .nav-list { display: flex; }
	.nav-item > a,
	.nav-item > button { padding: 13px 20px; }
	.nav-sub {
		position: static;
		box-shadow: none;
		background-color: rgba(0, 0, 0, 0.18);
		min-width: 0;
	}
	.nav-sub a { padding: 12px 34px; }
	.nav-item.active > a,
	.nav-item.active > button {
		background: none;
		color: #fff;
		box-shadow: inset 4px 0 0 #fff;
	}
}

/* ---------- 6. COOKIE CONSENT BAR ------------------------------------ */
.cookiebar {
	position: fixed;
	left: 0; right: 0; bottom: 0;
	z-index: 100;
	background-color: #40153d;
	color: #fff;
	font-size: 14px;
	padding: 12px 16px;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 10px 18px;
	box-shadow: 0 -3px 10px rgba(0, 0, 0, 0.25);
}
.cookiebar a { color: #fff; }
.cookiebar-accept {
	border: 0;
	background-color: var(--c-accent, #ee4396);
	color: #fff;
	font: inherit;
	font-weight: bold;
	font-size: 14px;
	padding: 7px 22px;
	border-radius: 5px;
	cursor: pointer;
}
.cookiebar-accept:hover { filter: brightness(0.9); }
html.cookies-accepted .cookiebar { display: none; }

/* ---------- 6b. PAGE CONTENT BOTTOM SPACING ---------------------------
   Every page still carries its own .page-content rule in a page-scoped
   <style> block (pending consolidation). Those come later in the
   document and would win a specificity tie, so this rule is written as
   `body .page-content` to override them from one place.
--------------------------------------------------------------------- */
body .page-content { padding-bottom: 70px; }
@media (max-width: 700px) {
	body .page-content { padding-bottom: 60px; }
}

/* ---------- 7. FOOTER -------------------------------------------------
   Background follows the section theme (--c-primary), so the footer
   changes colour with the section. No top margin: the white content
   column runs straight into the footer instead of leaving a strip of
   page background showing.
--------------------------------------------------------------------- */
.site-footer {
	background-color: var(--c-primary);
	color: #fff;
	font-size: 14px;
	padding: 26px 30px;
	margin-top: 0;
}
.site-footer a { color: #fff; }
.footer-contact {
	width: 100%;
	display: flex;
	flex-wrap: nowrap;
	justify-content: space-evenly;
	align-items: center;
	gap: 20px;
}
.footer-item {
	display: flex;
	align-items: center;
	gap: 10px;
	color: #fff;
	text-decoration: none;
	line-height: 1.5;
	white-space: nowrap;
}
.footer-item img {
	width: 24px;
	height: 24px;
	flex-shrink: 0;
}
a.footer-item:hover span { text-decoration: underline; }
@media (max-width: 900px) {
	.footer-contact {
		flex-wrap: wrap;
		justify-content: center;
		gap: 16px 40px;
	}
	.footer-item { white-space: normal; }
}

/* ---------- 8. ACCESSIBILITY / MOTION -------------------------------- */
:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; animation: none !important; }
}

/* =====================================================================
   STEP 2 ADDITIONS — hero slider, per-page hero image, front page
   ===================================================================== */

/* ---------- 9. HERO ---------------------------------------------------
   Two variants:
     .hero-slider  — crossfade slideshow (front page); needs slider.js
     .hero-still   — single image with optional link (inner pages)
   Adjust the shape with --hero-ratio (width / height).
--------------------------------------------------------------------- */
.hero { position: relative; }
.hero-slider {
	position: relative;
	overflow: hidden;
	aspect-ratio: var(--hero-ratio, 45 / 16);
	background-color: #2a082b;
}
.hero-slide {
	position: absolute;
	inset: 0;
	opacity: 0;
	transition: opacity 0.8s ease;
}
.hero-slide.active { opacity: 1; z-index: 1; }
.hero-slide img,
.hero-slide .hero-fill {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.hero-slide a { display: block; width: 100%; height: 100%; color: inherit; text-decoration: none; }
.hero-caption {
	position: absolute;
	left: 0; right: 0; bottom: 0;
	background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
	color: #fff;
	padding: 42px 26px 32px;
	font-size: 17px;
	line-height: 1.45;
}
.hero-caption .captionheader { display: block; font-size: 21px; font-weight: bold; }
.hero-caption a { color: #fff; }
.hero-dots {
	position: absolute;
	bottom: 10px; left: 0; right: 0;
	text-align: center;
	z-index: 2;
}
.hero-dot {
	width: 11px; height: 11px;
	border-radius: 50%;
	border: 0;
	padding: 0;
	margin: 0 4px;
	background-color: rgba(255, 255, 255, 0.5);
	cursor: pointer;
}
.hero-dot.active { background-color: #fff; }
@media (max-width: 640px) {
	.hero-slider { aspect-ratio: var(--hero-ratio-mobile, 16 / 10); }
	.hero-caption { font-size: 14px; padding: 30px 16px 26px; }
	.hero-caption .captionheader { font-size: 17px; }
}

.hero-still img { width: 100%; display: block; }
/* Never show a broken-image placeholder if a hero src is empty:
   desktop browsers collapse it, mobile draws a [?] icon. */
.hero-still img[src=""] { display: none; }

/* ---------- 10. FRONT PAGE COMPONENTS -------------------------------- */
.front-intro {
	background-color: #fff;
	padding: 28px 32px;
}
@media (max-width: 640px) { .front-intro { padding: 20px 18px; } }

.video-frame {
	position: relative;
	aspect-ratio: 16 / 9;
	max-width: 720px;
	margin: 22px auto;
}
.video-frame iframe {
	position: absolute;
	inset: 0;
	width: 100%; height: 100%;
	border: 0;
}

.subject-band {
	background-color: #f0e7f0;
	padding: 32px 16px;
}
.subject-grid {
	max-width: 1100px;
	margin: 0 auto;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20px;
}
@media (max-width: 800px) { .subject-grid { grid-template-columns: 1fr; } }
.subject-card {
	display: block;
	background-color: #fff;
	border-radius: 6px;
	overflow: hidden;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
	color: inherit;
	text-decoration: none;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.subject-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14);
}
.subject-card .subject-line {
	color: #fff;
	font-weight: bold;
	padding: 8px 16px;
}
.subject-card img { width: 100%; display: block; }
.subject-card .subject-text { padding: 14px 18px; font-size: 15px; }

/* ---------- 11. SECTION SUBMENU BAR ----------------------------------
   Reusable submenu for section pages, replicating the original
   GESE / Drama look: plain centred text links separated by pipes,
   dark text at body size, active item bold in the theme colour,
   sitting on the white content column just under the hero.
   One include per section, e.g. templateresources/submenu-music.php.
--------------------------------------------------------------------- */
.page-submenu {
	font-family: 'Sarabun', Arial, Helvetica, sans-serif;
	background-color: #fff;
	text-align: center;
	padding: 22px 10px 26px;
}
.page-submenu a {
	display: inline-block;
	color: var(--c-text);
	text-decoration: none;
	padding: 0 10px;
	white-space: nowrap;
}
.page-submenu a.active {
	color: var(--c-primary);
	font-weight: bold;
}
.page-submenu .smb-sep { color: var(--c-text); }
.page-submenu .smb-section {
	color: var(--c-primary);
	font-weight: bold;
	text-decoration: none;
	padding: 0 6px;
	white-space: nowrap;
}
.page-submenu .smb-sep-section {
	font-weight: bold;
	opacity: 0.55;
	padding: 0 4px;
}
@media (max-width: 640px) {
	/* label wraps onto its own line above the items on small screens */
	.page-submenu .smb-section { display: block; margin-bottom: 4px; }
	.page-submenu .smb-sep-section { display: none; }
}

/* ---------- 12. ROCK AND POP DARK OVERRIDES --------------------------
   The rockpop theme is dark end to end. Shared components below are
   defined with light backgrounds (some duplicated in page style
   blocks); these body.theme-rockpop rules win on specificity, so the
   pages themselves stay identical to the other sections.
--------------------------------------------------------------------- */
body.theme-rockpop .page-content { background-color: #1b1b1b; }
body.theme-rockpop .page-title,
body.theme-rockpop .page-h2,
body.theme-rockpop .page-h3,
body.theme-rockpop .text-link,
body.theme-rockpop .doc-links a,
body.theme-rockpop .quicklinks-head { color: var(--c-accent); }
body.theme-rockpop .page-h2 { border-bottom-color: var(--c-accent); }
body.theme-rockpop .doc-links a:hover { color: #f0f0f0; }
body.theme-rockpop .page-button,
body.theme-rockpop .consult-button {
	background-color: var(--c-accent);
}
body.theme-rockpop .page-button:hover,
body.theme-rockpop .consult-button:hover { background-color: #b34f0c; }
/* ghost (outline) buttons must keep their transparent background;
   this outranks both the rule above and the page-scoped .ghost rule */
body.theme-rockpop .page-button.ghost {
	background-color: transparent;
	color: var(--c-accent);
	border: 1px solid var(--c-accent);
}
body.theme-rockpop .page-button.ghost:hover {
	background-color: rgba(219, 100, 20, 0.15);
}

/* submenu bar: dark strip, light links, accent label + active item */
body.theme-rockpop .page-submenu { background-color: #111; }
body.theme-rockpop .page-submenu a { color: var(--c-text); }
body.theme-rockpop .page-submenu a.active,
body.theme-rockpop .page-submenu .smb-section { color: var(--c-accent); }
body.theme-rockpop .page-submenu .smb-sep { color: var(--c-text); opacity: 0.5; }

/* cards and boxes: dark surfaces */
body.theme-rockpop .mark-card,
body.theme-rockpop .syl-card,
body.theme-rockpop .doc-item,
body.theme-rockpop .reg-closed { background-color: #242424; }
body.theme-rockpop .mark-detail,
body.theme-rockpop .syl-notes { color: #aaa; }
body.theme-rockpop .jump-nav a {
	border-color: #444;
	color: var(--c-text);
}
body.theme-rockpop .jump-nav a:hover { background-color: #242424; }
body.theme-rockpop .syl-subject { color: var(--c-accent); }
body.theme-rockpop .reg-card {
	background-color: #242424;
	border-color: #444;
	color: var(--c-text);
}
body.theme-rockpop .reg-card.is-active { border-color: var(--c-accent); }
body.theme-rockpop .reg-card.is-active .reg-card-type,
body.theme-rockpop .reg-card-levels { color: var(--c-accent); }
body.theme-rockpop .reg-card-desc { color: #aaa; }

/* ---------- 13. STAGE TABS (GESE exam levels) ------------------------
   Second-tier nav inside a section, e.g. the four GESE stage pages.
   Include templateresources/submenu-gese-levels.php inside the page
   content, above the page title.
--------------------------------------------------------------------- */
.stage-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 22px;
}
.stage-tabs a {
	display: inline-block;
	font-size: 14px;
	border: 1px solid var(--c-primary);
	color: var(--c-primary);
	text-decoration: none;
	padding: 5px 14px;
	border-radius: 16px;
}
.stage-tabs a:hover { background-color: rgba(0, 0, 0, 0.05); }
.stage-tabs a.active {
	background-color: var(--c-primary);
	color: #fff;
	font-weight: bold;
}
