/* ============================================
   malware is gay
   ============================================ */

/* --- palette: web-safe purples + contrast --- */
:root {
  --bg:           #0d0015;
  --bg-panel:     #1a0033;
  --border:       #663399;
  --border-light: #9966cc;
  --text:         #cccccc;
  --text-bright:  #ffffff;
  --text-dim:     #999999;
  --heading:      #ffcc00;
  --link:         #cc99ff;
  --link-hover:   #ffcc00;
  --link-visited: #9966cc;
  --accent:       #c8aee0;
  --accent-green: #33ff33;
  --accent-cyan:  #66ffff;
  --accent-yellow:#ffcc00;
  --tag-bg:       #330066;

  /* Terminal typeface, shared by the shell window and the site title.
     Menlo is the important one for iOS/macOS: it ships with both and, unlike
     Courier New, covers the box-drawing glyphs the prompt is built from
     (╭ ╰ ─), so the prompt lines stay aligned on an iPhone. */
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Mono', 'DejaVu Sans Mono',
               Menlo, Consolas, 'Roboto Mono', 'Courier New', monospace;
}

/* --- reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: Verdana, Arial, Helvetica, sans-serif;
  font-size: 13px;
  background: var(--bg) url('../img/stars.png') repeat;
  color: var(--text);
  line-height: 1.6;
  /* stop mobile Safari inflating text on its own; the media query below
     handles phone sizing deliberately */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* pixel-art assets stay crunchy; illustrations/photos stay smooth */
.nameplate,
.pixelated {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  image-rendering: -webkit-optimize-contrast;
}

/* --- utilities --- */
/* present to assistive tech and the heading outline, but not painted */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --- scrollbar --- */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: #1a0033; }
::-webkit-scrollbar-thumb { background: #663399; }
* { scrollbar-width: thin; scrollbar-color: #663399 #1a0033; }

/* --- links --- */
a {
  color: var(--link);
  text-decoration: underline;
}
a:visited {
  color: var(--link-visited);
}
a:hover {
  color: var(--link-hover);
}

/* --- layout --- */
.site-wrapper {
  display: grid;
  grid-template-columns: 1fr 200px;
  grid-template-rows: auto 1fr auto auto;
  grid-template-areas:
    "header  header"
    "content sidebar"
    "player  player"
    "footer  footer";
  max-width: 800px;
  margin: 0 auto;
  padding: 8px;
  gap: 8px;
}

/* min-width:0 on every grid item: without it an item's automatic minimum
   size is its min-content width, so one wide child (the ticker, a <pre>, a
   long URL) stretches the whole column past the viewport on phones. */
.site-header  { grid-area: header;  min-width: 0; }
.main-content { grid-area: content; min-width: 0; }
.sidebar      { grid-area: sidebar; min-width: 0; }
.music-player { grid-area: player;  min-width: 0; }
.site-footer  { grid-area: footer;  min-width: 0; }

/* --- header --- */
.header-banner {
  text-align: center;
  padding: 12px 8px;
  border: 2px solid var(--border);
  background: var(--bg-panel);
}

/* scrolling ticker -- replaces the obsolete <marquee> element */
.marquee-wrap {
  background: #000000;
  border: 1px solid var(--border);
  padding: 3px 0;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--accent-yellow);
  overflow: hidden;
}
.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee-scroll 32s linear infinite;
}
.marquee-text {
  white-space: nowrap;
  padding-right: 3em;
}
@keyframes marquee-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* the motion toggle (WCAG 2.2.2) stops the ticker and the cursor blink */
.motion-control {
  text-align: right;
  margin-bottom: 6px;
}
.motion-toggle {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 10px;
  min-height: 24px;
  padding: 2px 8px;
  cursor: pointer;
}
.motion-toggle:hover {
  color: var(--accent-yellow);
  border-color: var(--border-light);
}
:root[data-motion="paused"] .marquee-track,
:root[data-motion="paused"] .cursor {
  animation-play-state: paused;
}

.site-title {
  /* Monospace, matching the shell window. The old stack ended in the generic
     `cursive`, which iOS resolves to Snell Roundhand (a copperplate script)
     since iPhones have no Comic Sans. */
  font-family: var(--font-mono);
  font-size: 28px;
  color: var(--accent-yellow);
  margin: 6px 0 4px;
}
.site-title a {
  color: inherit;
  text-decoration: none;
}

.site-tagline {
  font-size: 12px;
  color: var(--accent-cyan);
  margin-bottom: 8px;
}

.main-nav a {
  color: var(--link);
  font-size: 13px;
  font-weight: bold;
  padding: 0 4px;
}
.nav-sep { color: var(--border); margin: 0 2px; }

/* --- sidebar --- */
.sidebar-box {
  border: 2px solid var(--border);
  background: var(--bg-panel);
  margin-bottom: 8px;
}
.box-title {
  font-family: Verdana, Arial, sans-serif;
  font-size: 11px;
  font-weight: bold;
  background: var(--border);
  color: var(--text-bright);
  padding: 3px 6px;
  text-transform: uppercase;
}
.box-content {
  padding: 8px;
  font-size: 12px;
}

.avatar {
  display: block;
  margin: 0 auto 8px;
  width: 110px;
  height: 110px;
  max-width: 100%;
  border: 2px solid var(--border-light);
  background: var(--bg);
}
.sidebar-name {
  font-family: Verdana, Arial, sans-serif;
  font-size: 13px;
  font-weight: bold;
  color: var(--accent-yellow);
  text-align: center;
  letter-spacing: 1px;
  margin: -2px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
}
.about-list {
  list-style: none;
  font-size: 12px;
  line-height: 1.5;
}

.status-box p {
  font-size: 12px;
}
.status-line {
  font-weight: bold;
  text-transform: lowercase;
}
.status-dot {
  font-size: 10px;
  vertical-align: 1px;
}
.status--online  { color: var(--accent-green); }
.status--idle    { color: var(--accent-yellow); }
.status--offline { color: #888888; }
.status-box .mood,
.status-box .working {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: normal;
}

/* --- tag cloud --- */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
.tag-cloud--page {
  justify-content: center;
  margin-bottom: 16px;
}
.tag-count {
  color: var(--text-dim);
}

/* --- terminal welcome --- */
.term-window {
  border: 2px solid var(--border);
  margin-bottom: 16px;
}
.term-titlebar {
  background: var(--border);
  color: var(--text-bright);
  font-family: Verdana, Arial, sans-serif;
  font-size: 11px;
  font-weight: bold;
  padding: 3px 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.term-buttons {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
  padding-left: 8px;
}
.term-buttons .tb {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: block;
}
.tb-min   { background: #ffcc00; }
.tb-max   { background: #33ff33; }
.tb-close { background: #ff5f87; }

.term-body {
  background: #0a0010;
  padding: 12px 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: #aaaaaa;
  line-height: 1.5;
  overflow-x: auto;
}
.term-login {
  color: var(--text-dim);
  font-style: italic;
}

/* two-line zsh prompt */
.term-body .ps1 {
  white-space: nowrap;
}
.ps1-frame  { color: var(--border-light); }
.ps1-user   { color: var(--accent-cyan); font-weight: bold; }
.ps1-path   { color: var(--link); }
.ps1-git    { color: var(--accent-yellow); }
.ps1-ok     { color: var(--accent-green); }
.ps1-err    { color: #ff5f87; }
.ps1-arrow  { color: var(--accent-green); font-weight: bold; }
.ps1-arrow--err { color: #ff5f87; }
.ps1-cmd    { color: var(--text-bright); }

/* motd banner inside the terminal */
.motd-box {
  position: relative;
  border: 1px solid var(--border-light);
  padding: 10px 10px 6px;
  margin: 10px 0 0 2px;
  max-width: 480px;
}
.motd-label {
  position: absolute;
  top: -8px;
  left: 8px;
  padding: 0 5px;
  background: #0a0010;
  color: var(--accent-yellow);
  font-size: 11px;
  letter-spacing: 1px;
}
.motd-inner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.motd-art {
  color: var(--link);
  font: inherit;
  line-height: 1.3;
  flex-shrink: 0;
  margin: 0;
}
.motd-eye { color: var(--accent-cyan); }
/* the flag sits in this column too, so it lines up under the text */
.motd-lines { min-width: 0; }
.motd-lines .output {
  white-space: pre-wrap;
}
.motd-flag {
  margin-top: 6px;
  line-height: 0.8;
  letter-spacing: -1px;
  overflow: hidden;
  white-space: nowrap;
}
.motd-flag .fl-1 { color: #5bcefa; }
.motd-flag .fl-2 { color: #f5a9b8; }
.motd-flag .fl-3 { color: #ffffff; }

.term-body .cursor {
  color: var(--accent-green);
}
.term-body .output {
  color: #aaaaaa;
}
.term-body .output-err {
  color: #ff5f87;
}
.term-body a {
  color: var(--text-bright);
  text-decoration: underline;
}
.term-body a:hover {
  color: var(--link-hover);
}

/* --- posts --- */
.section-title {
  font-family: Verdana, Arial, sans-serif;
  font-size: 16px;
  font-weight: bold;
  color: var(--accent-yellow);
  text-align: center;
  margin-bottom: 12px;
}

.post-preview {
  border: 1px solid var(--border);
  background: var(--bg-panel);
  padding: 10px;
  margin-bottom: 8px;
}
.post-preview h3 { margin-bottom: 2px; }
.post-preview h3 a {
  color: var(--accent-cyan);
  font-size: 14px;
  font-weight: bold;
}
.post-preview time {
  font-size: 11px;
  color: var(--text-dim);
}
.post-preview p {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text);
}

.more-link {
  text-align: center;
  font-size: 12px;
  margin-top: 12px;
}

.empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
}

.tags { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
/* min 24px box for WCAG 2.5.8 (target size) */
.tag {
  background: var(--tag-bg);
  color: var(--accent-cyan);
  font-size: 10px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  min-width: 24px;
  justify-content: center;
}
a.tag:visited { color: var(--accent-cyan); }
a.tag:hover {
  color: var(--accent-yellow);
  border-color: var(--border-light);
}

/* --- single post --- */
/* opaque panel so body copy never sits directly on the starfield */
.post-full {
  max-width: 100%;
  border: 2px solid var(--border);
  background: var(--bg-panel);
  padding: 12px 14px;
}
.post-header {
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}
/* list-page intro copy gets the same panel treatment */
.list-intro {
  border: 2px solid var(--border);
  background: var(--bg-panel);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.post-title {
  font-family: Verdana, Arial, sans-serif;
  font-size: 20px;
  font-weight: bold;
  color: var(--accent-yellow);
}
.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 4px;
}
.post-meta time,
.post-author { font-size: 12px; color: var(--text-dim); }
.post-description {
  margin-top: 6px;
  font-size: 12px;
  color: var(--accent);
  font-style: italic;
}

.post-body {
  font-size: 13px;
  line-height: 1.7;
}
.post-body h1, .post-body h2, .post-body h3,
.post-body h4, .post-body h5, .post-body h6 {
  font-family: Verdana, Arial, sans-serif;
  color: var(--accent-yellow);
  margin: 20px 0 8px;
}
.post-body h1 { font-size: 18px; }
.post-body h2 { font-size: 16px; }
.post-body h3 { font-size: 14px; }
.post-body h4, .post-body h5, .post-body h6 { font-size: 13px; }
.post-body p { margin-bottom: 10px; }
.post-body ul, .post-body ol { margin: 6px 0 10px 20px; }
.post-body li { margin-bottom: 3px; }
.post-body a { color: var(--link); }
.post-body a:hover { color: var(--link-hover); }
.post-body code {
  background: #000000;
  color: var(--accent-green);
  padding: 1px 4px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
}
.post-body pre {
  background: #000000;
  border: 1px solid var(--border);
  padding: 10px;
  overflow-x: auto;
  margin: 10px 0;
}
.post-body pre code {
  background: none;
  color: inherit;
  padding: 0;
}
/* chroma emits its own wrapper when highlighting */
.post-body .highlight { margin: 10px 0; }
.post-body .highlight pre { margin: 0; }
.post-body blockquote {
  border-left: 3px solid var(--accent-yellow);
  padding-left: 10px;
  color: var(--text-dim);
  margin: 10px 0;
}
.post-body img {
  max-width: 100%;
  height: auto;
  border: 2px solid var(--border);
}
.post-body hr {
  border: none;
  border-top: 1px dashed var(--border);
  margin: 16px 0;
}
.post-body strong { color: var(--text-bright); }
.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 12px;
}
.post-body th, .post-body td {
  border: 1px solid var(--border);
  padding: 4px 6px;
  text-align: left;
}
.post-body th {
  background: var(--bg-panel);
  color: var(--text-bright);
}

/* inline audio shortcode */
.post-body audio.player,
audio.player {
  width: 100%;
  margin: 10px 0;
  color-scheme: dark;
}

/* --- bandcamp embed --- */
.bandcamp-embed {
  margin: 12px 0 16px;
  border: 2px solid var(--border);
  background: var(--bg-panel);
  padding: 6px;
}
.bandcamp-embed iframe {
  display: block;
}
.bandcamp-link {
  margin: 6px 0 0;
  font-size: 11px;
  text-align: center;
}

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 20px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
}

/* --- music player --- */
.music-player {
  position: sticky;
  bottom: 0;
  z-index: 100;
}
.player-chrome {
  border: 2px solid var(--border);
  background: var(--bg-panel);
}
.player-titlebar {
  background: var(--border);
  color: var(--text-bright);
  font-size: 11px;
  font-weight: bold;
  padding: 2px 6px;
}
.player-body {
  padding: 6px 10px;
}
.player-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 3px;
}
.player-track { color: var(--accent-cyan); font-weight: bold; }
.player-artist { color: var(--text-dim); }

/* 24px tall for WCAG 2.5.8; the visible bar inside stays thin */
.player-progress-wrap {
  height: 24px;
  display: flex;
  align-items: center;
  cursor: pointer;
  margin-bottom: 3px;
}
.player-progress-wrap:focus-visible {
  outline: 2px solid var(--accent-yellow);
  outline-offset: 1px;
}
.player-progress-track {
  flex: 1;
  height: 6px;
  background: #000000;
  border: 1px solid var(--border);
}
.player-progress {
  height: 100%;
  width: 0%;
  background: var(--accent-green);
}

.player-times {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-dim);
  font-family: 'Courier New', Courier, monospace;
  margin-bottom: 3px;
}

.player-controls {
  display: flex;
  justify-content: center;
  gap: 4px;
}
.player-btn {
  background: var(--bg-panel);
  color: var(--text);
  border: 2px outset #9966cc;
  font-size: 14px;
  padding: 2px 10px;
  cursor: pointer;
  font-family: inherit;
}
.player-btn:active {
  border-style: inset;
}
.player-btn-play {
  font-size: 16px;
  padding: 2px 14px;
}

/* --- footer --- */
.site-footer {
  text-align: center;
  padding: 12px 0;
  border-top: 2px solid var(--border);
}

/* 88x31 buttons */
.nameplate-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  max-width: calc(88px * 8 + 7 * 4px);
  margin: 0 auto 10px;
  gap: 4px;
  line-height: 0;
}
.nameplate-container a,
.nameplate {
  display: block;
  line-height: 0;
}
.nameplate {
  width: 88px;
  height: 31px;
  border: none;
  padding: 0;
  margin: 0;
  opacity: 1;
  background: none;
  filter: none;
  mix-blend-mode: normal;
}

.footer-text {
  font-size: 11px;
  color: var(--text-dim);
  /* the footer sits on the starfield; the halo keeps contrast up if a glyph
     lands on one of the bright 1px stars */
  text-shadow: 0 0 3px var(--bg), 0 0 2px var(--bg);
}
.footer-text code {
  color: var(--accent-green);
  font-family: 'Courier New', Courier, monospace;
}
.footer-text a { color: var(--link); }
.footer-small { font-size: 10px; margin-top: 4px; }

/* --- pagination --- */
.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  list-style: none;
  margin-top: 16px;
}
.pagination li a,
.pagination li span {
  display: inline-block;
  padding: 2px 8px;
  border: 2px outset #9966cc;
  background: var(--bg-panel);
  color: var(--link);
  text-decoration: none;
  font-size: 12px;
}
.pagination li.active span {
  background: var(--border);
  color: var(--text-bright);
  border-style: inset;
}
.pagination li a:active {
  border-style: inset;
}

/* --- cursor blink (for welcome) --- */
.cursor {
  animation: blink 1s step-end infinite;
}
@keyframes blink {
  50% { opacity: 0; }
}

/* --- click spark (see assets/js/spark.js) --- */
.click-spark {
  position: fixed;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 9999;
}
.click-spark i {
  position: absolute;
  left: -1px;   /* bottom-centre of the ray sits on the click point */
  top: -7px;
  width: 2px;
  height: 7px;
  background: linear-gradient(to top, #ffffff, rgba(255, 255, 255, 0));
  transform-origin: 50% 100%;
  animation: spark-shoot 400ms ease-out forwards;
}
@keyframes spark-shoot {
  from { transform: rotate(var(--a)) translateY(1px) scaleY(0.4); opacity: 0.9; }
  to   { transform: rotate(var(--a)) translateY(-8px) scaleY(1); opacity: 0; }
}

/* --- selection --- */
::selection {
  background: var(--accent-yellow);
  color: #000000;
}

/* --- reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; }
  .click-spark { display: none; }
  .marquee-track { animation: none; }
}

/* --- responsive --- */
@media (max-width: 600px) {
  .site-wrapper {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "content"
      "sidebar"
      "player"
      "footer";
  }

  .sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-items: start;
  }

  .nameplate { width: 72px; height: auto; }

  /* --- phone header: trim the chrome so content reaches the fold --- */
  .header-banner { padding: 8px 6px; }
  .site-title { font-size: 22px; }
  /* duplicated by <meta name="description">, so no information is lost */
  .site-tagline { display: none; }
  .marquee-wrap { margin-bottom: 3px; }
  .motion-control { margin-bottom: 4px; }

  /* --- phone player: pinning it costs 20% of a small screen, so let it
         scroll away with the rest of the page --- */
  .music-player { position: static; }

  /* --- phone type scale: desktop sizes are too small to read on a phone --- */
  body { font-size: 15px; }
  .main-nav a { font-size: 15px; }

  .section-title { font-size: 18px; }
  .post-title { font-size: 22px; }
  .post-body { font-size: 16px; }
  .post-body h1 { font-size: 22px; }
  .post-body h2 { font-size: 19px; }
  .post-body h3 { font-size: 17px; }
  .post-body h4, .post-body h5, .post-body h6 { font-size: 16px; }
  .post-body code { font-size: 14px; }
  .post-body pre code { font-size: 13px; }
  .post-meta time, .post-author, .post-description { font-size: 14px; }
  .post-nav { font-size: 14px; }

  .post-preview h3 a { font-size: 17px; }
  .post-preview time { font-size: 13px; }
  .post-preview p { font-size: 14px; }
  .more-link, .empty { font-size: 14px; }
  .pagination li a, .pagination li span { font-size: 14px; }

  .box-content, .about-list, .status-box p { font-size: 14px; }
  .status-box .mood, .status-box .working { font-size: 13px; }
  .tag { font-size: 12px; }
  .footer-text { font-size: 13px; }
  .footer-small { font-size: 12px; }

  /* The terminal deliberately keeps its 13px monospace: bumping it (or
     stacking the moth above the motd) grows the window by ~50px and pushes
     the first post below the fold, which costs more than it gains. It gets
     the full column width instead. */
  .motd-box { max-width: none; padding: 8px 8px 5px; }
  .motd-inner { gap: 8px; }
}

@media (max-width: 400px) {
  .sidebar {
    grid-template-columns: 1fr;
  }
}
