/* REX News layout and components. Tokens live in tokens.css. */

/* ---------- Base ---------- */

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

html {
	scroll-behavior: smooth;
	-webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}
}

body {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	margin: 0;
	background: var(--rex-bg);
	color: var(--rex-text);
	font-family: var(--rex-font);
	font-size: 16px;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

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

img {
	height: auto;
}

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

:focus-visible {
	outline: 2px solid var(--rex-lime);
	outline-offset: 2px;
}

.site-main {
	flex: 1;
}

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

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

.skip-link {
	position: absolute;
	top: -100px;
	left: 16px;
	z-index: 100;
	padding: 8px 12px;
	border-radius: var(--rex-radius-sm);
	background: var(--rex-lime);
	color: #000;
	font-weight: 500;
}

.skip-link:focus {
	top: 16px;
}

/* ---------- Buttons ---------- */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	height: 36px;
	padding: 0 20px;
	border: 0;
	border-radius: var(--rex-radius-sm);
	font: 600 14px/1 var(--rex-font);
	white-space: nowrap;
	cursor: pointer;
	transition: background-color 0.15s, opacity 0.15s;
}

.btn--grey {
	background: var(--rex-surface);
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
	color: var(--rex-text);
}

.btn--grey:hover {
	background: var(--rex-surface-hover);
}

.btn--lime {
	background: var(--rex-lime);
	color: #000;
}

.btn--lime:hover {
	opacity: 0.85;
}

/* Disabled colours taken from the design (one step darker than the surface / muted grey). */
.btn.is-disabled {
	background: #252b37;
	box-shadow: none;
	color: #535862;
	pointer-events: none;
}

/* ---------- Header ---------- */

.site-header__top,
.site-subbar {
	border-bottom: 1px solid var(--rex-border);
}

.site-header__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	height: 68px;
}

.site-header__logo img {
	width: 103px;
	height: 36px;
}

.site-header__nav {
	display: flex;
	align-items: center;
	gap: 8px;
}

.site-subbar__inner {
	display: flex;
	align-items: center;
	gap: 12px;
	height: 82px;
}

.site-subbar__back {
	display: inline-flex;
	flex-shrink: 0;
	color: var(--rex-text);
}

.site-subbar__back svg {
	width: 32px;
	height: 32px;
	stroke-width: 1.5;
}

.site-subbar__back:hover {
	color: var(--rex-lime);
}

.site-subbar__title {
	min-width: 0;
	overflow: hidden;
	font-size: 24px;
	font-weight: 500;
	white-space: nowrap;
	text-overflow: ellipsis;
}

/* ---------- Footer ---------- */

.site-footer {
	border-top: 1px solid var(--rex-border);
}

.site-footer__top {
	display: flex;
	justify-content: space-between;
	gap: 48px;
	padding-top: 64px;
	padding-bottom: 128px;
}

.site-footer__brand img {
	width: 103px;
	height: 36px;
}

.site-footer__tagline {
	margin: 12px 0 0;
	font-size: 16px;
	line-height: 1.5;
}

.site-footer__columns {
	display: grid;
	grid-template-columns: repeat(4, auto);
	gap: 0 clamp(32px, 5.6vw, 80px);
}

.site-footer__heading {
	margin: 0 0 12px;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.4;
	text-transform: uppercase;
}

.site-footer__column ul {
	display: grid;
	gap: 12px;
	margin: 0;
	padding: 0;
	font-size: 14px;
	line-height: 20px;
	list-style: none;
}

.site-footer__column a:hover {
	color: var(--rex-lime);
}

.site-footer__bottom {
	border-top: 1px solid var(--rex-border);
	border-bottom: 1px solid var(--rex-border);
}

.site-footer__bottom-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	min-height: 74px;
}

.site-footer__copy {
	margin: 0;
	font-size: 12px;
}

.site-footer__top-link {
	display: inline-flex;
	flex-shrink: 0;
	align-items: center;
	gap: 2px;
	color: var(--rex-lime);
	font-size: 16px;
	font-weight: 600;
	white-space: nowrap;
}

.site-footer__top-link svg {
	width: 24px;
	height: 24px;
}

.site-footer__top-link span {
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 6px;
}

.site-footer__wordmark {
	/* The wordmark PNG has ~19px of transparent padding, so the letters sit 96px below the border. */
	padding: 76px 32px 0;
	overflow: hidden;
}

.site-footer__wordmark img {
	width: 100%;
	max-width: 1374px;
	margin: 0 auto;
}

/* ---------- Responsive: header + footer ---------- */

@media (max-width: 1024px) {
	.site-footer__top {
		flex-direction: column;
	}

	.site-footer__columns {
		grid-template-columns: repeat(4, minmax(0, 1fr));
		gap: 32px;
	}
}

@media (max-width: 640px) {
	.site-header__bar {
		height: 60px;
	}

	.site-header__logo img {
		width: 80px;
		height: 28px;
	}

	.site-header__nav {
		gap: 6px;
	}

	.site-header__nav .btn {
		height: 32px;
		padding: 0 10px;
		font-size: 12px;
	}

	.site-subbar__inner {
		gap: 12px;
		height: 60px;
	}

	.site-subbar__back svg {
		width: 24px;
		height: 24px;
		stroke-width: 2;
	}

	.site-subbar__title {
		font-size: 16px;
	}

	.site-footer__top {
		padding-top: 48px;
		padding-bottom: 48px;
	}

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

	.site-footer__wordmark {
		padding: 48px 16px 0;
	}
}

@media (max-width: 420px) {
	.hide-sm {
		display: none;
	}
}

/* ---------- Breadcrumbs + page heading ---------- */

.breadcrumbs ol {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
	color: var(--rex-text-muted);
	font-size: 16px;
}

.breadcrumbs li {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.breadcrumbs svg {
	width: 24px;
	height: 24px;
}

.breadcrumbs a:hover,
.breadcrumbs [aria-current] {
	color: var(--rex-text);
}

.breadcrumbs [aria-current] {
	font-weight: 500;
}

.breadcrumbs--center ol {
	justify-content: center;
}

.page-title {
	margin: 12px 0 0;
	font-size: clamp(36px, 4.2vw, 60px);
	font-weight: 500;
	line-height: 1.15;
	letter-spacing: -0.03em;
}

.page-subtitle {
	margin: 12px 0 0;
	color: var(--rex-text-muted);
	font-size: 18px;
}

/* ---------- News list ---------- */

.news-list {
	padding-top: 80px;
	padding-bottom: 96px;
}

.news-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 64px 20px;
	margin-top: 64px;
}

.news-card__link {
	display: block;
}

.news-card__media {
	aspect-ratio: 2.4 / 1;
	overflow: hidden;
	border-radius: var(--rex-radius);
	background: var(--rex-surface);
}

.news-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s;
}

.news-card__link:hover .news-card__img {
	transform: scale(1.03);
}

.news-card__title {
	display: -webkit-box;
	margin: 32px 0 0;
	overflow: hidden;
	font-size: 18px;
	font-weight: 600;
	line-height: 1.55;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.news-card__more {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	margin-top: 12px;
	color: var(--rex-lime);
	font-size: 12px;
	font-weight: 600;
}

.news-card__more svg {
	width: 24px;
	height: 24px;
}

.news-card__more-text {
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 5px;
}

.news-empty {
	margin-top: 64px;
	color: var(--rex-text-muted);
}

/* ---------- Pagination ---------- */

.pagination {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-top: 64px;
	padding-top: 16px;
	border-top: 1px solid var(--rex-border);
}

.pagination__info {
	display: flex;
	align-items: center;
	gap: 12px;
	font-size: 16px;
}

.pagination__per-page {
	display: flex;
	gap: 8px;
}

.pagination__per-page select {
	height: 36px;
	padding: 0 44px 0 20px;
	border: 0;
	border-radius: var(--rex-radius-sm);
	background: var(--rex-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 16px center / 24px;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
	color: var(--rex-text);
	font: 600 14px/1 var(--rex-font);
	cursor: pointer;
	appearance: none;
}

.pagination__nav {
	display: flex;
	gap: 12px;
}

@media (max-width: 1024px) {
	.news-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 48px 20px;
	}
}

@media (max-width: 640px) {
	.news-list {
		padding-top: 40px;
	}

	.news-grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 40px;
		margin-top: 40px;
	}
}

/* ---------- News detail ---------- */

.article {
	padding: 80px var(--rex-gutter);
}

.article__hero {
	max-width: 1000px;
	margin: 0 auto;
	aspect-ratio: 2 / 1;
	overflow: hidden;
	border-radius: var(--rex-radius);
	background: var(--rex-surface);
}

.article__hero-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.article__header {
	max-width: 1000px;
	margin: 80px auto 0;
	text-align: center;
}

.article__title {
	margin: 10px 0 0;
	font-size: clamp(30px, 4.2vw, 60px);
	font-weight: 500;
	line-height: 1.2;
	letter-spacing: -0.03em;
}

.article__meta {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px 20px;
	margin: 12px 0 0;
	color: var(--rex-text-muted);
	font-size: 18px;
}

.article__meta span {
	display: inline-flex;
	align-items: center;
	gap: 10px;
}

.article__meta svg {
	width: 22px;
	height: 22px;
}

.article__content {
	max-width: 800px;
	margin: 80px auto 0;
	font-size: 16px;
	line-height: 1.5;
}

.article__content > * {
	margin: 0 0 24px;
}

.article__content > :first-child {
	margin-top: 0;
}

.article__content h2 {
	margin: 48px 0 12px;
	font-size: clamp(24px, 2.1vw, 30px);
	font-weight: 500;
	line-height: 1.3;
}

.article__content h3 {
	margin: 40px 0 12px;
	font-size: 22px;
	font-weight: 500;
	line-height: 1.35;
}

.article__content a {
	color: var(--rex-lime);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.article__content ul,
.article__content ol {
	padding-left: 1.4em;
}

.article__content li + li {
	margin-top: 8px;
}

.article__content blockquote {
	margin-left: 0;
	padding: 4px 0 4px 20px;
	border-left: 3px solid var(--rex-lime);
	font-size: 18px;
}

.article__content figure {
	margin-right: 0;
	margin-left: 0;
}

.article__content img {
	border-radius: var(--rex-radius);
}

.article__content figcaption {
	margin-top: 8px;
	color: var(--rex-text-muted);
	font-size: 13px;
	text-align: center;
}

.article__content code {
	padding: 2px 6px;
	border-radius: 4px;
	background: var(--rex-border);
	font-size: 0.9em;
}

.article__content pre {
	padding: 16px;
	overflow-x: auto;
	border-radius: var(--rex-radius);
	background: var(--rex-border);
}

.article__content pre code {
	padding: 0;
	background: none;
}

.article__content hr {
	margin: 48px 0;
	border: 0;
	border-top: 1px solid var(--rex-border);
}

.article__content table {
	width: 100%;
	border-collapse: collapse;
}

.article__content th,
.article__content td {
	padding: 8px 12px;
	border: 1px solid var(--rex-border);
	text-align: left;
}

.article__share {
	max-width: 800px;
	margin: 48px auto 0;
}

.share {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.share__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
	min-width: 80px;
	height: 26px;
	padding: 0 12px;
	border: 0;
	border-radius: 4px;
	background: var(--rex-surface);
	color: var(--rex-text);
	font: 500 12px/1 var(--rex-font);
	cursor: pointer;
}

.share__btn svg {
	width: 16px;
	height: 16px;
}

.share__btn:hover {
	background: var(--rex-surface-hover);
}

@media (max-width: 640px) {
	.article {
		padding-top: 32px;
	}

	.article__header {
		margin-top: 40px;
	}

	.article__content {
		margin-top: 40px;
	}
}

/* ---------- 404 ---------- */

.not-found {
	padding-top: 120px;
	padding-bottom: 160px;
	text-align: center;
}

.not-found .btn {
	margin-top: 32px;
}
