/*
 * Aktuelles — the auto-advancing news panel on the front page.
 *
 * The viewport is exactly two items tall and the track advances one whole item
 * at a time, driven by main.js. A continuous glide was tried first and looked
 * broken in every still frame: there is no moment at which an item is not
 * sliced by the viewport edge, so a headline is always half-cut. Stepping means
 * an item is fully readable for the seconds it is held, and only moves between
 * those rests.
 *
 * That stepping is now a *scroll* position rather than a transform on a masked
 * track, so the panel is an ordinary scroll container: the scrollbar it shows
 * works, and so do the wheel, the trackpad and a finger. Scroll snapping keeps
 * a hand-driven scroll landing on the same item boundaries the timer uses, so
 * there is no state in which a headline is left half-cut.
 *
 * There is no prefers-reduced-motion block below, and that is on purpose: the
 * only motion here is the timer, main.js checks the query and never starts it,
 * and the panel is then simply a list that sits still until someone scrolls it.
 *
 * No ground. This used to be a filled --brand-cream card, which gave the right
 * half of the hero a block of colour the left half — the wordmark, set on bare
 * white — had no answer to, and the composition leaned. The panel now stands on
 * the same white as the name and holds its own by type weight and the yellow
 * rule under the heading instead of by a fill.
 *
 * Measured, not estimated: headline #121212 on white is 18.7:1, the excerpt
 * 9.2:1, the date 6.0:1. The heading in --brand-teal-ink is 4.31:1 — see the
 * note on its size below. The identity yellow is used only as a rule, never as
 * text.
 */
.aktuelles {
	/*
	 * Sized for the worst case an item can contain — date, a two-line title
	 * and a two-line excerpt — because every item is this tall whether it
	 * needs the room or not. Sizing it for the average instead sliced the
	 * excerpt of any headline that wrapped to two lines.
	 *
	 *   20  date      12px on the inherited 1.5 line-height, + 2 margin
	 *   42  title     2 lines @ 16/1.3
	 *   38  excerpt   2 lines @ 13/1.4, + 2 margin
	 *   16  padding   8 top + 8 bottom
	 *
	 * The old 108 was arithmetic that counted the date at its font size rather
	 * than its line box, so the worst-case item overflowed by ~5px and the
	 * second excerpt line was clipped by the item's own overflow:hidden.
	 */
	--aktuelles-item-h: 116px;

	display: flex;
	flex-direction: column;
	justify-content: center;
	height: 100%;
	min-height: 0;
}

/*
 * The panel's anchor, now that there is no card behind it: bigger, bolder, and
 * over a thicker rule. Those three together are what the cream fill used to do,
 * and they do it without putting a slab of colour opposite the wordmark.
 *
 * 19px is a floor, not a preference. --brand-teal-ink measures 4.31:1 on white,
 * which is under WCAG AA's 4.5:1 for normal text but over the 3:1 that applies
 * to large text — and bold text counts as large from 14pt / 18.66px. At the old
 * 15px this heading was failing AA (and failing it worse on the cream ground it
 * used to sit on, where the same colour measures 3.56:1). Do not shrink it
 * without darkening the colour first.
 */
.aktuelles-title {
	margin: 0 0 12px;
	font-family: 'Open Sans', sans-serif;
	font-size: 19px;
	font-weight: 700;
	letter-spacing: 2.4px;
	text-transform: uppercase;
	color: var(--brand-teal-ink);
	padding-bottom: 9px;
	border-bottom: 3px solid var(--brand-yellow);
	flex: none;
}

/* Items are a fixed height so two of them fill the viewport exactly and no
   third one peeks in at the bottom edge. */
.aktuelles-viewport {
	position: relative;
	height: calc(var(--aktuelles-item-h) * 2);
	flex: none;

	overflow-y: auto;
	overflow-x: hidden;
	/* The panel is two items deep inside a page that scrolls; without this,
	   reaching its last headline hands the wheel straight to the document and
	   the front page jumps. */
	overscroll-behavior-y: contain;

	/* Every item is a snap point at the top edge, which is the same grid the
	   timer advances along — so a flick of the wheel and a tick of the timer
	   come to rest in exactly the same places.

	   main.js sets this to `none` for the length of its own glide and restores
	   it on arrival: the browser re-applies proximity snapping after every
	   scroll position written to this element, which would otherwise pull each
	   frame of the glide onto the nearest item and flatten the curve. It lands
	   on a boundary, so the grid it hands back is the one it lifted. */
	scroll-snap-type: y proximity;

	/* Room for the scrollbar so it does not sit on the text. */
	padding-right: 10px;

	/* An affordance, not an artefact: thin, in the brand teal, and always
	   there rather than an overlay bar that fades out and leaves the panel
	   looking static again. */
	scrollbar-width: thin;
	scrollbar-color: rgba(1, 184, 173, 0.6) rgba(0, 0, 0, 0.07);
}

/*
 * The same bar for Safari, which has no scrollbar-width/-color yet. Not a
 * conflict: Chrome and Firefox ignore ::-webkit-scrollbar entirely once either
 * standard property is set above, so exactly one of the two blocks is ever in
 * effect. Keep the colours in step.
 */
.aktuelles-viewport::-webkit-scrollbar {
	width: 7px;
}

.aktuelles-viewport::-webkit-scrollbar-track {
	background: rgba(0, 0, 0, 0.07);
	border-radius: 4px;
}

.aktuelles-viewport::-webkit-scrollbar-thumb {
	background: rgba(1, 184, 173, 0.6);
	border-radius: 4px;
}

.aktuelles-viewport::-webkit-scrollbar-thumb:hover {
	background: rgba(1, 184, 173, 0.85);
}

/*
 * Deliberately no tabindex on the container: every item in it is a link, so
 * tabbing already walks the list and the browser scrolls each headline into
 * view as it goes. This ring is only for the browsers that focus a scroll
 * container of their own accord — it should never be the reason the panel
 * enters the tab order.
 */
.aktuelles-viewport:focus-visible {
	outline: 3px solid var(--brand-teal-ink);
	outline-offset: 2px;
}

.aktuelles-track {
	list-style: none;
	margin: 0;
	padding: 0;
}

.aktuelles-item {
	height: var(--aktuelles-item-h);
	padding: 8px 0;
	/* Was 0.09, which was enough against cream and nearly invisible on white. */
	border-bottom: 1px solid rgba(0, 0, 0, 0.13);
	overflow: hidden;
	scroll-snap-align: start;
}

.aktuelles-link {
	display: block;
	text-decoration: none;
	color: inherit;
}

/* Was #6d6446, a warm grey mixed for the cream ground. On white it is muddy;
   this is the same warmth taken darker so it still holds at 12px (~5.7:1). */
.aktuelles-date {
	display: block;
	font-family: 'Open Sans', sans-serif;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.6px;
	color: #6a6252;
	margin-bottom: 2px;
}

/*
 * Both title and excerpt are line-clamped: the item height is fixed, so text
 * that ran longer than expected would otherwise spill into the item below.
 */
.aktuelles-item-title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-family: 'Open Sans', sans-serif;
	/* A point larger and truly black. The headline is what carries the panel
	   now that nothing sits behind it. */
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
	color: #121212;
}

.aktuelles-excerpt {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-family: 'Open Sans', sans-serif;
	font-size: 13px;
	line-height: 1.4;
	color: #4d4739;
	margin-top: 2px;
}

.aktuelles-link:hover .aktuelles-item-title,
.aktuelles-link:focus-visible .aktuelles-item-title {
	color: var(--brand-teal-ink);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.aktuelles-link:focus-visible {
	outline: 3px solid var(--brand-teal-ink);
	outline-offset: 3px;
	border-radius: 3px;
}

/*
 * Short viewports.
 *
 * The front page gives 66vh to the hero band, so on a 950px-tall screen this
 * panel has roughly 280px to work with — the full-height item, sized for a
 * two-line headline over a two-line excerpt, runs the panel past the fold. The
 * excerpt drops to a single line and the item shrinks to match: 20 + 42 + 20
 * + 16, by the same arithmetic as above.
 *
 * Keyed to viewport height rather than width because height is the constraint;
 * a 1633x950 laptop and a 1920x1080 monitor are the same width class and need
 * different answers.
 */
@media (max-height: 1000px) {
	.aktuelles {
		--aktuelles-item-h: 98px;
	}

	.aktuelles-excerpt {
		-webkit-line-clamp: 1;
		line-clamp: 1;
	}
}
