/*
Theme Name: FASSET Bursaries
Description: Lightweight theme for FASSET Bursaries. Requires the FASSET Bursaries Core plugin.
Version: 0.2.0
Requires PHP: 7.4
Text Domain: fassetbursaries
*/

/* Colours: South African flag blue (#002395) and gold-yellow (#FFB612). */
:root {
	--bg: #ffffff;
	--card: #ffffff;
	--ink: #14203a;
	--muted: #56627a;
	--line: #dfe4ee;
	--blue: #002395;
	--blue-deep: #001660;
	--blue-soft: #e8edfa;
	--yellow: #ffb612;
	--yellow-soft: #fff4d9;
	--accent: #002395;
	--accent-ink: #ffffff;
	--accent-soft: #e8edfa;
	--ok: #007a4d;
	--ok-soft: #e3f4ec;
	--warn: #8a5a00;
	--warn-soft: #fff4d9;
	--bad: #9b2c2c;
	--bad-soft: #fdecec;
	--radius: 12px;
	--page: 1440px;
	--gutter: clamp(16px, 3.5vw, 48px);
	--sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--serif: Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--bg: #121a36;
		--card: #121a36;
		--ink: #e8ecf6;
		--muted: #9ea9c2;
		--line: #26304f;
		--blue: #8fa6ff;
		--blue-deep: #070c1f;
		--blue-soft: #18224a;
		--yellow-soft: #2d2410;
		--accent: #8fa6ff;
		--accent-ink: #0b1024;
		--accent-soft: #18224a;
		--ok: #5fd3a2;
		--ok-soft: #12302a;
		--warn: #f0c060;
		--warn-soft: #2d2410;
		--bad: #f19a9a;
		--bad-soft: #321a1a;
	}
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.65 var(--serif); }
a { color: var(--accent); }
img { max-width: 100%; height: auto; }
.screen-reader-text { position: absolute; left: -9999px; }
.skip-link:focus { left: 16px; top: 8px; z-index: 30; background: var(--card); padding: 8px 12px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--card); border-bottom: 1px solid var(--line); font-family: var(--sans); }
.site-header .inner { max-width: var(--page); margin: 0 auto; padding: 10px var(--gutter); display: flex; align-items: center; gap: 22px; }
.site-logo { display: block; flex-shrink: 0; line-height: 0; }
.site-logo img { height: 46px; width: auto; }
.site-nav { flex: 1; }
.site-nav > ul { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; justify-content: center; gap: 4px; }
.site-nav a, .sub-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; font: 600 15px var(--sans); background: none; border: 0; cursor: pointer; }
.site-nav a:hover, .sub-toggle:hover { background: var(--blue-soft); color: var(--blue); }
.site-nav > ul > li.current > a, .site-nav > ul > li.current > .sub-toggle { color: var(--blue); }
.has-sub { position: relative; }
.sub { display: none; position: absolute; top: calc(100% + 6px); left: 0; min-width: 260px; list-style: none; margin: 0; padding: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(20, 32, 58, .08); }
.sub a { display: block; padding: 8px 10px; font-weight: 500; }
.has-sub.open > .sub { display: block; }
@media (hover: hover) and (min-width: 900px) { .has-sub:hover > .sub, .has-sub:focus-within > .sub { display: block; } }
.header-search { display: flex; width: 280px; flex-shrink: 0; }
.header-search input { flex: 1; min-width: 0; font: 15px var(--sans); padding: 9px 12px; border: 1.5px solid var(--line); border-right: 0; border-radius: 8px 0 0 8px; background: var(--card); color: var(--ink); }
.header-search input:focus { outline: none; border-color: var(--blue); }
.header-search button { display: flex; align-items: center; padding: 0 13px; border: 0; border-radius: 0 8px 8px 0; background: var(--blue); color: #fff; cursor: pointer; }
.header-search button:hover { background: var(--blue-deep); color: var(--yellow); }
.nav-toggle { display: none; flex-direction: column; justify-content: center; gap: 5px; width: 40px; height: 40px; padding: 8px; border: 0; background: none; cursor: pointer; flex-shrink: 0; }
.nav-toggle span { display: block; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .2s, opacity .2s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Desktop: logo left, menu centred on the page, search right. */
@media (min-width: 900px) {
	.site-header .inner { display: grid; grid-template-columns: 1fr auto 1fr; }
	.site-logo { justify-self: start; }
	.site-nav { flex: none; }
	.header-search { justify-self: end; }
}
@media (max-width: 899px) {
	.site-header .inner { flex-wrap: wrap; gap: 8px 10px; padding: 8px 12px; }
	.nav-toggle { display: flex; }
	.site-logo img { height: 38px; }
	.header-search { flex: 1; width: auto; min-width: 0; }
	.site-nav { display: none; order: 3; flex-basis: 100%; padding: 4px 0 8px; }
	.site-nav.open { display: block; }
	.site-nav > ul { flex-direction: column; align-items: stretch; gap: 0; }
	.site-nav a, .sub-toggle { width: 100%; justify-content: space-between; padding: 11px 8px; border-radius: 0; border-bottom: 1px solid var(--line); }
	.sub { position: static; box-shadow: none; border: 0; border-radius: 0; padding: 0 0 0 12px; min-width: 0; }
}
@media (max-width: 420px) {
	.site-logo img { height: 32px; }
	.header-search input { padding: 8px 9px; font-size: 14px; }
}

/* Layout */
.wrap { max-width: var(--page); margin: 0 auto; padding: 24px var(--gutter) 64px; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: clamp(24px, 4vw, 56px); }
.wrap.full { grid-template-columns: minmax(0, 1fr); }
/* Body text keeps a readable line length; the page itself is not boxed. */
.entry-content > p, .entry-content > ul, .entry-content > ol, .entry-content > h2, .entry-content > h3 { max-width: 820px; }
main { min-width: 0; }
.crumbs { font: 13px var(--sans); color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }
article.entry { background: none; border: 0; border-radius: 0; padding: 0; }
.panel { background: var(--bg); border: 0; border-radius: 0; padding: 0; }
h1 { font: 700 30px/1.25 var(--sans); margin: 0 0 6px; letter-spacing: -.01em; color: var(--ink); }
.byline { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 6px 0 20px; font-family: var(--sans); }
.byline-person { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.byline-person .avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.byline-person > span { display: flex; flex-direction: column; line-height: 1.25; }
.byline-name { font-weight: 700; font-size: 14px; }
.byline-person:hover .byline-name { color: var(--blue); }
.byline-role { font-size: 12px; color: var(--muted); }
.entry-content h2 { font: 700 22px/1.3 var(--sans); margin: 30px 0 10px; }
.entry-content h3 { font: 700 19px/1.35 var(--sans); margin: 26px 0 8px; }
.entry-content p { margin: 0 0 14px; }
.entry-content ul, .entry-content ol { margin: 0 0 16px; padding-left: 22px; }
.entry-content li { margin-bottom: 6px; }
.entry-image { margin: 0 0 20px; }
.entry-image img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; }

/* Fact box, apply button, notices */
.fb-glance { background: var(--blue-soft); border-radius: 10px; padding: 4px 18px 6px; }
.fb-glance ul { list-style: none; padding-left: 0; }
.fb-apply { display: inline-block; background: var(--yellow); color: #14203a; text-decoration: none; font: 700 16px var(--sans); padding: 12px 22px; border-radius: 8px; margin: 6px 0 10px; }
.fb-apply:hover { background: #ffc94d; }
.fb-apply-muted { background: var(--line); color: var(--muted); }
.fb-notice { font: 15px/1.5 var(--sans); border-radius: 10px; padding: 12px 14px; margin: 0 0 18px; background: var(--warn-soft); color: var(--ink); }
.fb-notice-discontinued { background: var(--bad-soft); }
.fb-faq h3 { font-size: 17px; }
.checked { font: 13px var(--sans); color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; margin-top: 24px; }

/* Cards and badges */
.cards { display: grid; gap: 12px; margin: 16px 0 0; padding: 0; list-style: none; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; font-family: var(--sans); }
.card h3 { font-size: 17px; margin: 0 0 4px; line-height: 1.35; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { color: var(--blue); }
.card .meta { font-size: 14px; color: var(--muted); }
.card.has-thumb { padding: 0; overflow: hidden; }
.card.has-thumb h3, .card.has-thumb .meta, .card.has-thumb .result-kind { margin-left: 16px; margin-right: 16px; }
.card.has-thumb .meta { margin-bottom: 14px; }
.card.has-thumb h3 { margin-top: 12px; }
.card-thumb { display: block; line-height: 0; }
.card-thumb img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.badge { display: inline-block; font: 600 12px var(--sans); padding: 2px 8px; border-radius: 999px; margin-right: 6px; vertical-align: 1px; }
.badge-open { background: var(--ok-soft); color: var(--ok); }
.badge-upcoming { background: var(--yellow-soft); color: var(--warn); }
.badge-closed, .badge-unverifiable { background: var(--line); color: var(--muted); }
.badge-discontinued { background: var(--bad-soft); color: var(--bad); }

/* Sidebar */
.sidebar { font-family: var(--sans); font-size: 15px; }
.sidebar .panel { padding: 0 0 20px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.sidebar .panel:last-child { border-bottom: 0; }
.sidebar h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li { padding: 6px 0; border-top: 1px solid var(--line); }
.sidebar li:first-child { border-top: 0; }
.sidebar a { text-decoration: none; }
.site-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.site-stats li { border: 0; padding: 0; }
.site-stats strong { display: block; font-size: 22px; line-height: 1.1; color: var(--ink); }
.site-stats span { font-size: 13px; color: var(--muted); line-height: 1.3; }

/* Home */
.home-hero { background: var(--blue-soft); color: var(--ink); font-family: var(--sans); border-bottom: 1px solid var(--line); overflow: hidden; }
.hero-inner { max-width: var(--page); margin: 0 auto; padding: 48px var(--gutter) 54px; display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 24px; align-items: center; }
.eyebrow { margin: 0 0 10px; color: var(--blue); font: 700 13px var(--sans); letter-spacing: .06em; text-transform: uppercase; }
.home-hero h1 { color: var(--ink); font-size: 40px; line-height: 1.15; margin: 0 0 14px; max-width: 760px; }
.home-hero .lead { font-size: 18px; line-height: 1.6; color: var(--muted); margin: 0 0 22px; max-width: 680px; }
.hero-search { display: flex; max-width: 640px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px; }
.hero-search input { flex: 1; min-width: 0; border: 0; padding: 10px 12px; font: 16px var(--sans); color: #14203a; background: transparent; }
.hero-search input:focus { outline: none; }
.hero-search button { border: 0; border-radius: 8px; padding: 0 22px; background: var(--yellow); color: #14203a; font: 700 16px var(--sans); cursor: pointer; }
.hero-search button:hover { background: #ffc94d; }
.hero-chips { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.hero-chips a { display: inline-block; padding: 6px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); text-decoration: none; font-size: 14px; }
.hero-chips a:hover { border-color: var(--blue); color: var(--blue); }
/* Student photo: feathered into the hero on the left and faded out at the bottom. */
.hero-photo { position: relative; align-self: stretch; margin: -48px 0 -54px; min-height: 100%; }
.hero-photo img { display: block; width: 100%; height: 100%; min-height: 420px; object-fit: cover; object-position: 50% 15%;
	-webkit-mask-image: linear-gradient(to right, transparent 0, #000 38%), linear-gradient(to top, transparent 0, #000 22%);
	-webkit-mask-composite: source-in;
	mask-image: linear-gradient(to right, transparent 0, #000 38%), linear-gradient(to top, transparent 0, #000 22%);
	mask-composite: intersect; }

.home { max-width: var(--page); margin: 0 auto; padding: 8px var(--gutter) 64px; font-family: var(--sans); }
.home-section { margin-top: 44px; }
.section-head h2, .home-section > h2 { font: 800 26px/1.25 var(--sans); margin: 0 0 6px; color: var(--ink); }
.section-head p { margin: 0; color: var(--muted); font-size: 16px; }
.cards-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.cards:has(> .card-funder) { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.empty { color: var(--muted); }
.more-link { display: inline-block; margin-top: 16px; font-weight: 700; color: var(--blue); text-decoration: none; }
.more-link:hover { text-decoration: underline; }

.field-grid { list-style: none; padding: 0; margin: 18px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.field-card { display: grid; grid-template-columns: 48px minmax(0, 1fr); grid-template-rows: auto auto auto; column-gap: 14px; height: 100%; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); }
.field-card:hover { border-color: var(--blue); }
.field-icon { grid-row: 1 / 4; display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 12px; background: var(--blue-soft); color: var(--blue); }
.field-name { font-weight: 700; font-size: 16px; }
.field-note { font-size: 14px; color: var(--muted); }
.field-count { font-size: 13px; font-weight: 700; color: var(--blue); margin-top: 4px; }

.funder-grid { list-style: none; padding: 0; margin: 18px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.funder-grid a, .card-funder a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; height: 100%; padding: 16px 12px; text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 10px; color: var(--ink); text-decoration: none; }
.funder-grid a:hover, .card-funder a:hover { border-color: var(--blue); }
.funder-logo { display: block; width: auto; height: auto; max-width: 140px; max-height: 56px; object-fit: contain; }
.funder-initials { display: flex; align-items: center; justify-content: center; width: 56px; height: 56px; max-width: none; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-weight: 800; font-size: 18px; }
.funder-box { display: flex; gap: 18px; align-items: flex-start; margin: 32px 0 0; padding: 20px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.funder-box-logo { flex: 0 0 96px; display: flex; justify-content: center; }
.funder-box-logo .funder-logo { max-width: 96px; max-height: 64px; }
.funder-box h2 { margin: 0 0 8px; font-size: 20px; }
.funder-box p { margin: 0 0 10px; }
.funder-box .funder-box-links { margin: 0; font: 600 14px var(--sans); }
@media (max-width: 600px) { .funder-box { flex-direction: column; } .funder-box-logo { flex-basis: auto; justify-content: flex-start; } }
.funder-name { font: 600 14px/1.35 var(--sans); }
.card-funder { padding: 0; border: 0; background: none; }

.steps { list-style: none; padding: 0; margin: 18px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.steps li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.step-num { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-weight: 800; }
.steps h3 { margin: 10px 0 4px; font-size: 17px; }
.steps p { margin: 0; font-size: 15px; color: var(--muted); line-height: 1.5; }

.founders { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.founders-photos { display: flex; }
.founders-photos img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; object-position: center 20%; border: 3px solid var(--card); }
.founders-photos a + a { margin-left: -18px; }
.founders h2 { font: 800 22px/1.3 var(--sans); margin: 0 0 8px; }
.founders p { margin: 0 0 8px; font-size: 16px; line-height: 1.6; color: var(--muted); }
.founders-links a { font-weight: 700; color: var(--blue); }

@media (max-width: 860px) {
	.hero-inner { grid-template-columns: minmax(0, 1fr); gap: 24px; padding: 32px 16px 40px; }
	.hero-photo { display: none; }
	.home-hero h1 { font-size: 30px; }
	.founders { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
	.home-hero h1 { font-size: 26px; }
	.home-hero .lead { font-size: 16px; }
	.hero-search button { padding: 0 14px; }
	.cards-grid { grid-template-columns: minmax(0, 1fr); }
	.section-head h2, .home-section > h2 { font-size: 22px; }
}

/* Home layout: even grids on desktop, compact two-column sections on phones. */
@media (min-width: 900px) {
	.home .cards-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.field-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
	.funder-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (min-width: 1300px) {
	.hero-inner { grid-template-columns: minmax(0, 1fr) 460px; }
}
@media (max-width: 640px) {
	.home { padding-bottom: 40px; }
	.home-section { margin-top: 30px; }
	.section-head p { font-size: 14px; }
	.home .cards-grid > li:nth-child(n+5) { display: none; }

	.field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
	.field-card { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; align-content: start; row-gap: 2px; padding: 12px; }
	.field-icon { grid-row: auto; width: 36px; height: 36px; border-radius: 10px; margin-bottom: 6px; }
	.field-icon svg { width: 20px; height: 20px; }
	.field-name { font-size: 14px; line-height: 1.3; }
	.field-note { display: none; }
	.field-count { font-size: 12px; }

	.funder-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
	.funder-grid li:nth-child(n+9) { display: none; }
	.funder-grid a { padding: 12px 8px; gap: 8px; }
	.funder-logo { max-width: 110px; max-height: 40px; }
	.funder-initials { width: 40px; height: 40px; font-size: 14px; }
	.funder-name { font-size: 13px; }

	.home .cards-grid:has(> .has-thumb) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
	.card.has-thumb .meta { display: none; }
	.card.has-thumb h3 { font-size: 14px; margin: 8px 10px 10px; }

	.steps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
	.steps li { padding: 12px; }
	.step-num { width: 28px; height: 28px; font-size: 14px; }
	.steps h3 { font-size: 15px; margin-top: 8px; }
	.steps p { font-size: 13px; }

	.founders { padding: 18px; gap: 14px; }
	.founders-photos img { width: 72px; height: 72px; }
	.founders h2 { font-size: 19px; }
	.founders p { font-size: 15px; }
}

/* Funder and author headers */
.funder-head { display: flex; gap: 16px; align-items: center; margin-bottom: 12px; }
.funder-head img { width: 88px; height: 88px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.author-head { display: flex; gap: 20px; align-items: center; margin-bottom: 18px; }
.author-head img { width: 132px; height: 132px; object-fit: cover; object-position: center 20%; border-radius: 50%; flex-shrink: 0; }
.author-head h1 { margin-bottom: 4px; }
.author-role { font: 14px var(--sans); color: var(--muted); margin: 0; }
@media (max-width: 560px) { .author-head { flex-direction: column; align-items: flex-start; } }

/* Search results */
.search-form-inline { display: flex; gap: 8px; margin: 12px 0 8px; }
.search-form-inline input { flex: 1; min-width: 0; font: 16px var(--sans); padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); }
.search-form-inline button { border: 0; border-radius: 8px; padding: 0 18px; background: var(--blue); color: #fff; font: 700 15px var(--sans); cursor: pointer; }
.result-kind { font: 600 12px var(--sans); text-transform: uppercase; letter-spacing: .05em; color: var(--blue); }

/* Footer */
.site-footer { background: var(--card); border-top: 1px solid var(--line); font: 14px/1.6 var(--sans); color: var(--muted); }
.site-footer .inner { max-width: var(--page); margin: 0 auto; padding: 28px var(--gutter); }
.site-footer a { color: var(--ink); }
.site-footer ul { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 4px 20px; }
.footer-logo { display: inline-block; margin-bottom: 14px; line-height: 0; }
.footer-logo img { height: 42px; width: auto; }

@media (max-width: 860px) {
	.wrap { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
	h1 { font-size: 25px; }
}
