:root {
  color-scheme: light;
  --background: #f5f3ec;
  --paper: #fbf9f3;
  --paper-left: #f5f2e9;
  --ink: #303730;
  --muted: #626a60;
  --accent: #526d59;
  --wood: #c6ad87;
  --line: #d8d9ce;
  --serif: "Songti SC", "Noto Serif SC", SimSun, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--background); color: var(--ink); font-family: var(--sans); }
body { font-size: 16px; line-height: 1.8; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
button:disabled { opacity: .35; cursor: default; }
button:disabled:hover { transform: none; }
[hidden] { display: none !important; }
::selection { background: #b8c9af70; }
html[lang="en"] { --serif: Georgia, "Times New Roman", serif; }
.experience-shell { display: none; }
.enhanced .experience-shell, .booting .experience-shell { display: block; }
.enhanced #fallback, .booting #fallback { display: none; }
.skip-link { position: fixed; top: -100px; left: 20px; z-index: 100; background: var(--paper); padding: 10px 18px; box-shadow: 0 4px 20px #30373020; }
.skip-link:focus { top: 12px; }

/* Daylit study. Scene coordinates and the HTML hotspots share one surface. */
.room-main { position: relative; min-height: 720px; height: 100svh; isolation: isolate; overflow: hidden; }
.room-stage { position: absolute; inset: 0; }
.scene, .room-poster, .scene-shade, .hotspots { position: absolute; inset: 0; }
.room-poster { background: #ecebe2; }
.room-poster img { display: block; width: 100%; height: 100%; object-fit: contain; }
.scene { opacity: 0; transition: opacity .6s ease; z-index: 1; }
.scene[data-ready="true"] { opacity: 1; }
.scene canvas { display: block; width: 100%; height: 100%; }
.scene-shade { z-index: 2; pointer-events: none; background: linear-gradient(90deg, #f5f3ecaa, #f5f3ec00 42%); }
.hotspots { z-index: 3; pointer-events: none; }
.site-header { position: absolute; top: 26px; left: 4.5%; right: 4.5%; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 14px; font-size: 13px; letter-spacing: .08em; min-height: 48px; }
.brand-mark { font: italic 44px Georgia, serif; letter-spacing: -.09em; padding-right: 6px; color: var(--accent); }
.header-actions { display: flex; gap: 24px; align-items: center; }
.language-switch { display: flex; align-items: center; gap: 2px; font-size: 12px; color: var(--muted); }
.language-switch button { border: 0; background: none; min-width: 44px; min-height: 44px; font-size: 13px; padding: 6px; border-radius: 4px; }
.language-switch button[aria-pressed="true"] { color: var(--accent); font-weight: 650; }
.language-switch button:hover { background: #526d590c; }
.language-switch > span { color: #92998e; }
.pill { display: flex; align-items: center; gap: 11px; min-height: 44px; padding: 9px 18px; border: 1px solid #65775f50; border-radius: 24px; background: #fbf9f380; font-size: 13px; }
.pill:hover { background: var(--paper); }
.menu-icon { width: 13px; display: grid; gap: 4px; }
.menu-icon i { height: 1px; background: currentColor; }
.welcome { position: absolute; z-index: 4; left: 5.2%; bottom: 16%; width: min(28%, 350px); }
.welcome h1 { font: 400 clamp(38px, 3.6vw, 60px)/1.3 var(--serif); letter-spacing: .015em; margin: 0 0 26px; }
.welcome-summary { font-size: 16px; line-height: 1.9; margin: 0 0 12px; max-width: 23em; }
.welcome-status { color: var(--muted); font-size: 13px; margin: 0 0 26px; }
.start-link { display: inline-flex; align-items: center; gap: 36px; min-height: 44px; border-bottom: 1px solid #526d5980; color: var(--accent); font-size: 14px; }
.start-link span:last-child { font-size: 20px; transition: transform .2s; }
.start-link:hover span:last-child { transform: translate(2px,-2px); }
.room-footer { position: absolute; bottom: 20px; right: 4.5%; z-index: 4; }
.room-controls { display: flex; gap: 24px; }
.hint-button { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 0; border: 0; background: none; font-size: 13px; }
.hint-button > span:first-child { font-size: 20px; }
.hint-button[aria-pressed="true"] { color: var(--accent); }
.loading-note { position: absolute; right: 5%; top: 100px; z-index: 4; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); transition: opacity .2s; }
.loading-spark, .status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.is-ready .loading-note, .room-fallback .loading-note { opacity: 0; visibility: hidden; }
.hotspot { pointer-events: auto; position: absolute; transform: translate(-50%, -50%); width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; }
.hotspot::before { content: ""; width: 8px; height: 8px; border: 1px solid #fffdf2; background: #435b4390; border-radius: 50%; box-shadow: 0 0 0 4px #f9f7ee15; transition: background .2s, box-shadow .2s; }
.hotspot:hover::before, .hotspot:focus-visible::before, .show-hints .hotspot::before { background: #415d46; box-shadow: 0 0 0 5px #faf8ed80; }
.hotspot.visited::before { background: #95a783; }
.hotspot-label { position: absolute; bottom: 100%; left: 50%; transform: translate(calc(-50% + var(--label-shift, 0px)), 4px); width: max-content; max-width: min(220px, calc(100vw - 24px)); padding: 6px 11px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 5px 15px #30373010; font-size: 12px; line-height: 1.5; opacity: 0; transition: opacity .15s, transform .15s; pointer-events: none; text-align: center; }
.hotspot:hover .hotspot-label, .hotspot:focus-visible .hotspot-label { opacity: 1; transform: translate(calc(-50% + var(--label-shift, 0px)), 0); }
.hotspot.label-below .hotspot-label { top: 100%; bottom: auto; }

/* The index gives a direct path to everything in the room. */
dialog { border: 0; color: var(--ink); }
dialog:not([open]) { display: none; }
dialog::backdrop { background: #30372d65; backdrop-filter: blur(5px); }
.directory { position: fixed; inset: 0 0 0 auto; margin: 0; width: 420px; max-width: 100%; height: 100dvh; max-height: none; padding: 24px 32px; background: var(--paper); overflow-y: auto; overscroll-behavior: contain; box-shadow: -20px 0 70px #30373015; animation: drawer-in .25s ease; }
.directory-head { display: flex; justify-content: flex-end; }
.round-close { display: grid; place-items: center; width: 44px; height: 44px; min-width: 44px; border: 1px solid #7c867050; border-radius: 50%; background: transparent; font-size: 26px; line-height: 1; }
.round-close:hover { background: #526d590c; }
.directory h2 { font: 400 36px/1.3 var(--serif); margin: 10px 0 24px; }
.directory nav a { display: flex; gap: 16px; align-items: center; min-height: 48px; padding: 8px 0; font-size: 16px; border-bottom: 1px solid var(--line); }
.directory nav a span:first-child { font: 12px Georgia, serif; color: var(--muted); }
.directory nav a span:last-child { margin-left: auto; color: var(--accent); }
.directory a:hover { color: var(--accent); }
.directory-projects { margin-top: 28px; }
.directory-projects a { display: flex; align-items: center; min-height: 44px; font-size: 14px; line-height: 1.5; padding: 6px 0; }
.directory-email { display: flex; align-items: center; min-height: 44px; font-size: 14px; margin-top: 20px; overflow-wrap: anywhere; }
.directory > .reader-languages { margin-top: 16px; }
.eyebrow { display: block; font-size: 12px; line-height: 1.6; font-weight: 500; color: var(--muted); margin: 0 0 16px; }

/* One semantic reader; the layout mode is driven by the shared matchMedia rule. */
.reader { position: fixed; inset: 0; margin: auto; padding: 0; width: min(1180px, 94vw); max-width: none; height: fit-content; max-height: calc(100dvh - 32px); overflow: visible; background: transparent; outline: 0; }
.reader-toolbar { display: flex; align-items: center; gap: 16px; height: 44px; margin: 0 0 16px; color: var(--ink); }
.reader-index { display: flex; gap: 8px; align-items: center; min-height: 44px; border: 0; background: none; font-size: 13px; color: inherit; padding: 6px 0; }
.reader-index > span:first-child { font-size: 20px; }
.reader-toolbar .reader-languages { margin-left: auto; order: 2; color: inherit; }
.reader-toolbar .language-switch button[aria-pressed="true"] { color: inherit; text-decoration: underline; text-underline-offset: 6px; }
.reader-toolbar .round-close { order: 3; color: inherit; border-color: #526d5980; }
.book { position: relative; perspective: 1800px; border-radius: 3px; background: #dedacc; box-shadow: 0 3px 0 #d9d5c7, 0 6px 0 #c7c4b5, 0 9px 0 #a4ab96, 0 20px 55px #28352325; animation: book-in .4s ease; }
.spread { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); height: min(700px, calc(100dvh - 170px)); min-height: 0; position: relative; border-radius: 3px; overflow: hidden; background: var(--paper); }
.spread::after { content: ""; position: absolute; top: 0; bottom: 0; width: 32px; left: 50%; transform: translateX(-50%); background: linear-gradient(90deg,transparent,#46533c0c 40%,#34442b16 49%,#ffffff80 51%,transparent); pointer-events: none; z-index: 3; }
.paper-page { min-width: 0; padding: clamp(28px, 3.4vw, 48px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #c2c8b8 transparent; background: var(--paper); color: var(--ink); }
.paper-page:first-child { background-color: var(--paper-left); }
.paper-page h2 { font: 400 clamp(28px, 2.6vw, 42px)/1.35 var(--serif); margin: 0 0 24px; overflow-wrap: anywhere; text-wrap: balance; }
.paper-page h3 { font: 500 20px/1.5 var(--serif); margin: 26px 0 12px; }
.paper-page p, .contributions { font-size: 16px; line-height: 1.85; margin: 0 0 20px; overflow-wrap: anywhere; }
.paper-page .lead { font-size: 18px; line-height: 1.8; }
.paper-page .eyebrow { font-size: 12px; margin-bottom: 20px; }
.project-role { display: flex; flex-direction: column; gap: 3px; font-size: 13px !important; line-height: 1.7 !important; color: var(--muted); padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 24px !important; }
.contributions { list-style: none; padding: 0; }
.contributions li { position: relative; padding-left: 16px; margin-bottom: 15px; }
.contributions li::before { content: ""; position: absolute; top: .8em; left: 0; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 24px 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.tags span { overflow-wrap: anywhere; }
.paper-link { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; border: 0; border-bottom: 1px solid #526d5960; padding: 6px 0; color: var(--accent); background: transparent; font-size: 14px; }
.paper-link:hover { border-color: var(--accent); }
.back-projects { margin-top: 12px; }
.project-list { list-style: none; padding: 0; margin: 0; }
.project-list li { border-bottom: 1px solid var(--line); }
.project-list a { display: grid; grid-template-columns: 22px minmax(0,1fr) 16px; align-items: center; gap: 10px; min-height: 66px; padding: 10px 0; font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; }
.project-list .list-num { font: 12px Georgia,serif; color: var(--muted); }
.project-list small { display: block; font-size: 12px; line-height: 1.65; margin-top: 5px; color: var(--muted); }
.project-list a:hover { color: var(--accent); }
.index-art { position: relative; display: flex; align-items: flex-end; gap: 12px; height: 140px; margin-top: 50px; width: fit-content; }
.index-art i { display: block; width: 40px; height: 115px; background: #bdc7ac; border-radius: 3px 5px 5px 3px; border-left: 5px solid #a8b698; box-shadow: 3px 3px 0 #46533c0e; }
.index-art i:nth-child(2) { height: 135px; background: #d4c3a5; border-color: #c1ac87; transform: rotate(-8deg); transform-origin: bottom; }
.index-art i:nth-child(3) { height: 100px; background: #adbdc0; border-color: #8fa6a7; }
.growth-list { list-style: none; margin: 0; padding: 0; }
.growth-list li { padding: 0 0 10px 20px; border-left: 1px solid #b8c4ae; position: relative; }
.growth-list li::before { content: ""; position: absolute; left: -4px; top: 12px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.growth-list h3 { margin-top: 0; }
.skill-list { margin: 0; }
.skill-list > div { padding: 16px 0; border-bottom: 1px solid var(--line); }
.skill-list dt { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.skill-list dd { margin: 0; font-size: 16px; line-height: 1.8; overflow-wrap: anywhere; }
.diagram { margin: 0 0 32px; padding: 0; }
.diagram figcaption { font: 500 20px/1.5 var(--serif); margin-bottom: 24px; }
.flow { display: flex; align-items: stretch; gap: 7px; }
.flow-node { flex: 1; min-width: 0; display: grid; place-items: center; padding: 18px 9px; background: #edf0e6; border: 1px solid #d5ddca; border-radius: 3px; color: #42583f; font-size: 13px; text-align: center; line-height: 1.7; overflow-wrap: anywhere; }
.flow-arrow { align-self: center; color: var(--muted); font-size: 14px; }
.evaluation { display: flex; align-items: center; gap: 20px; margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); }
.evaluation strong { font: 48px/1 Georgia,serif; color: var(--accent); }
.evaluation span { font-size: 14px; line-height: 1.7; max-width: 200px; }
.contact-status { display: flex; align-items: center; gap: 10px; color: var(--accent); font-size: 14px !important; margin-top: 32px !important; }
.contact-details { padding-top: 12px; }
.contact-email { display: block; font: 24px/1.6 Georgia,serif; overflow-wrap: anywhere; margin: 10px 0 30px; text-decoration: underline; text-decoration-color: #a4af98; text-underline-offset: 8px; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 16px 28px; }
.reader-bottom { display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin-top: 22px; color: var(--ink); }
.page-turn { display: flex; align-items: center; gap: 12px; min-height: 44px; background: none; border: 0; padding: 0; font-size: 13px; color: inherit; }
.page-turn > span[aria-hidden] { font-size: 24px; }
#page-count { font: 13px Georgia,serif; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%,12px); opacity: 0; width: max-content; max-width: calc(100vw - 32px); padding: 10px 18px; background: var(--ink); color: var(--paper); border-radius: 4px; font-size: 14px; z-index: 20; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.visible { opacity: 1; transform: translate(-50%,0); }

/* Animated leaves never take focus or move the resting hit targets. */
.fixed-page, .turning-leaf { position: absolute; top: 0; bottom: 0; width: 50%; pointer-events: none; }
.fixed-page { z-index: 4; overflow: hidden; }
.fixed-page.left { left: 0; }
.fixed-page.right { right: 0; }
.turning-leaf { z-index: 8; transform-style: preserve-3d; }
.turning-leaf.forward { left: 50%; transform-origin: left center; animation: leaf-forward .65s cubic-bezier(.25,.65,.2,1) both; }
.turning-leaf.backward { left: 0; transform-origin: right center; animation: leaf-backward .65s cubic-bezier(.25,.65,.2,1) both; }
.leaf-face { position: absolute; inset: 0; backface-visibility: hidden; overflow: hidden; background: var(--paper); box-shadow: 0 0 20px #30373010; }
.leaf-front { transform: rotateY(0); }
.leaf-back { transform: rotateY(180deg); }
.leaf-face > .paper-page, .fixed-page > .paper-page { height: 100%; overflow: hidden; }
.fixed-page.right > .paper-page, .turning-leaf.forward .leaf-front > .paper-page, .turning-leaf.backward .leaf-back > .paper-page { background: var(--paper); }
@keyframes drawer-in { from { transform: translateX(100%); } to { transform: none; } }
@keyframes book-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes leaf-forward { from { transform: rotateY(0); } to { transform: rotateY(-180deg); } }
@keyframes leaf-backward { from { transform: rotateY(0); } to { transform: rotateY(180deg); } }

/* Continuous reading also serves short desktop windows and zoomed text. */
.reader[data-mode="continuous"] { inset: 0; width: 100%; height: 100dvh; max-height: none; margin: 0; background: var(--paper); overflow-y: auto; overscroll-behavior: contain; }
.reader[data-mode="continuous"] .reader-toolbar { position: sticky; top: 0; height: 76px; padding: 12px clamp(18px,4vw,36px); margin: 0; z-index: 12; background: #fbf9f3f5; color: var(--ink); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
.reader[data-mode="continuous"] .round-close { border-color: var(--line); }
.reader[data-mode="continuous"] .book { max-width: 760px; margin: auto; box-shadow: none; border-radius: 0; animation: none; }
.reader[data-mode="continuous"] .spread { display: block; height: auto; overflow: visible; border-radius: 0; }
.reader[data-mode="continuous"] .spread:last-child { min-height: calc(100dvh - 76px); }
.reader[data-mode="continuous"] .spread::after { display: none; }
.reader[data-mode="continuous"] .paper-page { overflow: visible; padding: 32px clamp(24px,5vw,52px); background: var(--paper); }
.reader[data-mode="continuous"] .paper-page + .paper-page, .reader[data-mode="continuous"] .spread + .spread { border-top: 1px solid var(--line); }
.reader[data-mode="continuous"] .paper-page h2 { font-size: clamp(30px,5vw,40px); }
.reader[data-mode="continuous"] .reader-bottom { display: none; }
.reader[data-mode="continuous"] .index-art { height: 80px; margin-top: 24px; }
.reader[data-mode="continuous"] .index-art i { width: 28px; height: 64px; }
.reader[data-mode="continuous"] .index-art i:nth-child(2) { height: 80px; }
.reader[data-mode="continuous"] .index-art i:nth-child(3) { height: 56px; }

@media (max-width: 1023px) {
  .room-main { display: flex; flex-direction: column; height: auto; min-height: 100svh; overflow: hidden; }
  .site-header { position: relative; inset: auto; min-height: 84px; padding: 16px 5%; gap: 10px; }
  .brand { gap: 8px; font-size: 12px; }
  .brand-mark { font-size: 38px; }
  .header-actions { gap: 12px; }
  .room-stage { position: relative; inset: auto; flex: none; height: clamp(440px,128vw,660px); width: 100%; }
  .scene-shade { background: linear-gradient(0deg,#f5f3ec40,transparent 22%); }
  .welcome { position: relative; inset: auto; width: auto; max-width: 620px; margin: 28px 6% 24px; }
  .welcome h1 { font-size: clamp(32px,4.4vw,44px); line-height: 1.4; margin-bottom: 16px; }
  .welcome h1 br { display: none; }
  .welcome-summary { font-size: 16px; max-width: 34em; }
  .welcome-status { margin-bottom: 16px; }
  .room-footer { position: relative; inset: auto; margin: 0 6% 16px; }
  .room-controls { justify-content: space-between; }
  .loading-note { top: 96px; right: 6%; }
}
@media (max-width: 420px) {
  .site-header { padding: 12px 5%; min-height: 80px; }
  .brand { gap: 7px; font-size: 11px; }
  .brand-mark { font-size: 34px; }
  .header-actions { gap: 4px; }
  .language-switch { gap: 0; }
  .pill { padding: 8px 12px; gap: 8px; font-size: 12px; }
  .menu-toggle .menu-icon { display: none; }
  .welcome h1 { font-size: 32px; }
  html[lang="en"] .welcome h1 { max-width: 9em; }
  .directory { padding: 20px 24px; }
  .reader-toolbar { gap: 8px; }
  .reader-index { font-size: 12px; }
  .flow { flex-direction: column; gap: 6px; }
  .flow-node { width: 100%; min-height: 50px; padding: 12px; }
  .flow-arrow { transform: rotate(90deg); line-height: 1; }
  .contact-email { font-size: 22px; }
}
@media (max-width: 360px) {
  .brand > span:last-child { font-size: 10px; letter-spacing: .02em; }
  .brand { gap: 4px; }
  .brand-mark { font-size: 30px; }
  .pill { padding: 8px; }
  .header-actions { gap: 0; }
  .language-switch button { padding: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Complete, readable document for no JavaScript, failed modules and print. */
.fallback { max-width: 900px; margin: auto; padding: 48px 24px; background: var(--paper); color: var(--ink); }
.fallback h1, .fallback h2, .fallback h3 { font-family: var(--serif); font-weight: 500; line-height: 1.5; }
.fallback h1 { font-size: 38px; }
.fallback h2 { font-size: 28px; margin: 40px 0 20px; }
.fallback h3 { font-size: 22px; }
.fallback section { margin: 48px 0; }
.fallback article { margin: 24px 0; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.fallback a { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; overflow-wrap: anywhere; }
.fallback nav { display: flex; flex-wrap: wrap; gap: 16px; }
.fallback ul { padding-left: 20px; }
.fallback dd { margin-left: 0; }
@media print {
  .experience-shell, .skip-link { display: none !important; }
  .enhanced #fallback, .booting #fallback { display: block; }
  .fallback { padding: 0; max-width: none; background: white; color: black; }
  .fallback section { margin: 24px 0; }
  .fallback article { break-inside: avoid; }
}
