/* =====================================================================
   Teachers / Staff directory pages: animated title band, responsive
   directory (table on wide screens, record cards on narrow ones).
   One table in the markup; card mode is CSS only, so there is no
   duplicated content and no duplicate IDs. Explicit ARIA table roles
   keep the semantics when the cells are restyled as cards.
   ===================================================================== */

.cgs-dirpage {
	--dk: 1;                       /* extra scale for wall TVs / 4K */
	--dir-wrap: 1240px;
	--d-fs: calc(1.0625rem * var(--ts) * var(--dk));
	--d-fs-sm: calc(.9375rem * var(--ts) * var(--dk));
	--d-fs-xs: calc(.8125rem * var(--ts) * var(--dk));
	--d-fs-name: calc(1.125rem * var(--ts) * var(--dk));
	--d-fs-h2: calc(clamp(1.375rem, 1.1rem + .9vw, 1.75rem) * var(--ts) * var(--dk));
	--d-fs-title: calc(clamp(1.875rem, 1.3rem + 2vw, 3rem) * var(--ts) * var(--dk));
	--d-fs-intro: calc(clamp(1.0625rem, .98rem + .35vw, 1.25rem) * var(--ts) * var(--dk));
}
@media (min-width: 2400px) {
	.cgs-dirpage { --dk: 1.14; --dir-wrap: 1440px; }
}
.cgs-dirwrap {
	width: 100%;
	max-width: var(--dir-wrap);
	margin-inline: auto;
	padding-inline: var(--gutter);
}

/* ---------- title band ---------- */
.cgs-dirhero {
	position: relative; isolation: isolate; overflow: hidden;
	color: #fff;
	background:
		radial-gradient(ellipse 60% 90% at 78% 45%, rgba(128, 214, 168, .2), transparent 70%),
		radial-gradient(ellipse 50% 70% at 0 100%, rgba(201, 162, 74, .12), transparent 70%),
		linear-gradient(118deg, #072d19 0%, #0a3f24 46%, #0d5631 100%);
}
.cgs-dirhero::after {
	content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; z-index: 1;
	background: linear-gradient(90deg, var(--gold), var(--gold-2) 40%, rgba(230, 197, 111, 0));
}
.cgs-dirhero__in {
	display: grid;
	grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
	grid-template-areas: "text art" "ctrl art";
	grid-template-rows: auto auto;
	align-content: center;
	column-gap: clamp(20px, 4vw, 64px);
	min-height: calc(clamp(240px, 21vw, 320px) * var(--dk));
	padding-block: clamp(22px, 2.4vw, 34px) clamp(24px, 2.6vw, 36px);
}
.cgs-dirhero__text { grid-area: text; align-self: end; min-width: 0; }
.cgs-dirhero__kicker {
	margin: 0 0 10px;
	font-size: var(--d-fs-xs); font-weight: 700; letter-spacing: .03em; line-height: 1.5;
	color: var(--gold-2);
}
.cgs-dirhero__title {
	margin: 0; padding-left: 18px; border-left: 5px solid var(--gold);
	font-family: var(--font-display); font-size: var(--d-fs-title); font-weight: 700; line-height: 1.35;
	color: #fff;
}
.cgs-dirhero__intro {
	margin: 14px 0 0; padding-left: 23px; max-width: 30em;
	font-size: var(--d-fs-intro); line-height: 1.75; color: rgba(255, 255, 255, .9);
}
.cgs-dirhero__art {
	grid-area: art; align-self: center; justify-self: end;
	width: 100%; max-width: calc(380px * var(--dk));
	aspect-ratio: 3 / 2;               /* reserves space: no layout shift */
	pointer-events: none;
}
.cgs-dirart { display: block; width: 100%; height: 100%; overflow: visible; }

/* pause / resume (visible label; the label itself carries the state) */
.cgs-dirhero__ctrl {
	grid-area: ctrl; align-self: start; justify-self: start;
	margin: 18px 0 0 23px;
	appearance: none; cursor: pointer;
	display: inline-flex; align-items: center; gap: 8px;
	min-height: 36px; padding: 5px 14px 5px 10px; border-radius: 999px;
	border: 1px solid rgba(255, 255, 255, .36); background: rgba(7, 45, 25, .4); color: #fff;
	font: inherit; font-size: var(--d-fs-xs); font-weight: 600; line-height: 1.4;
	transition: background-color .2s, border-color .2s;
}
.cgs-dirhero__ctrl:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .6); }
.cgs-dirhero__ctrl .cgs-ico { width: 13px; height: 13px; }
.cgs-dirhero__ctrl .is-stop,
.cgs-dirhero.is-paused .cgs-dirhero__ctrl .is-run { display: none; }
.cgs-dirhero.is-paused .cgs-dirhero__ctrl .is-stop { display: inline-flex; }
.cgs-dirhero__ctrl .is-run,
.cgs-dirhero__ctrl .is-stop { align-items: center; gap: 8px; }
.cgs-dirhero__ctrl .is-run { display: inline-flex; }

/* ---------- artwork motion (transform / opacity; stroke offset for two thin lines) ---------- */
.cgs-dirhero .da-anim {
	animation-timing-function: ease-in-out;
	animation-iteration-count: infinite;
	transform-box: view-box;
}
/* Teachers — knowledge in motion */
.da-t-float  { animation: da-float 6s infinite ease-in-out; }
.da-t-shadow { animation: da-shadow 6s infinite ease-in-out; transform-origin: 252px 290px; }
.da-t-page   { animation: da-page 8s infinite ease-in-out; transform-origin: 252px 256px; }
.da-t-pen    { animation: da-pen 7s infinite ease-in-out; transform-origin: 392px 276px; }
.da-t-trail  { opacity: 0; stroke-dashoffset: 28; animation: da-trail 7s infinite ease-in-out; }
@keyframes da-float  { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes da-shadow { 0%, 100% { transform: scaleX(1); opacity: 1; } 50% { transform: scaleX(.93); opacity: .72; } }
@keyframes da-page   { 0%, 12% { transform: rotate(0); } 46%, 58% { transform: rotate(-7deg); } 90%, 100% { transform: rotate(0); } }
@keyframes da-pen    { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-4deg); } }
@keyframes da-trail  {
	0% { stroke-dashoffset: 28; opacity: 0; }
	10% { opacity: .9; }
	78% { opacity: .9; }
	88%, 100% { stroke-dashoffset: -372; opacity: 0; }
}
/* Staff — coordinated daily support */
.da-s-clip   { animation: da-float 6s infinite ease-in-out; }
.da-s-shadow { animation: da-shadow 6s infinite ease-in-out; transform-origin: 246px 296px; }
.da-s-folder { animation: da-float-sm 6s -1.5s infinite ease-in-out; }
.da-s-shield { animation: da-float-sm 6s -3s infinite ease-in-out; }
.da-s-tool   { animation: da-float-sm 6s -4.5s infinite ease-in-out; }
.da-s-check  { stroke-dashoffset: 0; animation: da-check 9s infinite ease-in-out; }
@keyframes da-float-sm { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes da-check {
	0% { stroke-dashoffset: 100; opacity: 1; }
	22%, 84% { stroke-dashoffset: 0; opacity: 1; }
	94% { stroke-dashoffset: 0; opacity: 0; }
	100% { stroke-dashoffset: 100; opacity: 0; }
}
/* Contact — reach us (map, route, pin, phone, envelope) */
.da-c-map       { animation: da-float-sm 7s infinite ease-in-out; }
.da-c-shadow    { animation: da-shadow 7s infinite ease-in-out; transform-origin: 236px 292px; }
.da-c-pin       { animation: da-float 5s infinite ease-in-out; }
.da-c-pinshadow { animation: da-shadow 5s infinite ease-in-out; transform-origin: 284px 152px; }
.da-c-phone     { animation: da-float-sm 6s -2s infinite ease-in-out; }
.da-c-mail      { animation: da-float-sm 6s -4s infinite ease-in-out; }
.da-c-route     { opacity: 0; stroke-dashoffset: 26; animation: da-route 6s infinite ease-in-out; }
@keyframes da-route {
	0% { stroke-dashoffset: 26; opacity: 0; }
	12%, 76% { opacity: .95; }
	88%, 100% { stroke-dashoffset: -174; opacity: 0; }
}
/* Compact band (contact page) */
.cgs-dirhero--compact .cgs-dirhero__in { min-height: calc(clamp(210px, 17vw, 260px) * var(--dk)); }
.cgs-dirhero--compact .cgs-dirhero__art { max-width: calc(320px * var(--dk)); }

/* Paused by the visitor: back to the complete still picture.
   Offscreen: frozen where it is (nobody sees it). */
.cgs-dirhero.is-paused .da-anim { animation: none; }
.cgs-dirhero.is-offscreen .da-anim { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
	.cgs-dirhero .da-anim { animation: none !important; }
	.cgs-dirhero__ctrl { display: none !important; }
}

/* ---------- breadcrumb width matches the page ---------- */
.cgs-dirpage .cgs-crumbs ol { font-size: var(--d-fs-sm); }

/* ---------- page body ---------- */
.cgs-dirbody {
	background:
		radial-gradient(ellipse 60% 40% at 100% 0, rgba(201, 162, 74, .07), transparent 70%),
		linear-gradient(180deg, #f3f8f4 0, var(--paper) 420px);
	padding-block: clamp(28px, 4.4vw, 60px) clamp(36px, 5vw, 72px);
}
.cgs-dir__lead {
	margin: 0 0 clamp(26px, 3.4vw, 40px); max-width: 52em;
	padding-left: 18px; border-left: 3px solid var(--emerald-500);
	font-size: var(--d-fs); line-height: 1.95; color: var(--ink-2);
}
.cgs-dir__h {
	position: relative; margin: 0 0 18px; padding-bottom: 10px;
	font-family: var(--font-display); font-size: var(--d-fs-h2); line-height: 1.45; color: var(--emerald-900);
}
.cgs-dir__h::after {
	content: ""; position: absolute; left: 0; bottom: 0; width: 56px; height: 3px; border-radius: 3px;
	background: linear-gradient(90deg, var(--gold), var(--gold-2));
}

.cgs-dir__panel {
	container: cgsdir / inline-size;
	font-size: var(--d-fs);
	background: #fff;
	border: 1px solid var(--line);
	border-radius: 18px;
	box-shadow: 0 1px 2px rgba(10, 63, 36, .05), 0 18px 40px -30px rgba(10, 63, 36, .4);
}
.cgs-dir__table {
	width: 100%;
	border-collapse: separate; border-spacing: 0;
	font-size: 1em; line-height: 1.65; color: var(--ink);
}
.cgs-dir__table th,
.cgs-dir__table td {
	padding: .95em 1.25em;
	text-align: left; vertical-align: middle;
	overflow-wrap: break-word;
}
.cgs-dir__table thead th {
	background: var(--emerald-800); color: #fff;
	font-size: var(--d-fs-sm); font-weight: 700; line-height: 1.5;
	padding-block: .9em;
}
.cgs-dir__table thead th:first-child { border-top-left-radius: 17px; }
.cgs-dir__table thead th:last-child { border-top-right-radius: 17px; }
.cgs-dir__table tbody > tr > * { border-top: 1px solid rgba(13, 86, 49, .1); }
.cgs-dir__table tbody > tr:first-child > * { border-top: 0; }
.cgs-dir__table tbody > tr:nth-child(even) { background: #f8fbf9; }
.cgs-dir__table tbody > tr:last-child > :first-child { border-bottom-left-radius: 17px; }
.cgs-dir__table tbody > tr:last-child > :last-child { border-bottom-right-radius: 17px; }

.cgs-dir__table .cgs-dir__no {
	width: 1%; white-space: nowrap; text-align: center;
	color: var(--ink-3); font-weight: 600; font-variant-numeric: tabular-nums;
	padding-inline: 1.1em;
}
.cgs-dir__table thead .cgs-dir__no { color: #fff; }
.cgs-dir__table tbody .cgs-dir__name {
	font-size: var(--d-fs-name); font-weight: 700; color: var(--emerald-950); line-height: 1.55;
}
.cgs-dir__badge {
	display: inline-block;
	max-width: 100%; /* long designations wrap inside the cell or card */
	padding: .2em .8em; border-radius: 999px;
	background: var(--emerald-100); color: var(--emerald-800);
	font-size: var(--d-fs-sm); font-weight: 600; line-height: 1.6;
}
.cgs-dir__val { color: var(--ink); }
.cgs-dir__lbl { display: none; }

/* Acting Head Teacher: modest green accent */
.cgs-dir__table tbody > tr.is-lead { background: linear-gradient(90deg, rgba(35, 154, 92, .1), rgba(35, 154, 92, .03) 70%); }
.cgs-dir__table tbody > tr.is-lead > :first-child { box-shadow: inset 4px 0 0 var(--emerald-600); }
.cgs-dir__table tbody > tr.is-lead .cgs-dir__badge { background: var(--emerald-700); color: #fff; }

/* ---------- record cards (narrow containers; em = follows text size) ---------- */
@container cgsdir (max-width: 40em) {
	.cgs-dir__table--teachers,
	.cgs-dir__table--teachers > tbody,
	.cgs-dir__table--teachers > tbody > tr,
	.cgs-dir__table--teachers > tbody > tr > * { display: block; }
	.cgs-dir__table--teachers > thead { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
	.cgs-dir__table--teachers > tbody > tr { display: grid; }
}
@container cgsdir (max-width: 30em) {
	.cgs-dir__table--staff,
	.cgs-dir__table--staff > tbody,
	.cgs-dir__table--staff > tbody > tr,
	.cgs-dir__table--staff > tbody > tr > * { display: block; }
	.cgs-dir__table--staff > thead { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
	.cgs-dir__table--staff > tbody > tr { display: grid; }
}
/* Shared card styling: applies only once a table is in card mode (its rows are grids). */
@container cgsdir (max-width: 40em) {
	.cgs-dir__table--teachers > tbody { display: grid; gap: 12px; padding: 12px; background: #f4f9f5; border-radius: 17px; }
	.cgs-dir__table--teachers > tbody > tr,
	.cgs-dir__table--teachers > tbody > tr:nth-child(even) {
		grid-template-columns: auto minmax(0, 1fr); column-gap: 14px;
		padding: 14px 16px 16px; border-radius: 14px;
		background: #fff; border: 1px solid rgba(13, 86, 49, .14);
		box-shadow: 0 1px 3px rgba(10, 63, 36, .06);
	}
	.cgs-dir__table--teachers > tbody > tr > * { padding: 0; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; }
	.cgs-dir__table--teachers .cgs-dir__no {
		grid-column: 1; grid-row: 1; align-self: start;
		display: grid; place-items: center; width: 2.2em; height: 2.2em; border-radius: 50% !important;
		background: var(--emerald-100); color: var(--emerald-800); font-weight: 700; line-height: 1;
	}
	.cgs-dir__table--teachers .cgs-dir__name { grid-column: 2; grid-row: 1; align-self: center; }
	.cgs-dir__table--teachers .cgs-dir__role,
	.cgs-dir__table--teachers .cgs-dir__subj {
		grid-column: 2; display: grid; justify-items: start; gap: 4px;
	}
	.cgs-dir__table--teachers .cgs-dir__role { margin-top: 10px; padding-top: 10px !important; border-top: 1px solid rgba(13, 86, 49, .1) !important; }
	.cgs-dir__table--teachers .cgs-dir__subj { margin-top: 8px; }
	.cgs-dir__table--teachers .cgs-dir__lbl { display: inline; min-width: 6.5em; font-size: var(--d-fs-xs); font-weight: 600; color: var(--ink-3); }
	.cgs-dir__table--teachers > tbody > tr.is-lead { border-color: rgba(26, 127, 75, .45); box-shadow: inset 4px 0 0 var(--emerald-600), 0 1px 3px rgba(10, 63, 36, .06); }
	.cgs-dir__table--teachers > tbody > tr.is-lead .cgs-dir__no { background: #fff; }
}
@container cgsdir (max-width: 30em) {
	.cgs-dir__table--staff > tbody { display: grid; gap: 12px; padding: 12px; background: #f4f9f5; border-radius: 17px; }
	.cgs-dir__table--staff > tbody > tr,
	.cgs-dir__table--staff > tbody > tr:nth-child(even) {
		grid-template-columns: auto minmax(0, 1fr); column-gap: 14px;
		padding: 14px 16px 16px; border-radius: 14px;
		background: #fff; border: 1px solid rgba(13, 86, 49, .14);
		box-shadow: 0 1px 3px rgba(10, 63, 36, .06);
	}
	.cgs-dir__table--staff > tbody > tr > * { padding: 0; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; }
	.cgs-dir__table--staff .cgs-dir__no {
		grid-column: 1; grid-row: 1; align-self: start;
		display: grid; place-items: center; width: 2.2em; height: 2.2em; border-radius: 50% !important;
		background: var(--emerald-100); color: var(--emerald-800); font-weight: 700; line-height: 1;
	}
	.cgs-dir__table--staff .cgs-dir__name { grid-column: 2; grid-row: 1; align-self: center; }
	.cgs-dir__table--staff .cgs-dir__role {
		grid-column: 2; display: grid; justify-items: start; gap: 4px;
		margin-top: 10px; padding-top: 10px !important; border-top: 1px solid rgba(13, 86, 49, .1) !important;
	}
	.cgs-dir__table--staff .cgs-dir__lbl { display: inline; min-width: 6.5em; font-size: var(--d-fs-xs); font-weight: 600; color: var(--ink-3); }
}

/* ---------- sibling directory links ---------- */
.cgs-dir__more { margin-top: clamp(24px, 3vw, 36px); }
.cgs-dir__more ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.cgs-dir__more a {
	display: inline-flex; align-items: center; gap: 8px;
	min-height: 44px; padding: 8px 18px; border-radius: 999px;
	border: 1px solid var(--line); background: #fff; color: var(--emerald-800);
	font-size: var(--d-fs-sm); font-weight: 600; text-decoration: none;
}
.cgs-dir__more a:hover { border-color: var(--emerald-600); background: var(--emerald-100); }
.cgs-dir__more a[aria-current] { background: var(--emerald-800); border-color: var(--emerald-800); color: #fff; }
.cgs-dir__more .cgs-ico { width: 14px; height: 14px; }

/* ---------- responsive band ---------- */
@media (max-width: 1023.98px) {
	.cgs-dirhero__in { column-gap: 20px; }
	.cgs-dirhero__art { max-width: 300px; }
}
@media (max-width: 699.98px) {
	.cgs-dirhero__in {
		grid-template-columns: minmax(0, 1fr);
		grid-template-areas: "text" "art" "ctrl";
		min-height: 0;
		padding-block: 26px 22px;
	}
	.cgs-dirhero__text { align-self: auto; }
	.cgs-dirhero__art { justify-self: center; max-width: min(300px, 100%); margin-top: 12px; }
	.cgs-dirhero__ctrl { justify-self: center; margin: 8px 0 0; }
}
@media (max-width: 479.98px) {
	.cgs-dirhero__title { padding-left: 14px; border-left-width: 4px; }
	.cgs-dirhero__intro { padding-left: 18px; }
	.cgs-dirhero__art { max-width: 260px; }
	.cgs-dir__lead { padding-left: 14px; line-height: 1.9; }
}
