/*
Theme Name: ODSSBC Swoop
Theme URI: https://odssbc.ca/
Author: ODSSBC
Description: An accessible (WCAG 2.2 AA) theme with a blue and orange swoop header over a full-width photo gallery, a services grid on the front page, and a matching swoop footer with contact details and social links.
Version: 1.6.1
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: odssbc-swoop
Tags: accessibility-ready, custom-logo, custom-menu, featured-images, one-column, translation-ready
*/

/* ==========================================================================
   1. Design tokens
   ========================================================================== */
:root {
	/* Colours matched to the logo */
	--blue: #020066;        /* header & footer; white text on this = 17.6:1 */
	--blue-dark: #01003d;   /* menus, footer bar; white text = 19.7:1 */
	--sky: #0094ff;         /* logo's bright blue — decorative accents only */
	--orange: #ff6633;      /* logo orange — decorative; dark text on this = 5.7:1 */
	--orange-dark: #b83d0f; /* orange for text/links on white = 5.7:1 */
	--ink: #1b1f24;
	--ink-soft: #444b55;
	--paper: #ffffff;
	--paper-alt: #f4f6f9;
	--focus: #ffd23f;
	--radius: 12px;
	--gutter: clamp(1rem, 3vw, 2rem);
	--max: 72rem;

	/* Swoop geometry (all relative to viewport height) */
	--hero-h: 40vh;          /* photo gallery height */
	--swoop-h: 22.5vh;       /* orange reaches 22.5% on the left */
	--hero-min: 17rem;       /* guards for very short windows / 200% zoom */
	--swoop-min: 12rem;
	--footer-swoop-h: clamp(3.5rem, 9vw, 7rem);
	--section-pad: clamp(2rem, 5vw, 3.5rem);
}

/* ==========================================================================
   2. Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	font-size: 1.0625rem;
	line-height: 1.6;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--blue); text-underline-offset: 0.15em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

h1, h2, h3, h4 { line-height: 1.2; color: var(--blue-dark); }

:focus-visible {
	outline: 3px solid var(--focus);
	outline-offset: 2px;
	box-shadow: 0 0 0 6px var(--ink);
	border-radius: 2px;
}

.screen-reader-text {
	border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%);
	height: 1px; width: 1px; margin: -1px; overflow: hidden; padding: 0;
	position: absolute !important; word-wrap: normal !important;
}

.skip-link:focus {
	clip: auto; clip-path: none; height: auto; width: auto; margin: 0;
	position: fixed !important; top: 0.75rem; left: 0.75rem; z-index: 1000;
	padding: 0.75rem 1.25rem; background: var(--paper); color: var(--ink);
	font-weight: 700; border-radius: 6px;
}

/* ==========================================================================
   3. Hero: gallery behind the swoop
   ========================================================================== */
.site-hero {
	position: relative;
	height: var(--hero-h);
	min-height: var(--hero-min);
	background: var(--blue-dark);
	isolation: isolate;
}

/* Photo gallery — full width, 40% of the viewport high, behind the swoop */
.hero-gallery {
	position: absolute;
	inset: 0;
	z-index: 0;
	display: flex;
	margin: 0;
	padding: 0;
	list-style: none;
	overflow: hidden;
}
.hero-gallery__item { flex: 1 1 0; min-width: 0; margin: 0; position: relative; }
.hero-gallery__item + .hero-gallery__item { border-left: 3px solid var(--paper); }
.hero-gallery__item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center 65%;
}

/* The swoop itself */
.site-header {
	position: absolute;
	top: 0; left: 0; right: 0;
	z-index: 10;
	height: var(--swoop-h);
	min-height: var(--swoop-min);
	color: #fff;
}
.swoop {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	z-index: -1;
	pointer-events: none;
	filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.25));
}
.swoop__orange { fill: var(--orange); }
.swoop__blue   { fill: var(--blue); }

/* Content sitting in the top of the swoop */
.site-header__inner {
	position: relative;
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem 2rem;
	padding: 0.6rem var(--gutter) 0;
}

/* Branding: logo on the left, title + slogan beside it on the right */
.site-branding {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: clamp(0.6rem, 1.2vw, 1rem);
	min-width: 0;
	flex: 0 1 auto;
}
.site-branding .custom-logo-link { flex: 0 0 auto; display: block; }
.site-branding .custom-logo {
	height: clamp(3rem, 11vh, 6.5rem);
	width: auto;
	max-width: none;
}
.site-branding__text { display: flex; flex-direction: column; min-width: 0; }
.site-title {
	margin: 0;
	font-size: clamp(1.2rem, 2.2vw, 2rem);
	font-weight: 700;
	line-height: 1.15;
	color: #fff;
	text-wrap: balance; /* even line lengths when a long title wraps */
}
.site-title a { color: inherit; text-decoration: none; }
.site-title a:hover { text-decoration: underline; }
.site-description {
	margin: 0.2rem 0 0;
	font-size: clamp(0.85rem, 1.15vw, 1.05rem);
	line-height: 1.3;
	color: #fff;
	opacity: 0.95;
}

/* ==========================================================================
   4. Primary navigation — compact so it fits in the thin right of the swoop
   ========================================================================== */
.main-navigation { flex: 0 1 auto; position: relative; margin-top: -0.3rem; }

.main-navigation ul { list-style: none; margin: 0; padding: 0; }

.main-navigation .menu {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 0.15rem;
}

.main-navigation a {
	display: flex;
	align-items: center;
	min-height: 2rem;              /* ≥ 24px target size (WCAG 2.5.8) */
	padding: 0.2rem clamp(0.45rem, 0.8vw, 0.8rem);
	color: #fff;
	font-size: clamp(0.875rem, 0.95vw, 1rem);
	font-weight: 600;
	white-space: nowrap;
	text-decoration: none;
	border-radius: 6px;
}
.main-navigation a:hover,
.main-navigation .current-menu-item > a,
.main-navigation .current_page_item > a {
	background: rgba(255, 255, 255, 0.16);
	text-decoration: underline;
	text-decoration-thickness: 2px;
}
.main-navigation .current-menu-item > a,
.main-navigation .current_page_item > a { box-shadow: inset 0 -3px 0 var(--orange); }

/* Drop-downs */
.main-navigation li { position: relative; }
.main-navigation .sub-menu,
.main-navigation .children {
	position: absolute;
	top: 100%;
	right: 0;
	min-width: 14rem;
	padding: 0.4rem;
	background: var(--blue-dark);
	border-top: 4px solid var(--orange);
	border-radius: 0 0 8px 8px;
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
	display: none;
	z-index: 30;
}
.main-navigation .sub-menu .sub-menu,
.main-navigation .children .children { top: 0; right: 100%; }
.main-navigation li:hover > .sub-menu,
.main-navigation li:focus-within > .sub-menu,
.main-navigation li:hover > .children,
.main-navigation li:focus-within > .children { display: block; }
.main-navigation.submenus-dismissed li > .sub-menu,
.main-navigation.submenus-dismissed li > .children { display: none; }
.main-navigation .sub-menu a,
.main-navigation .children a { white-space: normal; }

/* Menu toggle (shown on narrow screens) */
.menu-toggle {
	display: none;
	align-items: center;
	gap: 0.5rem;
	min-height: 2.75rem;
	padding: 0.4rem 0.9rem;
	color: #fff;
	background: transparent;
	border: 2px solid #fff;
	border-radius: 8px;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}
.menu-toggle__bars, .menu-toggle__bars::before, .menu-toggle__bars::after {
	display: block; width: 1.2rem; height: 2px; background: currentColor; content: ""; position: relative;
}
.menu-toggle__bars::before { position: absolute; top: -6px; }
.menu-toggle__bars::after  { position: absolute; top: 6px; }

@media (max-width: 64em) {
	.menu-toggle { display: inline-flex; }
	.main-navigation .menu {
		display: none;
		position: absolute;
		top: calc(100% + 0.5rem);
		right: 0;
		width: min(20rem, calc(100vw - 2 * var(--gutter)));
		flex-direction: column;
		align-items: stretch;
		padding: 0.5rem;
		background: var(--blue-dark);
		border-top: 4px solid var(--orange);
		border-radius: 0 0 10px 10px;
		box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
	}
	.main-navigation.is-open .menu { display: flex; }
	.main-navigation a { white-space: normal; min-height: 2.75rem; font-size: 1rem; }
	.main-navigation .sub-menu,
	.main-navigation .sub-menu .sub-menu,
	.main-navigation .children,
	.main-navigation .children .children,
	.main-navigation.submenus-dismissed li > .sub-menu,
	.main-navigation.submenus-dismissed li > .children {
		display: block; position: static; box-shadow: none; border: 0;
		background: transparent; padding: 0 0 0 1rem; min-width: 0;
	}
}

/* Narrow phones: logo + text still side by side, just smaller */
@media (max-width: 40em) {
	.hero-gallery__item:nth-child(n+3) { display: none; } /* two photos on phones */
}
@media (max-width: 30em) {
	.site-header__inner { padding-top: 0.5rem; }
	.site-branding .custom-logo { height: 2.6rem; }
	.site-title { font-size: 1.1rem; }
	.site-description { font-size: 0.78rem; max-width: 11rem; }
	.menu-toggle { min-height: 2.5rem; padding: 0.3rem 0.7rem; }
}

/* ==========================================================================
   5. Content
   ========================================================================== */
.site-main { padding: clamp(2rem, 5vw, 3.5rem) var(--gutter); }
.container { max-width: var(--max); margin: 0 auto; }
.entry-content > * { max-width: 46rem; }
.entry-content > .alignwide { max-width: var(--max); }
.entry-content > .alignfull { max-width: none; }

.entry-title { font-size: clamp(1.75rem, 3.5vw, 2.6rem); margin: 0 0 1rem; }
.entry-meta { color: var(--ink-soft); font-size: 0.95rem; }

.post-list { display: grid; gap: 2.5rem; }
.post-list article { border-bottom: 1px solid #d5dae1; padding-bottom: 2rem; }

.button, .wp-block-button__link, input[type="submit"] {
	display: inline-block;
	min-height: 2.75rem;
	padding: 0.65rem 1.4rem;
	background: var(--blue);
	color: #fff;
	border: 0;
	border-radius: 999px;
	font: inherit;
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
}
.button:hover, .wp-block-button__link:hover, input[type="submit"]:hover { background: var(--blue-dark); text-decoration: underline; }

input, textarea, select { font: inherit; padding: 0.55rem 0.7rem; border: 2px solid #6b7480; border-radius: 6px; }

/* ==========================================================================
   6. Services grid (front page)
   ========================================================================== */
.services { padding: clamp(2rem, 5vw, 3.5rem) var(--gutter); background: var(--paper-alt); }
.services__title { text-align: center; margin: 0 0 0.5rem; font-size: clamp(1.6rem, 3vw, 2.3rem); }
.services__intro { text-align: center; color: var(--ink-soft); margin: 0 auto 2rem; max-width: 40rem; }
.services__grid {
	display: flex;
	flex-wrap: wrap;
	justify-content: center; /* a short last row (e.g. 3 + 2) stays centred */
	gap: clamp(1rem, 2.5vw, 1.75rem);
	list-style: none;
	margin: 0;
	padding: 0;
}
.service-card {
	flex: 0 1 min(100%, 21rem);
	position: relative;
	display: flex;
	flex-direction: column;
	background: var(--paper);
	border-radius: var(--radius);
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 6px 16px rgba(2, 0, 102, 0.08);
	border-top: 6px solid var(--orange);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.service-card:hover, .service-card:focus-within {
	transform: translateY(-3px);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.14), 0 12px 28px rgba(2, 0, 102, 0.16);
}
.service-card__media img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.service-card__body { padding: 1.1rem 1.25rem 1.4rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.service-card__title { margin: 0; font-size: 1.25rem; }
.service-card__title a { color: var(--blue-dark); text-decoration: none; }
.service-card__title a::after { content: ""; position: absolute; inset: 0; } /* whole card clickable */
.service-card__title a:hover { text-decoration: underline; }
.service-card__title a:focus-visible { outline: none; box-shadow: none; }
.service-card:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; }
.service-card:nth-child(even) { border-top-color: var(--sky); }
.service-card__excerpt { margin: 0; color: var(--ink-soft); }
.service-card__more { margin-top: auto; font-weight: 700; color: var(--orange-dark); }

/* ==========================================================================
   7. Footer: orange + blue swoop at the bottom
   ========================================================================== */
/* The footer swoop overlaps the last section, so the colour above the curve is
   always that section's own background (white or light grey), never a mismatch. */
.site-footer { position: relative; z-index: 1; color: #fff; margin-top: calc(-1 * var(--footer-swoop-h)); }
.footer-swoop { display: block; width: 100%; height: var(--footer-swoop-h); margin-bottom: -1px; }
#content > .site-main:last-child,
.site-main-wrap > :last-child { padding-bottom: calc(var(--section-pad) + var(--footer-swoop-h)); }
.site-main-wrap:has(> .screen-reader-text:last-child) { padding-bottom: var(--footer-swoop-h); }
.footer-swoop .swoop__orange { fill: var(--orange); }
.footer-swoop .swoop__blue { fill: var(--blue); }
.site-footer__body { background: var(--blue); padding: 0.5rem var(--gutter) 2rem; }
.site-footer__grid {
	max-width: var(--max);
	margin: 0 auto;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
	gap: 2rem;
}
.site-footer h2 { color: #fff; font-size: 1.15rem; margin: 0 0 0.75rem; padding-bottom: 0.4rem; border-bottom: 3px solid var(--orange); display: inline-block; }
.site-footer a { color: #fff; }
.site-footer address { font-style: normal; }
.contact-list, .footer-menu, .social-links, .instagram-list { list-style: none; margin: 0; padding: 0; }
.contact-list .contact-phone { font-size: 1.2rem; font-weight: 700; }
.instagram-list { margin-bottom: 1rem; }
.instagram-list li + li { margin-top: 0.35rem; }
.instagram-list a {
	display: inline-flex; align-items: center; gap: 0.6rem;
	min-height: 2.75rem; padding: 0.2rem 0.9rem 0.2rem 0.3rem;
	border-radius: 999px; font-weight: 700; text-decoration: none;
	overflow-wrap: anywhere;
}
.instagram-list a:hover { text-decoration: underline; background: rgba(255, 255, 255, 0.1); }
.instagram-list svg {
	flex: 0 0 auto; width: 2.25rem; height: 2.25rem; padding: 0.45rem;
	border-radius: 50%; background: var(--orange); fill: #1b1f24;
}
.contact-list li { margin-bottom: 0.4rem; }
.footer-menu li { margin-bottom: 0.35rem; }
.social-links { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.social-links a {
	display: inline-flex; align-items: center; justify-content: center;
	width: 2.75rem; height: 2.75rem; border-radius: 50%;
	background: rgba(255, 255, 255, 0.14); border: 2px solid rgba(255, 255, 255, 0.6);
}
.social-links a:hover { background: var(--orange); color: var(--ink); border-color: var(--orange); }
.social-links svg { width: 1.3rem; height: 1.3rem; fill: currentColor; }
.site-info { background: var(--blue-dark); text-align: center; padding: 0.9rem var(--gutter); font-size: 0.95rem; border-top: 4px solid var(--orange); }

/* ==========================================================================
   8. Motion & forced colours
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; animation: none !important; }
	.service-card:hover, .service-card:focus-within { transform: none; }
}

@media (forced-colors: active) {
	/* Keep the brand colours so the white header text stays on the blue swoop */
	.site-header, .site-footer__body, .site-info, .swoop, .footer-swoop { forced-color-adjust: none; }
	.main-navigation .menu, .main-navigation .sub-menu { forced-color-adjust: none; }
	.service-card { border: 1px solid CanvasText; }
}

/* WordPress core alignment classes */
.alignleft { float: left; margin: 0 1.5rem 1rem 0; }
.alignright { float: right; margin: 0 0 1rem 1.5rem; }
.aligncenter { margin-left: auto; margin-right: auto; }
.wp-caption-text, figcaption { font-size: 0.9rem; color: var(--ink-soft); }
.sticky, .bypostauthor, .gallery-caption { outline: 0; }
