/* SIS Home — cookie consent bar, settings dialog, chat button (every page)
   and the cookie policy page. */

.sisc,
.sisc-policy {
	--sisc-primary: var(--sisn-primary, #0b5354);
	--sisc-dark: var(--sisn-primary-dark, #073334);
	--sisc-accent: var(--sisn-accent, #e3a033);
	--sisc-on-accent: #2b1d00;
	--sisc-display: "Bai Jamjuree", system-ui, sans-serif;
	--sisc-body: "IBM Plex Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
	font-family: var(--sisc-body);
}
.sisc *,
.sisc-policy * { box-sizing: border-box; }
.sisc [hidden] { display: none !important; }
/* The theme sets p { line-height: 1.15em !important } and big font sizes on p, a, li. */
body .sisc p,
body .sisc a,
body .sisc button,
body .sisc-policy p,
body .sisc-policy a,
body .sisc-policy li,
body .sisc-policy td,
body .sisc-policy th { font-size: inherit; line-height: inherit !important; letter-spacing: normal; margin: 0; }
.sisc button { font-family: inherit; }

/* Bar */
.sisc-bar {
	position: fixed;
	left: 24px;
	bottom: 24px;
	z-index: 99990;
	width: min(620px, calc(100vw - 48px));
	display: flex;
	flex-direction: column;
	gap: 14px;
	padding: 20px 22px;
	border-radius: 18px;
	background: var(--sisc-dark);
	color: #fff;
	font-size: 14px;
	line-height: 1.65;
	box-shadow: 0 16px 40px rgba(0, 0, 0, .28);
	animation: siscIn .4s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes siscIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.sisc-bar__text { display: flex; gap: 14px; align-items: flex-start; }
.sisc-bar__ic { color: var(--sisc-accent); flex: none; margin-top: 2px; }
.sisc .sisc-bar__title { font-family: var(--sisc-display); font-weight: 700; font-size: 17px; margin-bottom: 4px; }
.sisc .sisc-bar__desc { color: #d6e6e5; }
.sisc .sisc-bar__desc a { color: #f2c879; font-weight: 600; text-decoration: underline; }
.sisc-bar__actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.sisc .sisc-btn {
	min-height: 44px;
	padding: 0 18px;
	border-radius: 10px;
	font-family: var(--sisc-display);
	font-weight: 700;
	font-size: 15px;
	line-height: 1.4;
	cursor: pointer;
	border: 1px solid transparent;
}
.sisc .sisc-btn--accent { background: var(--sisc-accent); color: var(--sisc-on-accent); }
.sisc .sisc-btn--line { background: transparent; border-color: rgba(255, 255, 255, .5); color: #fff; }
.sisc .sisc-btn--line:hover { background: rgba(255, 255, 255, .12); }
.sisc .sisc-btn--dark { background: var(--sisc-primary); color: #fff; }
.sisc .sisc-btn--line-dark { background: #fff; border-color: #c8d8d5; color: var(--sisc-dark); }
.sisc .sisc-link {
	min-height: 44px;
	padding: 0 12px;
	border: 0;
	background: none;
	color: #fff;
	font-family: var(--sisc-display);
	font-weight: 600;
	font-size: 15px;
	text-decoration: underline;
	text-underline-offset: 4px;
	cursor: pointer;
}

/* Dialog */
.sisc-dialog {
	width: min(560px, calc(100vw - 32px));
	padding: 0;
	border: 0;
	border-radius: 20px;
	color: #141414;
	box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
}
.sisc-dialog::backdrop { background: rgba(7, 51, 52, .55); }
.sisc-dialog__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px; border-bottom: 1px solid #e3e8e8; }
.sisc-dialog__head h2 {
	margin: 0;
	font-family: var(--sisc-display) !important;
	font-weight: 700 !important;
	font-size: 22px;
	line-height: 1.35 !important;
	color: var(--sisc-dark);
}
.sisc .sisc-x {
	width: 40px;
	height: 40px;
	border-radius: 10px;
	border: 1px solid #dde6e4;
	background: #fff;
	color: var(--sisc-dark);
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}
.sisc-dialog__body { padding: 4px 24px; font-size: 14px; line-height: 1.6; }
.sisc-cat { display: flex; gap: 16px; align-items: flex-start; padding: 16px 0; border-bottom: 1px solid #eef1f1; }
.sisc-cat > div { flex: 1; }
.sisc .sisc-cat__name { font-family: var(--sisc-display); font-weight: 700; font-size: 16px; color: var(--sisc-dark); }
.sisc .sisc-cat__desc { font-size: 13px; color: #5b6b6b; }
.sisc-always { flex: none; font-size: 12px; font-weight: 700; color: var(--sisc-primary); padding-top: 4px; }
.sisc .sisc-dialog__policy { padding: 12px 0; }
.sisc .sisc-dialog__policy a { color: var(--sisc-primary); font-weight: 600; }
.sisc-dialog__foot { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; padding: 16px 24px 20px; }

.sisc-switch { position: relative; flex: none; display: inline-block; width: 44px; height: 24px; cursor: pointer; }
.sisc-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.sisc-switch span { position: absolute; inset: 0; border-radius: 999px; background: #c3cfcd; transition: background .2s; pointer-events: none; }
.sisc-switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .2s; }
.sisc-switch input:checked + span { background: var(--sisc-primary); }
.sisc-switch input:checked + span::after { left: 23px; }
.sisc-switch input:focus-visible + span { box-shadow: 0 0 0 3px var(--sisc-accent); }

/* Reopen + chat */
.sisc .sisc-reopen {
	position: fixed;
	left: 24px;
	bottom: 24px;
	z-index: 99980;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	border: 1px solid #dde6e4;
	background: #fff;
	color: var(--sisc-primary);
	display: grid;
	place-items: center;
	cursor: pointer;
	box-shadow: 0 8px 20px rgba(7, 51, 52, .18);
}
.sisc .sisc-chat {
	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 99980;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 56px;
	padding: 0 20px 0 7px;
	border-radius: 999px;
	background: var(--sisc-primary);
	color: #fff;
	font-family: var(--sisc-display);
	font-weight: 700;
	font-size: 15px;
	text-decoration: none;
	box-shadow: 0 12px 30px rgba(7, 51, 52, .35);
	transition: transform .2s;
}
.sisc .sisc-chat:hover { transform: translateY(-2px); color: #fff; }
.sisc-chat__ic { width: 42px; height: 42px; border-radius: 50%; background: #fff; color: var(--sisc-primary); display: grid; place-items: center; }
html.sisc-open .sisc-chat { display: none; }
/* SIS Navigation's back-to-top button sits above the chat button. */
body:has(.sisc-chat) { --sisn-totop-bottom: 92px; }
/* Keep the footer's last row out from under the corner buttons (cookie
   settings on the left, chat on the right), measured from the screen edge. */
body:has(.sisc-chat) .sisn-foot .sisn-foot__bottom-in {
	padding-left: max(32px, calc(84px - max(0px, (100vw - var(--sisn-max, 1280px)) / 2)));
	padding-right: max(32px, calc(196px - max(0px, (100vw - var(--sisn-max, 1280px)) / 2)));
}
html.sisc-open .sisn-totop { display: none; }

.sisc a:focus-visible,
.sisc button:focus-visible { outline: 3px solid var(--sisc-accent); outline-offset: 3px; }

@media (max-width: 600px) {
	.sisc-bar { left: 12px; right: 12px; bottom: 12px; width: auto; }
	.sisc-bar__actions .sisc-btn { flex: 1; }
	.sisc .sisc-chat { right: 12px; bottom: 12px; padding: 0 7px; }
	.sisc-chat__label { display: none; }
	.sisc .sisc-reopen { left: 12px; bottom: 16px; }
	body:has(.sisc-chat) { --sisn-totop-bottom: 80px; }
	body:has(.sisc-chat) .sisn-foot .sisn-foot__bottom-in { padding-left: 70px; padding-right: 78px; }
}

/* Policy page -------------------------------------------------------------- */

.sisc-policy {
	max-width: 1200px;
	margin: 0 auto;
	padding: 40px 24px 72px;
	color: #2b3a3a;
	font-size: 16px;
	line-height: 1.85;
}
.sisc-policy__head {
	position: relative;
	overflow: hidden;
	margin-bottom: 40px;
	padding: 40px;
	border-radius: 24px;
	background: var(--sisc-dark);
	color: #fff;
}
.sisc-policy__head h1 {
	margin: 0 0 12px;
	font-family: var(--sisc-display) !important;
	font-weight: 700 !important;
	font-size: clamp(2rem, 4vw, 3rem);
	/* The theme forces h1/h2 to line-height:1em !important; Thai needs room. */
	line-height: 1.3 !important;
	color: #fff;
}
.sisc-policy .sisc-policy__lead { color: #d6e6e5; font-size: 17px; max-width: 720px; }
.sisc-policy__meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 18px; }
.sisc-policy__date { font-size: 13px; padding: 4px 12px; border-radius: 999px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .2); }
.sisc-policy__btn {
	min-height: 44px;
	padding: 0 18px;
	border: 0;
	border-radius: 10px;
	background: var(--sisc-accent);
	color: var(--sisc-on-accent);
	font-family: var(--sisc-display);
	font-weight: 700;
	font-size: 15px;
	line-height: 1.4;
	cursor: pointer;
}
.sisc-policy__layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 48px; align-items: start; }
.sisc-policy__toc { position: sticky; top: 120px; display: flex; flex-direction: column; }
.sisc-policy__toc p { font-family: var(--sisc-display); font-weight: 700; font-size: 13px; letter-spacing: .1em; color: #c0841f; padding: 0 12px 8px; }
.sisc-policy .sisc-policy__toc a { padding: 8px 12px; border-radius: 8px; color: #3a4a4a; font-size: 14px; line-height: 1.5 !important; text-decoration: none; }
.sisc-policy .sisc-policy__toc a:hover { background: #eef4f3; color: var(--sisc-dark); }
.sisc-policy .sisc-policy__toc a { border-left: 3px solid transparent; border-radius: 0 8px 8px 0; transition: background .2s, color .2s, border-color .2s; }
.sisc-policy .sisc-policy__toc a.is-active { background: #eef4f3; color: var(--sisc-dark); border-left-color: var(--sisc-primary); font-weight: 600; }
/* The theme sets overflow:hidden on the main area, which stops the list from
   staying in view; clip cuts overflow the same way without breaking sticky. */
#wrapper [role="main"]:has(.sisc-policy) { overflow: clip; }
.sisc-policy section { padding: 32px 0; border-top: 1px solid #e3e8e8; scroll-margin-top: 120px; }
.sisc-policy section:first-child { border-top: 0; padding-top: 0; }
.sisc-policy h2 {
	margin: 0 0 12px;
	font-family: var(--sisc-display) !important;
	font-weight: 700 !important;
	font-size: 24px;
	line-height: 1.4 !important;
	color: var(--sisc-dark);
}
.sisc-policy section > p { margin-bottom: 12px; }
.sisc-policy__table { overflow-x: auto; border: 1px solid #e3e8e8; border-radius: 14px; margin-top: 8px; }
.sisc-policy table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 0; }
.sisc-policy th { text-align: left; font-weight: 700; color: var(--sisc-dark); background: #eef4f3; padding: 12px 14px; border: 0; }
.sisc-policy td { padding: 12px 14px; border: 0; border-bottom: 1px solid #e3e8e8; vertical-align: top; line-height: 1.6; }
.sisc-policy code { font-size: 13px; color: var(--sisc-dark); background: none; padding: 0; }
.sisc-tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; white-space: nowrap; background: #e6efee; color: var(--sisc-dark); }
.sisc-tag.is-analytics { background: #fdf3e1; color: #7a4f00; }
.sisc-tag.is-other { background: #eef0f6; color: #2f3a66; }
.sisc-policy__box { padding: 20px 22px; border-radius: 16px; background: #eef4f3; margin-top: 8px; }

@media (max-width: 900px) {
	.sisc-policy__layout { grid-template-columns: minmax(0, 1fr); }
	.sisc-policy__toc { position: static; }
	.sisc-policy__head { padding: 28px 22px; }
}
