/* ==========================================================================
   Careers screen
   Contents: apply block · benefits band · team gallery
   ========================================================================== */

/*
 * Column proportions only. .split-section's skeleton is in main.css, shared with
 * About; these are this screen's two different splits — the apply block is close
 * to even because the photograph carries as much as the copy, while the gallery
 * below needs the wider half.
 */
@media (min-width: 992px) {
	/*
	 * The photograph is the wider half, 1.3 : 1, measured off the mockup — where
	 * the image spans 415px against the copy's 320. It was the other way round
	 * here, which is why the paragraph ran three lines instead of four: a column
	 * of that width simply fits more. The line count follows the measure; it is
	 * not worth chasing with breaks in the copy or a max-width on the paragraph.
	 */
	/*
	 * The photograph is the NARROWER half. Measured off the design: the image
	 * spans 418px and the column beside it 479, so 0.87 : 1, and the image takes
	 * 45% of the block rather than the 58% it had here.
	 *
	 * It was inverted because the first measurement took the width of the
	 * paragraph's ink — one line of it, 320px — for the width of its column. The
	 * paragraph does not fill that column; the buttons under it do.
	 */
	.careers-apply .split-section__inner {
		grid-template-columns: minmax(0, 0.87fr) minmax(0, 1fr);
		gap: var(--space-10);
		/*
		 * The copy sets the height and the photograph matches it, rather than a
		 * ratio deciding how tall the whole block is. At 0.7 the image stood 95px
		 * taller than the text beside it and pushed the section out on its own.
		 *
		 * Same arrangement as the gallery below: the tile owns the shape,
		 * object-fit fills it. Nothing to re-tune when the copy changes.
		 */
		align-items: stretch;
	}

	/*
	 * Taken out of flow so it contributes no height of its own — stretching
	 * alone was not enough, because the reserved 0.7 ratio still made the image
	 * the tallest thing in the row and the section stayed exactly as tall.
	 *
	 * Only from 992px. Stacked below that there is no copy beside it to inherit
	 * a height from, and an absolutely positioned image in an auto-height row
	 * collapses to nothing.
	 */
	/*
	 * The column crops; the photograph keeps its own proportion and is centred in
	 * the opening. No percentage height anywhere, which is what kept failing:
	 * height: 100% on a stretched grid item does not resolve, and an <img> is a
	 * replaced element, so height: auto between top: 0 and bottom: 0 falls back
	 * to its intrinsic 391px instead of filling them. Half-and-half positioning
	 * needs neither, and the crop lands evenly top and bottom rather than
	 * chopping the bottom third off.
	 */
	.careers-apply__media {
		position: relative;
		overflow: hidden;
		border-radius: var(--radius);
	}

	.careers-apply__image {
		position: absolute;
		top: 50%;
		left: 0;
		width: 100%;
		height: auto;
		transform: translateY(-50%);
	}

	/*
	 * A narrow column of copy against a wide gallery, measured off the mockup:
	 * 222px of text to 654px of photographs, or 1 : 2.95. Not copied exactly —
	 * at that ratio the paragraph runs about 42 characters a line, under the ~45
	 * a comfortable measure wants. 1 : 2.2 keeps the editorial proportion and
	 * lands near 50, which is inside it.
	 */
	.careers-life .split-section__inner {
		grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr);
		gap: var(--space-8);
		/*
		 * The copy sets the height and the gallery fills it, so the eyebrow lines
		 * up with the top of the first row and the Instagram button with the
		 * bottom of the second. Left to itself the gallery was the taller of the
		 * two and stood well past the button.
		 */
		align-items: stretch;
	}

	/*
	 * Absolute images are what let this work: they contribute no height, so the
	 * gallery's own content height is nothing and the row is free to take the
	 * copy's. The two rows then split whatever that is. Same reason as the apply
	 * block above — an <img> otherwise insists on its intrinsic size.
	 *
	 * Only from 992px. Stacked below that there is no copy beside it to take a
	 * height from, and the whole gallery would collapse.
	 */
	.careers-gallery {
		height: 100%;
	}

	.careers-gallery__item {
		position: relative;
		min-height: 0;
	}

	.careers-gallery__image {
		position: absolute;
		inset: 0;
		width: 100%;
		height: 100%;
	}

	/*
	 * And from 992px, where the image is absolute, the trigger is too: it is
	 * then the image's containing block, so the image fills the button and the
	 * button fills the tile. Left in flow it would be zero pixels tall — the
	 * click would still land, through the image, but the focus ring would be a
	 * line.
	 */
	.careers-gallery .lightbox-open {
		position: absolute;
		inset: 0;
	}

	/*
	 * Both bands with no photographs chosen — which is a real state, because
	 * Settings → Quantum lets an editor clear them and there is no stand-in.
	 *
	 * The column proportions above are still on the grid, so the copy left on
	 * its own would sit in a 45% column with an empty 55% beside it: the shape
	 * of a picture that failed to load rather than of a band that has none.
	 * Spanning both columns is what makes it look chosen. The measure is capped
	 * because a paragraph across the full 1280px container runs past 150
	 * characters a line, and this is the one arrangement where nothing else is
	 * there to stop it.
	 *
	 * :only-child and not :has() on the parent: the media block simply is not
	 * printed, so the body is the only child, and this needs no support for a
	 * selector the older half of the browsers still meets.
	 */
	.careers-apply__body:only-child,
	.careers-life__body:only-child {
		grid-column: 1 / -1;
		max-width: 62ch;
	}
}


/* Apply block
   ========================================================================== */

/*
 * --radius, not --radius-lg: this is the same pattern as About's team groups —
 * one large photograph beside its copy in a .split-section — and they should
 * not round differently for no reason.
 */
.careers-apply__image {
	width: 100%;
	height: auto;
	border-radius: var(--radius);
}

.careers-apply__actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-4);
	margin-top: var(--space-6);
}

/*
 * Both grow to share the row and wrap to full width together, so the pair never
 * lands as one wide button beside a narrow one — the arrangement that reads as
 * though the second were an afterthought.
 *
 * white-space: normal is what lets them sit side by side at all. The base .btn
 * refuses to wrap, which is a promise that every label is short enough for the
 * narrowest screen; "View Open Positions on LinkedIn" is not, and held on one
 * line it forced a column so wide the paragraph above dropped to three lines.
 * Wrapped, each button is about 220px and both fit — which is how the mockup
 * draws them, two lines apiece.
 */
.careers-apply__actions .btn {
	/*
	 * The basis is the width at which the address still fits on one line, so it
	 * is what decides whether the pair shares a row: below it there is not room
	 * for two, and flex-wrap stacks them to full width on its own.
	 *
	 * This replaced a max-width: 575.98px rule that stacked them on phones. The
	 * breakpoint was the wrong question — at 1200px the column is 451px, the
	 * buttons came out at 225 each and the address broke in half on a desktop.
	 * Tying it to the button's own requirement covers every width at once.
	 *
	 * Measured, not guessed: the address renders at 192.9px, plus the 30px mark,
	 * the 9.6px gap, 32px of padding and 3px of border = 268px. 272 leaves a
	 * couple of pixels for the font loading at a slightly different metric.
	 *
	 * It was 240px while the mark was 18px wide. Anything that changes the icon
	 * size, the padding or the address has to move this number with it — at 240
	 * the pair still shared a row at 575px and broke the address across two
	 * lines, which is the one thing here that has to stay read-at-a-glance.
	 */
	flex: 1 1 272px;
	white-space: normal;
	text-align: left;
	/*
	 * Tighter than .btn--lg's default so the address fits on one line. At the
	 * standard padding the orange button needed 268px of a 250px slot and broke
	 * "contact@quantumptandchiro.com" in half, which is the one thing on this
	 * screen that must stay readable at a glance.
	 */
	padding-inline: var(--space-4);
	/*
	 * The base .btn centres its contents, which is right for a pill that hugs its
	 * label. These two are stretched by flex-grow, so centring left the orange
	 * button's mark floating in the middle of a box far wider than its content
	 * while the LinkedIn one — whose label nearly fills its box — read as though
	 * it were aligned. Two buttons side by side starting their marks at different
	 * x looks like a mistake even when it is symmetrical.
	 *
	 * The design aligns to the start too: its envelope sits 16px in from the
	 * button's left edge, not centred.
	 */
	justify-content: flex-start;
}

/*
 * With the row aligned to the start, the trailing arrow would otherwise sit
 * tight against the label. Pushing it to the far edge gives the pair the shape
 * a rectangular CTA wants — mark, label, arrow — and lets the arrow point out
 * of the button, which is what it is there to say.
 *
 * :last-child, so this never reaches the orange button, whose last child is the
 * label span.
 */
.careers-apply__actions .btn__icon:last-child {
	margin-inline-start: auto;
}

/*
 * overflow-wrap is the safety net: if the address ever grows, it breaks rather
 * than forcing the pair of buttons onto separate rows.
 */
.careers-apply__actions .btn__sublabel {
	overflow-wrap: anywhere;
	font-size: 0.75rem;
}

/*
 * The leading mark at the size the design gives it: its envelope measures 26x19
 * there, which for Lucide's mail — 20x16 on a 24 grid — works back to about a
 * 30px icon, against the theme's default 18.
 *
 * :first-child, so only the brand mark grows. The arrow that closes the LinkedIn
 * button stays at 18 like every other arrow on the site; it is an affordance,
 * not the subject of the button.
 */
.careers-apply__actions .btn__icon:first-child {
	width: 30px;
	height: 30px;
}

/*
 * No measure of its own: the lead paragraph above runs the full column at about
 * 70ch, so a narrower cap here would read as a stray indent rather than a
 * choice. Left uncapped it takes the same line as the design, two.
 */
.careers-apply__note {
	margin-top: var(--space-5);
	font-size: var(--fs-sm);
	line-height: 1.6;
	color: var(--color-muted);
}



/* Benefits band
   ========================================================================== */

.careers-why__inner {
	display: grid;
	gap: var(--space-8);
	align-items: center;
}

@media (min-width: 992px) {
	.careers-why__inner {
		grid-template-columns: minmax(0, 1fr) minmax(0, 2.6fr);
		gap: var(--space-10);
	}
}

.benefit-list {
	display: grid;
	gap: var(--space-6);
	padding: 0;
	margin: 0;
	list-style: none;
}

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

@media (min-width: 992px) {
	.benefit-list {
		/*
		 * Five across, as the mockup has them. auto-fit would be tidier to write
		 * but would reflow to four the moment a sixth benefit is added, which is
		 * a layout decision that should be made on purpose, not by the grid.
		 */
		grid-template-columns: repeat(5, minmax(0, 1fr));
		gap: var(--space-5);
	}
}

/*
 * Flex, not text-align alone. quantum_icon() renders an <svg>, which is a block
 * box, and text-align does not move one — so the glyph sat hard left of its own
 * centred title. Barely visible in a narrow desktop column; unmistakable once
 * the list stacks to one column on a phone.
 */
.benefit {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
}

/*
 * Hairlines between the five, and only between them: a rule after the last one
 * would fence the group off from the section rather than divide it. Drawn only
 * where the row is actually a row — stacked, a left border is a stray mark.
 */
@media (min-width: 992px) {
	.benefit + .benefit {
		padding-left: var(--space-5);
		border-left: 1px solid var(--color-border);
	}
}

.benefit__icon {
	color: var(--color-primary);
}

.benefit__title {
	margin-top: var(--space-3);
	font-size: var(--fs-base);
	color: var(--color-navy);
}

.benefit__text {
	margin-top: var(--space-2);
	font-size: var(--fs-sm);
	line-height: 1.6;
	color: var(--color-text);
}


/* Team gallery
   ========================================================================== */

.careers-life__button {
	margin-top: var(--space-6);
}

/*
 * On phones the apply pair above stacks edge to edge, and a lone button hugging
 * its own label underneath read as unfinished next to it. Same width, and the
 * same internal arrangement as that pair: mark and label from the start edge,
 * arrow pushed to the far one, so the three buttons on this page share a shape.
 *
 * max-width rather than the file's usual min-width because this is the
 * exception, not the base: everywhere else the button should hug its label.
 */
@media (max-width: 575.98px) {
	.careers-life__button {
		width: 100%;
		justify-content: flex-start;
	}

	.careers-life__button .btn__icon:last-child {
		margin-inline-start: auto;
	}
}

/*
 * The gap is 7px between photographs in the mockup and 8px between the rows,
 * which scales to 9–11px here. --space-4 was 16 and let the group fall apart
 * into six separate pictures; --space-3 is 12 and reads as one gallery.
 */
.careers-gallery {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--space-3);
	padding: 0;
	margin: 0;
	list-style: none;
}

/*
 * Three per row, each row with its own proportions — which is why this is flex
 * and not grid. One grid-template-columns applies to every row alike, and
 * repeating the first row's descent down the second built a staircase the
 * mockup does not have: the left column visibly widest twice over.
 */
@media (min-width: 768px) {
	.careers-gallery {
		display: flex;
		flex-wrap: wrap;
		align-content: stretch;
	}

	/*
	 * Three to a row and grow to fill it. This is what any count other than six
	 * gets, and since the practice chooses these photographs in wp-admin, every
	 * count from one to six is a state somebody can leave the screen in.
	 *
	 * The measured widths below only add up when all six are there — each row's
	 * three sum to 100%. Applied to four, the second row would be one tile at
	 * 35.3% with the gap where the two missing photographs would have gone,
	 * which reads as two that failed to load. Grown, four is three and a wide
	 * one, and nothing looks absent.
	 */
	.careers-gallery__item {
		flex: 1 1 calc(33.333% - 8px);
	}

	/*
	 * The design's own proportions, and only for the six it was drawn with.
	 * Measured off it at full resolution, as percentages of each row:
	 *
	 *   row 1   484 / 410 / 384   ->  37.9 / 32.1 / 30.0   a clear descent
	 *   row 2   451 / 404 / 424   ->  35.3 / 31.6 / 33.1   dips in the middle
	 *
	 * Each row sums to 100%, less its share of the two gaps — with three items
	 * and one gap value, that is two gaps split three ways, hence the 8px.
	 */
	.careers-gallery[data-count="6"] .careers-gallery__item:nth-child(1) { flex: 0 0 calc(37.9% - 8px); }
	.careers-gallery[data-count="6"] .careers-gallery__item:nth-child(2) { flex: 0 0 calc(32.1% - 8px); }
	.careers-gallery[data-count="6"] .careers-gallery__item:nth-child(3) { flex: 0 0 calc(30.0% - 8px); }
	.careers-gallery[data-count="6"] .careers-gallery__item:nth-child(4) { flex: 0 0 calc(35.3% - 8px); }
	.careers-gallery[data-count="6"] .careers-gallery__item:nth-child(5) { flex: 0 0 calc(31.6% - 8px); }
	.careers-gallery[data-count="6"] .careers-gallery__item:nth-child(6) { flex: 0 0 calc(33.1% - 8px); }
}

.careers-gallery__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: var(--radius-tile);
}

/*
 * The tile, not the image, owns the shape: the ratio is reserved by
 * quantum_image() to stop layout shift, and object-fit fills it whatever
 * proportion the photograph arrives in. Real team photographs will not all be
 * the same shape, and the grid should not care.
 *
 * No overflow: hidden here, which there used to be. The photograph viewer's
 * trigger wraps each image and draws its focus ring 3px outside the tile; a
 * clipping tile cut that ring off entirely, so a keyboard user tabbing through
 * the gallery could not see where they were (SC 2.4.7). Nothing else needed the
 * clip — the image carries its own radius, and the hover zoom is clipped by the
 * trigger itself (.hover-zoom in main.css).
 */
.careers-gallery__item {
	border-radius: var(--radius-tile);
}

/*
 * The viewer's trigger (built by initLightbox() around each photograph that has
 * a description) has to take the whole tile, or the image inside it loses the
 * box it was sized against: below 992px the image is height: 100% of its
 * parent, which is now the button, and a button of auto height gives it
 * nothing to be 100% of.
 */
.careers-gallery .lightbox-open {
	height: 100%;
}
