/*
 * Site chrome: utility bar, header + Services dropdown, mobile drawer, footer,
 * call bar, scroll reveal, 404.
 *
 * Ported from the homepage design (designs/showcase-landscaping/assets/css/
 * showcase.css). The drawer follows the Calgary City Roofing pattern
 * (designs/_reference/mobile-menu-pattern.md). Consumes the --sc-* tokens from
 * design-system.css, which is enqueued first. IDs/classes are wired to
 * header.php, footer.php and assets/js/theme.js.
 *
 * NOT LOADED IN THE EDITOR (only design-system.css + editor.css are). Keep
 * front-end-only behaviour such as reveal in this file.
 */

/* --------------------------------------------------------------- utility --- */

.sc-utility {
	background: var(--sc-forest);
	color: var(--sc-on-dark-2);
	font-size: var(--sc-step--1);
}

.sc-utility .sc-wrap {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	min-height: 38px;
}

.sc-utility a {
	color: var(--sc-on-dark);
	text-decoration: none;
	font-weight: 600;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.sc-utility a:hover {
	color: var(--sc-leaf);
}

.sc-utility__area {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.sc-utility__area svg {
	color: var(--sc-leaf);
}

/* ---------------------------------------------------------------- header --- */

.sc-header {
	position: sticky;
	top: 0;
	z-index: 40;
	background: var(--sc-white);
	border-bottom: 1px solid var(--sc-line);
}

/* Logged-in editors: sit below the admin bar instead of under it. Below 600px
   the admin bar scrolls away (position: absolute), so 0 is right there. */
.admin-bar .sc-header {
	top: 32px;
}

@media (max-width: 782px) {
	.admin-bar .sc-header {
		top: 46px;
	}
}

@media (max-width: 600px) {
	.admin-bar .sc-header {
		top: 0;
	}
}

.sc-header__row {
	display: flex;
	align-items: center;
	gap: 28px;
	min-height: var(--sc-header-h);
}

.sc-brand {
	display: flex;
	align-items: center;
	flex: none;
}

.sc-brand img {
	height: 52px;
	width: auto;
}

.sc-nav {
	display: flex;
	align-items: center;
	gap: 4px;
	margin-left: auto;
}

.sc-nav > a,
.sc-nav__group > button {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 44px;
	padding: 0 14px;
	color: var(--sc-ink);
	font: 600 1rem var(--sc-text);
	text-decoration: none;
	background: none;
	border: 0;
	border-radius: var(--sc-radius);
	cursor: pointer;
}

.sc-nav > a:hover,
.sc-nav__group > button:hover,
.sc-nav__group.is-open > button {
	background: var(--sc-stone);
	color: var(--sc-forest);
}

.sc-nav__group {
	position: relative;
}

.sc-nav__group > button svg {
	transition: transform 0.2s var(--sc-ease);
}

.sc-nav__group.is-open > button svg {
	transform: rotate(180deg);
}

.sc-nav__menu {
	position: absolute;
	top: calc(100% + 10px);
	left: 50%;
	translate: -50% 0;
	width: 560px;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 2px;
	padding: 12px;
	background: var(--sc-white);
	border: 1px solid var(--sc-line);
	border-radius: var(--sc-radius-lg);
	box-shadow: var(--sc-shadow-lg);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-6px);
	transition: opacity 0.2s var(--sc-ease), transform 0.2s var(--sc-ease), visibility 0s linear 0.2s;
}

.sc-nav__group.is-open .sc-nav__menu {
	opacity: 1;
	visibility: visible;
	transform: none;
	transition: opacity 0.2s var(--sc-ease), transform 0.2s var(--sc-ease), visibility 0s;
}

.sc-nav__menu a {
	display: flex;
	align-items: center;
	min-height: 44px;
	padding: 8px 12px;
	border-radius: 6px;
	color: var(--sc-ink);
	font-weight: 500;
	text-decoration: none;
	font-size: 0.975rem;
}

.sc-nav__menu a:hover {
	background: var(--sc-stone);
	color: var(--sc-forest);
}

.sc-nav__menu .sc-nav__all {
	grid-column: 1 / -1;
	border-top: 1px solid var(--sc-line);
	margin-top: 6px;
	padding-top: 14px;
	font-weight: 700;
	color: var(--sc-forest);
}

.sc-header__actions {
	display: flex;
	align-items: center;
	gap: 14px;
}

.sc-header__tel {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	color: var(--sc-forest);
	font-weight: 700;
	text-decoration: none;
	white-space: nowrap;
}

.sc-header__tel svg {
	width: 1.15em;
	height: 1.15em;
	color: var(--sc-olive);
}

.sc-burger {
	display: none;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 0 4px;
	border: 0;
	background: transparent;
	color: var(--sc-forest);
	font: 700 1rem var(--sc-text);
	cursor: pointer;
}

.sc-burger svg {
	width: 24px;
	height: 24px;
}

/* Collapse where the desktop row actually stops fitting (logo + 4 links +
   phone + CTA), not at a generic tablet width. */
@media (max-width: 1120px) {
	.sc-nav {
		display: none;
	}

	.sc-burger {
		display: inline-flex;
	}

	.sc-header__actions {
		margin-left: auto;
	}
}

/* Phone bar: logo + phone icon + labelled Menu, nothing else. */
@media (max-width: 640px) {
	.sc-utility {
		display: none;
	}

	.sc-header__actions .sc-btn,
	.sc-header__tel span {
		display: none;
	}

	.sc-header__tel {
		width: 44px;
		justify-content: center;
		border-radius: 50%;
		background: var(--sc-stone);
	}

	.sc-brand img {
		height: 42px;
	}
}

/* ------------------------------------------------------- burger + drawer --- */

.sc-scrim {
	position: fixed;
	inset: 0;
	z-index: 70;
	background: rgba(16, 24, 12, 0.6);
	opacity: 0;
	transition: opacity 0.3s var(--sc-ease);
}

.sc-scrim.is-open {
	opacity: 1;
}

/* visibility (with a delayed transition) rather than display:none, so closed
   links are unreachable by Tab and screen readers but the slide-out still
   animates. */
.sc-mobile {
	position: fixed;
	inset: 0 0 0 auto;
	z-index: 80;
	width: min(88vw, 380px);
	display: flex;
	flex-direction: column;
	background: var(--sc-forest);
	color: var(--sc-on-dark);
	transform: translateX(100%);
	visibility: hidden;
	transition: transform 0.35s var(--sc-ease), visibility 0s linear 0.35s;
}

.sc-mobile.is-open {
	transform: none;
	visibility: visible;
	transition: transform 0.35s var(--sc-ease), visibility 0s;
}

.admin-bar .sc-mobile {
	top: 32px;
}

@media (max-width: 782px) {
	.admin-bar .sc-mobile {
		top: 46px;
	}
}

.sc-mobile__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px var(--sc-gutter);
	background: var(--sc-white);
}

.sc-mobile__head img {
	height: 40px;
	width: auto;
}

.sc-mobile__close {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 50%;
	background: var(--sc-stone);
	color: var(--sc-forest);
	cursor: pointer;
}

.sc-mobile__close svg {
	width: 22px;
	height: 22px;
}

.sc-mobile__nav {
	flex: 1;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 6px var(--sc-gutter);
}

.sc-mobile__link {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 15px 0;
	border-bottom: 1px solid var(--sc-line-dark);
	color: var(--sc-on-dark);
	font: 600 1.125rem var(--sc-text);
	text-decoration: none;
}

.sc-mobile__link:hover {
	color: var(--sc-leaf);
}

.sc-mobile__group > summary {
	list-style: none;
	cursor: pointer;
}

.sc-mobile__group > summary::-webkit-details-marker {
	display: none;
}

.sc-mobile__group > summary svg {
	width: 20px;
	height: 20px;
	transition: transform 0.2s var(--sc-ease);
}

.sc-mobile__group[open] > summary svg {
	transform: rotate(180deg);
}

.sc-mobile__sublink {
	display: block;
	padding: 12px 0 12px 16px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
	color: var(--sc-on-dark-2);
	font: 500 1.0625rem var(--sc-text);
	text-decoration: none;
}

.sc-mobile__sublink:hover {
	color: var(--sc-on-dark);
}

.sc-mobile__foot {
	display: grid;
	gap: 14px;
	padding: 20px var(--sc-gutter) 28px;
	border-top: 1px solid var(--sc-line-dark);
}

.sc-mobile__tel {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 44px;
	color: var(--sc-on-dark);
	font: 700 1.25rem var(--sc-text);
	text-decoration: none;
}

.sc-mobile__tel:hover {
	color: var(--sc-leaf);
}

.sc-mobile__tel svg {
	width: 20px;
	height: 20px;
	color: var(--sc-leaf);
}

/* ---------------------------------------------------------------- footer --- */

.sc-footer {
	background: var(--sc-forest-deep);
	color: var(--sc-on-dark-2);
	padding-block: 64px 28px;
	font-size: 0.975rem;
}

.sc-footer a {
	color: var(--sc-on-dark);
	text-decoration: none;
}

.sc-footer a:hover {
	color: var(--sc-leaf);
	text-decoration: underline;
}

.sc-footer__top {
	display: grid;
	grid-template-columns: 1.3fr 1fr 1fr;
	gap: 40px;
}

.sc-footer__top > * {
	min-width: 0;
}

.sc-footer__brand {
	display: grid;
	gap: 16px;
	align-content: start;
}

.sc-footer .sc-footer__logo {
	background: var(--sc-white);
	border-radius: var(--sc-radius);
	padding: 10px 14px;
	width: fit-content;
}

.sc-footer__logo img {
	height: 46px;
	width: auto;
}

.sc-footer__title {
	font: 700 1rem var(--sc-text);
	color: var(--sc-on-dark);
	letter-spacing: 0;
	margin-bottom: 12px;
}

.sc-footer ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 2px;
}

.sc-footer ul a {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 40px;
	overflow-wrap: anywhere;
}

.sc-footer__badges {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	margin-top: 40px;
	padding-top: 28px;
	border-top: 1px solid var(--sc-line-dark);
}

.sc-footer__badges span {
	background: var(--sc-white);
	border-radius: var(--sc-radius);
	padding: 8px;
	display: grid;
	place-items: center;
	height: 72px;
}

.sc-footer__badges img {
	height: 56px;
	width: auto;
}

.sc-social {
	display: flex;
	gap: 8px;
}

.sc-footer .sc-social a {
	width: 44px;
	height: 44px;
	display: grid;
	place-items: center;
	border-radius: 50%;
	border: 1px solid var(--sc-line-dark);
}

.sc-footer .sc-social a:hover {
	background: var(--sc-forest-2);
	text-decoration: none;
}

.sc-footer__legal {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 12px 24px;
	margin-top: 28px;
	font-size: var(--sc-step--1);
}

.sc-footer .sc-footer__legal ul {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 20px;
}

.sc-footer .sc-footer__legal ul a {
	min-height: 32px;
}

@media (max-width: 900px) {
	.sc-footer__top {
		grid-template-columns: 1fr 1fr;
	}

	.sc-footer__brand {
		grid-column: 1 / -1;
	}
}

@media (max-width: 640px) {
	.sc-footer__top {
		grid-template-columns: 1fr;
	}
}

/* -------------------------------------------------------------- call bar ---
   Phones only. theme.js slides it in once the hero's buttons have scrolled
   away; the body gets bottom padding so it never covers the footer's end. */

.sc-callbar {
	display: none;
}

@media (max-width: 640px) {
	.sc-callbar:not([hidden]) {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 8px;
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 30;
		padding: 8px var(--sc-gutter) calc(8px + env(safe-area-inset-bottom));
		background: var(--sc-white);
		border-top: 1px solid var(--sc-line);
		box-shadow: 0 -8px 24px -12px rgba(27, 36, 20, 0.3);
		transition: transform 0.35s var(--sc-ease);
	}

	.sc-callbar.is-away {
		transform: translateY(110%);
	}

	.sc-callbar .sc-btn {
		min-height: 48px;
		padding: 0 12px;
	}

	body {
		padding-bottom: 72px;
	}
}

/* --------------------------------------------------------- scroll reveal ---
   The design's entry motion: media rise 18px and fade in as they scroll into
   view. Content is VISIBLE by default; theme.js adds .is-in to start the
   animation, so if the script never runs nothing is left hidden. Blocks put
   .sc-reveal on photos, tiles and sliders (front end only, never edit.tsx). */

.sc-reveal.is-in {
	animation: sc-rise 0.7s var(--sc-ease) both;
}

@keyframes sc-rise {
	from {
		opacity: 0.001;
		transform: translateY(18px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

/* ------------------------------------------------------------------- 404 --- */

/* The hero block (no photo) carries the H1 and buttons; see 404.php. */

.showcase-404__links {
	padding: clamp(28px, 4vw, 44px) 0;
}

.showcase-404__links ul {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.showcase-404__links a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 10px 16px;
	border: 1px solid var(--sc-line);
	border-radius: 99px;
	background: var(--sc-white);
	color: var(--sc-forest);
	font-weight: 650;
	text-decoration: none;
}
