/* ============================================================================
   Larry Zhang — personal site
   Built on foliate's default stylesheet, restyled for an academic homepage
   with light/dark theming.
   ============================================================================ */

/* ============================================================================
   THEME TOKENS
   ============================================================================ */

:root {
  /* Brand */
  --color-primary: #1c3d5a;
  --color-primary-dark: #14507d;
  --color-secondary: #b0642a;
  --color-accent: #7c4ddb;

  /* Typography */
  --font-family-sans: "Source Sans 3", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-family-display: "Literata", Palatino, "Book Antiqua", Georgia, serif;
  --font-family-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --font-family-serif: Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;

  /* Surfaces & text */
  --text-primary: #1b1d21;
  --text-secondary: #4a5057;
  --text-muted: #82888f;
  --background-primary: #fdfcfa;
  --background-panel: #ffffff;
  --background-code: #f1efeb;
  --background-subtle: #f5f3f0;
  --border-light: #e5e1da;
  --border-medium: #cdc7bd;
  --shadow-soft: 0 1px 2px rgba(27, 29, 33, 0.04), 0 8px 24px rgba(27, 29, 33, 0.05);
  --overlay-scrim: rgba(27, 29, 33, 0.38);
}

:root[data-theme="dark"] {
  --color-primary: #a8c7e6;
  --color-primary-dark: #93bce0;
  --color-secondary: #e0a06a;
  --color-accent: #b79bff;

  --text-primary: #e6e5e2;
  --text-secondary: #b3b1ac;
  --text-muted: #8a8884;
  --background-primary: #16181b;
  --background-panel: #1e2125;
  --background-code: #24272c;
  --background-subtle: #22262a;
  --border-light: #2e3237;
  --border-medium: #3d4248;
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  --overlay-scrim: rgba(0, 0, 0, 0.6);
}

/* ============================================================================
   BASE
   ============================================================================ */

html {
  font-size: 16px;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  width: 90%;
  max-width: 820px;
  padding: 0 5%;
  margin: 0 auto;
  font-family: var(--font-family-sans);
  font-size: 1.08rem;
  background-color: var(--background-primary);
  color: var(--text-primary);
  line-height: 1.7;
  overflow-x: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

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

article {
  padding: 2.5rem 0 1rem;
  width: 100%;
}

section {
  padding: 0.5rem 0;
  width: 100%;
}

/* ============================================================================
   TYPOGRAPHY
   ============================================================================ */

p {
  margin: 1.15rem 0;
  width: 100%;
}

h1 + p {
  margin-top: 0.6rem;
}

header h1 {
  font-family: var(--font-family-display);
  font-size: 2.1rem;
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 0.4rem;
}

section h1, .content h1, h1 {
  font-family: var(--font-family-display);
  font-size: 1.8rem;
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 2rem;
  margin-bottom: 0.8rem;
}

h2 {
  font-family: var(--font-family-display);
  color: var(--color-primary);
  font-weight: 600;
  font-size: 1.42rem;
  letter-spacing: -0.01em;
  margin-top: 2.4rem;
  margin-bottom: 0.7rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-light);
}

h3 {
  font-family: var(--font-family-sans);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1.16rem;
  margin-top: 1.8rem;
  margin-bottom: 0.4rem;
}

h4 {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 1.06rem;
  margin-top: 1.4rem;
  margin-bottom: 0.3rem;
}

h5, h6 {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 1rem;
}

strong { font-weight: 600; }

kbd {
  font-family: var(--font-family-mono);
  font-size: 0.82em;
  padding: 0.1em 0.4em;
  border: 1px solid var(--border-medium);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--background-code);
  color: var(--text-secondary);
}

/* ============================================================================
   LISTS
   ============================================================================ */

ul, ol {
  padding-left: 1.5rem;
  overflow-wrap: break-word;
}

li:not(:first-child) {
  margin-top: 0.3rem;
}

li {
  overflow-wrap: break-word;
  hyphens: auto;
}

li > ul, li > ol {
  margin-top: 0.3rem;
}

/* ============================================================================
   BLOCK ELEMENTS
   ============================================================================ */

blockquote {
  margin: 1.4rem 0;
  padding: 0.2rem 0 0.2rem 1.4rem;
  border-left: 3px solid var(--border-medium);
  color: var(--text-secondary);
}

blockquote p:first-child { margin-top: 0; }
blockquote p:last-child { margin-bottom: 0; }

table {
  margin: 1.4rem 0;
  border-collapse: collapse;
  width: 100%;
  font-size: 0.96rem;
}

th, td {
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border-light);
  text-align: left;
}

th {
  background-color: var(--background-code);
  font-weight: 600;
}

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

/* ============================================================================
   IMAGES & FIGURES
   ============================================================================ */

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

.content p > img {
  display: block;
  margin-left: auto;
  margin-right: auto;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-sizing: border-box;
}

figure {
  margin: 2rem 0;
  padding: 0;
  max-width: 100%;
  overflow-x: auto;
}

figcaption {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-align: center;
}

/* ============================================================================
   CODE
   ============================================================================ */

pre {
  margin: 1.4rem 0;
  padding: 1rem;
  background: var(--background-code);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  overflow-x: auto;
}

pre > code {
  font-size: 0.9rem;
  display: block;
}

code {
  font-family: var(--font-family-mono);
  font-size: 0.88em;
  background: var(--background-code);
  padding: 0.12em 0.36em;
  border-radius: 4px;
}

pre > code, .highlight code, .codehilite code {
  background: none;
  padding: 0;
}

.codehilite,
.highlight {
  width: 100%;
  padding: 0;
  background: var(--background-code);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  margin: 1.4rem 0;
  overflow-x: auto;
}

.codehilite pre,
.highlight pre {
  margin: 0;
  padding: 1rem;
  background: none;
  border: none;
  border-radius: 0;
}

/* Pygments syntax highlighting (friendly theme) */
.highlight .c { color: #60A0B0; font-style: italic } /* Comment */
.highlight .err { border: 1px solid #F00 } /* Error */
.highlight .k { color: #007020; font-weight: bold } /* Keyword */
.highlight .o { color: #666 } /* Operator */
.highlight .ch { color: #60A0B0; font-style: italic }
.highlight .cm { color: #60A0B0; font-style: italic }
.highlight .cp { color: #007020 }
.highlight .c1 { color: #60A0B0; font-style: italic }
.highlight .cs { color: #60A0B0; background-color: #FFF0F0 }
.highlight .gd { color: #A00000 }
.highlight .ge { font-style: italic }
.highlight .gr { color: #F00 }
.highlight .gh { color: #000080; font-weight: bold }
.highlight .gi { color: #00A000 }
.highlight .go { color: #888 }
.highlight .gp { color: #C65D09; font-weight: bold }
.highlight .gs { font-weight: bold }
.highlight .gu { color: #800080; font-weight: bold }
.highlight .gt { color: #04D }
.highlight .kc { color: #007020; font-weight: bold }
.highlight .kd { color: #007020; font-weight: bold }
.highlight .kn { color: #007020; font-weight: bold }
.highlight .kp { color: #007020 }
.highlight .kr { color: #007020; font-weight: bold }
.highlight .kt { color: #902000 }
.highlight .m { color: #40A070 }
.highlight .s { color: #4070A0 }
.highlight .na { color: #4070A0 }
.highlight .nb { color: #007020 }
.highlight .nc { color: #0E84B5; font-weight: bold }
.highlight .no { color: #60ADD5 }
.highlight .nd { color: #555; font-weight: bold }
.highlight .ni { color: #D55537; font-weight: bold }
.highlight .ne { color: #007020 }
.highlight .nf { color: #06287E }
.highlight .nl { color: #002070; font-weight: bold }
.highlight .nn { color: #0E84B5; font-weight: bold }
.highlight .nt { color: #062873; font-weight: bold }
.highlight .nv { color: #BB60D5 }
.highlight .ow { color: #007020; font-weight: bold }
.highlight .w { color: #BBB }
.highlight .mb, .highlight .mf, .highlight .mh, .highlight .mi, .highlight .mo,
.highlight .il { color: #40A070 }
.highlight .sa, .highlight .sb, .highlight .sc, .highlight .dl, .highlight .s2,
.highlight .sh, .highlight .s1 { color: #4070A0 }
.highlight .sd { color: #4070A0; font-style: italic }
.highlight .se { color: #4070A0; font-weight: bold }
.highlight .si { color: #70A0D0; font-style: italic }
.highlight .sx { color: #C65D09 }
.highlight .sr { color: #235388 }
.highlight .ss { color: #517918 }
.highlight .bp { color: #007020 }
.highlight .fm { color: #06287E }
.highlight .vc, .highlight .vg, .highlight .vi, .highlight .vm { color: #BB60D5 }

/* Syntax colors readable on the dark surface */
:root[data-theme="dark"] .highlight .c,
:root[data-theme="dark"] .highlight .cm,
:root[data-theme="dark"] .highlight .c1,
:root[data-theme="dark"] .highlight .ch { color: #7fb3c8 }
:root[data-theme="dark"] .highlight .k,
:root[data-theme="dark"] .highlight .kc,
:root[data-theme="dark"] .highlight .kd,
:root[data-theme="dark"] .highlight .kn,
:root[data-theme="dark"] .highlight .kr,
:root[data-theme="dark"] .highlight .ow { color: #7ec699 }
:root[data-theme="dark"] .highlight .s,
:root[data-theme="dark"] .highlight .s1,
:root[data-theme="dark"] .highlight .s2,
:root[data-theme="dark"] .highlight .sd { color: #9cc4e4 }
:root[data-theme="dark"] .highlight .nf,
:root[data-theme="dark"] .highlight .fm { color: #82aaff }
:root[data-theme="dark"] .highlight .nc,
:root[data-theme="dark"] .highlight .nn { color: #6cb6d9 }
:root[data-theme="dark"] .highlight .o { color: #b3b1ac }
:root[data-theme="dark"] .highlight .cs { background-color: transparent }

/* ============================================================================
   LINKS
   ============================================================================ */

a {
  color: var(--color-primary-dark);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

a:hover {
  color: var(--color-secondary);
  border-bottom-color: currentColor;
}

a.wikilink {
  color: var(--color-accent);
}

a.wikilink:hover {
  color: var(--color-secondary);
}

/* Wikilink to a page that doesn't exist (or isn't public) yet. */
.wikilink-private {
  color: var(--text-muted);
  border-bottom: 1px dashed var(--border-medium);
  cursor: help;
}

/* Header anchor links */
.header-anchor {
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: none;
  margin-left: 0.4em;
  font-weight: normal;
  opacity: 0;
  transition: opacity 0.15s ease-in-out;
}

h1:hover .header-anchor,
h2:hover .header-anchor,
h3:hover .header-anchor,
h4:hover .header-anchor,
h5:hover .header-anchor,
h6:hover .header-anchor {
  opacity: 1;
}

.header-anchor:hover {
  color: var(--color-secondary);
  border-bottom: none;
}

/* ============================================================================
   NAVIGATION
   ============================================================================ */

nav.top-nav {
  position: relative;
  padding: 1.1rem 0 0.9rem;
  font-family: var(--font-family-sans);
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 0.5rem;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-wordmark {
  font-family: var(--font-family-display);
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  border-bottom: none;
  white-space: nowrap;
}

.site-wordmark:hover {
  color: var(--color-secondary);
  border-bottom: none;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--text-secondary);
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  border-bottom: none;
  white-space: nowrap;
}

.nav-links a:hover {
  color: var(--text-primary);
  background: var(--background-subtle);
  border-bottom: none;
}

.nav-logo {
  height: 1.15em;
  width: auto;
  vertical-align: middle;
  margin: 0 0.25rem 2px 0;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 34px;
  height: 34px;
  padding: 0 7px;
  background: none;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  cursor: pointer;
}

.nav-toggle-bar {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text-secondary);
  border-radius: 1px;
}

.nav-icon-button,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  background: none;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.nav-icon-button:hover,
.theme-toggle:hover {
  background: var(--background-subtle);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.nav-icon-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* ============================================================================
   HOME HERO
   ============================================================================ */

.home-hero {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  margin: 0.5rem 0 1.5rem;
}

.home-hero-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.home-hero-copy p:first-child {
  margin-top: 0;
  font-family: var(--font-family-display);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--text-primary);
}

.home-hero-copy p:first-child strong { font-weight: 600; }

.home-hero-photo {
  flex: 0 0 auto;
  width: 190px;
  max-width: 38%;
}

.content .home-hero-photo img.profile-image {
  display: block;
  width: 100%;
  margin: 0;
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-light);
}

/* ============================================================================
   SOCIAL LINKS
   ============================================================================ */

.social-links {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 1.4rem 0 0.5rem;
  flex-wrap: wrap;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border-light);
  border-radius: 50%;
  color: var(--text-secondary);
  background: var(--background-panel);
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.social-link:hover {
  color: var(--color-secondary);
  border-color: var(--color-secondary);
  transform: translateY(-2px);
}

.social-link svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

/* ============================================================================
   PUBLICATION LISTS
   ============================================================================ */

.pub-list {
  margin: 1.2rem 0;
}

.pub-list > p {
  margin: 0 0 1.15rem;
  padding: 0.85rem 1rem;
  background: var(--background-panel);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--border-medium);
  border-radius: 6px;
  line-height: 1.55;
  transition: border-left-color 0.15s ease, box-shadow 0.15s ease;
}

.pub-list > p:hover {
  border-left-color: var(--color-secondary);
  box-shadow: var(--shadow-soft);
}

.pub-list > p > strong:first-child,
.pub-list > p > a:first-child {
  font-size: 1.03rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Titles that link to a detail page still read as titles, not as links. */
.pub-list > p > strong:first-child > a,
.pub-list > p > a:first-child > strong {
  color: inherit;
  border-bottom: 1px solid transparent;
}

.pub-list > p > strong:first-child > a:hover,
.pub-list > p > a:first-child:hover {
  color: var(--color-secondary);
  border-bottom-color: currentColor;
}

.pub-authors,
.pub-venue,
.pub-links,
.pub-note {
  display: block;
  font-size: 0.92rem;
}

.pub-authors {
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

.pub-authors strong {
  color: var(--text-primary);
}

.pub-venue {
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.pub-links {
  margin-top: 0.35rem;
  font-size: 0.88rem;
}

.pub-note {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ============================================================================
   CV LISTS
   ============================================================================ */

.cv-list {
  margin: 1.2rem 0;
}

.cv-list > p {
  margin: 0 0 1.1rem;
  padding-left: 1rem;
  border-left: 2px solid var(--border-light);
  line-height: 1.5;
}

.cv-list > p > strong:first-child {
  font-size: 1.02rem;
  color: var(--text-primary);
}

.cv-org,
.cv-dates,
.cv-note {
  display: block;
  font-size: 0.92rem;
}

.cv-org { color: var(--text-secondary); }

.cv-dates {
  color: var(--text-muted);
  font-size: 0.87rem;
  font-variant-numeric: tabular-nums;
}

.cv-note {
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* ============================================================================
   SEARCH  (opened with "/", Cmd/Ctrl-K, or the nav button)
   ============================================================================ */

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--overlay-scrim);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 10vh 1rem 1rem;
}

.search-overlay[hidden] {
  display: none;
}

.search-modal {
  width: 100%;
  max-width: 560px;
  background: var(--background-panel);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.search-input {
  width: 100%;
  box-sizing: border-box;
  border: none;
  border-bottom: 1px solid var(--border-light);
  padding: 1rem 1.2rem;
  font-family: var(--font-family-sans);
  font-size: 1.05rem;
  color: var(--text-primary);
  background: var(--background-panel);
}

.search-input:focus {
  outline: none;
}

.search-results {
  list-style: none;
  margin: 0;
  padding: 0.4rem 0;
  max-height: 55vh;
  overflow-y: auto;
}

.search-results li {
  margin: 0;
  padding: 0;
}

.search-result {
  display: block;
  padding: 0.5rem 1.2rem;
  text-decoration: none;
  border-bottom: none;
  font-weight: 600;
  color: var(--color-primary);
}

.search-result:hover,
.search-result.is-active {
  background: var(--background-subtle);
  border-bottom: none;
}

.search-empty {
  padding: 1rem 1.2rem;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

body.search-open {
  overflow: hidden;
}

/* ============================================================================
   FOOTER
   ============================================================================ */

.footer-separator {
  border-top: 1px solid var(--border-light);
  margin: 2.5rem 0 1rem;
}

footer {
  padding: 0.5rem 0 3rem;
}

.footer-text {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.footer-text a { color: var(--text-secondary); }

.page-dates {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-family-mono);
  margin: 0.2rem 0 1.4rem;
  font-weight: normal;
}

/* ============================================================================
   WIKI HOME — RECENT PAGES
   ============================================================================ */

.recent-pages {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
}

.recent-pages h2 {
  font-size: 1.3rem;
  margin-top: 0;
  margin-bottom: 1.2rem;
  border-bottom: none;
  padding-bottom: 0;
}

.recent-pages ul.page-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

.recent-pages .page-list li {
  margin-bottom: 0.15rem;
  padding: 0.1rem 0;
  display: flex;
  align-items: baseline;
  gap: 1.2rem;
}

.recent-pages .page-list a {
  font-size: 1.02rem;
  border-bottom: none;
  color: var(--color-primary-dark);
}

.recent-pages .page-list a:hover {
  color: var(--color-secondary);
  border-bottom: 1px solid currentColor;
}

.page-date {
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-shrink: 0;
  white-space: nowrap;
  text-align: right;
  font-family: var(--font-family-mono);
  width: 10ch;
  display: inline-block;
}

.page-date--new {
  color: var(--color-secondary);
}

/* ============================================================================
   KATEX
   ============================================================================ */

.katex-display {
  text-align: center;
  margin: 1em 0;
  overflow-x: auto;
  overflow-y: hidden;
}

article .katex-display,
article .katex {
  width: auto;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 720px) {
  body {
    width: 92%;
    padding: 0 4%;
    font-size: 1rem;
  }

  article {
    padding: 1.5rem 0 0.5rem;
  }

  nav.top-nav {
    padding: 0.8rem 0 0.7rem;
  }

  .nav-inner {
    flex-wrap: nowrap;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 900;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.4rem;
    margin-top: 0.4rem;
    background: var(--background-panel);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
  }

  .nav-links.is-open {
    display: flex;
  }

  .nav-links a {
    padding: 0.55rem 0.7rem;
  }

  .home-hero {
    flex-direction: column-reverse;
    align-items: center;
    gap: 1.2rem;
  }

  .home-hero-copy p:first-child {
    font-size: 1.45rem;
  }

  .profile-image {
    width: 165px;
    max-width: 55%;
  }

  header h1 { font-size: 1.65rem; }
  section h1, .content h1, h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; margin-top: 1.9rem; }
  h3 { font-size: 1.1rem; }
  h4, h5, h6 { font-size: 1rem; }

  p { margin: 1rem 0; }

  ul, ol { padding-left: 1.2rem; }

  .pub-list > p { padding: 0.75rem 0.85rem; }

  .search-overlay { padding: 5vh 0.6rem 0.6rem; }

  .recent-pages .page-list li { gap: 0.8rem; }

  .page-date { width: 9ch; font-size: 0.8rem; }

  p, li, blockquote {
    max-width: 100%;
    overflow-wrap: break-word;
  }

  * {
    max-width: 100%;
    box-sizing: border-box;
  }

  a { overflow-wrap: break-word; }

  pre {
    overflow-x: auto;
    max-width: 100%;
    font-size: 0.85rem;
  }

  code {
    word-break: break-word;
    font-size: 0.88rem;
  }

  blockquote {
    margin: 1rem 0;
    padding-left: 1.1rem;
  }

  .footer-separator { margin: 1.8rem 0 0.5rem; }
  footer { padding: 0.5rem 0 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
