/* Aeolian Dynamics live data page. Matches the site's Elementor kit:
   Poppins, primary #EC3543, surfaces #131313 / #272626, text #FFFFFF / #C8C8C8.
   Poppins is self-hosted (SIL Open Font License, @fontsource/poppins 5.3.0). */
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/poppins-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/poppins-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/poppins-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/poppins-latin-700-normal.woff2") format("woff2");
}

:root {
  --bg: #131313;
  --card: #272626;
  --card-2: #1d1c1c;
  --line: #3a3939;
  --text: #ffffff;
  --muted: #c8c8c8;
  --primary: #ec3543;
  --primary-dark: #c61f2c; /* white on this passes 4.5:1 for small button text */
  --primary-darker: #a3141f; /* hover: keeps white text well above 4.5:1 */
  --focus: #ffffff;
  --radius: 10px;
  color-scheme: dark;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.ld {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 20px 24px;
}

/* Inside the website: no own background, no centring or side gap, so the
   content lines up with the section heading on the parent page. */
html.is-embedded { color-scheme: normal; }
html.is-embedded, html.is-embedded body { background: transparent; }
html.is-embedded .ld { max-width: none; margin: 0; padding: 8px 0 24px; }
html.is-embedded input { color-scheme: dark; }

.ld-block { margin: 0 0 40px; }

.ld-head { margin: 0 0 16px; }
.ld-head h2 {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.3;
}
.ld-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}
.ld-meta.is-warn, .ld-msg.is-error, .ld-msg.is-warn, .ld-tile-note.is-warn { color: #ff8a93; }

/* Tiles */
.ld-tiles {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
}
.ld-tiles-1 { --cols: 1; margin-bottom: 16px; }
.ld-tiles-3 { --cols: 3; }
.ld-tiles-6 { --cols: 6; }

.ld-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 18px 20px;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
}
.ld-tile::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--primary);
}
.ld-tile-label {
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ld-tile-value {
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.ld-tile-value small {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--muted);
}
.ld-tile-note { color: var(--muted); font-size: 0.8125rem; }
.ld-tiles-6 .ld-tile { padding: 14px 16px; }
.ld-tiles-6 .ld-tile-value { font-size: 1.5rem; }

/* Charts */
.ld-charts {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.ld-chart {
  margin: 0;
  min-width: 0;
  padding: 16px 16px 12px;
  background: var(--card);
  border-radius: var(--radius);
}
.ld-chart figcaption {
  margin: 0 0 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}
.ld-canvas { position: relative; height: 300px; }
.ld-sum { margin: 10px 0 0; color: var(--muted); font-size: 0.8125rem; line-height: 1.45; }
.ld-sum:empty { display: none; }
.ld-range-label { margin: 0 0 12px; }
.ld-range-label:empty { display: none; }
#hist-results { transition: opacity 0.2s; }
#hist-results.is-pending { opacity: 0.45; }
.ld-csv-for { margin: 0 0 8px; color: var(--text); font-size: 0.875rem; }

/* Range form */
.ld-range {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin: 0 0 16px;
}
.ld-range label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 500;
}
input[type="date"], input[type="password"] {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-2);
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
}
input:focus-visible, .ld-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.ld-btn {
  min-height: 44px;
  padding: 10px 22px;
  border: 0;
  border-radius: 50px;
  background: var(--primary-dark);
  color: #fff;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.2s;
}
.ld-btn:hover { background: var(--primary-darker); }
.ld-btn[disabled] { opacity: 0.6; cursor: progress; }
.ld-btn-ghost {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--primary);
}
.ld-btn-ghost:hover { background: var(--card); }

/* CSV panel */
.ld-csv {
  margin: 0 0 16px;
  padding: 16px 20px;
  background: var(--card);
  border-radius: var(--radius);
}
.ld-csv label { display: block; margin: 0 0 10px; color: var(--muted); font-size: 0.875rem; }
.ld-csv-row { display: flex; flex-wrap: wrap; gap: 12px; }
.ld-csv-row input { flex: 1 1 220px; min-width: 0; }

.ld-msg { margin: 0 0 12px; color: var(--muted); font-size: 0.875rem; min-height: 0; }
.ld-msg:empty { display: none; }
.ld-msg.is-ok { color: #8fd69b; }

.ld-foot { margin: 0; color: var(--muted); font-size: 0.8125rem; }

/* Responsive */
@media (max-width: 1024px) {
  .ld-tiles-6 { --cols: 3; }
}
@media (max-width: 767px) {
  .ld-tiles-3 { --cols: 1; }
  .ld-tiles-6 { --cols: 2; }
  .ld-charts { grid-template-columns: minmax(0, 1fr); }
  .ld-canvas { height: 260px; }
  .ld-tile-value { font-size: 1.75rem; }
  .ld-head h2 { font-size: 1.2rem; }
  .ld-range label { flex: 1 1 140px; }
  .ld-range input { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
