/* World Economy — development journal
 *
 * Retro trading-terminal aesthetic: dark, amber-on-slate with green/red
 * market accents, restrained CRT influence. Readability wins every conflict
 * with nostalgia. No external fonts, no CDN, no frameworks; works from file://.
 */

:root {
  --bg:          #0c0d10;
  --bg-panel:    #13151b;
  --bg-deep:     #0e1014;
  --border:      #23262f;
  --border-lit:  #4a4230;

  --text:        #f0e6cf;
  --text-body:   #c3bcaa;
  --text-dim:    #8a8474;
  --text-faint:  #55503f;

  --amber:       #ffb648;
  --green:       #3ddc84;
  --red:         #ff5c6c;
  --cyan:        #5cc8ff;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "DejaVu Sans Mono", "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, sans-serif;

  --measure: 74ch;
}

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

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-body);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
}

/* Faint scanlines; very low contrast so body text stays crisp. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.012) 0px,
    rgba(255, 255, 255, 0.012) 1px,
    transparent 1px,
    transparent 3px
  );
}
@media (prefers-reduced-motion: reduce) { body::before { display: none; } }

.wrap { max-width: 940px; margin: 0 auto; padding: 32px 20px 80px; }

/* --- Masthead ---------------------------------------------------------- */

.masthead {
  border: 1px solid var(--border);
  border-top: 2px solid var(--amber);
  background: var(--bg-panel);
  padding: 22px 24px;
  margin-bottom: 28px;
}
.masthead h1 {
  font-family: var(--mono);
  font-size: 26px;
  letter-spacing: 0.16em;
  margin: 0;
  color: var(--amber);
  text-shadow: 0 0 14px rgba(255, 182, 72, 0.25);
}
.masthead .subtitle {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 6px;
  letter-spacing: 0.05em;
}
.masthead .blurb { margin: 14px 0 0; color: var(--text-dim); font-size: 14px; max-width: var(--measure); }

/* --- Index list -------------------------------------------------------- */

.entry-card {
  border: 1px solid var(--border);
  background: var(--bg-panel);
  padding: 18px 22px;
  margin-bottom: 14px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.entry-card:hover, .entry-card:focus-within { border-color: var(--border-lit); background: #171a21; }

.entry-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: baseline;
}
.entry-meta .loop { color: var(--amber); }
.entry-meta .milestone { color: var(--cyan); }
.entry-meta .commit { color: var(--text-faint); }

.entry-card h2 { font-family: var(--mono); font-size: 19px; margin: 9px 0 8px; line-height: 1.35; }
.entry-card h2 a { color: var(--text); text-decoration: none; border-bottom: 1px solid transparent; }
.entry-card h2 a:hover, .entry-card h2 a:focus { color: var(--amber); border-bottom-color: var(--amber); }
.entry-card .summary { margin: 0 0 12px; color: var(--text-body); font-size: 15px; max-width: var(--measure); }

.read-link { font-family: var(--mono); font-size: 12.5px; color: var(--amber); text-decoration: none; letter-spacing: 0.06em; }
.read-link:hover, .read-link:focus { text-decoration: underline; }

/* --- Entry pages ------------------------------------------------------- */

.entry-header {
  border: 1px solid var(--border);
  border-top: 2px solid var(--amber);
  background: var(--bg-panel);
  padding: 22px 24px;
  margin-bottom: 26px;
}
.entry-header h1 { font-family: var(--mono); font-size: 25px; line-height: 1.3; margin: 10px 0 0; color: var(--text); }

article { max-width: var(--measure); }
article h2 {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--amber);
  margin: 36px 0 4px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
article h3 { font-family: var(--mono); font-size: 15px; color: var(--text); margin: 24px 0 4px; }
article p { margin: 12px 0; }
article ul, article ol { margin: 12px 0; padding-left: 22px; }
article li { margin: 5px 0; }
article a { color: var(--cyan); }
article strong { color: var(--text); font-weight: 600; }

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 1px 5px;
  color: var(--amber);
}
pre {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-left: 2px solid var(--border-lit);
  padding: 14px 16px;
  overflow-x: auto;
  color: var(--text-body);
  max-width: 100%;
}
pre code { background: none; border: none; padding: 0; color: inherit; font-size: inherit; }

blockquote { margin: 16px 0; padding: 2px 0 2px 16px; border-left: 2px solid var(--border-lit); color: var(--text-dim); font-style: italic; }

figure { margin: 22px 0; max-width: 100%; }
figure img { display: block; max-width: 100%; height: auto; border: 1px solid var(--border); background: var(--bg-deep); }
figcaption { font-family: var(--mono); font-size: 12px; color: var(--text-faint); margin-top: 8px; }

.table-scroll { overflow-x: auto; margin: 18px 0; }
table { border-collapse: collapse; font-family: var(--mono); font-size: 13px; min-width: 100%; }
th, td { border: 1px solid var(--border); padding: 6px 12px; text-align: left; white-space: nowrap; }
th { color: var(--text-dim); background: var(--bg-deep); font-weight: normal; }
td.num, th.num { text-align: right; }

.up   { color: var(--green); }
.down { color: var(--red); }
.warn { color: var(--amber); }

/* --- Navigation -------------------------------------------------------- */

.nav { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.06em; display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 22px; }
.nav a { color: var(--text-dim); text-decoration: none; }
.nav a:hover, .nav a:focus { color: var(--amber); }

.entry-footer {
  margin-top: 48px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-faint);
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: space-between;
}
.entry-footer a { color: var(--text-dim); text-decoration: none; }
.entry-footer a:hover, .entry-footer a:focus { color: var(--amber); }

.site-footer { margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--border); font-family: var(--mono); font-size: 12px; color: var(--text-faint); }

@media (max-width: 640px) {
  .wrap { padding: 20px 14px 56px; }
  body { font-size: 15px; }
  .masthead h1 { font-size: 20px; }
  .entry-header h1, .entry-card h2 { font-size: 18px; }
}
