/* ============================================================
   KAMA WANG · PORTFOLIO — DESIGN SYSTEM
   A hand-bound artist's book — five chapters, sewn together.
   ============================================================ */

/* ---------- DESIGN TOKENS ---------- */
:root {
  /* Greens — stable, calm base (vintage linen & deep forest) */
  --green-vintage: #4a5d3a;
  --green-deep:    #2e3a26;
  --green-deeper:  #1f2820;
  --green-soft:    #6f7e5e;

  /* Red accent — the single bolt of stitched thread */
  --red-accent:    #963E42;
  --red-darker:    #6d2e30;
  --red-soft:      #b56063;

  /* Cream & paper — the binding cloth & aged paper */
  --cream-bg:      #F4EFE4;
  --cream-warm:    #ebe3d4;
  --cream-deep:    #d9cfb9;

  /* Paper beige — secondary text & aged edges */
  --paper-beige:   #C5AE8C;
  --paper-amber:   #a88a64;

  /* Ink — body text */
  --black-ink:     #1a1a1a;
  --ink-soft:      #3d3a35;
  --ink-mute:      #6b6760;
  --ink-faint:     #9b968c;

  /* Type stacks */
  --font-serif-cn: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --font-sans-cn:  "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --font-serif-en: "Cormorant Garamond", "EB Garamond", "Playfair Display", Georgia, serif;
  --font-mono:     "Special Elite", "Courier Prime", "Courier New", monospace;

  /* Spacing & motion */
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --gutter-xl: clamp(2rem, 6vw, 5rem);
  --radius-soft: 2px;
  --motion: 0.5s cubic-bezier(.2,.7,.2,1);
}

/* ---------- RESET ---------- */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans-cn);
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink-soft);
  /* Cream textured background (provided by user) + subtle paper grain on top */
  background-color: var(--cream-bg);
  background-image:
    /* very faint grain */
    radial-gradient(rgba(74, 93, 58, 0.022) 1px, transparent 1px),
    url('../images/cream-bg-texture.jpg');
  background-size: 4px 4px, 720px auto;
  background-position: 0 0, center top;
  background-repeat: repeat, repeat-y;
  background-attachment: scroll, scroll;
  min-height: 100vh;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
ul, ol { list-style: none; }
::selection { background: var(--red-accent); color: var(--cream-bg); }

/* ---------- TYPOGRAPHY ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-serif-cn);
  font-weight: 500;
  color: var(--black-ink);
  letter-spacing: 0.02em;
}
h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); line-height: 1.1; letter-spacing: 0.05em; }
h2 { font-size: clamp(1.75rem, 3.5vw, 2.5rem); line-height: 1.25; }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); line-height: 1.4; }
.serif-en { font-family: 'Caveat', var(--font-serif-en); font-style: normal; font-weight: 500; letter-spacing: 0.02em; }
.mono { font-family: var(--font-mono); letter-spacing: 0.05em; }
.accent { color: var(--red-accent); }
.mute { color: var(--ink-mute); }

/* ---- TYPE SYSTEM (derived from the supplied font references) ----
   字体3 → English accents: dashed cross-stitch script (red thread) */
.type-en-stitch,
.section-head__sub,
.chapter-head__sub,
.cover__lede .serif-en {
  color: var(--red-accent);
}
/* 中文字体3 → Chinese display: embroidered black thread */
.type-cn-stitch {
  font-family: var(--font-serif-cn);
  font-weight: 900;
  color: #17170f;
  letter-spacing: 0.08em;
  filter: url(#embroidery);
}

/* ---------- LAYOUT PRIMITIVES ---------- */
.page-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}
/* Green cloth "cover" behind everything (background image supplied by user) */
.bound {
  position: relative;
  background-color: #3d4a30;
  background-image: url('../images/bg-green-linen.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

/* The reading column — a cream sheet bound in green cloth */
.book-nav,
#main,
.book-colophon {
  max-width: 1440px;
  margin-left: auto;
  margin-right: auto;
}
#main {
  background-color: var(--cream-bg);
  background-image: radial-gradient(rgba(74, 93, 58, 0.018) 1px, transparent 1px);
  background-size: 4px 4px;
  box-shadow: 0 0 0 1px rgba(31, 40, 32, 0.16), 0 30px 80px rgba(0, 0, 0, 0.28);
}

/* The spine — single vertical stitch running down the center of every page */
.spine {
  position: fixed;
  top: 0; left: 50%;
  width: 1px;
  height: 100vh;
  transform: translateX(-50%);
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 6px,
    var(--ink-faint) 6px,
    var(--ink-faint) 12px
  );
  opacity: 0.18;
  pointer-events: none;
  z-index: 1;
}
@media (max-width: 768px) { .spine { display: none; } }

/* ---------- TOP NAVIGATION — like the title page of an old volume ---------- */
.book-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(244, 239, 228, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--cream-deep);
  padding: 1.2rem 0;
}
.book-nav__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}
.book-nav__brand {
  font-family: var(--font-serif-cn);
  font-size: 1.1rem;
  color: var(--green-deep);
  letter-spacing: 0.18em;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}
.book-nav__brand .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--red-accent);
  border-radius: 50%;
  margin: 0 0.6rem 2px;
  vertical-align: middle;
}
.book-nav__chapters {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.book-nav__chapters li {
  position: relative;
  padding: 0 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.book-nav__chapters li:not(:last-child)::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 1px;
  background: var(--ink-faint);
}
.book-nav__chapters a {
  display: inline-block;
  padding: 0.3rem 0;
  transition: color var(--motion);
}
.book-nav__chapters a:hover { color: var(--red-accent); }
.book-nav__chapters a.active {
  color: var(--green-deep);
  border-bottom: 1px solid var(--red-accent);
}
.book-nav__chapters .num {
  color: var(--red-accent);
  font-weight: 700;
}
@media (max-width: 768px) {
  /* 小屏导航改为上下两行：品牌一行、章节一行，避免互相挤压换行 */
  .book-nav { padding: 0.45rem 0; }
  .book-nav__inner {
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0 0.75rem;
  }
  .book-nav__brand { font-size: 1rem; }
  .book-nav__chapters {
    font-size: 0.58rem;
    justify-content: center;
    gap: 0.1rem 0.2rem;
    width: 100%;
  }
  .book-nav__chapters li { padding: 0 0.22rem; }
  .book-nav__chapters .num { display: none; }
  .book-nav__chapters li:not(:last-child)::after { width: 4px; }
}

/* ---------- PAGE HEADER — like opening a chapter ---------- */
.chapter-head {
  padding: clamp(4rem, 10vw, 8rem) 0 clamp(2rem, 5vw, 4rem);
  position: relative;
}
.chapter-head__num {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.3em;
  color: var(--red-accent);
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
}
.chapter-head__num::before {
  content: "";
  display: inline-block;
  width: 36px;
  height: 1px;
  background: var(--red-accent);
}
.chapter-head__title {
  font-family: var(--font-serif-cn);
  font-size: clamp(2.5rem, 5vw, 4rem);
  color: var(--green-deep);
  margin-bottom: 0.6rem;
  letter-spacing: 0.04em;
}
.chapter-head__sub {
  font-family: var(--font-serif-en);
  font-style: italic;
  color: var(--ink-mute);
  font-size: 1.1rem;
}
.chapter-head__meta {
  margin-top: 2rem;
  display: flex;
  gap: 2rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-faint);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.chapter-head__meta span::before {
  content: "·";
  margin-right: 0.6rem;
  color: var(--red-accent);
}
.chapter-head__meta span:first-child::before { content: ""; margin: 0; }

/* ---------- FOOTER — colophon page ---------- */
.book-colophon {
  background: var(--green-deep);
  color: var(--cream-bg);
  padding: clamp(3rem, 7vw, 5rem) 0 2rem;
  margin-top: 5rem;
  position: relative;
}
.book-colophon::before {
  content: "";
  display: block;
  height: 6px;
  background: repeating-linear-gradient(
    90deg,
    var(--red-accent) 0,
    var(--red-accent) 4px,
    transparent 4px,
    transparent 10px
  );
  position: absolute;
  top: 0; left: 0; right: 0;
}
.book-colophon__title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--paper-beige);
  letter-spacing: 0.3em;
  margin-bottom: 2rem;
  text-transform: uppercase;
}
.book-colophon__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2.5rem;
  padding-bottom: 3rem;
  border-bottom: 1px dashed rgba(244, 239, 228, 0.2);
}
.book-colophon h4 {
  color: var(--cream-bg);
  font-size: 0.95rem;
  margin-bottom: 0.6rem;
  letter-spacing: 0.05em;
}
.book-colophon p, .book-colophon a {
  color: rgba(244, 239, 228, 0.7);
  font-size: 0.88rem;
  line-height: 1.9;
}
.book-colophon a:hover { color: var(--red-soft); }
.book-colophon__bottom {
  margin-top: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: rgba(244, 239, 228, 0.5);
  text-transform: uppercase;
}
@media (max-width: 768px) {
  .book-colophon__grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* ---------- MOTIFS (used sparingly — 1 or 2 per page max) ---------- */

/* 1) Vertical stitched seam */
.stitch-v {
  width: 1px;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 7px,
    currentColor 7px,
    currentColor 13px
  );
  opacity: 0.6;
}
.stitch-h {
  height: 1px;
  background: repeating-linear-gradient(
    to right,
    transparent 0,
    transparent 7px,
    currentColor 7px,
    currentColor 13px
  );
  opacity: 0.6;
}

/* 2) Fabric tag (a pinned label with stitched border) */
.fabric-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  background: var(--green-vintage);
  color: var(--cream-bg);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  position: relative;
  border-radius: 1px;
  box-shadow:
    inset 0 0 0 1px rgba(244, 239, 228, 0.15),
    2px 2px 0 rgba(31, 40, 32, 0.4);
  transform: rotate(-1.5deg);
}
.fabric-tag::before {
  content: "";
  width: 4px; height: 4px;
  background: var(--red-accent);
  border-radius: 50%;
  display: inline-block;
}
.fabric-tag--flat { transform: rotate(0); }
.fabric-tag--right { transform: rotate(2deg); }
.fabric-tag--light { background: var(--cream-warm); color: var(--green-deep); }
.fabric-tag--red { background: var(--red-accent); }

/* 3) Page number / position marker */
.pg-num {
  position: absolute;
  top: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--ink-mute);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.pg-num--tl { left: var(--gutter); }
.pg-num--tr { right: var(--gutter); }
.pg-num--bl { bottom: 1.5rem; top: auto; left: var(--gutter); }
.pg-num--br { bottom: 1.5rem; top: auto; right: var(--gutter); }
.pg-num::before {
  content: "";
  width: 24px; height: 1px;
  background: currentColor;
  opacity: 0.5;
}

/* 4) Stamp / seal (for verified items) */
.stamp {
  display: inline-block;
  padding: 0.5rem 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  color: var(--red-accent);
  border: 1.5px solid var(--red-accent);
  text-transform: uppercase;
  position: relative;
  background: transparent;
  transform: rotate(-4deg);
  opacity: 0.85;
}
.stamp--quiet {
  color: var(--green-vintage);
  border-color: var(--green-vintage);
  transform: rotate(2deg);
}

/* 5) Torn paper edge */
.torn {
  --tear-color: var(--cream-warm);
  position: relative;
  background: var(--cream-warm);
  padding: 2rem;
}
.torn::before, .torn::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 14px;
  background: var(--cream-warm);
  -webkit-mask: var(--tear-mask, none);
          mask: var(--tear-mask, none);
}
.torn::before {
  top: -1px;
  /* SVG noise to simulate torn paper */
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 14' preserveAspectRatio='none'><path d='M0 0 L100 0 L100 6 L96 8 L91 5 L86 9 L82 5 L77 10 L72 4 L67 9 L61 5 L55 11 L48 4 L42 8 L36 5 L29 9 L22 4 L17 9 L11 5 L5 8 L0 5 Z' fill='black'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 14' preserveAspectRatio='none'><path d='M0 0 L100 0 L100 6 L96 8 L91 5 L86 9 L82 5 L77 10 L72 4 L67 9 L61 5 L55 11 L48 4 L42 8 L36 5 L29 9 L22 4 L17 9 L11 5 L5 8 L0 5 Z' fill='black'/></svg>");
  -webkit-mask-size: 100% 100%;
          mask-size: 100% 100%;
}
.torn::after {
  bottom: -1px;
  transform: scaleY(-1);
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 14' preserveAspectRatio='none'><path d='M0 0 L100 0 L100 6 L96 8 L91 5 L86 9 L82 5 L77 10 L72 4 L67 9 L61 5 L55 11 L48 4 L42 8 L36 5 L29 9 L22 4 L17 9 L11 5 L5 8 L0 5 Z' fill='black'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 14' preserveAspectRatio='none'><path d='M0 0 L100 0 L100 6 L96 8 L91 5 L86 9 L82 5 L77 10 L72 4 L67 9 L61 5 L55 11 L48 4 L42 8 L36 5 L29 9 L22 4 L17 9 L11 5 L5 8 L0 5 Z' fill='black'/></svg>");
  -webkit-mask-size: 100% 100%;
          mask-size: 100% 100%;
}

/* 6) Lace frame */
.lace-frame {
  position: relative;
  padding: 3.5rem 2.5rem;
}
.lace-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--cream-warm);
  border: 1px solid var(--paper-beige);
  z-index: -1;
}
.lace-frame::after {
  content: "";
  position: absolute;
  inset: -1.5rem;
  border: 1px dashed var(--paper-beige);
  pointer-events: none;
}

/* ---------- UTILITY ---------- */
.text-center { text-align: center; }
.divider {
  display: block;
  width: 100%;
  height: 1px;
  background: var(--cream-deep);
  margin: 3rem 0;
}
.divider--stitch {
  height: 6px;
  background: repeating-linear-gradient(
    90deg,
    var(--red-accent) 0,
    var(--red-accent) 3px,
    transparent 3px,
    transparent 9px
  );
}
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-sm { gap: 0.75rem; }
.gap-md { gap: 1.5rem; }
.gap-lg { gap: 3rem; }
.mt-md { margin-top: 2rem; }
.mt-lg { margin-top: 4rem; }

/* ---------- ANIMATION ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* Reveal is progressive enhancement: without JS the content stays visible
   (the hidden state is scoped to html.js, added by an inline script). */
.reveal,
[data-reveal] { transition: opacity 0.9s ease, transform 0.9s ease; }
.js .reveal:not(.in),
.js [data-reveal]:not(.in) { opacity: 0; transform: translateY(20px); }
.js .reveal.in,
.js [data-reveal].in { opacity: 1; transform: translateY(0); }

/* ---------- TOP PROGRESS STITCH (the reading thread) ---------- */
.progress-stitch {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 4px;
  z-index: 200;
  background: rgba(31, 40, 32, 0.08);
  pointer-events: none;
}
.progress-stitch__fill {
  display: block;
  height: 100%;
  width: 0;
  background: repeating-linear-gradient(
    90deg,
    var(--red-accent) 0,
    var(--red-accent) 5px,
    transparent 5px,
    transparent 11px
  );
  transition: width 0.08s linear;
}
.count { font-variant-numeric: tabular-nums; }

/* ---------- OPACITY-ONLY REVEAL (safe for sticky children) ----------
   A transform on any ancestor breaks position: sticky, so sections that
   contain pinned headers must NOT use the translate-based .reveal. */
.reveal--fade { transition: opacity 1s ease; }
.js .reveal--fade:not(.in) { opacity: 0; }
.js .reveal--fade.in { opacity: 1; }

/* ---------- SECTION HEADER (shared by every chapter) ---------- */
.section-head {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  position: relative;
}
.section-head__num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--red-accent);
  letter-spacing: 0.3em;
  margin-bottom: 0.8rem;
}
/* 布料标签版小节编号 —— 与 projects 分类头的 CAT. I 同款 */
.section-head__tag { margin-bottom: 0.9rem; }
.section-head__title {
  font-family: var(--font-serif-cn);
  font-weight: 400;
  font-size: clamp(2rem, 4vw, 3rem);
  color: var(--green-deep);
  letter-spacing: 0.08em;
  margin-bottom: 0.4rem;
}
.section-head__sub {
  font-family: var(--font-serif-en);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--ink-mute);
}

/* ---------- PINNED SECTION HEADERS (chapters that hold their place) ---------- */
.pin-head {
  position: sticky;
  top: 76px;
  z-index: 6;
  background: rgba(244, 239, 228, 0.95);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--cream-deep);
  box-shadow: 0 8px 18px -18px rgba(31, 40, 32, 0.5);
}
/* Compound selectors so these win over per-page .section-head rules */
.section-head.pin-head,
.proj-cat__head.pin-head { position: sticky; }
.proj-cat__head.pin-head { padding: 0.9rem 0; }
@media (max-width: 768px) {
  /* Nav wraps taller on small screens — don't pin headers (avoids overlap) */
  .section-head.pin-head,
  .proj-cat__head.pin-head { position: static; }
  .pin-head { box-shadow: none; }
}

/* ---------- CHAPTER RAIL (persistent scrollspy) ---------- */
.chapter-rail {
  position: fixed;
  right: 1.4rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.85rem;
}
.chapter-rail__item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.chapter-rail__label {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  white-space: nowrap;
  opacity: 0;
  transform: translateX(6px);
  transition: opacity var(--motion), transform var(--motion), color var(--motion);
}
.chapter-rail__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid var(--ink-faint);
  background: transparent;
  transition: all var(--motion);
}
.chapter-rail__item:hover .chapter-rail__label { opacity: 1; transform: translateX(0); }
.chapter-rail__item.is-active .chapter-rail__dot {
  background: var(--red-accent);
  border-color: var(--red-accent);
  transform: scale(1.45);
}
.chapter-rail__item.is-active .chapter-rail__label {
  opacity: 1;
  transform: translateX(0);
  color: var(--red-accent);
}
@media (max-width: 1100px) { .chapter-rail { display: none; } }

/* ============================================================
   CROSS-STITCH FRAME (十字绣边框)
   Reference: embroidered X-stitch border + inner stitched line.
   Applied to the card "interfaces" across every chapter.
   ============================================================ */
.contents__item a,
.cap,
.proj__main,
.tl__card,
.edu__card,
.skills__group,
.trait,
.channel,
.letter__card,
.awards__list {
  border: 10px solid transparent !important;
  border-image: url('../images/xstitch-frame.svg') 10 / 10px round !important;
}
/* Light stitches for panels on dark backgrounds */
.skills__group--craft,
.stats__grid,
.exp-back__panel {
  border: 10px solid transparent !important;
  border-image: url('../images/xstitch-frame-light.svg') 10 / 10px round !important;
}
/* Inner stitched line — the double frame of the reference */
.contents__item a::after,
.cap::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px dashed var(--paper-beige);
  pointer-events: none;
}
.contents__item a,
.cap { position: relative; }
@media (max-width: 768px) {
  .contents__item a,
  .cap,
  .proj__main,
  .tl__card,
  .edu__card,
  .skills__group,
  .trait,
  .channel,
  .letter__card,
  .awards__list,
  .skills__group--craft,
  .stats__grid,
  .exp-back__panel {
    border-width: 7px !important;
    border-image-width: 7px !important;
  }
}

/* ---------- ACCESSIBILITY ---------- */
:focus-visible { outline: 2px dashed var(--red-accent); outline-offset: 4px; }
.skip-link {
  position: absolute; top: -40px; left: 0;
  padding: 0.5rem 1rem; background: var(--green-deep); color: var(--cream-bg);
  z-index: 999;
}
.skip-link:focus { top: 0; }

/* ============================================================
   SEWING ASSETS (watercolour illustrations & fabric patches)
   White-background JPGs are dropped onto the cloth with multiply.
   ============================================================ */
.sew {
  position: absolute;
  z-index: 0;
  pointer-events: none;
  width: var(--sew-w, 104px);
  height: auto;
}
.sew--tl { top: 1rem; left: 1rem; transform: rotate(-8deg); }
.sew--tr { top: 1rem; right: 1rem; transform: rotate(8deg); }
.sew--bl { bottom: 1rem; left: 1rem; transform: rotate(-6deg); }
.sew--br { bottom: 1rem; right: 1rem; transform: rotate(6deg); }
.sew--sm { --sew-w: 72px; }
.sew--lg { --sew-w: 156px; }
.sew--head { top: -0.5rem; right: 0; --sew-w: 92px; transform: rotate(6deg); }
@media (max-width: 900px) { .sew { display: none; } }

/* host sections keep the decorations in place */
.contents, .caps, .download, .intro, .traits, .awards,
.channels, .finale, .letter, .timeline { position: relative; }
.contents__grid, .caps__grid, .proj-list, .letter__card { position: relative; z-index: 1; }

/* ============================================================
   GLITCH TEXT — ported from react-bits GlitchText (JS-CSS)
   Two clipped, offset copies with red / teal thread shadows.
   Usage: <span class="glitch" data-text="…">…</span>
   ============================================================ */
.glitch {
  position: relative;
  display: inline-block;
  cursor: pointer;
  user-select: none;
}
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  clip-path: inset(0 0 0 0);
  background: var(--glitch-bg, var(--cream-bg));
  color: inherit;
  pointer-events: none;
}
.glitch::after {
  left: 2px;
  text-shadow: -2px 0 var(--glitch-1, var(--red-accent));
  animation: glitch-slice var(--after-duration, 3s) infinite linear alternate-reverse;
}
.glitch::before {
  left: -2px;
  text-shadow: 2px 0 var(--glitch-2, #2f9e8f);
  animation: glitch-slice var(--before-duration, 2s) infinite linear alternate-reverse;
}
@keyframes glitch-slice {
  0%   { clip-path: inset(20% 0 50% 0); }
  5%   { clip-path: inset(10% 0 60% 0); }
  10%  { clip-path: inset(15% 0 55% 0); }
  15%  { clip-path: inset(25% 0 30% 0); }
  20%  { clip-path: inset(35% 0 15% 0); }
  25%  { clip-path: inset(5% 0 70% 0); }
  30%  { clip-path: inset(45% 0 10% 0); }
  35%  { clip-path: inset(30% 0 40% 0); }
  40%  { clip-path: inset(20% 0 50% 0); }
  45%  { clip-path: inset(55% 0 5% 0); }
  50%  { clip-path: inset(10% 0 65% 0); }
  55%  { clip-path: inset(40% 0 20% 0); }
  60%  { clip-path: inset(25% 0 45% 0); }
  65%  { clip-path: inset(5% 0 75% 0); }
  70%  { clip-path: inset(50% 0 15% 0); }
  75%  { clip-path: inset(15% 0 55% 0); }
  80%  { clip-path: inset(35% 0 35% 0); }
  85%  { clip-path: inset(20% 0 50% 0); }
  90%  { clip-path: inset(45% 0 25% 0); }
  95%  { clip-path: inset(10% 0 60% 0); }
  100% { clip-path: inset(20% 0 50% 0); }
}
/* Hover-only variant (glitches only while hovered) */
.glitch--hover::before,
.glitch--hover::after { animation-play-state: paused; }
.glitch--hover:hover::before,
.glitch--hover:hover::after { animation-play-state: running; }
@media (prefers-reduced-motion: reduce) {
  .glitch::before, .glitch::after { animation: none; }
}


/* ============================================================
   简历自取 · 双方向选择（<details> 原生展开，无 JS 依赖）
   ============================================================ */
.resume-pick { position: relative; display: inline-block; }
.resume-pick > summary {
  list-style: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.resume-pick > summary::-webkit-details-marker { display: none; }
.resume-pick > summary::marker { content: ""; }
.resume-pick__mark {
  margin-left: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1;
  display: inline-block;
  transition: transform var(--motion);
}
.resume-pick[open] > summary { background: var(--green-vintage); color: var(--cream-bg); }
.resume-pick[open] .resume-pick__mark { transform: rotate(45deg); }

.resume-pick__menu {
  position: absolute;
  top: calc(100% + 0.7rem);
  left: 0;
  z-index: 40;
  width: min(84vw, 330px);
  padding: 0.95rem 1rem 0.8rem;
  background: var(--cream-bg);
  border: 1px solid var(--paper-beige);
  box-shadow: 6px 6px 0 rgba(31, 40, 32, 0.18);
  text-align: left;
}
.resume-pick__hint {
  font-size: 0.64rem;
  letter-spacing: 0.18em;
  color: var(--red-accent);
  margin-bottom: 0.5rem;
}
.resume-pick__item {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.65rem 0.45rem 0.6rem;
  border-top: 1px dashed var(--cream-deep);
  color: var(--ink-soft);
  transition: background var(--motion), transform var(--motion);
}
.resume-pick__item:first-of-type { border-top: 0; }
.resume-pick__item:hover { background: var(--cream-warm); transform: translateX(2px); }
.resume-pick__no {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--red-accent);
  padding-top: 0.25rem;
}
.resume-pick__body b {
  display: block;
  font-family: var(--font-serif-cn);
  font-size: 0.98rem;
  font-weight: 500;
  color: var(--green-deep);
  letter-spacing: 0.04em;
}
.resume-pick__body em {
  display: block;
  font-style: normal;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--ink-mute);
  margin-top: 0.15rem;
}

/* 小屏：菜单改为文档流内展开，避免溢出与遮挡 */
@media (max-width: 560px) {
  .resume-pick { display: block; width: 100%; }
  .resume-pick > summary { width: 100%; }
  .resume-pick__menu {
    position: static;
    width: 100%;
    margin-top: 0.6rem;
    box-shadow: 3px 3px 0 rgba(31, 40, 32, 0.15);
  }
}
