/**
 * Live Earthquake Map — styles.
 *
 * Scoped under .eqm-page-wrap so nothing leaks into the rest of the theme.
 * Reuses the theme's design tokens (--navy, --blue, --cyan, --border, …) with
 * safe fallbacks so it also renders correctly if loaded standalone.
 */

.eqm-page-wrap {
	--eqm-navy: var(--navy, #162b51);
	--eqm-blue: var(--blue, #1e73be);
	--eqm-cyan: var(--cyan, #8fd9fb);
	--eqm-bg: var(--bg, #f9f9f9);
	--eqm-card: var(--bg-white, #ffffff);
	--eqm-text: var(--text, #444);
	--eqm-text-dark: var(--text-dark, #333);
	--eqm-text-light: var(--text-light, #666);
	--eqm-border: var(--border, #dfdfdf);
	--eqm-radius: var(--radius-md, 6px);
	--eqm-shadow: var(--shadow, 0 2px 8px rgba(0,0,0,.1));
	color: var(--eqm-text);
	padding-top: 18px;
	padding-bottom: 40px;
}

.eqm-page-wrap * { box-sizing: border-box; }

/* The [hidden] attribute must always win, even over our display:flex/inline-block
 * rules (otherwise toggling `hidden` in JS does nothing — e.g. the empty prompt
 * or the Load more button). */
.eqm-page-wrap [hidden] { display: none !important; }

/* ── Header ─────────────────────────────────────────────────────────────── */
.eqm-breadcrumb { font-size: 13px; color: var(--eqm-text-light); margin-bottom: 12px; }
.eqm-breadcrumb a { color: var(--eqm-blue); text-decoration: none; }
.eqm-breadcrumb a:hover { text-decoration: underline; }
.eqm-breadcrumb span { margin: 0 6px; }

.eqm-header { margin-bottom: 18px; }
.eqm-title {
	font-size: clamp(1.5rem, 3.5vw, 2.15rem);
	line-height: 1.2;
	color: var(--eqm-navy);
	margin: 0 0 8px;
}
.eqm-intro {
	max-width: 760px;
	font-size: 1rem;
	line-height: 1.6;
	color: var(--eqm-text-light);
	margin: 0 0 12px;
}

.eqm-updated {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	color: var(--eqm-text-light);
}
.eqm-updated-dot {
	width: 9px; height: 9px; border-radius: 50%;
	background: #2ecc71;
	box-shadow: 0 0 0 0 rgba(46,204,113,.5);
	animation: eqm-pulse 2s infinite;
}
@keyframes eqm-pulse {
	0% { box-shadow: 0 0 0 0 rgba(46,204,113,.5); }
	70% { box-shadow: 0 0 0 7px rgba(46,204,113,0); }
	100% { box-shadow: 0 0 0 0 rgba(46,204,113,0); }
}

.eqm-banner {
	margin: 12px 0 0;
	padding: 10px 14px;
	border-radius: var(--eqm-radius);
	font-size: 14px;
}
.eqm-banner--warn { background: #fff6e5; border: 1px solid #ffd591; color: #8a5a00; }

/* ── Filters ────────────────────────────────────────────────────────────── */
.eqm-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 18px 28px;
	align-items: flex-end;
	margin: 18px 0;
	padding: 14px 16px;
	background: var(--eqm-card);
	border: 1px solid var(--eqm-border);
	border-radius: var(--eqm-radius);
}
.eqm-filter-group { border: 0; margin: 0; padding: 0; min-width: 0; }
.eqm-filter-group legend {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--eqm-text-light);
	font-weight: 700;
	padding: 0;
	margin-bottom: 7px;
}
.eqm-segmented {
	display: inline-flex;
	border: 1px solid var(--eqm-border);
	border-radius: 6px;
	background: var(--eqm-bg);
	padding: 3px;
	flex-wrap: wrap;
}
.eqm-seg-btn {
	appearance: none;
	border: 0;
	background: transparent;
	color: var(--eqm-text);
	font: inherit;
	font-size: 14px;
	padding: 7px 15px;
	border-radius: 6px;
	cursor: pointer;
	white-space: nowrap;
	transition: background .15s, color .15s;
}
.eqm-seg-btn:hover { color: var(--eqm-navy); }
.eqm-seg-btn.is-active {
	background: var(--eqm-navy);
	color: #fff;
	font-weight: 600;
}
.eqm-seg-btn:focus-visible,
.eqm-select:focus-visible,
.eqm-btn:focus-visible,
.eqm-row:focus-visible {
	outline: 3px solid var(--eqm-cyan);
	outline-offset: 2px;
}

.eqm-select {
	appearance: none;
	font: inherit;
	font-size: 14px;
	padding: 8px 34px 8px 12px;
	border: 1px solid var(--eqm-border);
	border-radius: var(--eqm-radius);
	background: var(--eqm-card) url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='12'%20height='8'%3E%3Cpath%20fill='%23666'%20d='M0%200l6%208%206-8z'/%3E%3C/svg%3E") no-repeat right 12px center;
	color: var(--eqm-text-dark);
	cursor: pointer;
}

/* ── Summary stats ──────────────────────────────────────────────────────── */
.eqm-stats {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 14px;
	margin-bottom: 20px;
	transition: opacity .2s;
}
.eqm-stats.is-loading { opacity: .55; }
.eqm-stat {
	background: var(--eqm-card);
	border: 1px solid var(--eqm-border);
	border-left: 4px solid var(--eqm-blue);
	border-radius: var(--eqm-radius);
	padding: 14px 16px;
	display: flex;
	flex-direction: column;
	gap: 3px;
	min-width: 0;
}
#eqm-stat-largest { border-left-color: #f46d43; }
#eqm-stat-avg { border-left-color: #fdae61; }
#eqm-stat-latest { border-left-color: #2ecc71; }
/* Largest + Latest cards are clickable → select that earthquake on the map. */
.eqm-stat.is-clickable { cursor: pointer; transition: box-shadow .15s, transform .1s; }
.eqm-stat.is-clickable:hover { box-shadow: 0 4px 14px rgba(0, 0, 0, .12); transform: translateY(-2px); }
.eqm-stat.is-clickable:focus-visible { outline: 3px solid rgba(30, 115, 190, .5); outline-offset: 2px; }
.eqm-stat-label {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--eqm-text-light);
	font-weight: 700;
}
.eqm-stat-value {
	font-size: clamp(1.4rem, 3vw, 1.9rem);
	font-weight: 800;
	color: var(--eqm-navy);
	line-height: 1.1;
}
.eqm-stat-sub { font-size: 12px; color: var(--eqm-text-light); }

/* ── Layout: map + side panel ───────────────────────────────────────────── */
.eqm-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 340px;
	gap: 18px;
	margin-bottom: 26px;
	align-items: start;
}
.eqm-map-col { min-width: 0; }
.eqm-map-shell { position: relative; }
.eqm-map {
	width: 100%;
	border-radius: var(--eqm-radius);
	border: 1px solid var(--eqm-border);
	background: #e8eef2;
	z-index: 0;
	position: relative;
}
.eqm-map.is-loading::after {
	content: "";
	position: absolute; inset: 0;
	background: rgba(255,255,255,.35);
	z-index: 500;
	pointer-events: none;
	border-radius: var(--eqm-radius);
}
.eqm-map-skeleton {
	position: absolute; inset: 0;
	display: flex; flex-direction: column;
	align-items: center; justify-content: center;
	gap: 12px;
	color: var(--eqm-text-light);
	font-size: 14px;
	background: repeating-linear-gradient(45deg, #eef2f5, #eef2f5 12px, #e7edf1 12px, #e7edf1 24px);
	border-radius: var(--eqm-radius);
	z-index: 400;
}
.eqm-spinner {
	width: 22px; height: 22px;
	border: 3px solid rgba(30,115,190,.25);
	border-top-color: var(--eqm-blue);
	border-radius: 50%;
	animation: eqm-spin .8s linear infinite;
	display: inline-block;
}
@keyframes eqm-spin { to { transform: rotate(360deg); } }

/* Legend */
.eqm-legend {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 16px;
	margin-top: 10px;
	padding: 10px 14px;
	background: var(--eqm-card);
	border: 1px solid var(--eqm-border);
	border-radius: var(--eqm-radius);
	font-size: 13px;
}
.eqm-legend-title { font-weight: 700; color: var(--eqm-navy); margin-right: 4px; }
.eqm-legend-list { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; list-style: none; }
.eqm-legend-list li { display: inline-flex; align-items: center; gap: 7px; color: var(--eqm-text); }
.eqm-dot { display: inline-block; border-radius: 50%; border: 1px solid rgba(0,0,0,.35); }
.eqm-dot--t1 { width: 8px;  height: 8px;  background: #66bd63; }
.eqm-dot--t2 { width: 11px; height: 11px; background: #fee08b; }
.eqm-dot--t3 { width: 14px; height: 14px; background: #fdae61; }
.eqm-dot--t4 { width: 18px; height: 18px; background: #f46d43; }
.eqm-dot--t5 { width: 22px; height: 22px; background: #d73027; }

/* ── Side panel / detail ─────────────────────────────────────────────────── */
.eqm-panel {
	background: var(--eqm-card);
	border: 1px solid var(--eqm-border);
	border-radius: var(--eqm-radius);
	padding: 18px;
	position: sticky;
	top: 84px;
	min-height: 240px;
}
.eqm-panel-empty {
	display: flex; flex-direction: column; align-items: center; justify-content: center;
	gap: 12px; text-align: center; color: var(--eqm-text-light);
	min-height: 200px;
}
.eqm-panel-empty svg { color: var(--eqm-border); }
.eqm-panel-empty p { margin: 0; font-size: 14px; max-width: 240px; }

.eqm-panel-body { position: relative; }
.eqm-panel-close {
	position: absolute; top: -6px; right: -4px;
	width: 32px; height: 32px;
	border: 0; background: transparent;
	font-size: 26px; line-height: 1; color: var(--eqm-text-light);
	cursor: pointer; border-radius: 6px;
	display: none;
}
.eqm-panel-close:hover { background: var(--eqm-bg); color: var(--eqm-text-dark); }

.eqm-panel-head { margin-bottom: 4px; }
.eqm-panel-mag { display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 12px; border-radius: 8px; }
.eqm-panel-magnum { font-size: 1.9rem; font-weight: 800; line-height: 1; color: var(--eqm-navy); }
.eqm-panel-magtype { font-size: 12px; color: var(--eqm-text-light); text-transform: uppercase; }
.eqm-panel-mag.eqm-mag-t4 .eqm-panel-magnum { color: #d1481f; }
.eqm-panel-mag.eqm-mag-t5 .eqm-panel-magnum { color: #b3261a; }
.eqm-panel-place { margin: 10px 0 2px; font-size: 15px; font-weight: 700; line-height: 1.3; color: var(--eqm-text-dark); }
.eqm-panel-when { margin: 0; font-size: 13px; color: var(--eqm-text-light); }

.eqm-detail-list {
	display: flex; flex-direction: column; gap: 6px;
	margin: 14px 0; padding-top: 14px; border-top: 1px solid var(--eqm-border);
}
.eqm-detail-row {
	display: flex; justify-content: space-between; gap: 12px;
	font-size: 13.5px; padding-bottom: 6px; border-bottom: 1px dashed var(--eqm-border);
}
.eqm-detail-row:last-child { border-bottom: 0; }
.eqm-detail-label { color: var(--eqm-text-light); flex: 0 0 auto; }
.eqm-detail-value { color: var(--eqm-text-dark); font-weight: 600; text-align: right; }
.eqm-detail-tsunami { color: #b3261a; font-weight: 600; border-bottom: 0; }

.eqm-btn {
	display: inline-block;
	font: inherit; font-size: 14px; font-weight: 600;
	padding: 9px 16px;
	border-radius: var(--eqm-radius);
	border: 1px solid var(--eqm-border);
	background: var(--eqm-card);
	color: var(--eqm-navy);
	cursor: pointer;
	text-decoration: none;
	text-align: center;
}
.eqm-usgs-btn {
	display: block;
	background: var(--eqm-navy);
	color: #fff;
	border-color: var(--eqm-navy);
	margin-bottom: 16px;
}
.eqm-usgs-btn:hover { background: var(--eqm-blue); border-color: var(--eqm-blue); }

/* ── Nearby webcams ─────────────────────────────────────────────────────── */
.eqm-nearby { border-top: 1px solid var(--eqm-border); padding-top: 14px; margin-top: 14px; }
.eqm-nearby-title { font-size: 15px; margin: 0 0 10px; color: var(--eqm-navy); }
.eqm-nearby-loading { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--eqm-text-light); }
.eqm-nearby-msg { font-size: 14px; color: var(--eqm-text-light); margin: 0; }
.eqm-cam-list { display: flex; flex-direction: column; gap: 10px; }
.eqm-cam {
	display: flex; gap: 12px; align-items: center;
	padding: 8px; border: 1px solid var(--eqm-border); border-radius: var(--eqm-radius);
	text-decoration: none; color: inherit; transition: box-shadow .15s, border-color .15s;
}
.eqm-cam:hover { box-shadow: var(--eqm-shadow); border-color: var(--eqm-cyan); }
.eqm-cam-thumb { flex: 0 0 auto; width: 72px; height: 54px; border-radius: 6px; overflow: hidden; background: var(--eqm-bg); }
.eqm-cam-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.eqm-cam-thumb--empty { background: linear-gradient(135deg, #dfe7ee, #cdd8e2); }
.eqm-cam-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.eqm-cam-title { font-weight: 600; font-size: 14px; color: var(--eqm-text-dark); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eqm-cam-dist { font-size: 13px; color: var(--eqm-text-light); }
.eqm-cam-cta { font-size: 13px; font-weight: 600; color: var(--eqm-blue); }

/* ── Recent list ────────────────────────────────────────────────────────── */
.eqm-section-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.eqm-section-head h2 { margin: 0; font-size: 1.3rem; color: var(--eqm-navy); }
.eqm-sort { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--eqm-text-light); }

.eqm-table-wrap { overflow: auto; max-height: 620px; border: 1px solid var(--eqm-border); border-radius: var(--eqm-radius); background: var(--eqm-card); }
.eqm-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 480px; }
.eqm-table thead th {
	text-align: left; padding: 12px 14px; background: var(--eqm-bg);
	color: var(--eqm-text-light); font-size: 12px; text-transform: uppercase; letter-spacing: .03em;
	border-bottom: 1px solid var(--eqm-border);
	position: sticky; top: 0; z-index: 1;
}
.eqm-table tbody td { padding: 11px 14px; border-bottom: 1px solid var(--eqm-border); }
.eqm-row { cursor: pointer; transition: background .12s; }
.eqm-row:hover { background: #f2f7fb; }
.eqm-row.is-selected { background: #e6f3fc; }
.eqm-row:last-child td { border-bottom: 0; }
.eqm-empty-row td { text-align: center; color: var(--eqm-text-light); padding: 28px 14px; }

.eqm-mag-pill {
	display: inline-block; min-width: 48px; text-align: center;
	padding: 3px 8px; border-radius: 999px; font-weight: 700; font-size: 13px;
	background: var(--eqm-bg); color: var(--eqm-text-dark); border: 1px solid var(--eqm-border);
}
.eqm-mag-t1 { background: #eaf6ea; border-color: #b7e0b5; color: #2f6b2c; }
.eqm-mag-t2 { background: #fdf7e0; border-color: #f2df9a; color: #866a12; }
.eqm-mag-t3 { background: #fdeede; border-color: #f6c58c; color: #9a5715; }
.eqm-mag-t4 { background: #fde3d8; border-color: #f4a184; color: #b3431c; }
.eqm-mag-t5 { background: #fbdcd7; border-color: #e88a7d; color: #b3261a; }
.eqm-cell-place { color: var(--eqm-text-dark); }
.eqm-list-more { text-align: center; margin: 16px 0 0; }
.eqm-load-more { min-width: 160px; }

/* ── Chart ──────────────────────────────────────────────────────────────── */
.eqm-chart-section { margin: 30px 0; }
.eqm-chart-section h2 { margin: 0 0 4px; font-size: 1.3rem; color: var(--eqm-navy); }
.eqm-chart-note { margin: 0 0 14px; font-size: 14px; color: var(--eqm-text-light); }
.eqm-chart {
	display: flex; flex-direction: column; gap: 10px;
	background: var(--eqm-card); border: 1px solid var(--eqm-border); border-radius: var(--eqm-radius);
	padding: 16px;
}
.eqm-bar-row { display: grid; grid-template-columns: 110px 1fr 52px; align-items: center; gap: 12px; }
.eqm-bar-label { font-size: 13px; color: var(--eqm-text-light); }
.eqm-bar-track { background: var(--eqm-bg); border-radius: 6px; height: 18px; overflow: hidden; }
.eqm-bar-fill { display: block; height: 100%; background: linear-gradient(90deg, #fdae61, #d73027); border-radius: 6px; transition: width .4s ease; min-width: 2px; }
.eqm-bar-count { font-size: 13px; font-weight: 700; color: var(--eqm-navy); text-align: right; }
/* The data table is a screen-reader / no-JS fallback; hide when JS bars render. */
.eqm-chart-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13px; }
.eqm-chart-table th, .eqm-chart-table td { padding: 6px 10px; border: 1px solid var(--eqm-border); text-align: left; }
.eqm-js .eqm-chart-table { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

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

/* ── Informational content ──────────────────────────────────────────────── */
.eqm-info { max-width: 820px; margin: 30px 0; }
.eqm-info h2 { font-size: 1.25rem; color: var(--eqm-navy); margin: 22px 0 8px; }
.eqm-info p { font-size: 15px; line-height: 1.7; color: var(--eqm-text); margin: 0 0 6px; }
.eqm-info a { color: var(--eqm-blue); }

.eqm-disclaimer { border-top: 1px solid var(--eqm-border); padding-top: 16px; margin-top: 24px; }
.eqm-disclaimer-note { font-size: 13px; color: var(--eqm-text-light); font-style: italic; margin: 0 0 6px; }
.eqm-attribution { font-size: 13px; color: var(--eqm-text-light); margin: 0; }
.eqm-attribution a { color: var(--eqm-blue); }

/* ── Leaflet tweaks ─────────────────────────────────────────────────────── */
.eqm-map .leaflet-container { font: inherit; border-radius: var(--eqm-radius); }
.eqm-map .marker-cluster-small { background: rgba(102,189,99,.35); }
.eqm-map .marker-cluster-small div { background: rgba(102,189,99,.85); color: #123; }
.eqm-map .marker-cluster-medium { background: rgba(253,174,97,.35); }
.eqm-map .marker-cluster-medium div { background: rgba(253,174,97,.9); color: #3a2400; }
.eqm-map .marker-cluster-large { background: rgba(215,48,39,.3); }
.eqm-map .marker-cluster-large div { background: rgba(215,48,39,.85); color: #fff; }

/* ── Responsive: tablet ─────────────────────────────────────────────────── */
@media (max-width: 900px) {
	.eqm-layout { grid-template-columns: 1fr; }

	/* Side panel becomes a bottom sheet, hidden until a quake is selected. */
	.eqm-panel {
		position: fixed;
		left: 0; right: 0; bottom: 0;
		top: auto;
		z-index: 1200;
		max-height: 78vh;
		overflow-y: auto;
		border-radius: 6px 6px 0 0;
		box-shadow: 0 -6px 24px rgba(0,0,0,.22);
		transform: translateY(110%);
		transition: transform .28s ease;
		min-height: 0;
	}
	.eqm-panel.is-open { transform: translateY(0); }
	.eqm-panel-empty { display: none; }
	.eqm-panel-close { display: block; }
}

/* ── Responsive: mobile ─────────────────────────────────────────────────── */
@media (max-width: 600px) {
	.eqm-stats { grid-template-columns: 1fr 1fr; }
	.eqm-filters { gap: 14px 18px; }
	.eqm-bar-row { grid-template-columns: 90px 1fr 40px; gap: 8px; }
	.eqm-section-head h2, .eqm-chart-section h2 { font-size: 1.15rem; }
}

/* Respect reduced motion. */
@media (prefers-reduced-motion: reduce) {
	.eqm-updated-dot, .eqm-spinner, .eqm-bar-fill, .eqm-panel { animation: none; transition: none; }
}

/* ── Place-name overlay ──────────────────────────────────────────────────────
   The basemap is CARTO's label-free cut and the names come from a separate Esri
   reference layer, because CARTO bakes OSM's local-language `name` tag into its
   labelled tiles (the map used to read "AFRIKA / أفريقيا" and "AMÉRICA DO SUL").

   The two cuts need opposite treatment. Boundaries & Places is drawn fairly
   heavy, so it only wants a soft white glow to lift it off the pale basemap;
   the Canvas reference cut is a light grey built for a flat canvas and needs
   darkening before it reads at all. Blurs stay tight: a wide blur spreads haze
   around the glyphs and looks like fog rather than a halo. */
.leaflet-eqm-labels-pane .eqm-labels-wide {
	filter: drop-shadow(0 0 1px rgba(255, 255, 255, .95)) drop-shadow(0 0 2px rgba(255, 255, 255, .75));
}

.leaflet-eqm-labels-pane .eqm-labels-close {
	filter: brightness(.82) drop-shadow(0 0 1px rgba(255, 255, 255, .95));
}

/* Material Symbols Outlined icons (inline SVG): sized to the text, centred on the capitals. */
.lww-mi{display:inline-block;flex:none;width:1.25em;height:1.25em;fill:currentColor;vertical-align:-.27em}
