/*
 * Theme layer over the Base44 Tailwind build (app.css): Framer Motion
 * equivalents, interaction states, and fixes for where Base44 breaks.
 */

/* Accessibility and form plumbing */
.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 100; padding: .75rem 1rem; border-radius: .5rem; background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); font-family: var(--font-heading); font-weight: 700; }
.skip-link:focus { top: 1rem; }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
:focus-visible { outline: 2px solid hsl(var(--primary)); outline-offset: 2px; }
html { scroll-behavior: smooth; }
section[id] { scroll-margin-top: 5rem; }

/* Hero. Base44 locks it to a 3:2 box, which crops the form on phones and
   leaves empty bands on desktop. Size it to the screen instead (content-height
   on phones), centre the content below the fixed header, and fade its bottom
   edge into the next section. */
.b44-hero { aspect-ratio: auto; display: flex; flex-direction: column; }
.b44-hero > .relative { flex: 1 1 auto; width: 100%; padding-top: 6.5rem; padding-bottom: 4rem; }
@media (min-width: 1024px) {
	.b44-hero { min-height: max(720px, min(100svh, 1000px)); }
	.b44-hero > .relative { padding-top: 7rem; padding-bottom: 5rem; }
}
/* Photo- and video-backed sections dissolve into their neighbours instead of meeting at a hard line. */
.b44-hero::after,
.b44-fade-y::before,
.b44-fade-y::after {
	content: ""; position: absolute; left: 0; right: 0; height: 7rem; z-index: 2; pointer-events: none;
}
.b44-hero::after { height: 9rem; }
/* -2px: the parallax layer's clipped edge falls on a fractional pixel and would show as a bright hairline. */
.b44-hero::after, .b44-fade-y::after { bottom: -2px; background: linear-gradient(to bottom, transparent, var(--fade-bottom) 92%); }
.b44-fade-y::before { top: -2px; background: linear-gradient(to top, transparent, var(--fade-top) 92%); }
.b44-fade-y { border-top-color: transparent !important; }
/* Each edge fades into the colour of the band it touches (Base44 alternates base navy and tinted bands). */
:root {
	--band-base: hsl(var(--background));
	--band-tint: color-mix(in srgb, hsl(var(--secondary)) 20%, hsl(var(--background)));
	--band-card: color-mix(in srgb, hsl(var(--card)) 40%, hsl(var(--background)));
}
.b44-hero, .b44-fade-y { --fade-top: var(--band-base); --fade-bottom: var(--band-base); }
#partners { --fade-bottom: var(--band-tint); }
#why-us { --fade-top: var(--band-tint); --fade-bottom: var(--band-card); }
#faq { --fade-top: var(--band-tint); }

/* The badge logo leads the hero, so the header copy stays hidden until scrolling. */
.is-home [data-header-logo] { opacity: 0; transition: opacity .35s ease; }
.is-home [data-b44-header].is-solid [data-header-logo] { opacity: 1; }

/* One vertical rhythm for every section after the hero. */
main > section:not(#home) { padding-top: 4.5rem; padding-bottom: 4.5rem; }
@media (min-width: 1024px) { main > section:not(#home) { padding-top: 6.5rem; padding-bottom: 6.5rem; } }

/* Partner logos sized by area (inline --lw from inc/b44-data.php). */
.b44-logo { width: calc(var(--lw) * .62); height: auto; max-width: 88%; }
@media (min-width: 1024px) { .b44-logo { width: var(--lw); } }
.b44-logo-cell { height: 7rem; }
@media (min-width: 1024px) { .b44-logo-cell { height: 9rem; } }

/* Service cards: extra shade so the spec line and copy read over busy photos. */
.b44-card-shade { background: linear-gradient(to top, hsl(var(--card) / .92) 0%, hsl(var(--card) / .78) 45%, hsl(var(--card) / .35) 100%); }

/* Phones: services and certifications become swipeable rows (next card peeks in). */
@media (max-width: 767px) {
	.b44-swipe { display: flex; gap: 1rem; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 1rem; margin-inline: -1rem; padding: .25rem 1rem 1rem; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
	.b44-swipe::-webkit-scrollbar { display: none; }
	.b44-swipe > * { flex: 0 0 84%; scroll-snap-align: start; }
}
@media (min-width: 640px) and (max-width: 767px) { .b44-swipe--trust { display: grid; overflow: visible; margin-inline: 0; padding: 0; } .b44-swipe--trust > * { flex: none; } }
.b44-dots { display: flex; justify-content: center; gap: .5rem; margin-top: .5rem; }
.b44-dots span { height: .375rem; width: .375rem; border-radius: 999px; background: hsl(var(--border)); transition: width .25s, background-color .25s; }
.b44-dots span.is-on { width: 1.5rem; background: hsl(var(--primary)); }
@media (min-width: 768px) { .b44-dots { display: none; } }

/* Gallery bento: 2 columns on phones, 4 on desktop (feature 2×2, drone 2×1 → six full rows). */
.b44-bento { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.b44-tile { position: relative; overflow: hidden; border-radius: .75rem; aspect-ratio: 4 / 3; background: hsl(var(--card)); }
.b44-tile img, .b44-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.b44-tile--feature { grid-column: span 2; aspect-ratio: 16 / 11; border-radius: 1rem; border: 1px solid hsl(var(--border)); }
.b44-tile--wide { grid-column: span 2; aspect-ratio: 16 / 9; }
@media (max-width: 1023px) {
	.b44-bento:not(.is-open) .b44-tile--more { display: none; }
}
@media (min-width: 1024px) {
	.b44-bento { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.5rem; }
	.b44-tile--feature { grid-row: span 2; aspect-ratio: auto; }
	.b44-tile--wide { aspect-ratio: auto; }
	.b44-more-wrap { display: none; }
}

/* Header: solid after scrolling (classes swapped in app.js). */
[data-b44-header] { transition-property: background-color, border-color, box-shadow, backdrop-filter; }
body.admin-bar [data-b44-header] { top: 32px; }
@media (max-width: 782px) { body.admin-bar [data-b44-header] { top: 46px; } }

/* Reveal animations (Framer Motion initial → whileInView / animate). */
html.js [data-reveal] {
	opacity: 0;
	transform: translate3d(var(--rx, 0), var(--ry, 20px), 0);
	transition: opacity var(--rd, .5s) ease var(--delay, 0s), transform var(--rd, .5s) cubic-bezier(.16, 1, .3, 1) var(--delay, 0s);
}
html.js [data-reveal="left"] { --ry: 0px; --rx: -80px; --rd: .7s; }
/* Headings rise out of a mask, line by line in effect (the clip opens upward). */
html.js [data-reveal="mask"] {
	--ry: .45em; --rd: .9s;
	clip-path: inset(-20% -10% 100% -10%);
	transition: clip-path 1s cubic-bezier(.16, 1, .3, 1) var(--delay, 0s), transform 1s cubic-bezier(.16, 1, .3, 1) var(--delay, 0s), opacity .6s ease var(--delay, 0s);
}
html.js [data-reveal="mask"].is-in { clip-path: inset(-20% -10% -20% -10%); }

/* Scroll-linked motion (values set in app.js): hero zoom/lift and gentle parallax. */
[data-hero-bg] { transform: scale(calc(1 + var(--hp, 0) * .25)) translate3d(0, calc(var(--hp, 0) * 10%), 0); will-change: transform; }
[data-hero-content] { transform: translate3d(0, calc(var(--hp, 0) * -160px), 0) scale(calc(1 - var(--hp, 0) * .04)); opacity: calc(1 - var(--hp, 0) * 1.15); }
[data-parallax] { transform: translate3d(0, var(--py, 0px), 0) scale(1.3); will-change: transform; }

/* Cards and tiles rise into place with a slight scale. */
html.js [data-reveal="rise"] { --ry: 70px; --rd: .8s; transform: translate3d(0, var(--ry), 0) scale(.94); }

/* Scroll progress: a thin gold line across the top. */
.b44-progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 60; background: linear-gradient(90deg, hsl(var(--accent)), hsl(var(--primary))); transform-origin: 0 50%; transform: scaleX(0); pointer-events: none; }
body.admin-bar .b44-progress { top: 32px; }

/* Lenis smooth scroll (required rules). */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }
/* GPU layers round their clip outward on fractional edges; keep the moving
   layers 2px inside each section so the hairline lands under the edge fades. */
section > div:has(> [data-parallax]), #partners > [data-parallax], #home > div:has([data-hero-bg]) { top: 2px; bottom: 2px; }
html.js [data-reveal="fade"] { --ry: 0px; }
html.js [data-reveal="scale"] { transform: scale(.95); }
html.js [data-reveal].is-in { opacity: 1; transform: none; }
html.js [data-reveal].is-settled { transition: opacity .2s ease, transform .3s cubic-bezier(.16, 1, .3, 1), border-color .15s, box-shadow .15s; }

/* Hover lifts (Framer whileHover). */
/* html.js prefix: must outrank "html.js [data-reveal].is-in { transform: none }". */
html.js .b44-lift.is-settled:hover, html:not(.js) .b44-lift:hover { transform: translateY(-6px); }
html.js .b44-lift--sm.is-settled:hover, html:not(.js) .b44-lift--sm:hover { transform: translateY(-4px); }
html.js .b44-zoom.is-settled:hover, html:not(.js) .b44-zoom:hover { transform: scale(1.02); }

/* Savings button pulse. */
@keyframes b44-pulse { 50% { transform: scale(1.18); } }
@keyframes b44-ping { 50% { transform: scale(1.4); opacity: .6; } }
.b44-pulse { animation: b44-pulse 1.8s ease-in-out infinite; }
.b44-ping { animation: b44-ping 1.8s ease-in-out infinite; }
.b44-savings { animation: b44-slide-in .5s ease .8s both; }
@keyframes b44-slide-in { from { opacity: 0; translate: 40px 0; } }

/* Reviews: slide in from the right. */
@keyframes b44-review-in { from { opacity: 0; transform: translateX(30px); } }
.b44-review.is-entering { animation: b44-review-in .3s ease; }

/* Quote form: multi-select interest checkboxes (real inputs, visually hidden). */
.b44-check [data-interest-box] { border-radius: 3px; }
.b44-check input:not(:checked) + [data-interest-box] svg { visibility: hidden; }
.b44-check:has(input:focus-visible) { outline: 2px solid hsl(var(--primary)); outline-offset: 2px; }

/* Solar Accreditation Australia badge beside the STC badge. */
.b44-saa { height: 4rem; }
@media (min-width: 640px) { .b44-saa { height: 5rem; } }

/* Calculator bar. */
.b44-bar { transition: width .6s ease-out; }

/* Gallery video tile once playing. */
[data-gallery-video].is-playing [data-video-chrome] { display: none; }
[data-gallery-video] video:not([hidden]) { display: block; }

/* Editorial pages (privacy, terms). */
.b44-prose { color: hsl(var(--foreground) / .8); font-size: 1rem; line-height: 1.75; }
.b44-prose > * + * { margin-top: 1.25em; }
.b44-prose h2, .b44-prose h3 { font-family: var(--font-heading); font-weight: 700; text-transform: uppercase; letter-spacing: -.01em; color: hsl(var(--foreground)); margin-top: 2em; }
.b44-prose h2 { font-size: 1.5rem; }
.b44-prose h3 { font-size: 1.125rem; }
.b44-prose a { color: hsl(var(--primary)); text-decoration: underline; text-underline-offset: 3px; }
.b44-prose ul { list-style: disc; padding-left: 1.25rem; }
.b44-prose ol { list-style: decimal; padding-left: 1.25rem; }

@media (prefers-reduced-motion: reduce) {
	html.js [data-reveal] { opacity: 1; transform: none; transition: none; clip-path: none; }
	[data-hero-bg], [data-hero-content], [data-parallax] { transform: none; opacity: 1; }
	.b44-progress { display: none; }
	.b44-pulse, .b44-ping, .b44-savings, .b44-review.is-entering { animation: none; }
	html { scroll-behavior: auto; }
}

/* Inline text link (Tailwind build has no .underline). */
.b44-link { text-decoration: underline; text-underline-offset: 2px; }
