/* enigma.lt. Colour roles from the dataviz reference palette (validated in lab/phase-3, step 1 e):
   text and surface tokens, categorical slot 1 for TimesFM, slot 2 for naive. Dark mode has its
   own steps, not a flip. */
:root {
  color-scheme: light dark;
  --surface-1: #fcfcfb;
  --surface-2: #f3f2ef;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --grid: #e4e3df;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --history: #52514e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --surface-1: #1a1a19;
    --surface-2: #232321;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --grid: #33332f;
    --series-1: #3987e5;
    --series-2: #d95926;
    --history: #c3c2b7;
  }
  /* CoinMarketCap's widget writes its BTC line in dark grey at 50%, made for a white page. */
  .coinmarketcap-currency-widget span[style*="rgba(39, 52, 64, 0.5)"] {
    color: var(--text-secondary) !important;
  }
}

body { margin: 0; background: var(--surface-1); color: var(--text-primary);
       font: 16px/1.5 system-ui, sans-serif; }
a { color: inherit; text-underline-offset: 2px; }
main, .top, .foot { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
main { padding-top: 8px; padding-bottom: 24px; }

.top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 20px; padding-top: 14px;
       padding-bottom: 10px; border-bottom: 1px solid var(--grid); }
.brand { font-weight: 700; text-decoration: none; }
.top nav { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .95rem; }
.top nav a { color: var(--text-secondary); text-decoration: none; }
.top nav a[aria-current="page"] { color: var(--text-primary); text-decoration: underline; }

h1 { font-size: 1.4rem; margin: 18px 0 8px; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 28px 0 8px; }
h3 { font-size: 1rem; margin: 22px 0 6px; }
h4 { font-size: .9rem; font-weight: 600; margin: 16px 0 4px; color: var(--text-secondary); }
.lead { max-width: 70ch; }
.meta, .foot { color: var(--text-secondary); font-size: .875rem; }
.tier-tag { font-size: .8rem; font-weight: 400; color: var(--text-secondary);
            border: 1px solid var(--grid); border-radius: 4px; padding: 1px 6px; vertical-align: middle; }

.scroll { overflow-x: auto; }
table.data { border-collapse: collapse; font-size: .875rem; margin: 6px 0; }
table.data th, table.data td { padding: 4px 10px; border-bottom: 1px solid var(--grid); text-align: left;
                               white-space: nowrap; }
table.data thead th { color: var(--text-secondary); font-weight: 600; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.tier th { background: var(--surface-2); text-transform: capitalize; font-weight: 600; }
table.data .chg { color: var(--text-secondary); font-size: .8rem; }
table.data .skip { color: var(--text-secondary); font-style: italic; }
details { margin: 12px 0; }
summary { cursor: pointer; color: var(--text-secondary); }
ul.skips { color: var(--text-secondary); font-size: .875rem; }
code { font-size: .85em; }

/* Prose keeps a reading width; its tables take the page's, scrolling on a narrow screen. */
.prose > :not(table) { max-width: 72ch; }
.prose h1 { margin-top: 18px; }
.prose table { display: block; overflow-x: auto; border-collapse: collapse; font-size: .875rem;
               font-variant-numeric: tabular-nums; margin: 6px 0 14px; }
.prose th, .prose td { padding: 4px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
.prose th { color: var(--text-secondary); font-weight: 600; text-align: left; }

.foot { border-top: 1px solid var(--grid); padding-top: 10px; padding-bottom: 24px; }
.foot p { margin: 2px 0; }

/* The fan chart (asset pages). */
.viz { margin: 12px 0; }
.viz .legend { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: .85rem;
               color: var(--text-secondary); margin-bottom: 6px; }
.viz .key { display: inline-flex; align-items: center; gap: 6px; }
.viz .swatch-line { width: 16px; height: 2px; border-radius: 1px; }
.viz .swatch-band { width: 14px; height: 10px; border-radius: 2px; }
.viz .plot { position: relative; }
.viz .tip { position: absolute; pointer-events: none; background: var(--surface-1);
            color: var(--text-primary); border: 1px solid var(--grid); border-radius: 6px;
            padding: 6px 8px; font-size: .8rem; line-height: 1.35;
            box-shadow: 0 2px 6px rgba(0, 0, 0, .12); display: none; white-space: nowrap; z-index: 10; }
.viz .tip .muted { color: var(--text-secondary); }
.viz .uplot .u-legend { display: none; }

/* The widgets page. */
body.wide main, body.wide .top, body.wide .foot { max-width: 1240px; }  /* four widget cards a row */
.widgets { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.widgets > div { min-height: 150px; }
