/*
Theme Name: AfriOSH LMS
Theme URI: https://grupawilson.com/
Author: Grupa Technology
Author URI: https://grupawilson.com/
Description: The AfriOSH Occupational Safety and Health learning platform theme, built on Grupa LMS. Developed by Grupa Technology.
Version: 1.1.1
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: afriosh
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/

/* ==========================================================================
   Design tokens
   Grounded in the AfriOSH mark: deep teal + safety orange + compliance gold.
   Background is a teal-tinted mist rather than a warm cream, so it reads as
   "safety/compliance" rather than "editorial blog".
   ========================================================================== */

:root {
	--afriosh-teal-900: #123f3d;
	--afriosh-teal-700: #1a6b6b;
	--afriosh-teal-600: #226f6d;
	--afriosh-orange-600: #e8622c;
	--afriosh-orange-700: #cc4f1e;
	--afriosh-gold-500: #d6a429;
	--afriosh-hazard-yellow: #f2c230;
	--afriosh-ink-900: #1f2a30;
	--afriosh-ink-600: #566169;
	--afriosh-mist-50: #f2f7f6;
	--afriosh-mist-100: #e7efee;
	--afriosh-white: #ffffff;
	--afriosh-border: #dbe6e4;

	--afriosh-font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
	--afriosh-font-body: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	--afriosh-font-mono: "IBM Plex Mono", ui-monospace, monospace;

	--afriosh-radius: 10px;
	--afriosh-shadow: 0 4px 24px rgba(18, 63, 61, 0.08);

	/* Keep the Grupa LMS plugin's own CSS variables in sync with the theme,
	   so course cards, dashboards, quizzes, and certificates automatically
	   pick up AfriOSH branding without editing plugin files. */
	--grupa-color-primary: var(--afriosh-teal-700);
	--grupa-color-accent: var(--afriosh-orange-600);
	--grupa-color-highlight: var(--afriosh-gold-500);
	--grupa-color-text: var(--afriosh-ink-900);
	--grupa-color-muted: var(--afriosh-ink-600);
	--grupa-color-border: var(--afriosh-border);
	--grupa-color-bg-soft: var(--afriosh-mist-50);
	--grupa-radius: var(--afriosh-radius);
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ==========================================================================
   Base
   ========================================================================== */

* { box-sizing: border-box; }

html {
	scroll-behavior: smooth;
	overflow-x: hidden;
	width: 100%;
}

body {
	margin: 0;
	width: 100%;
	max-width: 100%;
	font-family: var(--afriosh-font-body);
	font-size: 16px;
	line-height: 1.6;
	color: var(--afriosh-ink-900);
	background: var(--afriosh-white);
	overflow-x: hidden; /* safety net: decorative elements (seal, hazard divider)
	                       must never cause horizontal scroll on any device */
}

img, svg, video, iframe { max-width: 100%; height: auto; }
img { display: block; }

table { width: 100%; border-collapse: collapse; }
input, select, textarea, button { max-width: 100%; font-family: inherit; }

a { color: var(--afriosh-teal-700); }

h1, h2, h3, h4 {
	font-family: var(--afriosh-font-display);
	font-weight: 700;
	line-height: 1.08;
	letter-spacing: 0.2px;
	margin: 0 0 .5em;
	color: var(--afriosh-ink-900);
	overflow-wrap: break-word;
}

h1 { font-size: clamp(2.1rem, 5vw + 1rem, 4.2rem); font-weight: 800; }
h2 { font-size: clamp(1.7rem, 3vw + 1rem, 2.8rem); }
h3 { font-size: clamp(1.2rem, 1.5vw + 1rem, 1.4rem); }

.afriosh-eyebrow {
	font-family: var(--afriosh-font-mono);
	font-size: 12px;
	letter-spacing: 2.5px;
	text-transform: uppercase;
	color: var(--afriosh-orange-600);
	font-weight: 600;
	display: inline-block;
	margin-bottom: 14px;
}

.afriosh-container { max-width: 1180px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 24px); }
.afriosh-section { padding: clamp(40px, 8vw, 72px) 0; }
.afriosh-section--tight { padding: clamp(32px, 5vw, 48px) 0; }

:focus-visible { outline: 2px solid var(--afriosh-teal-700); outline-offset: 3px; }

.skip-link {
	position: absolute; left: -9999px; top: 0; background: var(--afriosh-teal-900);
	color: #fff; padding: 12px 20px; z-index: 10000;
}
.skip-link:focus { left: 12px; top: 12px; }

/* ==========================================================================
   Header
   ========================================================================== */

.afriosh-header {
	position: sticky;
	top: 0;
	z-index: 500;
	background: rgba(255,255,255,.96);
	backdrop-filter: blur(6px);
	border-bottom: 1px solid var(--afriosh-border);
}

.afriosh-header__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 14px 0;
	flex-wrap: nowrap;
}

.afriosh-logo {
	display: flex;
	align-items: baseline;
	gap: 8px;
	font-family: var(--afriosh-font-display);
	font-weight: 800;
	font-size: clamp(20px, 4vw, 26px);
	text-decoration: none;
	color: var(--afriosh-teal-700);
	flex-shrink: 0;
}
.afriosh-logo span { color: var(--afriosh-orange-600); }
.afriosh-logo img { height: 34px; width: auto; display: block; }
.afriosh-logo small {
	font-family: var(--afriosh-font-mono);
	font-size: 9px;
	letter-spacing: 1.5px;
	color: var(--afriosh-ink-600);
	display: block;
	text-transform: uppercase;
	font-weight: 600;
}

.afriosh-nav { display: flex; align-items: center; gap: 28px; }
.afriosh-nav ul { list-style: none; display: flex; gap: 26px; margin: 0; padding: 0; }
.afriosh-nav a {
	color: var(--afriosh-ink-900);
	text-decoration: none;
	font-weight: 600;
	font-size: 15px;
}
.afriosh-nav a:hover { color: var(--afriosh-teal-700); }

.afriosh-header__actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.afriosh-header__logout { font-size: 13px; color: var(--afriosh-ink-600); text-decoration: none; font-weight: 600; }
.afriosh-header__logout:hover { color: var(--afriosh-orange-600); }
.afriosh-header__auth-links { display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.afriosh-header__auth-links a {
	font-size: 14px;
	font-weight: 600;
	color: var(--afriosh-ink-900);
	text-decoration: none;
}
.afriosh-header__auth-links a:hover { color: var(--afriosh-teal-700); }

/* Login/Sign Up also exist inside the nav markup (afriosh-nav__auth-item)
   for the mobile hamburger — hidden here on desktop since the header-actions
   copy above is what actually shows at this width. */
.afriosh-nav__auth-item { display: none; }

.afriosh-menu-toggle {
	display: none;
	background: none;
	border: none;
	cursor: pointer;
	padding: 8px;
}
.afriosh-menu-toggle span { display: block; width: 24px; height: 2px; background: var(--afriosh-ink-900); margin: 5px 0; }

/* ==========================================================================
   Buttons (shared visual language with the plugin's .grupa-lms-btn)
   ========================================================================== */

.afriosh-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 13px 26px;
	border-radius: 999px;
	font-weight: 700;
	font-size: 15px;
	text-decoration: none;
	border: 2px solid transparent;
	cursor: pointer;
	transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
	min-height: 46px;
}
.afriosh-btn--primary { background: var(--afriosh-orange-600); color: #fff; }
.afriosh-btn--primary:hover { background: var(--afriosh-orange-700); transform: translateY(-1px); }
.afriosh-btn--ghost { background: transparent; border-color: var(--afriosh-teal-700); color: var(--afriosh-teal-700); }
.afriosh-btn--ghost:hover { background: var(--afriosh-teal-700); color: #fff; }
.afriosh-btn--on-dark { border-color: rgba(255,255,255,.5); color: #fff; }
.afriosh-btn--on-dark:hover { background: #fff; color: var(--afriosh-teal-900); }

/* ==========================================================================
   Hero
   ========================================================================== */

.afriosh-hero {
	position: relative;
	overflow: hidden;
	background: linear-gradient(180deg, var(--afriosh-mist-50) 0%, var(--afriosh-white) 100%);
}

.afriosh-hero__grid {
	display: grid;
	grid-template-columns: 1.15fr .85fr;
	gap: 48px;
	align-items: center;
	padding: 76px 0 64px;
}

.afriosh-hero h1 { margin-bottom: 18px; }
.afriosh-hero h1 em { font-style: normal; color: var(--afriosh-teal-700); }

.afriosh-hero__lead { font-size: 18px; color: var(--afriosh-ink-600); max-width: 46ch; margin-bottom: 30px; }

.afriosh-hero__actions { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 44px; }

.afriosh-hero__stats { display: flex; gap: 36px; flex-wrap: wrap; }
.afriosh-hero__stat strong {
	display: block;
	font-family: var(--afriosh-font-mono);
	font-size: 26px;
	font-weight: 700;
	color: var(--afriosh-teal-900);
}
.afriosh-hero__stat span { font-size: 12px; color: var(--afriosh-ink-600); text-transform: uppercase; letter-spacing: 1px; }

/* Signature element: the compliance seal — echoes the certificate seal so
   the hero, homepage, and issued certificates all read as one system. */
.afriosh-seal {
	--seal-size: 320px;
	width: var(--seal-size);
	height: var(--seal-size);
	max-width: 100%;
	margin: 0 auto;
	position: relative;
	animation: afriosh-seal-in .7s ease both;
}
@keyframes afriosh-seal-in {
	from { opacity: 0; transform: scale(.92) translateY(10px); }
	to { opacity: 1; transform: scale(1) translateY(0); }
}
.afriosh-seal svg { width: 100%; height: 100%; display: block; }

/* Hazard-stripe divider — used exactly once, between hero and the next
   section, drawn from OSH signage rather than decoration for its own sake. */
.afriosh-hazard-divider {
	height: 10px;
	background: repeating-linear-gradient(
		135deg,
		var(--afriosh-teal-900) 0 22px,
		var(--afriosh-gold-500) 22px 44px
	);
}

/* ==========================================================================
   Pillars (Training / Consulting / OSH — matches the tagline exactly,
   parallel categories, not a sequence, so no numbered markers)
   ========================================================================== */

.afriosh-pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; }

.afriosh-pillar {
	background: var(--afriosh-white);
	border: 1px solid var(--afriosh-border);
	border-radius: var(--afriosh-radius);
	padding: 32px;
	transition: box-shadow .2s ease, transform .2s ease;
}
.afriosh-pillar:hover { box-shadow: var(--afriosh-shadow); transform: translateY(-2px); }

.afriosh-pillar__icon {
	width: 52px; height: 52px; border-radius: 12px;
	display: flex; align-items: center; justify-content: center;
	background: var(--afriosh-mist-50); color: var(--afriosh-teal-700);
	margin-bottom: 18px;
}
.afriosh-pillar__icon svg { width: 26px; height: 26px; }

.afriosh-pillar p { color: var(--afriosh-ink-600); margin: 0; }

/* ==========================================================================
   Stats band
   ========================================================================== */

.afriosh-stats-band { background: var(--afriosh-teal-900); color: #fff; }
.afriosh-stats-band .afriosh-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 24px; text-align: center; }
.afriosh-stat strong {
	display: block;
	font-family: var(--afriosh-font-mono);
	font-size: clamp(28px, 4vw, 42px);
	font-weight: 700;
	color: var(--afriosh-hazard-yellow);
}
.afriosh-stat span { font-size: 13px; letter-spacing: .5px; color: rgba(255,255,255,.8); }

/* ==========================================================================
   Featured courses section header + testimonials + CTA band
   ========================================================================== */

.afriosh-section__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 32px; flex-wrap: wrap; }
.afriosh-section__head p { color: var(--afriosh-ink-600); max-width: 52ch; margin: 8px 0 0; }

.afriosh-testimonials { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.afriosh-testimonial {
	background: var(--afriosh-mist-50);
	border-radius: var(--afriosh-radius);
	padding: 28px;
}
.afriosh-testimonial blockquote { margin: 0 0 16px; font-size: 16px; color: var(--afriosh-ink-900); }
.afriosh-testimonial cite { font-style: normal; font-weight: 700; font-size: 14px; }
.afriosh-testimonial cite span { display: block; font-weight: 400; color: var(--afriosh-ink-600); font-size: 13px; }

.afriosh-cta-band {
	background: linear-gradient(135deg, var(--afriosh-teal-700), var(--afriosh-teal-900));
	color: #fff;
	border-radius: 20px;
	padding: 56px;
	text-align: center;
}
.afriosh-cta-band h2 { color: #fff; }
.afriosh-cta-band p { color: rgba(255,255,255,.85); max-width: 52ch; margin: 0 auto 28px; }

/* ==========================================================================
   Footer
   ========================================================================== */

.afriosh-footer { background: var(--afriosh-teal-900); color: rgba(255,255,255,.85); }
.afriosh-footer__top { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; padding: 56px 0 32px; }
.afriosh-footer h4 { color: #fff; font-size: 14px; text-transform: uppercase; letter-spacing: 1px; font-family: var(--afriosh-font-body); font-weight: 700; margin-bottom: 16px; }
.afriosh-footer ul { list-style: none; margin: 0; padding: 0; }
.afriosh-footer li { margin-bottom: 10px; }
.afriosh-footer a { color: rgba(255,255,255,.8); text-decoration: none; font-size: 14px; }
.afriosh-footer a:hover { color: #fff; }
.afriosh-footer__tagline { font-family: var(--afriosh-font-mono); font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: rgba(255,255,255,.6); margin-top: 10px; }

.afriosh-footer__bottom {
	border-top: 1px solid rgba(255,255,255,.12);
	padding: 20px 0;
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	font-size: 13px;
	color: rgba(255,255,255,.6);
}
.afriosh-footer__bottom a { color: rgba(255,255,255,.8); text-decoration: underline; }

/* ==========================================================================
   Generic page / single content wrapper (non-LMS pages)
   ========================================================================== */

.afriosh-page { padding: 56px 0; }
.afriosh-page__content { max-width: 760px; margin: 0 auto; }
.afriosh-page__content h1 { margin-bottom: 24px; }

/* ==========================================================================
   Responsive
   Staged from large-tablet down to small-phone. Grids that use auto-fit
   above (pillars, testimonials, stats) already scale smoothly on their own;
   the breakpoints below handle the pieces that need a deliberate layout
   change (hero split, nav collapse, footer columns, spacing rhythm).
   ========================================================================== */

/* Large tablets / small laptops */
@media (max-width: 1024px) {
	.afriosh-hero__grid { gap: 32px; }
	.afriosh-seal { --seal-size: 260px; }
}

/* Tablets (portrait) — hero stacks, seal moves above the headline */
@media (max-width: 900px) {
	.afriosh-hero__grid { grid-template-columns: 1fr; padding-top: 32px; text-align: center; }
	.afriosh-hero__lead { margin-left: auto; margin-right: auto; }
	.afriosh-hero__actions { justify-content: center; }
	.afriosh-hero__stats { justify-content: center; }
	.afriosh-seal { order: -1; --seal-size: 200px; margin-bottom: 8px; }
	.afriosh-footer__top { grid-template-columns: 1fr 1fr; }
	.afriosh-section__head { justify-content: flex-start; }
}

/* Nav collapse point — below this, the hamburger takes over */
@media (max-width: 782px) {
	.afriosh-nav { position: static; }
	.afriosh-nav ul { display: none; }
	.afriosh-menu-toggle { display: block; }
	.afriosh-nav.is-open ul {
		display: flex !important;
		flex-direction: column;
		gap: 4px;
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		background: #fff;
		border-bottom: 1px solid var(--afriosh-border);
		box-shadow: var(--afriosh-shadow);
		padding: 12px 24px 16px;
		margin: 0;
		z-index: 400;
		max-height: calc(100vh - 70px);
		overflow-y: auto;
	}
	.afriosh-nav.is-open ul a {
		display: block;
		padding: 14px 4px;
		font-size: 16px;
		border-bottom: 1px solid var(--afriosh-border);
	}

	/* Everything menu-like collapses into the hamburger on mobile:
	   hide the desktop Login/Sign Up (next to the language switcher)
	   and show the nav's own copy instead, inside the dropdown. */
	.afriosh-header__auth-links { display: none; }
	.afriosh-nav__auth-item { display: block; }
	.afriosh-nav.is-open .afriosh-nav__auth-item a { color: var(--afriosh-teal-700); }

	/* The actions bar must be allowed to shrink now that it holds
	   fewer items — this, combined with the auth-links move above, is
	   what stops the header (and the whole page) from being forced
	   wider than the viewport on narrow phones. */
	.afriosh-header__actions { flex-shrink: 1; min-width: 0; gap: 8px; }

	.afriosh-header__actions .afriosh-btn { padding: 10px 16px; font-size: 13px; min-height: 40px; }
	.afriosh-cta-band { padding: 36px 22px; }
	.afriosh-cta-band h2 { font-size: clamp(1.6rem, 6vw, 2rem); }
}

/* Phones (landscape and larger phones) */
@media (max-width: 600px) {
	.afriosh-hero__stats { gap: 18px; justify-content: center; }
	.afriosh-hero__stat { flex: 1 1 30%; min-width: 90px; }
	.afriosh-footer__top { grid-template-columns: 1fr; text-align: left; }
	.afriosh-footer__bottom { flex-direction: column; text-align: center; }
	.afriosh-section__head { flex-direction: column; align-items: flex-start; }
	.afriosh-page__content { padding: 0 2px; }
}

/* Small phones — tightest spacing, secondary header action hidden to keep
   the primary CTA and menu toggle comfortably tappable. The language
   switcher stays visible (never hide language access), it just shrinks. */
@media (max-width: 420px) {
	.afriosh-header__actions .afriosh-btn--ghost { display: none; }
	.afriosh-header__actions { gap: 8px; }
	.afriosh-header__auth-links { gap: 10px; }
	.afriosh-header__auth-links a { font-size: 13px; }
	.afriosh-lms-lang-switcher select, .grupa-lms-lang-switcher select { padding: 6px 8px; font-size: 12px; min-height: 36px; }
	.afriosh-hero__actions { flex-direction: column; align-items: stretch; }
	.afriosh-hero__actions .afriosh-btn { width: 100%; }
	.afriosh-seal { --seal-size: 160px; }
	.afriosh-pillar { padding: 24px; }
	.afriosh-cta-band { border-radius: 14px; }
}

/* Very small / older devices (iPhone SE and similar ~320px) */
@media (max-width: 360px) {
	.afriosh-logo small { display: none; }
	.afriosh-hero__stat strong { font-size: 22px; }
	.afriosh-testimonial { padding: 20px; }
	.afriosh-header__bar { flex-wrap: wrap; row-gap: 10px; }
	.afriosh-header__actions { flex-basis: 100%; justify-content: flex-end; }
}

/* Landscape phones — constrain sticky header height so content isn't
   crowded on short viewports */
@media (max-height: 480px) and (orientation: landscape) {
	.afriosh-hero__grid { padding-top: 20px; padding-bottom: 20px; }
	.afriosh-seal { --seal-size: 140px; }
}

/* ==========================================================================
   Single course override layout (theme's grupa-lms/single-course.php)
   ========================================================================== */

@media (max-width: 900px) {
	.afriosh-container > div[style*="grid-template-columns:1fr 340px"] {
		grid-template-columns: 1fr !important;
	}
	aside[style*="position:sticky"] {
		position: static !important;
		order: -1; /* enroll/progress card shows before the curriculum on mobile */
	}
}

/* ==========================================================================
   Print
   ========================================================================== */

@media print {
	.afriosh-header, .afriosh-footer, .afriosh-menu-toggle, .afriosh-hazard-divider { display: none; }
}
