/* =========================================================
   Base: reset, the global type system, layout primitives,
   buttons and links, motion. Nothing section-specific.
   ========================================================= */

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

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-padding-top: calc(var(--nav-h) + var(--space-md));
}

@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior: smooth;
	}
}

body {
	margin: 0;
	background: var(--ground);
	color: var(--ink);
	font-family: var(--font-body);
	font-size: var(--fs-body);
	font-weight: var(--fw-body);
	line-height: var(--lh-body);
	font-kerning: normal;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

body.is-locked {
	overflow: hidden;
}

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

img {
	height: auto;
}

h1, h2, h3, h4, h5, p, ul, ol, dl, dd, figure {
	margin: 0;
}

:where(ul[class], ol[class]) {
	list-style: none;
	padding: 0;
}

a {
	color: inherit;
	text-decoration: none;
}

button,
input,
select {
	font: inherit;
	color: inherit;
}

button {
	cursor: pointer;
}

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

::selection {
	background: var(--corten);
	color: #fff;
}

/* =========================================================
   Type system
   Heading elements and the matching classes share one rule
   each, so a level always looks the same wherever it appears.
   ========================================================= */

h1, h2, h3, h4,
.t-display, .t-h2, .t-h3, .t-h4 {
	font-family: var(--font-display);
	font-weight: var(--fw-display);
	text-wrap: balance;
}

.t-display {
	font-size: var(--fs-display);
	line-height: var(--lh-display);
	letter-spacing: var(--ls-display);
	font-variation-settings: "opsz" 72;
}

h2, .t-h2 {
	font-size: var(--fs-h2);
	line-height: var(--lh-h2);
	letter-spacing: var(--ls-h2);
	font-variation-settings: "opsz" 60;
}

h3, .t-h3 {
	font-size: var(--fs-h3);
	line-height: var(--lh-h3);
	letter-spacing: var(--ls-h3);
	font-variation-settings: "opsz" 48;
}

h4, .t-h4 {
	font-size: var(--fs-h4);
	line-height: var(--lh-h4);
	letter-spacing: var(--ls-h4);
	font-variation-settings: "opsz" 24;
}

/* Emphasis inside any heading: italic, same weight */
:is(h1, h2, h3, h4, .t-display, .t-h2, .t-h3) em {
	font-style: italic;
}

.t-lead {
	font-size: var(--fs-lead);
	line-height: var(--lh-lead);
}

.t-small {
	font-size: var(--fs-small);
	line-height: var(--lh-small);
}

.t-label {
	font-family: var(--font-body);
	font-size: var(--fs-label);
	font-weight: var(--fw-strong);
	line-height: 1.4;
	letter-spacing: var(--ls-label);
	text-transform: uppercase;
}

.t-num {
	font-variant-numeric: tabular-nums lining-nums;
}

.c-muted  { color: var(--muted); }
.c-accent { color: var(--corten); }

/* Metadata line under cards: author · read time */
.meta {
	color: var(--muted);
	font-size: var(--fs-small);
	line-height: var(--lh-small);
}

/* =========================================================
   Layout primitives
   ========================================================= */

.container {
	position: relative;
	width: 100%;
	max-width: calc(var(--max) + var(--gutter) * 2);
	margin-inline: auto;
	padding-inline: var(--gutter);
}

/* Every homepage section uses the same vertical rhythm */
.section {
	padding-block: var(--section-space);
}

/* Two light sections in a row: they share one gap, split by a hairline */
.section:not(.band):has(+ .section:not(.band)) {
	padding-bottom: calc(var(--section-space) * 0.55);
}

.section:not(.band) + .section:not(.band) {
	padding-top: 0;
}

.section:not(.band) + .section:not(.band) > .container:first-child {
	padding-top: calc(var(--section-space) * 0.55);
}

.section:not(.band) + .section:not(.band) > .container:first-child::before {
	content: "";
	position: absolute;
	top: 0;
	left: var(--gutter);
	right: var(--gutter);
	height: 1px;
	background: var(--rule);
}

/* Section heading block: label → title → description, then content */
.section-head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: var(--space-md) var(--grid-gap-wide);
	margin-bottom: var(--head-space);
}

.section-head__text {
	max-width: 40rem;
}

.section-head .t-label {
	display: block;
	margin-bottom: var(--label-gap);
}

.section-desc {
	margin-top: var(--title-gap);
	max-width: 34em;
	color: var(--muted);
	font-size: var(--fs-lead);
	line-height: var(--lh-lead);
}

/* =========================================================
   Media
   ========================================================= */

.media {
	position: relative;
	display: block;
	overflow: hidden;
	background: var(--placeholder);
}

.media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	/* One quiet grade so photos from different sources sit together */
	filter: saturate(0.86) contrast(1.02);
	transition: transform 1.1s var(--ease);
}

/* Gentle zoom when the card or link around an image is hovered */
@media (hover: hover) {
	.is-zoomable:hover .media img {
		transform: scale(1.03);
	}
}

/* =========================================================
   Icons
   ========================================================= */

.sprite {
	position: absolute;
	width: 0;
	height: 0;
	overflow: hidden;
}

.icon {
	width: 18px;
	height: 18px;
	flex: none;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.5;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* =========================================================
   Buttons and links
   Rectangular, flat, one height. Hover changes colour only.
   ========================================================= */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-2xs);
	min-height: 48px;
	padding: 0 var(--space-md);
	border: 1px solid var(--ink);
	border-radius: 0;
	background: transparent;
	color: var(--ink);
	font-family: var(--font-body);
	font-size: var(--fs-small);
	font-weight: var(--fw-strong);
	letter-spacing: 0.02em;
	white-space: nowrap;
	transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}

.btn--ink {
	background: var(--ink);
	color: var(--on-ink);
}

.btn--ink:hover {
	background: var(--ink-soft);
}

.btn--accent {
	border-color: var(--corten);
	background: var(--corten);
	color: #fff;
}

.btn--accent:hover {
	border-color: var(--corten-deep);
	background: var(--corten-deep);
}

.btn--line:hover {
	background: var(--ink);
	color: var(--on-ink);
}

.btn--light {
	border-color: var(--on-ink);
	background: var(--on-ink);
	color: var(--ink);
}

.btn--light:hover {
	background: #fff;
	border-color: #fff;
}

.btn--sm {
	min-height: 40px;
	padding: 0 var(--space-sm);
}

/* Text link: permanent hairline underline that darkens on hover */
.link {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2xs);
	min-height: 44px;
	font-size: var(--fs-small);
	font-weight: var(--fw-strong);
	letter-spacing: 0.02em;
}

.link span {
	padding-bottom: 2px;
	border-bottom: 1px solid var(--rule-strong);
	transition: border-color var(--dur-fast) ease;
}

.link .icon {
	width: 16px;
	height: 16px;
	transition: transform var(--dur) var(--ease);
}

.link:hover span {
	border-color: currentColor;
}

.link:hover .icon {
	transform: translateX(3px);
}

.link--muted { color: var(--muted); }
.link--muted:hover { color: var(--ink); }

.link--on-ink span { border-color: var(--rule-on-ink); }

.actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--control-gap) var(--space-md);
}

/* Chips: square-cornered location buttons and search suggestions */
.chips {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2xs);
}

.chip {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 14px;
	border: 1px solid var(--rule-strong);
	border-radius: 0;
	background: transparent;
	font-size: var(--fs-small);
	transition: border-color var(--dur-fast) ease, background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}

.chip:hover {
	border-color: var(--ink);
}

.chip[aria-pressed="true"] {
	border-color: var(--ink);
	background: var(--ink);
	color: var(--on-ink);
}

/* Small outlined tag for sample/demo content */
.tag {
	display: inline-flex;
	align-items: center;
	min-height: 22px;
	padding: 0 8px;
	border: 1px solid var(--rule-strong);
	font-size: 0.6875rem;
	font-weight: var(--fw-strong);
	letter-spacing: 0.1em;
	text-transform: uppercase;
	line-height: 1;
}

/* =========================================================
   Accessibility helpers
   ========================================================= */

.visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

.skip-link {
	position: fixed;
	top: var(--space-xs);
	left: var(--space-xs);
	z-index: 1000;
	padding: var(--space-xs) var(--space-sm);
	background: var(--ink);
	color: var(--on-ink);
	font-weight: var(--fw-strong);
	transform: translateY(-200%);
	transition: transform var(--dur-fast) ease;
}

.skip-link:focus {
	transform: none;
}

/* =========================================================
   Motion
   Content is visible by default. Only when JS is running and
   motion is allowed do elements wait to be revealed.
   ========================================================= */

@media (prefers-reduced-motion: no-preference) {
	.js [data-reveal] {
		opacity: 0;
		transform: translateY(16px);
		transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
		transition-delay: calc(var(--i, 0) * 80ms);
	}

	.js [data-reveal].is-in {
		opacity: 1;
		transform: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		transition-delay: 0ms !important;
	}
}

/* Long titles and unbroken strings (URLs, names) wrap instead of overflowing */
h1, h2, h3, h4, p, dd, li, figcaption, caption {
	overflow-wrap: break-word;
}

/* No single orphaned word on the last line of a paragraph */
p, dd, li, figcaption {
	text-wrap: pretty;
}

/* Keep content clear of notches and rounded corners in landscape */
.container {
	padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
}
