/*
 * Solid Teens: the band system. Type widths and rhythm, eyebrows, the 5/7 split, seams between bands,
 * buttons and arrow links, the smile, image ratios and masks, and the home, camp and give bands.
 * Colours are palette variables, or rgb() of palette channels with alpha. Loads after components.css.
 */

/* Type */
:root :is(h1, h2, h3, h4, h5, h6) {
	text-wrap: balance;
	word-spacing: 0.05em;
}

:root :is(p, li) {
	text-wrap: pretty;
}

:root :is(.has-lead-font-size, .styi-lead) {
	line-height: 1.45;
}

/* Eyebrow: a block style for paragraph and heading, plus a class for block markup. Capitals by CSS only. */
:root :is(.styi-eyebrow, .is-style-eyebrow, .styi-footer__heading, .styi-camp-timeline__edition) {
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

:root :is(.styi-eyebrow, .is-style-eyebrow):not(.has-text-color) {
	color: var(--wp--preset--color--slate);
}

:root :is(.has-navy-background-color, .has-deep-navy-background-color, .has-slate-background-color, .has-ink-background-color, .styi-camp-slot__frame) :is(.styi-eyebrow, .is-style-eyebrow):not(.has-text-color) {
	color: var(--wp--preset--color--gold);
}

:root .has-gold-background-color :is(.styi-eyebrow, .is-style-eyebrow):not(.has-text-color) {
	color: inherit;
}

:root .is-style-eyebrow + * {
	margin-block-start: var(--wp--preset--spacing--40);
}

/* One gold word on a dark band. On light it stays the text colour, so gold is never text on white. */
:root :is(.has-navy-background-color, .has-deep-navy-background-color, .has-slate-background-color, .has-ink-background-color) .styi-gold-word {
	color: var(--wp--preset--color--gold);
}

/* Split: the heading left on 5 columns, the content right on 7, stacked below 64rem. */
.styi-split {
	display: grid;
	gap: var(--wp--preset--spacing--50);
}

:root .styi-split > * {
	margin-block: 0;
}

/* Stacked, a body keeps a reading measure; side by side (and in the hero, whose body is a photo) it fills its
   column, so ruled rows and lists end on the same right edge as the hairlines and the header. */
.styi-split__body {
	max-width: 44rem;
}

:root .styi-split--hero .styi-split__body {
	max-width: none;
}

:root :is(.styi-split__head, .styi-split__body) > :first-child {
	margin-block-start: 0;
}

@media (min-width: 64rem) {
	.styi-split {
		grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
		column-gap: var(--wp--preset--spacing--70);
		align-items: start;
	}

	:root .styi-split__body {
		max-width: none;
	}

	.styi-split__head {
		position: sticky;
		top: calc(var(--styi-header-h) + var(--wp--preset--spacing--50));
	}

	.styi-split--hero {
		grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
		align-items: center;
	}

	.styi-split--hero .styi-split__head {
		position: static;
	}
}

/* A panorama under a split, on the wide grid. The camp ground photo is a 3 to 1 strip whose top half is flat
   sky, so the frame is cropped to the roofs, the trees and the field: a 5 to 1 frame zoomed in a little from
   the bottom edge on the grid, and on phones a 5 to 2 frame zoomed in further from the bottom centre. */
:root .styi-panorama {
	margin-block-start: var(--wp--preset--spacing--60);
}

:root .styi-panorama .wp-block-image {
	margin: 0;
	overflow: hidden;
}

.styi-panorama .wp-block-image img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 5 / 2;
	object-fit: cover;
	object-position: 50% 100%;
	transform: scale(1.8);
	transform-origin: 50% 100%;
	filter: saturate(0.9) contrast(1.05);
}

/* Full bleed on phones. The bleed goes on the figure: the constrained layout centres the group with !important. */
@media (max-width: 47.99rem) {
	:root .styi-panorama .wp-block-image {
		margin-inline: calc(-1 * var(--styi-gutter));
	}
}

@media (min-width: 48rem) {
	.styi-panorama .wp-block-image img {
		aspect-ratio: 5 / 1;
		transform: scale(1.15);
	}
}

/* page.html: the title starts where the page's first band starts. On the 680 text column for prose and legal
   pages and for bands set on the text column; on the 1320 grid when the first band opens with a wide block. */
:root .styi-main > .styi-page-title.alignwide:has(+ .wp-block-post-content) {
	max-width: var(--wp--style--global--content-size, 680px);
}

:root .styi-main > .styi-page-title.alignwide:has(+ .wp-block-post-content > .alignwide:first-child),
:root .styi-main > .styi-page-title.alignwide:has(+ .wp-block-post-content > .alignfull:first-child > .alignwide:first-child),
:root .styi-main > .styi-page-title.alignwide:has(+ .wp-block-post-content > .alignfull:first-child > hr.styi-smile:first-child + .alignwide) {
	max-width: var(--styi-wide);
}

/* page.html: a first band on the page's own white carries on from the title instead of opening again under it.
   Its top padding (spacing-70) on top of the content's margin (spacing-50) left the title alone above about
   150 px of white at 1440. The band's padding goes, and the title sits spacing-60 above the band's first block.
   A dark or mist first band keeps its padding: its edge already marks where it starts. A band whose first block
   is a hung smile keeps it too, so the smile never sits on the band's heading. */
:root .styi-main > .styi-page-title + .wp-block-post-content:has(> .alignfull.has-white-background-color:first-child) {
	margin-block-start: var(--wp--preset--spacing--60);
}

:root .styi-main > .styi-page-title + .wp-block-post-content > .alignfull.has-white-background-color:first-child:not(:has(> hr.styi-smile:first-child)) {
	padding-top: 0 !important;
}

/* Seams: bands meet with no white strip, and the last band meets the footer strip. */
:root .wp-block-post-content > .alignfull + .alignfull {
	margin-block-start: 0;
}

.styi-main:has(> .wp-block-post-content > .alignfull:last-child) {
	padding-block-end: 0;
}

:root .styi-main.styi-main--band {
	padding-block: 0;
}

:root .styi-main.styi-main--band > .wp-block-post-content {
	margin-block: 0;
}

/* Two light bands in a row get a hairline on the wide grid, not a seam. */
.wp-block-post-content > :is(.has-white-background-color, .has-mist-background-color) + :is(.has-white-background-color, .has-mist-background-color) {
	background-image: linear-gradient(var(--styi-line), var(--styi-line));
	background-repeat: no-repeat;
	background-position: top center;
	background-size: min(var(--styi-wide), 100% - 2 * var(--styi-gutter)) 1px;
}

/* Buttons. At rest an outline button is see-through and, without a text colour of its own, takes the band's text
   colour: core's rules for that are :root :where(...), the same weight as the global button colours from
   theme.json, which print later and made it a navy button with white text (white on white once see-through). */
:root .wp-block-button.is-style-outline > .wp-block-button__link:not(.has-background) {
	background-color: transparent;
}

:root .wp-block-button.is-style-outline > .wp-block-button__link:not(.has-text-color) {
	color: currentColor;
}

/* Outline buttons did not respond to hover: core's :not(.has-background) rule is (0,4,0). */
:root .wp-block-button.is-style-outline > .wp-block-button__link:is(:hover, :focus-visible) {
	background-color: var(--wp--preset--color--navy);
	border-color: var(--wp--preset--color--navy);
	color: var(--wp--preset--color--white) !important;
}

:root :is(.has-navy-background-color, .has-deep-navy-background-color, .has-slate-background-color, .has-ink-background-color) .wp-block-button.is-style-outline > .wp-block-button__link:is(:hover, :focus-visible) {
	background-color: var(--wp--preset--color--white);
	border-color: var(--wp--preset--color--white);
	color: var(--wp--preset--color--navy) !important;
}

.wp-element-button,
.wp-block-button__link {
	letter-spacing: 0.01em;
}

/* Arrow link: every action after a band's one filled button. The chevron is drawn, because U+2192 is not
   in the Latin subset. */
.styi-link-arrow a {
	display: inline-flex;
	align-items: center;
	gap: 0.6em;
	min-height: 2.75rem;
	color: var(--wp--preset--color--navy);
	font-weight: 800;
	letter-spacing: 0.01em;
	text-decoration: none;
}

.styi-link-arrow a::after {
	content: "";
	flex: none;
	width: 0.5em;
	height: 0.5em;
	border-top: 2px solid currentColor;
	border-right: 2px solid currentColor;
	transform: rotate(45deg);
}

.styi-link-arrow a:hover {
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 0.2em;
}

:root :is(.has-navy-background-color, .has-deep-navy-background-color, .has-slate-background-color, .has-ink-background-color) .styi-link-arrow a {
	color: var(--wp--preset--color--gold);
}

:root .has-gold-background-color .styi-link-arrow a {
	color: var(--wp--preset--color--deep-navy);
}

/* One underline everywhere: components keep their own, which are more specific. */
:root :where(a:not(.wp-element-button, .wp-block-button__link)) {
	text-underline-offset: 0.2em;
	text-decoration-thickness: max(1px, 0.0625em);
}

/* Header: 44 px targets. */
.styi-header__talk a,
.styi-header__give .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	min-height: 2.75rem;
}

/* Phones: full-width actions in page content (not the header). */
@media (max-width: 29.99rem) {
	.wp-block-post-content .wp-block-buttons > .wp-block-button {
		flex: 1 1 100%;
	}

	.wp-block-post-content .wp-block-button__link,
	.wp-block-post-content form :is(button[type="submit"], input[type="submit"]) {
		width: 100%;
	}
}

/* The smile, once per band. 1: hung from a band's top edge when it is the band's first child. */
:root .alignfull:has(> hr.styi-smile:first-child) {
	position: relative;
}

:root .alignfull > hr.wp-block-separator.styi-smile:first-child {
	position: absolute;
	top: 0;
	left: max(var(--styi-gutter), calc((100% - var(--wp--style--global--content-size, 680px)) / 2));
	margin: 0;
}

:root .alignfull:has(> .styi-split, > .wp-block-columns.alignwide) > hr.wp-block-separator.styi-smile:first-child {
	left: max(var(--styi-gutter), calc((100% - var(--styi-wide)) / 2));
}

/* 2: the hero smile, desktop only (below 64rem it would touch the H1). It hangs from the band's top edge where
   the heading column ends, crosses the column gap and lies over the photo's top left corner, above the photo
   on purpose. It starts at the heading column's edge, so it never covers the heading text. */
:is(.styi-home-hero, .styi-page-hero) {
	position: relative;
	overflow: hidden;
}

:is(.styi-home-hero, .styi-page-hero) > * {
	position: relative;
	z-index: 1;
}

@media (min-width: 64rem) {
	:is(.styi-home-hero, .styi-page-hero)::before {
		content: "";
		position: absolute;
		top: 0;
		left: calc(max(var(--styi-gutter), (100% - var(--styi-wide)) / 2) + (min(var(--styi-wide), 100% - 2 * var(--styi-gutter)) - var(--wp--preset--spacing--70)) * 7 / 12);
		z-index: 2;
		width: clamp(9rem, 5rem + 16vw, 20rem);
		aspect-ratio: 2 / 1;
		border-radius: 0 0 999px 999px;
		background: var(--wp--preset--color--gold);
		pointer-events: none;
	}
}

/* Images: text beside a photo on a 7/5 split, the photo above its text and full bleed on phones. */
:root .wp-block-columns.styi-media-split {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--wp--preset--spacing--50);
}

:root .styi-media-split > .wp-block-column:last-child {
	order: -1;
}

.styi-media-split .wp-block-image {
	margin: 0;
}

.styi-media-split .wp-block-image img,
.styi-split--hero .wp-block-image img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 3 / 2;
	object-fit: cover;
	object-position: var(--styi-crop, 50% 50%);
}

@media (max-width: 47.99rem) {
	/* width: auto, because core gives a vertically aligned column width: 100%, which stops the bleed. */
	:root .styi-media-split > .wp-block-column:last-child,
	.styi-split--hero .wp-block-image {
		width: auto;
		margin-inline: calc(-1 * var(--styi-gutter));
	}

	.styi-media-split .wp-block-image img {
		aspect-ratio: 4 / 3;
	}
}

@media (min-width: 64rem) {
	:root .wp-block-columns.styi-media-split {
		grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
		column-gap: var(--wp--preset--spacing--70);
	}

	:root .wp-block-columns.styi-media-split--flip {
		grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
	}

	:root .styi-media-split > .wp-block-column:last-child {
		order: 0;
	}

	:root .styi-media-split--flip > .wp-block-column:last-child {
		order: -1;
	}

	.styi-media-split .wp-block-image img,
	.styi-split--hero .wp-block-image img {
		aspect-ratio: 5 / 4;
	}
}

:root .styi-media-split .styi-key-camp-ground img {
	aspect-ratio: 3 / 2;
}

/* 3: the smile mask, flat edge up and curve down. */
:root .wp-block-image.is-style-smile img {
	aspect-ratio: 2 / 1;
	object-fit: cover;
	object-position: var(--styi-crop, 50% 60%);
	border-radius: 0 0 50% 50% / 0 0 100% 100%;
}

/* A light grade, no scrims: ::after is kept for the smile and the chevrons. */
:is(.styi-media-split img, .styi-camp-slot__still, .styi-split--hero .wp-block-image img) {
	filter: saturate(0.9) contrast(1.05);
}

/* Focal points by image key. */
.styi-key-home-hero {
	--styi-crop: 50% 55%;
}

.styi-key-camp-worship {
	--styi-crop: 50% 45%;
}

.styi-key-camp-flags {
	--styi-crop: 50% 40%;
}

.styi-key-camp-ground {
	--styi-crop: 50% 60%;
}

/* Home: the hero. When registration is open the frame shows its own gold button, so the hero's steps down. */
:root .styi-home-hero:has(.styi-camp-slot__register) .styi-hero__actions .wp-block-button__link {
	background-color: transparent !important;
	color: var(--wp--preset--color--white) !important;
	box-shadow: inset 0 0 0 2px currentColor;
}

:root .styi-home-hero .styi-hero__title {
	margin-block-end: var(--wp--preset--spacing--40);
}

/* Home: the doors, a navy 4-up strip of ruled cells with stretched arrow links. */
.styi-door-list {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 48rem) {
	.styi-door-list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 64rem) {
	.styi-door-list {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

:root .styi-door-list {
	max-width: var(--styi-wide);
}

:root .styi-door-list > .styi-door {
	margin: 0;
}

.styi-door {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--30);
	padding: var(--wp--preset--spacing--50) var(--wp--preset--spacing--40) var(--wp--preset--spacing--50) 0;
	border-top: 1px solid var(--styi-line);
}

:root .styi-door > * {
	margin: 0;
}

.styi-door > .styi-link-arrow {
	margin-top: auto;
}

.styi-door .styi-link-arrow a::before {
	content: "";
	position: absolute;
	inset: 0;
}

.styi-door:is(:hover, :focus-within) {
	box-shadow: inset 0 3px 0 var(--wp--preset--color--navy);
}

.has-navy-background-color .styi-door {
	border-top-color: rgb(255 255 255 / 0.25);
}

.has-navy-background-color .styi-door:is(:hover, :focus-within) {
	box-shadow: inset 0 3px 0 var(--wp--preset--color--gold);
}

@media (min-width: 64rem) {
	.styi-door + .styi-door {
		padding-left: var(--wp--preset--spacing--40);
		border-left: 1px solid rgb(255 255 255 / 0.25);
	}
}

/* Home and pattern: programmes as index rows, no numbers and no images. */
:root .styi-programme-list .wp-block-post-template {
	display: grid;
	gap: 0;
	margin: 0;
	padding: 0;
	list-style: none;
}

.styi-programme-list .wp-block-post {
	position: relative;
	display: grid;
	gap: var(--wp--preset--spacing--20) var(--wp--preset--spacing--50);
	padding-block: var(--wp--preset--spacing--40);
	border-top: 1px solid var(--styi-line);
}

.styi-programme-list .wp-block-post:last-child {
	border-bottom: 1px solid var(--styi-line);
}

:root .styi-programme-list .wp-block-post > * {
	margin: 0;
}

/* Top-aligned, not baseline: Chrome lined the excerpt up with the last line of a title that wraps. Top-aligned,
   the excerpt's first baseline sits 3 px above the title's (card at 1.1 against body at 1.6, measured at every
   width from 768 to 1920), so the excerpt drops by that much. */
@media (min-width: 48rem) {
	.styi-programme-list .wp-block-post {
		grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
		align-items: start;
	}

	:root .styi-programme-list .wp-block-post-excerpt {
		padding-top: 0.1875rem;
	}
}

/* Inline, so a title that wraps keeps its chevron after the last word, not out at the cell's edge. */
.styi-programme-list .wp-block-post-title a {
	text-decoration: none;
}

.styi-programme-list .wp-block-post-title a::after {
	content: "";
	display: inline-block;
	width: 0.35em;
	height: 0.35em;
	margin-inline-start: 0.4em;
	border-top: 2px solid currentColor;
	border-right: 2px solid currentColor;
	vertical-align: 0.15em;
	transform: rotate(45deg);
}

.styi-programme-list .wp-block-post-title a::before {
	content: "";
	position: absolute;
	inset: 0;
}

.styi-programme-list .wp-block-post:is(:hover, :focus-within) {
	box-shadow: inset 0 2px 0 var(--wp--preset--color--navy);
}

/* Home and pattern: the facts, the page's one gold block. */
:root .styi-facts-band .wp-block-columns {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--wp--preset--spacing--50) var(--wp--preset--spacing--40);
}

/* One row on desktop, however many figures the band holds (the pattern starts with three). */
@media (min-width: 64rem) {
	:root .styi-facts-band .wp-block-columns {
		grid-template-columns: none;
		grid-auto-columns: minmax(0, 1fr);
		grid-auto-flow: column;
	}
}

:root .styi-facts-band .wp-block-column {
	margin: 0;
}

.styi-fact {
	padding-top: var(--wp--preset--spacing--30);
	border-top: 2px solid currentColor;
}

:root .styi-fact > * {
	margin-block: 0;
}

/* The figure size is a preset class with !important, so this needs it too. */
:root .styi-facts-band .styi-fact__figure {
	font-size: clamp(3.5rem, 2.1667rem + 5.9259vw, 7rem) !important;
	font-weight: 900;
	line-height: 0.9;
}

:root .styi-facts-band .styi-fact__label {
	max-width: 18ch;
	margin-top: var(--wp--preset--spacing--20);
	font-size: var(--wp--preset--font-size--body);
	font-weight: 600;
}

/* Home: the connect band (newsletter and social) and the social links as ruled rows. */
.styi-social-band .styi-social--band {
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0 var(--wp--preset--spacing--40);
}

/* The list's own margin: 0 would set the heading above it straight on the first rule. */
:root .styi-social-band .styi-social--band {
	margin-block-start: var(--wp--preset--spacing--30);
}

.styi-social-band .styi-social--band .styi-social__link {
	min-height: 2.75rem;
	padding: var(--wp--preset--spacing--30) 0;
	border: 0;
	border-top: 1px solid var(--styi-line);
	background: none;
}

.styi-social-band .styi-social--band .styi-social__link:hover {
	background: none;
	color: var(--wp--preset--color--navy);
	box-shadow: inset 0 2px 0 var(--wp--preset--color--navy);
}

.styi-social-band .styi-social--band .styi-social__name {
	font-size: var(--wp--preset--font-size--body);
	font-stretch: 87.5%;
}

@media (max-width: 29.99rem) {
	.styi-social-band .styi-social__handle {
		display: none;
	}
}

:root .styi-newsletter__teens {
	font-weight: 400;
}

/* Questions: ruled rows with a drawn chevron. */
.wp-block-details > summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--wp--preset--spacing--30);
	min-height: 2.75rem;
	list-style: none;
}

.wp-block-details > summary::-webkit-details-marker {
	display: none;
}

.wp-block-details > summary::after {
	content: "";
	flex: none;
	width: 0.55em;
	height: 0.55em;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: translateY(-25%) rotate(45deg);
}

.wp-block-details[open] > summary::after {
	transform: translateY(25%) rotate(-135deg);
}

/* Give: the asks band carries its own H2s below the split, so its head does not stick. */
.styi-give-asks-band .styi-split__head {
	position: static;
}

/* Legal and long pages: prose rhythm on the 680 column. */
:root .wp-block-post-content > h2.wp-block-heading {
	margin-block: var(--wp--preset--spacing--70) var(--wp--preset--spacing--30);
	font-size: clamp(1.75rem, 1.4rem + 1.5vw, 2.5rem);
}

:root .wp-block-post-content > h3.wp-block-heading {
	margin-block: var(--wp--preset--spacing--50) var(--wp--preset--spacing--20);
}

:root .wp-block-post-content > :is(ul, ol) > li + li {
	margin-top: 0.5em;
}

:root .wp-block-post-content > :is(ul, ol) > li::marker {
	color: var(--wp--preset--color--navy);
}

/* Give page: the navy "How to give" band, the costed asks as ruled rows, and the bank details (styi/give-options). */
:is(.styi-give-band, .styi-give-hero) .wp-block-buttons {
	margin-block: var(--wp--preset--spacing--40) var(--wp--preset--spacing--30);
}

/* The button rows styi/give-options writes itself carry no layout class, so they get the row gap here. */
:is(.styi-give-contact, .styi-give-online > .wp-block-buttons) {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--30);
}

.styi-give-fallback {
	font-size: var(--wp--preset--font-size--lead);
	font-weight: 700;
}

.styi-give-fallback a[href^="tel:"] {
	white-space: nowrap;
}

.styi-give-online__note {
	max-width: 40rem;
	font-size: var(--wp--preset--font-size--small);
}

.styi-give-ask {
	padding-block: var(--wp--preset--spacing--40);
	border-top: 1px solid var(--styi-line);
}

.styi-give-ask__figure {
	color: var(--wp--preset--color--navy);
	font-size: var(--wp--preset--font-size--card);
	font-weight: 800;
	font-stretch: 75%;
	font-variant-numeric: tabular-nums;
}

.styi-give-bank__details {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 0.5rem 1.5rem;
	margin: 0;
}

.styi-give-bank__details dt {
	font-weight: 700;
}

.styi-give-bank__details dd {
	margin: 0;
	overflow-wrap: anywhere;
}

.styi-give-bank__number {
	font-size: var(--wp--preset--font-size--lead);
	font-weight: 800;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.04em;
}

.styi-give-bank__check {
	padding: var(--wp--preset--spacing--30) var(--wp--preset--spacing--40);
	border-inline-start: 4px solid var(--wp--preset--color--navy);
	background-color: var(--wp--preset--color--white);
}

/* The parts styi/give-options adds space their children like the page around them. */
:is(.styi-give-online, .styi-give-bank, .styi-give-abroad, .styi-give-breakdown) > * {
	margin-block: 0;
}

:is(.styi-give-online, .styi-give-bank, .styi-give-abroad, .styi-give-breakdown) > * + * {
	margin-block-start: var(--wp--preset--spacing--40);
}
