/* Bircher Inc. site styles. Layout and palette follow the original
   "Solid State" theme by HTML5 UP (CCA 3.0), rewritten as plain CSS. */

@font-face {
	font-family: "Raleway";
	src: url("../fonts/raleway-latin-wght-normal.woff2") format("woff2");
	font-weight: 100 900;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: "Source Sans 3";
	src: url("../fonts/source-sans-3-latin-wght-normal.woff2") format("woff2");
	font-weight: 200 900;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: "Source Sans 3";
	src: url("../fonts/source-sans-3-latin-wght-italic.woff2") format("woff2");
	font-weight: 200 900;
	font-style: italic;
	font-display: swap;
}

:root {
	--blue: #1d508d;
	--blue-deep-1: #163c6a;
	--blue-deep-2: #13355e;
	--blue-deep-3: #0f2e52;
	--fg: #fff;
	--fg-muted: rgb(255 255 255 / 0.75);
	--fg-faint: rgb(255 255 255 / 0.35);
	--border: rgb(255 255 255 / 0.125);
	--border-strong: rgb(255 255 255 / 0.25);
	--field-bg: rgb(0 0 0 / 0.1);
	--field-bg-focus: rgb(0 0 0 / 0.2);
	--hover-bg: rgb(255 255 255 / 0.075);
	--error: #ff9a9a;
	--success: #7be07d;

	--font-body: "Source Sans 3", "Source Sans Pro", system-ui, sans-serif;
	--font-heading: "Raleway", system-ui, sans-serif;
	--kerning: 0.1em;
	--radius: 5px;
	--inner: 56rem;
	--gutter: clamp(1.25rem, 5vw, 3rem);
	--section-space: clamp(3.5rem, 8vw, 7rem);
	--header-height: 3.5rem;

	color-scheme: dark;
}

/* Base */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-behavior: smooth;
	scroll-padding-top: var(--header-height);
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}
}

body {
	margin: 0;
	background: var(--blue);
	color: var(--fg);
	font-family: var(--font-body);
	font-size: clamp(1rem, 0.9rem + 0.3vw, 1.125rem);
	font-weight: 350;
	line-height: 1.65;
}

[hidden]:not([hidden="until-found"]) {
	display: none !important;
}

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

img {
	height: auto;
}

h1,
h2,
h3,
h4 {
	margin: 0 0 1em;
	font-family: var(--font-heading);
	font-weight: 700;
	letter-spacing: var(--kerning);
	line-height: 1.5;
	text-transform: uppercase;
	text-wrap: balance;
}

h1 {
	font-size: clamp(1.75rem, 1.4rem + 1.5vw, 2.25rem);
}

h2 {
	font-size: 1.25em;
}

h3 {
	font-size: 1em;
}

h4 {
	font-size: 0.8em;
}

p,
ul,
ol,
address {
	margin: 0 0 1.5em;
}

address {
	font-style: normal;
}

strong {
	font-weight: 600;
}

a {
	color: inherit;
	text-decoration: underline dotted 1px var(--fg-faint);
	text-underline-offset: 0.25em;
	transition: text-decoration-color 0.2s ease-in-out;

	&:hover {
		text-decoration-color: transparent;
	}
}

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

.major {
	padding-bottom: 1em;
	border-bottom: 2px solid var(--border);
}

.icon {
	width: 1em;
	height: 1em;
	flex: none;
}

.inner {
	width: min(100% - 2 * var(--gutter), var(--inner));
	margin-inline: auto;
}

.skip-link {
	position: absolute;
	top: 0.5rem;
	left: 0.5rem;
	z-index: 100;
	padding: 0.5em 1em;
	background: var(--blue-deep-3);
	transform: translateY(-200%);

	&:focus {
		transform: none;
	}
}

/* Header and menu */

.site-header {
	position: fixed;
	inset: 0 0 auto;
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: var(--header-height);
	padding-inline: 1.25rem 0.75rem;
	background: var(--blue);
	font-family: var(--font-heading);
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: var(--kerning);
	text-transform: uppercase;
}

/* Over the hero the header starts transparent and fills in as the page
   scrolls. Browsers without scroll-driven animations keep it solid. */
@supports (animation-timeline: scroll()) {
	.site-header {
		animation: header-fill linear both;
		animation-timeline: scroll();
		animation-range: 0 12rem;
	}

	body:has(.hero--home) .site-header__brand {
		animation: brand-reveal linear both;
		animation-timeline: scroll();
		animation-range: 6rem 12rem;
	}
}

@keyframes header-fill {
	from {
		background-color: transparent;
	}
}

@keyframes brand-reveal {
	from {
		opacity: 0;
	}
}

.site-header__brand {
	text-decoration: none;
}

.menu-button,
.menu__close {
	display: inline-flex;
	align-items: center;
	gap: 0.75em;
	border: 0;
	border-radius: var(--radius);
	background: none;
	color: inherit;
	font: inherit;
	letter-spacing: inherit;
	text-transform: inherit;
	cursor: pointer;
	transition: background-color 0.2s ease-in-out;

	&:hover {
		background-color: var(--hover-bg);
	}
}

.menu-button {
	height: 2.75rem;
	padding-inline: 1.25em;
	box-shadow: inset 0 0 0 2px var(--border);
}

.menu {
	position: fixed;
	inset: 0 0 0 auto;
	width: min(100%, 20rem);
	height: 100dvh;
	margin: 0;
	padding: 2.5rem 2rem;
	border: 0;
	background: var(--blue-deep-1);
	color: var(--fg);
	box-shadow: 0 0 3rem rgb(0 0 0 / 0.35);
	transform: translateX(100%);
	transition:
		transform 0.35s ease,
		display 0.35s allow-discrete,
		overlay 0.35s allow-discrete;

	&:popover-open {
		transform: none;

		@starting-style {
			transform: translateX(100%);
		}
	}

	&::backdrop {
		background: rgb(0 0 0 / 0.4);
	}
}

@media (prefers-reduced-motion: reduce) {
	.menu {
		transition: none;
	}
}

.menu__close {
	position: absolute;
	top: 0.75rem;
	right: 0.75rem;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	font-size: 1.25rem;
}

.menu__title {
	font-size: 0.8rem;
}

.menu__links {
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 0.8rem;

	a {
		display: block;
		padding-block: 0.85em;
		border-top: 2px solid var(--border);
		text-decoration: none;

		&:hover,
		&[aria-current="page"] {
			color: var(--fg-muted);
		}
	}

	li:first-child a {
		border-top: 0;
	}
}

/* Hero: the home banner and the page title band */

.hero {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	padding-block: calc(var(--header-height) + clamp(3rem, 10vw, 7rem)) clamp(2.5rem, 6vw, 4.5rem);
	background: var(--blue);

	h1 {
		margin-bottom: 0.8em;
		padding-bottom: 0.4em;
		border-bottom: 2px solid var(--border);
	}
}

/* Shown at 20% over the blue, the same as the original theme's 80% overlay. */
.hero__backdrop {
	position: absolute;
	inset: 0;
	z-index: -1;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center 30%;
	opacity: 0.2;
}

.hero__tagline {
	margin: 0;
	font-family: var(--font-heading);
	font-weight: 300;
	letter-spacing: var(--kerning);
	line-height: 2;
	text-transform: uppercase;
	opacity: 0.9;
}

.hero--home {
	padding-block-end: clamp(3rem, 8vw, 6rem);

	h1 {
		font-size: clamp(2rem, 1.5rem + 2vw, 2.75rem);
	}
}

.hero__logo {
	width: 5rem;
	margin-bottom: 1.5rem;
}

@media (prefers-reduced-motion: no-preference) {
	.hero--home .inner > * {
		animation: rise 0.8s ease both;
	}

	.hero--home h1 {
		animation-delay: 0.15s;
	}

	.hero--home .hero__tagline {
		animation-delay: 0.3s;
	}
}

@keyframes rise {
	from {
		opacity: 0;
		transform: translateY(1rem);
	}
}

/* Sections */

.section {
	padding-block: var(--section-space);
}

.spotlight {
	background: var(--blue-deep-1);

	&.spotlight--2 {
		background: var(--blue-deep-2);
	}

	&.spotlight--3 {
		background: var(--blue-deep-3);
	}

	.inner {
		display: grid;
		gap: 1.5rem clamp(2rem, 5vw, 3.5rem);
		align-items: center;
	}

	@media (min-width: 48rem) {
		.inner {
			grid-template-columns: 1fr 18rem;
		}

		&:nth-of-type(even) .inner {
			grid-template-columns: 18rem 1fr;
		}

		&:nth-of-type(odd) .spotlight__image {
			order: 2;
		}
	}
}

.spotlight__image {
	width: min(100%, 18rem);
	aspect-ratio: 1;
	border-radius: 50%;
	object-fit: cover;
}

.spotlight__content > :last-child {
	margin-bottom: 0;
}

.more-links {
	padding: 0;
	list-style: none;
}

.more-link {
	display: inline-flex;
	align-items: center;
	gap: 0.85em;
	font-family: var(--font-heading);
	font-size: 0.8em;
	font-weight: 700;
	letter-spacing: var(--kerning);
	text-decoration: none;
	text-transform: uppercase;

	.icon {
		box-sizing: content-box;
		padding: 0.45em;
		border: 2px solid var(--border);
		border-radius: 50%;
		transition: background-color 0.2s ease-in-out;
	}

	&:hover .icon {
		background-color: var(--hover-bg);
	}
}

/* Long-form pages */

.prose {
	.inner > :last-child {
		margin-bottom: 0;
	}

	h2 {
		margin-top: 2.5em;
		padding-bottom: 1em;
		border-bottom: 2px solid var(--border);
		font-size: 1em;
	}

	h3 {
		margin-top: 2em;
		font-size: 0.8em;
	}

	ul,
	ol {
		padding-left: 1.25em;
	}

	li + li {
		margin-top: 0.35em;
	}

	&::after {
		content: "";
		display: table;
		clear: both;
	}
}

.figure {
	margin: 0 0 1.5em;

	img {
		border-radius: var(--radius);
	}

	figcaption {
		margin-top: 0.5em;
		color: var(--fg-muted);
		font-size: 0.9em;
	}
}

.figure--right {
	float: right;
	width: min(40%, 20rem);
	margin: 0.35em 0 1em 1.5em;
}

.video {
	margin: 0 0 1.5em;

	iframe {
		width: 100%;
		aspect-ratio: 16 / 9;
		border: 0;
		border-radius: var(--radius);
	}
}

/* Buttons and forms */

.button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 3.5em;
	padding-inline: 2.25em;
	border: 0;
	border-radius: var(--radius);
	background: transparent;
	box-shadow: inset 0 0 0 2px var(--border);
	color: var(--fg);
	font-family: var(--font-heading);
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: var(--kerning);
	text-transform: uppercase;
	cursor: pointer;
	transition: background-color 0.2s ease-in-out;

	&:hover {
		background-color: var(--hover-bg);
	}

	&:disabled {
		cursor: progress;
		opacity: 0.6;
	}
}

.field {
	margin-bottom: 1.5em;
}

label {
	display: block;
	margin-bottom: 0.7em;
	font-family: var(--font-heading);
	font-size: 0.8em;
	font-weight: 700;
	letter-spacing: var(--kerning);
	text-transform: uppercase;
}

input,
textarea {
	display: block;
	width: 100%;
	padding: 0.6em 1em;
	border: 2px solid var(--border);
	border-radius: var(--radius);
	background: var(--field-bg);
	color: inherit;
	font: inherit;
	transition:
		border-color 0.2s ease-in-out,
		background-color 0.2s ease-in-out;

	&:focus {
		border-color: var(--border-strong);
		background-color: var(--field-bg-focus);
		outline: none;
	}

	&[aria-invalid="true"] {
		border-color: var(--error);
	}
}

textarea {
	min-height: 8em;
	resize: vertical;
}

.field__error {
	margin: 0.5em 0 0;
	color: var(--error);
	font-weight: 600;
}

/* Footer and contact form */

.site-footer {
	padding-block: var(--section-space) 2.5rem;
	background: var(--blue-deep-1);

	.lead strong {
		display: block;
	}
}

.site-footer__grid {
	display: grid;
	gap: 2.5rem clamp(2rem, 6vw, 4rem);

	@media (min-width: 48rem) {
		grid-template-columns: 1.2fr 1fr;
	}
}

.contact-form__trap {
	position: absolute;
	left: -10000px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.contact-form__status {
	margin: 0 0 1.25em;
	font-weight: 600;

	&:empty {
		display: none;
	}

	[data-state="error"] > & {
		color: var(--error);
	}

	[data-state="sent"] > & {
		color: var(--success);
	}
}

@media (scripting: none) {
	.contact-form {
		display: none;
	}
}

.contact-list {
	margin: 0;
	padding: 0;
	list-style: none;

	li {
		display: grid;
		grid-template-columns: 2.5rem 1fr;
		gap: 1rem;
		align-items: start;
		margin-bottom: 1.5em;
	}

	.icon {
		box-sizing: content-box;
		width: 1rem;
		height: 1rem;
		padding: 0.6rem;
		border: 2px solid var(--border);
		border-radius: 50%;
	}

	li > :last-child {
		margin: 0;
		padding-top: 0.45em;
	}
}

.site-footer__bottom {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1rem 2rem;
	margin-top: 3rem;
	padding-top: 2rem;
	border-top: 2px solid var(--border);
	color: var(--fg-muted);
	font-size: 0.9em;

	p {
		margin: 0;
	}
}

.site-footer__logo img {
	width: auto;
	height: 3.5rem;
	opacity: 0.35;
	transition: opacity 0.2s ease-in-out;
}

.site-footer__logo:hover img {
	opacity: 0.6;
}
