:root {
  color-scheme: dark;

  --color-page: #0e0d0b;
  --color-text: #d8d3c5;
  --color-dim: #8a8473;
  --color-line: #3a372f;
  --color-accent: #e8d52a;

  /*early-2010s button look: a light edge on top and left, a dark edge on bottom and right, a gradient face*/
  --bevel-light: #5e5a4b;
  --bevel-dark: #050504;
  --face-top: #2d2b24;
  --face-bottom: #16150f;

  /*system monospace fonts, so nothing is downloaded*/
  --font-mono: ui-monospace, "Cascadia Mono", "Cascadia Code", Consolas, Menlo, "Liberation Mono", monospace;
  --font-size: 0.875rem;
  /*a second, plain sans font for buttons and title bars; mixing it with the monospace is part of the untidy look*/
  --font-ui: Verdana, Tahoma, "Trebuchet MS", sans-serif;

  --page-width: 64rem;
  --text-width: 50rem;
  --zoom-picture: 1.12;
  --zoom-icon: 1.3;
  --lift-picture: 0.6rem;
  --lift-icon: 0.45rem;
  --lift-line-icon: 0.4em;
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #050505 url("/static/img/background.png") center / cover fixed no-repeat;
  image-rendering: pixelated;
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: var(--font-size);
  line-height: 1.6;
}

::selection {
  background: var(--color-accent);
  color: var(--color-page);
}

a {
  color: var(--color-accent);
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--color-text);
}

code {
  color: var(--color-accent);
}

/*the middle of the site is a card that sits on the stone background*/
/*old-style chunky scrollbar*/
html {
  scrollbar-color: #5e5a4b #0a0a09;
}

::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}

::-webkit-scrollbar-track {
  background: #0a0a09;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, var(--face-top), var(--face-bottom));
  border: 2px solid;
  border-color: var(--bevel-light) var(--bevel-dark) var(--bevel-dark) var(--bevel-light);
}

.page {
  max-width: var(--page-width);
  /*the card starts a little below the top and runs to the bottom of the window, however short the page*/
  min-height: calc(100vh - var(--space-lg));
  margin: var(--space-lg) auto 0;
  padding: var(--space-lg) var(--space-md) var(--space-xl);
  background: var(--color-page);
  border: 1px solid #4a463a;
  outline: 1px solid #000;
  box-shadow: 0 0 0 4px #1b1a16, 0 1.5rem 3rem rgba(0, 0, 0, 0.7);
}

@media (max-width: 40rem) {
  .page {
    min-height: calc(100vh - var(--space-sm));
    margin: var(--space-sm) var(--space-sm) 0;
  }
}

/*the name in ascii; it shrinks with the screen so it never wraps or scrolls*/
/*the box is as wide as the art and sits in the middle; centring the text itself would shift each line separately and break the drawing*/
.wordmark {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto var(--space-md);
  color: var(--color-accent);
  font: inherit;
  font-size: min(1.1rem, calc((100vw - 2rem) / 36));
  padding: 0.8em 1.6em 0.5em;
  line-height: 1.15;
  user-select: none;
  /*the name sits in a little screen: sunk into the page, with scanlines*/
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.35) 0 1px, transparent 1px 3px), radial-gradient(ellipse at center, #1d1b12, #080806);
  border: 2px solid;
  border-color: var(--bevel-dark) var(--bevel-light) var(--bevel-light) var(--bevel-dark);
}

/*each letter is its own box, so one can jump out of the name: it grows, glows and drops back, always in the same plain yellow*/
.logo-char {
  display: inline-block;
}

.logo-char.pop {
  position: relative;
  z-index: 1;
  animation: pop 0.8s ease-out;
}

@keyframes pop {
  0% {
    transform: translateY(0) scale(1);
    text-shadow: none;
  }
  35% {
    transform: translateY(-0.45em) scale(1.8);
    text-shadow: 0 0 0.5em var(--color-accent);
  }
  100% {
    transform: translateY(0) scale(1);
    text-shadow: none;
  }
}

/*small line icons that sit before a label*/
.icon {
  inline-size: 1em;
  block-size: 1em;
  margin-inline-end: 0.35em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.125em;
}

/*the line icon in a menu word or tab name rises a little when its link is pointed at*/
.nav-link .icon {
  transition: transform 0.25s ease;
}

.nav-link:hover .icon,
.nav-link:focus-visible .icon {
  transform: translateY(calc(var(--lift-line-icon) * -1));
}

/*navigation is a row of raised buttons; the page you are on looks pressed in*/
.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-sm);
  padding-block: var(--space-sm);
}

.nav-link {
  padding: 0.2em 0.9em;
  background: linear-gradient(var(--face-top), var(--face-bottom));
  border: 2px solid;
  border-color: var(--bevel-light) var(--bevel-dark) var(--bevel-dark) var(--bevel-light);
  color: var(--color-text);
  text-decoration: none;
}

.nav-link:hover {
  background: linear-gradient(#3b3829, #1d1b13);
  color: var(--color-accent);
}

.nav-link:active,
.nav-link.active {
  background: linear-gradient(#0d0c09, #1b1a13);
  border-color: var(--bevel-dark) var(--bevel-light) var(--bevel-light) var(--bevel-dark);
  color: var(--color-accent);
  font-weight: 700;
}

/*where you are, written as a path, with a cursor that blinks after it*/
.crumbs {
  margin: var(--space-xs) 0 0;
  color: var(--color-dim);
  font-size: 0.875rem;
}

.cursor {
  display: inline-block;
  inline-size: 0.55em;
  block-size: 1em;
  margin-inline-start: 0.2em;
  background: currentColor;
  vertical-align: -0.15em;
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.tab-count {
  margin-inline-start: 0.35em;
  color: var(--color-dim);
  font-size: 0.85em;
}

.request-error {
  margin: var(--space-md) 0 0;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-accent);
}

main {
  display: block;
  min-height: 50vh;
}

.lead {
  margin-block: var(--space-lg);
}

.dim {
  color: var(--color-dim);
}

/*the date sits above the heading, so the heading follows it closely*/
.date-line {
  margin: var(--space-lg) 0 0;
}

.date-line + .heading {
  margin-block-start: var(--space-xs);
}

/*headings are title bars, like the header of a little window*/
.heading {
  margin: var(--space-lg) 0 var(--space-sm);
  padding: 0.15em 0.6em;
  background: linear-gradient(90deg, #3a3520, #1a1810 70%);
  border: 1px solid var(--bevel-light);
  border-bottom-color: var(--bevel-dark);
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.heading::before {
  content: "■  ";
  color: var(--color-accent);
  font-weight: 400;
}

/*lists read like a directory listing: date, title, and a note on the right*/
.listing {
  margin: 0;
  padding: 0;
  list-style: none;
}

.listing li {
  padding: 0.15em 0.5em;
  border-bottom: 1px dotted var(--color-line);
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr) auto;
  gap: 0 var(--space-md);
}

.listing li:hover {
  background: #1d1b12;
}

/*a tag on the newest post*/
.new-tag {
  margin-inline-start: 0.6em;
  padding: 0 0.35em;
  background: var(--color-accent);
  color: var(--color-page);
  font-size: 0.75em;
  font-weight: 700;
}

/*the little 88x31 buttons every personal site used to collect; they sit in the bottom left of the footer*/
.buttons88 {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin: 0;
  padding: 0;
  list-style: none;
}

.badge88 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  inline-size: 88px;
  block-size: 31px;
  border: 1px solid #000;
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.35), inset -1px -1px 0 rgba(0, 0, 0, 0.5);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  user-select: none;
}

.badge88 b {
  font-size: 13px;
}

.badge-yellow {
  background: linear-gradient(#f4e44a, #b79c10);
  color: #15130a;
}

.badge-dark {
  background: linear-gradient(#3a372c, #12110c);
  color: var(--color-accent);
}

.badge-grey {
  background: linear-gradient(#cfcab8, #8c8777);
  color: #1b1a14;
}

.badge-red {
  background: linear-gradient(#b83a2a, #5c150c);
  color: #ffe9b0;
}

.badge-olive {
  background: linear-gradient(#7d8a3a, #3b4216);
  color: #f2f0c8;
}

.listing-date {
  color: var(--color-dim);
}

.listing-note {
  color: var(--color-dim);
  text-align: end;
}

/*the project's own tabs sit under its title and look like the main menu*/
.tabs {
  margin-block: var(--space-sm) var(--space-md);
}

/*gallery: a grid of framed pictures cropped to the same shape, each linking to the full picture*/
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: var(--space-md);
  margin: 0;
  padding: 0;
  list-style: none;
}

.gallery a {
  text-decoration: none;
}

.gallery-caption {
  display: block;
  margin-block-start: var(--space-xs);
  color: var(--color-text);
  transition: color 0.15s;
  font-size: 0.875rem;
}

/*portfolio: a grid of project cards; each card is one link to the project page*/
.projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: var(--space-lg) var(--space-md);
  margin: 0;
  padding: 0;
  list-style: none;
}

.project-link {
  display: block;
  color: var(--color-text);
  text-decoration: none;
}

.project-title {
  display: block;
  font-weight: 700;
}

.project-note,
.project-date {
  display: block;
  color: var(--color-dim);
  font-size: 0.875rem;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-md);
  margin-block-start: var(--space-xs);
  color: var(--color-dim);
  font-size: 0.875rem;
}

.project-meta .project-date {
  display: inline;
}

.gallery a:hover .gallery-caption,
.gallery a:focus-visible .gallery-caption,
.project-link:hover .project-title,
.project-link:focus-visible .project-title {
  color: var(--color-accent);
}

/*a thumbnail is a framed box that clips its picture, so the picture can grow on hover without leaving the frame*/
.thumb {
  display: block;
  padding: var(--space-xs);
  border: 1px solid var(--color-line);
  transition: border-color 0.15s, transform 0.3s ease;
}

.project-link .thumb {
  margin-block-end: var(--space-xs);
}

.thumb-frame {
  display: block;
  overflow: hidden;
  aspect-ratio: 4 / 3;
}

.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

a:hover .thumb,
a:focus-visible .thumb {
  border-color: var(--color-accent);
}

/*on screens with a pointer the pictures are grey and dim, and come into colour and grow when the pointer or keyboard focus is on them*/
@media (hover: hover) {
  .thumb img {
    filter: grayscale(1) brightness(0.7);
    transition: filter 0.15s, transform 0.3s ease;
  }

  a:hover .thumb img,
  a:focus-visible .thumb img {
    filter: none;
    transform: scale(var(--zoom-picture));
  }

  /*the whole framed box also lifts a little, so the picture seems to rise off the page*/
  a:hover .thumb,
  a:focus-visible .thumb {
    transform: translateY(calc(var(--lift-picture) * -1));
  }
}

/*a photo with a caption; the dashed box is the empty spot, a real image takes its place*/
.photo {
  max-width: 24rem;
  margin: 0 0 var(--space-lg);
}

.photo-spot {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  border: 1px dashed var(--color-dim);
  color: var(--color-dim);
}

.photo img {
  display: block;
  width: 100%;
  height: auto;
  padding: var(--space-xs);
  border: 1px solid var(--color-line);
}

.photo figcaption {
  margin-block-start: var(--space-xs);
  color: var(--color-dim);
  font-size: 0.875rem;
}

.colophon {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm) var(--space-md);
  margin-block-start: var(--space-xl);
  padding-block-start: var(--space-sm);
  border-block-start: 1px dashed var(--color-line);
  color: var(--color-dim);
}

.colophon-text {
  margin: 0;
}

.colophon-text::before {
  content: "-- ";
}

/*social icons on the right of the footer; an icon only exists when its address is set in data/links.json*/
.icon-links {
  display: flex;
  gap: var(--space-sm);
  margin: 0;
  padding: 0;
  list-style: none;
}

.icon-link {
  display: grid;
  place-items: center;
  padding: var(--space-xs);
  background: linear-gradient(var(--face-top), var(--face-bottom));
  border: 2px solid;
  border-color: var(--bevel-light) var(--bevel-dark) var(--bevel-dark) var(--bevel-light);
  color: var(--color-dim);
  transition: transform 0.25s ease;
}

.icon-link svg {
  display: block;
  inline-size: 1.125rem;
  block-size: 1.125rem;
  fill: currentColor;
  transition: transform 0.3s ease;
}

.icon-link:hover svg,
.icon-link:focus-visible svg {
  transform: scale(var(--zoom-icon));
}

.icon-link:hover,
.icon-link:focus-visible {
  color: var(--color-accent);
  transform: translateY(calc(var(--lift-icon) * -1));
}

/*a picture opened in place: it covers the page, and a click or Esc closes it*/
[x-cloak] {
  display: none !important;
}

.viewer {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: rgba(0, 0, 0, 0.92);
  cursor: zoom-out;
}

.viewer img {
  max-inline-size: 100%;
  max-block-size: calc(100vh - 4rem);
  border: 2px solid;
  border-color: var(--bevel-light) var(--bevel-dark) var(--bevel-dark) var(--bevel-light);
}

.viewer-hint {
  margin: 0;
  color: var(--color-dim);
  font-size: 0.875rem;
}

/*a link that leaves the site gets an arrow after it*/
.prose a[href^="https://"]::after {
  content: " ↗";
  font-size: 0.85em;
}

/*the page is wide for grids, but lines of text stay a readable length*/
.prose {
  max-width: var(--text-width);
}

/*blog posts and pages*/
.prose h1,
.prose h2,
.prose h3 {
  margin-block: var(--space-lg) var(--space-sm);
  font-size: 1rem;
}

.prose h2::before {
  content: "## ";
  color: var(--color-dim);
  font-weight: 400;
}

.prose h3::before {
  content: "### ";
  color: var(--color-dim);
  font-weight: 400;
}

.prose img {
  max-width: 100%;
  padding: var(--space-xs);
  border: 1px solid var(--color-line);
}

.prose pre {
  padding: var(--space-sm) var(--space-md);
  overflow-x: auto;
  border: 1px dashed var(--color-line);
}

.prose pre code {
  color: inherit;
}

.prose blockquote {
  margin-inline: 0;
  padding-inline-start: var(--space-md);
  border-inline-start: 1px solid var(--color-dim);
  color: var(--color-dim);
}

.prose table {
  margin-block: var(--space-md);
  border-collapse: collapse;
}

.prose th,
.prose td {
  padding: var(--space-xs) var(--space-md);
  border: 1px solid var(--color-line);
  text-align: start;
}

@media (max-width: 34rem) {
  .nav {
    gap: 0 var(--space-md);
  }

  .listing li {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .listing-note {
    grid-column: 2;
    text-align: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .thumb,
  .thumb img,
  .icon-link,
  .icon-link svg,
  .nav-link .icon {
    transition: none;
  }

  a:hover .thumb,
  a:focus-visible .thumb,
  a:hover .thumb img,
  a:focus-visible .thumb img,
  .icon-link:hover,
  .icon-link:focus-visible,
  .icon-link:hover svg,
  .icon-link:focus-visible svg,
  .nav-link:hover .icon,
  .nav-link:focus-visible .icon {
    transform: none;
  }

  .cursor {
    animation: none;
  }

  .logo-char.pop {
    animation: none;
  }
}

/*---- untidy early-2010s layer: gloss, mixed fonts, things slightly off-square ----*/

/*links the old way: underlined, and a visited one goes a duller yellow*/
a {
  text-decoration: underline;
}

.prose a:visited,
.listing a:visited {
  color: #b0a02a;
}

/*the card gets a double border, like a table with a frame*/
.page {
  border: 4px double #6b664f;
  outline: none;
}

/*buttons and title bars get the glossy look: a lighter top half with a hard edge, and a shadow under the text*/
.nav-link,
.heading,
.badge88 {
  font-family: var(--font-ui);
  text-shadow: 1px 1px 0 #000;
}

.nav-link {
  background: linear-gradient(#55503f 0 48%, #26241b 52% 100%);
  font-size: 0.8125rem;
  font-weight: 700;
}

.nav-link:hover {
  background: linear-gradient(#6a6450 0 48%, #302d21 52% 100%);
}

.nav-link:active,
.nav-link.active {
  background: linear-gradient(#0a0907 0 48%, #181711 52% 100%);
}

.heading {
  background: linear-gradient(90deg, #5a5326 0 0) 0 0 / 100% 48% no-repeat, linear-gradient(90deg, #2a2616, #15130b 80%);
  font-size: 0.8125rem;
}

.badge88 {
  text-shadow: none;
  font-family: var(--font-ui);
}

/*the intro is a note on its own, boxed with a dashed edge*/
.lead {
  padding: var(--space-sm) var(--space-md);
  background: #14130d;
  border: 1px dashed #6b664f;
}

/*when it was last built, in the corner of the path line, like a little lcd stamp*/
.crumbs {
  display: flex;
  align-items: center;
}

.updated {
  margin-inline-start: auto;
  padding: 0 0.5em;
  background: #080806;
  border: 1px solid var(--bevel-light);
  border-color: var(--bevel-dark) var(--bevel-light) var(--bevel-light) var(--bevel-dark);
  color: #9bd36a;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

/*---- shadows: everything sits on top of the page and casts a soft drop shadow; things that lift get a longer one ----*/
:root {
  --card-face: #23221b;
  --shadow-hard: 0 3px 8px rgba(0, 0, 0, 0.7);
  --shadow-soft: 0 6px 16px rgba(0, 0, 0, 0.7);
  --shadow-lift: 0 12px 22px rgba(0, 0, 0, 0.75);
}

.page {
  /*a lighter card face than before, so the black shadows on it can be seen*/
  background: var(--card-face);
  box-shadow: 0 0 0 4px #1b1a16, 0 0 0 5px #000, 0 1.2rem 3rem rgba(0, 0, 0, 0.8);
}

.nav-link,
.icon-link,
.badge88,
.ticker,
.updated {
  box-shadow: var(--shadow-hard);
}

.nav-link:active,
.nav-link.active {
  box-shadow: none;
}

.wordmark {
  box-shadow: var(--shadow-soft);
}

.heading {
  box-shadow: var(--shadow-hard);
}

.lead {
  box-shadow: var(--shadow-hard);
}

.thumb {
  box-shadow: var(--shadow-hard);
  transition: border-color 0.15s, transform 0.3s ease, box-shadow 0.3s ease;
}

a:hover .thumb,
a:focus-visible .thumb {
  box-shadow: var(--shadow-lift);
}

.icon-link:hover,
.icon-link:focus-visible {
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.75);
}

.viewer img {
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.85);
}

.listing li:hover {
  box-shadow: inset 0 0 0 1px #3a362a;
}

/*text gets a shadow as well: a hard black one on titles, a soft yellow glow on the yellow words*/
.project-title,
.heading,
.nav-link,
.prose h2,
.prose h3 {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

a {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.nav-link.active,
.new-tag,
.heading::before {
  text-shadow: 0 0 6px rgba(232, 213, 42, 0.6), 0 1px 3px rgba(0, 0, 0, 0.9);
}



.badge88 {
  text-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  .thumb {
    transition: none;
  }
}
