/* Renogare: single weight, never bold. Non-commercial use only. */
@font-face {
  font-family: "Renogare";
  src: local("Renogare"), local("Renogare-Regular"), url("fonts/Renogare-Regular.otf") format("opentype");
  font-display: swap;
}

/* Quiet snowfall at night. Sections sit side by side and slide horizontally;
   content is shown directly, in solid boxes. */
:root {
  --page: #06080f;
  --ink: #eaf0f7;
  --body-ink: #c6d0dc;
  --muted: #8090a6;
  --box: rgba(255, 255, 255, 0.045);
  --box-hover: rgba(255, 255, 255, 0.075);
  --accent: #a9d8ff;
  --radius: 14px;
  --capw: clamp(160px, 14.5vw, 230px); /* a project card's width; it's 2:3 */
  --fit: 1;
  --body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Renogare", "DM Sans", system-ui, sans-serif;
  --ease: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-out: cubic-bezier(0.16, 0.84, 0.24, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: radial-gradient(120% 90% at 50% 0%, #0f1a2c 0%, #0a1120 45%, var(--page) 100%) fixed;
  /* a solid colour too: phones paint behind the status bar and the bottom toolbar with the
     page's background colour (never the gradient), and fall back to white without one */
  background-color: var(--page);
  color-scheme: dark;
}

body {
  color: var(--ink);
  font: 16px/1.65 var(--body);
  -webkit-font-smoothing: antialiased;
  touch-action: none;
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 400;
  font-synthesis: none;
  margin: 0;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

#snowFar,
#snowNear {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
}

#snowFar {
  z-index: 0;
}

#snowNear {
  z-index: 4;
}

/* ---------- menu ---------- */
#menu {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: clamp(14px, 2.6vh, 24px) clamp(18px, 4vw, 56px);
}

.nav {
  display: flex;
  gap: clamp(12px, 2.4vw, 32px);
}

.nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--muted);
  font: 12px var(--display);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  padding: 6px 0;
  transition: color 0.3s ease;
}

.nav a:hover,
.nav a.here {
  color: var(--ink);
}

/* ---------- the phone menu: Menu top right opens every section in large type ---------- */
#btnMenu {
  display: none;
  border: 0;
  background: none;
  padding: 6px 0;
  cursor: pointer;
  color: var(--muted);
  font: 12px var(--display);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  transition: color 0.3s ease;
}

#btnMenu:hover,
#btnMenu[aria-expanded="true"] {
  color: var(--ink);
}

#menuSheet {
  position: fixed;
  inset: 0;
  z-index: 9; /* under the bar, so Close stays where Menu was */
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 70px 28px 40px;
  background: rgba(6, 8, 15, 0.97);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

body.menu-open #menuSheet {
  opacity: 1;
  pointer-events: auto;
}

#menuSheet .go {
  display: flex;
  align-items: center;
  gap: 14px;
  width: max-content;
  padding: 6px 0;
  text-decoration: none;
  color: var(--muted);
  font: 32px/1.15 var(--display);
  opacity: 0;
  transform: translateX(26px);
  transition:
    opacity 0.5s var(--ease-out),
    transform 0.6s var(--ease-out),
    color 0.3s ease;
}

#menuSheet .go::before {
  content: "";
  width: 10px;
  height: 10px;
  background: currentColor;
  opacity: 0;
}

#menuSheet .go.here {
  color: var(--ink);
}

#menuSheet .go.here::before {
  opacity: 1;
}

body.menu-open #menuSheet .go {
  opacity: 1;
  transform: none;
  transition-delay: calc(var(--i) * 0.04s), calc(var(--i) * 0.04s), 0s; /* one after another */
}

#menuSheet .soc {
  display: flex;
  gap: 10px;
  margin-top: 26px;
}

#menuSheet .soc a {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--brand);
}

#menuSheet .soc svg {
  width: 19px;
  height: 19px;
  fill: #fff;
}

@media (min-width: 761px) {
  #menuSheet {
    display: none;
  }
}

/* ---------- the track: sections side by side ---------- */
#track {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  will-change: transform;
}

.panel {
  flex: none;
  width: 100vw;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(64px, 11vh, 100px) clamp(20px, 6vw, 96px) clamp(56px, 10vh, 92px);
}

.inner {
  width: 100%;
  max-width: 860px;
  max-height: 100%;
  font-size: calc(16px * var(--fit));
}

/* pieces of a section arrive one after another as it slides in */
[data-a] {
  opacity: 0;
  transform: translateX(46px);
  transition:
    opacity 0.9s var(--ease-out) var(--d, 0s),
    transform 1.1s var(--ease-out) var(--d, 0s);
}

.panel.active [data-a] {
  opacity: 1;
  transform: none;
}

/* on touch screens the pieces arrive sooner, to keep up with the quicker swipe slides */
@media (pointer: coarse) {
  [data-a] {
    transition:
      opacity 0.6s var(--ease-out) calc(var(--d, 0s) * 0.6),
      transform 0.7s var(--ease-out) calc(var(--d, 0s) * 0.6);
  }
}

/* section titles: the large display style (short words, never sentences) */
.label {
  font: calc(clamp(26px, 5.4vh, 50px) * var(--fit)) / 1.14 var(--display);
  font-weight: 400;
  font-synthesis: none;
  color: var(--ink);
  margin: 0 0 calc(3.2vh * var(--fit));
}

/* content sits straight on the page: no fill or rounded box behind it */
.box {
  background: none;
}

/* ---------- home ---------- */
.home {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#logo {
  display: block;
  image-rendering: pixelated;
}

#name {
  white-space: nowrap;
  line-height: 1;
  letter-spacing: 0;
  position: relative;
  color: #d3dce8; /* the same resting white as the logo's dots */
}

/* the letters are painted by the logo's finish on #nameArt (drawName in js/logo.js), so the name
   always matches the logo, gleam included; the h1's own text stays for readers and selection */
#name {
  color: transparent;
}

#nameArt {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
}

/* the cue (home only): a matte mouse peeking up from the bottom edge, lit from above,
   its sides falling into shadow and its body dissolving into the dark. The light runs
   down a recessed slot. Leaving home, it sinks and the section segments appear. */
/* size and position are set in whole device pixels from JS (placeCue), so the slot
   and its light sit exactly on the centre line at any screen scaling */
.cue {
  position: fixed;
  z-index: 3;
  left: 50%;
  bottom: 0;
  width: 58px;
  height: 68px;
  pointer-events: none;
  will-change: transform, opacity;
}

.cue-in {
  position: absolute;
  inset: 0;
  transform: translateY(90px);
  animation: peek 1.3s cubic-bezier(0.16, 0.84, 0.24, 1) 0.6s forwards;
}

.cue > .cue-in > svg {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: auto; /* taller than the cue: only the front of the mouse shows */
  overflow: visible;
}

/* the mouse rests dim while the keys have their beat */
.cue > .cue-in > svg,
.cue .slot {
  animation: beatMouse 4.8s ease infinite;
}

.cue .slot {
  position: absolute;
  background: rgba(3, 5, 11, 0.6);
  box-shadow: 0 1px 0 rgba(234, 240, 247, 0.12);
}

/* the light in the slot (drawn in the SVG, so it shares the mouse's centre) */
/* the light fades in at the top of the slot and out at the bottom (rather than being
   clipped), so its soft glow can spill just past the slot */
.cue .light {
  position: absolute;
  top: 0;
  background: #f4f8fc;
  box-shadow:
    0 0 4px rgba(244, 248, 252, 0.85),
    0 0 11px rgba(169, 216, 255, 0.55);
  will-change: transform, opacity;
  animation: cue 4.8s cubic-bezier(0.6, 0, 0.4, 1) infinite;
}

/* ← and → beside the mouse, in the mouse's own material: a lit top face and a short
   dark skirt for height. Each press sinks the key and brightens its arrow, left then right,
   in time with the mouse's light. Only where there is a keyboard and a mouse. */
/* Everything here animates only transform and opacity, so it runs on the compositor
   and stays smooth while the main thread draws snow. The skirt (::before) stays put;
   the face sinks 3px over it, leaving 1px of skirt showing, as a pressed key does.
   The bright arrow is a second copy faded in over the dim one. */
.cue .key {
  display: none;
  position: absolute;
  bottom: 16px;
  width: 40px;
  height: 38px;
  animation: beatKeys 4.8s ease infinite;
}

.cue .key::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 9px;
  background: #0a0f1a;
  transform: translateY(4px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}

.cue .key-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: radial-gradient(120% 110% at 50% 0%, #303a50 0%, #1b2334 60%, #121929 100%);
  box-shadow: inset 0 1px 0 rgba(234, 240, 247, 0.08);
  will-change: transform;
  animation: keyL 4.8s ease infinite;
}

.cue .key svg {
  grid-area: 1 / 1;
  width: 16px;
  height: 16px;
  color: #9aa8bb;
}

.cue .key svg.lit {
  color: #eaf0f7;
  opacity: 0;
  will-change: opacity;
  animation: litL 4.8s ease infinite;
}

.cue .key-l {
  right: calc(100% + 22px);
}

.cue .key-r {
  left: calc(100% + 22px);
}

.cue .key-r .key-face {
  animation-name: keyR;
}

.cue .key-r svg.lit {
  animation-name: litR;
}

@media (hover: hover) and (pointer: fine) {
  .cue .key {
    display: block;
  }
}

/* touch screens: the fingertip replaces the mouse. Its streak stretches from where the
   finger pressed to under its tip, on the same curve over the same span, so the light never
   runs ahead; it fades before the finger does, so it is never left on its own. */
.cue .finger,
.cue .streak {
  display: none;
  position: absolute;
}

.cue .finger {
  left: calc(50% - 20px);
  top: 2px;
  width: 40px;
  height: 130px; /* taller than the cue: only the tip shows */
  opacity: 0;
  will-change: transform, opacity;
  animation: finger 3.6s linear infinite;
}

.cue .finger svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.cue .streak {
  left: calc(50% - 40px);
  top: 16px;
  width: 80px;
  height: 2px;
  border-radius: 1px;
  background: linear-gradient(270deg, #f4f8fc, rgba(169, 216, 255, 0.45) 55%, rgba(169, 216, 255, 0));
  box-shadow: 0 0 6px rgba(169, 216, 255, 0.5);
  transform-origin: 0% 50%;
  opacity: 0;
  will-change: transform, opacity;
  animation: streak 3.6s linear infinite;
}

@media (hover: none), (pointer: coarse) {
  .cue > .cue-in > svg,
  .cue .slot {
    display: none;
  }
  .cue .finger,
  .cue .streak {
    display: block;
  }
}

@keyframes finger {
  0% { transform: translate(-40px, 0); opacity: 0; animation-timing-function: ease-out; }
  12% { transform: translate(-40px, 0); opacity: 1; animation-timing-function: ease-out; }
  18% { transform: translate(-40px, 3px); opacity: 1; animation-timing-function: cubic-bezier(0.45, 0, 0.25, 1); }
  44% { transform: translate(40px, 3px); opacity: 1; animation-timing-function: ease-out; }
  50% { transform: translate(40px, 0); opacity: 1; animation-timing-function: ease-in; }
  68%, 100% { transform: translate(40px, 0); opacity: 0; }
}

@keyframes streak {
  0%, 17.9% { transform: scaleX(0); opacity: 0; }
  18% { transform: scaleX(0); opacity: 1; animation-timing-function: cubic-bezier(0.45, 0, 0.25, 1); }
  44% { transform: scaleX(1); opacity: 1; animation-timing-function: ease-in; }
  54%, 100% { transform: scaleX(1); opacity: 0; }
}

@keyframes keyL {
  0%, 58%, 70%, 100% { transform: translateY(0); }
  62%, 66% { transform: translateY(3px); }
}

@keyframes litL {
  0%, 58%, 70%, 100% { opacity: 0; }
  62%, 66% { opacity: 1; }
}

@keyframes keyR {
  0%, 74%, 86%, 100% { transform: translateY(0); }
  78%, 82% { transform: translateY(3px); }
}

@keyframes litR {
  0%, 74%, 86%, 100% { opacity: 0; }
  78%, 82% { opacity: 1; }
}

/* the two beats: dimmed while the other one has the stage */
@keyframes beatMouse {
  0%,
  44%,
  100% {
    opacity: 1;
  }
  52%,
  94% {
    opacity: 0.32;
  }
}

@keyframes beatKeys {
  0%,
  44%,
  100% {
    opacity: 0.32;
  }
  52%,
  94% {
    opacity: 1;
  }
}

@keyframes cue {
  0% {
    transform: translateY(0);
    opacity: 0;
  }
  7% {
    opacity: 1;
  }
  39% {
    opacity: 1;
  }
  50%,
  100% {
    transform: translateY(var(--travel));
    opacity: 0;
  }
}

@keyframes peek {
  to {
    transform: none;
  }
}

.home .buttons {
  display: none;
  justify-content: center;
  margin-top: 26px;
}

/* ---------- about ---------- */
/* the small flag after the name, sized to the text like an emoji */
.about-lead .flag {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  margin: 0 0.04em 0 0.1em;
  vertical-align: -0.22em;
}

.about-lead {
  max-width: 34em;
  margin: 0 0 calc(2.6vh * var(--fit));
  font-size: calc(clamp(18px, 2.6vh, 22px) * var(--fit));
  line-height: 1.6;
  color: var(--ink);
}

.about-rest {
  max-width: 40em;
  color: var(--body-ink);
}

.about-rest p {
  margin: 0 0 calc(1.8vh * var(--fit));
}

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

.about {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: clamp(16px, 2vw, 24px);
  align-items: stretch;
}

.about .text {
  color: var(--body-ink);
}

.about .text p {
  margin: 0 0 calc(1.8vh * var(--fit));
}

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

.about .side {
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2vw, 24px);
}

.side .text {
  flex: 1;
}

/* ---------- experience: one row per role, the facts only ---------- */
.jobs {
  display: flex;
  flex-direction: column;
  gap: calc(2.6vh * var(--fit));
}

.job {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 32px;
}

.job h3 {
  margin: 0;
  font: calc(20px * var(--fit)) / 1.3 var(--body);
  font-weight: 400;
  color: var(--ink);
}

.job .place {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.95em;
}

.job .period {
  flex: none;
  color: var(--muted);
  font-size: 0.9em;
  font-variant-numeric: tabular-nums;
}

/* the dates in Discord's status colours: still going is idle orange, finished is online green */
.job .period.ongoing {
  color: #f0b232;
}

.job .period.done {
  color: #23a55a;
}

/* ---------- projects: a catalog of cards ---------- */
/* as tall as its row, so the section centres it like every other section */
.projects-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* the selected project, above the row: anchored to the row, growing upward */
.phero {
  position: relative;
  z-index: 2;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: calc(2.6vh * var(--fit));
}

.phero h2 {
  font: clamp(28px, 5.4vh, 44px) / 1.1 var(--display);
  font-weight: 400;
  font-synthesis: none;
  color: var(--ink);
  margin: 0 0 10px;
}

.ph-blurb {
  margin: 0;
  max-width: 600px;
  color: var(--body-ink);
  font-size: 17px;
  line-height: 1.55;
}

.ph-blurb strong {
  font-weight: 500;
  color: var(--ink);
}

.ph-story {
  display: none;
  max-width: 680px;
  color: var(--body-ink);
  font-size: 17px;
  line-height: 1.7;
}

.ph-story p {
  margin: 0;
}

.phero.reading .ph-story {
  display: block;
}

.phero.reading .ph-blurb {
  display: none;
}

.ph-tech {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.ph-act {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 24px;
  margin-top: 14px;
}

/* Read more / Show less: part of the text, so it reads as "this opens here" */
.inl {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(169, 216, 255, 0.35);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.25s ease;
}

.inl:hover,
.inl:focus-visible {
  text-decoration-color: var(--accent);
}

/* the write-up's way back: the same link, led by the blog's back chevron, which nudges
   left on hover like "All posts" does */
.inl.back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  white-space: nowrap;
}

.inl.back span {
  text-decoration: underline;
  text-decoration-color: rgba(169, 216, 255, 0.35);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.25s ease;
}

.inl.back:hover span,
.inl.back:focus-visible span {
  text-decoration-color: var(--accent);
}

.inl.back svg {
  width: 1.05em;
  height: 1.05em;
  flex: none;
  transition: transform 0.35s var(--ease-out);
}

.inl.back:hover svg {
  transform: translateX(-3px);
}

/* while reading, the row steps aside: slides down and fades */
#sec-projects .catalog-wrap {
  transition:
    transform 0.7s var(--ease-out),
    opacity 0.5s ease;
}

/* reading on a short screen (a phone): the section itself scrolls under the finger */
#sec-projects.reading {
  overflow-y: auto;
  scrollbar-width: none;
  touch-action: pan-y;
  overscroll-behavior: contain;
}

#sec-projects.reading::-webkit-scrollbar {
  display: none;
}

#sec-projects.reading .catalog-wrap {
  transform: translateY(140px);
  opacity: 0;
  pointer-events: none;
}

/* the selected project's screenshot fills the screen behind everything, soft and dim
   (two layers so one fades into the next); it shows only around Projects */
#projBg {
  position: fixed;
  inset: 0;
  z-index: 0; /* with the far snow; it comes first, so the snow falls over it */
  opacity: 0;
  pointer-events: none;
}

#projBg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(6, 8, 15, 0.55), rgba(6, 8, 15, 0) 30%, rgba(6, 8, 15, 0) 52%, rgba(6, 8, 15, 0.75));
}

.pbg {
  position: absolute;
  inset: -40px;
  background: center / cover no-repeat;
  filter: blur(16px) brightness(0.32) saturate(1.15);
  opacity: 0;
  transition: opacity 1.2s ease;
}

.pbg.on {
  opacity: 1;
}

.catalog-wrap {
  min-height: 0;
}

/* ---------- a post: a narrower reading column, centred; only the text scrolls ---------- */
.post-inner {
  height: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
}

.reader {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  outline: none;
  touch-action: pan-y;
  overscroll-behavior: contain;
  padding-bottom: clamp(48px, 10vh, 96px);
}

.reader::-webkit-scrollbar {
  display: none;
}

.reader.scrolled {
  -webkit-mask-image: linear-gradient(transparent, #000 40px);
  mask-image: linear-gradient(transparent, #000 40px);
}

/* "All posts" has its own row above the text, so it is always there while you read */
.reader-bar {
  flex: none;
  padding-bottom: 12px;
}

.all-posts {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 2px;
  border: 0;
  background: none;
  color: var(--muted);
  font: 12px var(--display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.3s ease;
}

.all-posts:hover,
.all-posts:focus-visible {
  color: var(--ink);
}

.all-posts svg {
  width: 15px;
  height: 15px;
  transition: transform 0.35s var(--ease-out);
}

.all-posts:hover svg {
  transform: translateX(-4px);
}

/* the cover at its own shape, as wide as the column */
.post-cover {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 4px 0 26px;
}

.post h1 {
  font: clamp(28px, 4.6vh, 40px) / 1.15 var(--display);
  font-weight: 400;
  font-synthesis: none;
  color: var(--ink);
  margin: 0 0 8px;
}

.post-date {
  color: var(--muted);
  font-size: 14.5px;
  margin-bottom: 30px;
}

.md {
  color: var(--body-ink);
  font-size: 17px;
  line-height: 1.75;
}

.md > :first-child {
  margin-top: 0;
}

.md h2,
.md h3,
.md h4 {
  font-family: var(--display);
  font-weight: 400;
  font-synthesis: none;
  color: var(--ink);
  line-height: 1.25;
}

.md h2 {
  font-size: 24px;
  margin: 2em 0 0.6em;
}

.md h3 {
  font-size: 19px;
  margin: 1.8em 0 0.5em;
}

.md h4 {
  font-size: 17px;
  margin: 1.6em 0 0.4em;
}

.md p {
  margin: 0 0 1.1em;
}

.md ul,
.md ol {
  margin: 0 0 1.2em;
  padding-left: 1.3em;
}

.md li {
  margin: 0.35em 0;
}

.md li > p {
  margin: 0;
}

.md strong {
  font-weight: 500;
  color: var(--ink);
}

.md a {
  color: var(--accent);
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

.md code {
  font: 0.86em/1.5 ui-monospace, "Cascadia Code", Consolas, monospace;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 5px;
  padding: 0.12em 0.38em;
}

.md pre {
  margin: 0 0 1.3em;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.045);
  border-radius: 12px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.6;
}

.md pre code {
  background: none;
  padding: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
}

/* quotes and rules: a soft box and plain space, never a line */
.md blockquote {
  margin: 0 0 1.3em;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.045);
  border-radius: 12px;
  color: var(--muted);
}

.md blockquote > :last-child {
  margin-bottom: 0;
}

.md hr {
  border: 0;
  height: 0;
  margin: 2.4em 0;
}

.md img {
  max-width: 100%;
  border-radius: 12px;
}

/* keep reading: the posts either side, set like the other controls (no boxes): a small
   label in the menu's type with an arrow that nudges on hover, the title under it */
.more {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-top: 56px;
}

.more button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.more .next {
  grid-column: 2;
  align-items: flex-end;
  text-align: right;
}

.more .k {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font: 12px var(--display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: color 0.3s ease;
}

.more .k svg {
  width: 15px;
  height: 15px;
  transition: transform 0.35s var(--ease-out);
}

.more .prev:hover .k svg {
  transform: translateX(-4px);
}

.more .next:hover .k svg {
  transform: translateX(4px);
}

.more .t {
  color: var(--body-ink);
  font-size: 16px;
  line-height: 1.45;
  transition: color 0.3s ease;
}

.more button:hover .k,
.more button:focus-visible .k,
.more button:hover .t,
.more button:focus-visible .t {
  color: var(--ink);
}

@media (max-width: 760px) {
  .md {
    font-size: 16px;
  }
  .md h2 {
    font-size: 21px;
  }
  .more {
    grid-template-columns: 1fr;
  }
  .more .next {
    grid-column: 1;
  }
}

/* while searching the blog, everything but the search box and its results steps back */
#menu,
#snowFar,
#snowNear,
#btnSettings,
#sec-blog .label {
  transition:
    opacity 0.45s ease,
    filter 0.45s ease;
}

body.searching #menu,
body.searching #btnSettings,
body.searching #sec-blog .label {
  opacity: 0.3;
}

body.searching #snowFar,
body.searching #snowNear {
  opacity: 0.35;
}

/* ---------- blog: the title, a full-width search, then the posts as plain rows ---------- */
.blog-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.blog-search {
  position: relative;
  display: block;
  flex: none;
  margin-bottom: 14px;
}

.blog-search svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.blog-search input {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 0;
  border-radius: 10px;
  color: var(--ink);
  font: 15.5px/1.45 var(--body);
  padding: 11px 13px 11px 40px;
  transition: background 0.25s ease;
  -webkit-appearance: none;
  appearance: none;
}

.blog-search input::placeholder {
  color: var(--muted);
}

.blog-search input::-webkit-search-cancel-button {
  display: none;
}

.blog-search input:hover,
.blog-search input:focus {
  background: rgba(255, 255, 255, 0.08);
}

.blog-search input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
}

/* only the list scrolls; on a phone the finger scrolls it natively */
.blog-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  touch-action: pan-y;
  overscroll-behavior: contain;
}

.blog-list::-webkit-scrollbar {
  display: none;
}

/* "fading", not "more": .more is the "More posts" grid under a post, and sharing the
   name turned this list into two columns */
.blog-list.fading {
  -webkit-mask-image: linear-gradient(#000 calc(100% - 64px), transparent);
  mask-image: linear-gradient(#000 calc(100% - 64px), transparent);
}

/* rows: no fill, no lines. Title left, date right; spacing does the separating */
.blog-posts {
  display: flex;
  flex-direction: column;
}

.blog-posts a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 32px;
  padding: 12px 0;
  text-decoration: none;
}

.blog-posts .t {
  color: var(--body-ink);
  font-size: 18px;
  line-height: 1.45;
  transition: color 0.25s ease;
}

.blog-posts .d {
  flex: none;
  color: var(--muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  transition: color 0.25s ease;
}

.blog-posts a:hover .t {
  color: var(--ink);
}

.blog-posts a:hover .d {
  color: var(--body-ink);
}

/* while one row is hovered, the others step back */
.blog-posts:hover a:not(:hover) .t {
  color: var(--muted);
}

.blog-none {
  color: var(--muted);
  margin: 8px 0 0;
}

@media (max-width: 760px) {
  .blog-posts a {
    flex-direction: column;
    gap: 2px;
    padding: 10px 0;
  }
  .blog-posts .t {
    font-size: 17px;
  }
  .blog-posts .d {
    font-size: 13px;
  }
}

/* One long row of cards: scrolling in Projects slides the row, never the page. */
#sec-projects {
  overflow: hidden;
  position: relative;
}

/* a stage light behind the row: a soft lighter wash, so dark cards read as silhouettes */
#sec-projects::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: radial-gradient(ellipse 70% 42% at 50% 58%, rgba(130, 160, 210, 0.11), rgba(130, 160, 210, 0.04) 55%, transparent 75%);
  pointer-events: none;
}

#sec-projects > .inner {
  position: relative;
  z-index: 1;
}

/* the row slides as one piece, its heading with it */
.rail {
  width: max-content;
  /* the right padding is set in measureRail: the last card stops as far from the
     screen's right edge as the first one starts from its left */
  padding: 4px 4px 4px 4px;
  will-change: transform;
}

.shelf {
  position: relative;
  display: flex;
  gap: clamp(14px, 1.4vw, 22px);
  padding-bottom: 18px; /* room for the lift and the shadow */
}

/* the glow, the Steam look: none above the card, a little at the sides, most of it pooling
   underneath. The layer sits lower and narrower than the card, behind it, so its top is
   hidden and only the sides and the bottom spill out. Its colour is the card art's own
   average (the art tiled at 1px squeezes it to one colour). One shared layer that moves
   to whichever card is hovered. */
.cap-glow {
  position: absolute;
  z-index: 0;
  top: calc(var(--capw) * 1.5 * 0.34);
  width: calc(var(--capw) * 1.06);
  height: calc(var(--capw) * 1.5 * 0.76);
  /* screened with a soft ice blue, so dark art still glows (cool), bright art keeps its hue */
  background:
    linear-gradient(rgba(140, 175, 230, 0.7), rgba(140, 175, 230, 0.7)),
    var(--glow-bg) 0 0 / 1px 1px repeat;
  background-blend-mode: screen;
  filter: blur(24px) saturate(1.6);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.35s ease,
    left 0.35s var(--ease-out);
}

.cap-glow.on {
  opacity: 0.8;
}

.shelf .cap {
  z-index: 1;
}

/* spotlight: while one card is hovered, the others step back */
.shelf .cap {
  transition:
    transform 0.35s var(--ease-out),
    box-shadow 0.35s ease,
    filter 0.35s ease;
}

.shelf.has-sel .cap:not(.sel) {
  filter: brightness(0.55);
}

/* tall capsule cards, like a game library: the art is the card */
.cap {
  position: relative;
  flex: none;
  width: var(--capw);
  aspect-ratio: 2 / 3;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: #0c1322;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  transition:
    transform 0.35s var(--ease-out),
    box-shadow 0.35s ease;
}

.cap-open {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.cap.sel {
  transform: scale(1.05);
}

.cap:hover {
  transform: scale(1.04);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
}

/* each project can frame its art: which part shows (--fx, --fy) and how close (--z) */
.cap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--fx, 50%) 50%;
  transform: scale(var(--z, 1));
  transform-origin: var(--fx, 50%) var(--fy, 50%);
  display: block;
}

/* the drifting art's second layer: cross-fades over the first, no dip to dark */
.cap .art-next {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.cap .art-next.on {
  opacity: 1;
}

/* the name sits on the art, over a soft dark fade, like a game's logo */
.cap .name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 56px 14px 14px;
  font: calc(var(--capw) * 0.095) / 1.05 var(--display);
  color: #fff;
  text-align: left;
  background: linear-gradient(rgba(4, 7, 14, 0), rgba(4, 7, 14, 0.85) 60%, #04070e);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  transition: padding-bottom 0.3s var(--ease-out);
}

/* the card's own buttons: they rise at its foot on hover, the name lifts above them */
.cap-links {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition:
    opacity 0.25s ease,
    transform 0.3s var(--ease-out);
}

.cap:hover .cap-links,
.cap:focus-within .cap-links {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.cap.has-links:hover .name,
.cap.has-links:focus-within .name {
  padding-bottom: 52px;
}

.cap-links .pill {
  height: 30px;
  padding: 0 11px;
  font-size: 12.5px;
}

/* projects without a screenshot: their colour, the name larger */
.cap.type {
  background: linear-gradient(160deg, var(--c1), var(--c2));
}

.cap.type .name {
  background: none;
  font-size: calc(var(--capw) * 0.13);
}

.pill .host {
  overflow: hidden;
  text-overflow: ellipsis;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  font: 500 13.5px var(--body);
  text-decoration: none;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  transition:
    background 0.25s ease,
    color 0.4s ease;
}

.pill.code {
  background: var(--ink);
  color: var(--page);
}

.pill.code:hover {
  background: var(--accent);
}

.pill.live {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

.pill.live:hover {
  background: rgba(255, 255, 255, 0.13);
}

/* the address itself shows whether the site answers: green when up, orange when down */
.pill.live[data-state="up"] {
  color: #62e294;
}

.pill.live[data-state="down"] {
  color: #ffa25c;
}

.pill svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.cover {
  aspect-ratio: 16 / 10;
  width: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
  background: #0c1322;
}

/* projects without a screenshot get a quiet typographic cover in their own colour */
.cover.type {
  display: flex;
  align-items: flex-end;
  padding: 18px;
  font: 26px/1.05 var(--display);
  color: rgba(234, 240, 247, 0.92);
  background: linear-gradient(150deg, var(--c1), var(--c2));
}

.kicker {
  font: 10.5px var(--display);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.plink {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  color: var(--ink);
  font: 12px var(--display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 0.3s ease;
}

.plink svg {
  width: 15px;
  height: 15px;
}

.plink:hover,
.plink:focus-visible {
  color: var(--accent);
}

/* the live site says whether it answers: green when up, orange when down */
.plink.live[data-state="up"] {
  color: #62e294;
}

.plink.live[data-state="down"] {
  color: #ffb27a;
}

.pwhen {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13.5px;
}

.pwhen[hidden] {
  display: none;
}

.pwhen svg {
  width: 14px;
  height: 14px;
}

.x {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 0;
  background: rgba(6, 8, 15, 0.7);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.x::before,
.x::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 2px;
  border-radius: 1px;
  background: var(--ink);
  transform: rotate(45deg);
}

.x::after {
  transform: rotate(-45deg);
}

/* ---------- buttons, inputs: boxes ---------- */
.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  background: var(--box-hover);
  color: var(--ink);
  font: 500 15px var(--body);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.25s ease;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* in each brand's colour, like the Contact tiles (these show on phones) */
.btn.social {
  gap: 10px;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
  transition:
    filter 0.25s ease,
    transform 0.35s var(--ease-out);
}

.btn.social:hover {
  background: var(--brand);
  filter: brightness(1.1);
  transform: translateY(-2px);
}

.btn.social svg {
  width: 17px;
  height: 17px;
  flex: none;
  fill: currentColor;
  opacity: 0.9;
}

.btn.primary {
  background: var(--ink);
  color: var(--page);
}

.btn.primary:hover {
  background: var(--accent);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* ---------- contact ---------- */
.contact {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(16px, 2vw, 24px);
  align-items: start;
}

.form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: calc(14px * var(--fit)) 14px;
}

.form .full {
  grid-column: 1 / -1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 13px;
  color: var(--muted);
}

.field input,
.field textarea {
  background: rgba(255, 255, 255, 0.06);
  border: 0;
  border-radius: 10px;
  color: var(--ink);
  font: 15.5px/1.45 var(--body);
  padding: 11px 13px;
  resize: none;
  transition: background 0.25s ease;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #5d6b80;
}

.field [aria-invalid="true"] {
  outline: 2px solid rgba(255, 154, 138, 0.6);
  outline-offset: 0;
}

.field input:hover,
.field textarea:hover {
  background: rgba(255, 255, 255, 0.08);
}

.field input:focus,
.field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  background: rgba(255, 255, 255, 0.08);
}

.field textarea {
  height: calc(16vh * var(--fit));
  min-height: 80px;
}

.err {
  color: #ff9a8a;
  font-size: 12.5px;
  min-height: 1em;
  line-height: 1.2;
}

/* socials as square tiles, the cards' feel in each brand's own colour */
/* three socials: one row across */
.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(10px, 1vw, 14px);
  max-width: 400px;
}

.tile {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #fff;
  text-decoration: none;
  background: var(--brand);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  transition:
    transform 0.35s var(--ease-out),
    box-shadow 0.35s ease,
    filter 0.35s ease;
}

.tile:hover {
  transform: translateY(-5px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  filter: brightness(1.08);
}

.tile svg {
  width: 34%;
  height: 34%;
  fill: currentColor;
  margin-bottom: 12%;
}

.tile span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 26px 8px 9px;
  font: 13.5px/1.1 var(--display);
  text-align: center;
  background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.42));
}

/* ---------- settings ---------- */
#btnSettings {
  position: fixed;
  right: clamp(14px, 2vw, 22px);
  bottom: clamp(14px, 2vw, 22px);
  z-index: 10;
  width: 40px;
  height: 40px;
  border: 0;
  background: none;
  display: grid;
  place-items: center;
  cursor: pointer;
}

#btnSettings {
  color: var(--muted);
  transition: color 0.3s ease;
}

#btnSettings svg {
  transition: transform 0.6s var(--ease-out);
}

#btnSettings:hover,
#btnSettings[aria-expanded="true"] {
  color: var(--ink);
}

#btnSettings:hover svg,
#btnSettings[aria-expanded="true"] svg {
  transform: rotate(60deg);
}

#setSheet {
  position: fixed;
  right: clamp(14px, 2vw, 22px);
  bottom: 70px;
  z-index: 10;
  padding: 14px 18px;
  background: #0d1424;
  border-radius: var(--radius);
}

#setSheet[hidden] {
  display: none;
}

/* the "Control hint" setting, off */
body.no-hint .cue-in {
  opacity: 0;
  transition: opacity 0.4s ease;
}

.cue-in {
  transition: opacity 0.4s ease;
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.choice {
  background: var(--box);
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  padding: 6px 11px;
  font-size: 14px;
  cursor: pointer;
}

.choice[aria-pressed="true"] {
  background: var(--ink);
  color: var(--page);
}

/* toasts sit away from the settings panel (bottom right), so quick clicks through the settings
   never bury the buttons: bottom left on a PC, under the top bar on a phone (where the panel
   spans most of the width). They never take clicks either. */
#toasts {
  position: fixed;
  left: clamp(14px, 2vw, 22px);
  bottom: 20px;
  z-index: 21;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  pointer-events: none;
}

@media (max-width: 760px) {
  #toasts {
    left: 20px;
    right: 20px;
    bottom: auto;
    top: 62px;
    align-items: center;
  }
}

.toast {
  background: #0d1424;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 14px;
  animation: toast 3.2s ease forwards;
}

@keyframes toast {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }
  8%,
  80% {
    opacity: 1;
    transform: none;
  }
  100% {
    opacity: 0;
  }
}

@media (max-width: 760px) {
  /* six items across a phone: spread over the full width, type scaled to the screen */
  #menu {
    padding: 16px 20px;
  }
  .nav {
    display: none;
  }
  #btnMenu {
    display: block;
  }
  .contact .reach {
    display: none;
  }
  .home .buttons {
    display: flex;
  }
  .field textarea {
    height: clamp(56px, 10vh, 84px);
    min-height: 56px;
  }
  .panel {
    padding: 66px 20px 64px;
  }
  .about,
  .contact {
    grid-template-columns: 1fr;
  }
  .job {
    flex-direction: column;
    gap: 0;
  }
  .form {
    grid-template-columns: 1fr;
  }
  .reach .buttons {
    flex-direction: row;
  }
  :root {
    --capw: 40vw;
  }
  .cover.type {
    padding: 12px;
    font-size: 20px;
  }
}

/* ---------- easter eggs (js/eggs.js) ---------- */
#logo {
  transform-origin: 50% 100%; /* the pat hop squashes from the bottom */
}
.egg-fx {
  position: fixed;
  pointer-events: none;
  z-index: 5;
  image-rendering: pixelated;
}
/* typing "seal": the painted letters wave one by one (slices of #nameArt) */
.name-wave {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.name-wave canvas {
  position: absolute;
  top: 0;
}
