/*
 * Directorate of Vocational Education — child theme rules.
 *
 * Load order: Avada style.css -> Avada child style.css (theme header) -> this file.
 * Everything here can therefore override Avada without fighting the cascade.
 *
 * RTL NOTE
 * --------
 * This stylesheet is written for ARABIC / RTL as the primary direction. Every
 * directional rule uses LOGICAL properties so it mirrors automatically for the
 * English / LTR version — never hardcode `left` / `right`:
 *
 *     margin-inline-start      instead of  margin-left
 *     padding-inline-end       instead of  padding-right
 *     border-inline-start      instead of  border-left
 *     text-align: start|end    instead of  text-align: left|right
 *
 * When WPML goes in (final phase), add assets/css/rtl.css with rules that must
 * differ per direction instead of editing this file.
 */

:root {
	/* Palette — replace with the Directorate's brand colours. */
	--dgve-brand: #1f6f54;
	--dgve-brand-dark: #14503c;
	--dgve-accent: #c8a24a;
	--dgve-ink: #1a1d21;
	--dgve-muted: #5c6672;
	--dgve-surface: #f6f7f9;
	--dgve-line: #e2e6eb;

	/* Type — one Latin family, one Arabic family. */
	--dgve-font-latin: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
	--dgve-font-arabic: "Tajawal", "Cairo", "Almarai", "Segoe UI", Tahoma, sans-serif;

	--dgve-radius: 8px;
	--dgve-shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
	--dgve-shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.12);
}

/*
 * Font families per direction.
 * `html[lang="ar"]` / `html[dir="rtl"]` — both selectors so it works whether
 * WordPress sets lang, dir, or both.
 */
html[lang="ar"],
html[dir="rtl"] {
	font-family: var(--dgve-font-arabic);
}

html[lang="en"],
html[dir="ltr"] {
	font-family: var(--dgve-font-latin);
}

/* -------------------------------------------------------------------------
 * 1. Layout helpers (logical properties only)
 * ---------------------------------------------------------------------- */

.dgve-container {
	inline-size: min(100% - 2.5rem, 1200px);
	margin-inline: auto;
}

.dgve-stack > * + * {
	margin-block-start: 1.25rem;
}

/* -------------------------------------------------------------------------
 * 2. Cards — news, branches, specializations, schools
 * ---------------------------------------------------------------------- */

.dgve-card {
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid var(--dgve-line);
	border-radius: var(--dgve-radius);
	overflow: hidden;
	box-shadow: var(--dgve-shadow);
	transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.dgve-card:hover {
	box-shadow: var(--dgve-shadow-lg);
	transform: translateY(-2px);
}

.dgve-card__media {
	aspect-ratio: 16 / 10;
	background: var(--dgve-surface);
	overflow: hidden;
}

.dgve-card__media img {
	inline-size: 100%;
	block-size: 100%;
	object-fit: cover;
	display: block;
}

.dgve-card__body {
	padding: 1rem 1.15rem 1.25rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	flex: 1;
}

.dgve-card__title {
	margin: 0;
	font-size: 1.0625rem;
	line-height: 1.4;
}

.dgve-card__meta {
	margin: 0;
	font-size: 0.8125rem;
	color: var(--dgve-muted);
}

/* Grid of cards: 1 col mobile, 2 tablet, 3 desktop. */
.dgve-grid {
	display: grid;
	gap: 1.25rem;
	grid-template-columns: 1fr;
}

@media (min-width: 640px) {
	.dgve-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
	.dgve-grid { grid-template-columns: repeat(3, 1fr); }
}

/* -------------------------------------------------------------------------
 * 3. Badges and tags (branch, grade, status)
 * ---------------------------------------------------------------------- */

.dgve-badge {
	display: inline-block;
	padding: 0.2rem 0.6rem;
	border-radius: 999px;
	font-size: 0.75rem;
	font-weight: 600;
	background: var(--dgve-surface);
	color: var(--dgve-brand-dark);
	border: 1px solid var(--dgve-line);
	white-space: nowrap;
}

.dgve-badge--solid {
	background: var(--dgve-brand);
	border-color: var(--dgve-brand);
	color: #fff;
}

.dgve-badge--warn {
	background: #fdf3e3;
	border-color: #f0dcb5;
	color: #8a6417;
}

/* -------------------------------------------------------------------------
 * 4. Data tables (subject hours, specialization lists, school details)
 * ---------------------------------------------------------------------- */

.dgve-table-wrap {
	inline-size: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.dgve-table {
	inline-size: 100%;
	border-collapse: collapse;
	font-size: 0.9375rem;
}

.dgve-table caption {
	caption-side: top;
	text-align: start;
	padding-block-end: 0.5rem;
	color: var(--dgve-muted);
	font-size: 0.875rem;
}

.dgve-table th,
.dgve-table td {
	padding: 0.65rem 0.75rem;
	border-block-end: 1px solid var(--dgve-line);
	text-align: start; /* NEVER text-align: left — breaks RTL */
	vertical-align: top;
}

.dgve-table thead th {
	background: var(--dgve-surface);
	font-weight: 600;
	color: var(--dgve-ink);
	white-space: nowrap;
}

.dgve-table tbody tr:last-child th,
.dgve-table tbody tr:last-child td {
	border-block-end: 0;
}

/* Numeric and code columns stay LTR even inside an Arabic page so digits
   never reflow into the wrong order. */
.dgve-ltr {
	direction: ltr;
	unicode-bidi: isolate;
}

.dgve-num {
	font-variant-numeric: tabular-nums;
	text-align: end;
}

/* -------------------------------------------------------------------------
 * 5. Announcement ticker (pinned circulars under the header)
 * ---------------------------------------------------------------------- */

.dgve-ticker {
	background: var(--dgve-brand-dark);
	color: #fff;
	font-size: 0.875rem;
}

.dgve-ticker__inner {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding-block: 0.55rem;
}

.dgve-ticker__label {
	font-weight: 700;
	background: var(--dgve-accent);
	color: #2a1f00;
	padding: 0.15rem 0.55rem;
	border-radius: 4px;
	font-size: 0.75rem;
	white-space: nowrap;
}

.dgve-ticker__list {
	margin: 0;
	padding: 0;
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem 1.25rem;
}

.dgve-ticker a {
	color: #fff;
	text-decoration: none;
}

.dgve-ticker a:hover,
.dgve-ticker a:focus-visible {
	text-decoration: underline;
}

/* -------------------------------------------------------------------------
 * 6. Archive filter bar (schools directory, specializations, curricula)
 * ---------------------------------------------------------------------- */

.dgve-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	align-items: flex-end;
	padding: 1rem;
	background: var(--dgve-surface);
	border: 1px solid var(--dgve-line);
	border-radius: var(--dgve-radius);
	margin-block-end: 1.5rem;
}

.dgve-filters__field {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	flex: 1 1 190px;
	min-inline-size: 0;
}

.dgve-filters__field label {
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--dgve-muted);
}

.dgve-filters input[type="search"],
.dgve-filters input[type="text"],
.dgve-filters select {
	block-size: 40px;
	padding-inline: 0.7rem;
	border: 1px solid var(--dgve-line);
	border-radius: 6px;
	background: #fff;
	font: inherit;
	inline-size: 100%;
}

.dgve-filters input:focus-visible,
.dgve-filters select:focus-visible,
.dgve-btn:focus-visible,
a:focus-visible {
	outline: 2px solid var(--dgve-brand);
	outline-offset: 2px;
}

/* -------------------------------------------------------------------------
 * 7. Buttons
 * ---------------------------------------------------------------------- */

.dgve-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.55rem 1.1rem;
	border-radius: 6px;
	font-weight: 600;
	font-size: 0.9375rem;
	text-decoration: none;
	border: 1px solid transparent;
	cursor: pointer;
	min-block-size: 40px; /* comfortable tap target */
}

.dgve-btn--primary {
	background: var(--dgve-brand);
	color: #fff;
}

.dgve-btn--primary:hover {
	background: var(--dgve-brand-dark);
	color: #fff;
}

.dgve-btn--ghost {
	background: transparent;
	border-color: var(--dgve-line);
	color: var(--dgve-ink);
}

.dgve-btn--ghost:hover {
	border-color: var(--dgve-brand);
	color: var(--dgve-brand-dark);
}

/* -------------------------------------------------------------------------
 * 8. Download / document rows (curriculum files, circulars, reports)
 * ---------------------------------------------------------------------- */

.dgve-doc {
	display: flex;
	align-items: center;
	gap: 0.85rem;
	padding: 0.8rem 1rem;
	border: 1px solid var(--dgve-line);
	border-radius: var(--dgve-radius);
	background: #fff;
	text-decoration: none;
	color: inherit;
	transition: border-color 0.15s ease;
}

.dgve-doc + .dgve-doc {
	margin-block-start: 0.6rem;
}

.dgve-doc:hover {
	border-color: var(--dgve-brand);
}

.dgve-doc__type {
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	background: var(--dgve-surface);
	border: 1px solid var(--dgve-line);
	border-radius: 4px;
	padding: 0.2rem 0.45rem;
	color: var(--dgve-muted);
}

.dgve-doc__title {
	flex: 1;
	font-weight: 500;
}

.dgve-doc__size {
	font-size: 0.8125rem;
	color: var(--dgve-muted);
	font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------------------
 * 9. Breadcrumb — required for the branch > specialization > school hierarchy
 * ---------------------------------------------------------------------- */

.dgve-breadcrumb ol {
	margin: 0;
	padding: 0;
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	font-size: 0.8125rem;
	color: var(--dgve-muted);
}

.dgve-breadcrumb li + li::before {
	content: "/";
	margin-inline-end: 0.35rem;
	color: var(--dgve-line);
}

.dgve-breadcrumb a {
	color: var(--dgve-muted);
	text-decoration: none;
}

.dgve-breadcrumb a:hover {
	color: var(--dgve-brand-dark);
	text-decoration: underline;
}

.dgve-breadcrumb [aria-current="page"] {
	color: var(--dgve-ink);
	font-weight: 600;
}

/* -------------------------------------------------------------------------
 * 10. Statistics / KPI cards
 * ---------------------------------------------------------------------- */

.dgve-kpi {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	padding: 1.15rem 1.25rem;
	background: #fff;
	border: 1px solid var(--dgve-line);
	border-radius: var(--dgve-radius);
	box-shadow: var(--dgve-shadow);
}

.dgve-kpi__value {
	font-size: 1.875rem;
	font-weight: 700;
	line-height: 1.1;
	color: var(--dgve-brand-dark);
	font-variant-numeric: tabular-nums;
}

.dgve-kpi__label {
	font-size: 0.8125rem;
	color: var(--dgve-muted);
}

.dgve-kpi-grid {
	display: grid;
	gap: 1rem;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

/* -------------------------------------------------------------------------
 * 11. Accessibility
 * ---------------------------------------------------------------------- */

/* Visible focus everywhere — the site must pass WCAG 2.1 AA. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
	outline: 2px solid var(--dgve-brand);
	outline-offset: 2px;
}

/* Skip link: first focusable element in the DOM. */
.dgve-skip-link {
	position: absolute;
	inset-block-start: -60px;
	inset-inline-start: 1rem;
	z-index: 100000;
	background: var(--dgve-brand-dark);
	color: #fff;
	padding: 0.6rem 1rem;
	border-radius: 0 0 6px 6px;
	transition: inset-block-start 0.15s ease;
}

.dgve-skip-link:focus {
	inset-block-start: 0;
}

/* Minimum body text size — do not go below 16px for Arabic. */
body {
	font-size: 16px;
	line-height: 1.7;
	color: var(--dgve-ink);
}

/* -------------------------------------------------------------------------
 * 12. Print — officials routinely print timetables, circulars and results
 * ---------------------------------------------------------------------- */

@media print {
	.dgve-ticker,
	.dgve-filters,
	.dgve-skip-link,
	.widget,
	.site-header,
	.site-footer {
		display: none !important;
	}

	.dgve-card,
	.dgve-table,
	.dgve-doc {
		box-shadow: none;
		border-color: #999;
		break-inside: avoid;
	}

	body {
		font-size: 12pt;
		color: #000;
		background: #fff;
	}

	a[href^="http"]::after {
		content: " (" attr(href) ")";
		font-size: 0.85em;
		color: #444;
	}
}
