/*
Theme Name: CTHRiders Archive
Theme URI: https://www.cthriders.in
Author: Gurpal Kaher
Description: The permanent archive of the CTHRiders Himalayan expeditions, 2009-2018 — three Manali-Leh crossings, the 2014 SUV run and winter Ladakh. A closed collection of finished work. Sister site to Hike Bike Throttle, which carries everything that came after.
Version: 0.1.0
Requires at least: 6.6
Tested up to: 7.0
Requires PHP: 8.1
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: cthriders
Tags: blog, photography, full-site-editing, one-column, dark
*/

/* -----------------------------------------------------------------------------
   Most styling lives in theme.json. This file carries only what theme.json
   cannot express: the ridgeline mark, image treatments for guest photos,
   and the long-form reading rules that keep a 3,000-word story readable on a
   dark background.
   -------------------------------------------------------------------------- */

/* --- Reading comfort ------------------------------------------------------
   Dark backgrounds fatigue the eye over long reads. Three defences: warm
   off-white rather than pure #FFF, generous leading, and a capped measure. */

.cthr-story__body {
	max-width: 68ch;
	margin-inline: auto;
}

.cthr-story__body p {
	margin-block: 0 1.5em;
}

.cthr-story__body > * + h2,
.cthr-story__body > * + h3 {
	margin-block-start: 2.2em;
}

/* Opening paragraph gets a little more presence */
.cthr-story__body > p:first-of-type {
	font-size: 1.15em;
	line-height: 1.65;
	color: var(--wp--preset--color--paper);
}

/* --- Guest photography ----------------------------------------------------
   Contributor photos vary in quality. Fixed-ratio crops plus a scrim keep an
   ordinary phone shot looking considered instead of magnifying its flaws.
   Full-bleed is reserved for images we know are large enough to carry it. */

.cthr-hero {
	position: relative;
	overflow: hidden;
}

.cthr-hero img {
	display: block;
	width: 100%;
	/* `height: auto` is load-bearing. Without it, the HTML height attribute
	   wins and aspect-ratio is ignored, so object-fit crops the sides. */
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
}

.cthr-hero--contained img {
	aspect-ratio: 3 / 2;
}

.cthr-hero::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(
		180deg,
		rgb(10 12 14 / 0.75) 0%,
		rgb(10 12 14 / 0.08) 42%,
		rgb(10 12 14 / 0.94) 100%
	);
	pointer-events: none;
}

.cthr-hero__caption {
	position: absolute;
	inset-inline: 0;
	inset-block-end: 0;
	padding: clamp(1rem, 4vw, 2.5rem);
	z-index: 1;
}

/* --- Data badges ----------------------------------------------------------
   Altitude, distance, days, season. These do triple duty: they render here,
   they power the archive filters, and they are what the submission form asks
   contributors for. */

.cthr-badges {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin-block: 1.2rem;
	list-style: none;
	padding: 0;
}

.cthr-badge {
	border-inline-start: 2px solid var(--wp--preset--color--ember);
	background: rgb(242 239 234 / 0.06);
	padding: 0.4rem 0.7rem;
	min-width: 5.5rem;
}

.cthr-badge__label {
	display: block;
	font-family: var(--wp--preset--font-family--display);
	font-size: 0.6rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	opacity: 0.6;
}

.cthr-badge__value {
	display: block;
	font-family: var(--wp--preset--font-family--display);
	font-size: 1.05rem;
	font-weight: 800;
	line-height: 1.2;
}

.cthr-badge__unit {
	font-size: 0.7em;
	font-weight: 500;
}

/* --- Guest story marker ---------------------------------------------------
   A contributor's story sits in the same grid with the same dignity. The badge
   attributes it; it does not demote it. */

.cthr-guest-tag {
	position: absolute;
	inset-block-start: 0.5rem;
	inset-inline-start: 0.5rem;
	z-index: 1;
	background: var(--wp--preset--color--ember);
	color: var(--wp--preset--color--ink);
	font-family: var(--wp--preset--font-family--display);
	font-size: 0.55rem;
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	padding: 0.2rem 0.5rem;
}

/* --- Films band -----------------------------------------------------------
   The one place the site goes fully cinematic. Populated from the channel's
   RSS feed, so it refreshes itself. */

.cthr-films {
	background: var(--wp--preset--color--ink);
	padding-block: clamp(1.5rem, 5vw, 3rem);
}

.cthr-films__head {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 1rem;
	border-block-end: 1px solid rgb(242 239 234 / 0.14);
	padding-block-end: 0.7rem;
	margin-block-end: 1rem;
}

.cthr-films__title {
	font-family: var(--wp--preset--font-family--display);
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	margin: 0;
}

.cthr-films__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 1rem;
	list-style: none;
	padding: 0;
	margin: 0;
}

.cthr-film a {
	text-decoration: none;
	color: inherit;
	display: block;
}

/* Scoped to the thumbnail specifically — a bare `.cthr-film img` also matches
   the emoji images WordPress injects into titles, and stretches them. */
.cthr-film__thumb {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	background: var(--wp--preset--color--surface);
}

/* Emoji in a film title should stay inline text-sized. */
.cthr-film img.emoji {
	width: 1em;
	height: 1em;
	aspect-ratio: auto;
	display: inline-block;
	vertical-align: -0.1em;
}

.cthr-film__title {
	font-family: var(--wp--preset--font-family--display);
	font-size: 0.8rem;
	font-weight: 600;
	line-height: 1.35;
	margin-block: 0.5rem 0.25rem;
}

.cthr-film__meta {
	font-family: var(--wp--preset--font-family--display);
	font-size: 0.65rem;
	opacity: 0.5;
}

.cthr-film a:hover .cthr-film__title,
.cthr-film a:focus-visible .cthr-film__title {
	color: var(--wp--preset--color--ember);
}

.cthr-films__empty {
	font-size: 0.85rem;
	opacity: 0.6;
}

/* --- Accessibility --------------------------------------------------------
   Focus has to be visible against a near-black page, and motion is optional. */

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
	outline: 2px solid var(--wp--preset--color--ember);
	outline-offset: 3px;
}

@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;
	}
}

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