/* EMSA Racing Circuit: one stylesheet for the whole site. */

@font-face {
	font-family: "Open Sans";
	font-style: normal;
	font-weight: 400 700;
	font-display: swap;
	src: url("../fonts/open-sans-latin.woff2") format("woff2");
}
@font-face {
	font-family: "Open Sans";
	font-style: italic;
	font-weight: 400 700;
	font-display: swap;
	src: url("../fonts/open-sans-italic-latin.woff2") format("woff2");
}
@font-face {
	font-family: "Titillium Web";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/titillium-web-400-latin.woff2") format("woff2");
}
@font-face {
	font-family: "Titillium Web";
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url("../fonts/titillium-web-600-latin.woff2") format("woff2");
}
@font-face {
	font-family: "Titillium Web";
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url("../fonts/titillium-web-700-latin.woff2") format("woff2");
}

:root {
	--ink: #0d141a;
	--muted: #5b6573;
	--navy: #1a2233;
	--navy-2: #232d42;
	--paper: #fff;
	--mist: #f2f6fa;
	--line: #dfe4eb;
	--accent: #006ff6;
	--accent-dark: #0058c4;
	--red: #d0161d;
	--radius: 8px;
	--wrap: 1140px;
	--font-body: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--font-head: "Titillium Web", "Open Sans", system-ui, sans-serif;
}

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

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

body {
	margin: 0;
	font-family: var(--font-body);
	font-size: 1rem;
	line-height: 1.65;
	color: var(--ink);
	background: var(--paper);
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}

main {
	flex: 1 0 auto;
}

img {
	max-width: 100%;
	height: auto;
	display: block;
}

h1,
h2,
h3,
h4 {
	font-family: var(--font-head);
	font-weight: 700;
	line-height: 1.2;
	margin: 2rem 0 0.75rem;
	color: var(--ink);
}

h1 {
	font-size: clamp(2rem, 4vw, 2.75rem);
	margin-top: 0;
}

h2 {
	font-size: clamp(1.4rem, 2.6vw, 1.8rem);
}

h3 {
	font-size: 1.25rem;
}

p,
ul,
ol {
	margin: 0 0 1rem;
}

a {
	color: var(--accent);
	text-underline-offset: 0.15em;
}

a:hover {
	color: var(--accent-dark);
}

:focus-visible {
	outline: 3px solid var(--accent);
	outline-offset: 2px;
}

.container {
	width: 100%;
	max-width: var(--wrap);
	margin: 0 auto;
	padding: 0 1.5rem;
}

.narrow {
	max-width: 780px;
}

.skip-link {
	position: absolute;
	left: -999px;
	top: 0.5rem;
	z-index: 10;
	padding: 0.5rem 1rem;
	background: var(--navy);
	color: #fff;
	border-radius: var(--radius);
}

.skip-link:focus {
	left: 0.5rem;
}

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

.site-header {
	background: var(--mist);
	border-bottom: 1px solid var(--line);
}

.site-header__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem 2rem;
	min-height: 74px;
	padding-top: 0.6rem;
	padding-bottom: 0.6rem;
}

.brand {
	font-family: var(--font-body);
	font-weight: 700;
	font-size: 1.15rem;
	color: var(--ink);
	text-decoration: none;
	white-space: nowrap;
}

.brand:hover {
	color: var(--ink);
}

.site-nav ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1.6rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.site-nav a {
	display: inline-block;
	padding: 0.35rem 0;
	color: var(--ink);
	text-decoration: none;
	border-bottom: 1px solid transparent;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
	border-bottom-color: currentColor;
}

@media (max-width: 760px) {
	.site-header__inner {
		justify-content: center;
		text-align: center;
	}

	.site-nav ul {
		justify-content: center;
		gap: 0 1.1rem;
	}
}

/* ---------- Page sections ---------- */

.page {
	padding: 3rem 0 4rem;
}

.page-head {
	text-align: center;
	margin-bottom: 2rem;
}

.page-head p {
	color: var(--muted);
	max-width: 680px;
	margin: 0 auto;
}

.lead {
	font-size: 1.1rem;
	color: var(--muted);
}

.hero {
	background: #000;
	color: #fff;
	text-align: center;
	padding: 3.5rem 0 3.75rem;
}

.hero__logo {
	width: min(320px, 70vw);
	margin: 0 auto 1.5rem;
}

.hero h1 {
	color: #fff;
	margin: 0 0 0.75rem;
}

.hero p {
	margin: 0;
	font-size: 1.05rem;
}

.logo-banner {
	background: #000;
	border-radius: var(--radius);
	max-width: 420px;
	margin: 0 auto 2rem;
	padding: 0.5rem 1.5rem;
}

.split {
	display: grid;
	gap: 2.5rem;
	align-items: center;
}

@media (min-width: 860px) {
	.split {
		grid-template-columns: 1fr 1fr;
	}
}

.section {
	padding: 3.5rem 0;
}

.section--mist {
	background: var(--mist);
}

.section h2:first-child {
	margin-top: 0;
}

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

.buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin: 1.5rem 0 0;
}

.button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.6rem 1.4rem;
	border: 2px solid var(--ink);
	border-radius: 999px;
	background: transparent;
	color: var(--ink);
	font: 600 0.95rem/1.3 var(--font-body);
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s, color 0.15s;
}

.button:hover {
	background: var(--ink);
	color: #fff;
}

.button--solid {
	background: var(--navy);
	border-color: var(--navy);
	color: #fff;
}

.button--solid:hover {
	background: var(--accent);
	border-color: var(--accent);
}

.button[disabled] {
	opacity: 0.6;
	cursor: progress;
}

/* ---------- Content ---------- */

.prose {
	max-width: 780px;
	margin: 0 auto;
}

.prose h2 {
	margin-top: 2.25rem;
}

.prose li {
	margin-bottom: 0.3rem;
}

.figure {
	margin: 0 auto 2rem;
	text-align: center;
}

.figure img {
	margin: 0 auto;
	border-radius: var(--radius);
	box-shadow: 0 6px 24px rgba(13, 20, 26, 0.15);
}

.figure figcaption {
	margin-top: 0.6rem;
	color: var(--muted);
	font-size: 0.9rem;
}

.photo-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 1rem;
	max-width: var(--wrap);
	margin: 2.5rem auto 0;
}

.photo-grid a {
	display: block;
	border-radius: var(--radius);
	overflow: hidden;
	background: var(--mist);
	aspect-ratio: 4 / 3;
}

.photo-grid img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.25s;
}

.photo-grid a:hover img {
	transform: scale(1.03);
}

.back-link {
	display: inline-block;
	margin-bottom: 1.25rem;
	text-decoration: none;
	font-weight: 600;
}

/* ---------- Tracks ---------- */

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

.track-card {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	height: 100%;
	padding: 1.1rem 1.25rem;
	border: 1px solid var(--line);
	border-left: 4px solid var(--line);
	border-radius: var(--radius);
	background: #fff;
	color: var(--ink);
	text-decoration: none;
}

.track-card__name {
	font-family: var(--font-head);
	font-weight: 700;
	font-size: 1.2rem;
}

.track-card__host {
	color: var(--muted);
	font-size: 0.9rem;
}

.track-card__more {
	margin-top: auto;
	padding-top: 0.5rem;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--muted);
}

a.track-card {
	border-left-color: var(--red);
}

a.track-card .track-card__more {
	color: var(--accent);
}

a.track-card:hover {
	border-color: var(--accent);
	border-left-color: var(--red);
	box-shadow: 0 4px 16px rgba(13, 20, 26, 0.1);
	color: var(--ink);
}

/* ---------- Schedule ---------- */

.sheet-grid {
	display: grid;
	gap: 2.5rem;
}

@media (min-width: 860px) {
	.sheet-grid {
		grid-template-columns: 1fr 1fr;
	}

	/* Keeps the car photo in view beside the long spec card. */
	.sheet-grid__sticky {
		position: sticky;
		top: 1.5rem;
		align-self: start;
	}
}

.sheet-grid h2 {
	margin-top: 0;
	text-align: center;
}

.sheet-grid .figure {
	margin-bottom: 1.25rem;
}

.coming-soon {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 10rem;
	margin: 0;
	padding: 1.5rem;
	border: 1px solid var(--line);
	border-top: 4px solid var(--red);
	border-radius: var(--radius);
	background: var(--mist);
	color: var(--navy);
	font-family: var(--font-head);
	font-size: 1.6rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	text-align: center;
}

.spec-card {
	padding: 1.25rem 1.25rem 1.5rem;
	border: 1px solid var(--line);
	border-top: 4px solid var(--red);
	border-radius: var(--radius);
	background: #fff;
	box-shadow: 0 6px 24px rgba(13, 20, 26, 0.08);
}

.spec-card__series {
	margin: 0 0 0.75rem;
	font-family: var(--font-head);
	font-size: 1.35rem;
	font-weight: 700;
	text-align: center;
}

.spec-card h3 {
	margin: 1.5rem 0 0.5rem;
	font-size: 1.1rem;
}

.spec-card ul {
	margin: 0;
	padding-left: 1.2rem;
}

.spec-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.95rem;
}

.spec-table th,
.spec-table td {
	padding: 0.45rem 0.6rem;
	border-bottom: 1px solid var(--line);
	text-align: left;
	vertical-align: top;
}

.spec-table th {
	width: 38%;
	color: var(--muted);
	font-weight: 600;
}

.spec-table tbody tr:nth-child(even) {
	background: var(--mist);
}

.spec-card .spec-table__list {
	padding: 0;
	list-style: none;
}

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

/* ---------- Gallery ---------- */

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

.video {
	margin: 0;
}

.video__frame {
	position: relative;
	display: block;
	aspect-ratio: 16 / 9;
	border-radius: var(--radius);
	overflow: hidden;
	background: #000;
}

.video__frame img,
.video__frame iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border: 0;
}

.video__play {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	border: 0;
	padding: 0;
	background: transparent;
	cursor: pointer;
}

.video__play svg {
	width: 68px;
	height: 48px;
	filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
	transition: transform 0.15s;
}

.video__frame:hover .video__play svg {
	transform: scale(1.1);
}

.video figcaption {
	margin-top: 0.5rem;
	font-weight: 600;
}

.video figcaption span {
	display: block;
	font-weight: 400;
	color: var(--muted);
	font-size: 0.9rem;
}

/* A second series on the gallery page gets room above its heading. */
.video-grid + h2,
.video-empty + h2 {
	margin-top: 3rem;
}

.video-empty {
	padding: 2rem 1rem;
	border-radius: var(--radius);
	background: var(--mist);
	color: var(--muted);
	text-align: center;
}

.admin-videos {
	margin: 0 0 1rem;
	padding-left: 1.4rem;
}

.admin-videos li {
	margin-bottom: 0.25rem;
}

/* ---------- Live feed ---------- */

.feed-card {
	max-width: 640px;
	margin: 0 auto;
	padding: 2rem;
	text-align: center;
	background: var(--mist);
	border-radius: var(--radius);
}

/* ---------- Forms ---------- */

.form {
	max-width: 780px;
	margin: 0 auto;
}

.form fieldset {
	border: 0;
	margin: 0 0 1.5rem;
	padding: 0;
}

.form legend {
	font-family: var(--font-head);
	font-weight: 700;
	font-size: 1.3rem;
	margin-bottom: 0.75rem;
	padding: 0;
}

.form-grid {
	display: grid;
	gap: 1.1rem 1.5rem;
}

@media (min-width: 700px) {
	.form-grid {
		grid-template-columns: 1fr 1fr;
	}

	.field--wide {
		grid-column: 1 / -1;
	}
}

.field label,
.field .label {
	display: block;
	font-weight: 600;
	margin-bottom: 0.3rem;
}

.field .hint {
	display: block;
	font-size: 0.85rem;
	color: var(--muted);
	margin-top: 0.25rem;
}

.req {
	color: var(--red);
}

.form input[type="text"],
.form input[type="email"],
.form input[type="number"],
.form input[type="password"],
.form select,
.form textarea {
	width: 100%;
	padding: 0.65rem 0.8rem;
	border: 1px solid #b8c1cc;
	border-radius: 6px;
	background: #fff;
	color: var(--ink);
	font: inherit;
}

.form textarea {
	min-height: 140px;
	resize: vertical;
}

.form input:focus,
.form select:focus,
.form textarea:focus {
	border-color: var(--accent);
	outline: 2px solid rgba(0, 111, 246, 0.25);
	outline-offset: 0;
}

.choices {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.5rem;
}

.choices label {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	font-weight: 400;
}

.dropzone {
	display: block;
	padding: 1.5rem;
	border: 2px dashed #b8c1cc;
	border-radius: var(--radius);
	background: var(--mist);
	text-align: center;
	cursor: pointer;
}

.dropzone.is-over {
	border-color: var(--accent);
	background: #e6f0fe;
}

.dropzone input {
	display: block;
	margin: 0.75rem auto 0;
	max-width: 100%;
}

.thumbs {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	list-style: none;
	margin: 0.75rem 0 0;
	padding: 0;
}

.thumbs li {
	position: relative;
	width: 92px;
}

.thumbs img {
	width: 92px;
	height: 92px;
	object-fit: cover;
	border-radius: 6px;
}

.thumbs span {
	display: block;
	font-size: 0.72rem;
	color: var(--muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.thumbs button {
	position: absolute;
	top: 3px;
	right: 3px;
	width: 24px;
	height: 24px;
	border: 0;
	border-radius: 50%;
	background: rgba(13, 20, 26, 0.75);
	color: #fff;
	font-size: 15px;
	line-height: 24px;
	cursor: pointer;
}

.hp {
	position: absolute !important;
	left: -10000px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.notice {
	padding: 1rem 1.25rem;
	border-radius: var(--radius);
	margin: 0 0 1.5rem;
	border: 1px solid var(--line);
	background: var(--mist);
}

.notice--ok {
	border-color: #9fd7b0;
	background: #ecf9f0;
}

.notice--error {
	border-color: #f0a8ab;
	background: #fdeeee;
}

.notice p:last-child {
	margin-bottom: 0;
}

/* ---------- Contact panel ---------- */

.contact-panel {
	background: var(--mist);
	padding: 2.5rem 0;
	margin-top: 1rem;
}

.contact-panel h2 {
	margin-top: 0;
}

.contact-panel p {
	margin-bottom: 0.5rem;
}

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

.site-footer {
	background: var(--navy);
	color: #fff;
	padding: 2.5rem 0 1.5rem;
}

.site-footer a {
	color: #fff;
	text-decoration: none;
}

.site-footer a:hover {
	text-decoration: underline;
}

.site-footer__grid {
	display: grid;
	gap: 1.5rem;
}

@media (min-width: 700px) {
	.site-footer__grid {
		grid-template-columns: 1fr 2fr;
	}
}

.site-footer__title {
	font-size: 1.1rem;
	margin: 0 0 0.75rem;
	color: #fff;
}

.site-footer__title + p {
	margin-bottom: 1.25rem;
}

.site-footer__links {
	list-style: none;
	margin: 0;
	padding: 0;
}

.site-footer__links li {
	margin-bottom: 0.35rem;
}

.site-footer__links a[aria-current="page"] {
	text-decoration: underline;
}

.social-link {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
}

.site-footer__copy {
	margin: 2rem 0 0;
	text-align: center;
	font-size: 0.82rem;
	color: #c7cfdb;
}

/* ---------- Series standings ---------- */

.emsa-ss {
	--gold: #c9971c;
	--silver: #8e99a6;
	--bronze: #b0703a;
	margin: 0 0 2.5rem;
}

.emsa-ss__head {
	margin-bottom: 1rem;
}

.emsa-ss__season {
	margin: 0;
	font-weight: 700;
	font-size: 0.85rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--accent);
}

.emsa-ss__meta {
	margin: 0.25rem 0 0;
	color: var(--muted);
}

.emsa-ss__empty {
	padding: 1.25rem 1.5rem;
	border: 1px dashed var(--line);
	border-radius: var(--radius);
	background: var(--mist);
}

.emsa-ss__scroll {
	overflow-x: auto;
	border: 1px solid var(--line);
	border-radius: var(--radius);
}

.emsa-ss__table {
	width: 100%;
	min-width: 560px;
	margin: 0;
	border-collapse: collapse;
	font-variant-numeric: tabular-nums;
	background: #fff;
}

.emsa-ss__table th,
.emsa-ss__table td {
	padding: 0.7rem 0.9rem;
	border-bottom: 1px solid var(--line);
	text-align: left;
	vertical-align: middle;
}

.emsa-ss__table thead th {
	background: var(--navy);
	color: #fff;
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	white-space: nowrap;
}

.emsa-ss__table tbody tr:nth-child(even) {
	background: var(--mist);
}

.emsa-ss__table tbody tr:last-child th,
.emsa-ss__table tbody tr:last-child td {
	border-bottom: 0;
}

.emsa-ss__table tbody th {
	font-weight: 600;
}

.emsa-ss__table .emsa-ss__num {
	text-align: right;
	white-space: nowrap;
}

.emsa-ss__table .emsa-ss__pos {
	width: 3.5rem;
	text-align: center;
}

.emsa-ss__points {
	font-weight: 700;
}

.emsa-ss__muted {
	color: var(--muted);
}

.emsa-ss__badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.9rem;
	height: 1.9rem;
	padding: 0 0.35rem;
	border-radius: 999px;
	font-weight: 700;
}

.emsa-ss__badge--p1 {
	background: var(--gold);
	color: #fff;
}

.emsa-ss__badge--p2 {
	background: var(--silver);
	color: #fff;
}

.emsa-ss__badge--p3 {
	background: var(--bronze);
	color: #fff;
}

.emsa-ss__note {
	margin: 0.6rem 0 0;
	font-size: 0.85rem;
	color: var(--muted);
}

.emsa-ss__subhead {
	margin: 2.25rem 0 0.75rem;
}

.emsa-ss__race {
	border: 1px solid var(--line);
	border-radius: var(--radius);
	margin-bottom: 0.6rem;
	background: #fff;
}

.emsa-ss__race summary {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.35rem 1rem;
	padding: 0.8rem 1rem;
	cursor: pointer;
	list-style-position: inside;
}

.emsa-ss__race-date {
	color: var(--muted);
	font-variant-numeric: tabular-nums;
}

.emsa-ss__race-name {
	font-weight: 700;
}

.emsa-ss__race-winner {
	margin-left: auto;
	color: var(--muted);
}

.emsa-ss__race-body {
	padding: 0 1rem 1rem;
}

.emsa-ss__table--compact {
	min-width: 0;
	border: 1px solid var(--line);
}

.emsa-ss__table--compact th,
.emsa-ss__table--compact td {
	padding: 0.5rem 0.75rem;
}

.emsa-ss__pdf {
	margin: 0.75rem 0 0;
}

.emsa-ss__seasons {
	margin-top: 2rem;
	color: var(--muted);
}

@media (max-width: 600px) {
	.emsa-ss__table th,
	.emsa-ss__table td {
		padding: 0.55rem 0.6rem;
	}

	/* Phones: keep Pos, Driver, Points, Races and Wins; drop the extras. */
	.emsa-ss__table {
		min-width: 0;
	}

	.emsa-ss__opt {
		display: none;
	}

	.emsa-ss__race-winner {
		margin-left: 0;
		flex-basis: 100%;
	}
}

/* ---------- Admin (standings manager) ---------- */

.admin-table {
	width: 100%;
	border-collapse: collapse;
	margin: 0 0 1.5rem;
	font-size: 0.95rem;
}

.admin-table th,
.admin-table td {
	padding: 0.55rem 0.6rem;
	border-bottom: 1px solid var(--line);
	text-align: left;
	vertical-align: top;
}

.admin-table thead th {
	background: var(--mist);
}

.admin-table form {
	margin: 0;
}

.admin-log {
	max-height: 360px;
	overflow: auto;
	padding: 0.75rem 1rem;
	background: var(--mist);
	border-radius: var(--radius);
	font: 0.85rem/1.5 ui-monospace, Consolas, monospace;
	white-space: pre-wrap;
}

.link-button {
	border: 0;
	background: none;
	padding: 0;
	color: var(--red);
	font: inherit;
	text-decoration: underline;
	cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
	* {
		transition: none !important;
	}
}

.after-grid {
	margin-top: 2rem;
	text-align: center;
}

.buttons--center {
	justify-content: center;
}

.section--card {
	padding: 1.25rem 1.5rem;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	margin-bottom: 1.5rem;
}

.section--card h2 {
	margin-top: 0;
}

.admin-narrow {
	max-width: 420px;
}

.admin-bar {
	margin: 0 0 1.5rem;
}

.admin-bar form {
	margin: 0;
}
