/* -------------------------------------------------------------
   A clean, minimal, monochrome blog theme with a single accent.
   Inspired by the restraint of Daring Fireball: plain text,
   generous whitespace, no chrome, no cards, no shadows.
   ------------------------------------------------------------- */

:root {
  --color-bg: #202b3e;
  --color-text: #e8ecf2;
  --color-copy: #ccd3e0;
  --color-muted: #8b95b0;
  --color-rule: #303e58;
  --color-rule-hover: #3f4d67;
  --color-accent: #5ec8c0;
  --color-accent-dark: #82d9d2;
  --color-rss: #ee8c00;
  --color-rss-dark: #ffa733;

  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
  --font-garamond: "EB Garamond", Garamond, "Apple Garamond", Baskerville, serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --measure: 34rem;
  --sidebar-width: 15rem;
  --layout-gap: 3rem;
  --space: 1.5rem;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: calc(var(--measure) + var(--layout-gap) + var(--sidebar-width));
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header */

.site-header {
  position: relative;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  padding: 1.25rem 0;
  margin-bottom: 2rem;
}

.site-brand {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.site-title {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.site-title:hover {
  color: var(--color-accent);
}

.site-tagline {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.8125rem;
}

/* Mobile menu toggle */

.nav-toggle-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  padding: 0.5rem;
  margin: -0.5rem;
  background: none;
  border: none;
}

.nav-toggle-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--color-text);
  transform-origin: center;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Animate the three bars into an X when the menu is open */

body.nav-open .nav-toggle-btn span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

body.nav-open .nav-toggle-btn span:nth-child(2) {
  opacity: 0;
}

body.nav-open .nav-toggle-btn span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.sidebar-backdrop {
  display: none;
}

/* Layout: content + sidebar */

.layout {
  display: flex;
  align-items: flex-start;
  gap: var(--layout-gap);
}

.content {
  flex: 0 1 var(--measure);
  max-width: var(--measure);
  min-width: 0;
}

/* Whatever the first thing in the column is — heading, list, article —
   it should start flush with the sidebar's top edge, not carry whatever
   top margin it would normally have. */
.content > *:first-child {
  margin-top: 0;
}

.sidebar {
  flex: 0 0 var(--sidebar-width);
  width: var(--sidebar-width);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-rule);
}

.sidebar-nav a {
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
}

.sidebar-nav a:hover {
  color: var(--color-accent);
}

.sidebar-widget {
  margin-bottom: 2rem;
}

.sidebar-heading {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  margin: 0 0 0.9rem;
}

.sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.sidebar-list-title {
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.9375rem;
  line-height: 1.35;
}

.sidebar-list-title:hover {
  color: var(--color-accent);
}

.sidebar-list time {
  display: block;
  font-family: var(--font-mono);
  position: relative;
  top: 1px;
  color: var(--color-muted);
  font-size: 0.6875rem;
  margin-top: 0.15rem;
}

.sidebar-list .linkroll-marker {
  font-size: 1.1em;
  margin-left: 0.3rem;
}

.sidebar-list .featured-marker {
  font-size: 1em;
  line-height: 1;
  margin-left: 0.3rem;
}

.sidebar-tag-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sidebar-tag-list a {
  display: inline-block;
  font-family: var(--font-mono);
  position: relative;
  top: 1px;
  padding: 0.15rem 0.5rem;
  background: var(--color-rule);
  border: 1px solid var(--color-rule);
  border-radius: 999px;
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.625rem;
}

.sidebar-tag-list a:hover {
  background: var(--color-rule-hover);
  border-color: var(--color-rule-hover);
  color: #ffffff;
}

.sidebar-rss-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rss-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.5rem;
  background: var(--color-rss);
  color: #ffffff;
  text-decoration: none;
  font-family: var(--font-mono);
  position: relative;
  top: 1px;
  font-size: 0.625rem;
  font-weight: 600;
  border-radius: 3px;
}

.rss-button:hover {
  background: var(--color-rss-dark);
  color: #ffffff;
}

.rss-icon {
  width: 9px;
  height: 9px;
  flex-shrink: 0;
}

/* Links */

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

a:hover {
  color: var(--color-accent-dark);
}

/* Typography */

h1, h2, h3, h4 {
  font-family: var(--font-mono);
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-accent);
}

.page-title {
  font-size: 1.5rem;
  margin: 0 0 1.5rem;
}

.section-heading {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 2rem 0 1rem;
}

.section-heading:first-of-type {
  margin-top: 0;
}

.lede {
  color: var(--color-muted);
  font-size: 1rem;
  margin: -0.5rem 0 2rem;
}

p, ul, ol, blockquote, figure, pre {
  margin: 0 0 1.25rem;
}

blockquote {
  margin-left: 0;
  padding-left: 1rem;
  border-left: 3px solid var(--color-accent);
  color: var(--color-muted);
  font-style: italic;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875em;
  background: var(--color-rule);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

pre {
  position: relative;
  background: #17202e;
  color: #e6e6e6;
  padding: 1rem 1rem 1rem 1.5rem;
  border-radius: 4px;
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
}

.code-copy-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  background: var(--color-rule);
  color: var(--color-muted);
  border: none;
  border-radius: 3px;
  font-size: 0.75rem;
  cursor: pointer;
}

.code-copy-btn:hover {
  background: var(--color-rule-hover);
  color: #ffffff;
}

.code-copy-btn.is-copied {
  background: var(--color-accent);
  color: var(--color-bg);
}

/* Syntax highlighting (works with the eleventy-plugin-syntaxhighlight
   Prism output). Kept to the site's existing palette rather than a
   generic multi-colour theme. */

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: var(--color-muted);
  font-style: italic;
}

.token.punctuation {
  color: var(--color-copy);
}

.token.property,
.token.number,
.token.boolean,
.token.constant,
.token.symbol,
.token.deleted {
  color: var(--color-rss-dark);
}

.token.string,
.token.char,
.token.attr-value,
.token.builtin,
.token.inserted {
  color: var(--color-accent);
}

.token.selector,
.token.atrule,
.token.keyword,
.token.important {
  color: var(--color-accent-dark);
  font-weight: 600;
}

.token.function,
.token.class-name {
  color: #ffffff;
}

.token.operator,
.token.entity,
.token.url,
.token.tag,
.token.attr-name {
  color: var(--color-copy);
}

/* Keyboard keys, e.g. "press <kbd>Cmd</kbd> + <kbd>K</kbd>" */

kbd {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75em;
  padding: 0.1em 0.45em;
  border: 1px solid var(--color-rule-hover);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--color-rule);
  color: var(--color-text);
}

/* Tables */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.25rem;
  font-size: 0.9em;
}

th, td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--color-rule);
}

th {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  font-weight: 600;
}

/* Callouts, for asides that need to stand out from body copy */

.callout {
  margin: 0 0 1.25rem;
  padding: 0.85rem 1rem;
  border-left: 3px solid var(--color-accent);
  background: var(--color-rule);
  border-radius: 0 3px 3px 0;
}

.callout p:last-child {
  margin-bottom: 0;
}

.callout-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-accent);
  margin-bottom: 0.35rem;
}

.callout-warning {
  border-left-color: var(--color-rss);
}

.callout-warning .callout-label {
  color: var(--color-rss-dark);
}

/* Footnotes (markdown-it-footnote). Write "word[^1]" in a post, then
   "[^1]: the note text" anywhere else in the same file. */

.footnote-ref {
  font-size: 0.75em;
  vertical-align: super;
  text-decoration: none;
  color: var(--color-accent);
  margin-left: 0.1em;
}

.footnotes-sep {
  display: none;
}

.footnotes {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-rule);
  font-size: 0.8125rem;
  color: var(--color-muted);
}

.footnotes-list {
  padding-left: 1.25rem;
}

.footnote-item {
  margin-bottom: 0.5rem;
}

.footnote-item p {
  display: inline;
  margin: 0;
}

.footnote-backref {
  color: var(--color-accent);
  text-decoration: none;
  margin-left: 0.35rem;
}

/* Mastodon embeds — Mastodon's own iframe already sets sensible inline
   styles, this just adds consistent vertical spacing around it. Grab the
   embed code from a toot's "..." menu -> Get embed code. */

.mastodon-embed {
  margin: 2rem 0;
}

hr {
  border: none;
  border-top: 1px solid var(--color-rule);
  margin: 2.5rem 0;
}

/* Images and media, always responsive */

img, video, iframe {
  max-width: 100%;
  height: auto;
  display: block;
}

figure {
  margin: 2rem 0;
}

figure img, figure video {
  border-radius: 2px;
}

figcaption {
  color: var(--color-muted);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

/* Responsive video embeds (e.g. YouTube/Vimeo iframes) */

.video-embed {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  margin: 2rem 0;
  background: var(--color-rule);
}

.video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Spotify (and similarly fixed-height oEmbed players) — these already
   come with a sensible height from Spotify itself, so unlike video this
   just needs to be full width with the corners matching the theme. */

.spotify-embed {
  margin: 2rem 0;
}

.spotify-embed iframe {
  width: 100%;
  border: 0;
  border-radius: 8px;
}

/* PICO-8 cart embeds — square canvas, capped so it doesn't dominate the
   column on wide screens but still shrinks to fit on mobile. */

.pico8-embed {
  width: 100%;
  max-width: 512px;
  aspect-ratio: 1 / 1;
  margin: 2rem auto;
  background: #000000;
  overflow: hidden;
  border-radius: 8px;
}

.pico8-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  overflow: hidden;
}

/* Download links */

.download {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border: none;
  background: var(--color-accent);
  color: var(--color-bg);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9375rem;
  border-radius: 3px;
}

.download:hover {
  background: var(--color-accent-dark);
  color: var(--color-bg);
}

.download .meta {
  font-family: var(--font-mono);
  position: relative;
  top: 1px;
  font-weight: 400;
  font-size: 0.8125rem;
  color: rgba(32, 43, 62, 0.75);
}

.download:hover .meta {
  color: rgba(32, 43, 62, 0.9);
}

/* Post list (home page, tag pages) */

.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.post-list-item {
  padding: 1.5rem 0;
  border-top: 1px solid var(--color-rule);
}

.post-list-item:first-child {
  border-top: none;
  padding-top: 0;
}

.post-list-title-row {
  display: block;
  margin-bottom: 0.25rem;
}

.post-list-title {
  font-family: var(--font-mono);
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
}

.post-list-title:hover {
  color: var(--color-accent);
}

/* Linkroll permalink marker — links back to the post's own page since
   the title itself links straight out to the external URL. */

.linkroll-marker {
  display: inline-flex;
  position: relative;
  top: -2px;
  color: var(--color-rss);
  text-decoration: none;
  font-size: 1.3em;
  margin-left: 0.45rem;
  vertical-align: middle;
}

.linkroll-marker:hover {
  color: var(--color-rss-dark);
}

/* Featured post badge — not a link, just a flourish next to the title. */

.featured-marker {
  display: inline-block;
  font-family: var(--font-garamond);
  font-style: italic;
  font-weight: 600;
  color: var(--color-accent);
  font-size: 1.6em;
  margin-left: 0.4rem;
}

.post-list-item time {
  font-family: var(--font-mono);
  position: relative;
  top: 1px;
  color: var(--color-muted);
  font-size: 0.6875rem;
}

.post-list-summary {
  margin: 0.5rem 0 0;
  font-size: 0.9375rem;
  color: var(--color-muted);
}

/* Single post */

.post-header {
  margin-bottom: 2rem;
}

.post-title-row {
  font-size: 1.625rem;
  margin: 0 0 0.5rem;
}

.post-title {
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-text);
  text-decoration: none;
}

.post-title:hover {
  color: var(--color-accent);
}

.post-title-row .linkroll-marker {
  font-size: 0.75em;
}

.post-title-row .featured-marker {
  font-size: 0.85em;
  margin-left: 0.05rem;
}

.post-meta {
  font-family: var(--font-mono);
  color: var(--color-muted);
  font-size: 0.6875rem;
  margin: 0;
}

.post-meta time {
  position: relative;
  top: 1px;
}

.post-tags a {
  display: inline-block;
  margin: 0.15rem 0 0.15rem 0.4rem;
  padding: 0.1rem 0.4rem;
  background: var(--color-rule);
  border-radius: 999px;
  color: var(--color-muted);
  text-decoration: none;
  font-family: var(--font-mono);
  position: relative;
  top: 1px;
  font-size: 0.5625rem;
}

.post-tags a:hover {
  background: var(--color-rule-hover);
  color: #ffffff;
}

.post-content {
  font-size: 0.9375rem;
  color: var(--color-copy);
}

/* Plain prose pages (About, etc.) get the same body-copy treatment as
   posts, so text size/colour is consistent everywhere you're reading
   paragraphs rather than scanning a list. */

.tpl-page .content {
  font-size: 0.9375rem;
  color: var(--color-copy);
}

/* Archive */

.archive-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.archive-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--color-rule);
}

.archive-item:first-child {
  border-top: none;
  padding-top: 0;
}

.archive-item time {
  font-family: var(--font-mono);
  position: relative;
  top: 1px;
  color: var(--color-muted);
  font-size: 0.6875rem;
  flex-shrink: 0;
  width: 7.5rem;
}

.archive-item-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
}

.archive-item-title-link {
  color: var(--color-text);
  text-decoration: none;
}

.archive-item-title-link:hover {
  color: var(--color-accent);
}

.archive-item-title .featured-marker {
  font-size: 1.1em;
  position: relative;
  top: 1px;
}

.archive-item-title .linkroll-marker {
  font-size: 1em;
  top: 0;
}

/* Footer */

.site-footer {
  margin-top: 4rem;
  padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--color-rule);
  color: var(--color-muted);
  font-size: 0.8125rem;
}

.site-footer a {
  color: var(--color-muted);
}

.site-footer a:hover {
  color: var(--color-accent);
}

/* Collapse the sidebar into a burger menu below this width */

@media (max-width: 760px) {
  .nav-toggle-btn {
    display: flex;
  }

  .layout {
    flex-direction: column;
    gap: 0;
  }

  .content {
    max-width: 100%;
  }

  /* Sidebar becomes a fixed slide-in panel, off-screen until opened */
  .sidebar {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 95;
    width: min(85vw, 320px);
    height: 100vh;
    margin: 0;
    padding: 5rem 1.5rem 2rem;
    background: var(--color-bg);
    border-left: 1px solid var(--color-rule);
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.25s ease;
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
  }

  body.nav-open .sidebar-backdrop {
    opacity: 1;
    visibility: visible;
  }

  body.nav-open {
    overflow: hidden;
  }

  .sidebar-nav {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 1.5rem;
  }
}

/* Small screens */

@media (max-width: 480px) {
  .site-header {
    padding-top: 1.75rem;
  }

  .post-title-row {
    font-size: 1.5rem;
  }

  .archive-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
  }

  .archive-item time {
    width: auto;
  }

}
