/* Responsive and accessibility layer for the public pages: phones from 320px, iPad
   portrait and landscape, laptops. Loaded last in include/head.php so it wins over
   style.css / templete.css by order, not !important. Breakpoints are the theme's own
   Bootstrap 4 ones (576 / 768 / 992) plus the 1400px header breakpoint of templete.css. */

:root {
	--ntc-gutter: clamp(15px, 4vw, 30px);
	--ntc-tap: 44px;
	--ntc-focus: var(--color-primary, #ed3624);
	--ntc-cta: #b85a00;        /* white text 4.67:1 (the old #e67d15 was 2.87:1) */
	--ntc-cta-hover: #9a4a00;  /* 6.26:1 */
	/* Thai has marks above and below the line: headings need more than the usual 1.1–1.2 */
	--ntc-h-lh: 1.35;
	--ntc-h-section: clamp(26px, 1.6vw + 20px, 38px);
	--ntc-h-page: clamp(26px, 2vw + 18px, 41px);
	--ntc-h-display: clamp(28px, 2.4vw + 20px, 50px);
}

/* ── Base ─────────────────────────────────────────────────────────────────── */

/* style.css removes the outline from links, buttons and selects, and templete.css from
   every [type=button] (0,2,0); give keyboard users a ring back. */
a:focus-visible,
button:focus-visible,
[type="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
	outline: 3px solid var(--ntc-focus);
	outline-offset: 2px;
}
/* !important: style.css sets `.bootstrap-select .dropdown-toggle:focus { outline: 0 !important }` */
.bootstrap-select .dropdown-toggle:focus-visible {
	outline: 3px solid var(--ntc-focus) !important;
	outline-offset: 2px;
}

h1, h2, h3, h4, h5, h6 {
	overflow-wrap: break-word;
}

.ntc-gutter-x {
	padding-left: var(--ntc-gutter);
	padding-right: var(--ntc-gutter);
}

/* ── Headings ─────────────────────────────────────────────────────────────── */

.ntc-h-section,
.ntc-h-page,
.ntc-h-display {
	line-height: var(--ntc-h-lh);
}
.ntc-h-section { font-size: var(--ntc-h-section); }
.ntc-h-page { font-size: var(--ntc-h-page); }
.ntc-h-display { font-size: var(--ntc-h-display); }

/* Grey band title: was a <button> that did nothing; same look, 24px from tablets up */
.ntc-band {
	margin: 0;
	padding: 15px;
	border-radius: .25rem;
	background: #c9c9c9;
	color: #000;
	font-size: clamp(20px, 1vw + 16px, 24px);
	font-weight: 500;
	line-height: 1.5;
	text-align: center;
}

/* ── Header ───────────────────────────────────────────────────────────────── */

/* A real <button> now, so style.css's `.dlab-quik-search span` no longer places it.
   right:3px keeps the icon centre where the old 20px span had it. */
.dlab-quik-search #quik-search-remove {
	position: absolute;
	top: 50%;
	right: 3px;
	transform: translateY(-50%);
	display: grid;
	place-items: center;
	width: var(--ntc-tap);
	height: var(--ntc-tap);
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font-size: 20px;
	cursor: pointer;
}

/* iPad landscape and small laptops: keep the menu on one line */
@media (min-width: 992px) and (max-width: 1400px) {
	.header-langschool .container-fluid {
		padding-left: 15px;
		padding-right: 15px;
	}
	.navstyle1 .header-nav .nav > li > a {
		padding: 12px 8px;
		font-size: 14px;
	}
}

@media (min-width: 992px) {
	/* "About us" is the last menu: open its panel leftwards so it stays on screen */
	.header-nav .nav > li > .sub-menu.left {
		left: auto;
		right: 0;
	}
	/* Keyboard: open submenus while focus is inside, mirroring the :hover rules in style.css */
	.header-nav .nav > li:focus-within > .sub-menu {
		opacity: 1;
		visibility: visible;
		margin-top: 0;
	}
	.header-nav .nav > li .sub-menu li:focus-within > .sub-menu {
		left: 220px;
		margin: 0;
		opacity: 1;
		top: -1px;
		visibility: visible;
	}
	.header-nav .nav > li .sub-menu li:focus-within > .sub-menu.left {
		left: auto;
		right: 220px;
	}
	/* Items sit edge to edge in the white panel: draw the ring inside */
	.header-nav .sub-menu a:focus-visible {
		outline-offset: -3px;
	}
}

/* ── Schedule (schedule.php, include/schedule-*.php) ──────────────────────── */

/* The table keeps its columns and scrolls inside this box; the shadows at the
   edges show there is more to the side (covers scroll with the content, shadows stay). */
.ntc-table-scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior-x: contain;
	background:
		linear-gradient(to right, #fff 30%, rgba(255, 255, 255, 0)) left / 40px 100% no-repeat local,
		linear-gradient(to left, #fff 30%, rgba(255, 255, 255, 0)) right / 40px 100% no-repeat local,
		radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, .18), rgba(0, 0, 0, 0)) left / 14px 100% no-repeat scroll,
		radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, .18), rgba(0, 0, 0, 0)) right / 14px 100% no-repeat scroll;
	background-color: #fff;
}
.ntc-table-scroll > .table {
	min-width: 760px;
	margin-bottom: 0;
	font-variant-numeric: tabular-nums;
}
.ntc-table-scroll th,
.ntc-table-scroll td {
	white-space: nowrap;
}
.ntc-table-scroll tbody th,
.ntc-table-scroll tbody td:first-child {
	white-space: normal;
}
.ntc-table-scroll tbody td:first-child {
	min-width: 200px;
}

.ntc-schedule-filter {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
}
.ntc-schedule-filter .form-group {
	margin: 0;
}
.ntc-schedule-filter .form-group:first-child {
	flex: 1 1 260px;
	min-width: 0;
}
.ntc-schedule-filter .bootstrap-select,
.ntc-schedule-filter .form-control {
	width: 100%;
}
/* the theme greys the chosen value #999 (2.85:1); use the body text colour (5.0:1) */
.ntc-schedule-filter .dropdown-toggle {
	color: #6f6f6f;
}
.ntc-schedule-filter .dropdown-menu {
	max-width: calc(100vw - 2 * var(--ntc-gutter));
}
.ntc-schedule-filter .dropdown-menu .text {
	white-space: normal;
}

@media (max-width: 991.98px) {
	.ntc-schedule-download {
		margin-top: 12px;
	}
}

@media (max-width: 575.98px) {
	.ntc-schedule-panel.service-box.style7 {
		padding: var(--ntc-gutter);
	}
	.ntc-schedule-filter .form-group {
		flex: 1 1 100%;
	}
	.ntc-schedule-download {
		display: flex;
		justify-content: center;
		width: 100%;
	}
}

/* ── Page-level overflow fixes ────────────────────────────────────────────── */

/* testcenter.php / detail_testcenter.php put #masonry.row straight inside a .row; once the
   container is full width the doubled -15px margin makes the page 15px wider than the phone */
@media (max-width: 575.98px) {
	.row > #masonry.row {
		margin-left: 0;
		margin-right: 0;
	}
}

/* Carousel arrows sit 70px outside the slider (style.css, !important); the theme pulls them in
   below 1200px, but up to 1310px they still cross the screen edge. !important to beat that rule. */
@media (max-width: 1309.98px) {
	.owl-btn-2 .owl-prev,
	.owl-btn-2 .owl-next,
	.owl-btn-3 .owl-prev,
	.owl-btn-3 .owl-next {
		margin: 0 10px !important;
	}
}

/* ── Home hero heading (index.php) ────────────────────────────────────────── */

/* LangPhrases() wraps each space-separated phrase of the CMS text. As an inline-block it moves
   to the next line whole instead of being split by the Thai dictionary ("เริ่ม|ต้น"); a phrase
   wider than the column on its own still wraps inside, so nothing overflows. */
.ntc-phrase {
	display: inline-block;
}
/* Portrait iPad: the heading column is ~330px; at the theme's 50px the phrase
   "การเรียนรู้ที่ยั่งยืน" is ~370px and would wrap inside */
@media (min-width: 768px) and (max-width: 991.98px) {
	.banner-langschool .banner-content h1 {
		font-size: 42px;
	}
}

/* ── Pictures in CMS content (blogs, news, about, catalog, course detail) ─── */

/* The CMS editor saves each picture with an inline width and height, e.g. 900 × 675.
   max-width narrows it to the column but the height stayed, so a blog picture drew 2.6×
   too tall on a phone. Let the height follow the width; !important to beat the inline style. */
.text-content img,
.textul img {
	max-width: 100%;
	height: auto !important;
}

/* ── Call-to-action buttons (Test Center downloads) ──────────────────────── */

.ntc-cta-group {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 16px;
	margin: 16px 0;
}
/* Stacked, one per row, on phones and portrait iPad: side by side there, each label breaks
   onto three lines. Paired from 992px. Colour is set for every state because style.css
   colours links #EFBB20 / #333 on hover. */
.ntc-cta-btn {
	display: inline-flex;
	flex: 1 1 100%;
	max-width: 480px;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: var(--ntc-tap);
	padding: 12px 20px;
	border: 0;
	border-radius: .25rem;
	background: var(--ntc-cta);
	color: #fff;
	font-size: clamp(16px, 1.2vw + 12px, 22px);
	font-weight: 500;
	line-height: 1.3;
	text-align: center;
	text-decoration: none;
	white-space: normal;
	transition: background-color .15s ease, transform .1s ease;
}
.ntc-cta-btn:hover,
.ntc-cta-btn:focus,
.ntc-cta-btn:active {
	color: #fff;
	text-decoration: none;
}
.ntc-cta-btn:hover {
	background: var(--ntc-cta-hover);
}
.ntc-cta-btn:active {
	transform: translateY(1px);
}
@media (min-width: 992px) {
	.ntc-cta-btn {
		flex-basis: 0;
	}
}

/* ── Registration (register.php) ─────────────────────────────────────────── */

/* was a fixed 50px, which squeezed the course summary to ~200px on a 320px phone; desktop
   keeps 50px. An error message with a long unbroken URL wraps instead of widening the page. */
.ntc-register-body {
	padding: clamp(15px, 5vw, 50px);
	overflow-wrap: anywhere;
}

/* ── Reduced motion ───────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
	/* !important: has to beat the inline animation styles wow.js and plugins write */
	*,
	*::before,
	*::after {
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .01ms !important;
		scroll-behavior: auto !important;
	}
	/* wow.js hides boxes until they scroll into view; show them without the reveal */
	.wow {
		visibility: visible !important;
		animation-name: none !important;
	}
}
