:root {
  --bg: #0f1724;
  --panel: #1b2536;
  --panel-2: #243049;
  --text: #e8edf6;
  --muted: #9aa7bd;
  --accent: #6aa9ff;
  --border: #2c3a55;
  --error: #ff7a7a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: linear-gradient(160deg, #0f1724, #131d30);
  color: var(--text);
  min-height: 100vh;
}

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 18px 48px;
}

header h1 {
  margin: 0 0 4px;
  font-size: 1.9rem;
}

.subtitle {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.controls,
.result {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 18px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.row:last-child {
  margin-bottom: 0;
}

.row label {
  min-width: 110px;
  color: var(--muted);
  font-size: 0.9rem;
}

input,
select,
button {
  font: inherit;
}

input[type='text'],
input[type='datetime-local'],
select {
  flex: 1;
  min-width: 0;
  padding: 9px 11px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
}

.search-row input {
  flex: 1;
}

button {
  padding: 9px 14px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s;
}

button:hover {
  background: #2e3c5a;
}

button.primary {
  background: var(--accent);
  color: #08111f;
  border-color: var(--accent);
  font-weight: 600;
  width: 100%;
}

button.primary:hover {
  background: #82b8ff;
}

.location-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.status {
  margin: 10px 0 0;
  min-height: 1.2em;
  font-size: 0.88rem;
  color: var(--muted);
}

.status.error {
  color: var(--error);
}

.readout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.uva-number {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
}

.uva-number .metric-label {
  display: block;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.uva-number .uva-secondary {
  display: block;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 400;
  margin-top: 6px;
}

.band {
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 700;
  color: #0c0c12;
  white-space: nowrap;
}

.result h2 {
  font-size: 1rem;
  color: var(--muted);
  margin: 18px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.data-table td {
  padding: 7px 4px;
  border-bottom: 1px solid var(--border);
}

.data-table td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.data-table td:first-child {
  color: var(--muted);
}

.chart {
  margin: 4px 0 6px;
}

.uva-chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

.uva-chart-svg .grid {
  stroke: var(--border);
  stroke-width: 1;
}

.uva-chart-svg .axis {
  fill: var(--muted);
  font-size: 11px;
}

.uva-chart-svg .area {
  fill: var(--accent);
  opacity: 0.12;
}

.uva-chart-svg .curve {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.uva-chart-svg .marker {
  stroke: var(--muted);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

.uva-chart-svg .marker-dot {
  stroke: var(--text);
  stroke-width: 1.5;
}

.chart-empty {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 8px 0;
}

.disclaimer {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
  text-align: center;
}

.disclaimer a {
  color: var(--accent);
}

/* ---------------------------------------------------------------------------
   Knowledge Base: hub + article pages
   These share the dark theme and the .app container with the calculator.
   --------------------------------------------------------------------------- */

/* Top navigation shown on the calculator and the knowledge base. */
.site-nav {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
  font-size: 0.9rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--text);
}

.site-nav a.active {
  color: var(--text);
  font-weight: 600;
}

.site-nav .spacer {
  flex: 1;
}

/* Breadcrumb on article pages. */
.breadcrumb {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 16px;
  line-height: 1.6;
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb .sep {
  margin: 0 6px;
  color: var(--border);
}

/* Cards linking to each article on the hub page. */
.kb-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.kb-card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}

.kb-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.kb-card h2 {
  margin: 0 0 6px;
  font-size: 1.1rem;
  color: var(--text);
}

.kb-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.kb-card .kb-more {
  display: inline-block;
  margin-top: 10px;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 600;
}

/* Long-form article body. */
.prose {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 20px;
  margin-bottom: 18px;
}

.prose h1 {
  margin: 0 0 6px;
  font-size: 1.6rem;
  line-height: 1.25;
}

.prose .lead {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
  margin: 0 0 18px;
}

.prose h2 {
  font-size: 1.15rem;
  margin: 26px 0 10px;
  color: var(--text);
  text-transform: none;
  letter-spacing: normal;
}

.prose h3 {
  font-size: 1rem;
  margin: 18px 0 8px;
  color: var(--text);
}

.prose p,
.prose li {
  color: var(--text);
  font-size: 0.96rem;
  line-height: 1.65;
}

.prose ul,
.prose ol {
  padding-left: 22px;
  margin: 10px 0;
}

.prose li {
  margin-bottom: 6px;
}

.prose a {
  color: var(--accent);
}

.prose strong {
  color: var(--text);
}

.prose .data-table {
  margin: 14px 0;
}

.prose .data-table td:last-child {
  text-align: left;
  font-variant-numeric: normal;
}

.prose .data-table th {
  text-align: left;
  padding: 7px 4px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
}

/* Callout / key-point box. */
.callout {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 9px;
  padding: 14px 16px;
  margin: 18px 0;
  font-size: 0.94rem;
  line-height: 1.6;
}

.callout strong {
  color: var(--text);
}

/* "Try the calculator" call to action. */
.cta {
  display: block;
  text-align: center;
  background: var(--accent);
  color: #08111f;
  border-radius: 11px;
  padding: 14px 16px;
  font-weight: 600;
  text-decoration: none;
  margin: 22px 0 4px;
}

.cta:hover {
  background: #82b8ff;
}

/* "Keep reading" list at the foot of an article. */
.related {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 18px;
}

.related h2 {
  font-size: 1rem;
  color: var(--muted);
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.related ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.related li {
  margin-bottom: 8px;
}

.related a {
  color: var(--accent);
  text-decoration: none;
}

.related a:hover {
  text-decoration: underline;
}
