/* ==========================================================================
   Joyce Mo — personal site. Design language after chester.how:
   neutral palette, floating pill nav, serif intro with
   colored underlines, soft staggered reveal.
   ========================================================================== */

:root {
  --bg: #ffffff;
  --tile: #fafafa;
  --tile-hover: #f5f5f5;
  --line: #e5e5e5;
  --hl: #e5e5e5;
  --ink: #171717;
  --ink-2: #525252;
  --muted: #a3a3a3;
  --muted-2: #737373;
  --glass: rgb(255 255 255 / .7);
  --btn: #ffffff;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / .08), 0 2px 4px -2px rgb(0 0 0 / .08);
  --skeuo: 0 0 0 1px rgb(0 0 0 / .06), 0 1px 2px rgb(0 0 0 / .08), inset 0 -1px 0 rgb(0 0 0 / .05);
  --ring: #bfdbfe;
  --accent: #7e22ce;   /* links and my name */

  --orange: #fb923c; --sky: #38bdf8; --rose: #fb7185; --lime: #a3e635;
  --purple: #c084fc; --teal: #2dd4bf; --fuchsia: #e879f9;

  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Newsreader", ui-serif, Georgia, "Times New Roman", serif;
  --radius: 10px;
  --gap: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a;
    --tile: #141414;
    --tile-hover: #1c1c1c;
    --line: #262626;
    --hl: #2e2e2e;
    --ink: #f5f5f5;
    --ink-2: #c4c4c4;
    --muted: #737373;
    --muted-2: #a3a3a3;
    --glass: rgb(20 20 20 / .7);
    --btn: #262626;
    --shadow: 0 4px 12px rgb(0 0 0 / .5);
    --skeuo: 0 0 0 1px rgb(255 255 255 / .08), 0 1px 2px rgb(0 0 0 / .4);
    --ring: #1e3a8a;
    --accent: #c084fc;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.6 var(--sans);
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 4px; }
::selection { background: #fde68a; color: #171717; }
.muted { color: var(--muted); }

.shell {
  max-width: 1536px;
  margin: 0 auto;
  padding: 0 32px;
}
@media (max-width: 639px) { .shell { padding: 0 16px; } }

/* ---------- Nav ---------------------------------------------------------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 4px;
  pointer-events: none;
}
.nav > * { pointer-events: auto; }
.nav-pill {
  position: relative; isolation: isolate;
  display: flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--glass);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  animation: drop .6s cubic-bezier(.2,.8,.2,1) both;
}
.nav-hl {
  position: absolute; left: 0; top: 4px; z-index: -1;
  height: 28px; width: 0;
  border-radius: 6px;
  background: var(--hl);
  opacity: 0;
  transition: transform .25s cubic-bezier(.2,.8,.2,1), width .25s cubic-bezier(.2,.8,.2,1), opacity .2s;
}
.nav-link, .nav-ext a {
  padding: 4px 8px;
  font-size: 14px; line-height: 20px; letter-spacing: -0.02em;
  color: var(--muted);
  border-radius: 6px;
  transition: color .15s;
}
.nav-link:hover, .nav-link.is-active { color: var(--ink); }
.nav-ext { display: flex; animation: fade .6s .3s both; }
.nav-ext a { color: var(--accent); cursor: alias; text-underline-offset: 4px; text-decoration-style: wavy; }
.nav-ext a:hover { color: var(--ink); text-decoration-line: underline; }
@media (max-width: 767px) {
  .nav { justify-content: center; }
  .nav-ext { display: none; }
}

/* ---------- Home --------------------------------------------------------- */
.home {
  max-width: 1280px; margin: 0 auto;
  padding: 56px 0 16px;
  display: grid; gap: 72px;
}
@media (max-width: 639px) { .home { padding-top: 24px; gap: 48px; } }
/* big name: an SVG drawn in the Birthstone Bounce font by scripts/make-name-svg.py */
.name { margin: 0; color: var(--accent); }
.name-art { display: block; width: min(100%, 720px); height: auto; overflow: visible; }
.name-art .star { transform-box: fill-box; transform-origin: center; animation: twinkle 3.2s ease-in-out infinite; }
.name-art .star:nth-child(2n) { animation-delay: -1.3s; }
.name-art .star:nth-child(3n) { animation-delay: -2.4s; }
@keyframes twinkle { 50% { transform: scale(.45) rotate(15deg); opacity: .45; } }
.bio {
  margin: 36px 0 0; max-width: 54ch;
  font: 300 clamp(22px, 2.3vw, 32px)/1.4 var(--serif);
  font-optical-sizing: auto;
  letter-spacing: -0.012em;
  text-wrap: pretty;
  color: var(--ink-2);
}
.bio .more { white-space: nowrap; }
.ink { color: var(--ink); }
.hero-links { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 28px 0 0; font-size: 15px; }
.hero-links a, .footer-links a { color: var(--accent); text-underline-offset: 4px; }
.hero-links a:hover, .footer-links a:hover { text-decoration: underline; }
.hero-links a[target], .footer-links a[target] { cursor: alias; }

/* book + writing side by side on wide screens */
.home-split { display: grid; gap: 72px; }
@media (min-width: 1024px) { .home-split { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 48px; align-items: start; } }

/* colored underline links (hero + prose) */
.u {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 5px;
  text-decoration-color: transparent;
  transition: text-decoration-color .2s;
}
.u:hover, .u:focus-visible { text-decoration-color: currentColor; }
.ext-u { cursor: alias; text-decoration-style: wavy; text-decoration-thickness: 1px; }

/* featured book */
.book {
  display: grid; grid-template-columns: 132px 1fr; gap: 28px; align-items: center;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--tile);
  cursor: alias;
  transition: background-color .2s;
}
.book:hover, .book:focus-visible { background: var(--tile-hover); }
.book-cover {
  width: 100%; height: auto;
  border-radius: 3px;
  box-shadow: var(--shadow), 0 0 0 1px rgb(0 0 0 / .06);
  transition: transform .35s cubic-bezier(.2,.8,.2,1);
}
.book:hover .book-cover { transform: translateY(-3px) rotate(-1deg); }
.book-body { min-width: 0; }
.eyebrow { margin: 0 0 8px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.book-title { margin: 0; font: 400 clamp(26px, 3vw, 34px)/1.15 var(--serif); letter-spacing: -0.02em; text-wrap: balance; }
.book-sub { margin: 4px 0 0; font: 300 italic 19px/1.4 var(--serif); color: var(--muted-2); }
.book-authors { margin: 14px 0 0; font-size: 14px; line-height: 1.5; color: var(--muted-2); max-width: 56ch; }
.book-cta {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 18px; padding: 6px 10px 6px 14px;
  font-size: 14px; color: var(--accent);
  border-radius: 999px;
  background: var(--btn); box-shadow: var(--skeuo);
}
@media (max-width: 539px) {
  .book { grid-template-columns: 88px 1fr; gap: 18px; padding: 18px; align-items: start; }
  .book-sub { font-size: 16px; }
}

/* home sections */
.sec-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding-bottom: 12px; margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.sec-head h2 { margin: 0; font: 400 26px/1.2 var(--serif); letter-spacing: -0.015em; }
.sec-head a { flex: none; font-size: 14px; color: var(--accent); }
.sec-head a:hover { text-decoration: underline; text-underline-offset: 4px; }

.art-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); padding-top: 8px; }
@media (max-width: 639px) { .art-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.art-thumb { display: grid; gap: 8px; font-size: 14px; letter-spacing: -0.02em; color: var(--muted-2); }
.art-thumb img {
  width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover;
  border-radius: var(--radius); background: var(--tile);
  transition: transform .35s cubic-bezier(.2,.8,.2,1);
}
.art-thumb:hover { color: var(--ink); }
.art-thumb:hover img { transform: translateY(-3px); }

/* ---------- Reveal animation --------------------------------------------- */
.reveal { animation: rise .6s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes rise { from { opacity: 0; transform: translateY(-10px); } }
@keyframes drop { from { opacity: 0; transform: translateY(-50px); } }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Pages --------------------------------------------------------- */
.page { max-width: 1120px; margin: 0 auto; padding: 56px 0 32px; }
.page-wide { max-width: none; }
.page-head { margin-bottom: 40px; }
.page-wide .page-head { max-width: 900px; }
.page-title {
  margin: 0;
  font: 300 clamp(36px, 5vw, 52px)/1.1 var(--serif);
  letter-spacing: -0.02em;
}
.page-intro {
  margin: 16px 0 0; max-width: 64ch;
  font: 300 22px/1.5 var(--serif);
  color: var(--muted-2);
}

.year-group { display: grid; grid-template-columns: 120px 1fr; gap: 0 24px; padding: 24px 0; border-top: 1px solid var(--line); }
.year { margin: 0; font: 400 14px/28px var(--sans); color: var(--muted); }
@media (max-width: 639px) { .year-group { grid-template-columns: 1fr; } .year { margin-bottom: 8px; } }

/* publications */
.pubs, .rows { list-style: none; margin: 0; padding: 0; }
.pub { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; padding: 4px 0 20px; }
.pub:last-child { padding-bottom: 4px; }
.pub-title { font: 400 21px/1.3 var(--serif); letter-spacing: -0.01em; }
a.pub-title { color: var(--accent); text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 4px; transition: text-decoration-color .2s; cursor: alias; }
a.pub-title:hover { text-decoration-color: currentColor; }
.pub-authors { margin: 6px 0 0; font-size: 14px; color: var(--muted-2); }
.pub-authors strong { color: var(--accent); font-weight: 500; }
.pub-venue { margin: 2px 0 0; font-size: 14px; font-style: italic; color: var(--muted); }
.pub-links { margin: 8px 0 0; display: flex; gap: 12px; font-size: 13px; }
.pub-links a { color: var(--muted-2); text-decoration: underline; text-underline-offset: 3px; }
.pub-links a:hover { color: var(--ink); }
.tag {
  flex: none; margin-top: 4px;
  padding: 2px 8px;
  font-size: 12px; color: var(--muted-2);
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--tile);
}

/* writing list */
.row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  margin: 0 -12px; padding: 8px 12px;
  border-radius: 8px;
  transition: background-color .15s;
}
.row:hover { background: var(--tile-hover); }
.row-title { font: 400 19px/1.4 var(--serif); color: var(--accent); }
.row-date { flex: none; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.row[target] { cursor: alias; }
.src {
  display: inline-block; vertical-align: 3px; margin-left: 6px;
  padding: 0 7px;
  font: 400 11px/18px var(--sans); letter-spacing: .02em; color: var(--muted-2);
  border: 1px solid var(--line); border-radius: 999px;
}
.feed-link { margin-top: 32px; font-size: 13px; color: var(--muted); }
.feed-link a:hover { color: var(--ink); text-decoration: underline; }

/* ---------- Post / prose -------------------------------------------------- */
.post { max-width: 680px; margin: 0 auto; padding: 48px 0 32px; }
.back { font-size: 14px; color: var(--muted); }
.back:hover { color: var(--ink); }
.post-title { margin: 20px 0 0; font: 400 clamp(34px, 5vw, 48px)/1.1 var(--serif); letter-spacing: -0.02em; text-wrap: balance; }
.post-meta { margin: 12px 0 40px; font-size: 14px; color: var(--muted); }
.prose { font: 400 19px/1.7 var(--serif); color: var(--ink-2); }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose figure { margin: 0 0 1.2em; }
.prose h2, .prose h3 { margin: 2em 0 .6em; font-family: var(--sans); font-weight: 600; letter-spacing: -0.02em; color: var(--ink); }
.prose h2 { font-size: 20px; } .prose h3 { font-size: 17px; }
.prose strong { color: var(--ink); font-weight: 500; }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.prose a:hover { text-decoration-color: var(--accent); }
.prose ul, .prose ol { padding-left: 1.2em; }
.prose li { margin: .3em 0; }
.prose blockquote { padding-left: 1em; border-left: 2px solid var(--line); color: var(--muted-2); font-style: italic; }
.prose img { border-radius: var(--radius); margin: 1.6em auto; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
.prose code { font: 0.85em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--tile-hover); padding: .1em .35em; border-radius: 4px; }
.prose pre { overflow-x: auto; padding: 16px; background: var(--tile); border: 1px solid var(--line); border-radius: var(--radius); font-size: 14px; line-height: 1.5; }
.prose pre code { background: none; padding: 0; }
.post-nav { display: flex; justify-content: space-between; gap: 16px; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); }
.post-nav a { display: grid; font: 400 17px/1.3 var(--serif); max-width: 45%; }
.post-nav a span { font: 400 13px var(--sans); color: var(--muted); margin-bottom: 4px; }
.post-nav a:hover { color: var(--muted-2); }
.post-nav .next { text-align: right; margin-left: auto; }

/* ---------- About --------------------------------------------------------- */
.about { display: grid; gap: 56px; grid-template-columns: 340px minmax(0, 1fr); align-items: start; }
.about-photo { width: 100%; height: auto; border-radius: var(--radius); position: sticky; top: 88px; }
@media (max-width: 819px) { .about { grid-template-columns: 1fr; } .about-photo { max-width: 280px; position: static; } }
.page .prose { font-size: 19px; max-width: 68ch; }

/* ---------- Art gallery --------------------------------------------------- */
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 24px; }
.chip {
  padding: 5px 12px;
  font: 400 14px/20px var(--sans); letter-spacing: -0.02em;
  color: var(--muted-2);
  background: var(--tile);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: color .15s, background-color .15s, box-shadow .15s;
}
.chip:hover { color: var(--ink); }
.chip.is-on { color: var(--ink); background: var(--btn); box-shadow: var(--skeuo); }

.gallery { columns: 4 260px; column-gap: var(--gap); }
.piece { break-inside: avoid; margin: 0 0 18px; }
.piece[hidden] { display: none; }
.piece-btn {
  display: block; width: 100%; padding: 0; border: 0;
  background: var(--tile);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: zoom-in;
}
.piece-btn img { width: 100%; height: auto; transition: transform .35s cubic-bezier(.2,.8,.2,1); }
.piece-btn:hover img { transform: scale(1.03); }
.piece figcaption { display: flex; justify-content: space-between; gap: 12px; padding: 8px 2px 0; font-size: 14px; letter-spacing: -0.02em; }
.piece figcaption .muted { text-align: right; font-size: 13px; }

.lightbox {
  width: 100vw; height: 100vh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: transparent; color: var(--ink);
}
.lightbox::backdrop { background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.lightbox[open] { display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; animation: fade .2s both; }
.lightbox figure { margin: 0; height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 56px 0 24px; min-width: 0; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 200px); object-fit: contain; border-radius: var(--radius); box-shadow: var(--shadow); }
.lightbox figcaption { max-width: 640px; text-align: center; padding-top: 16px; }
.lightbox figcaption strong { display: block; font: 400 24px/1.2 var(--serif); }
.lightbox figcaption span { font-size: 14px; }
.lightbox figcaption p { margin: 8px 0 0; font: 400 16px/1.5 var(--serif); color: var(--muted-2); }
.lightbox figcaption p:empty { display: none; }
.lb-nav, .lb-close {
  display: grid; place-items: center;
  width: 40px; height: 40px; margin: auto;
  font: 16px var(--sans); color: var(--ink);
  background: var(--btn); border: 0; border-radius: 999px;
  box-shadow: var(--skeuo); cursor: pointer;
}
.lb-close { position: fixed; top: 16px; right: 16px; }
@media (max-width: 639px) {
  .lightbox[open] { grid-template-columns: 1fr; }
  .lb-nav { position: fixed; bottom: 16px; }
  .lb-prev { left: 16px; } .lb-next { right: 16px; }
  .lightbox figure { padding: 64px 16px 72px; }
}

/* ---------- Wooper the cat (sprite from my VS Code extension) ------------- */
/* sits next to the GitHub link, top right; blinks and flicks his tail.
   Drawn at exactly 2x (22px sprite -> 44px) so the pixels stay square. */
.nav-ext { align-items: center; }
.nav-ext .gh { display: inline-flex; align-items: center; gap: 6px; }
.wooper {
  flex: none;
  width: 44px; height: 44px; margin: -10px 0;
  background: url("../img/wooper-sit.svg") 0 0 / 300% 100% no-repeat;
  image-rendering: pixelated;
  animation: wooper-idle 2.24s step-end infinite;
}
/* frames 0,0,0,0,0,1,1,0,0,0,0,0,2,0 like the extension: 1 = tail flick, 2 = blink */
@keyframes wooper-idle {
  0% { background-position-x: 0%; }
  35.71% { background-position-x: 50%; }
  50% { background-position-x: 0%; }
  85.71% { background-position-x: 100%; }
  92.86% { background-position-x: 0%; }
}

/* ---------- Footer -------------------------------------------------------- */
.footer {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 64px 0 40px;
  font-size: 14px; color: var(--muted);
}
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin: 4px 0 0; }
.seal { width: 40px; height: auto; opacity: .9; transition: transform .4s cubic-bezier(.2,.8,.2,1); }
.footer:hover .footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin: 4px 0 0; }
.seal { transform: rotate(-8deg) scale(1.08); }
@media (prefers-color-scheme: dark) { .footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin: 4px 0 0; }
.seal { filter: brightness(1.7) saturate(1.2); } }
