@font-face {
  font-family: "Space Grotesk";
  src: url("assets/fonts/space-grotesk.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --bg: #0b0b0d;
  --fg: #ece6da;
  --muted: #9a9385;
  --dim: #3a3832;
  --accent: #ffb454;
  --hat: #ff8f70;
  --panel: rgba(13, 13, 15, 0.84);
  --line: rgba(236, 230, 218, 0.12);
  --sans: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  --halo: 0 0 3px #000, 0 0 10px rgba(0, 0, 0, 0.9), 0 0 22px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; }

/* ---------- backdrop ---------- */
#backdrop {
  position: fixed;
  inset: 0;
  width: 100%;   /* always fills the window, even mid-resize */
  height: 100%;
  z-index: 0;
  touch-action: none;
}
#vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  /* quiet focus: a wide soft pool behind the name, darker top + bottom edges
     so the floating links and the bar always read */
  background:
    radial-gradient(52% 34% at 50% 48%, rgba(8, 8, 10, 0.16), rgba(8, 8, 10, 0) 72%),
    linear-gradient(to bottom, rgba(8, 8, 10, 0.4), rgba(8, 8, 10, 0) 13%, rgba(8, 8, 10, 0) 80%, rgba(8, 8, 10, 0.6));
}

/* ---------- avatar ---------- */
#world { position: fixed; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }

.avatar {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}
.avatar-sprite {
  margin: 0;
  font-family: var(--mono);
  white-space: pre;
  color: #f6efe3;
  text-shadow: var(--halo);
  pointer-events: auto;
  cursor: pointer;
  position: relative;
}
.avatar-sprite .hat { color: var(--hat); }
.avatar-sprite { transition: opacity .4s ease, filter .4s ease, transform .4s ease; transform-origin: 50% 100%; }
.avatar.real .avatar-sprite { opacity: 0; filter: blur(2px); transform: scale(0.8); }
.avatar-icon {
  position: absolute;
  color: #f8f2e7;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.8)) drop-shadow(0 3px 8px rgba(0,0,0,.45));
  opacity: 0;
  transform: scale(0.6);
  transform-origin: 50% 100%;
  transition: opacity .4s ease, transform .5s cubic-bezier(.2, .8, .2, 1.25);
  pointer-events: none;
  cursor: pointer;
}
.avatar.real .avatar-icon { opacity: 1; transform: none; pointer-events: auto; }
.avatar-icon .body { position: absolute; inset: 0; display: block; transition: transform .2s; }
.avatar-icon svg { width: 100%; height: 100%; display: block; }
.avatar.walking .avatar-icon .body svg { animation: step .44s ease-in-out infinite; }
@keyframes step { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8%); } }
.avatar-icon .badge {
  position: absolute;
  right: -46%;
  top: -14%;
  width: 52%;
  height: 52%;
  padding: 9%;
  border-radius: 50%;
  color: var(--accent);
  background: rgba(18, 18, 20, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: badge-in .5s cubic-bezier(.2, .8, .2, 1.3);
}
@keyframes badge-in { from { transform: scale(0); } }
.avatar.squeeze .avatar-sprite,
.avatar.squeeze .avatar-icon { animation: squeeze .7s cubic-bezier(.3, .7, .3, 1) both; }
@keyframes squeeze {
  0%   { transform: scale(1, 1); }
  28%  { transform: scale(0.3, 1.18); }
  50%  { transform: scale(0.22, 1.24); }
  72%  { transform: scale(1.22, 0.84); }
  86%  { transform: scale(0.94, 1.06); }
  100% { transform: scale(1, 1); }
}
.avatar-bit {
  position: absolute;
  left: var(--emote-x, 20px);
  top: 45%;
  font-size: 11px;
  color: var(--accent);
  text-shadow: var(--halo);
  pointer-events: none;
  animation: bit .75s ease-out forwards;
}
@keyframes bit {
  from { opacity: 1; transform: translate(-50%, 0) scale(1); }
  to   { opacity: 0; transform: translate(calc(-50% + var(--dx)), var(--dy)) scale(0.6); }
}

.avatar-shadow {
  position: absolute;
  width: 28px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0) 70%);
}
.avatar-emote {
  position: absolute;
  left: var(--emote-x, 20px);
  top: -6px;
  transform: translateX(-50%);
  font-size: 13px;
  color: var(--accent);
  text-shadow: var(--halo);
  white-space: nowrap;
  animation: emote 2.6s ease-out forwards;
  pointer-events: none;
}
@keyframes emote {
  0% { opacity: 0; transform: translate(-50%, 6px); }
  15% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -26px); }
}

/* ---------- section guides (js/guides.js) ---------- */
.guides { position: absolute; inset: 0; opacity: 0; transition: opacity .8s ease; }
.guides.on { opacity: 1; }
.guide {
  position: absolute; top: 0; left: 0;
  display: block; padding: 0; margin: 0; border: 0; background: none;
  pointer-events: auto; cursor: pointer;
  transform-origin: 0 0; will-change: transform;
  color: var(--c);
}
.guide-body { position: relative; display: block; transform-origin: 50% 60%; }
.guide-body canvas { display: block; image-rendering: pixelated; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6)); }
.guide-ascii {
  margin: 0;
  font: 700 var(--guide-font, 8.5px)/1.05 var(--mono);
  white-space: pre;
  text-shadow: 0 0 2px #000, 0 0 6px rgba(0, 0, 0, 0.8);
}
.guide-ascii i { font-style: normal; }
.guide-ascii .hi { color: var(--c); }
.guide-ascii .lo { color: color-mix(in srgb, var(--c) 55%, #000); }
.guide-label {
  position: absolute; left: 50%; bottom: calc(100% + 4px);
  transform: translateX(-50%);
  font: 600 9px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--c); white-space: nowrap;
  padding: 3px 5px; background: rgba(11, 11, 13, 0.72);
  opacity: 0.75; transition: opacity .2s, transform .2s;
}
.guide:hover .guide-label, .guide:focus-visible .guide-label { opacity: 1; transform: translateX(-50%) translateY(-3px); }
.guide:hover .guide-body, .guide:focus-visible .guide-body { filter: brightness(1.2); }
.guide:focus-visible { outline: 1px dashed var(--c); outline-offset: 4px; }
.guide-shadow {
  position: absolute; left: 15%; right: 15%; bottom: -3px; height: 6px;
  border-radius: 50%; background: rgba(0, 0, 0, 0.55); filter: blur(2px);
  transform-origin: 50% 50%;
}
/* the same guides as small icons in the top nav */
#top #nav a { align-items: center; }
.nav-icon { display: inline-grid; place-items: center; width: 28px; height: 22px; flex: none; }
.nav-icon canvas { display: block; max-height: 22px; width: auto !important; image-rendering: pixelated; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.7)); }
.nav-ascii { --guide-font: 3.3px; line-height: 1; letter-spacing: -0.02em; }
#nav a:hover .nav-icon, #nav a.on .nav-icon { filter: brightness(1.25); }
#top #nav a.on, #top #nav a:hover { color: var(--c, #fff); }

/* the two forms: dithered pixels, or clean flat colour over the real photo */
.guide-form { display: block; transform-origin: 50% 100%; }
.guide-form canvas.form-photo { image-rendering: auto; filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.45)) saturate(1.1); border-radius: 2px; }
/* crossing between them: squash flat, swap at the thinnest point, spring back */
.guide-form.squeeze { animation: guide-squeeze .42s cubic-bezier(.3, .7, .3, 1.3) both; }
@keyframes guide-squeeze {
  0%   { transform: scale(1, 1); }
  40%  { transform: scale(0.08, 1.25); filter: brightness(1.8); }
  55%  { transform: scale(0.08, 1.25); filter: brightness(1.8); }
  100% { transform: scale(1, 1); filter: none; }
}
@media (prefers-reduced-motion: reduce) { .guide-form.squeeze { animation: none; } }

/* ---------- cursor ring ---------- */
#ring {
  position: fixed; top: 0; left: 0; z-index: 100;
  width: 0; height: 0;
  pointer-events: none;
  mix-blend-mode: difference;   /* white ring inverts what's under it: always visible */
  opacity: 0; transition: opacity .25s;
}
#ring.on { opacity: 1; }
#ring::before {
  content: ""; position: absolute;
  width: 26px; height: 26px; left: -13px; top: -13px;
  border: 1.5px solid #fff; border-radius: 50%;
  transition: width .2s var(--ease), height .2s var(--ease), left .2s var(--ease), top .2s var(--ease), border-width .2s;
}
#ring.hot::before { width: 40px; height: 40px; left: -20px; top: -20px; }
#ring.down::before { width: 18px; height: 18px; left: -9px; top: -9px; border-width: 2.5px; }

/* ---------- hero ---------- */
#hero {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  z-index: 3;
  pointer-events: none;
  text-align: center;
  padding: 0 16px 6vh;
}

#banner {
  margin: 0;
  font-weight: 400;
  pointer-events: auto;
}
.logo {
  margin: 0;
  font-family: var(--mono);
  font-weight: 700;
  white-space: pre;
  color: #f7f1e6;
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.9), 0 0 10px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 1.6s ease, transform 1.8s cubic-bezier(.2, .7, .2, 1);
  cursor: default;
}
.logo-tilt {
  display: inline-block;
  transform: perspective(1000px) rotateX(var(--rx, 10deg)) rotateY(var(--ry, -12deg)) rotateZ(-2.5deg);
  transform-origin: 50% 60%;
  filter: drop-shadow(0 22px 22px rgba(0, 0, 0, 0.55));
  will-change: transform;
}
/* front faces, shaded like a rounded surface lit from the top-left */
.logo .f3 { color: #fffbf2; }
.logo .f2 { color: #eee5d4; }
.logo .f1 { color: #cdc1ac; }
.logo .f0 { color: #9e927e; }
/* 3D back side: dark ascii in shadow (deepest part darkest) */
.logo .x0, .logo .x1 {
  background: rgba(9, 9, 11, 0.9);
  font-weight: 400;
  text-shadow: none;
}
.logo .x0 { color: #4a443c; }
.logo .x1 { color: #6d6458; }
body.ready .logo {
  opacity: 1;
  transform: none;
  animation: bob 4.2s ease-in-out 2s infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

#tagline {
  margin: 0.2rem 0 0;
  font-family: var(--sans);
  font-size: clamp(15px, 1.5vw, 18px);
  font-weight: 500;
  letter-spacing: 0.01em;
  color: #efe8db;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.7);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 1.4s var(--ease) 1.1s, transform 1.4s var(--ease) 1.1s;
}
body.ready #tagline { opacity: 1; transform: none; }

/* ---------- top bar: name + numbered sections ---------- */
#top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: max(20px, env(safe-area-inset-top)) 28px 20px;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 1.2s var(--ease) 1.6s, transform 1.2s var(--ease) 1.6s;
}
body.ready #top { opacity: 1; transform: none; }
#mark {
  display: inline-flex;
  align-items: flex-end;
  gap: 8px;
  font: 600 14px/1 var(--sans);
  letter-spacing: 0.01em;
  color: #f4ede1;
  text-decoration: none;
}
/* the name sits centre stage in the hero, above the tagline */
#mark { margin: 0; justify-content: center; max-width: 100%; }
/* no plate behind it: a soft dark halo around the glyphs keeps it readable */
/* only the burger is left in the header: keep it on the right */
#top #burger { margin-left: auto; }
#mark .logo-tilt { display: inline-flex; align-items: flex-end; gap: 0.5em; filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.5)); }
#mark .logo { animation: none; font-weight: 800; text-shadow: 0 0 2px var(--mark-glow, rgba(0, 0, 0, 0.9)), 0 0 6px var(--mark-glow, rgba(0, 0, 0, 0.7)), 0 0 16px rgba(0, 0, 0, 0.45); }
#mark .logo span { transition: color .9s ease; }
/* the centred name, painted (see buildAltName in js/main.js) */
.name-alt { opacity: 0; transform: translateY(14px); transition: opacity 1.4s var(--ease) .7s, transform 1.4s var(--ease) .7s; }
body.ready .name-alt { opacity: 1; transform: none; }
.name-paint { display: flex; align-items: flex-end; gap: 1.2%; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.55)); transform: rotate(-2.5deg); }
body.ready .name-paint { transform: rotate(-2.5deg); }
.name-paint { display: grid; }
.name-layer { grid-area: 1 / 1; display: flex; align-items: flex-end; gap: 1.2%; transition: opacity .35s ease, transform .35s var(--ease); }
.name-layer canvas { display: block; height: auto; }
.name-layer.dither canvas { image-rendering: pixelated; }
/* dithered by default; over the real photo it squeezes across into clean paint */
.name-layer.smooth { opacity: 0; transform: scaleY(0.85); }
.name-paint.photo .name-layer.smooth { opacity: 1; transform: none; }
.name-paint.photo .name-layer.dither { opacity: 0; transform: scaleY(0.85); }
/* brighter faces and a lighter 3d side than the big version, for small sizes */
/* colours come from the photo (themeMark in js/main.js) */
#mark .logo .f3, #mark .logo .f2 { color: var(--mark-face, #ffffff); }
#mark .logo .f1 { color: var(--mark-face2, #f1e8d8); }
#mark .logo .f0 { color: var(--mark-face3, #d6cab5); }
/* fill the letter shapes (not a box) so the ascii reads over any photo */
#mark .logo .x0, #mark .logo .x1 { background: rgba(9, 9, 11, 0.82); }
#mark .logo .f0, #mark .logo .f1, #mark .logo .f2, #mark .logo .f3 { background: rgba(9, 9, 11, 0.5); }
#mark .logo .x0 { color: var(--mark-side2, #ff9f3a); }
#mark .logo .x1 { color: var(--mark-side, #ffb454); }
#nav {
  display: flex;
  gap: 4px;
}
#nav a {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font: 500 13px/1 var(--sans);
  letter-spacing: 0.02em;
  color: rgba(239, 232, 219, 0.7);
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 999px;
  transition: color .2s, background .2s;
}
#nav a i {
  font: normal 9px/1 var(--mono);
  letter-spacing: 0.06em;
  color: rgba(239, 232, 219, 0.38);
  transition: color .2s;
}
#nav a:hover, #nav a:focus-visible, #nav a.on { color: #fff; background: rgba(255, 255, 255, 0.07); outline: none; }
#nav a:hover i, #nav a:focus-visible i, #nav a.on i { color: var(--accent); }

/* ---------- bottom bar: caption · slider · credit ---------- */
#bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 18px 28px max(18px, calc(env(safe-area-inset-bottom) + 10px));
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 1.2s var(--ease) 2s, transform 1.2s var(--ease) 2s;
}
body.ready #bar { opacity: 1; transform: none; }

#caption {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
#caption-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: opacity .45s ease;
}
#caption-text.swap { opacity: 0; }
#caption-text .title {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  color: #f4ede1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#caption-text .meta {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: rgba(239, 232, 219, 0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#caption button {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font: 15px/1 var(--sans);
  color: rgba(239, 232, 219, 0.85);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  transition: background .2s, border-color .2s, color .2s;
}
#caption button:hover, #caption button:focus-visible { color: #fff; border-color: rgba(255, 180, 84, 0.7); background: rgba(255, 180, 84, 0.12); outline: none; }
#next { order: 3; }

/* dither <-> photo (double-click anywhere does the same) */
#flip {
  display: inline-flex; align-items: center; gap: 8px;
  font: 500 10px/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(239, 232, 219, 0.6);
  padding: 8px 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: rgba(13, 13, 15, 0.45);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  cursor: pointer; transition: color .2s, border-color .2s;
}
#flip .k { color: rgba(239, 232, 219, 0.38); }
#flip #flip-to { color: #f4ede1; }
#flip:hover, #flip:focus-visible { color: #fff; border-color: rgba(255, 180, 84, 0.6); outline: none; }

#copy {
  justify-self: end;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: rgba(239, 232, 219, 0.4);
}

/* one-time drag hint */
#hint {
  position: fixed;
  left: 50%;
  bottom: 96px;
  z-index: 5;
  transform: translate(-50%, 6px);
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: #f4ede1;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(13, 13, 15, 0.6);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .8s ease, transform .8s var(--ease);
}
#hint.show { opacity: 1; transform: translate(-50%, 0); }
#hint.gone { opacity: 0; transform: translate(-50%, 6px); }

/* ---------- panel ---------- */
/* ---------- section pages (full screen, #work, #travel, ...) ---------- */
#page {
  position: fixed; inset: 0; z-index: 4;
  overflow-y: auto;
  background:
    radial-gradient(120% 60% at 50% 0%, color-mix(in srgb, var(--c, #ffb454) 14%, transparent), transparent 70%),
    #0b0b0d;
  color: var(--fg);
  font-family: var(--sans);
}
#page[hidden] { display: none; }
#page .panel-art .art-old { position: absolute; inset: 0; }
#page.swap .page-inner { animation: page-swap .35s ease both; }
@keyframes page-swap { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-inner { max-width: 760px; margin: 0 auto; padding: 96px 24px 96px; }
#page-back {
  font: 500 12px/1 var(--mono); letter-spacing: 0.06em;
  color: rgba(239, 232, 219, 0.7);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 14px; cursor: pointer;
  transition: color .2s, border-color .2s;
}
#page-back:hover, #page-back:focus-visible { color: var(--c); border-color: var(--c); outline: none; }
.page-head { display: flex; align-items: center; gap: 16px; margin: 28px 0 18px; }
#page-icon { display: grid; place-items: center; }
#page-icon canvas { display: block; image-rendering: pixelated; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.6)); }
#page-icon .guide-ascii { --guide-font: 8px; }
#page .panel-art { position: relative; margin: 0 0 22px; border: 1px solid var(--line); border-radius: 6px; height: clamp(160px, 32vh, 300px); }
body.paged #bar, body.paged #hint { opacity: 0; pointer-events: none; }

/* the dithered flood between pages (js/transition.js) */
#wipe { position: fixed; inset: 0; z-index: 60; width: 100%; height: 100%; pointer-events: none; display: none; }
#wipe.on { display: block; }
/* the guides acting out their page journeys (js/journeys.js) */
#journey { position: fixed; inset: 0; z-index: 61; width: 100%; height: 100%; pointer-events: none; display: none; }
#journey.on { display: block; }

#panel-title {
  margin: 0;
  color: var(--c, inherit);
  font-size: clamp(40px, 7vw, 72px);
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: capitalize;
}

/* section illustration (js/art.js), full width under the title bar */
.panel-art {
  flex: none;
  margin: 4px 0 6px;
  height: clamp(130px, 28vh, 230px);
  background: rgba(255, 255, 255, 0.03);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.panel-art[hidden] { display: none; }
.panel-art-img {
  display: block; width: 100%; height: 100%;
  object-fit: cover;
  animation: art-in .5s var(--ease) both;
}
@keyframes art-in { from { opacity: 0; filter: contrast(2) brightness(1.4); } to { opacity: 1; filter: none; } }
#panel-body {
  font-size: 16px;
  line-height: 1.65;
}
#panel-body p { margin: 0 0 0.8em; color: rgba(239, 232, 219, 0.86); }
#panel-body .intro { color: rgba(239, 232, 219, 0.6); font-size: 14px; margin-bottom: 18px; }

.rows { display: grid; }
.row {
  display: grid;
  grid-template-columns: 8.5em 1fr;
  gap: 0 1.2em;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.row:first-child { border-top: 0; }
.row .k { font: 12px/1.9 var(--mono); color: rgba(239, 232, 219, 0.5); }
.row .t b { font-weight: 600; color: #f7f1e6; }
.row .t .at { color: rgba(239, 232, 219, 0.6); }
.row .t .note { color: rgba(239, 232, 219, 0.6); display: block; font-size: 14px; }
.row a { color: #f7f1e6; text-decoration: none; border-bottom: 1px solid rgba(255, 180, 84, 0.5); transition: color .2s, border-color .2s; }
.row a:hover { color: var(--accent); border-color: var(--accent); }

/* travel gallery */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.card {
  display: block;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #0b0b0d;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .2s, transform .3s var(--ease);
}
.card canvas { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; }
.card .meta { padding: 9px 11px 11px; font-size: 13px; font-weight: 600; line-height: 1.35; }
.card .meta span { display: block; font: 11px/1.5 var(--mono); color: rgba(239, 232, 219, 0.5); font-weight: 400; }
.card:hover, .card:focus-visible { border-color: rgba(255, 180, 84, 0.6); transform: translateY(-2px); outline: none; }
.card.current { border-color: rgba(239, 232, 219, 0.45); }

/* tablets and phones: the nav already lists every section, so the drifting
   links step aside; the bar stacks */
@media (max-width: 760px) {
  #top { flex-direction: column; gap: 10px; padding-top: max(16px, env(safe-area-inset-top)); }
  #nav a { padding: 8px 8px; font-size: 12px; }
  #nav a i { display: none; }
  #bar { grid-template-columns: 1fr; gap: 12px; padding: 14px 18px max(16px, calc(env(safe-area-inset-bottom) + 8px)); }
  #caption { justify-content: space-between; }
  #caption-text { align-items: center; text-align: center; flex: 1; }
  #flip { justify-self: center; }
  #copy { display: none; }
  #hint { bottom: 132px; }
  .row { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .page-inner { padding: 80px 18px 80px; }
}

/* short screens (phones in landscape) */
@media (max-height: 560px) {
  #hero { gap: 0.5rem; padding-bottom: 8vh; }
  #top { padding-top: 12px; padding-bottom: 12px; }
  #hint { display: none; }
  #bar { padding-top: 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
}

body.still *, body.still *::before, body.still *::after { transition: none !important; animation: none !important; }

@media (prefers-reduced-motion: reduce) {
  .glyph, body.ready .glyph { animation: none; transition: none; }
}

/* ---------- 404 page (deploy/404.html) ---------- */
body.notfound { overflow: auto; display: grid; place-items: center; min-height: 100vh; }
.nf { text-align: center; font-family: var(--sans); color: var(--fg); }
.nf-code { font: 700 72px/1 var(--mono); color: var(--accent); margin: 0 0 12px; }
.nf a { color: var(--accent); }

/* ---------- travel: full-screen pixel globe, time ruler, search (js/travel.js) ---------- */
#page.is-travel .page-inner { max-width: none; padding: 0; }
#page.is-travel .panel-art { display: none; }
#page.is-travel #page-back { position: absolute; z-index: 3; top: 132px; left: 28px; }
#page.is-travel .page-head { position: absolute; z-index: 3; top: 168px; left: 28px; margin: 0; pointer-events: none; }
#page.is-travel #panel-title { font-size: clamp(28px, 4vw, 44px); }
.travel { position: relative; height: 100vh; height: 100dvh; min-height: 520px; overflow: hidden; }
.travel .globe { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; cursor: grab; touch-action: none; }
.travel .globe:active { cursor: grabbing; }

/* the ruler: one glowing tick per photo, fisheye under the pointer */
.ruler { position: absolute; z-index: 2; left: 0; top: 0; bottom: 0; width: 170px; outline: none; touch-action: none; cursor: ns-resize; }
.ruler-track { position: absolute; left: 40px; top: 270px; bottom: 140px; width: 2px; }
.ruler-track::before { content: ""; position: absolute; left: 0; top: -12px; bottom: -12px; width: 1px; background: linear-gradient(transparent, rgba(239, 232, 219, 0.28) 8%, rgba(239, 232, 219, 0.28) 92%, transparent); }
/* a slow light sweeping down the spine */
.ruler-track::after { content: ""; position: absolute; left: -1px; width: 3px; height: 90px; top: -90px; background: linear-gradient(transparent, var(--c), transparent); opacity: .55; filter: blur(1px); animation: sweep 6s linear infinite; }
@keyframes sweep { to { top: 100%; } }
.ryear { --y: 0px; position: absolute; left: -10px; top: var(--y); width: 21px; height: 1px; background: rgba(239, 232, 219, 0.5); }
.ryear span { position: absolute; left: 28px; top: -6px; font: 600 11px/1 var(--mono); letter-spacing: .08em; color: rgba(239, 232, 219, 0.45); transition: color .3s; }
.ruler.live .ryear span { color: rgba(239, 232, 219, 0.75); }
.ptick { --y: 0px; --s: 1; position: absolute; left: 1px; top: var(--y); height: 1px; width: calc(12px * var(--s)); background: linear-gradient(90deg, rgba(239, 232, 219, 0.9), rgba(239, 232, 219, 0.2)); transform: translateY(-0.5px); pointer-events: none; }
.ptick.trip { height: 2px; background: linear-gradient(90deg, var(--c), color-mix(in srgb, var(--c) 30%, transparent)); box-shadow: 0 0 6px color-mix(in srgb, var(--c) 70%, transparent); animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 12px var(--c); } }
.ptick.hot { height: 3px; width: calc(16px * var(--s)); background: linear-gradient(90deg, #fff, #ff8f70 60%, transparent); box-shadow: 0 0 10px #ff8f70, 0 0 22px rgba(255, 143, 112, 0.6); animation: none; }
.scan { --y: 0px; position: absolute; left: -16px; top: var(--y); width: 150px; height: 1px; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9) 12%, rgba(255, 255, 255, 0.25) 45%, transparent); box-shadow: 0 0 8px rgba(255, 255, 255, 0.5); opacity: 0; transition: opacity .25s; pointer-events: none; }
.ruler.live .scan { opacity: 1; }
.scan .ro { position: absolute; left: -2px; top: -19px; padding: 2px 6px; border-radius: 999px; font: 10px/1.3 var(--mono); letter-spacing: .04em; color: #0b0b0d; background: rgba(255, 255, 255, 0.88); white-space: nowrap; }
.peek { --y: 0px; position: absolute; left: 64px; top: var(--y); width: 168px; transform: translate(-6px, -50%) scale(.92); opacity: 0; border-radius: 8px; overflow: hidden; background: rgba(11, 11, 13, 0.92); border: 1px solid color-mix(in srgb, var(--c) 60%, transparent); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 0 24px color-mix(in srgb, var(--c) 35%, transparent), 0 14px 30px rgba(0, 0, 0, 0.55); transition: opacity .18s, transform .22s var(--ease), top .08s linear; pointer-events: none; }
.peek.on { opacity: 1; transform: translate(0, -50%) scale(1); }
.peek img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.peek .pt { padding: 7px 9px 8px; display: grid; gap: 2px; }
.peek b { font: 600 12px/1.3 var(--sans); color: #f7f1e6; }
.peek span { font: 10px/1.4 var(--mono); color: rgba(239, 232, 219, 0.6); }
.ruler:focus-visible .ruler-track::before { background: var(--c); }


/* film strip of the trip's photos, above the search */
.film { position: absolute; z-index: 2; left: 50%; bottom: 74px; transform: translateX(-50%); display: flex; gap: 6px; max-width: min(80vw, 860px); overflow-x: auto; padding: 4px; scrollbar-width: none; transition: opacity .25s; }
.film::-webkit-scrollbar { display: none; }
.frame, .hit { all: unset; flex: none; cursor: pointer; border: 1px solid rgba(239, 232, 219, 0.14); border-radius: 4px; overflow: hidden; background: rgba(11, 11, 13, 0.7); transition: border-color .2s, transform .2s var(--ease); }
.frame img { display: block; height: 58px; width: 78px; object-fit: cover; opacity: 0.85; transition: opacity .2s; }
.frame span { display: none; }
.frame:hover, .frame:focus-visible, .frame.hot { border-color: var(--c); transform: translateY(-3px); }
.frame:hover img, .frame.hot img { opacity: 1; }
.travel.searching .film { opacity: 0; pointer-events: none; }

/* search: a quiet pill at the bottom; results slide up above it */
.tsearch { position: absolute; z-index: 3; left: 50%; bottom: 22px; transform: translateX(-50%); width: min(420px, calc(100vw - 40px)); display: flex; align-items: center; gap: 8px; padding: 0 14px; height: 38px; border-radius: 999px; background: rgba(11, 11, 13, 0.55); border: 1px solid rgba(239, 232, 219, 0.12); backdrop-filter: blur(6px); transition: border-color .2s, background .2s; cursor: text; }
.tsearch:focus-within { border-color: var(--c); background: rgba(11, 11, 13, 0.85); }
.tsearch .icon { font: 15px/1 var(--mono); color: rgba(239, 232, 219, 0.45); }
.tsearch input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--fg); font: 13px/1 var(--mono); }
.tsearch input::placeholder { color: rgba(239, 232, 219, 0.35); }
.tsearch input::-webkit-search-cancel-button { filter: invert(1) opacity(.4); }
.tsearch .count { font: 11px/1 var(--mono); color: var(--c); }
.tresults { position: absolute; z-index: 3; left: 50%; bottom: 70px; transform: translateX(-50%); width: min(640px, calc(100vw - 40px)); max-height: 46vh; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; padding: 10px; border-radius: 10px; background: rgba(11, 11, 13, 0.88); border: 1px solid rgba(239, 232, 219, 0.1); backdrop-filter: blur(8px); }
.tresults[hidden] { display: none; }
.hit img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.hit span { display: block; padding: 5px 7px 6px; font: 10.5px/1.35 var(--mono); color: rgba(239, 232, 219, 0.65); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hit:hover, .hit:focus-visible { border-color: var(--c); }
.tresults .none { grid-column: 1 / -1; margin: 6px; font: 12px/1.4 var(--mono); color: rgba(239, 232, 219, 0.5); }

.travel-below { max-width: 760px; margin: 0 auto; padding: 48px 24px 96px; }
#panel-body h3.sub { font: 600 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: rgba(239, 232, 219, 0.45); margin: 0 0 12px; }

.lightbox { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; align-content: center; gap: 12px; padding: 24px; background: rgba(5, 5, 7, 0.94); cursor: zoom-out; }
.lightbox img { max-width: min(92vw, 1600px); max-height: 80vh; border-radius: 4px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6); }
.lightbox p { margin: 0; font: 12px/1.5 var(--mono); color: rgba(239, 232, 219, 0.7); text-align: center; }

@media (max-width: 760px) {
  #page.is-travel #page-back { top: 96px; left: 16px; }
  #page.is-travel .page-head { top: 128px; left: 16px; }
  #page.is-travel #panel-title { font-size: 24px; }
  .ruler { width: 120px; }
  .ruler-track { left: 20px; top: 200px; bottom: 210px; }
  .peek { left: 34px; width: 132px; }
    .film { bottom: 70px; max-width: calc(100vw - 24px); }
  .frame img { height: 50px; width: 66px; }
}

/* ---------- the burger: a literal pixel burger that drops the menu down ---------- */
body.menu-open #top { z-index: 60; }
#scrim { position: fixed; inset: 0; z-index: 6; background: rgba(0, 0, 0, 0.35); }
#scrim[hidden] { display: none; }
#burger {
  all: unset; position: relative; z-index: 8; box-sizing: border-box; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 50px; height: 50px; border-radius: 14px;
  background: rgba(13, 13, 15, 0.55); border: 1px solid rgba(239, 232, 219, 0.14); backdrop-filter: blur(6px);
  transition: border-color .2s, transform .2s var(--ease);
}
#burger:hover { transform: translateY(-1px) rotate(-3deg); border-color: rgba(255, 180, 84, 0.5); }
#burger:focus-visible { border-color: var(--accent); }
#burger span { display: block; transition: transform .3s var(--ease), opacity .2s; }
/* top bun: domed, with sesame seeds */
#burger .bun-top {
  width: 28px; height: 9px; border-radius: 14px 14px 3px 3px; background: #e0a34e;
  box-shadow: inset 0 -2px 0 #b97a2e;
  background-image: radial-gradient(#fff4dc 1px, transparent 1.4px), radial-gradient(#fff4dc 1px, transparent 1.4px);
  background-size: 8px 5px, 8px 5px; background-position: 2px 1px, 6px 3px;
}
#burger .lettuce { width: 30px; height: 3px; margin-top: 1px; background:
  radial-gradient(circle at 2px 0, #7ee081 2px, transparent 2.2px) 0 0 / 5px 3px repeat-x; }
#burger .cheese { width: 28px; height: 0; border-left: 14px solid transparent; border-right: 14px solid transparent; border-top: 4px solid #ffd24a; margin: -1px 0; box-sizing: border-box; }
#burger .patty { width: 28px; height: 5px; border-radius: 3px; background: #6b3a24; box-shadow: inset 0 1px 0 #8a4e32; }
#burger .bun-bot { width: 27px; height: 5px; margin-top: 1px; border-radius: 2px 2px 7px 7px; background: #e0a34e; box-shadow: inset 0 -2px 0 #b97a2e; }
/* open: the top bun lifts off and tilts like a lid */
body.menu-open #burger .bun-top { transform: translate(5px, -6px) rotate(18deg); }
body.menu-open #burger .lettuce { transform: translateY(-1px) scaleX(1.08); }

/* the menu drops out of the burger */
#nav {
  position: absolute; z-index: 7; top: calc(100% - 10px); right: 20px;
  flex-direction: column; gap: 2px; min-width: 210px; padding: 8px;
  background: rgba(13, 13, 15, 0.96); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.55);
  transform-origin: calc(100% - 25px) 0; transform: translateY(-8px) scale(0.6); opacity: 0; visibility: hidden;
  transition: transform .28s var(--ease), opacity .2s, visibility 0s linear .28s;
}
body.menu-open #nav { transform: none; opacity: 1; visibility: visible; transition: transform .28s var(--ease), opacity .2s, visibility 0s; }
#top #nav a { font-size: 16px; padding: 12px 14px; border-radius: 10px; gap: 12px; opacity: 0; transform: translateY(-10px); transition: color .2s, background .2s, opacity .2s, transform .3s var(--ease); }
#nav a i { display: inline; font-size: 10px; }
/* items fall in one by one, like stacking a burger */
body.menu-open #top #nav a { opacity: 1; transform: none; }
body.menu-open #top #nav a:nth-child(2) { transition-delay: .03s; }
body.menu-open #top #nav a:nth-child(3) { transition-delay: .06s; }
body.menu-open #top #nav a:nth-child(4) { transition-delay: .09s; }
body.menu-open #top #nav a:nth-child(5) { transition-delay: .12s; }
@media (max-width: 760px) {
  #top { flex-direction: row; align-items: center; }
  #nav { right: 14px; left: 14px; min-width: 0; }
  #top #nav a { font-size: 18px; padding: 14px; }
}
@media (prefers-reduced-motion: reduce) { .ruler-track::after, .ptick.trip { animation: none; } .peek, .film, #nav, #nav a, #burger, #burger span { transition: none; } }

/* ---------- guides: the briefcase's idle quips (js/guides.js) ---------- */
.quip { position: absolute; left: 50%; bottom: calc(100% + 26px); width: max-content; max-width: 220px; padding: 8px 11px; border-radius: 10px 10px 10px 3px; background: #f7f1e6; color: #0b0b0d; font: 600 12px/1.35 var(--mono); text-align: left; white-space: normal; box-shadow: 0 0 0 2px #0b0b0d, 0 0 0 4px var(--c), 0 10px 24px rgba(0, 0, 0, 0.45); transform-origin: 0 100%; transform: translate(-12px, 6px) scale(.6); opacity: 0; pointer-events: none; }
.quip::after { content: ""; position: absolute; left: 10px; top: 100%; border: 7px solid transparent; border-top-color: #f7f1e6; border-left-width: 0; }
.quip.on { animation: quip-in .35s cubic-bezier(.3, 1.6, .5, 1) forwards; }
.quip.off { animation: quip-out .22s ease forwards; }
@keyframes quip-in { to { opacity: 1; transform: translate(-12px, 0) scale(1); } }
@keyframes quip-out { from { opacity: 1; transform: translate(-12px, 0) scale(1); } to { opacity: 0; transform: translate(-12px, 4px) scale(.85); } }
@media (prefers-reduced-motion: reduce) { .quip.on { animation: none; opacity: 1; transform: translate(-12px, 0); } }
.quip.left { left: auto; right: 50%; border-radius: 10px 10px 3px 10px; transform-origin: 100% 100%; transform: translate(12px, 6px) scale(.6); }
.quip.left::after { left: auto; right: 10px; border-left-width: 7px; border-right-width: 0; }
.quip.left.on { animation-name: quip-in-l; }
.quip.left.off { animation-name: quip-out-l; }
@keyframes quip-in-l { to { opacity: 1; transform: translate(12px, 0) scale(1); } }
@keyframes quip-out-l { from { opacity: 1; transform: translate(12px, 0) scale(1); } to { opacity: 0; transform: translate(12px, 4px) scale(.85); } }
/* the guide that's paying attention to you gets a soft glow */
.guide.awake .guide-body { filter: drop-shadow(0 0 6px var(--c)) drop-shadow(0 0 14px color-mix(in srgb, var(--c) 50%, transparent)); }
.guide.awake .guide-label { opacity: 1; }

/* ---------- readability: bigger, higher-contrast text everywhere ---------- */
#tagline { font-size: clamp(17px, 1.7vw, 21px); }
#top #nav a { font-size: 15px; }
#nav a i { font-size: 10px; }
.guide-label { font-size: 11px; padding: 4px 6px; opacity: 0.9; }
#caption-text .title { font-size: 17px; }
#caption-text .meta { font-size: 12.5px; color: rgba(239, 232, 219, 0.72); }
#flip { font-size: 11.5px; }
#copy { font-size: 12.5px; }
#panel-body { font-size: 18px; line-height: 1.7; }
#panel-body p { color: rgba(239, 232, 219, 0.92); }
#panel-body .intro { font-size: 16px; color: rgba(239, 232, 219, 0.72); }
.row { grid-template-columns: 9.5em 1fr; padding: 16px 0; }
.row .k { font-size: 14px; color: rgba(239, 232, 219, 0.62); }
.row .t .at { color: rgba(239, 232, 219, 0.72); }
.row .t .note { font-size: 16px; color: rgba(239, 232, 219, 0.74); }
.card .meta { font-size: 15px; }
.card .meta span { font-size: 12.5px; color: rgba(239, 232, 219, 0.62); }
.quip { font-size: 13.5px; max-width: 240px; }
/* travel page */
.ryear span { font-size: 13px; }
.scan .ro { font-size: 12px; }
.peek { width: 190px; }
.peek b { font-size: 14px; }
.peek span { font-size: 12px; }
.tsearch { height: 42px; }
.tsearch input { font-size: 14.5px; }
.tsearch input::placeholder { color: rgba(239, 232, 219, 0.5); }
.hit span { font-size: 12px; }
.lightbox p { font-size: 14px; }
@media (max-width: 760px) {
  #panel-body { font-size: 17px; }
  .row { grid-template-columns: 1fr; }
  #top #nav a { font-size: 18px; }
  .peek { width: 150px; }
}
