/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  /* Light — warm paper */
  --bg: #FFFFFF;
  --surface: #F6F3EC;
  --text: #1C1A15;
  --text-muted: #55504A;
  --text-subtle: #9A9488;
  --accent: #2563eb;
  --border: #E6E0D3;

  --font-display: 'Fraunces', 'PingFang SC', 'Hiragino Sans GB', Georgia, serif;
  --font: 'Instrument Sans', -apple-system, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;

  --text-xs: 13px;
  --text-sm: 15px;
  --text-base: 17px;
  --text-lg: 19px;
  --text-xl: 22px;
  --text-2xl: 26px;
  --text-3xl: 32px;
  --text-4xl: 40px;
}

[data-theme="dark"] {
  /* Dark — cool neutral */
  --bg: #000000;
  --surface: #0E1113;
  --text: #E8ECEF;
  --text-muted: #9BA3AB;
  --text-subtle: #6B727A;
  --accent: #4ade80;
  --border: #232A30;
}


/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: var(--text-base);
  -webkit-text-size-adjust: 100%;
}

html, body {
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

body {
  font-family: var(--font);
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  min-height: 100vh;
  padding: 0;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.transitions-ready * {
  transition: background-color 0.2s ease, color 0.2s ease,
    border-color 0.2s ease;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ============================================================
   WIP BANNER
   ============================================================ */
/* ============================================================
   LAYOUT
   ============================================================ */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 60px;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 48px 0;
}

/* ============================================================
   THEME TOGGLE — Floating round icon button
   ============================================================ */
.theme-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  user-select: none;
  line-height: 1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.theme-toggle input { display: none; }

.theme-toggle:hover {
  border-color: var(--accent);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
}

[data-theme="dark"] .theme-toggle {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .theme-toggle:hover {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
}

/* Show only the icon matching the current theme */
[data-theme="dark"]  .theme-toggle .icon-sun  { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ============================================================
   HERO BLOCK
   ============================================================ */
.hero-block {
  margin-bottom: 0;
}

.hero-bottom {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.hero-top-row {
  display: flex;
  gap: 28px;
  align-items: center;
}

.hero-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hero-affil {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-subtle);
  line-height: 1.5;
  letter-spacing: 0.01em;
  margin-top: 6px;
}

.hero-photo {
  width: 160px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  flex-shrink: 0;
  background-color: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.16);
}

[data-theme="dark"] .hero-photo {
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transform: scale(1.18);
}

.hero-photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  color: var(--text-subtle);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.4vw, 2.8rem);
  font-weight: 500;
  font-variation-settings: "opsz" 96, "SOFT" 50, "WONK" 0;
  letter-spacing: -0.015em;
  line-height: 1.05;
  color: var(--text);
}

.hero-title-sep {
  font-size: 0.8em;
  font-weight: 400;
  color: var(--text-subtle);
  margin: 0 0.3em;
  vertical-align: baseline;
}

.hero-title-zh {
  font-family: 'Noto Serif SC', serif;
  font-size: 0.75em;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--text);
  vertical-align: baseline;
}

/* ============================================================
   BIO
   ============================================================ */
.hero-bottom > .bio {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text);
  line-height: 1.65;
  margin: 0 0 0.7em 0;
  text-align: justify;
  hyphens: auto;
}
.hero-bottom > .bio:last-of-type { margin-bottom: 0; }

.hero-bottom > .bio a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.hero-bottom > .bio a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ============================================================
   SOCIAL LINKS
   ============================================================ */
.social-links {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
}

.social-icon + .social-icon {
  position: relative;
  padding-left: 17px;
}
.social-icon + .social-icon::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 1px;
  background: var(--border);
}

.social-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.social-icon svg {
  width: 14px;
  height: 14px;
  display: block;
  flex-shrink: 0;
}

.social-label {
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}

.social-icon:hover {
  color: var(--accent);
  text-decoration: none;
}

.social-icon:hover .social-label {
  border-bottom-color: var(--accent);
}

/* ============================================================
   SECTION HEADINGS
   ============================================================ */
.section-title {
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text);
  margin-bottom: 20px;
}

.research-prose p,
.contact-intro {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.7;
  margin: 0 0 0.8em 0;
  text-align: justify;
  hyphens: auto;
}
.research-prose p:last-child,
.contact-intro:last-of-type { margin-bottom: 0; }

/* ============================================================
   RESEARCH INTERESTS
   ============================================================ */
.interests-list.as-list {
  display: grid;
  grid-template-columns: minmax(200px, 280px) 1fr;
  row-gap: 14px;
  column-gap: 32px;
  align-items: baseline;
}

.interests-list.as-prose p {
  margin: 0 0 0.7em 0;
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text);
  line-height: 1.65;
  text-align: justify;
  hyphens: auto;
}
.interests-list.as-prose p:last-child { margin-bottom: 0; }

.interests-list.as-prose mark {
  background: transparent;
  color: var(--accent);
  font-weight: 600;
}


.interest-topic {
  font-weight: 600;
  font-size: var(--text-base);
  color: var(--text);
  letter-spacing: -0.005em;
}

.interest-desc {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.65;
}

.interest-desc:empty { display: none; }

/* ============================================================
   PUBLICATIONS
   ============================================================ */
.pub-list {
  display: flex;
  flex-direction: column;
}

.pub-item {
  display: flex;
  gap: 36px;
  align-items: center;
  padding: 32px 0;
  border-bottom: 1px solid var(--border);
}

.pub-item:first-child { padding-top: 8px; }
.pub-item:last-child  { border-bottom: none; padding-bottom: 8px; }

.pub-thumb {
  width: 500px;
  flex-shrink: 0;
  align-self: center;
  overflow: hidden;
}

.pub-thumb img {
  width: 100%;
  height: auto;
  display: block;
}

.pub-category {
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.pub-thumb-placeholder {
  width: 100%; height: 100%;
  background: var(--surface);
}

.pub-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.pub-topline {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  font-size: var(--text-sm);
  margin-bottom: 10px;
}

.pub-topline .pub-venue {
  font-family: var(--font);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-right: 2px;
}

.pub-topline a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.pub-topline a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.pub-topline-sep {
  color: var(--text-subtle);
  opacity: 0.5;
  user-select: none;
  font-weight: 400;
}

.pub-title {
  font-family: var(--font);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  letter-spacing: -0.012em;
  margin-bottom: 8px;
}

.pub-authors {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 12px;
}

.pub-authors strong {
  color: var(--text);
  font-weight: 700;
}

.pub-authors a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .15s, border-color .15s;
}

.pub-authors a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
  text-decoration: none;
}

.pub-summary {
  font-size: var(--text-sm);
  color: var(--text);
  line-height: 1.65;
  max-width: 580px;
}

.pub-tags {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.pub-tag {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 10px;
  border: 1px solid var(--border);
  text-decoration: none;
  transition: border-color .15s, background .15s;
  font-size: var(--text-xs);
  color: var(--text);
}

.pub-tag:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  text-decoration: none;
}

.pub-tag-marker {
  width: 5px;
  height: 5px;
  background: var(--text-subtle);
  flex-shrink: 0;
}

.pub-tag--production .pub-tag-marker,
.pub-tag--coverage .pub-tag-marker {
  background: var(--accent);
}

.pub-tag-logo {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.pub-tag-brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pub-tag-label {
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

.pub-tag--production .pub-tag-label,
.pub-tag--coverage .pub-tag-label {
  color: var(--accent);
}

.pub-tag-sep {
  width: 1px;
  height: 11px;
  background: var(--border);
  flex-shrink: 0;
}

.pub-tag-value {
  font-size: var(--text-xs);
  color: var(--text);
  font-weight: 500;
}

/* ============================================================
   EXPERIENCE
   ============================================================ */
.exp-list {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.exp-item {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 18px;
  align-items: baseline;
}

.exp-kind {
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-subtle);
  padding-top: 3px;
}

.exp-kind--accent { color: var(--accent); }

.exp-body { min-width: 0; }

.exp-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 3px;
}

.exp-title {
  font-weight: 700;
  color: var(--text);
  font-size: var(--text-base);
  line-height: 1.35;
}

.exp-period {
  font-family: var(--font);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-subtle);
  flex-shrink: 0;
  white-space: nowrap;
}

.exp-org {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.45;
  margin-bottom: 2px;
}

.exp-org-logo {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.exp-org a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .15s, border-color .15s;
}
.exp-org a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
  text-decoration: none;
}

.exp-note {
  color: var(--text);
  font-size: var(--text-sm);
  line-height: 1.6;
  margin-top: 4px;
}

/* ============================================================
   LIFE SECTION
   ============================================================ */
.life-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 8px;
}

.life-item {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.life-emoji {
  display: none;
}

.life-marker {
  width: 6px;
  height: 6px;
  background: var(--accent);
  flex-shrink: 0;
  position: relative;
  top: 7px;
}

.life-text {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  font-size: var(--text-xs);
  color: var(--text-subtle);
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  line-height: 1.6;
  text-align: center;
  letter-spacing: 0.04em;
}

.footer-cc {
  color: var(--accent);
  font-weight: 600;
}

.claude-logo {
  width: 14px;
  height: 14px;
  vertical-align: -3px;
  margin-right: 5px;
  display: inline-block;
  object-fit: contain;
}

/* ============================================================
   RESPONSIVE — MOBILE
   ============================================================ */
/* ── Tablet ── */
@media (max-width: 768px) {
  .container {
    padding: 28px 20px 40px;
  }

  .pub-item {
    gap: 24px;
  }

  .pub-thumb {
    width: 380px;
  }
}

/* ── Mobile ── */
@media (max-width: 600px) {
  :root {
    --text-xs:   12px;
    --text-sm:   14px;
    --text-base: 15px;
    --text-lg:   17px;
  }

  body {
    padding: 0;
  }

  .container {
    padding: 20px 18px 32px;
  }

  .hero-title {
    font-size: clamp(1.4rem, 6.5vw, 1.9rem);
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .hero-title-zh { letter-spacing: 0.03em; }

  .hero-bottom { gap: 22px; }

  .hero-top-row {
    gap: 20px;
  }

  .hero-photo {
    width: 120px;
  }

  .hero-bottom > .bio {
    font-size: var(--text-sm);
    text-align: left;
    hyphens: none;
  }

  .hero-affil {
    font-size: var(--text-xs);
    line-height: 1.45;
  }

  .social-links {
    gap: 14px;
    flex-wrap: wrap;
  }

  .social-icon + .social-icon::before {
    display: none;
  }
  .social-icon + .social-icon { padding-left: 0; }

  .section-title {
    font-size: var(--text-sm);
    margin-bottom: 16px;
  }

  .interests-list {
    grid-template-columns: 1fr;
    row-gap: 4px;
  }

  .interest-topic { margin-top: 8px; }
  .interest-topic:first-child { margin-top: 0; }

  .interest-desc {
    font-size: var(--text-sm);
    margin-bottom: 4px;
  }

  .interests-list.as-prose p {
    text-align: left;
    hyphens: none;
  }

  .pub-item {
    flex-direction: column;
    gap: 22px;
    padding: 28px 0;
  }

  .pub-thumb {
    width: 100%;
    transform: none;
  }

  .pub-thumb:hover {
    transform: translateY(-2px);
  }

  .pub-eyebrow { font-size: var(--text-xs); }
  .pub-eyebrow::before { width: 18px; }

  .pub-title {
    font-size: 22px;
    line-height: 1.2;
  }

  .pub-authors {
    font-size: var(--text-xs);
  }

  .pub-summary {
    font-size: var(--text-xs);
  }

  .pub-actions { font-size: var(--text-xs); }
  .pub-footer  { font-size: var(--text-xs); padding-left: 14px; }

  .life-text {
    font-size: var(--text-sm);
  }

  hr {
    margin: 28px 0;
  }

  .theme-toggle {
    width: 40px;
    height: 40px;
    bottom: 18px;
    right: 18px;
    font-size: 16px;
  }

  .site-footer {
    font-size: 11px;
    margin-top: 32px;
    padding-top: 16px;
  }
}

/* ── Narrow phones — stack hero vertically ── */
@media (max-width: 480px) {
  .hero-top-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
  }

  .hero-photo {
    width: 110px;
  }

  .hero-meta {
    width: 100%;
    gap: 8px;
  }
}

/* ── Very small screens ── */
@media (max-width: 380px) {
  .container {
    padding: 48px 14px 28px;
  }

  .hero-title {
    font-size: 1.3rem;
  }

  .hero-photo {
    width: 100px;
  }

  .theme-toggle {
    width: 36px;
    height: 36px;
    bottom: 14px;
    right: 14px;
    font-size: 14px;
  }
}

/* ============================================================
   NOTES PAGE — Reading Notebook
   ============================================================ */
.notes-page .container {
  max-width: none;
  margin: 0;
  padding: 32px 40px 80px;
}

.notes-page .notes-breadcrumb { margin-bottom: 28px; }
.notes-page .notes-header {
  margin-bottom: 64px;
  max-width: 720px;
}
.notes-page .notes-stream { max-width: 680px; }
.notes-page .notes-footer { max-width: 720px; }

/* Breadcrumb */
.notes-breadcrumb {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  margin-bottom: 72px;
  display: flex;
  align-items: center;
  gap: 0;
}
.notes-breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.18s, border-color 0.18s;
  padding-bottom: 1px;
}
.notes-breadcrumb a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
  text-decoration: none;
}
.notes-breadcrumb .divider {
  margin: 0 10px;
  color: var(--text-subtle);
  font-weight: 300;
}
.notes-breadcrumb .current {
  color: var(--text);
  font-weight: 600;
}

/* Header */
.notes-header {
  margin-bottom: 88px;
}
.notes-title {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 144, 'SOFT' 60, 'WONK' 1;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(3.2rem, 9vw, 5.2rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 18px;
}
.notes-sub {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 14;
  font-style: italic;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.005em;
  color: var(--text-muted);
  margin: 0;
  max-width: 44ch;
}

/* Stream of notes */
.notes-stream {
  display: flex;
  flex-direction: column;
  gap: 104px;
  margin-bottom: 120px;
}

/* Individual note */
.note {
  position: relative;
  opacity: 0;
  transform: translateY(12px);
  animation: note-enter 0.7s cubic-bezier(0.2, 0.65, 0.3, 1) forwards;
  animation-delay: var(--stagger, 0ms);
}

@keyframes note-enter {
  to { opacity: 1; transform: translateY(0); }
}

.note-index {
  display: block;
  margin-bottom: 10px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--accent);
  text-transform: uppercase;
  white-space: nowrap;
}

.note-meta {
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.note-meta-dot {
  width: 3px;
  height: 3px;
  background: var(--border);
  border-radius: 50%;
  display: inline-block;
}
.note-tags { color: var(--text-muted); }

.note-title {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 72, 'SOFT' 20;
  font-weight: 500;
  font-size: clamp(1.5rem, 3.3vw, 2.1rem);
  line-height: 1.18;
  letter-spacing: -0.018em;
  color: var(--text);
  margin: 0 0 30px;
}
.note-title em {
  font-style: italic;
  font-variation-settings: 'opsz' 72, 'SOFT' 60, 'WONK' 1;
}

.note-body {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 14;
  font-weight: 400;
  font-size: 17.5px;
  line-height: 1.68;
  color: var(--text);
}
.note-body p { margin: 0; }
.note-body p + p,
.note-body p + blockquote,
.note-body blockquote + p {
  margin-top: 1.1em;
}

/* Drop cap on the first paragraph (lede) */
.note-body .lede::first-letter {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 144, 'SOFT' 60, 'WONK' 1;
  font-weight: 500;
  font-style: normal;
  font-size: 3.6em;
  float: left;
  line-height: 0.85;
  padding: 8px 10px 0 0;
  color: var(--accent);
}

.note-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  transition: text-decoration-color 0.15s;
}
.note-body a:hover {
  text-decoration-color: var(--accent);
}

.note-body em {
  font-style: italic;
  font-variation-settings: 'opsz' 14, 'SOFT' 60, 'WONK' 1;
}

.note-body strong {
  font-weight: 600;
  color: var(--text);
}

.note-body blockquote {
  font-style: italic;
  font-variation-settings: 'opsz' 18, 'SOFT' 60;
  color: var(--text-muted);
  border-left: 2px solid var(--border);
  padding: 2px 0 2px 20px;
  margin: 1.4em 0;
  font-size: 17px;
  line-height: 1.55;
}

/* Placeholder strip under the page header */
.notes-placeholder-strip {
  margin-top: 28px;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border: 1px dashed var(--border);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  border-radius: 2px;
  max-width: 100%;
}
.notes-placeholder-mark {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 2px 8px;
  border: 1px solid var(--accent);
  border-radius: 2px;
  white-space: nowrap;
  flex-shrink: 0;
}
.notes-placeholder-text {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text-muted);
}

/* Per-entry placeholder marker */
.note-placeholder-tag {
  display: inline-block;
  font-family: var(--font);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 2px 7px;
  border: 1px solid var(--accent);
  border-radius: 2px;
}

/* Soften the body text for placeholder entries so readers notice */
.note.is-placeholder .note-title,
.note.is-placeholder .note-body {
  opacity: 0.72;
}

.notes-empty {
  font-family: var(--font);
  color: var(--text-muted);
  font-size: 15px;
}
.notes-empty code {
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 13px;
  border: 1px solid var(--border);
}

.notes-footer {
  margin-top: 40px;
}

/* Tablet */
@media (max-width: 900px) {
  .notes-page .container { padding: 28px 28px 64px; }
  .notes-page .notes-header { margin-bottom: 52px; }
  .notes-stream { gap: 80px; }
}

/* Mobile */
@media (max-width: 600px) {
  .notes-page .container { padding: 20px 20px 56px; }
  .notes-page .notes-breadcrumb { margin-bottom: 20px; }
  .notes-page .notes-header { margin-bottom: 40px; }
  .notes-title {
    font-size: clamp(2.6rem, 12vw, 3.6rem);
  }
  .notes-sub { font-size: 15px; }
  .notes-stream { gap: 64px; }
  .note-body { font-size: 16.5px; line-height: 1.65; }
  .note-body .lede::first-letter { font-size: 3em; padding: 6px 8px 0 0; }
}

/* ============================================================
   GALLERY PAGE — Editorial grid (portraits tall, landscapes wide)
   Flush-left full viewport; plates click into a lightbox overlay.
   ============================================================ */
.gallery-page .container {
  --page-pad: 40px;
  max-width: none;
  margin: 0;
  padding: 32px var(--page-pad) 80px;
}

.gallery-page .notes-breadcrumb { margin-bottom: 28px; }
.gallery-page .notes-header {
  margin-bottom: 40px;
  max-width: 720px;
}

/* Chapter-row editorial layout — alternating hero / flat rows drive rhythm.
   hero-left + flat-row + hero-right + flat-row cycles consume photos in
   groups of 18; widest photo in each 5-photo hero chunk earns the big slot. */
.gallery-stream {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 72px;
  transition: filter 0.35s ease, opacity 0.35s ease;
}

.chapter {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
/* Same 4-col track for every chapter so vertical gutters line up across
   the whole gallery. Hero size comes from spanning 2 cols + 2 rows. */
.chapter.hero-left  > .plate-hero { grid-column: 1 / span 2; grid-row: 1 / span 2; }
.chapter.hero-right > .plate-hero { grid-column: 3 / span 2; grid-row: 1 / span 2; }

.plate {
  position: relative;
  width: 100%;
  margin: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px);
  animation: note-enter 0.7s cubic-bezier(0.2, 0.65, 0.3, 1) forwards;
  animation-delay: var(--stagger, 0ms);
}
/* Only thumbs declare an aspect-ratio. Hero gets its size from spanning
   2 thumb rows + the gap — so thumb heights stay identical across hero
   rows and flat rows, and the gutters line up across chapters regardless
   of gap size. */
.plate-thumb { aspect-ratio: 4 / 3; }

/* Hover focus: when one plate is held, others desaturate + blur. */
.gallery-stream.has-focus .plate {
  transition: filter 0.4s ease, transform 0.4s ease, opacity 0.4s ease;
  filter: blur(5px) brightness(0.55);
  opacity: 0.85;
}
.gallery-stream.has-focus .plate.plate-focused {
  filter: none;
  opacity: 1;
  transform: scale(1.015);
  z-index: 2;
}

/* Image button (clickable) */
.plate-btn {
  all: unset;
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  cursor: zoom-in;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  box-sizing: border-box;
}
.plate-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
[data-theme="dark"] .plate-btn { box-shadow: 0 14px 40px -22px rgba(0, 0, 0, 0.5); }
[data-theme="light"] .plate-btn { box-shadow: 0 12px 30px -22px rgba(0, 0, 0, 0.22); }

.plate-btn img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  transition: transform 0.5s ease, filter 0.35s ease;
}
.plate-btn:hover img { transform: scale(1.03); }

/* Overlay meta — shown on hover or when plate is focused. Each chip has its
   own translucent pill so the text stays readable on any background. */
.plate-overlay {
  position: absolute;
  left: 10px;
  bottom: 10px;
  right: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s, transform 0.25s;
  pointer-events: none;
}
.plate-btn:hover .plate-overlay,
.plate-btn:focus-visible .plate-overlay,
.plate.plate-focused .plate-overlay {
  opacity: 1;
  transform: translateY(0);
}
.plate-overlay-loc,
.plate-overlay-date {
  padding: 4px 9px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(8px) saturate(1.1);
  -webkit-backdrop-filter: blur(8px) saturate(1.1);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
  line-height: 1;
}
.plate-overlay-loc { color: var(--accent); }
.plate-overlay-date { color: #ffffff; }

.plate-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

/* ============================================================
   LIGHTBOX — full-screen photo viewer
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 48px 64px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(18px) saturate(1.1);
  -webkit-backdrop-filter: blur(18px) saturate(1.1);
  opacity: 0;
  transition: opacity 0.25s ease;
}
body.lightbox-open .lightbox {
  display: flex;
  opacity: 1;
}
body.lightbox-open {
  overflow: hidden;
}
body.lightbox-open .gallery-stream,
body.lightbox-open .notes-header,
body.lightbox-open .notes-breadcrumb,
body.lightbox-open .notes-footer,
body.lightbox-open .theme-toggle {
  filter: blur(12px);
  opacity: 0.45;
  pointer-events: none;
  transition: filter 0.35s ease, opacity 0.35s ease;
}

.lightbox-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  max-width: 100%;
  max-height: 100%;
}
.lightbox-frame {
  display: inline-block;
  line-height: 0;
  animation: lb-zoom 0.35s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.lightbox-img {
  max-width: min(1400px, 92vw);
  max-height: 80vh;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
  box-shadow: 0 32px 80px -20px rgba(0, 0, 0, 0.45);
  border-radius: 2px;
}
@keyframes lb-zoom {
  from { opacity: 0; transform: scale(0.98); }
  to   { opacity: 1; transform: scale(1); }
}

.lightbox-caption {
  max-width: 720px;
  text-align: center;
  color: var(--text);
  font-family: var(--font);
}
.lb-meta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-subtle);
}
.lb-meta .lb-loc { color: var(--accent); }
.lb-meta .lb-dot {
  width: 3px; height: 3px;
  background: var(--border);
  border-radius: 50%;
}
.lb-title {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 36, 'SOFT' 20;
  font-weight: 500;
  font-size: 20px;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 4px;
}
.lb-caption {
  font-family: var(--font);
  font-weight: 500;
  font-size: 14px;
  line-height: 1.2;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.lb-caption::before { content: '[ '; color: var(--text-subtle); }
.lb-caption::after  { content: ' ]'; color: var(--text-subtle); }

/* Close + nav buttons */
.lightbox-close,
.lightbox-nav {
  position: absolute;
  background: color-mix(in srgb, var(--surface) 75%, transparent);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-family: var(--font);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  user-select: none;
}
.lightbox-close {
  top: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  font-size: 26px;
  padding-bottom: 3px;
}
.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  font-size: 28px;
  padding-bottom: 4px;
}
.lightbox-prev { left: 18px; }
.lightbox-next { right: 18px; }
.lightbox-close:hover,
.lightbox-nav:hover {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--accent);
}

@media (max-width: 1100px) {
  /* Tablet landscape: shrink gutters a touch so thumbs don't get cramped */
  .chapter { gap: 8px; }
  .gallery-stream { gap: 8px; }
}

@media (max-width: 800px) {
  .gallery-page .container { --page-pad: 20px; padding: 28px var(--page-pad) 56px; }
  .gallery-page .notes-breadcrumb { margin-bottom: 20px; }
  .gallery-page .notes-header { margin-bottom: 28px; }
  .gallery-stream { margin-bottom: 56px; }

  /* Below 800px: drop to 2-col base. Hero spans full width as its own row,
     thumbs fill 2×2 below. Consistent grid across all chapter types so
     vertical gutters still line up. */
  .chapter {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  .gallery-stream { gap: 6px; }
  .chapter.hero-left  > .plate-hero,
  .chapter.hero-right > .plate-hero {
    grid-column: 1 / span 2;
    grid-row: auto;
    aspect-ratio: 3 / 2;
  }

  .lightbox { padding: 16px; }
  .lightbox-close { top: 14px; right: 14px; }
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
  .lightbox-img { max-height: 72vh; }
  .lightbox-stage { gap: 14px; }
}

@media (max-width: 500px) {
  .gallery-page .container { padding-top: 20px; padding-bottom: 44px; }
  .gallery-page .notes-header { margin-bottom: 22px; }
  .gallery-stream { margin-bottom: 40px; }

  /* Phone: single column, portrait-friendly. Keep aspect ratios so all
     images stay uncropped vertically. */
  .chapter {
    grid-template-columns: 1fr;
    gap: 5px;
  }
  .gallery-stream { gap: 5px; }
  .chapter.hero-left  > .plate-hero,
  .chapter.hero-right > .plate-hero {
    grid-column: auto;
    grid-row: auto;
  }

  .plate-overlay { left: 8px; right: 8px; bottom: 8px; }
  .plate-overlay-loc,
  .plate-overlay-date {
    font-size: 10px;
    padding: 3px 7px;
  }

  /* Phone lightbox: image fills most of the viewport, prev/next sit in a
     horizontal pair at the bottom instead of overlapping the photo. */
  .lightbox { padding: 16px 12px 88px; }
  .lightbox-close { top: 10px; right: 10px; width: 40px; height: 40px; font-size: 22px; }
  .lightbox-img { max-width: calc(100vw - 24px); max-height: 58vh; }
  .lightbox-nav {
    top: auto;
    bottom: 20px;
    transform: none;
    width: 48px;
    height: 48px;
    font-size: 22px;
  }
  .lightbox-prev { left: calc(50% - 58px); right: auto; }
  .lightbox-next { right: calc(50% - 58px); left: auto; }
}

@media (hover: hover) {
  .gallery-stream .plate { transition: filter 0.35s ease, transform 0.35s ease; }
}

@media (hover: none) {
  /* Touch devices: show overlay permanently, disable hover-based effects */
  .plate-overlay { opacity: 1; transform: none; }
  .plate-btn:hover img { transform: none; }
  .gallery-stream.has-focus .plate {
    filter: none;
    opacity: 1;
  }
  .gallery-stream.has-focus .plate.plate-focused {
    transform: none;
  }
}
