/* Energy Intel — institutional energy-research dashboard styling.
   Light theme, dense tables, restrained palette, monospace numerics. */

:root {
  --fg: #0f172a;
  --fg-muted: #64748b;
  --fg-subtle: #94a3b8;
  --bg: #f8fafc;
  --bg-panel: #ffffff;
  --bg-row-alt: #f1f5f9;
  --bg-header: #0f172a;
  --bg-header-text: #f8fafc;
  --rule: #e2e8f0;
  --rule-strong: #cbd5e1;
  --accent: #1e3a5f;
  --accent-hover: #0f1d33;
  --pos: #047857;
  --neg: #b91c1c;
  --warn: #b45309;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font: 15px/1.55 var(--sans);
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--bg-header);
  color: var(--bg-header-text);
  border-bottom: 3px solid var(--accent);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bg-header-text);
  text-decoration: none;
}

.brand::before {
  content: "▲";
  margin-right: 0.5rem;
  color: #f59e0b;
  font-size: 0.85em;
}

nav { display: flex; gap: 1.5rem; }

nav a {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 500;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

nav a:hover { color: var(--bg-header-text); border-bottom-color: #f59e0b; }

main { max-width: 1080px; margin: 0 auto; padding: 1.75rem 1.5rem 3rem; }

article.brief {
  background: var(--bg-panel);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 1.75rem 2rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.meta { color: var(--fg-muted); font-size: 0.82rem; margin: 0 0 1rem 0; letter-spacing: 0.02em; }
.meta a { color: var(--accent); text-decoration: none; }
.meta a:hover { text-decoration: underline; }

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0.25rem 0 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--bg-header);
}

h2 {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 2rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule-strong);
  color: var(--accent);
}

h3 { font-size: 0.95rem; font-weight: 600; margin-top: 1.25rem; }

article.brief > p:first-of-type {
  background: var(--bg-row-alt);
  padding: 0.6rem 0.85rem;
  border-left: 3px solid var(--accent);
  margin: 0 0 1.25rem 0;
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.01em;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

code, pre { font-family: var(--mono); font-size: 0.88em; }
pre { background: var(--bg-row-alt); padding: 0.75rem 1rem; overflow-x: auto; border-radius: 2px; border: 1px solid var(--rule); }
p code { background: var(--bg-row-alt); padding: 0.1em 0.35em; border-radius: 2px; font-size: 0.85em; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 0.75rem 0 1.25rem;
  font-variant-numeric: tabular-nums;
}

th, td {
  padding: 0.45rem 0.75rem;
  text-align: right;
  border-bottom: 1px solid var(--rule);
}

th:first-child, td:first-child { text-align: left; }

td:first-child {
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: 0.02em;
}

td { font-family: var(--mono); font-size: 0.84rem; }

thead th {
  background: var(--bg-row-alt);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  border-bottom: 2px solid var(--rule-strong);
  border-top: 1px solid var(--rule-strong);
  position: relative;
}

thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { color: var(--accent); }

thead th.sortable::after {
  content: "";
  display: inline-block;
  margin-left: 0.4em;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid var(--fg-subtle);
  opacity: 0.35;
  vertical-align: middle;
}

thead th[data-sort-dir="asc"]::after {
  border-top: none;
  border-bottom: 4px solid var(--accent);
  opacity: 1;
}

thead th[data-sort-dir="desc"]::after {
  border-top: 4px solid var(--accent);
  border-bottom: none;
  opacity: 1;
}

tbody tr:hover { background: var(--bg-row-alt); }
tbody tr:nth-child(even) { background: rgba(241, 245, 249, 0.4); }
tbody tr:nth-child(even):hover { background: var(--bg-row-alt); }

.pos { color: var(--pos); }
.neg { color: var(--neg); }

ul, ol { padding-left: 1.5rem; }
li { margin: 0.25rem 0; }

ul#brief-list {
  list-style: none;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: var(--bg-panel);
  overflow: hidden;
}

ul#brief-list li { padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--rule); margin: 0; font-size: 0.9rem; }
ul#brief-list li:last-child { border-bottom: none; }
ul#brief-list li:hover { background: var(--bg-row-alt); }
ul#brief-list a { font-weight: 600; }

.preview { color: var(--fg-muted); font-size: 0.85rem; }

input[type="search"] {
  width: 100%;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  font: 0.9rem var(--sans);
  background: var(--bg-panel);
  margin-bottom: 1rem;
}

input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(30, 58, 95, 0.15);
}

.chart-block {
  margin-bottom: 1.5rem;
  background: var(--bg-panel);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 1rem 1.25rem 1.25rem;
}

.chart-block h2 { margin-top: 0; border: none; padding: 0; }
.chart-block .meta { margin: 0 0 0.5rem 0; }

.chart-canvas { position: relative; width: 100%; height: 280px; }
.chart-canvas-tall { height: 380px; }

@media (min-width: 1080px) {
  .chart-canvas { height: 320px; }
  .chart-canvas-tall { height: 440px; }
}

.chart-hint { font-size: 0.78rem; color: var(--fg-subtle); margin: -0.25rem 0 0.75rem; font-style: italic; }

canvas { background: transparent; }

blockquote { margin: 1rem 0; padding: 0.6rem 0.9rem; border-left: 3px solid var(--warn); background: #fffbeb; color: var(--fg); font-size: 0.9rem; }
em { color: var(--fg-muted); }
hr { border: none; border-top: 1px solid var(--rule); margin: 1.5rem 0; }

footer { text-align: center; padding: 1.5rem 1rem 2rem; color: var(--fg-subtle); font-size: 0.78rem; letter-spacing: 0.02em; }
footer small { color: var(--fg-subtle); }

@media (max-width: 720px) {
  body { font-size: 14px; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 0.5rem; padding: 0.75rem 1rem; }
  nav { gap: 1rem; flex-wrap: wrap; }
  main { padding: 1rem; }
  article.brief { padding: 1.25rem 1rem; border-radius: 0; }
  table { font-size: 0.78rem; }
  th, td { padding: 0.35rem 0.5rem; }
  h1 { font-size: 1.4rem; }
}
