/* The platform's front page (pkg/theme/platform/index/front.html): its
   layout, and a plain look drawn from the theme's variables, which every
   theme may restyle. Themes set --ink, --paper, --muted, --rule, --accent,
   --serif-display, --sans, --measure, --wide and --gutter, or get the
   fallbacks here. It comes before the theme's stylesheet, so the theme
   wins ties. */

.front,
.front-search {
	--front-ink: var(--ink, currentColor);
	--front-muted: var(--muted, #666);
	--front-rule: var(--rule, #ddd);
	--front-accent: var(--accent, currentColor);
	--front-display: var(--serif-display, Georgia, serif);
	--front-sans: var(--sans, system-ui, sans-serif);
	--front-measure: var(--measure, 40rem);
	--front-wide: var(--wide, 66rem);
	--front-gutter: var(--gutter, 1.5rem);
}

.front {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, var(--front-measure)) minmax(0, 1fr);
	/* Room between the header and the front page. */
	margin-top: 1.5rem;
}

/* Everything runs in the text column but the top, across the page. */
.front > * { grid-column: 2; }
.front > .front-top { grid-column: 1 / -1; }

/* The lead, and the pinned posts in columns beside it as on a newspaper's
   front page; below it on narrow screens. */
.front-top {
	padding-bottom: 2rem;
	margin-bottom: 1rem;
	border-bottom: 1px solid var(--front-ink);
}

.front-top.with-pins {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr) minmax(0, 1fr);
	gap: 2.5rem;
	align-items: start;
}

.front-lead {
	max-width: var(--front-wide);
	margin: 0 auto;
	text-align: center;
}

.front-lead-image { display: block; margin-top: 1.25rem; }
.front-lead-image img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }

.front-lead-label {
	margin: 0 0 0.75rem;
	font-family: var(--front-sans);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--front-accent);
}

.front-lead-headline {
	margin: 0;
	font-family: var(--front-display);
	font-size: clamp(2rem, 5vw, 3.25rem);
	font-weight: 700;
	line-height: 1.05;
	letter-spacing: -0.025em;
}

.front-lead-dek {
	max-width: var(--front-measure);
	margin: 1rem auto 0;
	font-size: 1.25rem;
	color: var(--front-muted);
}

.front-pins {
	display: grid;
	gap: 1.75rem;
	align-content: start;
}

/* With rules (the owner's choice), a line runs down the middle of the gap
   between each column and the lead: half the gap from each. */
.with-rules > .front-pins-left { margin-right: -1.25rem; padding-right: 1.25rem; border-right: 1px solid var(--front-rule); }
.with-rules > .front-pins-right { margin-left: -1.25rem; padding-left: 1.25rem; border-left: 1px solid var(--front-rule); }
.front-pins:empty { border: 0; }

.front-pin-image { display: block; margin-bottom: 0.6rem; }
.front-pin-image img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; }

.front-pin-headline {
	margin: 0;
	font-family: var(--front-display);
	font-size: 1.15rem;
	font-weight: 700;
	line-height: 1.2;
}

.front-pin-dek {
	margin: 0.35rem 0 0;
	font-size: 0.92rem;
	line-height: 1.45;
	color: var(--front-muted);
}

@media (max-width: 60rem) {
	.front-top.with-pins { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
	.with-pins > .front-lead { grid-column: 1 / -1; grid-row: 1; }
	.front-pins-left, .front-pins-right { margin: 0; padding: 0; border: 0; }
}

@media (max-width: 36rem) {
	.front-top.with-pins { grid-template-columns: minmax(0, 1fr); }
}

/* The posts by date. */
.front-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.front-story {
	padding: 1.5rem 0;
	border-top: 1px solid var(--front-rule);
}

.front-list > .front-story:first-child { border-top: 0; }

.front-story-headline {
	margin: 0;
	font-family: var(--front-display);
	font-size: 1.6rem;
	font-weight: 700;
	line-height: 1.15;
	letter-spacing: -0.01em;
}

.front-story-dek { margin: 0.5rem 0 0; color: var(--front-muted); }

.front-lead-headline a,
.front-pin-headline a,
.front-story-headline a { color: inherit; text-decoration: none; }
.front-lead-headline a:hover,
.front-pin-headline a:hover,
.front-story-headline a:hover { color: var(--front-accent); }

.front-date {
	display: block;
	margin-top: 0.6rem;
	font-family: var(--front-sans);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--front-muted);
}

/* Cards: the posts by date in columns, like the pinned posts, the top
   ones (front-card-top) in their own number of columns. The list runs
   across the page; headings span its width. */
.front > .front-cards { grid-column: 1 / -1; }

.front-cards {
	display: grid;
	grid-template-columns: repeat(12, minmax(0, 1fr));
	gap: 2rem 2rem;
	max-width: var(--front-wide);
	width: 100%;
	margin: 0 auto;
}

.front-cards > :not(.front-card) { grid-column: 1 / -1; }
.front-cards.cols-2 > .front-card { grid-column: span 6; }
.front-cards.cols-3 > .front-card { grid-column: span 4; }
.front-cards.cols-4 > .front-card { grid-column: span 3; }
.front-cards.top-cols-2 > .front-card-top { grid-column: span 6; }
.front-cards.top-cols-3 > .front-card-top { grid-column: span 4; }
.front-cards.top-cols-4 > .front-card-top { grid-column: span 3; }

.front-card-image { display: block; margin-bottom: 0.6rem; }
.front-card-image img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; }

.front-card-headline {
	margin: 0;
	font-family: var(--front-display);
	font-size: 1.2rem;
	font-weight: 700;
	line-height: 1.2;
}

.front-card-top .front-card-headline { font-size: 1.6rem; }
.front-card-headline a { color: inherit; text-decoration: none; }
.front-card-headline a:hover { color: var(--front-accent); }

.front-card-dek {
	margin: 0.35rem 0 0;
	font-size: 0.95rem;
	line-height: 1.45;
	color: var(--front-muted);
}

@media (max-width: 48rem) {
	.front-cards > .front-card,
	.front-cards > .front-card-top { grid-column: span 6; }
}

@media (max-width: 32rem) {
	.front-cards > .front-card,
	.front-cards > .front-card-top { grid-column: 1 / -1; }
}

/* Year and month headings. They scroll to just under a sticky header. */
.front-year,
.front-month { scroll-margin-top: 7rem; }

.front-year > h2 {
	margin: 4rem 0 0;
	padding-bottom: 0.5rem;
	border-bottom: 3px solid var(--front-ink);
	font-family: var(--front-display);
	font-size: clamp(2.8rem, 6vw, 3.8rem);
	font-weight: 700;
	line-height: 1;
	letter-spacing: -0.03em;
}

/* A month is its name, then a rule to the column's edge, and its picture
   as a wide band under it. */
.front-month > h3 {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin: 2.5rem 0 0;
	font-family: var(--front-sans);
	font-size: 1rem;
	font-weight: 800;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--front-accent);
}

.front-month > h3::after {
	content: "";
	flex: 1;
	border-top: 1px solid var(--front-accent);
}

.front-month-image {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 4 / 1;
	object-fit: cover;
	margin-top: 0.75rem;
}

.front-month + .front-story { border-top: 0; padding-top: 0.75rem; }

.front-more,
.front-newer {
	max-width: var(--measure, 40rem);
	margin: 2rem auto 0;
	font-family: var(--sans, system-ui, sans-serif);
	font-size: 0.85rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.front-newer { margin: 0 auto 2rem; }
.front-more a,
.front-newer a { color: var(--muted, #666); }
.front-more a:hover,
.front-newer a:hover { color: var(--accent, currentColor); }
.front-more a[aria-busy="true"] { opacity: 0.5; }

/* A tag's page: its name over the list of its posts. */
.front-tag {
	max-width: var(--measure, 40rem);
	margin: 0 auto 2.5rem;
	font-family: var(--sans, system-ui, sans-serif);
}
.front-tag-label {
	margin: 0;
	color: var(--muted, #666);
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}
.front-tag-name { margin: 0.2rem 0 0.4rem; font-family: var(--serif, Georgia, serif); }
.front-tag-feed { color: var(--muted, #666); font-size: 0.85rem; }
.front-tag-feed:hover { color: var(--accent, currentColor); }

/* The search page: its form over what it found. */
.front-search {
	max-width: var(--front-measure);
	margin: 0 auto 2.5rem;
	font-family: var(--front-sans);
}
.front-search-title { margin: 0 0 0.75rem; font-family: var(--front-display); }
.front-search-form { display: flex; gap: 0.5rem; }
.front-search-input {
	flex: 1;
	min-width: 0;
	padding: 0.5rem 0.7rem;
	border: 1px solid var(--front-muted);
	border-radius: 4px;
	background: var(--paper, transparent);
	color: var(--front-ink);
	font: inherit;
}
.front-search-input:focus { outline: 2px solid var(--front-accent); outline-offset: 1px; }
.front-search-button {
	padding: 0.5rem 1rem;
	border: 1px solid var(--front-ink);
	border-radius: 4px;
	background: var(--front-ink);
	color: var(--paper, Canvas);
	font: inherit;
	cursor: pointer;
}
.front-story-snippet { margin: 0.3rem 0; color: var(--front-muted); }
.front-story-snippet mark {
	background: color-mix(in srgb, var(--front-accent) 22%, transparent);
	color: var(--front-ink);
	padding: 0 0.1em;
}

.front-empty {
	text-align: center;
	color: var(--muted, #666);
	font-style: italic;
}

/* Year links: at the page's left edge beside the posts, below the lead,
   staying in view; a row under the lead on narrow screens. The platform's
   script marks the year being read. */
.front-years ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1rem;
	margin: 0 0 1rem;
	padding: 0;
	list-style: none;
	font-family: var(--front-sans);
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.06em;
}

.front-years a { color: var(--front-muted); text-decoration: none; }
.front-years a:hover { color: var(--front-accent); }
.front-years a[aria-current] { color: var(--front-ink); box-shadow: inset 0 -2px 0 var(--front-accent); }

@media (min-width: 60rem) {
	.front > .front-years {
		grid-column: 1;
		grid-row: 2 / span 2;
		align-self: start;
		justify-self: start;
		position: sticky;
		top: 7rem;
		/* From the front page's left edge out to the body's padding. */
		margin: 2.5rem 0 0 calc(-1 * max(0px, (100vw - 2 * var(--front-gutter) - var(--front-wide)) / 2));
	}
	.front > .front-list { grid-row: 2; }
	.front > .front-more { grid-row: 3; }
	.front-years ul {
		flex-direction: column;
		gap: 0.5rem;
		margin: 0;
	}
}
