/*
 * RBSEResult — responsive layer.
 *
 * main.css is the small-screen baseline (tested down to 320px). This file only
 * adds capability as space allows: multi-column grids, the horizontal desktop
 * navigation and the sidebar column.
 *
 * Breakpoints are chosen for the device widths this audience actually uses:
 *   360px  small Android
 *   390px  common phone
 *   412px  large Android
 *   600px  large phone / small tablet
 *   768px  tablet
 *   1024px small laptop
 *   1200px desktop
 */

/* -------------------------------------------------------------------------
 * 360px — the narrowest common Android width
 * ---------------------------------------------------------------------- */

@media (min-width: 360px) {
	.rbse-status__action {
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
	}
}

/* -------------------------------------------------------------------------
 * 480px — two-up fact rows
 * ---------------------------------------------------------------------- */

@media (min-width: 480px) {
	.rbse-facts__row {
		grid-template-columns: 11rem 1fr;
		gap: 0.75rem;
		align-items: baseline;
	}

	.rbse-facts__key {
		text-align: start;
	}

	.rbse-card__date {
		flex-direction: row;
		gap: 0.5rem;
		align-items: baseline;
	}

	.rbse-related__list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* -------------------------------------------------------------------------
 * 600px — cards and streams pair up
 * ---------------------------------------------------------------------- */

@media (min-width: 600px) {
	h1 {
		font-size: 1.85rem;
	}

	.rbse-hero {
		padding: 1.75rem;
	}

	.rbse-hero__title {
		font-size: 2.1rem;
	}

	.rbse-page-head__title {
		font-size: 1.8rem;
	}

	.rbse-cards,
	.rbse-streams__list,
	.rbse-links {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.rbse-grid--2 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.rbse-post-nav .nav-links {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.rbse-footer__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.rbse-footer__widgets {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.rbse-prose table {
		display: table;
		white-space: normal;
	}
}

/* -------------------------------------------------------------------------
 * 768px — horizontal navigation, three-up panels
 * ---------------------------------------------------------------------- */

@media (min-width: 768px) {
	.rbse-main {
		padding-block: 2rem 3rem;
	}

	.rbse-nav-toggle {
		display: none;
	}

	/* The toggle is gone, so the menu must always be visible from here up. */
	.rbse-nav {
		display: block !important;
		flex-basis: auto;
		width: 100%;
	}

	.rbse-header__inner {
		padding-block: 1rem;
	}

	.rbse-menu {
		flex-direction: row;
		flex-wrap: wrap;
		gap: 0.1rem 0.25rem;
		margin-top: 0.75rem;
		padding-top: 0.65rem;
		border-top: 1px solid var(--rbse-line);
	}

	.rbse-menu a {
		padding: 0.45rem 0.7rem;
		font-size: 0.92rem;
	}

	.rbse-menu .current-menu-item > a,
	.rbse-menu .current_page_item > a,
	.rbse-menu [aria-current="page"] {
		box-shadow: inset 0 -3px 0 var(--rbse-primary);
	}

	/* Dropdowns: hover and keyboard focus both open them. */
	.rbse-menu .sub-menu {
		position: absolute;
		top: 100%;
		left: 0;
		z-index: 30;
		min-width: 14rem;
		margin: 0;
		padding: 0.35rem;
		background: var(--rbse-base);
		border: 1px solid var(--rbse-line-strong);
		border-radius: var(--rbse-radius-sm);
		box-shadow: 0 8px 20px rgb(28 25 23 / 12%);
		opacity: 0;
		visibility: hidden;
	}

	.rbse-menu li:hover > .sub-menu,
	.rbse-menu li:focus-within > .sub-menu {
		opacity: 1;
		visibility: visible;
	}

	.rbse-nav__search {
		margin-top: 0;
		padding-top: 0;
		border-top: 0;
	}

	.rbse-nav {
		display: flex !important;
		flex-wrap: wrap;
		align-items: center;
		justify-content: space-between;
		gap: 0.75rem;
	}

	.rbse-nav > .rbse-menu {
		flex: 1 1 auto;
	}

	.rbse-nav__search {
		flex: 0 1 18rem;
	}

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

	.rbse-grid--3 {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.rbse-status-pair {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.rbse-streams__list {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.rbse-entry {
		flex-direction: row;
		align-items: flex-start;
		gap: 1.25rem;
	}

	.rbse-entry__thumb {
		flex: 0 0 12rem;
	}

	.rbse-entry__body {
		flex: 1 1 auto;
		min-width: 0;
	}

	.rbse-footer__grid {
		grid-template-columns: 1.4fr 1fr 1fr 1fr;
	}

	.rbse-footer__widgets {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.alignleft {
		float: left;
		margin: 0.25rem 1.5rem 1rem 0;
	}

	.alignright {
		float: right;
		margin: 0.25rem 0 1rem 1.5rem;
	}
}

/* -------------------------------------------------------------------------
 * 1024px — sidebar column
 * ---------------------------------------------------------------------- */

@media (min-width: 1024px) {
	.rbse-layout--sidebar {
		display: grid;
		gap: 2rem;
		grid-template-columns: minmax(0, 1fr) 20rem;
		align-items: start;
	}

	.rbse-sidebar {
		margin-top: 0;
		position: sticky;
		top: 1.5rem;
	}

	.rbse-hero__title {
		font-size: 2.35rem;
	}

	.rbse-section {
		margin-block: 2.5rem;
	}

	.rbse-primary--wide {
		max-width: none;
	}

	.rbse-related__list {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

/* -------------------------------------------------------------------------
 * 1200px — a little more air, nothing structural
 * ---------------------------------------------------------------------- */

@media (min-width: 1200px) {
	.rbse-wrap {
		padding-inline: 1.5rem;
	}

	.rbse-hero {
		padding: 2.25rem;
	}
}

/* -------------------------------------------------------------------------
 * Preferences
 * ---------------------------------------------------------------------- */

@media (prefers-contrast: more) {
	:root {
		--rbse-muted: #3f3b38;
		--rbse-line: #b9b5b2;
		--rbse-line-strong: #8c8783;
	}

	.rbse-pill {
		border-width: 2px;
	}
}

/*
 * Dark mode is deliberately conservative: the palette flips to dark surfaces,
 * but the status tones keep their meaning and their contrast so a live result
 * still reads as live.
 */
@media (prefers-color-scheme: dark) {
	:root {
		--rbse-ink: #f5f4f1;
		--rbse-body: #e7e5e4;
		--rbse-muted: #b8b2ad;
		--rbse-line: #3a3532;
		--rbse-line-strong: #55504c;
		--rbse-surface: #241f1d;
		--rbse-surface-2: #1d1917;
		--rbse-base: #171412;
		--rbse-primary: #f0a6bd;
		--rbse-primary-dark: #f6c6d5;
		--rbse-primary-tint: #33191f;
		--rbse-accent: #f0b268;
		--rbse-accent-dark: #f6cd9b;
		--rbse-accent-tint: #33240f;
		--rbse-live: #6ee7a0;
		--rbse-live-tint: #12291c;
		--rbse-soon: #f0b268;
		--rbse-soon-tint: #33240f;
		--rbse-wait: #c9c3be;
		--rbse-wait-tint: #232020;
		--rbse-closed: #b8b2ad;
		--rbse-closed-tint: #201d1b;
		--rbse-error: #f78d8d;
		--rbse-error-tint: #33191a;
	}

	.rbse-strip {
		background: #33191f;
		color: #f6c6d5;
	}

	.rbse-btn {
		color: #171412;
	}

	.rbse-btn:hover,
	.rbse-btn:focus {
		color: #171412;
	}

	.rbse-btn--ghost {
		color: var(--rbse-primary);
	}

	.rbse-hero {
		background: linear-gradient(180deg, #241a1d, var(--rbse-base));
	}

	.rbse-banner {
		border-bottom-color: #4a3a1c;
	}

	.rbse-callout {
		border-color: #4a3a1c;
	}

	.rbse-menu .sub-menu {
		box-shadow: 0 8px 20px rgb(0 0 0 / 45%);
	}
}
