/*
 * vga -- "320x200x256"
 * Graphics mode: black screen, the 8x8 BIOS font for display text, and every
 * colour taken from the default mode 13h palette. Body copy stays in a modern face.
 */

html[data-theme="vga"] {
  --bg: #000;
  --surface: #141414;   /* palette 11h */
  --line: #2c2c2c;      /* palette 13h */
  --text: #cbcbcb;      /* palette 1Dh */
  --dim: #828282;       /* palette 19h */
  --bright: #fff;
  --accent: #7dffff;
  --px: 2px;

  --c-comment: #828282;
  --c-pre: #ff7d7d;
  --c-kw: #7dffff;
  --c-type: #ffff7d;
  --c-str: #beff7d;
  --c-num: #ff7dff;
  --c-fn: #7dbeff;
  --c-attr: #ffbe7d;
  --c-punct: #a2a2a2;
  --c-lnum: #515151;
  --c-hl: #202020;
  --lang-label: block;

  background: var(--bg);
  color-scheme: dark;

  body {
    background: var(--bg);
    color: var(--text);
    font: 17px/1.65 "IBM Plex Sans", system-ui, sans-serif;
  }

  ::selection { background: #0000aa; color: #fff; }

  a { color: var(--accent); text-underline-offset: .2em; text-decoration-thickness: 1px; }
  a:hover { color: var(--bright); }

  /* Menu */

  .menubar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 24px;
    width: 100%;
    max-width: 52rem;
    margin: 0 auto;
    padding: 20px 1rem 14px;
    font: 16px/1 "BIOS", monospace;
  }

  .menubar a { color: var(--dim); text-decoration: none; text-transform: uppercase; font-size: 8px; letter-spacing: 1px; }
  .menubar a:hover { color: var(--bright); }
  .menubar u { text-decoration: none; }
  .menubar .menu-brand { margin-right: auto; font-size: 16px; letter-spacing: 0; text-transform: none; }

  .logo-letters span:nth-child(1) { color: #ff7d7d; }
  .logo-letters span:nth-child(2) { color: #ffbe7d; }
  .logo-letters span:nth-child(3) { color: #ffff7d; }
  .logo-letters span:nth-child(4) { color: #7dff7d; }
  .logo-letters span:nth-child(6) { color: #7dffff; }
  .logo-letters span:nth-child(7) { color: #7d9eff; }
  .logo-letters span:nth-child(8) { color: #df7dff; }

  .palstrip {
    display: block;
    width: 100%;
    height: 6px;
    image-rendering: pixelated;
  }

  /* Hero: a 320x100 slice of mode 13h */

  .hero.window {
    position: relative;
    margin: 2rem 0 3rem;
    container-type: inline-size;
  }

  .hero .fx {
    display: block;
    width: 100%;
    aspect-ratio: 320 / 120;   /* mode 13h pixels are 1.2x taller than wide */
    image-rendering: pixelated;
    background: #000;
    border: var(--px) solid var(--line);
    cursor: pointer;
  }

  /* The canvas draws the title; keep the real heading for readers and search. */
  .hero .logo {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .hero .tagline {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100cqw * 120 / 320 * .8);
    margin: 0;
    text-align: center;
    font: calc(100cqw * 8 / 320) / 1 "BIOS", monospace;
    color: #a2a2a2;
    pointer-events: none;
  }

  .fx-caption {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin: 8px 0 0;
    font: 8px/1.5 "BIOS", monospace;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #515151;
  }

  .fx-next { text-transform: uppercase; letter-spacing: 1px; color: var(--dim); }
  .fx-next:hover { color: var(--bright); }

  /* Section labels */

  .window { margin: 0 0 3rem; }

  .window-bar {
    display: block;
    margin-bottom: 1.5rem;
    padding-bottom: 10px;
    border-bottom: var(--px) solid var(--line);
    font: 8px/1 "BIOS", monospace;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--dim);
  }

  .window-bar > :not(.window-title) { display: none; }
  .post > .window-bar, .hero > .window-bar, .post-list:not(#recent) > .window-bar, .archive > .window-bar, .not-found > .window-bar { display: none; }

  /* Post list */

  .post-item {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 0 20px;
    margin-bottom: 2.75rem;
  }

  .post-item-meta { display: contents; }

  .swatch {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    grid-row: 1 / span 4;
    width: 56px;
    height: 56px;
    padding: 4px;
    background: var(--accent);
    color: #000;
    font: 8px/1 "BIOS", monospace;
    box-shadow: var(--px) var(--px) 0 0 var(--bg), calc(var(--px) * 3) calc(var(--px) * 3) 0 0 var(--line);
  }

  .post-item time {
    grid-column: 2;
    font: 8px/1 "BIOS", monospace;
    letter-spacing: 1px;
    color: var(--dim);
  }

  .post-item h2 {
    grid-column: 2;
    margin: 10px 0 8px;
    font: 600 1.35rem/1.3 "IBM Plex Sans", system-ui, sans-serif;
  }

  .post-item h2 a { color: var(--accent); text-decoration: none; }
  .post-item h2 a:hover { color: var(--bright); }
  .post-item .summary { grid-column: 2; }
  .post-item .summary p { margin: 0 0 .5em; }

  .post-item .more {
    grid-column: 2;
    justify-self: start;
    font: 8px/1 "BIOS", monospace;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--dim);
  }

  .post-item .more::after { content: " \25BA"; }
  .post-item .more:hover { color: var(--accent); }

  .file-list li { border-bottom: 1px solid var(--line); }
  .file-list a { padding: 10px 0; color: var(--text); }
  .file-list a:hover { color: var(--bright); }
  .file-list a:hover time { color: var(--accent); }
  .file-list time { font: 8px/2.6 "BIOS", monospace; letter-spacing: 1px; color: var(--dim); }

  .btn {
    display: inline-block;
    margin-top: 1.5rem;
    padding: 12px 16px;
    font: 8px/1 "BIOS", monospace;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-decoration: none;
    color: #000;
    background: var(--text);
    box-shadow: calc(var(--px) * 2) calc(var(--px) * 2) 0 0 #515151;
  }

  .btn:hover { background: var(--bright); color: #000; }

  .list-title, .not-found h1 {
    margin: 2rem 0;
    font: 24px/1.5 "BIOS", monospace;
    color: var(--bright);
  }

  .year { margin: 2.5rem 0 .5rem; font: 16px/1 "BIOS", monospace; color: #ffff7d; }

  .term-list { display: flex; flex-wrap: wrap; gap: 12px 20px; }
  .count { color: var(--dim); font-size: .85em; }

  .tag {
    font: .85rem/1 "IBM Plex Mono", monospace;
    text-decoration: none;
    color: var(--text);
    padding: 4px 8px;
    border: 1px solid #515151;
  }

  .tag::before { content: "#"; color: var(--dim); }
  .tag:hover { color: #000; background: var(--accent); border-color: var(--accent); }
  .tag:hover::before { color: #000; }

  /* Article */

  .post { margin-top: 3rem; }

  .post-header { margin-bottom: 2.5rem; padding-bottom: 1.5rem; border-bottom: var(--px) solid var(--line); }

  .post-header h1 {
    margin: 0 0 1.25rem;
    font: 24px/1.5 "BIOS", monospace;
    color: var(--accent);
  }

  .post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
  .post-meta .swatch { width: auto; height: auto; padding: 6px; box-shadow: none; }
  .post-meta time { font: 8px/1 "BIOS", monospace; letter-spacing: 1px; text-transform: uppercase; color: var(--dim); }

  .prose p, .prose ul, .prose ol { margin: 0 0 1.25em; }
  .prose strong { color: var(--bright); }

  .prose h1, .prose h2, .prose h3 {
    margin: 2.5em 0 1em;
    font: 16px/1.5 "BIOS", monospace;
  }

  .prose h1 { color: #ffff7d; }
  .prose h2 { color: #7dff7d; }
  .prose h3 { color: #ff7dff; font-size: 8px; letter-spacing: 1px; text-transform: uppercase; }
  .prose h1::before, .prose h2::before { content: "\25A0 "; color: var(--accent); }

  .prose :not(pre) > code {
    font: .88em "IBM Plex Mono", monospace;
    padding: .1em .35em;
    color: #ffdf7d;
    background: var(--surface);
  }

  .prose blockquote { margin: 0 0 1.25em; padding-left: 1.25rem; border-left: 4px solid var(--accent); color: #a2a2a2; }
  .prose hr { border: 0; border-top: var(--px) solid var(--line); margin: 2.5em 0; }
  .prose img { border: var(--px) solid var(--line); }
  .prose th { color: var(--bright); border-bottom: var(--px) solid #515151; }
  .prose td { border-bottom: 1px solid var(--line); }

  .highlight, .prose > pre {
    padding: 1.5rem 1.25rem 1.25rem;
    background: var(--surface);
    border-left: 4px solid var(--accent);
    font: 14.5px/1.55 "IBM Plex Mono", ui-monospace, monospace;
    color: var(--text);
  }

  .highlight code[data-lang]::before {
    padding: 5px 8px;
    font: 8px/1 "BIOS", monospace;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #000;
    background: var(--accent);
  }

  .comments { margin-top: 4rem; }

  /* Footer */

  .statusbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    width: 100%;
    max-width: 52rem;
    margin: 2rem auto 0;
    padding: 20px 1rem 28px;
    border-top: var(--px) solid var(--line);
    font: 8px/1.5 "BIOS", monospace;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #515151;
  }

  .statusbar a { color: var(--dim); text-decoration: none; }
  .statusbar a:hover { color: var(--bright); }
  .statusbar b { display: none; }
  .statusbar .copyright { margin-left: auto; }

  @media (max-width: 40em) {
    body { font-size: 16px; }
    .post-item { grid-template-columns: 32px 1fr; gap: 0 14px; }
    .swatch { width: 32px; height: 32px; font-size: 0; }
    .post-meta .swatch { font-size: 8px; }
    .post-header h1, .list-title { font-size: 16px; }
    .highlight, .prose > pre { margin-left: -1rem; margin-right: -1rem; font-size: 13px; }
    .statusbar .copyright { margin-left: 0; }
  }
}
