/* ===============================================================
   Engineering Dispatches — "Phosphor"
   Typography:  JetBrains Mono (body/UI) + Departure Mono (display)
   Palette:     warm-black field, amber phosphor, green CRT accent
   =============================================================== */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }

:root {
  --bg:         #0b0b08;
  --bg-deep:    #07070a;
  --bg-tint:    #121008;
  --amber:      #ffb000;    /* primary phosphor */
  --amber-dim:  #b87700;
  --amber-soft: #7a4d00;
  --ivory:      #ecd99f;    /* muted amber-ivory for body */
  --ink-muted:  #6b5424;
  --rule:       #3a2d10;
  --rule-soft:  #211900;
  --accent:     #00d985;    /* secondary phosphor — green CRT accent */
  --accent-dim: #0a6d44;

  --code-bg:    #15110a;
  --code-fg:    #ffdf80;
  --code-warn:  #ff8b47;

  --font-mono:   "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-display:"Departure Mono", "JetBrains Mono", ui-monospace, monospace;

  --fs-xxs: 11px; --fs-xs: 12px; --fs-sm: 13px; --fs-base: 15px; --fs-md: 17px;
  --fs-lg: 20px; --fs-xl: 26px; --fs-2xl: 36px; --fs-3xl: 48px; --fs-4xl: 68px;

  --s-1:4px; --s-2:8px; --s-3:12px; --s-4:16px; --s-5:24px;
  --s-6:32px; --s-7:48px; --s-8:64px; --s-9:96px;

  --measure: 64ch;
  --wide:    980px;
  --ease-out: cubic-bezier(0.2, 0.8, 0.3, 1);
}

body {
  font-family: var(--font-mono);
  font-size: var(--fs-base);
  line-height: 1.72;
  color: var(--ivory);
  background: var(--bg);
  /* scanlines + vignette + noise */
  background-image:
    /* vignette */
    radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.65) 100%),
    /* scanlines */
    repeating-linear-gradient(to bottom,
      rgba(255, 176, 0, 0.02) 0px,
      rgba(255, 176, 0, 0.02) 1px,
      transparent 1px,
      transparent 3px),
    /* noise */
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 0.7  0 0 0 0 0  0 0 0 0.05 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-attachment: fixed;
  text-shadow: 0 0 6px rgba(255, 176, 0, 0.25);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--amber); color: var(--bg); text-shadow: none; }

.italic {
  font-family: var(--font-mono);
  font-style: italic;
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* scroll progress */
.scroll-progress {
  position: fixed; top: 0; left: 0;
  height: 2px; width: 0;
  background: var(--amber);
  z-index: 1000;
  transition: width 0.08s linear;
  box-shadow: 0 0 14px var(--amber);
}

/* terminal bar */
.terminal-bar {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--amber-dim);
  padding: var(--s-3) var(--s-5);
  border-bottom: 1px solid var(--rule);
  display: flex; gap: var(--s-2); align-items: baseline;
  white-space: nowrap; overflow: hidden;
  background: var(--bg-deep);
}
.terminal-bar__prompt { flex: 0 0 auto; }
.terminal-bar__user   { color: var(--accent); }
.terminal-bar__at     { color: var(--ink-muted); }
.terminal-bar__host   { color: var(--amber); font-weight: 600; }
.terminal-bar__sep    { color: var(--ink-muted); }
.terminal-bar__path   { color: var(--ivory); }
.terminal-bar__dollar { color: var(--accent); margin-left: var(--s-1); }
.terminal-bar__cmd    { color: var(--ivory); overflow: hidden; text-overflow: ellipsis; }
.terminal-bar__cursor {
  display: inline-block;
  width: 0.6ch; height: 1em;
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
  margin-left: 2px; transform: translateY(2px);
  animation: blink 1.05s steps(2, start) infinite;
}
@keyframes blink { to { visibility: hidden; } }

/* masthead */
.masthead {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s-5);
  max-width: var(--wide); margin: 0 auto;
  padding: var(--s-7) var(--s-5) var(--s-6);
  border-bottom: 2px solid var(--amber);
}
.masthead__brand {
  display: inline-flex; align-items: baseline; gap: var(--s-3);
  font-family: var(--font-mono); font-weight: 700;
  font-size: var(--fs-md); letter-spacing: -0.02em;
  text-transform: lowercase; color: var(--amber);
  text-shadow: 0 0 10px rgba(255,176,0,0.4);
}
.masthead__brand-mark { font-family: var(--font-display); color: var(--accent); transform: translateY(0.1em); text-shadow: 0 0 10px rgba(0, 217, 133, 0.4); }
.masthead__brand-name .italic { color: var(--ivory); }
.masthead__nav {
  display: inline-flex; align-items: center; gap: var(--s-3);
  font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--amber-dim);
}
.masthead__nav a { position: relative; padding-bottom: 2px; transition: color 0.2s; }
.masthead__nav a:hover { color: var(--accent); text-shadow: 0 0 8px rgba(0, 217, 133, 0.5); }
.masthead__rule { width: 1px; height: 12px; background: var(--amber-soft); }

.main { max-width: var(--wide); margin: 0 auto; padding: 0 var(--s-5); }

/* hero */
.hero { padding: var(--s-9) 0 var(--s-8); position: relative; max-width: 48ch; }
.hero__issue {
  font-size: var(--fs-xs); font-weight: 500;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--amber-dim);
  margin-bottom: var(--s-5); display: flex; align-items: center; gap: var(--s-3);
}
.hero__issue::before { content: ""; display: inline-block; width: 32px; height: 1px; background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.hero__title {
  font-family: var(--font-mono); font-weight: 800; font-size: var(--fs-4xl);
  line-height: 0.94; letter-spacing: -0.055em;
  margin: 0 0 var(--s-6); color: var(--amber);
  text-transform: lowercase;
  text-shadow: 0 0 24px rgba(255, 176, 0, 0.25);
}
.hero__title-pre {
  font-family: var(--font-mono); font-weight: 500; font-size: 0.28em;
  line-height: 1; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--amber-dim); display: inline-block; margin-bottom: var(--s-3);
  text-shadow: none;
}
.hero__title-main {
  font-family: var(--font-mono); font-weight: 800; font-style: italic;
  color: var(--accent); display: inline; letter-spacing: -0.055em;
  text-shadow: 0 0 22px rgba(0, 217, 133, 0.4);
}
.hero__title-post { font-style: italic; font-weight: 700; }
.hero__lede {
  font-family: var(--font-mono); font-size: var(--fs-md); line-height: 1.55;
  color: var(--ivory); margin: 0 0 var(--s-6); max-width: 48ch; opacity: 0.85;
}
.hero__meta {
  font-size: var(--fs-xs); color: var(--amber-dim);
  text-transform: uppercase; letter-spacing: 0.14em;
  display: flex; gap: var(--s-3); align-items: center; font-weight: 500;
}
.hero__dot { color: var(--accent); }

/* dispatches */
.dispatches { padding: var(--s-6) 0 var(--s-9); }
.dispatches__head {
  display: flex; align-items: center; gap: var(--s-4);
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.22em;
  color: var(--amber-dim); margin-bottom: var(--s-7); font-weight: 500;
}
.dispatches__label { color: var(--amber); font-weight: 600; }
.dispatches__rule { flex: 1; height: 1px; background: var(--rule); }

.dispatch { border-top: 1px solid var(--rule); }
.dispatch:last-child { border-bottom: 1px solid var(--rule); }
.dispatch__link {
  display: grid; grid-template-columns: 220px 1fr; gap: var(--s-7);
  padding: var(--s-7) 0; position: relative; overflow: hidden;
  transition: padding 0.35s var(--ease-out);
}
.dispatch__link::before {
  content: ""; position: absolute; left: -6px; top: 0; bottom: 0; width: 3px;
  background: var(--accent); box-shadow: 0 0 10px var(--accent);
  transform: scaleY(0); transform-origin: top;
  transition: transform 0.45s var(--ease-out);
}
.dispatch__link:hover::before { transform: scaleY(1); }
.dispatch__link:hover { padding-left: var(--s-4); background: rgba(255, 176, 0, 0.03); }

.dispatch__number {
  font-family: var(--font-display); font-weight: 400;
  font-size: var(--fs-3xl); line-height: 1; color: var(--amber);
  transition: color 0.35s; align-self: start; white-space: nowrap;
  text-shadow: 0 0 14px rgba(255, 176, 0, 0.35);
}
.dispatch__link:hover .dispatch__number { color: var(--accent); text-shadow: 0 0 20px rgba(0, 217, 133, 0.5); }
.dispatch__body { min-width: 0; }
.dispatch__meta {
  font-size: var(--fs-xs); font-weight: 500; color: var(--amber-dim);
  text-transform: uppercase; letter-spacing: 0.16em; margin-bottom: var(--s-4);
  display: flex; gap: var(--s-3); flex-wrap: wrap;
}
.dispatch__sep, .dispatch__tag-sep { color: var(--rule); }
.dispatch__tags span:not(.dispatch__tag-sep) { color: var(--ivory); }
.dispatch__title {
  font-family: var(--font-mono); font-weight: 700; font-size: var(--fs-2xl);
  line-height: 1.08; letter-spacing: -0.035em; margin: 0 0 var(--s-4);
  color: var(--amber); text-transform: lowercase;
  text-shadow: 0 0 16px rgba(255, 176, 0, 0.2);
}
.dispatch__excerpt {
  font-family: var(--font-mono); font-size: var(--fs-base); line-height: 1.65;
  color: var(--ivory); opacity: 0.75;
  margin: 0 0 var(--s-5); max-width: 58ch;
}
.dispatch__cta {
  display: inline-flex; align-items: baseline; gap: var(--s-2);
  font-size: var(--fs-xs); letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent); font-weight: 600;
  text-shadow: 0 0 8px rgba(0, 217, 133, 0.35);
}
.dispatch__arrow { transition: transform 0.35s var(--ease-out); display: inline-block; }
.dispatch__link:hover .dispatch__arrow { transform: translateX(6px); }

/* post */
.post { padding: var(--s-8) 0 var(--s-9); }
.post__header {
  position: relative; padding-bottom: var(--s-6); margin-bottom: var(--s-7);
  border-bottom: 1px solid var(--rule); max-width: var(--measure);
}
.post__issue {
  line-height: 1; margin-bottom: var(--s-5);
  display: flex; align-items: baseline; gap: var(--s-4); color: var(--accent);
}
.post__issue-label {
  font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 500;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--amber-dim);
}
.post__issue-number {
  font-family: var(--font-display); font-weight: 400; font-size: var(--fs-3xl);
  color: var(--accent); text-shadow: 0 0 16px rgba(0, 217, 133, 0.4);
}
.post__title {
  font-family: var(--font-mono); font-weight: 700; font-size: var(--fs-3xl);
  line-height: 1.08; letter-spacing: -0.045em; margin: 0 0 var(--s-5);
  color: var(--amber); text-transform: lowercase;
  text-shadow: 0 0 22px rgba(255, 176, 0, 0.2);
}
.post__dek {
  font-family: var(--font-mono); font-style: italic; font-weight: 500;
  font-size: var(--fs-lg); line-height: 1.45; color: var(--ivory);
  margin: 0 0 var(--s-5); letter-spacing: -0.01em; opacity: 0.85;
}
.post__meta {
  font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--amber-dim);
  display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center;
}
.post__meta-dot { color: var(--accent); }

.post__content {
  max-width: var(--measure); font-size: var(--fs-md); line-height: 1.8; color: var(--ivory);
}
.post__content > * + * { margin-top: var(--s-5); }
.post__content p { margin: 0; }

.post__content h2, .post__content h3 {
  font-family: var(--font-mono); font-weight: 700; color: var(--amber);
  letter-spacing: -0.025em; line-height: 1.15; text-transform: lowercase;
  text-shadow: 0 0 14px rgba(255,176,0,0.2);
}
.post__content h2 {
  font-size: var(--fs-2xl); margin-top: var(--s-8); padding-top: var(--s-6);
  border-top: 1px solid var(--rule); position: relative;
}
.post__content h2::before { content: "//"; position: absolute; top: var(--s-6); left: -4ch; color: var(--accent); }
.post__content h3 { font-size: var(--fs-xl); margin-top: var(--s-7); color: var(--amber); }
.post__content h3::before { content: "> "; color: var(--accent); font-weight: 500; }

.post__content a {
  color: var(--accent);
  border-bottom: 1px solid var(--accent-dim);
  padding-bottom: 1px;
  transition: color 0.2s, border-color 0.2s;
}
.post__content a:hover { color: var(--amber); border-color: var(--amber); text-shadow: 0 0 8px rgba(255,176,0,0.4); }

.post__content blockquote {
  margin: var(--s-7) 0; padding: var(--s-5) var(--s-5) var(--s-5) var(--s-6);
  border-left: 3px solid var(--accent);
  background: var(--bg-tint);
  font-family: var(--font-mono); font-style: italic; font-weight: 500;
  font-size: var(--fs-md); line-height: 1.55; color: var(--ivory); position: relative;
}
.post__content blockquote::before {
  content: "[ note ]"; position: absolute;
  top: calc(var(--s-5) * -0.5); left: var(--s-4);
  background: var(--bg); padding: 0 var(--s-2);
  font-family: var(--font-mono); font-style: normal;
  font-size: var(--fs-xxs); font-weight: 600;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent);
}
.post__content blockquote p { margin: 0; }

.post__content code {
  font-family: var(--font-mono); font-size: 0.88em;
  padding: 0.1em 0.45em; background: var(--bg-tint);
  border: 1px solid var(--rule); border-radius: 2px; color: var(--amber);
}
.post__content pre {
  margin: var(--s-6) calc(var(--s-5) * -1);
  padding: var(--s-5) var(--s-5) var(--s-5) calc(var(--s-5) + 28px);
  background: var(--code-bg); color: var(--code-fg);
  border-left: 3px solid var(--accent);
  border-radius: 2px; overflow-x: auto;
  font-size: var(--fs-sm); line-height: 1.65; position: relative;
  text-shadow: 0 0 4px rgba(255,223,128,0.2);
}
.post__content pre::before { content: "$"; position: absolute; top: var(--s-5); left: var(--s-5); color: var(--code-warn); font-weight: 600; }
.post__content pre code { background: none; border: 0; padding: 0; color: inherit; white-space: pre; font-size: inherit; }

.post__content p > img,
.post__content figure > img {
  display: block;
  max-width: 420px;
  width: 100%;
  height: auto;
  margin: var(--s-7) auto;
  padding: var(--s-3);
  background: var(--bg-tint);
  border: 1px solid var(--amber-soft);
  border-radius: 2px;
  box-shadow: 0 0 24px rgba(255, 176, 0, 0.06);
  box-sizing: border-box;
}
.post__content figure { margin: var(--s-7) auto; max-width: 420px; text-align: center; }
.post__content figure > img { margin: 0 auto var(--s-3); }
.post__content figure figcaption {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-style: italic;
  color: var(--amber-dim);
  letter-spacing: 0.02em;
  text-align: center;
}

.post__content table {
  width: 100%; border-collapse: collapse; margin: var(--s-6) 0;
  font-family: var(--font-mono); font-size: var(--fs-sm); line-height: 1.5;
}
.post__content thead th {
  text-align: left; font-weight: 600; font-size: var(--fs-xxs);
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--amber-dim);
  padding: var(--s-2) var(--s-4) var(--s-2) 0; border-bottom: 2px solid var(--amber);
}
.post__content tbody td {
  padding: var(--s-3) var(--s-4) var(--s-3) 0;
  border-bottom: 1px solid var(--rule-soft); vertical-align: top;
}
.post__content tbody tr:hover td { background: rgba(255, 176, 0, 0.05); }

/* colophon */
.colophon { max-width: var(--wide); margin: var(--s-9) auto 0; padding: 0 var(--s-5) var(--s-7); }
.colophon__rule { height: 1px; background: var(--amber); margin-bottom: var(--s-6); box-shadow: 0 0 8px rgba(255,176,0,0.3); }
.colophon__grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-5);
  font-size: var(--fs-xs); color: var(--ivory); opacity: 0.8;
}
.colophon__col p { margin: 0; }
.colophon__col--right { text-align: right; }
.colophon__label {
  text-transform: uppercase; letter-spacing: 0.22em; color: var(--amber);
  font-size: var(--fs-xxs); margin-bottom: var(--s-2); font-weight: 600;
}
.colophon__mark { font-family: var(--font-display); color: var(--accent); font-size: var(--fs-xl); line-height: 1; text-shadow: 0 0 14px rgba(0,217,133,0.4); }
.colophon a { color: var(--ivory); border-bottom: 1px solid var(--rule); transition: color 0.2s, border-color 0.2s; }
.colophon a:hover { color: var(--amber); border-color: var(--amber); }

/* post footer */
.post__footer { margin-top: var(--s-9); padding-top: var(--s-6); max-width: var(--measure); }
.post__footer-rule {
  height: 1px; background: var(--amber); margin-bottom: var(--s-6);
  position: relative; box-shadow: 0 0 8px rgba(255,176,0,0.3);
}
.post__footer-rule::after {
  content: "[ end ]"; position: absolute;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: var(--bg); padding: 0 var(--s-3);
  color: var(--accent); font-family: var(--font-mono);
  font-size: var(--fs-xxs); font-weight: 600;
  letter-spacing: 0.22em; text-transform: uppercase;
}
.post__footer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-6); }
.post__footer-label {
  font-size: var(--fs-xxs); letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--amber-dim); margin-bottom: var(--s-2); font-weight: 600;
}
.post__footer-text { margin: 0; color: var(--ivory); opacity: 0.85; font-size: var(--fs-sm); }
.post__footer a {
  color: var(--accent); border-bottom: 1px solid var(--accent-dim);
  padding-bottom: 1px; transition: color 0.2s, border-color 0.2s;
}
.post__footer a:hover { color: var(--amber); border-color: var(--amber); }

/* strong / em / hr / lists in post content */
.post__content strong {
  font-weight: 700;
  background: linear-gradient(transparent 60%, rgba(255, 176, 0, 0.22) 60%);
  color: var(--amber);
}
.post__content em { font-family: var(--font-mono); font-style: italic; font-weight: 500; color: var(--ivory); }
.post__content ul, .post__content ol { padding-left: 1.5em; margin: 0; }
.post__content li { padding-left: 0.5em; }
.post__content li + li { margin-top: var(--s-2); }
.post__content ul li::marker { color: var(--accent); content: "▸  "; }
.post__content ol li::marker { color: var(--accent); font-weight: 600; }
.post__content hr {
  border: 0; height: 1px; background: var(--rule); margin: var(--s-7) 0; position: relative;
}
.post__content hr::after {
  content: "◆ ◆ ◆"; position: absolute;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: var(--bg); padding: 0 var(--s-3);
  color: var(--accent); font-size: var(--fs-xs); letter-spacing: 0.5em;
}

/* ===============================================================
   PAGE-LOAD ANIMATIONS
   =============================================================== */
.hero, .dispatch, .post__header, .post__content, .post__footer, .colophon {
  opacity: 0;
  transform: translateY(8px);
  animation: rise 0.7s var(--ease-out) forwards;
}
.hero               { animation-delay: 0.08s; }
.dispatches__head   { animation-delay: 0.14s; }
.dispatch:nth-child(2) { animation-delay: 0.22s; }
.dispatch:nth-child(3) { animation-delay: 0.28s; }
.dispatch:nth-child(4) { animation-delay: 0.34s; }
.dispatch:nth-child(5) { animation-delay: 0.40s; }
.post__header       { animation-delay: 0.10s; }
.post__content      { animation-delay: 0.20s; }
.post__footer       { animation-delay: 0.30s; }
.colophon           { animation-delay: 0.40s; animation-duration: 0.5s; }
@keyframes rise { to { opacity: 1; transform: translateY(0); } }

@media (prefers-reduced-motion: reduce) {
  .hero, .dispatch, .post__header, .post__content, .post__footer, .colophon {
    animation: none; opacity: 1; transform: none;
  }
  .terminal-bar__cursor { animation: none; }
  .scroll-progress { transition: none; }
}

/* ===============================================================
   RESPONSIVE
   =============================================================== */
@media (max-width: 780px) {
  :root { --fs-2xl: 28px; --fs-3xl: 36px; --fs-4xl: 48px; }
  .terminal-bar { padding: var(--s-2) var(--s-4); }
  .masthead {
    padding: var(--s-5) var(--s-4) var(--s-4);
    flex-wrap: wrap; gap: var(--s-3);
  }
  .masthead__nav { width: 100%; justify-content: flex-start; gap: var(--s-2); }
  .main { padding: 0 var(--s-4); }
  .hero { padding: var(--s-7) 0 var(--s-6); }
  .dispatch__link { grid-template-columns: 1fr; gap: var(--s-4); padding: var(--s-6) 0; }
  .dispatch__number { font-size: var(--fs-2xl); }
  .post { padding: var(--s-6) 0 var(--s-8); }
  .post__issue-number { font-size: var(--fs-2xl); }
  .post__content h2::before { display: none; }
  .post__content pre { margin: var(--s-5) calc(var(--s-4) * -1); padding-left: calc(var(--s-4) + 24px); }
  .post__footer-grid { grid-template-columns: 1fr; }
  .colophon__grid { grid-template-columns: 1fr 1fr; row-gap: var(--s-5); }
  .colophon__col--right { text-align: left; }
}

@media (max-width: 480px) {
  .terminal-bar { font-size: 10.5px; }
  .hero__title { font-size: 42px; }
  .hero__lede { font-size: var(--fs-base); }
  .post__title { font-size: 30px; }
  .dispatch__title { font-size: 22px; }
}
