/* ==========================================================================
   Guanhua Zhu — personal homepage
   Layout follows the Minimal Light theme (fixed left sidebar + right column).
   Every visual choice is a token on :root, so each style below only
   redefines tokens (plus the scenery layer).
   ========================================================================== */

:root {
  --bg: #ffffff;
  --scenery: none;
  --text: #595959;
  --text-strong: #222222;
  --muted: #828282;
  --heading: #043361;
  --link: #3399cc;
  --link-hover: #006699;
  --accent: #002d72;
  --badge-bg: #002d72;
  --badge-text: #ffffff;
  --btn-border: #000000;
  --btn-text: #000000;
  --panel: transparent;
  --panel-border: transparent;
  --panel-shadow: none;
  --panel-pad: 0px;
  --side-text: #595959;
  --side-strong: #043361;
  --teaser-bg: #eef2f7;
  --teaser-shadow: 3px 3px 6px rgba(0, 0, 0, .35);
  --curtain: #ffffff;
  --ring: #3399cc;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-heading: var(--font-body);
  --heading-weight: 500;
  --heading-transform: none;
  --heading-spacing: normal;
  --heading-shadow: none;
  --avatar-border: transparent;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]), :root[data-theme="default"] {
    --bg: #20212b;
    --text: #dadbdf;
    --text-strong: #eeeff0;
    --muted: #9a9ba3;
    --heading: #3eb7f0;
    --link: #3eb7f0;
    --link-hover: #8fd6f7;
    --accent: #2496cb;
    --badge-bg: #2496cb;
    --btn-border: #ffffff;
    --btn-text: #ffffff;
    --side-text: #dadbdf;
    --side-strong: #3eb7f0;
    --teaser-bg: #2c2e3a;
    --teaser-shadow: 3px 3px 8px rgba(0, 0, 0, .6);
    --curtain: #20212b;
    --ring: #3eb7f0;
  }
}

/* ---------- 1. Hogwarts (Harry Potter) ---------- */
:root[data-theme="potter"] {
  --bg: #120c0a;
  --scenery:
    radial-gradient(circle at 12% 18%, rgba(255, 190, 90, .22), transparent 22%),
    radial-gradient(circle at 88% 30%, rgba(255, 170, 70, .16), transparent 20%),
    radial-gradient(1px 1px at 20px 30px, rgba(255, 236, 180, .8), transparent 60%),
    radial-gradient(1px 1px at 90px 120px, rgba(255, 236, 180, .6), transparent 60%),
    radial-gradient(1.5px 1.5px at 160px 60px, rgba(255, 236, 180, .7), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='160' viewBox='0 0 120 160'%3E%3Cpath d='M0 160V70a60 60 0 0 1 120 0v90' fill='none' stroke='%23d3a625' stroke-opacity='.07' stroke-width='2'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #1c0f0d 0%, #2a1210 45%, #120c0a 100%);
  --scenery-size: auto, auto, 200px 200px, 200px 200px, 200px 200px, 120px 160px, auto;
  --text: #3b2a1a;
  --text-strong: #5c0a0a;
  --muted: #7a6245;
  --heading: #740001;
  --link: #8a5a00;
  --link-hover: #740001;
  --accent: #740001;
  --badge-bg: linear-gradient(135deg, #740001, #ae0001);
  --badge-text: #f7d77a;
  --btn-border: #740001;
  --btn-text: #740001;
  --panel: linear-gradient(180deg, #f4e6c3, #ecd8a8);
  --panel-border: #d3a625;
  --panel-shadow: 0 0 0 4px rgba(211, 166, 37, .25), 0 20px 50px rgba(0, 0, 0, .6);
  --panel-pad: 36px;
  --side-text: #eadbb4;
  --side-strong: #f0c75e;
  --teaser-bg: #e3cf9b;
  --teaser-shadow: 0 4px 10px rgba(60, 20, 0, .35);
  --curtain: #f0c75e;
  --ring: #f0c75e;
  --font-body: "EB Garamond", Georgia, serif;
  --font-heading: "Cinzel", Georgia, serif;
  --heading-weight: 700;
  --heading-spacing: .04em;
  --avatar-border: #d3a625;
}

/* ---------- 2. Caribbean (Pirates of the Caribbean) ---------- */
:root[data-theme="pirate"] {
  --bg: #07141b;
  --scenery:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='40' viewBox='0 0 240 40'%3E%3Cpath d='M0 20 Q30 0 60 20 T120 20 T180 20 T240 20' fill='none' stroke='%23c9a24a' stroke-opacity='.12' stroke-width='2'/%3E%3C/svg%3E"),
    radial-gradient(ellipse at 70% 35%, rgba(233, 170, 70, .35), transparent 45%),
    linear-gradient(180deg, #16262c 0%, #2d3b36 30%, #3b3a2b 42%, #0e2a33 48%, #07141b 100%);
  --scenery-size: 240px 40px, auto, auto;
  --text: #e3d7b8;
  --text-strong: #f4d58d;
  --muted: #a99a78;
  --heading: #e2b04a;
  --link: #f0c36b;
  --link-hover: #ffe3a3;
  --accent: #8b1e1e;
  --badge-bg: #8b1e1e;
  --badge-text: #f4e1b0;
  --btn-border: #e2b04a;
  --btn-text: #e2b04a;
  --panel: linear-gradient(180deg, rgba(20, 28, 30, .9), rgba(12, 20, 24, .92));
  --panel-border: rgba(226, 176, 74, .45);
  --panel-shadow: 0 20px 50px rgba(0, 0, 0, .6);
  --panel-pad: 36px;
  --side-text: #e3d7b8;
  --side-strong: #f4d58d;
  --teaser-bg: #1b2a2e;
  --teaser-shadow: 0 4px 12px rgba(0, 0, 0, .6);
  --curtain: #0b1d26;
  --ring: #e2b04a;
  --font-body: "EB Garamond", Georgia, serif;
  --font-heading: "Pirata One", Georgia, serif;
  --heading-weight: 400;
  --heading-spacing: .03em;
  --heading-shadow: 0 2px 0 rgba(0, 0, 0, .6);
  --avatar-border: #8b1e1e;
}

/* ---------- 3. Hip-Hop ---------- */
:root[data-theme="hiphop"] {
  --bg: #0d0d10;
  --scenery:
    radial-gradient(circle at 15% 20%, rgba(255, 0, 170, .35), transparent 30%),
    radial-gradient(circle at 85% 75%, rgba(0, 229, 255, .28), transparent 32%),
    radial-gradient(circle at 70% 10%, rgba(255, 230, 0, .18), transparent 25%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .05) 0 2px, transparent 2px 36px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .05) 0 2px, transparent 2px 72px),
    linear-gradient(160deg, #17121c, #0d0d10);
  --scenery-size: auto, auto, auto, auto, auto, auto;
  --text: #e8e8ee;
  --text-strong: #ffffff;
  --muted: #a0a0b0;
  --heading: #ffe600;
  --link: #00e5ff;
  --link-hover: #ff3cac;
  --accent: #ff3cac;
  --badge-bg: #ff3cac;
  --badge-text: #0d0d10;
  --btn-border: #ffe600;
  --btn-text: #ffe600;
  --panel: rgba(10, 10, 14, .86);
  --panel-border: #ff3cac;
  --panel-shadow: 6px 6px 0 #00e5ff, 0 20px 50px rgba(0, 0, 0, .6);
  --panel-pad: 36px;
  --side-text: #e8e8ee;
  --side-strong: #ffe600;
  --teaser-bg: #1b1b24;
  --teaser-shadow: 4px 4px 0 #ffe600;
  --curtain: #ff3cac;
  --ring: #00e5ff;
  --font-body: "Space Grotesk", "Segoe UI", sans-serif;
  --font-heading: "Bungee", Impact, sans-serif;
  --heading-weight: 400;
  --heading-shadow: 3px 3px 0 #ff3cac;
  --avatar-border: #ffe600;
}

/* ---------- 4. Age of Discovery ---------- */
:root[data-theme="voyage"] {
  --bg: #e8d6a8;
  --scenery:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='520' height='520' viewBox='-260 -260 520 520'%3E%3Cg fill='none' stroke='%235b3a1a' stroke-opacity='.18'%3E%3Ccircle r='200'/%3E%3Ccircle r='188'/%3E%3Ccircle r='120' stroke-dasharray='4 6'/%3E%3Cpath d='M-260 0H260M0-260V260M-184-184L184 184M184-184L-184 184'/%3E%3C/g%3E%3Cg fill='%235b3a1a' fill-opacity='.16'%3E%3Cpath d='M0-190L22-22 0 0-22-22Z M0 190L22 22 0 0-22 22Z M-190 0L-22-22 0 0-22 22Z M190 0L22-22 0 0 22 22Z'/%3E%3Cpath d='M0-120L12-12 0 0-12-12Z' transform='rotate(45)'/%3E%3Cpath d='M0-120L12-12 0 0-12-12Z' transform='rotate(135)'/%3E%3Cpath d='M0-120L12-12 0 0-12-12Z' transform='rotate(225)'/%3E%3Cpath d='M0-120L12-12 0 0-12-12Z' transform='rotate(315)'/%3E%3C/g%3E%3C/svg%3E"),
    repeating-linear-gradient(0deg, rgba(91, 58, 26, .06) 0 1px, transparent 1px 80px),
    repeating-linear-gradient(90deg, rgba(91, 58, 26, .06) 0 1px, transparent 1px 80px),
    radial-gradient(ellipse at center, #f3e4bb 0%, #e3cc93 70%, #c9a867 100%);
  --scenery-size: 520px 520px, auto, auto, auto;
  --scenery-position: right -140px bottom -140px, 0 0, 0 0, center;
  --text: #3e2b16;
  --text-strong: #2a1a08;
  --muted: #6e5634;
  --heading: #5b3a1a;
  --link: #1f4e79;
  --link-hover: #8b1e1e;
  --accent: #1f4e79;
  --badge-bg: #1f4e79;
  --badge-text: #f3e4bb;
  --btn-border: #5b3a1a;
  --btn-text: #5b3a1a;
  --panel: rgba(250, 240, 212, .78);
  --panel-border: rgba(91, 58, 26, .45);
  --panel-shadow: 0 10px 30px rgba(91, 58, 26, .25);
  --panel-pad: 36px;
  --side-text: #3e2b16;
  --side-strong: #5b3a1a;
  --teaser-bg: #eadbb0;
  --teaser-shadow: 0 3px 8px rgba(91, 58, 26, .35);
  --curtain: #f3e4bb;
  --ring: #1f4e79;
  --font-body: "IM Fell English", Georgia, serif;
  --font-heading: "IM Fell English SC", Georgia, serif;
  --heading-weight: 400;
  --heading-spacing: .03em;
  --avatar-border: #5b3a1a;
}

/* ---------- 5. Wild West ---------- */
:root[data-theme="cowboy"] {
  --bg: #5a2a17;
  --scenery:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='260' viewBox='0 0 1200 260' preserveAspectRatio='none'%3E%3Cpath d='M0 260V170h80l20-40h140l25 40h160l30-70h170l30 70h120l20-30h110l25 30h270v90Z' fill='%233a1a0e'/%3E%3Cg fill='%232a1209'%3E%3Cpath d='M120 260v-70a8 8 0 0 1 16 0v70Z M108 222v-18a6 6 0 0 1 12 0v18Z M136 214v-22a6 6 0 0 1 12 0v22Z'/%3E%3Cpath d='M980 260v-90a9 9 0 0 1 18 0v90Z M966 214v-20a7 7 0 0 1 14 0v20Z M998 204v-26a7 7 0 0 1 14 0v26Z'/%3E%3C/g%3E%3C/svg%3E"),
    radial-gradient(circle at 50% 78%, rgba(255, 214, 120, .9), rgba(255, 170, 80, .0) 18%),
    linear-gradient(180deg, #3b1d3a 0%, #8a3b3a 30%, #d4693a 58%, #f2a65a 76%, #c26a35 100%);
  --scenery-size: 100% 32vh, auto, auto;
  --scenery-position: bottom, center, center;
  --text: #3d2413;
  --text-strong: #5a2a0f;
  --muted: #7d5a3c;
  --heading: #7a3b12;
  --link: #a0451a;
  --link-hover: #5a2a0f;
  --accent: #7a3b12;
  --badge-bg: #7a3b12;
  --badge-text: #f5e6c8;
  --btn-border: #7a3b12;
  --btn-text: #7a3b12;
  --panel: linear-gradient(180deg, #f7ead0, #efdcb5);
  --panel-border: #6b3e1f;
  --panel-shadow: 0 0 0 3px #f7ead0, 0 0 0 5px #6b3e1f, 0 20px 50px rgba(40, 10, 0, .55);
  --panel-pad: 36px;
  --side-text: #fff1dc;
  --side-strong: #ffe2a8;
  --teaser-bg: #e8d2a8;
  --teaser-shadow: 0 3px 8px rgba(60, 25, 5, .4);
  --curtain: #f2a65a;
  --ring: #ffe2a8;
  --font-body: "EB Garamond", Georgia, serif;
  --font-heading: "Rye", Georgia, serif;
  --heading-weight: 400;
  --avatar-border: #6b3e1f;
}

/* ==========================================================================
   Base
   ========================================================================== */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding: 50px;
  background-color: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font-body);
  font-weight: 400;
  transition: background-color .4s ease, color .4s ease;
}

:root[data-theme="potter"] body,
:root[data-theme="pirate"] body,
:root[data-theme="voyage"] body,
:root[data-theme="cowboy"] body { font-size: 16px; }

.scenery {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--scenery);
  background-size: var(--scenery-size, auto);
  background-position: var(--scenery-position, 0 0);
  background-repeat: repeat;
  pointer-events: none;
}
:root[data-theme="cowboy"] .scenery { background-repeat: no-repeat, no-repeat, no-repeat; }
:root[data-theme="voyage"] .scenery { background-repeat: no-repeat, repeat, repeat, no-repeat; }
:root[data-theme="pirate"] .scenery { background-position: 0 100%, center, center; background-repeat: repeat, no-repeat, no-repeat; }

/* Colour wash that sweeps the page when the style changes */
.curtain {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: radial-gradient(circle at var(--cx, 10%) var(--cy, 15%), var(--curtain) 0%, transparent 70%);
  opacity: 0;
  pointer-events: none;
}
.curtain.play { animation: curtain .7s ease-out; }
@keyframes curtain { 0% { opacity: 0; } 35% { opacity: .9; } 100% { opacity: 0; } }

a { color: var(--link); text-decoration: none; transition: color .2s; }
a:hover { color: var(--link-hover); }

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

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: var(--heading-weight);
  letter-spacing: var(--heading-spacing);
  text-shadow: var(--heading-shadow);
  line-height: 1.15;
}
h1 { font-size: 28px; color: var(--side-strong); margin: 0 0 14px; }
h2 { font-size: 157%; color: var(--heading); margin: 2px 0 15px; }

p, ul, ol { margin: 0 0 20px; }
img { max-width: 100%; }

/* ==========================================================================
   Layout (Minimal Light: 232px fixed sidebar + 650px content, 960px wrapper)
   ========================================================================== */
.wrapper { width: 960px; margin: 0 auto; }

header {
  width: 232px;
  float: left;
  position: fixed;
  padding-top: 4em;
  text-align: center;
  color: var(--side-text);
  -webkit-font-smoothing: subpixel-antialiased;
}

section {
  width: 650px;
  float: right;
  margin-top: 4em;
  margin-bottom: 50px;
  padding: var(--panel-pad);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  box-shadow: var(--panel-shadow);
  transition: box-shadow .4s ease, border-color .4s ease;
}

.position { font-size: 1.1rem; }
.affil { color: var(--side-text); opacity: .9; }
.affil:hover { color: var(--side-strong); }
.email { font-family: "Ubuntu Mono", Consolas, monospace; font-size: 14px; }

/* ---------- Avatar + style button ---------- */
.avatar-wrap {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 0 auto 10px;
  perspective: 800px;
}
.avatar {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 3px solid var(--avatar-border);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
  transition: border-color .4s ease;
}
.avatar.flip { animation: flip .6s ease-in-out; }
@keyframes flip {
  0% { transform: rotateY(0) scale(1); }
  50% { transform: rotateY(90deg) scale(.92); }
  100% { transform: rotateY(0) scale(1); }
}

.style-toggle {
  position: absolute;
  right: 2px;
  bottom: 4px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  background: var(--accent);
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
  transition: transform .2s ease;
}
.style-toggle:hover { transform: scale(1.12) rotate(-12deg); }
.style-toggle:active { transform: scale(.95); }
.style-toggle:focus-visible { outline: 3px solid var(--ring); outline-offset: 3px; }
.style-toggle::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--ring);
  opacity: 0;
  animation: pulse 2.4s ease-out infinite;
}
.style-toggle.seen::before { animation: none; }
@keyframes pulse {
  0% { transform: scale(.8); opacity: .8; }
  100% { transform: scale(1.5); opacity: 0; }
}

.style-toggle .tip {
  position: absolute;
  left: 50%;
  top: calc(100% + 10px);
  transform: translateX(-50%) translateY(-4px);
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 4px;
  background: rgba(20, 20, 20, .9);
  color: #fff;
  font: 12px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
  z-index: 5;
}
.style-toggle .tip::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -5px;
  margin-left: -5px;
  border: 5px solid transparent;
  border-top: 0;
  border-bottom-color: rgba(20, 20, 20, .9);
}
.style-toggle:hover .tip,
.style-toggle:focus-visible .tip { opacity: 1; transform: translateX(-50%) translateY(0); }

.style-name {
  display: inline-block;
  margin: 2px 0 14px;
  padding: 1px 10px;
  border-radius: 999px;
  border: 1px solid currentColor;
  color: var(--side-strong);
  font-family: var(--font-heading);
  font-size: 12px;
  letter-spacing: .06em;
  opacity: .85;
}

/* ---------- Social icons ---------- */
.social-icons { margin-top: 18px; }
.social-icons a {
  display: inline-block;
  width: 2.2rem;
  height: 2.2rem;
  line-height: 2.3rem;
  border-radius: 50%;
  text-align: center;
  font-size: 1.15rem;
  color: var(--side-strong);
  transition: transform .2s ease, background-color .2s ease;
}
.social-icons a:hover { transform: scale(1.2); background-color: rgba(127, 127, 127, .15); color: var(--side-strong); }

/* ==========================================================================
   Content
   ========================================================================== */
ul.news li { margin-bottom: 4px; }

.bibliography { list-style: none; padding: 0; margin: 0 0 8px; }
.pub-row {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 26px;
}
.pub-row .abbr {
  position: relative;
  flex: 0 0 230px;
}
.teaser {
  display: block;
  width: 230px;
  height: 125px;
  object-fit: contain;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: var(--teaser-shadow);
  padding: 4px;
}

.badge {
  position: absolute;
  top: 8px;
  left: -6px;
  display: inline-block;
  padding: .3em .7em;
  font: 700 11px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: .02em;
  text-decoration: none;
  color: var(--badge-text);
  background: var(--badge-bg);
  border-radius: 2px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .16), 0 2px 10px rgba(0, 0, 0, .12);
}

.pub-body { flex: 1; min-width: 0; }
.pub-body .title { font-weight: 700; color: var(--text-strong); }
.pub-body .title a { color: var(--link); }
.pub-body .author { margin-top: 2px; }
.pub-body .periodical { color: var(--muted); }
.links { margin-top: 6px; }
.btn {
  display: inline-block;
  margin-right: 6px;
  padding: .05rem .5rem;
  font-size: 12px;
  color: var(--btn-text);
  border: 1px solid var(--btn-border);
  border-radius: 2px;
}
.btn:hover { color: var(--link-hover); border-color: var(--link-hover); }

.note { font-size: 13px; color: var(--muted); margin-top: -6px; }

ul.plain { padding-left: 20px; }
ul.plain li { margin-bottom: 6px; }
.role { font-weight: 600; color: var(--text-strong); }
.when { color: var(--muted); white-space: nowrap; }
.when::before { content: "· "; }

.footer-note { margin: 30px 0 0; color: var(--muted); }

/* ==========================================================================
   Responsive (same breakpoints as Minimal Light)
   ========================================================================== */
@media screen and (max-width: 960px) {
  body { padding: 16px; }
  .wrapper { width: auto; margin: 0; }
  header, section { float: none; position: static; width: auto; }
  header { padding-top: 1.5em; }
  section { margin-top: 1.5em; }
  :root[data-theme="default"] section, :root:not([data-theme]) section {
    border-width: 1px 0;
    border-color: rgba(127, 127, 127, .25);
    padding: 20px 0;
  }
}

@media screen and (max-width: 560px) {
  section { --panel-pad: 20px; padding: var(--panel-pad); }
  .pub-row { display: block; }
  .pub-row .abbr { margin-bottom: 10px; }
  .teaser { width: 100%; height: 160px; }
}

@media (prefers-reduced-motion: reduce) {
  .avatar.flip, .curtain.play, .style-toggle::before { animation: none; }
}
