/**
 * Katie Rae Photo — front end.
 *
 * Design note. The palette is taken from water rather than from a template:
 * a cold deep-water ink, the grey-green of sea haze, foam off-white, and a
 * single patrol yellow borrowed from surf lifesaving flags. The yellow only
 * ever appears on focus and active states — it is the one loud thing, and it
 * is loud on purpose so keyboard users can always find themselves.
 *
 * The signature is the horizon: a hairline rule that runs the full width
 * under the wordmark and reappears above the footer. Surf photography is
 * built around that line, so the page is too. Gallery metadata hangs off it
 * in mono, set like a session log.
 */

/* ---------------------------------------------------------------- tokens */

:root {
	--kr-deep: #101f26;
	--kr-shallow: #3f7a80;
	--kr-haze: #d7dcd9;
	--kr-foam: #f4f6f4;
	--kr-patrol: #f2c14e;

	--kr-display: 'Archivo', system-ui, sans-serif;
	--kr-body: 'Newsreader', Georgia, serif;
	--kr-mono: 'Space Mono', ui-monospace, monospace;

	--kr-gap: clamp(4px, 0.7vw, 12px);
	--kr-pad: clamp(20px, 5vw, 72px);
	--kr-row: clamp(180px, 26vw, 340px);

	--kr-rule: 1px solid rgba(16, 31, 38, 0.18);
}

/* ------------------------------------------------------------------ base */

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

html {
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	font-family: var(--kr-body);
	font-size: clamp(16px, 1.05vw, 18px);
	font-weight: 300;
	line-height: 1.6;
	color: var(--kr-deep);
	background: var(--kr-foam);
	-webkit-font-smoothing: antialiased;
}

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

a {
	color: inherit;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.22em;
}

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

.kr-skip {
	position: absolute;
	left: -9999px;
}

.kr-skip:focus {
	left: var(--kr-pad);
	top: 12px;
	z-index: 20;
	padding: 10px 16px;
	background: var(--kr-deep);
	color: var(--kr-foam);
	font-family: var(--kr-mono);
	font-size: 13px;
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* ---------------------------------------------------------------- header */

.kr-header {
	padding: clamp(28px, 5vw, 56px) var(--kr-pad) 0;
}

.kr-header__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 20px 40px;
	padding-bottom: 14px;
	/* The horizon. */
	border-bottom: var(--kr-rule);
}

.kr-wordmark {
	margin: 0;
	font-family: var(--kr-display);
	font-size: clamp(19px, 2vw, 26px);
	font-weight: 600;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	line-height: 1;
}

.kr-wordmark a {
	text-decoration: none;
}

.kr-nav ul {
	display: flex;
	flex-wrap: wrap;
	gap: clamp(16px, 2.4vw, 34px);
	margin: 0;
	padding: 0;
	list-style: none;
}

.kr-nav a {
	font-family: var(--kr-mono);
	font-size: 12px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	text-decoration: none;
	padding-bottom: 3px;
	border-bottom: 1px solid transparent;
	transition: border-color 0.18s ease;
}

.kr-nav a:hover,
.kr-nav .current-menu-item > a {
	border-bottom-color: var(--kr-deep);
}

/* ----------------------------------------------------------------- pages */

.kr-main {
	padding: 0 var(--kr-pad) clamp(60px, 9vw, 120px);
}

.kr-pagehead {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px 32px;
	padding: clamp(30px, 5vw, 60px) 0 clamp(20px, 3vw, 34px);
}

.kr-pagetitle {
	margin: 0;
	font-family: var(--kr-display);
	font-size: clamp(34px, 6.5vw, 78px);
	font-weight: 700;
	letter-spacing: -0.015em;
	text-transform: uppercase;
	line-height: 0.94;
}

/* The session-log line. Mono, tabular, hanging off the horizon. */
.kr-meta {
	font-family: var(--kr-mono);
	font-size: 12px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--kr-shallow);
	font-variant-numeric: tabular-nums;
}

.kr-intro {
	max-width: 58ch;
	margin: 0 0 clamp(28px, 4vw, 48px);
	font-size: 1.15em;
	line-height: 1.55;
}

/* --------------------------------------------------------------- gallery */

/*
 * Justified rows without JavaScript.
 *
 * flex-grow is set to the image's aspect ratio, so within any row the widths
 * come out proportional to the ratios — which means the heights all match.
 * Nothing is cropped, and a tall portrait simply takes less width than a wide
 * landscape instead of being squared off.
 */

.kr-gallery {
	display: flex;
	flex-wrap: wrap;
	gap: var(--kr-gap);
}

.kr-gallery__item {
	position: relative;
	margin: 0;
	flex-grow: calc(var(--ar) * 100);
	flex-shrink: 1;
	flex-basis: calc(var(--ar) * var(--kr-row));
	min-width: 0;
}

.kr-gallery__trigger {
	display: block;
	width: 100%;
	padding: 0;
	border: 0;
	background: var(--kr-haze);
	cursor: zoom-in;
}

.kr-gallery__img {
	width: 100%;
	height: auto;
	aspect-ratio: var(--ar);
	object-fit: cover;
	transition: opacity 0.35s ease;
}

.kr-gallery__trigger:hover .kr-gallery__img {
	opacity: 0.86;
}

.kr-gallery__caption {
	margin-top: 6px;
	font-family: var(--kr-mono);
	font-size: 11px;
	letter-spacing: 0.08em;
	color: var(--kr-shallow);
}

/*
 * The last row would otherwise stretch its few items to full width and blow
 * them up out of scale with everything above. Capping the grow keeps them
 * honest.
 */
.kr-gallery__item:last-child {
	flex-grow: 0;
	max-width: 100%;
}

@media (max-width: 640px) {

	.kr-gallery {
		display: block;
	}

	.kr-gallery__item {
		margin-bottom: calc(var(--kr-gap) * 2);
	}
}

/* ------------------------------------------------------------- portfolio */

.kr-cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
	gap: clamp(20px, 3vw, 44px);
	margin: 0;
	padding: 0;
	list-style: none;
}

.kr-card a {
	display: block;
	text-decoration: none;
}

.kr-card__frame {
	overflow: hidden;
	background: var(--kr-haze);
	aspect-ratio: 3 / 2;
}

.kr-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.kr-card a:hover .kr-card__img {
	transform: scale(1.03);
}

.kr-card__title {
	margin: 12px 0 2px;
	font-family: var(--kr-display);
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 0.2em;
	text-transform: uppercase;
}

/* -------------------------------------------------------------- lightbox */

.kr-lightbox {
	position: fixed;
	inset: 0;
	z-index: 50;
	display: none;
	align-items: center;
	justify-content: center;
	padding: clamp(16px, 4vw, 56px);
	background: rgba(16, 31, 38, 0.96);
}

.kr-lightbox[open],
.kr-lightbox.is-open {
	display: flex;
}

.kr-lightbox__img {
	max-width: 100%;
	max-height: 82vh;
	width: auto;
	object-fit: contain;
}

.kr-lightbox__caption {
	position: absolute;
	left: 50%;
	bottom: clamp(16px, 3vw, 34px);
	transform: translateX(-50%);
	font-family: var(--kr-mono);
	font-size: 12px;
	letter-spacing: 0.1em;
	color: var(--kr-haze);
	text-align: center;
}

.kr-lightbox__btn {
	position: absolute;
	padding: 12px 16px;
	font-family: var(--kr-mono);
	font-size: 18px;
	line-height: 1;
	color: var(--kr-foam);
	background: none;
	border: 0;
	cursor: pointer;
	opacity: 0.65;
	transition: opacity 0.18s ease;
}

.kr-lightbox__btn:hover {
	opacity: 1;
}

.kr-lightbox__close {
	top: 10px;
	right: 12px;
	font-size: 24px;
}

.kr-lightbox__prev {
	left: 4px;
	top: 50%;
	transform: translateY(-50%);
}

.kr-lightbox__next {
	right: 4px;
	top: 50%;
	transform: translateY(-50%);
}

/* ---------------------------------------------------------------- footer */

.kr-footer {
	padding: clamp(28px, 4vw, 48px) var(--kr-pad) clamp(36px, 5vw, 60px);
	/* The horizon, returning. */
	border-top: var(--kr-rule);
}

.kr-footer__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 14px 32px;
}

.kr-footer a {
	font-family: var(--kr-mono);
	font-size: 12px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	text-decoration: none;
	border-bottom: 1px solid transparent;
}

.kr-footer a:hover {
	border-bottom-color: currentColor;
}

/* --------------------------------------------------------------- motion */

@media (prefers-reduced-motion: reduce) {

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}
