/* Shared reading sections inside the persistent LCD blog shell. */
:root {
  --accent-secondary: var(--terminal-accent-secondary, #d6aa70);
  --site-content-width: 1200px;
  --site-panel-bg: color-mix(in srgb, var(--ink) 2%, var(--paper));
  --site-panel-radius: 6px;
  --site-image-radius: 4px;
}
.site-shell { max-width: calc(var(--site-content-width) + 96px); }
/* Subtle corners keep the pixel identity while softening panels and images. */
.site-header { border-radius: 0; }
#posts .post-card, .section-view {
  border-radius: var(--site-panel-radius);
}
.post-thumbnail, .post-figure, .post-figure a, .post-figure img,
.about-panorama, .about-panorama img, .lightbox-img {
  border-radius: var(--site-image-radius);
}
/* Programmatic navigation targets are containers, not interactive controls. */
#journal:focus, #postMain:focus { outline: none; }
.site-nav [aria-current] { color: var(--accent); }
.section-view { margin-top: 28px; padding: 20px; background: var(--site-panel-bg); }
.section-back { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: 22px; color: var(--accent); font-size: 16px; line-height: 1.5; }
.section-back:hover { color: var(--ink); }
.post-header { margin-bottom: 22px; }
.post-head { display: flex; flex-direction: column-reverse; align-items: flex-start; gap: 12px; }
#postMain .post-title { font: 400 32px/1.25 var(--simple-font), monospace; color: var(--accent); letter-spacing: 0; margin: 0; overflow-wrap: anywhere; }
.post-description, .about-copy :is(h1, h2, p) { font: 400 16px/1.5 var(--simple-font), monospace; color: #ded5c8; white-space: pre-line; }
.post-description { max-width: none; margin: 0 0 32px; overflow-wrap: anywhere; }
.post-gallery { display: grid; gap: 24px; }
.post-figure { margin: 0; min-width: 0; }
.post-figure a { display: block; }
.post-figure img { display: block; width: 100%; height: auto; background: #101115; }
.post-figure a:focus-visible { outline-offset: 4px; }
/* A fine bevel and cast shadow give blog images a mounted-print finish. */
.post-thumbnail, .post-figure {
  position: relative;
  isolation: isolate;
  box-shadow: 0 2px 3px #00000038, 0 10px 24px -8px #00000080;
}
.post-thumbnail::after, .post-figure::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  border: 1px solid #ffffff24;
  border-radius: inherit;
  box-shadow: inset 0 1px 0 #ffffff1a, inset 0 -1px 0 #00000040;
}
.post-nav { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--line); }
.post-nav-link { display: flex; flex-direction: column; gap: 8px; min-height: 44px; overflow-wrap: anywhere; font-size: 16px; line-height: 1.5; }
.post-nav-meta { color: var(--muted); }
.post-nav-title { color: var(--accent); }
.post-nav-row:last-child { text-align: right; }
.post-nav-link:hover .post-nav-title { color: var(--ink); }
.post-nav-link.is-empty { visibility: hidden; }
.about-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 40px; align-items: start; }
.about-panorama { position: relative; align-self: stretch; margin: 0; }
.about-panorama img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; }
.about-copy { min-width: 0; }
.about-copy :is(h1, h2, p) { white-space: pre-line; overflow-wrap: anywhere; }
.about-title { margin: 0 0 20px; }
.about-copy p { margin: 0 0 20px; }
.about-subtitle { margin: 26px 0 12px; }
.about-copy > :last-child { margin-bottom: 0; }
.route-error { color: var(--ink); font-size: 16px; line-height: 1.7; }
.route-error a, .route-error button { color: var(--accent); }
.route-error button { display: block; border: 0; padding: 12px 0; background: transparent; }
/* Retain the existing image reader: zoom, pan, keyboard and touch navigation. */
.lightbox { position: fixed; inset: 0; z-index: 10010; background: #08090cf5; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 160ms ease, visibility 0s 160ms; }
.lightbox.open { opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
.image-viewer { position: relative; width: 100%; height: 100%; color: var(--ink); font: 16px/1.5 var(--simple-font), monospace; }
.image-viewer-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.lightbox-img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; touch-action: none; }
.lightbox :is(button, .lightbox-full, .lightbox-counter) { position: absolute; z-index: 1; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--site-image-radius); background: #17191ee8; color: var(--ink); font: inherit; }
.lightbox button:hover, .lightbox-full:hover { color: var(--accent); }
.lightbox-close { top: 12px; right: 12px; width: 44px; height: 44px; }
.lightbox-full { top: 12px; right: 68px; min-height: 44px; }
.lightbox-prev, .lightbox-next { top: 50%; transform: translateY(-50%); width: 44px; height: 44px; }
.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }
.lightbox-counter { bottom: 12px; left: 50%; transform: translateX(-50%); }
.lightbox .hidden { visibility: hidden; }
@media (max-width: 740px) {
  .about-layout { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .about-panorama { max-width: 100%; }
  .about-panorama img { position: static; height: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .lightbox { transition: none; }
}

/* Each control keeps its assigned accent across interaction states. */
.section-back, #scrollTop, #back-to-top { --control-accent: var(--accent-secondary); }
#posts .post-date, #postMain .post-date { color: var(--accent-secondary); }
.year-stop[aria-pressed='true'] .year-stop-label {
  color: var(--accent-secondary);
  opacity: 1;
}
#posts .post-year { color: var(--accent-secondary); }
#posts .post-year::before, #posts .post-year::after {
  background: color-mix(in srgb, var(--accent-secondary) 28%, transparent);
}
.site-header .site-nav { gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.site-header .site-nav a,
:is(.read-post, .more-posts),
.section-back,
.post-nav-link,
#scrollTop,
#back-to-top,
.route-error button,
.lightbox :is(button, .lightbox-full) {
  --button-accent: var(--control-accent, var(--accent));
  min-height: 44px;
  padding: 9px 16px;
  font: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: color-mix(in srgb, var(--button-accent) 8%, var(--paper));
  color: var(--button-accent);
  border-radius: var(--site-image-radius);
  transition: background-color 140ms ease, border-color 140ms ease;
}
.site-header .site-nav a:hover,
:is(.read-post, .more-posts):hover,
.section-back:hover,
.post-nav-link:hover,
#scrollTop:hover,
#back-to-top:hover,
.route-error button:hover,
.lightbox :is(button, .lightbox-full):hover {
  --button-accent: var(--control-accent, var(--accent));
  background: color-mix(in srgb, var(--button-accent) 20%, var(--paper));
  border-color: var(--button-accent);
  color: var(--button-accent);
}
.site-header .site-nav a[aria-current] {
  --button-accent: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, var(--paper));
  border-color: var(--accent);
  box-shadow: none;
}
.site-header .site-nav a:active, :is(.read-post, .more-posts):active, .section-back:active, .post-nav-link:active, #scrollTop:active, #back-to-top:active, .route-error button:active, .lightbox :is(button, .lightbox-full):active { --button-accent: var(--control-accent, var(--accent)); background: color-mix(in srgb, var(--button-accent) 28%, var(--paper)); }
.site-header .site-nav a:focus-visible, :is(.read-post, .more-posts):focus-visible, .section-back:focus-visible, .post-nav-link:focus-visible, #scrollTop:focus-visible, #back-to-top:focus-visible, .route-error button:focus-visible, .lightbox :is(button, .lightbox-full):focus-visible { outline-color: var(--button-accent); }
@media (max-width: 580px) {
  .section-view { padding: 14px; margin-top: 24px; }
  .post-nav { gap: 16px; }
  .site-header .site-nav { gap: 8px; }
  .site-header .site-nav a, a.read-post { padding-inline: 10px; }
}

/* Navigation sits at the right edge of the shared header. */
.site-header { flex-wrap: wrap; }
.site-header .site-nav { margin: 0 0 0 auto; justify-content: flex-end; }
@media (max-width: 740px) {
  .site-header .site-identity { width: auto; flex: 1 1 auto; }
  .site-header .site-nav { flex: 0 0 auto; }
}
@media (max-width: 580px) {
  .site-header .site-identity { flex-basis: 100%; }
  .site-header .site-nav { margin-left: auto; }
}
/* A 2px gap separates the navigation from the header divider. */
.site-header { padding-bottom: 0; }
.site-header .site-identity { padding-bottom: 24px; }
.site-header .site-nav { align-self: flex-end; margin-bottom: 2px; }


/* One compact identity block, using native dot sizes throughout. */
.brand-copy { min-width: 0; }
.brand-wordmark picture, .brand-wordmark img { display: block; }
.brand-wordmark img { width: 522px; height: 78px; max-width: none; image-rendering: pixelated; }
.site-header { gap: 12px 24px; padding-top: 24px; }
.site-header .site-identity {
  display: grid;
  grid-template-columns: 150px 576px;
  align-items: start;
  gap: 24px;
  flex: 0 1 auto;
  padding-bottom: 12px;
}
.site-header .brand-copy { align-self: end; padding-top: 0; }
.site-header .brand-wordmark { margin: 0; }
.site-header .brand-copy > p { margin-top: 12px; line-height: 24px; color: var(--ink); }
.site-header .site-nav { margin-top: 0; margin-bottom: 2px; }
@media (max-width: 740px) {
  .site-header .site-identity { gap: 18px; }
}
@media (max-width: 580px) {
  .brand-wordmark img { width: 261px; height: 39px; }
  .site-header { gap: 8px 16px; }
  .site-header .site-identity { grid-template-columns: 100px 192px; gap: 20px; padding-bottom: 4px; }
  .site-header .brand-copy > p { margin-top: 8px; }
}
@media (max-width: 360px) {
  .site-header .site-identity { grid-template-columns: 192px; gap: 12px; }
  .site-header .brand-copy { padding-top: 0; }
  .site-shell { padding-inline: 12px; }
}
@media (min-width: 581px) and (max-width: 800px) {
  .site-header { row-gap: 6px; }
  .site-header .site-identity { padding-bottom: 0; }
}

/* Native-sized single-line variants preserve the dot geometry at each width. */
@media (min-width: 581px) and (max-width: 960px) {
  .brand-wordmark img { width: 261px; height: 39px; }
  .site-header .site-identity { grid-template-columns: 150px 288px; }
}

/* Share the subtitle row with navigation instead of adding a separate row. */
.site-header {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  grid-template-rows: 127px 44px;
  align-items: center;
  gap: 0 24px;
  padding-bottom: 2px;
}
.site-header .site-identity, .site-header .brand-copy { display: contents; }
.site-header .brand { grid-column: 1; grid-row: 1 / 3; align-self: start; }
.site-header .brand-wordmark { grid-column: 2 / 4; grid-row: 1; align-self: end; margin: 0 0 8px; }
.site-header .brand-copy > p { grid-column: 2; grid-row: 2; align-self: start; margin: 0; white-space: nowrap; }
.site-header .site-nav { grid-column: 3; grid-row: 2; align-self: center; margin: 0; gap: 8px; flex-wrap: nowrap; }
.site-header .site-nav a { padding-inline: 8px; gap: 8px; }
@media (min-width: 581px) and (max-width: 740px) {
  .site-header { column-gap: 12px; }
}
@media (max-width: 580px) {
  .site-header { grid-template-columns: 100px minmax(0, 1fr) auto; grid-template-rows: 114px 44px; gap: 8px 12px; }
  .site-header .brand { grid-row: 1; }
  .site-header .brand-wordmark { margin-bottom: 0; }
  .site-header .brand-copy > p { grid-column: 1 / 3; }
}
@media (max-width: 360px) {
  .site-header .site-nav { gap: 4px; }
  .site-header .site-nav a { padding-inline: 4px; gap: 4px; }
}
.site-header .site-nav { gap: 4px; }
.site-header .site-nav a { padding-inline: 4px; gap: 6px; }
@media (max-width: 580px) {
  .site-header .site-nav { font-size: 16px; }
  .site-header .site-nav a { gap: 4px; }
}
@media (max-width: 360px) {
  .site-header { grid-template-columns: minmax(0, 1fr); grid-template-rows: 114px 14px 24px 44px; gap: 8px 0; }
  .site-header .brand { grid-column: 1; grid-row: 1; }
  .site-header .brand-wordmark { grid-column: 1; grid-row: 2; }
  .site-header .brand-copy > p { grid-column: 1; grid-row: 3; }
  .site-header .site-nav { grid-column: 1; grid-row: 4; justify-self: end; }
}
/* Leave breathing room under the head while tabs meet the divider. */
.site-header {
  grid-template-rows: 127px 60px;
  padding: 20px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.site-header .site-nav { align-self: end; margin-bottom: 0; }
@media (max-width: 580px) {
  .site-header { grid-template-rows: 114px 60px; padding: 14px; column-gap: 8px; }
}
@media (max-width: 380px) {
  .site-header { grid-template-columns: minmax(0, 1fr); grid-template-rows: 114px 14px 24px 60px; gap: 8px 0; }
  .site-header .brand { grid-column: 1; grid-row: 1; }
  .site-header .brand-wordmark { grid-column: 1; grid-row: 2; }
  .site-header .brand-copy > p { grid-column: 1; grid-row: 3; }
  .site-header .site-nav { grid-column: 1; grid-row: 4; justify-self: end; }
}

/* Reading navigation and viewer chrome share the homepage button surfaces. */
.post-nav-link { width: 100%; align-items: stretch; }
.post-nav-link .post-nav-title, .post-nav-link:hover .post-nav-title { color: inherit; }
.lightbox .lightbox-counter { border: 0; background: var(--site-panel-bg); color: var(--muted); }

/* Reserve room for the persistent footer, including mobile safe areas. */
body { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
.site-footer {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 30;
  width: calc(100% - 96px);
  max-width: var(--site-content-width);
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
  padding: 0 16px env(safe-area-inset-bottom, 0px);
  border-radius: 0;
  border: 0;
  background: color-mix(in srgb, var(--ink) 2%, var(--paper));
  box-shadow: 0 -12px 0 var(--paper);
  font-size: 16px;
}
.site-footer > span { white-space: nowrap; }
#back-to-top { gap: 8px; }
@media (min-width: 581px) and (max-width: 740px) {
  .site-footer { width: calc(100% - 52px); }
}
@media (max-width: 580px) {
  .site-footer {
    width: calc(100% - 44px);
    padding: 0 12px env(safe-area-inset-bottom, 0px);
    gap: 8px;
    font-size: 16px;
    line-height: 1.5;
    flex-wrap: nowrap;
  }
  .site-footer .back-to-top-label { display: none; }
  .site-footer #back-to-top { padding-inline: 8px; white-space: nowrap; }
}
@media (max-width: 360px) {
  .site-footer { width: calc(100% - 24px); padding-inline: 8px; }
}

/* The complete header stays at a constant height while scrolling. */
.site-header-anchor { position: sticky; top: 0; z-index: 30; pointer-events: none; }
.site-header-anchor .site-header {
  --header-content-gap: 12px;
  pointer-events: auto;
  position: relative;
  overflow: clip;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  grid-template-rows: 135px 36px;
  column-gap: 24px;
  padding-block: 12px;
  padding-inline: 0;
  background: var(--paper);
  border-bottom: 0;
  /* Cover the posts' soft shadows as they pass beneath the header. */
  box-shadow: 0 0 0 16px var(--paper), 0 var(--header-content-gap) 0 16px var(--paper);
}
.site-header-anchor .brand,
.site-header-anchor .brand-copy > p {
  opacity: 1;
}
.site-header-anchor .brand { max-height: 100%; overflow: visible; }
@media (min-width: 581px) {
  /* Native SVG size keeps the head and wordmark on the same 2px / 3px dot grid. */
  .site-header-anchor .brand-logo { width: 150px; height: 171px; }
}
.site-header-anchor .brand-copy > p {
  width: max-content;
  max-width: 100%;
  max-height: 100%;
  overflow: clip;
}
.site-header-anchor .brand-wordmark { margin-bottom: 0; }
/* Center the visible text stack, compensating for the unused SVG shadow space. */
.site-header-anchor :is(.brand-wordmark, .brand-copy > p) {
  translate: 0 calc(13.5px + var(--wordmark-empty-bottom, 12px) / 2);
}
@media (min-width: 581px) {
  .site-header-anchor .site-header { --header-wordmark-height: 78px; }
  .site-header-anchor .brand-wordmark {
    grid-column: 2;
    grid-row: 1 / 3;
    align-self: center;
  }
  .site-header-anchor .brand-copy > p {
    grid-row: 1 / 3;
    align-self: center;
    margin-bottom: calc(var(--header-wordmark-height) + 30px);
  }
}
@media (min-width: 581px) and (max-width: 1100px) {
  .site-header-anchor .site-header { --header-wordmark-height: 39px; }
}
.site-header-anchor .site-nav {
  position: relative;
  grid-column: 3;
  grid-row: 1 / 3;
  z-index: 1;
  justify-self: end;
  justify-content: flex-end;
  align-self: center;
  margin: 0;
  gap: 0;
  align-items: center;
  font-size: 16px;
  padding-top: 0;
  border: 0;
  border-radius: var(--site-panel-radius);
  background: color-mix(in srgb, var(--ink) 7%, var(--paper));
}
.site-header-anchor .site-nav a {
  --button-accent: var(--accent);
  position: relative;
  z-index: 1;
  min-height: 44px;
  line-height: 16px;
  padding: 8px 12px;
  border-radius: var(--site-panel-radius);
  border: 0;
  margin-bottom: 0;
  background: transparent;
  color: var(--muted);
}
.site-header-anchor .site-nav a + a {
  margin-left: 0;
}
.site-header-anchor .site-nav a:hover {
  --button-accent: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.site-header-anchor .site-nav a[aria-current] {
  --button-accent: var(--accent);
  z-index: 2;
  color: var(--accent);
  background: transparent;
  box-shadow: none;
}
.site-header-anchor .site-nav a + a[aria-current] {
  box-shadow: none;
}
.site-header-anchor .site-nav a:active {
  --button-accent: var(--accent);
  color: var(--accent);
  background: transparent;
}
.site-header-anchor .site-nav a:focus-visible { z-index: 3; outline-color: var(--accent); }
@media (min-width: 801px) {
  .site-header-anchor .site-nav {
    align-self: end;
    margin-bottom: 0;
    translate: none;
  }
}
/* Keep clearance between the native-size wordmark and tabs. */
@media (min-width: 1360px) {
  .site-header-anchor .brand-wordmark img { width: 696px; height: 105px; }
  .site-header-anchor .site-header {
    --header-wordmark-height: 105px;
    --wordmark-empty-bottom: 18px;
    /* Leave room for the native BoldPixels mark, including its shadow. */
    grid-template-rows: 135px 36px;
  }
}
@media (min-width: 961px) and (max-width: 1100px) {
  .site-header-anchor .brand-wordmark img { width: 261px; height: 39px; }
}
.skip-link { z-index: 31; }
/* Keep hover effects confined to the visible wordmark. */
.brand-wordmark picture { width: max-content; max-width: 100%; }
/* Smaller wordmarks use the full header width without the decorative head. */
@media (max-width: 1100px) {
  .site-header-anchor .site-header {
    --header-content-gap: 10px;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 39px 44px;
    gap: 6px 8px;
    padding: 12px 0 0;
  }
  .site-header-anchor .brand { display: none; }
  .site-header-anchor .brand-wordmark {
    grid-column: 1 / -1;
    grid-row: 1;
    align-self: center;
    margin: 0;
    translate: none;
  }
  .site-header-anchor .brand-copy > p {
    grid-column: 1;
    grid-row: 2;
    align-self: center;
    justify-self: start;
    margin: 0;
    translate: none;
  }
  .site-header-anchor .site-nav {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
    align-self: center;
    margin: 0;
  }
}

/* The header and year dial share one sticky anchor and move as a single block. */
.site-header-anchor > .year-filter {
  width: 100%;
  position: relative;
  pointer-events: auto;
  z-index: 20;
  margin: 14px auto 0;
  padding: 0;
  isolation: isolate;
}
html[data-view]:not([data-view='blog']) .site-header-anchor > .year-filter { display: none; }
.site-header-anchor > .year-filter::before {
  content: '';
  position: absolute;
  inset: -12px 0 -6px;
  z-index: -1;
  pointer-events: none;
  background: var(--paper);
  /* Paint to both viewport edges without widening the sticky dial or the page. */
  box-shadow: 0 0 0 100vmax var(--paper);
  clip-path: inset(0 -100vmax);
}
.site-header-anchor > .year-filter .year-window { mask-repeat: repeat-x; }
.site-header-anchor > .year-filter .year-track {
  display: grid;
  gap: 0;
}
.site-header-anchor > .year-filter .year-stop { min-width: 0; min-height: 32px; padding-inline: 0; }
.site-header-anchor > .year-filter .year-stop-label { border-inline-width: 0; }
/* Keep the first artwork clear of the archive and the header's opaque shadow. */
html[data-view='blog'] #posts { padding-top: 24px; }
html[data-view='blog'] #posts .post-year:first-child { margin-top: 0; }
@media (min-width: 801px) {
  html[data-view='blog'] .site-header-anchor .site-header {
    padding-block: 8px;
  }
  html[data-view='blog'] .site-header-anchor > .year-filter { margin-top: 10px; }
  html[data-view='blog'] .site-header-anchor > .year-filter::before { top: -8px; }
}
/* Preserve the native-size logo while fitting the first row on shorter laptops. */
@media (min-width: 801px) and (max-height: 800px) {
  :root { --site-content-width: 1040px; }
  html[data-view='blog'] #posts { max-width: 1040px; gap: 16px 20px; }
}

/* BoldPixels includes its hard shadow on the same dot grid as the face. */
.site-header .brand-wordmark picture { filter: none; }

/* No soft or chromatic halos on the identity, including LCD interaction states. */
.site-header :is(.brand, .brand-logo, .brand-logo-art, .brand-wordmark, .brand-wordmark picture, .brand-wordmark img),
.site-header :is(.brand-logo, .brand-logo-art, .brand-wordmark, .brand-wordmark picture)::before,
.site-header :is(.brand-logo, .brand-logo-art, .brand-wordmark, .brand-wordmark picture)::after {
  filter: none !important;
  box-shadow: none;
  text-shadow: none;
}
