/**
 * Tahoe Fire Restrictions - front-end styles.
 * Colour and metric custom properties are injected inline from the settings page.
 */

.tfr {
	--tfr-bg: #ffffff;
	--tfr-bg-alt: #f6f7f8;
	--tfr-text: #1c1e21;
	--tfr-muted: #5f6368;
	--tfr-border: #d9dce1;
	--tfr-accent: var(--tfr-unknown, #5f6368);

	box-sizing: border-box;
	color: var(--tfr-text);
	font-size: var(--tfr-font-size, 15px);
	line-height: 1.5;
	margin: 0 0 1.25em;
	max-width: 100%;
}

.tfr *,
.tfr *::before,
.tfr *::after {
	box-sizing: inherit;
}

.tfr--theme-dark {
	--tfr-bg: #16181c;
	--tfr-bg-alt: #1f2228;
	--tfr-text: #e8eaed;
	--tfr-muted: #9aa0a6;
	--tfr-border: #33373d;
}

@media (prefers-color-scheme: dark) {
	.tfr--theme-auto {
		--tfr-bg: #16181c;
		--tfr-bg-alt: #1f2228;
		--tfr-text: #e8eaed;
		--tfr-muted: #9aa0a6;
		--tfr-border: #33373d;
	}
}

/* ---------- Banner ---------- */

.tfr-banner {
	align-items: flex-start;
	background: var(--tfr-bg);
	border: 1px solid var(--tfr-border);
	border-left: 6px solid var(--tfr-accent);
	border-radius: var(--tfr-radius, 8px);
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em 0.75em;
	justify-content: space-between;
	padding: 0.85em 1em;
}

/* Pinned to the right edge, wraps onto its own line when space runs out. */
.tfr-banner__badge {
	align-self: flex-start;
	background: var(--tfr-accent);
	border-radius: calc(var(--tfr-radius, 8px) / 2);
	color: #fff;
	flex: 0 1 auto;
	font-size: 0.8em;
	font-weight: 700;
	letter-spacing: 0.04em;
	margin-left: auto;
	max-width: 100%;
	order: 2;
	overflow-wrap: break-word;
	padding: 0.3em 0.65em;
	text-align: right;
	text-transform: uppercase;
	white-space: normal;
}

.tfr-banner__body {
	display: flex;
	flex: 1 1 14em;
	flex-direction: column;
	gap: 0.15em;
	min-width: 0;
	order: 1;
}

.tfr-banner__label {
	font-weight: 700;
}

.tfr-banner__meta,
.tfr-meta,
.tfr-updated {
	color: var(--tfr-muted);
	font-size: 0.85em;
	margin: 0;
}

.tfr-banner__link {
	align-self: flex-start;
	color: var(--tfr-accent);
	font-size: 0.9em;
	font-weight: 600;
	margin-top: 0.15em;
	text-decoration: none;
}

.tfr-banner__link:hover,
.tfr-banner__link:focus,
.tfr-card__link:hover,
.tfr-card__link:focus {
	text-decoration: underline;
}

/* ---------- Campfire indicator ---------- */

.tfr-fire {
	--tfr-fire: var(--tfr-fire-unknown, #5f6368);

	align-items: flex-start;
	display: flex;
	gap: 0.5em;
	margin-top: 0.3em;
}

.tfr-fire--yes {
	--tfr-fire: var(--tfr-fire-yes, #2e7d32);
}

.tfr-fire--limited {
	--tfr-fire: var(--tfr-fire-limited, #f9a825);
}

.tfr-fire--no {
	--tfr-fire: var(--tfr-fire-no, #c62828);
}

.tfr-fire__dot {
	background: var(--tfr-fire);
	border-radius: 50%;
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--tfr-fire) 22%, transparent);
	flex: 0 0 auto;
	height: 0.7em;
	margin-top: 0.42em;
	width: 0.7em;
}

.tfr-fire__text {
	display: flex;
	flex-direction: column;
	gap: 0.1em;
	min-width: 0;
}

.tfr-fire__verdict {
	color: var(--tfr-fire);
	font-size: 0.92em;
	font-weight: 700;
}

.tfr-fire__note {
	color: var(--tfr-muted);
	font-size: 0.82em;
}

/* Stage + campfire strip above the card, table and accordion layouts. */
.tfr-strip {
	background: var(--tfr-bg);
	border: 1px solid var(--tfr-border);
	border-left: 5px solid var(--tfr-accent);
	border-radius: var(--tfr-radius, 8px);
	display: flex;
	flex-direction: column;
	gap: 0.3em;
	margin-bottom: 0.9em;
	padding: 0.7em 0.9em;
}

.tfr-strip__stage {
	font-weight: 700;
}

.tfr-strip .tfr-fire {
	margin-top: 0;
}

/* ---------- Fire danger ---------- */

.tfr-danger {
	align-items: center;
	background: var(--tfr-bg-alt);
	border: 1px solid var(--tfr-border);
	border-radius: var(--tfr-radius, 8px);
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em 0.9em;
	margin-bottom: 0.9em;
	padding: 0.6em 0.9em;
}

.tfr-danger__label {
	color: var(--tfr-muted);
	font-size: 0.78em;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

.tfr-danger__zones {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em 1em;
	list-style: none;
	margin: 0;
	padding: 0;
}

.tfr-danger__zone {
	font-size: 0.9em;
	margin: 0;
}

.tfr-danger--low strong {
	color: #2e7d32;
}

.tfr-danger--moderate strong {
	color: #0277bd;
}

.tfr-danger--high strong {
	color: #f9a825;
}

.tfr-danger--very-high strong {
	color: #e65100;
}

.tfr-danger--extreme strong,
.tfr-danger--critical strong {
	color: #b71c1c;
}

/* ---------- Cards ---------- */

.tfr-cards {
	display: grid;
	gap: 0.85em;
	list-style: none;
	margin: 0;
	padding: 0;
}

.tfr-card {
	background: var(--tfr-bg);
	border: 1px solid var(--tfr-border);
	border-left: 5px solid var(--tfr-accent);
	border-radius: var(--tfr-radius, 8px);
	margin: 0;
	padding: 0.9em 1em;
}

.tfr-card__head {
	display: flex;
	flex-direction: column;
	gap: 0.2em;
	margin-bottom: 0.4em;
}

.tfr-card__type,
.tfr-pill {
	align-self: flex-start;
	background: var(--tfr-accent);
	border-radius: 99px;
	color: #fff;
	font-size: 0.72em;
	font-weight: 700;
	letter-spacing: 0.05em;
	padding: 0.2em 0.6em;
	text-transform: uppercase;
	white-space: nowrap;
}

.tfr-card__title {
	font-size: 1.05em;
	line-height: 1.3;
	margin: 0;
}

.tfr-card__desc {
	margin: 0 0 0.5em;
}

.tfr-card__link {
	color: var(--tfr-accent);
	display: inline-block;
	font-size: 0.9em;
	font-weight: 600;
	margin-top: 0.35em;
	text-decoration: none;
}

/* ---------- Table ---------- */

.tfr-tablewrap {
	-webkit-overflow-scrolling: touch;
	overflow-x: auto;
}

.tfr-table {
	border-collapse: collapse;
	min-width: 32em;
	width: 100%;
}

.tfr-table th,
.tfr-table td {
	border-bottom: 1px solid var(--tfr-border);
	padding: 0.6em 0.7em;
	text-align: left;
	vertical-align: top;
}

.tfr-table thead th {
	background: var(--tfr-bg-alt);
	font-size: 0.8em;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.tfr-table__desc {
	color: var(--tfr-muted);
	display: block;
	font-size: 0.85em;
	margin-top: 0.25em;
}

@media (max-width: 600px) {
	.tfr-table {
		min-width: 0;
	}

	.tfr-table thead {
		clip: rect(0 0 0 0);
		height: 1px;
		overflow: hidden;
		position: absolute;
		width: 1px;
	}

	.tfr-table tr {
		border-bottom: 2px solid var(--tfr-border);
		display: block;
		padding: 0.4em 0;
	}

	.tfr-table td {
		border: 0;
		display: flex;
		gap: 0.75em;
		justify-content: space-between;
		padding: 0.3em 0;
	}

	.tfr-table td::before {
		color: var(--tfr-muted);
		content: attr(data-label);
		flex: 0 0 8em;
		font-size: 0.8em;
		font-weight: 700;
		text-transform: uppercase;
	}
}

/* ---------- Accordion ---------- */

.tfr-accordion {
	display: grid;
	gap: 0.5em;
}

.tfr-acc {
	background: var(--tfr-bg);
	border: 1px solid var(--tfr-border);
	border-left: 5px solid var(--tfr-accent);
	border-radius: var(--tfr-radius, 8px);
}

.tfr-acc__summary {
	align-items: center;
	cursor: pointer;
	display: flex;
	flex-wrap: wrap;
	gap: 0.6em;
	justify-content: space-between;
	list-style: none;
	padding: 0.7em 0.9em;
}

.tfr-acc__summary::-webkit-details-marker {
	display: none;
}

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

.tfr-acc__title {
	font-weight: 600;
}

.tfr-acc__body {
	border-top: 1px solid var(--tfr-border);
	padding: 0.8em 0.9em;
}

.tfr-acc__body p {
	margin: 0 0 0.5em;
}

/* ---------- Shared ---------- */

.tfr-empty {
	background: var(--tfr-bg-alt);
	border: 1px dashed var(--tfr-border);
	border-radius: var(--tfr-radius, 8px);
	color: var(--tfr-muted);
	margin: 0;
	padding: 0.9em 1em;
}

.tfr-updated {
	margin-top: 0.6em;
}

.tfr-updated__stale {
	color: #b71c1c;
}
