@layer tokens, base, shared, desktop, mobile;

/* =========================================================================
   Design tokens
   ========================================================================= */
@layer tokens {
:root {
  --bg:            #F5F5F5;
  --surface:       #FFFFFF;
  --surface-2:     #F1EFE8;
  --surface-hover: #EDEBE3;

  --ink:           #14140F;
  --ink-2:         #56554E;
  --ink-3:         #8B8980;
  --ink-4:         #B5B3A8;

  --line:          #E5E3DB;
  --line-strong:   #C9C6BB;

  --signal:        #FF6A1F;
  --signal-soft:   #FFE4D7;
  --signal-ink:    #73300E;

  --paper:         #FAF8F3;

  --positive:      #2F6F4F;
  --frosted-bg:    rgba(245, 245, 245, 0.46);
  --frosted-filter: blur(16px) saturate(1.08);

  --font-sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Helvetica Neue', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, Monaco, Consolas, monospace;

  --ease: cubic-bezier(0.2, 0, 0, 1);
  --duration-fast: 120ms;
  --duration-base: 240ms;
}
}

@layer base {
* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
::selection { background: var(--signal-soft); color: var(--signal-ink); }

/* Keyboard focus — one visible, branded ring on every interactive element.
   Mouse/touch interactions stay ring-free via :focus-visible. */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

/* The deck and a post's horizontal pages are scroll containers that Chromium
   makes implicitly keyboard-focusable. Their navigation already runs through
   deck.js and the pager, so suppress the redundant full-bleed container ring. */
.deck:focus,
.deck:focus-visible,
.pages:focus,
.pages:focus-visible {
  outline: none;
}
}

@layer desktop {
:root {
  --index-w: 280px;

  /* gap between viewport edge and card */
  --deck-pad-x: 24px;
  --deck-pad-y: 24px;

  /* internal padding of the slide card */
  --card-pad-x: 32px;
  --card-pad-y: 24px;
}

body {
  display: grid;
  grid-template-columns: var(--index-w) 1fr;
}

/* =========================================================================
   Left index — no divider now
   ========================================================================= */
.index {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 24px;
  overflow-y: auto;
  position: relative;
  z-index: 10;
}

.masthead {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 36px;
  cursor: pointer;
}
.masthead .name {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.index-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.post-list li {
  position: relative;
}

.post-list a {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  transition: color var(--duration-fast) var(--ease);
  cursor: pointer;
}
.post-list li:last-child a { border-bottom: 0; }

.post-list .num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}

.post-list .title {
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--ink-2);
  font-weight: 400;
  letter-spacing: -0.005em;
  transition: color var(--duration-fast) var(--ease);
}

.post-list a:hover .title { color: var(--ink); }
.post-list a:hover .num { color: var(--ink-2); }

.post-list li.active a .title {
  color: var(--ink);
  font-weight: 500;
}
.post-list li.active a .num { color: var(--signal); }
.post-list li.active::before {
  content: "";
  position: absolute;
  left: -28px;
  top: 50%;
  width: 16px; height: 2px;
  background: var(--signal);
  transform: translateY(-50%);
  border-radius: 1px;
}

.index-foot {
  margin-top: auto;
  padding-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.index-foot .links { display: flex; gap: 14px; flex-wrap: wrap; }
.index-foot a { transition: color var(--duration-fast) var(--ease); }
.index-foot a:hover { color: var(--ink); }

/* =========================================================================
   Mobile header (only renders below 900px)
   ========================================================================= */
.mobile-header { display: none; }
.mobile-header .mh-left {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
}
.mobile-header .mh-left .name {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.mobile-header .mh-burger {
  appearance: none;
  background: transparent;
  border: 0;
  width: 40px; height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink);
  border-radius: 8px;
  transition: background var(--duration-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.mobile-header .mh-burger:active { background: var(--surface-hover); }
.mh-icon-close { display: none; }
body.index-open .mh-icon-burger { display: none; }
body.index-open .mh-icon-close { display: block; }

/* =========================================================================
   Deck (scroll-snap-y)
   ========================================================================= */
.deck {
  height: 100vh;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}
.deck::-webkit-scrollbar { display: none; }

.scene {
  position: relative;
  height: 100vh;
  width: 100%;
  scroll-snap-align: start;
  padding: var(--deck-pad-y) var(--deck-pad-x);
  display: flex;
  overflow: hidden;
}

/* =========================================================================
   Stage = the SLIDE CARD
   ========================================================================= */
.stage {
  position: relative;
  flex: 1;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow:
    0 1px 2px rgba(20,20,15,0.03),
    0 10px 28px rgba(20,20,15,0.05);
  padding: var(--card-pad-y) var(--card-pad-x);
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.stage-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.stage-head .index-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.draft-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--signal-soft);
  color: var(--signal-ink);
  font-weight: 600;
}
.post-list li.is-draft .num { color: var(--signal); }
.stage-head .crumb {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.stage-head .crumb .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--ink-4);
}
.stage-head .crumb .dot.live {
  background: var(--signal);
  box-shadow: 0 0 0 3px var(--signal-soft);
}
.stage-head .share,
.stage-head .locale {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.stage-head .locale { grid-column: 3; }
.stage-head .share {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color var(--duration-fast) var(--ease);
  cursor: pointer;
}
.stage-head .share:hover { color: var(--ink); }
.stage-head .share .share-copied { display: none; }
.stage-head .share[data-copied="true"] {
  color: var(--signal);
}
.stage-head .share[data-copied="true"] .share-default { display: none; }
.stage-head .share[data-copied="true"] .share-copied { display: inline; }
.post-header .meta {
  display: contents;
}
.post-header .post-date,
.post-header .post-read,
.post-title,
.post-collapse {
  display: none;
}
}

@layer shared {
@keyframes live-flicker {
  0%, 19%, 21%, 23%, 65%, 69%, 100% { opacity: 1; }
  20%, 22%, 66%, 67%, 68%           { opacity: 0.4; }
}
.hero-body .contact {
  margin-top: 32px;
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-2);
  align-self: flex-start;
  flex-wrap: wrap;
}
.hero-body .contact .pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 4px var(--signal-soft);
  animation: live-flicker 3.6s linear infinite;
  flex-shrink: 0;
}
.contact-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.contact-buttons {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.online-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 14px 3px 3px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink);
  transition: border-color var(--duration-fast) var(--ease),
              background var(--duration-fast) var(--ease),
              transform var(--duration-fast) var(--ease);
}
.online-pill:hover {
  border-color: var(--signal);
  background: var(--signal-soft);
}
.online-pill:active { transform: translateY(1px); }
.online-pill .avatar {
  position: relative;
  width: 28px; height: 28px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-2);
  flex-shrink: 0;
}
.online-pill .avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.online-pill .label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0;
  color: var(--ink);
}
.social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: border-color var(--duration-fast) var(--ease),
              background var(--duration-fast) var(--ease),
              transform var(--duration-fast) var(--ease);
}
.social-btn:hover {
  border-color: var(--signal);
  background: var(--signal-soft);
}
.social-btn:active { transform: translateY(1px); }
.social-btn svg {
  width: 14px;
  height: 14px;
  display: block;
  fill: var(--ink-2);
}
.social-btn[aria-label="GitHub"] svg {
  width: 16px;
  height: 16px;
}
@media (prefers-reduced-motion: reduce) {
  .hero-body .contact .pulse { animation: none; }
}
}

@layer desktop {
/* body — single-page posts */
.post-content {
  min-height: 0;
}
.stage-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}
.stage-body h2 {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 40px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.022em;
  color: var(--ink);
  max-width: 680px;
}
.stage-body .lede {
  margin-top: 18px;
  font-size: 18px;
  color: var(--ink-2);
  line-height: 1.55;
  max-width: 620px;
}
}

@layer shared {
.stage-body .prose {
  margin-top: 28px;
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.stage-body .prose p { margin: 0; }
.stage-body .prose .em-line {
  color: var(--ink-2);
}
}

@layer desktop {
.stage-foot {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.stage-foot .tags {
  display: flex; gap: 8px; flex-wrap: wrap;
}
}

@layer shared {
.tag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  padding: 3px 8px;
  border-radius: 999px;
  line-height: 1.5;
}
}

@layer desktop {
.pager {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.pager button {
  appearance: none;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  color: var(--ink-2);
  width: 28px; height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--duration-fast) var(--ease),
              border-color var(--duration-fast) var(--ease),
              color var(--duration-fast) var(--ease),
              transform var(--duration-fast) var(--ease);
}
.pager button:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--ink);
  color: var(--ink);
}
.pager button:active:not(:disabled) {
  background: var(--surface-2);
  transform: translateY(1px);
}
.pager button:disabled {
  opacity: 0.35; cursor: default;
}
.pager .indicator {
  min-width: 36px; text-align: center;
  color: var(--ink-2);
}

/* =========================================================================
   Multi-page post: horizontal scroll-snap inside the card
   ========================================================================= */
.pages {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  min-height: 0;
  gap: 48px;
}
.post-content > .pages {
  height: 100%;
}
.pages::-webkit-scrollbar { display: none; }

.page {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 40px 32px;
  min-height: 0;
}
.page:first-child {
  padding: 0;
}
.page:first-child > .cover-row:first-child,
.page:first-child > .stack-row:first-child {
  padding: 40px 32px;
}
.page h2 {
  margin: 0;
  font-size: 34px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  max-width: 740px;
}
}

@layer shared {
.page .prose {
  margin-top: 22px;
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--ink);
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 1em;
}
.page .prose p { margin: 0; }
.page .prose .list {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: flex; flex-direction: column; gap: 8px;
}
.page .prose .list li {
  padding-left: 22px;
  position: relative;
  color: var(--ink);
}
.page .prose .list li::before {
  content: "—";
  position: absolute;
  left: 0; top: 0;
  color: var(--signal);
}
.page .prose ol.list { counter-reset: list-counter; }
.page .prose ol.list li { counter-increment: list-counter; }
.page .prose ol.list li::before {
  content: counter(list-counter) ".";
  font-family: var(--font-mono);
  font-size: 0.9em;
}
.page .prose a {
  color: var(--signal);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pull-quote {
  border-left: 2px solid var(--signal);
  padding: 6px 0 6px 22px;
  margin: 28px 0;
  font-family: var(--font-sans);
  font-size: 24px;
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--ink);
  font-weight: 500;
  max-width: 740px;
}
.pull-quote .attribution {
  display: block;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 400;
}

.callout {
  border-left: 3px solid var(--signal);
  background: var(--signal-soft);
  color: var(--signal-ink);
  padding: 10px 14px 10px 16px;
  font-size: 15px;
  line-height: 1.55;
  max-width: 720px;
}

.code-block {
  position: relative;
  background: var(--ink);
  color: var(--paper);
  border-radius: 12px;
  padding: 20px 22px;
  max-width: 820px;
}
.code-block .code-block-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--signal);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.code-block pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--paper);
  opacity: 0.85;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.code-block .code-block-copy {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: 1px solid rgba(250, 248, 243, 0.15);
  border-radius: 6px;
  color: var(--paper);
  opacity: 0.65;
  cursor: pointer;
  transition: opacity 120ms ease, background 120ms ease, color 120ms ease;
}
.code-block .code-block-copy:hover {
  opacity: 1;
  background: rgba(250, 248, 243, 0.08);
}
.code-block .code-block-copy:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}
.code-block button.code-block-copy svg { width: 14px; height: 14px; }
.code-block .code-block-copy .icon-check { display: none; }
.code-block .code-block-copy[data-copied="true"] {
  opacity: 1;
  color: var(--signal);
}
.code-block .code-block-copy[data-copied="true"] .icon-copy { display: none; }
.code-block .code-block-copy[data-copied="true"] .icon-check { display: block; }

/* Triptych — three abstract column visuals (text above, illustration below). */
.page .triptych {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 72px;
  margin-top: 48px;
}
.page .triptych .col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.page .triptych .col-eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.page .triptych .col-title {
  margin: 0;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink);
}
.page .triptych .col-body {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-2);
}
.page .triptych .col-visual {
  order: -1;
  margin-bottom: 14px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  max-width: 240px;
  aspect-ratio: 1 / 1;
}
.page .triptych .col-visual svg {
  display: block;
  width: 100%;
  height: 100%;
}
.page .triptych-footer { margin-top: 24px; }
@media (max-width: 820px) {
  .page .triptych { grid-template-columns: 1fr; gap: 24px; }
  .page .triptych .col-visual { max-width: 200px; }
}

/* Cover layout — illustration alongside the page-1 intro of a post. */
.page .cover-row {
  display: flex;
  align-items: flex-start;
  gap: 40px;
}
.page .cover-row.cover-row--top { align-items: flex-start; }
.page .cover-art {
  flex: 0 0 auto;
  width: clamp(220px, 32%, 360px);
}
.page .cover-art img,
.page .cover-art svg {
  display: block;
  width: 100%;
  height: auto;
}
.page img {
  border: 1px solid var(--line);
  border-radius: 12px;
}
.page .cover-text {
  flex: 1 1 auto;
  min-width: 0;
}
@media (max-width: 820px) {
  .page .cover-row { flex-direction: column; align-items: flex-start; gap: 20px; }
  .page .cover-art { width: min(60%, 240px); }
}

/* Split row — text on the left, supporting visual/grid on the right. */
.page .split-row {
  display: flex;
  gap: 72px;
  align-items: flex-start;
}
.page .split-row .split-text {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--ink);
}
.page .split-row .split-text p { margin: 0; }
.page .split-row .split-text > .prose { margin-top: 0; }
/* Split-row figure — sized image/illustration in the right column. */
.page .split-row .split-figure {
  flex: 0 0 auto;
  width: clamp(240px, 38%, 420px);
  align-self: center;
}
.page .split-row .split-figure img,
.page .split-row .split-figure svg,
.page .split-row .split-figure video {
  display: block;
  width: 100%;
  height: auto;
}

/* Media-led variant — figure is the protagonist; text narrows. */
.page .split-row.split-row--media .split-text {
  flex: 0 0 auto;
  width: clamp(280px, 36%, 400px);
}
.page .split-row.split-row--media .split-figure {
  flex: 1 1 0;
  width: auto;
  max-width: none;
  align-self: flex-start;
}

/* Skills card — dark panel listing mono-labeled items in the right column. */
.skills-card {
  flex: 0 0 auto;
  width: clamp(240px, 38%, 360px);
  align-self: center;
  background: var(--ink);
  color: var(--paper);
  border-radius: 12px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.skills-card .skills-card-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.skills-card .skill-cmd {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--signal);
  letter-spacing: 0.01em;
  margin-bottom: 4px;
}
.skills-card .skill-desc {
  font-size: 13px;
  line-height: 1.45;
  opacity: 0.75;
}

@media (max-width: 820px) {
  .page .split-row { flex-direction: column; gap: 24px; }
  .page .split-row .split-figure,
  .page .split-row.split-row--media .split-text,
  .page .split-row .skills-card { width: 100%; max-width: none; }
}

/* Stack layout — wider text on top, figure beneath. */
.page .stack-row {
  display: flex;
  flex-direction: column;
  gap: 40px;
}
.page .stack-row .stack-text {
  max-width: 820px;
}
.page .stack-row .stack-text h2,
.page .stack-row .stack-text .prose,
.page .stack-row .stack-text .lede {
  max-width: none;
}
.page .stack-row .stack-figure {
  width: 100%;
  max-width: 820px;
}
.page .stack-row .stack-figure img,
.page .stack-row .stack-figure svg {
  display: block;
  width: 100%;
  height: auto;
}
}

@layer desktop {
/* =========================================================================
   Hero (scene 0)
   ========================================================================= */
.stage.hero-stage {
  grid-template-rows: auto 1fr auto;
}
.hero-stage .stage-foot {
  grid-template-columns: minmax(0, 1fr) auto;
  justify-items: end;
}
.hero-stage .stage-foot .hero-footnote {
  justify-self: start;
}
.hero-body {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
  min-height: 0;
}
.hero-footnote {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  min-width: 0;
  white-space: nowrap;
}
.hero-footnote .label {
  color: var(--ink-4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.hero-footnote .values {
  color: var(--ink-3);
}
.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1 1 auto;
  min-width: 0;
}
}

@layer shared {
.hero-art {
  flex: 0 0 auto;
  width: clamp(280px, 36vw, 480px);
  aspect-ratio: 1 / 1;
  margin: 0;
}
.hero-art svg {
  width: 100%;
  height: 100%;
  display: block;
}
.hero-art path {
  stroke: var(--ink);
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
  fill: none;
}
}

@layer desktop {
.hero-body .eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 28px;
}
.hero-body h2 {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 40px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.022em;
  color: var(--ink);
  max-width: 680px;
}
.hero-body .lede {
  margin-top: 22px;
  font-size: 18px;
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 620px;
}
.hero-body .prose {
  margin-top: 22px;
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.hero-body .prose p { margin: 0; }

/* =========================================================================
   Hint strip (hero)
   ========================================================================= */
.hint-strip {
  display: flex; gap: 18px; align-items: center;
  justify-content: flex-end;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.hint-strip .label { color: var(--ink-2); margin-right: 4px; }
.hint-strip .group { display: inline-flex; gap: 6px; align-items: center; }
.hint-strip .key {
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 3px 6px;
  color: var(--ink-2);
  font-size: 10px;
  line-height: 1;
}

@media (max-width: 1280px) {
  .hero-footnote {
    display: none;
  }
}
}

/* =========================================================================
   Mobile mode
   ========================================================================= */
@layer mobile {
@media (max-width: 900px) {
  html {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    scroll-behavior: smooth;
  }
  body {
    display: block;
    grid-template-columns: 1fr;
    min-height: 100%;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
  }
  :root {
    --mh-h: 52px;
  }

  .mobile-header {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--mh-h);
    z-index: 90;
    background: var(--frosted-bg);
    border-bottom: 1px solid var(--line);
    -webkit-backdrop-filter: var(--frosted-filter);
    backdrop-filter: var(--frosted-filter);
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    transform: translateY(0);
    transition: transform 220ms var(--ease);
    will-change: transform;
  }
  body.header-hidden:not(.index-open) .mobile-header {
    transform: translateY(-100%);
  }
  .mobile-header .mh-left { gap: 0; }
  .mobile-header .mh-left .name {
    font-size: 14px;
    letter-spacing: 0;
  }
  .mobile-header .mh-burger:active { background: var(--surface-2); }

  .index {
    position: fixed;
    top: var(--mh-h);
    left: 0;
    right: 0;
    bottom: auto;
    height: auto;
    max-height: calc(100dvh - var(--mh-h));
    z-index: 80;
    padding: 14px 22px 18px;
    background: var(--frosted-bg);
    border-bottom: 1px solid var(--line);
    -webkit-backdrop-filter: var(--frosted-filter);
    backdrop-filter: var(--frosted-filter);
    box-shadow: none;
    transform: translateY(calc(-100% - var(--mh-h)));
    transition:
      transform 280ms var(--ease),
      box-shadow 180ms var(--ease);
    pointer-events: none;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  body.index-open .index {
    box-shadow: 0 16px 28px rgba(20, 20, 15, 0.07);
    transform: translateY(0);
    pointer-events: auto;
  }
  .index .masthead { display: none; }
  .index-label { margin-bottom: 14px; }
  .post-list a { padding: 10px 0; }
  .post-list li.active::before { display: none; }
  .index-foot { display: none; }

  .deck {
    display: flex;
    flex-direction: column;
    gap: 18px;
    height: auto;
    min-height: 100dvh;
    margin-top: 0;
    padding: calc(var(--mh-h) + 28px) 12px 48px;
    overflow: visible;
    scroll-snap-type: none;
    scrollbar-width: auto;
  }
  .deck::-webkit-scrollbar { display: initial; }

  .scene {
    position: relative;
    display: block;
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 0;
    scroll-margin-top: 12px;
    scroll-snap-align: none;
  }
  .post {
    position: relative;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow:
      0 1px 2px rgba(20, 20, 15, 0.03),
      0 10px 28px rgba(20, 20, 15, 0.04);
    max-height: 240px;
    -webkit-tap-highlight-color: transparent;
  }
  .post:not(.expanded) { cursor: pointer; }
  .post.expanded,
  .post:target {
    max-height: none;
    overflow: hidden;
  }

  .stage,
  .post-card {
    display: block;
    height: auto;
    min-height: 0;
    padding: 0;
    overflow: visible;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .stage-head,
  .post-header {
    display: block;
    padding: 24px 18px 16px;
    border-bottom: 0;
  }
  .post.expanded .post-header,
  .post:target .post-header {
    padding-right: 62px;
  }
  .post-header .meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 10px;
    margin-bottom: 12px;
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--ink-3);
    letter-spacing: 0.07em;
    text-transform: uppercase;
  }
  .post-header .post-date,
  .post-header .post-read {
    display: inline;
  }
  .stage-head .index-tag,
  .stage-head .share,
  .stage-head .locale,
  .stage-head .crumb {
    display: none;
  }
  .post-title,
  .stage-body h2,
  .hero-body h2 {
    display: block;
    margin: 0;
    font-size: 22px;
    font-weight: 500;
    line-height: 1.08;
    letter-spacing: 0;
    max-width: none;
  }
  .post.expanded .post-title,
  .post:target .post-title {
    color: var(--signal);
  }
  .page h2,
  .page h3 {
    display: block;
    margin: 0 0 14px;
    font-size: 23px;
    font-weight: 500;
    line-height: 1.12;
    letter-spacing: 0;
    max-width: none;
  }
  .post .pages > .page:first-child h2:first-of-type {
    display: none;
  }
  .post .pages > .page:first-child > .cover-row:first-child,
  .post .pages > .page:first-child > .stack-row:first-child,
  .post .pages > .page:first-child h2:first-of-type + .prose {
    margin-top: 0;
  }

  .post-collapse {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    appearance: none;
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    background: var(--surface);
    color: var(--ink-3);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .post.expanded .post-collapse,
  .post:target .post-collapse {
    display: inline-flex;
  }
  .post-collapse:active {
    border-color: var(--signal);
    background: var(--signal-soft);
  }
  .post-collapse svg {
    width: 16px;
    height: 16px;
    display: block;
    stroke: currentColor;
  }

  .post-content {
    padding: 0 18px 24px;
    min-height: 0;
  }
  .post:not(.expanded):not(:target) .post-content {
    padding-top: 0;
  }
  .post:not(.expanded):not(:target) .post-content .cover-row,
  .post:not(.expanded):not(:target) .post-content .split-row,
  .post:not(.expanded):not(:target) .post-content .stack-row {
    display: block;
    margin-top: 0;
    gap: 0;
  }
  .post:not(.expanded):not(:target) .post-content .cover-text,
  .post:not(.expanded):not(:target) .post-content .split-text,
  .post:not(.expanded):not(:target) .post-content .stack-text {
    width: 100%;
    max-width: none;
  }
  .post:not(.expanded):not(:target) .post-content .page:not(:first-child),
  .post:not(.expanded):not(:target) .post-content .cover-art,
  .post:not(.expanded):not(:target) .post-content .prose > :not(p:first-of-type) {
    display: none;
  }
  .post:not(.expanded):not(:target) .post-content .workflow-figure[style] {
    display: none !important;
  }
  .post:not(.expanded):not(:target) .post-content .prose > p:first-of-type {
    display: -webkit-box;
    margin-bottom: 0;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
  }
  .post:not(.expanded):not(:target) .post-footer {
    display: none;
  }

  .pages {
    display: block;
    height: auto;
    min-height: 0;
    overflow: visible;
    scroll-snap-type: none;
  }
  .page {
    display: block;
    padding: 0;
    min-height: 0;
  }
  .page + .page {
    margin-top: 34px;
    padding-top: 26px;
    border-top: 1px solid var(--line);
  }

  .stage-body .lede,
  .hero-body .lede,
  .page .lede {
    margin: 18px 0 0;
    font-size: 17px;
    line-height: 1.5;
    color: var(--ink-2);
    max-width: none;
  }
  .stage-body .prose,
  .hero-body .prose,
  .page .prose {
    margin-top: 18px;
    font-size: 16px;
    line-height: 1.65;
    max-width: none;
    gap: 1em;
  }
  .pull-quote {
    margin: 24px 0;
    padding: 4px 0 4px 16px;
    font-size: 19px;
    line-height: 1.35;
  }
  .pull-quote .attribution {
    margin-top: 8px;
    font-size: 10.5px;
  }

  .post-footer {
    display: block;
    padding: 0 18px 24px;
    border-top: 0;
  }
  .stage-foot { display: none; }
  .post-footer .tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }
  .desktop-pager { display: none; }

  .hero-stage .post-header,
  .hero-stage .post-content {
    padding: 28px 18px 20px;
  }
  #about .stage-head {
    display: none;
  }
  #about .hero-stage {
    padding: 28px 18px 20px;
  }
  .hero-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
  }
  .hero-footnote { display: none; }
  .hero-art {
    width: min(70vw, 280px);
    align-self: center;
    margin: 0 auto 28px;
  }
  .hero-body .eyebrow { margin-bottom: 0; }
  .hero-body h2 {
    font-size: 40px;
    line-height: 0.98;
    letter-spacing: -0.022em;
  }
  .hero-body .contact {
    margin-top: 26px;
    margin-bottom: 120px;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    font-size: 12.5px;
  }

  .page .cover-row,
  .page .split-row,
  .page .stack-row {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 18px;
    padding: 0;
  }
  .page .cover-art,
  .page .split-row .split-figure,
  .page .split-row.split-row--media .split-text,
  .page .split-row .skills-card,
  .page .stack-row .stack-figure {
    width: 100%;
    max-width: none;
  }
  .page .cover-art:has(.code-block),
  .page .split-row .split-figure:has(.code-block),
  .page .stack-row .stack-figure:has(.code-block) {
    align-self: stretch;
    width: 100%;
  }
  .page .cover-art {
    align-self: center;
    width: min(74vw, 260px);
  }
  .page .split-row .split-text,
  .page .stack-row .stack-text {
    width: 100%;
  }
  .page img,
  .page video,
  .page svg {
    max-width: 100%;
    height: auto;
  }
  .page .split-row .split-figure video {
    width: 100%;
  }
  .page .triptych {
    grid-template-columns: 1fr;
    gap: 24px;
    margin-top: 28px;
  }
  .page .triptych .col-visual { max-width: 200px; }

  .code-block {
    max-width: 100%;
    padding: 18px 16px;
    border-radius: 10px;
    overflow-x: auto;
  }
  .code-block pre {
    font-size: 12.5px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }
  .workflow-figure,
  .page figure {
    max-width: 100%;
    overflow: hidden;
  }
  .page .workflow-figure[style] {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    width: 100% !important;
    margin: 1.4rem 0 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
  }
  .page .workflow-key[style] {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
    font-size: 11px !important;
  }
  .workflow-scroll {
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 8px;
  }
  .page .workflow-figure[style] > svg[style],
  .workflow-figure svg {
    flex: 0 0 auto !important;
    width: 620px !important;
    min-width: 620px;
    max-width: none !important;
  }

  @media (min-width: 560px) {
    .deck {
      padding-left: 24px;
      padding-right: 24px;
    }
    .post-header,
    .post-content,
    .post-footer {
      padding-left: 28px;
      padding-right: 28px;
    }
  }
}
}

@layer desktop {
/* =========================================================================
   Deep-link fade-in (two-class state machine)

   1. Inline <script> in <head> adds .deeplink-fade BEFORE first paint.
      The deck renders invisible from frame 0 — no flash.
   2. After deck.js positions the scroll, it adds .deeplink-ready on the
      next animation frame. The opacity transitions from 0 → 1 smoothly.
   3. Both classes are stripped once the transition finishes, so subsequent
      :target changes (sidebar clicks, scroll-driven hash updates) leave
     the deck untouched.
   ========================================================================= */
html.deeplink-fade .deck {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 360ms cubic-bezier(0.2, 0, 0, 1),
              transform 360ms cubic-bezier(0.2, 0, 0, 1);
}
html.deeplink-fade.deeplink-ready .deck {
  opacity: 1;
  transform: translateY(0);
}
}
