/* ---------- Tokens ---------- */
:root {
  --paper: #F5F6F3;
  --paper-raised: #FFFFFF;
  --ink: #1A1D24;
  --ink-soft: #4A5060;
  --ink-faint: #8A8F9A;
  --line: #E1E3DE;
  --teal: #0E6B63;
  --plum: #7C3A5C;
  --lamp: #C08A1E;
  --lamp-text: #8A5F0E;
  --lamp-glow: rgba(232, 176, 58, 0.28);
  --tag-work: #E3EFEC;
  --tag-found: #F1E6EC;
  --tag-school: #E7EAF3;
  --tag-teach: #F3ECDC;

  --font-display: "Newsreader", "Iowan Old Style", Georgia, serif;
  --font-body: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-code: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gutter: clamp(16px, 4vw, 56px);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

/* Lights off */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14161B;
    --paper-raised: #1C1F26;
    --ink: #ECEDE8;
    --ink-soft: #B4B8C2;
    --ink-faint: #7E8492;
    --line: #2B2F38;
    --teal: #5EC4B6;
    --plum: #D68FB3;
    --lamp: #F0B94A;
    --lamp-text: #F0B94A;
    --lamp-glow: rgba(240, 185, 74, 0.22);
    --tag-work: #1E3330;
    --tag-found: #36232E;
    --tag-school: #232838;
    --tag-teach: #352D1C;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #14161B;
  --paper-raised: #1C1F26;
  --ink: #ECEDE8;
  --ink-soft: #B4B8C2;
  --ink-faint: #7E8492;
  --line: #2B2F38;
  --teal: #5EC4B6;
  --plum: #D68FB3;
  --lamp: #F0B94A;
  --lamp-text: #F0B94A;
  --lamp-glow: rgba(240, 185, 74, 0.22);
  --tag-work: #1E3330;
  --tag-found: #36232E;
  --tag-school: #232838;
  --tag-teach: #352D1C;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.4s ease, color 0.4s ease;
}

h1, h2, h3, h4, p, ul, ol, dl, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
  border-radius: 4px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: var(--gutter); top: -60px; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 10px 16px;
  border-radius: var(--radius-sm); text-decoration: none;
}
.skip-link:focus { top: 12px; }

section, .site-footer { padding-inline: var(--gutter); }
section[id] { scroll-margin-top: 88px; }

/* Shared type */
.section-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.6rem, 7vw, 5.25rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.section-intro {
  max-width: 62ch;
  margin-top: 20px;
  color: var(--ink-soft);
}
.tok-c { color: var(--ink-faint); }
.tok-v { color: var(--plum); }
.tok-k { color: var(--teal); }
.tok-s { color: var(--lamp-text); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 18px var(--gutter);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(10px);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  transition: box-shadow 0.3s ease, background-color 0.4s ease;
}
.site-header.is-scrolled { box-shadow: 0 1px 0 var(--line); }

.brand {
  display: inline-flex; align-items: center; gap: 12px;
  text-decoration: none; min-height: 44px;
}
.brand-mark { width: 34px; height: 34px; color: var(--ink); }
.brand-dot { fill: var(--lamp); filter: drop-shadow(0 0 4px var(--lamp-glow)); }
.brand-name { font-family: var(--font-display); font-size: 1.3rem; letter-spacing: -0.01em; }

.site-nav ul { display: flex; gap: clamp(4px, 2vw, 28px); }
.site-nav a {
  --pad: 6px;
  position: relative;
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--pad);
  font-size: 0.98rem; color: var(--ink-soft); text-decoration: none;
  transition: color 0.2s ease;
}
/* Active section: a short teal bar under the label */
.site-nav a::after {
  content: ""; position: absolute; left: var(--pad); right: var(--pad); bottom: 9px;
  height: 2px; border-radius: 2px; background: var(--teal);
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.25s var(--ease-out);
}
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="true"] { color: var(--ink); font-weight: 500; }
.site-nav a[aria-current="true"]::after { transform: scaleX(1); }

@media (max-width: 640px) {
  .site-header { flex-direction: column; align-items: flex-start; gap: 0; padding-block: 10px 4px; }
  .site-nav { width: 100%; }
  .site-nav ul { justify-content: space-between; gap: 0; margin-inline: -4px; }
  .site-nav a { --pad: 9px; font-size: 0.92rem; }
}
@media (max-width: 360px) {
  .site-nav a { --pad: 7px; font-size: 0.86rem; }
}

/* ---------- Hero ---------- */
.hero {
  min-height: calc(100dvh - 80px);
  display: flex; flex-direction: column; justify-content: center;
  padding-block: 64px 96px;
}
.hero-name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(3.4rem, 12.5vw, 11rem);
  line-height: 0.92;
  letter-spacing: -0.035em;
  margin-left: -0.04em;
}
.hero-code {
  margin-top: clamp(28px, 4vw, 48px);
  font-family: var(--font-code);
  font-size: clamp(0.84rem, 1.25vw, 1rem);
  line-height: 1.95;
  color: var(--ink);
  max-width: 100%;
}
.code-line { overflow-wrap: anywhere; }

/* Typing: only where lines fit on one row and motion is welcome */
@media (min-width: 900px) and (prefers-reduced-motion: no-preference) {
  .js .hero-code .code-line {
    width: 0; overflow: hidden; white-space: nowrap;
    animation: type var(--dur, 1s) steps(var(--n, 40), end) var(--delay, 0s) forwards;
  }
}
@keyframes type { to { width: calc(var(--n) * 1ch); } }

.caret {
  display: inline-block; width: 0.6ch; height: 1.15em;
  margin-left: 2px; vertical-align: -0.2em;
  background: var(--lamp);
  box-shadow: 0 0 10px var(--lamp-glow);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .caret { animation: none; } }

/* ---------- Experience ---------- */
.experience { padding-block: 96px 120px; }

.exp-intro {
  display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 6vw, 96px);
  margin-top: 40px; max-width: 1240px;
}
.exp-intro p { max-width: 58ch; }
.exp-intro p + p { margin-top: 8px; }
.exp-intro .lead { font-weight: 600; }
@media (max-width: 800px) { .exp-intro { grid-template-columns: 1fr; gap: 16px; } }

.timeline { margin-top: 72px; }
/* Callout pointing visitors to the full resume */
.resume-callout {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px;
  margin-bottom: 40px; padding: 16px 20px;
  background: var(--tag-work);
  border: 1px solid color-mix(in srgb, var(--teal) 30%, transparent);
  border-radius: var(--radius-md);
  max-width: 760px;
}
.resume-callout svg { width: 26px; height: 26px; flex: none; fill: none; stroke: var(--teal); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.resume-callout p { flex: 1 1 260px; font-weight: 500; }
.resume-btn {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px;
  background: var(--ink); color: var(--paper); text-decoration: none;
  border-radius: var(--radius-sm); font-weight: 500; font-size: 0.95rem;
  transition: background-color 0.2s ease;
}
.resume-btn:hover { background: var(--teal); }
.timeline-head {
  display: flex; align-items: center; gap: 16px;
  font-size: 0.92rem; color: var(--ink-soft);
}
.ruler {
  flex: 1; height: 14px; min-width: 60px;
  background:
    radial-gradient(circle at 5px 50%, var(--teal) 4px, transparent 4.5px) no-repeat,
    repeating-linear-gradient(90deg, var(--ink-faint) 0 1px, transparent 1px 14px) 0 50% / 100% 8px no-repeat,
    repeating-linear-gradient(90deg, var(--ink-faint) 0 1px, transparent 1px 56px) 0 50% / 100% 14px no-repeat;
  opacity: 0.8;
}
.timeline-controls { display: flex; gap: 8px; margin-left: 8px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--paper-raised);
  transition: border-color 0.2s ease, transform 0.15s ease;
}
.icon-btn:hover { border-color: var(--ink-faint); }
.icon-btn:active { transform: scale(0.95); }
.icon-btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.icon-btn:disabled:hover { border-color: var(--line); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* Cards hang above (odd) and below (even) a shared branch line. Subgrid makes each
   side only as tall as the tallest card on that side. */
.timeline-track {
  position: relative;
  display: grid;
  grid-template-rows: auto 40px auto;
  grid-auto-flow: column;
  grid-template-columns: min(860px, 82vw);
  grid-auto-columns: 300px;
  column-gap: 20px;
  margin-top: 28px;
  margin-inline: calc(var(--gutter) * -1);
  padding: 24px var(--gutter) 40px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter);
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
/* The branch line every commit hangs from */
/* Absolutely positioned grid items need an explicit end line: plain `grid-row: 2`
   would stretch to the bottom of the grid and push the line into the lower cards. */
.timeline-track::before {
  content: ""; position: absolute; grid-row: 2 / 3;
  left: var(--gutter); top: 50%;
  width: calc(min(860px, 82vw) + 6 * 320px); height: 2px; margin-top: -1px;
  background: linear-gradient(90deg, var(--teal), color-mix(in srgb, var(--teal) 20%, transparent));
  pointer-events: none;
}
.commit {
  position: relative;
  grid-row: 1 / 4;
  display: grid; grid-template-rows: subgrid;
  scroll-snap-align: start;
}
.commit .card { grid-row: 1; align-self: end; }
.commit:nth-child(even) .card { grid-row: 3; align-self: start; }
.commit::before {
  content: ""; position: absolute; grid-row: 2 / 3; left: 28px; top: 50%;
  width: 11px; height: 11px; margin-top: -5.5px; z-index: 1;
  border-radius: 50%; background: var(--paper); border: 2px solid var(--teal);
}
.commit::after {
  content: ""; position: absolute; grid-row: 2 / 3; left: 33px; top: 0;
  width: 1.5px; height: 15px; background: var(--teal); opacity: 0.6;
}
.commit:nth-child(even)::after { top: 25px; }
.commit:first-child::before { background: var(--teal); box-shadow: 0 0 0 5px color-mix(in srgb, var(--teal) 18%, transparent); }

.card {
  width: 100%;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 22px 22px 24px;
  transition: border-color 0.25s ease;
}
.card:hover { border-color: color-mix(in srgb, var(--teal) 40%, var(--line)); }
.card-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 0.9rem; color: var(--ink-soft); }
.tag {
  font-family: var(--font-code); font-size: 0.78rem; letter-spacing: 0.02em;
  padding: 3px 9px; border-radius: var(--radius-sm); color: var(--ink);
}
.tag-work { background: var(--tag-work); }
.tag-found { background: var(--tag-found); }
.tag-school { background: var(--tag-school); }
.tag-teach { background: var(--tag-teach); }
.card h3 { font-family: var(--font-display); font-weight: 500; font-size: 1.55rem; line-height: 1.15; margin-top: 18px; letter-spacing: -0.01em; }
.card-role { color: var(--ink-soft); font-size: 0.95rem; margin-top: 4px; }
.card p:not(.card-role):not(.card-stack):not(.team-dates) { margin-top: 14px; font-size: 0.98rem; }
.card-stack { margin-top: 16px; font-size: 0.86rem; color: var(--ink-faint); }
.card-more { color: var(--ink-soft); }
.card-more a { color: var(--ink); text-decoration-color: var(--line); text-underline-offset: 3px; }
.card-more a:hover { text-decoration-color: currentColor; }

/* A role with more than one team: teams sit side by side, current first */
.teams { display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; }
.team { margin-top: 18px; padding-left: 14px; border-left: 2px solid var(--tag-work); }
.team-name { font-size: 0.98rem; font-weight: 600; line-height: 1.3; }
.team-wide { grid-column: 1 / -1; }
.team-org { font-weight: 400; color: var(--ink-faint); white-space: nowrap; }
.card .team .team-stack { margin-top: 8px; font-size: 0.86rem; color: var(--ink-faint); }
.team-dates { margin-top: 2px; font-size: 0.86rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.card .team p:not(.team-dates):not(.card-role) { margin-top: 6px; font-size: 0.95rem; }
.team-points { margin-top: 6px; }
.team-points li { position: relative; padding-left: 14px; font-size: 0.95rem; }
.team-points li + li { margin-top: 6px; }
.team-points li::before { content: ""; position: absolute; left: 1px; top: 0.62em; width: 5px; height: 5px; border-radius: 50%; background: var(--teal); }
.team-points strong { font-weight: 600; }

@media (max-width: 720px) {
  .timeline-head .ruler, .timeline-controls { display: none; }
  .timeline-head { justify-content: space-between; }
  .timeline-track {
    display: flex; flex-direction: column; overflow: visible; margin-inline: 0; padding: 24px 0 0 28px; gap: 16px;
  }
  .timeline-track::before { grid-row: auto; left: 5px; top: 0; bottom: 0; width: 2px; height: auto; margin-top: 0; background: linear-gradient(180deg, var(--teal), color-mix(in srgb, var(--teal) 15%, transparent)); }
  .commit, .commit:nth-child(even) { display: block; }
  .commit::before { grid-row: auto; left: -28px; top: 28px; margin-top: 0; }
  .teams { grid-template-columns: 1fr; }
  .commit::after, .commit:nth-child(even)::after { display: none; }
}

.code-link { margin-top: 32px; font-family: var(--font-code); font-size: 0.92rem; }
.code-link a { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; }
.code-link a:hover { text-decoration-color: currentColor; }

/* ---------- Work ---------- */
.work { padding-block: 96px 64px; }

.project {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(32px, 6vw, 96px); align-items: center;
  padding-block: 88px;
  max-width: 1320px;
}
.project + .project { border-top: 1px solid var(--line); }
.project-context { color: var(--ink-soft); font-size: 0.95rem; }
.project-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(1.9rem, 3.4vw, 2.75rem); line-height: 1.08; letter-spacing: -0.015em;
  margin-top: 8px; max-width: 18ch; text-wrap: balance;
}
@media (max-width: 900px) {
  .project { grid-template-columns: 1fr; padding-block: 64px; }
}

.tabs { margin-top: 28px; }
.tab-list { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tab-list [role="tab"] {
  position: relative; min-height: 44px; padding: 0 14px;
  background: none; border: 0;
  font-family: var(--font-code); font-size: 0.9rem; color: var(--ink-faint);
  transition: color 0.2s ease;
}
.tab-list [role="tab"]:first-child { padding-left: 0; }
.tab-list [role="tab"]:hover { color: var(--ink); }
.tab-list [role="tab"][aria-selected="true"] { color: var(--ink); }
.tab-list [role="tab"]::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px;
  background: var(--teal); transform: scaleX(0); transform-origin: left;
  transition: transform 0.3s var(--ease-out);
}
.tab-list [role="tab"]:first-child::after { left: 0; }
.tab-list [role="tab"][aria-selected="true"]::after { transform: scaleX(1); }
[role="tabpanel"] { padding-top: 20px; min-height: 9.5em; max-width: 56ch; color: var(--ink-soft); }
[role="tabpanel"]:not([hidden]) { animation: fade-in 0.35s var(--ease-out); }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) {
  [role="tabpanel"]:not([hidden]) { animation: none; }
}

.checks li { position: relative; padding-left: 28px; }
.checks li + li { margin-top: 10px; }
.checks li::before {
  content: ""; position: absolute; left: 2px; top: 0.45em;
  width: 13px; height: 7px;
  border-left: 2px solid var(--teal); border-bottom: 2px solid var(--teal);
  transform: rotate(-45deg);
}

.text-link {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-top: 8px;
  font-weight: 500; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 5px;
}
.text-link:hover { text-decoration-color: currentColor; }
.project-links { display: flex; flex-wrap: wrap; column-gap: 24px; margin-top: 8px; }
.project-links .text-link { margin-top: 0; }
.text-link svg, .social svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Visuals */
.project-visual {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  aspect-ratio: 4 / 3;
  display: grid; place-items: center;
  overflow: hidden;
}
.project-visual > svg { width: 100%; height: 100%; }

/* Project screenshots */
.visual-shot { background: var(--paper); padding: 0; place-items: stretch; }
.visual-shot img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.visual-stack { position: relative; }
.visual-stack img:last-child {
  position: absolute; right: 4%; bottom: 5%; width: 46%; height: auto; aspect-ratio: 4 / 3;
  border-radius: var(--radius-md); border: 1px solid var(--line);
  box-shadow: 0 18px 40px -22px rgba(26, 29, 36, 0.45);
}

/* ---------- Contact ---------- */
.contact {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(40px, 7vw, 120px);
  padding-block: 120px;
  border-top: 1px solid var(--line);
}
@media (max-width: 900px) { .contact { grid-template-columns: 1fr; } }
.contact-main > p:not(.email-row) { margin-top: 24px; max-width: 44ch; color: var(--ink-soft); }
.email-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 40px; }
.email {
  padding: 0; border: 0; background-color: transparent; color: inherit; cursor: pointer; text-align: left;
  font-family: var(--font-display); font-size: clamp(1.4rem, 3vw, 2.1rem);
  text-decoration: none; overflow-wrap: anywhere;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size 0.35s var(--ease-out);
}
.email:hover { background-size: 100% 1px; }
.social { display: flex; gap: 28px; margin-top: 32px; }
.social a { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; text-decoration: none; font-weight: 500; }
.social a:hover { color: var(--teal); }

.side-title { font-family: var(--font-display); font-weight: 400; font-size: 1.75rem; letter-spacing: -0.01em; }
.side-title:not(:first-child) { margin-top: 48px; }
.dash-list { margin-top: 16px; max-width: 62ch; }
.dash-list li { position: relative; padding-left: 26px; color: var(--ink-soft); }
.dash-list li + li { margin-top: 14px; }
.dash-list li::before { content: ""; position: absolute; left: 0; top: 0.8em; width: 14px; height: 1.5px; background: var(--teal); }
.stack-list { margin-top: 12px; max-width: 62ch; color: var(--ink-soft); }
.stack-groups { margin: 12px 0 0; max-width: 62ch; display: grid; gap: 8px; }
.stack-groups div { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 12px; align-items: baseline; }
.stack-groups dt { font-family: var(--font-code); font-size: 0.8rem; color: var(--ink-faint); }
.stack-groups dd { margin: 0; color: var(--ink-soft); }
@media (max-width: 480px) {
  .stack-groups div { grid-template-columns: 1fr; gap: 2px; }
}

/* Free-time photo row: three shapes, each a placeholder until its photo exists */
.free-photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(12px, 2vw, 24px); margin-top: 28px; max-width: 560px; align-items: end; }
.free-photo { margin: 0; }
.free-frame {
  position: relative; overflow: hidden;
  display: grid; place-items: center;
  aspect-ratio: 3 / 4;
}
.free-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.free-icon { width: 38%; height: auto; fill: none; stroke: var(--ink-soft); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.shape-arch .free-frame { border-radius: 999px 999px var(--radius-md) var(--radius-md); background: var(--tag-work); }
.shape-oval .free-frame { border-radius: 999px; background: var(--tag-teach); }
.shape-soft .free-frame { border-radius: 28px 6px 28px 6px; background: var(--tag-found); }

/* ---------- Footer ---------- */
.site-footer { padding-block: 96px 32px; }
.sign-off { display: flex; align-items: center; justify-content: space-between; gap: 32px; }
.sign-off-main { display: flex; flex-direction: column; align-items: flex-start; gap: 32px; }
.avatar {
  position: relative; flex: none;
  width: clamp(120px, 18vw, 260px); aspect-ratio: 1;
  border-radius: 50%; overflow: hidden;
  background: var(--tag-work);
  border: 4px solid var(--paper-raised);
  box-shadow: 0 0 0 1px var(--line), 0 12px 32px -18px rgba(26, 29, 36, 0.4);
  display: grid; place-items: center;
}
.avatar-placeholder { width: 46%; height: 46%; color: var(--ink); }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 640px) {
  .sign-off { flex-direction: column-reverse; align-items: flex-start; }
}
.sign-off-text {
  font-family: var(--font-display); font-size: clamp(3rem, 10vw, 8.5rem);
  line-height: 0.95; letter-spacing: -0.03em;
}
.message-btn {
  min-height: 52px; padding: 0 28px;
  background: transparent; border: 1.5px solid var(--ink);
  border-radius: var(--radius-sm);
  font-size: 1.02rem;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.message-btn:hover { background: var(--ink); color: var(--paper); }
.footer-meta {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;
  margin-top: 120px; padding-top: 20px; border-top: 1px solid var(--line);
  padding-right: 72px; /* keep "Back to top" clear of the floating lamp button */
  font-size: 0.92rem; color: var(--ink-soft);
}
.back-top { min-height: 44px; display: inline-flex; align-items: center; text-decoration-color: var(--line); text-underline-offset: 4px; }

/* ---------- Lamp ---------- */
.lamp {
  position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 30;
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
}
.lamp-btn {
  width: 56px; height: 56px; padding: 0; border: 0; border-radius: 50%;
  background: var(--paper-raised);
  box-shadow: 0 0 0 1px var(--line), 0 8px 24px -12px rgba(26, 29, 36, 0.35);
  transition: transform 0.2s var(--ease-out);
}
.lamp-btn:hover { transform: translateY(-2px); }
.lamp-btn:active { transform: scale(0.95); }
.lamp-btn svg { width: 36px; height: 36px; margin: auto; display: block; overflow: visible; }
.lamp-glow { fill: var(--lamp-glow); transition: opacity 0.4s ease, r 0.4s ease; }
.lamp-bulb { fill: var(--lamp); }
.lamp-base { fill: none; stroke: var(--ink-soft); stroke-width: 2; stroke-linecap: round; }
:root[data-theme="dark"] .lamp-glow { opacity: 0.25; }

.lamp-menu {
  display: flex; flex-direction: column;
  min-width: 220px; padding: 6px;
  background: var(--paper-raised);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-sm);
  box-shadow: -4px 4px 0 var(--ink);
  transform-origin: bottom right;
  animation: pop 0.22s var(--ease-out);
}
.lamp-menu[hidden] { display: none; }
@keyframes pop { from { opacity: 0; transform: scale(0.94) translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .lamp-menu { animation: none; } }
.lamp-menu > * {
  display: flex; align-items: center; min-height: 44px; padding: 0 12px;
  border: 0; background: none; border-radius: 4px;
  font-family: var(--font-code); font-size: 0.86rem; text-align: left; text-decoration: none;
}
.lamp-menu > *:hover { background: var(--paper); }

/* ---------- Message dialog ---------- */
.message-dialog {
  width: min(520px, calc(100vw - 32px));
  padding: 0; border: 1.5px solid var(--ink); border-radius: var(--radius-md);
  background: var(--paper-raised); color: var(--ink);
}
.message-dialog::backdrop { background: rgba(20, 22, 27, 0.45); }
.message-dialog[open] { animation: pop 0.25s var(--ease-out); }
.message-form { padding: 24px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; }
.dialog-head h2 { font-family: var(--font-display); font-weight: 400; font-size: 2rem; }
.dialog-help { margin-top: 4px; color: var(--ink-soft); font-size: 0.95rem; }
.field { margin-top: 20px; }
.field label { display: block; font-weight: 500; font-size: 0.95rem; margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; min-height: 48px; padding: 12px 14px;
  font: inherit; font-size: 1rem; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.field textarea { resize: vertical; }
.field input:focus-visible, .field textarea:focus-visible { outline-offset: 0; }
.field [aria-invalid="true"] { border-color: var(--plum); }
.field-error { color: var(--plum); font-size: 0.88rem; margin-top: 6px; min-height: 0; }
.field-error:empty { display: none; }
.primary-btn {
  margin-top: 24px; min-height: 48px; padding: 0 24px;
  background: var(--ink); color: var(--paper);
  border: 0; border-radius: var(--radius-sm); font-weight: 500;
}
.primary-btn:hover { background: var(--teal); }
