/*
 * Arctic Trip – stylesheet.
 *
 * Colors, fonts, sizes and spacing are presets in theme.json and are changed under
 * Appearance → Editor → Styles. Layout pieces the WordPress blocks cannot do are custom
 * blocks in the Arctic Trip plugin, each with its own CSS. This file holds the base
 * element styles and the CSS of the block styles registered in inc/block-styles.php.
 *
 * Font sizes and spacing are fluid presets: they grow smoothly from 390px to 1280px wide
 * instead of jumping at breakpoints. Breakpoints (640px, 768px, 1024px) are only used
 * where the layout itself changes.
 */

:root {
	--at-transition: 150ms ease;
}

/* ---------- Base ---------- */

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

html {
	scroll-behavior: smooth;

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

body {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* Like Tailwind's reset in the Astro site: no default margins, so the blocks' own spacing decides. */
h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
blockquote,
dl,
dd,
ul,
ol {
	margin: 0;
}

ul,
ol {
	padding: 0;
	list-style: none;
}

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

::selection {
	background: rgb(102 204 153 / 0.4);
}

:focus-visible {
	outline: 2px solid var(--wp--preset--color--polar);
	outline-offset: 2px;
}

:where(.has-night-background-color, .has-polar-background-color, .has-night-soft-background-color, .wp-block-cover, .wp-block-at-hero) :focus-visible {
	outline-color: var(--wp--preset--color--aurora);
}

/* Links in running text: a faint underline that darkens on hover. */
:where(.wp-block-paragraph, .wp-block-list, .wp-block-details) a {
	text-decoration-color: color-mix(in srgb, currentColor 32%, transparent);
	text-decoration-thickness: 1px;
	text-underline-offset: 4px;
	transition: text-decoration-color var(--at-transition), color var(--at-transition);

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

/* Each font size comes with its line height, as in the Astro site's Tailwind scale. A line
   height set on the block itself still wins. */
.has-sm-font-size {
	line-height: 1.25rem;
}

.has-lg-font-size,
.has-xl-font-size {
	line-height: 1.75rem;
}

.has-title-sm-font-size {
	line-height: clamp(1.75rem, 1.6404rem + 0.4494vw, 2rem);
}

.has-title-font-size {
	line-height: 2rem;
}

.has-title-md-font-size {
	line-height: clamp(2rem, 1.8904rem + 0.4494vw, 2.25rem);
}

.has-strip-font-size {
	line-height: clamp(2.25rem, 2.4657rem - 0.2697vw, 2.4rem);
}

.has-time-font-size {
	line-height: 2.25rem;
}

/* ---------- Buttons ---------- */

.wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 3.25rem;
	text-align: center;
	text-decoration: none;
	transition: color var(--at-transition), background-color var(--at-transition), box-shadow var(--at-transition), text-decoration-color var(--at-transition);
}

.wp-block-button.is-style-compact .wp-block-button__link {
	min-height: 3rem;
}

.wp-block-button.is-style-chip .wp-block-button__link {
	min-height: 2.75rem;
}

.wp-block-button.is-style-link .wp-block-button__link {
	min-height: 2.75rem;
	border-radius: 0;
	text-decoration-line: underline;
	text-decoration-thickness: 2px;
	text-decoration-color: color-mix(in srgb, currentColor 32%, transparent);
	text-underline-offset: 6px;
	white-space: nowrap;

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

/* ---------- Lists ---------- */

.wp-block-list.is-style-links,
.wp-block-list.is-style-links-underlined {
	li + li {
		margin-top: 0.25rem;
	}

	a {
		display: inline-flex;
		align-items: center;
		min-height: 2.75rem;
		text-decoration: none;
		text-decoration-thickness: 1px;
		text-underline-offset: 4px;
		transition: color var(--at-transition), text-decoration-color var(--at-transition);

		&:hover {
			color: var(--wp--preset--color--white);
			text-decoration-line: underline;
			text-decoration-color: var(--wp--preset--color--aurora);
		}
	}
}

.wp-block-list.is-style-links-underlined a {
	text-decoration-line: underline;
	text-decoration-color: color-mix(in srgb, currentColor 38%, transparent);
}

.wp-block-list.is-style-ruled {
	border-block: 1px solid var(--wp--preset--color--frost);
	line-height: 1.625;

	li {
		padding-block: 0.875rem;
	}

	/* Like Tailwind's divide-y: a line under every row but the last. */
	li:not(:last-child) {
		border-bottom: 1px solid var(--wp--preset--color--frost);
	}
}

.wp-block-list.is-style-checks li,
.wp-block-list.is-style-checks-ruled li {
	display: flex;
	gap: 0.75rem;

	&::before {
		content: "";
		flex-shrink: 0;
		width: 1rem;
		height: 1rem;
		margin-top: 0.25rem;
		background: var(--wp--preset--color--polar);
		mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M2.5 8.5l3.5 3.5 7.5-8' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
	}
}

.wp-block-list.is-style-checks li + li {
	margin-top: 0.75rem;
}

.wp-block-list.is-style-checks-ruled {
	display: grid;
	column-gap: 2rem;

	@media (min-width: 640px) {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	li {
		padding-block: 1rem;
		border-top: 1px solid var(--wp--preset--color--frost);
	}
}

.wp-block-list:is(.is-style-chips, .is-style-chips-outline, .is-style-chips-glass) {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;

	li {
		border-radius: 9999px;
	}
}

.wp-block-list.is-style-chips li {
	padding: 0.375rem 0.875rem;
	background: var(--wp--preset--color--polar-mist);
	color: var(--wp--preset--color--polar-deep);
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 500;
	line-height: 1.25rem;
}

.wp-block-list.is-style-chips-outline li {
	padding: 0.5rem 1rem;
	box-shadow: 0 0 0 1px color-mix(in srgb, currentColor 28%, transparent);
	font-size: var(--wp--preset--font-size--nav);
}

.wp-block-list.is-style-chips-glass li {
	padding: 0.5rem 1rem;
	background: rgb(255 255 255 / 0.1);
	box-shadow: 0 0 0 1px rgb(255 255 255 / 0.2);
	font-weight: 600;
}

.wp-block-list.is-style-tiles {
	display: grid;
	gap: 0.5rem;

	@media (min-width: 640px) {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	li {
		padding: 0.75rem 1rem;
		border-radius: 0.75rem;
		background: rgb(255 255 255 / 0.7);
	}
}

.wp-block-list.is-style-accent {
	li {
		padding-left: 1rem;
		border-left: 2px solid var(--wp--preset--color--polar);
	}

	li + li {
		margin-top: 0.75rem;
	}
}

/* ---------- Headings ---------- */

.wp-block-heading.is-style-rule {
	padding-bottom: 0.75rem;
	border-bottom: 1px solid var(--wp--preset--color--frost);
	color: var(--wp--preset--color--slate);
	font-family: var(--wp--preset--font-family--figtree);
	font-size: var(--wp--preset--font-size--base);
	font-weight: 600;
	line-height: 1.5;
}

/* ---------- Groups, covers and cards ---------- */

.wp-block-group.is-style-clip {
	overflow: hidden;
}

.wp-block-cover {
	overflow: hidden;

	.wp-block-cover__inner-container {
		width: 100%;
	}
}

/* Native Image blocks keep whole-card links compatible with Link Anything. */
.wp-block-image:is(.is-style-tour-portrait, .is-style-tour-wide) {
	margin: 0;
	overflow: hidden;
	border-radius: 1.75rem;
	background: var(--wp--preset--color--night);

	img {
		display: block;
		width: 100%;
		height: auto;
		object-fit: cover;
		aspect-ratio: 16 / 9;
	}

	&.is-style-tour-portrait img {
		aspect-ratio: 4 / 3;

		@media (min-width: 768px) {
			aspect-ratio: 4 / 5;
		}
	}
}

.wp-block-htech-link-anything.is-style-card {
	display: block;
	width: auto;
	border-radius: 1.75rem;
	color: inherit;
	text-decoration: none;

	:is(.wp-block-at-photo, .wp-block-image) img {
		transition: transform 700ms ease;
	}

	:where(h2, h3, h4) {
		transition: color var(--at-transition);
	}

	&:hover {
		:is(.wp-block-at-photo, .wp-block-image) img {
			transform: scale(1.03);
		}

		:where(h2, h3, h4) {
			color: var(--wp--preset--color--polar);
		}
	}

	&:focus-visible {
		outline-offset: 4px;
	}

	@media (prefers-reduced-motion: reduce) {
		:is(.wp-block-at-photo, .wp-block-image) img {
			transition: none;
		}
	}
}

/* ---------- Questions and answers ---------- */

.wp-block-details {
	padding-block: 0.5rem;

	&:not(:last-child) {
		border-bottom: 1px solid var(--wp--preset--color--frost);
	}

	summary {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 1rem;
		min-height: 3.5rem;
		padding-block: 0.75rem;
		font-family: var(--wp--preset--font-family--young-serif);
		font-size: var(--wp--preset--font-size--lead);
		line-height: 1.4;
		list-style: none;
		cursor: pointer;

		&::-webkit-details-marker {
			display: none;
		}

		/* A plus drawn with two centred bars, so it stays centred when it turns into an X. */
		&::after {
			content: "";
			flex-shrink: 0;
			width: 2.25rem;
			height: 2.25rem;
			border-radius: 9999px;
			background:
				linear-gradient(currentColor 0 0) center / 0.75rem 2px no-repeat,
				linear-gradient(currentColor 0 0) center / 2px 0.75rem no-repeat,
				var(--wp--preset--color--polar-mist);
			color: var(--wp--preset--color--polar);
			transition: transform var(--at-transition);
		}
	}

	&[open] summary::after {
		transform: rotate(45deg);
	}

	> :not(summary) {
		color: var(--wp--preset--color--slate);
		line-height: 1.625;
	}

	> :not(summary) + :not(summary) {
		margin-top: 1rem;
	}

	> :last-child:not(summary) {
		padding-bottom: 1.5rem;
	}
}

/* ---------- Quotes ---------- */

.wp-block-quote {
	margin: 0;
	border: 0;
	padding: 0;
}
