/* ============================================================================
   Yeux Page · paper / ink design system
   低饱和 · 纸质感 · 手绘凌乱感   (ref: 卢广仲《鱼仔》cover + Bakemonogatari title)
   All colours desaturated graphite-on-paper. Accent = one faint stamp-red only.
   ========================================================================== */

/* ---- Fonts -----------------------------------------------------------------
   Webfonts are loaded via <link rel="stylesheet"> in each page <head> (with
   preconnect) instead of CSS @import, so they no longer block this stylesheet.
   LXGW WenKai (霞鹜文楷) loads from jsDelivr (reachable in CN); Caveat / Ma Shan
   Zheng come from Google Fonts as progressive enhancement. Strong system
   fallbacks (楷体/KaiTi) keep the handwritten feel if a CDN is blocked.
   For production, self-host these (see design/art-direction.md §Typography).   */

:root {
  color-scheme: light;

  /* paper */
  --paper:        #d8d3cc;
  --paper-hi:     #e7e3db;
  --paper-lo:     #c6c0b6;
  --paper-edge:   #b4ada1;

  /* ink */
  --ink:          #1b1815;
  --ink-soft:     #3b352f;
  --ink-mute:     rgba(27, 24, 21, 0.56);
  --ink-faint:    rgba(27, 24, 21, 0.30);
  --ink-ghost:    rgba(27, 24, 21, 0.14);
  --line:         rgba(27, 24, 21, 0.34);

  /* the single restrained accent: faded seal vermilion */
  --seal:         #8c3a2c;
  --seal-soft:    rgba(140, 58, 44, 0.72);

  /* props */
  --tape:         rgba(206, 188, 138, 0.46);
  --tape-edge:    rgba(150, 132, 84, 0.30);
  --shadow:       0 16px 34px rgba(46, 39, 31, 0.16);
  --shadow-soft:  0 6px 16px rgba(46, 39, 31, 0.12);

  /* type */
  --font-hand:  "LXGW WenKai Screen", "LXGW WenKai", "霞鹜文楷", "楷体", "KaiTi", "STKaiti", serif;
  --font-brush: "Ma Shan Zheng", "LXGW WenKai Screen", "STKaiti", "楷体", serif;
  --font-en:    "Caveat", "Segoe Print", "Bradley Hand ITC", var(--font-hand), cursive;

  --maxw: 1080px;
  --radius: 3px;            /* paper has almost no rounding */
}

/* ---- reset ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-hand);
  font-size: 18px;
  line-height: 1.95;
  letter-spacing: 0.01em;
  background-color: var(--paper);
  /* faked paper mottle; a real scan can be dropped on .stage / body via art doc */
  background-image:
    radial-gradient(120% 120% at 50% 30%, var(--paper-hi) 0%, var(--paper) 46%, var(--paper-lo) 100%),
    radial-gradient(60% 50% at 18% 12%, rgba(255,255,255,0.22), transparent 60%),
    radial-gradient(70% 60% at 82% 88%, rgba(90,78,60,0.10), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; }

a { color: var(--ink); text-decoration: none; }

::selection { background: var(--seal-soft); color: var(--paper-hi); }

/* ---- global texture overlays --------------------------------------------- */
/* film grain + paper fibre, fixed over everything, multiply blended.          */
.grain {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  mix-blend-mode: multiply;
  opacity: 0.5;
  background-image:
    repeating-linear-gradient(0deg,   rgba(255,255,255,0.05) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(91deg,  rgba(20,18,16,0.035)   0 1px, transparent 1px 9px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  background-size: auto, auto, 180px 180px;
  animation: grain-shiver 360ms steps(2, end) infinite;
}

/* edge vignette — keeps the page feeling like a lit sheet of paper */
.vignette {
  position: fixed;
  inset: 0;
  z-index: 81;
  pointer-events: none;
  mix-blend-mode: multiply;
  background:
    radial-gradient(120% 100% at 50% 46%, transparent 0 56%, rgba(40,34,28,0.16) 84%, rgba(28,23,18,0.30) 100%),
    linear-gradient(90deg, rgba(40,34,28,0.14), transparent 10% 90%, rgba(40,34,28,0.14));
}

@keyframes grain-shiver {
  0%, 100% { transform: translate3d(0,0,0);          opacity: 0.50; }
  40%      { transform: translate3d(0.2px,-0.18px,0); opacity: 0.56; }
  72%      { transform: translate3d(-0.16px,0.12px,0);opacity: 0.44; }
}

/* ---- hand-drawn ink helpers ---------------------------------------------- */
/* roughen filter is declared once in an inline <svg> on each page (#roughen).  */
.rough { filter: url(#roughen); }

/* a tiny perpetual tremble for "the line is being re-drawn" feeling */
.shiver { animation: hand-shiver 2.6s ease-in-out infinite; }
@keyframes hand-shiver {
  0%, 100% { transform: translate(0,0) rotate(0deg); }
  25%      { transform: translate(0.4px,-0.3px) rotate(-0.18deg); }
  50%      { transform: translate(-0.3px,0.4px) rotate(0.16deg); }
  75%      { transform: translate(0.3px,0.2px) rotate(-0.1deg); }
}

/* ink underline that looks brushed, not ruled — shrink-wraps the text so the
   stroke sits only under the characters, with a small hand-drawn overshoot */
.inkline { position: relative; display: inline-block; }
.inkline::after {
  content: "";
  position: absolute;
  left: -3%;
  right: -3%;
  bottom: 0.02em;
  height: 0.34em;
  background: var(--ink);
  opacity: 0.18;
  filter: url(#roughen);
  transform: skewX(-9deg) scaleY(0.34);
}

/* ---- layout primitives ---------------------------------------------------- */
.wrap { width: min(100% - 2.4rem, var(--maxw)); margin-inline: auto; }

.section { padding-block: clamp(3.5rem, 9vw, 7rem); }

.eyebrow {
  font-family: var(--font-en);
  font-size: 1.05rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.h-title {
  font-family: var(--font-brush);
  font-weight: 400;
  line-height: 1.18;
  letter-spacing: 0.04em;
  margin: 0.2em 0 0.5em;
  font-size: clamp(2rem, 5.5vw, 3.6rem);
}

.lede { color: var(--ink-soft); max-width: 46ch; }

/* hand-drawn box border via SVG roughen on a pseudo-element */
.framed { position: relative; }
.framed::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1.6px solid var(--ink);
  opacity: 0.62;
  filter: url(#roughen);
  pointer-events: none;
  border-radius: var(--radius);
}

/* washi-tape strip, drop onto any pinned element */
.tape {
  position: absolute;
  width: 84px;
  height: 26px;
  background: var(--tape);
  border-left: 1px dashed var(--tape-edge);
  border-right: 1px dashed var(--tape-edge);
  box-shadow: 0 2px 6px rgba(40,34,28,0.12);
  opacity: 0.9;
  transform: rotate(-4deg);
  z-index: 2;
}

/* real washi-tape PNG, pinned to the top edge of a pinned card / signpost.
   Three variants rotate by position so repeated cards don't reuse one strip. */
.washi {
  position: absolute;
  top: -13px;
  left: 50%;
  width: 94px;
  height: 28px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-image: url("/assets/img/ink/tape-01.png");
  transform: translateX(-50%) rotate(-3deg);
  opacity: 0.94;
  pointer-events: none;
  z-index: 4;
  filter: drop-shadow(0 2px 4px rgba(40, 34, 28, 0.16));
}
.card:nth-child(3n+2) .washi,
.signpost:nth-child(2) .washi {
  background-image: url("/assets/img/ink/tape-02.png");
  transform: translateX(-58%) rotate(2.6deg);
}
.card:nth-child(3n) .washi,
.signpost:nth-child(3) .washi {
  background-image: url("/assets/img/ink/tape-03.png");
  transform: translateX(-42%) rotate(-5deg);
}

/* ============================================================================
   TOP NAV — appears as a faint hand-written rail, hidden on the bare cover
   ========================================================================== */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem clamp(1.2rem, 4vw, 2.6rem);
  /* nav 常驻可点：封面上无背景条（干净浮在纸面），滚动进内容后才加纸色背景，避免与卡片重叠 */
  background: transparent;
  transition: background 0.5s ease;
  pointer-events: auto;
}
.topbar.is-shown { background: linear-gradient(180deg, rgba(216,211,204,0.94), rgba(216,211,204,0)); }
/* on the homepage cover the nav is text, which the cover must not show — ink.js
   adds .cover-mode there, so the bar stays hidden until you scroll past the fish */
.topbar.cover-mode {
  opacity: 0;
  transform: translateY(-100%);
  pointer-events: none;
  transition: background 0.5s ease, opacity 0.5s ease, transform 0.5s ease;
}
.topbar.cover-mode.is-shown { opacity: 1; transform: none; pointer-events: auto; }

.brand {
  font-family: var(--font-brush);
  font-size: 1.4rem;
  letter-spacing: 0.08em;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.brand svg { width: 30px; height: auto; }

.topnav { display: flex; gap: clamp(0.9rem, 2.4vw, 1.8rem); }
.topnav a {
  font-family: var(--font-hand);
  font-size: 1.02rem;
  color: var(--ink-soft);
  position: relative;
  padding-bottom: 2px;
}
.topnav a .en { font-family: var(--font-en); color: var(--ink-mute); font-size: 0.82rem; margin-left: 0.3em; }
.topnav a::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -2px; height: 2px;
  background: var(--ink); opacity: 0; filter: url(#roughen);
  transition: opacity 0.25s ease;
}
.topnav a:hover::after, .topnav a.is-active::after { opacity: 0.6; }

.menu-toggle { display: none; }

/* ============================================================================
   COVER — full screen paper, fish only, NO TEXT
   ========================================================================== */
.cover {
  position: relative;
  height: 100svh;
  min-height: 560px;
  display: grid;
  place-items: center;
  isolation: isolate;
  overflow: hidden;
}
/* optional real paper scan; falls back silently to the body texture */
.cover__paper {
  position: absolute; inset: 0; z-index: -1;
  width: 100%; height: 100%;
  object-fit: cover;
  /* paper-bg is already a v2 grey, low-contrast scan — keep CSS nearly neutral */
  filter: saturate(0.92) contrast(1) brightness(1);
}

/* the fish stage: holds either generated frame <img>s or the SVG placeholder */
.fish-stage {
  position: relative;
  width: min(80vmin, 700px);   /* v2: 主体放大，两只鱼约占第一屏视宽 38–42% */
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
}
.fish-stage img.fish-frame {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
  opacity: 0;
  filter: contrast(1.22) saturate(0.3);
  will-change: opacity, transform;
}
.fish-stage img.fish-frame.is-base { opacity: 0.94; }
.fish-stage img.fish-frame.is-live { opacity: var(--frame-opacity, 0.78); }

/* SVG placeholder fish (shown until frame PNGs exist) */
.fish-svg { width: 100%; height: 100%; color: var(--ink); }
.fish-svg .stroke {
  fill: none; stroke: currentColor; stroke-width: 2.1;
  stroke-linecap: round; stroke-linejoin: round;
  filter: url(#roughen);
}
.fish-svg .fill { fill: currentColor; filter: url(#roughen); }

/* a non-text scroll cue (little drawn chevron) */
.cover__cue {
  position: absolute;
  bottom: clamp(1.4rem, 5vh, 3rem);
  left: 50%;
  transform: translateX(-50%);
  width: 34px; color: var(--ink-mute);
  animation: cue-bob 2.4s ease-in-out infinite;
  cursor: pointer;
}
@keyframes cue-bob { 0%,100%{transform:translate(-50%,0)} 50%{transform:translate(-50%,7px)} }

/* ============================================================================
   HUB (below the cover on index) — handwritten signposts
   ========================================================================== */
.hub { display: grid; gap: clamp(1.2rem, 3vw, 2rem); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.signpost {
  position: relative;
  padding: 1.8rem 1.6rem 2rem;
  background-color: var(--paper-hi);
  background-image: url("/assets/img/paper/paper-bg.jpg");
  background-size: 420px;
  background-blend-mode: soft-light;
  box-shadow: var(--shadow-soft);
  transition: transform 0.4s cubic-bezier(0.2,0.7,0.1,1);
}
.signpost:nth-child(1) { transform: rotate(-1.1deg); }
.signpost:nth-child(2) { transform: rotate(0.6deg); }
.signpost:nth-child(3) { transform: rotate(-0.5deg); }
.signpost:nth-child(4) { transform: rotate(0.9deg); }
.signpost:hover { transform: rotate(0deg) translateY(-4px); }
.signpost .num { font-family: var(--font-en); color: var(--ink-faint); font-size: 1.1rem; }
.signpost h3 { font-family: var(--font-brush); font-size: 1.7rem; margin: 0.3rem 0 0.5rem; }
.signpost p  { color: var(--ink-mute); font-size: 0.96rem; margin: 0; }
.signpost .en { font-family: var(--font-en); color: var(--ink-faint); letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.8rem; }

/* ============================================================================
   FEED / SCRAPBOOK — mixed life records on about.html
   每条记录像贴在纸上的便签 / 照片，略微歪斜、有胶带
   ========================================================================== */
.profile-head { display: grid; grid-template-columns: auto 1fr; gap: clamp(1.4rem,4vw,3rem); align-items: center; }
.profile-portrait {
  position: relative; width: clamp(120px, 22vw, 190px); aspect-ratio: 4/5;
  background: var(--paper-hi); box-shadow: var(--shadow); transform: rotate(-2.4deg);
  display: grid; place-items: center; overflow: hidden;
}
.profile-portrait img { width: 100%; height: 100%; object-fit: cover; filter: saturate(0.8) contrast(1.04); }
.profile-bio h1 { font-family: var(--font-brush); font-size: clamp(2.2rem,6vw,3.4rem); margin: 0 0 0.4rem; }
.profile-bio p  { color: var(--ink-soft); max-width: 52ch; }
.profile-links { display: flex; flex-wrap: wrap; gap: 0.8rem 1.4rem; margin-top: 1rem; }
.profile-links a { font-family: var(--font-en); letter-spacing: 0.04em; border-bottom: 1.5px solid var(--ink-faint); padding-bottom: 1px; }
.profile-links a:hover { border-color: var(--seal); color: var(--seal); }

/* filter chips — hand-underlined words instead of boxed buttons, matching the
   topnav / title brush language. Hover = faint ink stroke; selected = seal red. */
.filters { display: flex; gap: clamp(1.1rem, 3.4vw, 1.9rem); flex-wrap: wrap; align-items: baseline; margin: 2.4rem 0 2rem; }
.chip {
  font-family: var(--font-hand); font-size: 1.04rem; letter-spacing: 0.02em;
  padding: 0.1rem 0.15rem 0.34rem; background: none; border: none; cursor: pointer;
  color: var(--ink-mute); position: relative; transition: color 0.25s ease;
}
.chip::after {
  content: ""; position: absolute; left: -5%; right: -5%; bottom: 0.04em;
  height: 0.34em; background: var(--ink); opacity: 0;
  filter: url(#roughen); transform: skewX(-9deg) scaleY(0.32);
  transition: opacity 0.25s ease, background 0.25s ease;
}
.chip:hover { color: var(--ink); }
.chip:hover::after { opacity: 0.2; }
.chip.is-active { color: var(--ink); }
.chip.is-active::after { opacity: 0.9; background: var(--seal); }

/* the collage column layout */
.feed { columns: 3 260px; column-gap: 1.6rem; }
.card {
  position: relative;
  break-inside: avoid;
  margin-bottom: 1.6rem;
  background-color: var(--paper-hi);
  background-image: url("/assets/img/paper/paper-bg.jpg");
  background-size: 340px;
  background-blend-mode: soft-light;   /* real paper grain, keeps the light tone */
  box-shadow: var(--shadow-soft);
  padding: 0.7rem 0.7rem 1.1rem;
  transition: transform 0.4s cubic-bezier(0.2,0.7,0.1,1), box-shadow 0.4s ease;
}
.card:nth-child(3n+1) { transform: rotate(-1deg); }
.card:nth-child(3n+2) { transform: rotate(0.8deg); }
.card:nth-child(3n+3) { transform: rotate(-0.4deg); }
.card:hover { transform: rotate(0deg) translateY(-3px); box-shadow: var(--shadow); z-index: 3; }
.card__media { position: relative; overflow: hidden; }
.card__media img { width: 100%; height: auto; filter: saturate(0.82) contrast(1.04) brightness(0.99); }
.card__meta { font-family: var(--font-en); letter-spacing: 0.08em; color: var(--ink-faint); font-size: 0.82rem; margin: 0.7rem 0.3rem 0.2rem; text-transform: uppercase; }
.card__title { font-family: var(--font-brush); font-size: 1.3rem; margin: 0.1rem 0.3rem 0.3rem; }
.card__excerpt { color: var(--ink-mute); font-size: 0.95rem; margin: 0 0.3rem; }
.card__tag { display:inline-block; font-family: var(--font-en); font-size:0.72rem; letter-spacing:0.1em; color: var(--seal); text-transform: uppercase; margin: 0.5rem 0.3rem 0; }
.card.is-hidden { display: none; }

/* year-grouped archive (notes / gallery) */
.year-group.is-hidden { display: none; }
.year-head {
  display: flex; align-items: center; gap: 1rem;
  font-family: var(--font-en); font-size: 1.7rem; letter-spacing: 0.06em;
  color: var(--ink-mute); margin: 2.6rem 0 1.3rem;
}
.year-group:first-of-type .year-head { margin-top: 1.4rem; }
.year-head::after { content: ""; flex: 1; height: 1.5px; background: var(--ink-faint); filter: url(#roughen); opacity: 0.55; }

/* "view all" link under the recent feed on about */
.more-link { text-align: center; margin: 2.2rem 0 0; }
.more-link a {
  font-family: var(--font-hand); font-size: 1.05rem; color: var(--ink-soft);
  border-bottom: 1.6px solid var(--ink-faint); padding-bottom: 2px;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.more-link a:hover { color: var(--seal); border-color: var(--seal); }

/* ============================================================================
   GALLERY — 影像 / 摄影, denser masonry + lightbox
   ========================================================================== */
.gallery { columns: 4 220px; column-gap: 1.2rem; }
.shot { position: relative; break-inside: avoid; margin-bottom: 1.2rem; cursor: zoom-in; background: var(--paper-hi); padding: 0.5rem; box-shadow: var(--shadow-soft); transition: transform 0.35s ease; }
.shot:nth-child(2n) { transform: rotate(0.6deg); }
.shot:nth-child(2n+1) { transform: rotate(-0.6deg); }
.shot:hover { transform: rotate(0) scale(1.012); z-index: 3; }
.shot img { width: 100%; height: auto; filter: saturate(0.82) contrast(1.05); }
.shot figcaption { font-family: var(--font-hand); font-size: 0.85rem; color: var(--ink-mute); padding: 0.5rem 0.2rem 0.2rem; }

.lightbox {
  position: fixed; inset: 0; z-index: 100;
  display: none; place-items: center;
  background: rgba(28,23,18,0.86);
  padding: 4vmin;
}
.lightbox.is-open { display: grid; }
.lightbox img { max-width: 92vw; max-height: 86vh; box-shadow: 0 30px 80px rgba(0,0,0,0.5); filter: saturate(0.88) contrast(1.03); }
.lightbox__cap { position: absolute; bottom: 4vmin; left: 0; right: 0; text-align: center; color: var(--paper-hi); font-family: var(--font-hand); }
.lightbox__close { position: absolute; top: 3vmin; right: 4vmin; color: var(--paper-hi); font-family: var(--font-en); font-size: 1.6rem; line-height: 1; cursor: pointer; background: none; border: none; padding: 0.2em 0.4em; }
.shot:focus-visible, .cover__cue:focus-visible, .lightbox__close:focus-visible, .chip:focus-visible { outline: 2px solid var(--seal); outline-offset: 3px; }

/* ============================================================================
   ARTICLE — single post typography + left category index
   ========================================================================== */
/* two-column: sticky category index (left) + content (right) */
/* index rail pinned to the LEFT EDGE of the screen + centred content;
   collapsible via the handle on its right edge (see .doc-toggle / ink.js) */
.article-layout {
  --side-w: 256px;
  padding: clamp(4.6rem, 8vw, 6rem) 0 0 var(--side-w);
  transition: padding-left 0.35s cubic-bezier(0.2, 0.7, 0.1, 1);
}
.article-layout.side-collapsed { padding-left: 0; }

.doc-side {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--side-w);
  padding: clamp(4.8rem, 8vw, 6rem) 1.5rem 2rem 2rem;
  overflow: auto;
  background: var(--paper-hi);
  border-right: 1px solid var(--ink-ghost);
  box-shadow: 6px 0 22px rgba(46, 39, 31, 0.07);
  z-index: 55;
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.1, 1);
}
.article-layout.side-collapsed .doc-side { transform: translateX(-100%); }

/* collapse / expand handle — rides the panel's right edge */
.doc-toggle {
  position: fixed; top: 5.4rem; left: var(--side-w);
  z-index: 56;
  width: 22px; height: 42px;
  display: grid; place-items: center;
  padding: 0; cursor: pointer;
  color: var(--ink-mute);
  background: var(--paper-hi);
  border: 1.3px solid var(--ink-faint); border-left: none;
  border-radius: 0 7px 7px 0;
  box-shadow: var(--shadow-soft);
  transition: left 0.35s cubic-bezier(0.2, 0.7, 0.1, 1), color 0.2s ease;
}
.doc-toggle:hover { color: var(--ink); }
.doc-toggle svg { transition: transform 0.35s ease; }
.article-layout.side-collapsed .doc-toggle { left: 0; }
.article-layout.side-collapsed .doc-toggle svg { transform: rotate(180deg); }
.doc-side__home { margin: 0 0 1.4rem; font-size: 0.92rem; }
.doc-group { margin-bottom: 1.5rem; }
.doc-group__title {
  font-family: var(--font-brush); font-size: 1.12rem; color: var(--ink);
  margin: 0 0 0.5rem; position: relative; padding-left: 0.85rem;
}
/* small seal-red tick marks each category, in keeping with the hand-made look */
.doc-group__title::before {
  content: ""; position: absolute; left: 0; top: 0.28em;
  width: 4px; height: 0.86em; background: var(--seal); filter: url(#roughen);
}
.doc-index ul { list-style: none; margin: 0; padding: 0; }
.doc-item a {
  display: block; padding: 0.4rem 0.6rem; color: var(--ink-soft);
  line-height: 1.45; position: relative; border-radius: 3px;
  transition: background 0.2s ease, color 0.2s ease;
}
.doc-item__date { display: block; font-family: var(--font-en); font-size: 0.74rem; color: var(--ink-faint); letter-spacing: 0.04em; }
.doc-item a:hover { color: var(--ink); background: rgba(27, 24, 21, 0.04); }
.doc-item.is-current a { color: var(--ink); background: rgba(27, 24, 21, 0.06); }
.doc-item.is-current a::before {
  content: ""; position: absolute; left: -1px; top: 0.35rem; bottom: 0.35rem;
  width: 2.5px; background: var(--ink); filter: url(#roughen);
}

.article { width: min(100% - 2.4rem, 720px); margin-inline: auto; }
.article-layout .article__head { margin-top: 0; }

@media (max-width: 860px) {
  /* narrow: content takes the full width; the rail becomes an overlay drawer */
  .article-layout { padding-left: 0; }
  .doc-side { box-shadow: 8px 0 30px rgba(46, 39, 31, 0.16); }
}
.article__head { margin: clamp(2rem,6vw,4rem) 0 2.4rem; }
.article__meta { font-family: var(--font-en); letter-spacing: 0.1em; color: var(--ink-faint); text-transform: uppercase; font-size: 0.86rem; }
.article__title { font-family: var(--font-brush); font-size: clamp(2.2rem,6vw,3.4rem); line-height: 1.2; margin: 0.3rem 0 0.6rem; }
.prose { font-size: 1.06rem; line-height: 2.05; color: var(--ink); }
.prose p { margin: 0 0 1.4em; }
.prose h2 { font-family: var(--font-brush); font-size: 1.7rem; margin: 2em 0 0.6em; }
.prose h3 { font-family: var(--font-brush); font-size: 1.35rem; margin: 1.6em 0 0.5em; }
.prose a { border-bottom: 1.5px solid var(--seal-soft); color: var(--seal); }
.prose blockquote { margin: 1.6em 0; padding-left: 1.2em; border-left: 3px solid var(--ink-faint); color: var(--ink-soft); font-style: italic; }
.prose img { margin: 1.6em auto; box-shadow: var(--shadow-soft); padding: 0.5rem; background: var(--paper-hi); filter: saturate(0.84) contrast(1.04); }
.prose code { font-family: ui-monospace, "Cascadia Code", monospace; background: rgba(27,24,21,0.08); padding: 0.1em 0.4em; border-radius: 3px; font-size: 0.92em; }
.prose pre { background: rgba(27,24,21,0.07); padding: 1rem 1.2rem; overflow:auto; border-radius: var(--radius); }
.prose pre code { background: none; padding: 0; }
.prose hr { border: none; height: 46px; margin: 2.2em 0; background: url("/assets/img/fish/fish-divider.png") center / contain no-repeat; opacity: 0.5; mix-blend-mode: multiply; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.4em; }
.prose ul ul, .prose ol ol, .prose ul ol, .prose ol ul { margin: 0.25em 0 0.25em 0.2em; }
.prose li { margin: 0.3em 0; }
.prose .table-wrap { overflow-x: auto; margin: 1.8em 0; }
.prose table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: 0.96rem; line-height: 1.75; }
.prose th, .prose td { padding: 0.45rem 0.7rem; border-bottom: 1px solid var(--ink-faint); vertical-align: top; }
.prose th { font-family: var(--font-hand); color: var(--ink); background: rgba(27, 24, 21, 0.04); }
.prose tr:last-child td { border-bottom-color: transparent; }
.prose .footnote-ref { font-family: var(--font-en); font-size: 0.72em; line-height: 0; }
.prose .footnote-ref a { border-bottom: none; color: var(--seal); }
.prose .footnotes { margin-top: 2.4em; padding-top: 1em; border-top: 1px solid var(--ink-faint); font-size: 0.92rem; color: var(--ink-soft); }
.prose .footnotes ol { padding-left: 1.4em; margin-bottom: 0; }
.prose .footnotes li { padding-left: 0.2em; }
.prose .footnote-backref { margin-left: 0.4em; border-bottom: none; color: var(--ink-mute); }

/* a little hand-drawn fish closes each article */
.article-end { text-align: center; margin: 3rem 0 0; }
.article-end img { width: 78px; height: auto; display: inline-block; opacity: 0.66; mix-blend-mode: multiply; }

/* ============================================================================
   MUSIC — paper player: station page (.music--station) + per-article (.music--mini)
   ========================================================================== */
.music {
  position: relative;
  background-color: var(--paper-hi);
  background-image: url("/assets/img/paper/paper-bg.jpg");
  background-size: 340px;
  background-blend-mode: soft-light;
  box-shadow: var(--shadow-soft);
  padding: 1.1rem 1.2rem 1.2rem;
  border-radius: var(--radius);
}
.music--mini { margin: 0 0 2.2rem; }
.music--station { margin: 1.8rem 0 0; padding: 1.4rem 1.4rem 1rem; }
.music__empty { color: var(--ink-mute); margin: 0; }

.music__now { display: flex; gap: 0.9rem; align-items: center; }
.music__cover {
  flex: none; width: 56px; height: 56px; display: grid; place-items: center;
  background: var(--paper); box-shadow: var(--shadow-soft); overflow: hidden;
}
.music--station .music__cover { width: 72px; height: 72px; }
.music__cover img { width: 100%; height: 100%; object-fit: cover; filter: saturate(0.82) contrast(1.04); }
.music__cover-ph { font-size: 1.5rem; color: var(--ink-faint); }
.music__meta { min-width: 0; }
.music__eyebrow { font-family: var(--font-en); font-size: 0.74rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); margin: 0; }
.music__title { font-family: var(--font-brush); font-size: 1.25rem; margin: 0.1rem 0 0; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music__artist { color: var(--ink-mute); font-size: 0.9rem; margin: 0.15rem 0 0; }

.music__bar { display: flex; align-items: center; gap: 0.7rem; margin-top: 1rem; }
.music__btn {
  flex: none; width: 34px; height: 34px; display: grid; place-items: center;
  background: none; border: none; cursor: pointer; color: var(--ink-soft);
  border-radius: 50%; transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.music__btn:hover { color: var(--ink); background: rgba(27, 24, 21, 0.05); }
.music__btn svg { width: 16px; height: 16px; fill: currentColor; }
.music__btn--play { width: 42px; height: 42px; color: var(--ink); border: 1.4px solid var(--ink-faint); }
.music__btn--play svg { width: 18px; height: 18px; }
.music__btn--play:hover { border-color: var(--seal); color: var(--seal); background: none; }

.music__seek { -webkit-appearance: none; appearance: none; flex: 1; min-width: 60px; height: 3px; background: var(--ink-ghost); cursor: pointer; border-radius: 2px; }
.music__seek::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--seal); cursor: pointer; }
.music__seek::-moz-range-thumb { width: 12px; height: 12px; border: none; border-radius: 50%; background: var(--seal); cursor: pointer; }
.music__time { flex: none; font-family: var(--font-en); font-size: 0.82rem; color: var(--ink-mute); letter-spacing: 0.04em; min-width: 88px; text-align: right; }
.music__pick { flex: none; font-family: var(--font-hand); font-size: 0.92rem; background: none; border: none; cursor: pointer; color: var(--ink-mute); padding: 0.2rem 0.3rem; }
.music__pick:hover { color: var(--seal); }

.music__list { list-style: none; margin: 1rem 0 0; padding: 0; }
.music__list.is-collapsed { display: none; }
.music--station .music__list { max-height: 380px; overflow: auto; margin-top: 1.2rem; }
.music__item button {
  width: 100%; text-align: left; background: none; border: none; cursor: pointer;
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding: 0.55rem 0.5rem; color: var(--ink-soft); border-radius: 3px;
  transition: background 0.2s ease, color 0.2s ease;
}
.music__item + .music__item button { border-top: 1px solid var(--ink-ghost); }
.music__item button:hover { background: rgba(27, 24, 21, 0.04); color: var(--ink); }
.music__item.is-current button { color: var(--ink); background: rgba(27, 24, 21, 0.06); }
.music__item.is-current .music__item-title::before { content: "♪ "; color: var(--seal); }
.music__item-title { font-family: var(--font-hand); }
.music__item-artist { font-family: var(--font-en); font-size: 0.78rem; color: var(--ink-faint); white-space: nowrap; }
.music__btn:focus-visible, .music__pick:focus-visible, .music__item button:focus-visible, .music__seek:focus-visible { outline: 2px solid var(--seal); outline-offset: 2px; }

/* ---- station: accordion of themed song cards ---------------------------- */
.mstation { list-style: none; margin: 1.8rem 0 0; padding: 0; }
.mstation__row { margin-bottom: 0.95rem; }
.mstation__head {
  width: 100%; display: flex; align-items: center; gap: 1rem;
  /* frosted paper-glass: warm + restrained (plain rgba fallback first) */
  background-color: rgba(231, 227, 219, 0.82);
  background-color: color-mix(in srgb, var(--paper-hi) 66%, transparent);
  -webkit-backdrop-filter: blur(10px) saturate(106%);
  backdrop-filter: blur(10px) saturate(106%);
  border: 1px solid rgba(255, 251, 243, 0.34);
  cursor: pointer; text-align: left; color: var(--ink);
  padding: 0.95rem 1.2rem; border-radius: 5px;
  box-shadow:
    inset 0 1px 0 rgba(255, 253, 248, 0.40),
    0 6px 18px rgba(46, 39, 31, 0.14),
    0 1px 2px rgba(46, 39, 31, 0.10);
  transition: transform 0.3s cubic-bezier(0.2,0.7,0.1,1), box-shadow 0.3s ease, background-color 0.3s ease;
}
.mstation__row:nth-child(2n) .mstation__head { transform: rotate(0.4deg); }
.mstation__row:nth-child(2n+1) .mstation__head { transform: rotate(-0.45deg); }
.mstation__head:hover {
  transform: rotate(0) translateY(-2px);
  background-color: color-mix(in srgb, var(--paper-hi) 72%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 253, 248, 0.48),
    var(--shadow),
    0 1px 2px rgba(46, 39, 31, 0.10);
}
.mstation__row.is-open .mstation__head { transform: rotate(0); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .mstation__head {
    background-color: rgba(231, 227, 219, 0.92);
    background-color: color-mix(in srgb, var(--paper-hi) 88%, transparent);
  }
}
.mstation__idx { font-family: var(--font-en); color: var(--ink-faint); font-size: 1.05rem; flex: none; min-width: 1.7em; }
.mstation__head-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mstation__title { font-family: var(--font-brush); font-size: 1.32rem; line-height: 1.2; }
.mstation__artist { font-family: var(--font-en); font-size: 0.8rem; color: var(--ink-mute); letter-spacing: 0.03em; }
.mstation__swatch { flex: none; width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.18); filter: url(#roughen); }
.mstation__panel[hidden] { display: none; }
.mstation__panel { animation: mcard-in 0.44s cubic-bezier(0.22, 0.61, 0.18, 1); }
.mstation__panel .mplayer { margin-top: 0.9rem; }
/* room for the absolute corner button (station cards lead with intro, no title) */
.mstation__panel .mcard { padding-top: 2.6rem; }
@keyframes mcard-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---- themed card (per-song colours via --mc-* custom properties) --------- */
.mcard {
  position: relative; overflow: hidden;
  margin: 0.7rem 0 0; padding: 1.5rem 1.6rem;
  background-color: var(--mc-bg, var(--paper-hi));
  background-image: var(--mc-grad, none); background-size: cover;
  color: var(--mc-text, var(--ink));
  box-shadow: var(--shadow); border-radius: var(--radius);
}
.mcard > * { position: relative; z-index: 1; }
/* paper-grain overlay that survives any bg colour / gradient */
.mcard--paper::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: url("/assets/img/paper/paper-bg.jpg") 0 0 / 360px;
  mix-blend-mode: soft-light; opacity: 0.5;
}
.mcard--center { text-align: center; }
.mcard--center .mcard__lyric { border: none; padding: 0; }
.mcard__eyebrow { font-family: var(--font-en); font-size: 0.74rem; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.6; margin: 0 0 0.4rem; }
.mcard__title { font-family: var(--mc-font, var(--font-brush)); font-size: clamp(1.5rem, 3.6vw, 2.1rem); line-height: 1.16; margin: 0 0 0.2rem; }
.mcard--solo .mcard__title { font-size: clamp(2rem, 6vw, 3.2rem); }
.mcard__artist { font-family: var(--font-en); font-size: 0.9rem; opacity: 0.72; margin: 0 0 1.1rem; }
.mcard__intro { font-family: var(--font-hand); font-size: 1.04rem; line-height: 1.95; }
.mcard__intro p { margin: 0 0 0.8em; }
.mcard__intro p:last-child { margin-bottom: 0; }
.mcard__intro a { color: var(--mc-accent, var(--seal)); border-bottom: 1px solid currentColor; }
.mcard__lyric { font-family: var(--mc-font, var(--font-brush)); font-size: 1.12rem; opacity: 0.88; margin: 1.2rem 0 0; padding-left: 0.95rem; border-left: 2px solid var(--mc-accent, var(--seal)); }
.mcard__permalink { margin: 1.3rem 0 0; }
.mcard__permalink a { font-family: var(--font-en); font-size: 0.84rem; letter-spacing: 0.04em; color: var(--mc-accent, var(--seal)); border-bottom: 1px solid currentColor; }

/* player bar living inside a themed card (solo page) picks up the card colours */
.mcard .music__bar { margin-top: 1.4rem; }
.mcard .music__btn { color: var(--mc-text, var(--ink-soft)); }
/* hover wash + seek track follow the card's own text colour so they stay visible
   on both dark and light author themes (color-mix degrades to the generic rule) */
.mcard .music__btn:hover { background: color-mix(in srgb, var(--mc-text, var(--ink)) 12%, transparent); }
.mcard .music__btn--play { color: var(--mc-text, var(--ink)); border-color: var(--mc-accent, var(--ink-faint)); }
.mcard .music__btn--play:hover { border-color: var(--mc-accent, var(--seal)); background: color-mix(in srgb, var(--mc-text, var(--ink)) 9%, transparent); }
.mcard .music__seek { background: color-mix(in srgb, var(--mc-text, var(--ink)) 22%, transparent); }
.mcard .music__seek::-webkit-slider-thumb { background: var(--mc-accent, var(--seal)); }
.mcard .music__seek::-moz-range-thumb { background: var(--mc-accent, var(--seal)); }
.mcard .music__time { color: var(--mc-text, var(--ink-mute)); opacity: 0.72; }

.msolo { max-width: 680px; }
.msolo .doc-side__home { margin: 0 0 1.6rem; }
@media (max-width: 380px) {
  .mstation__head { gap: 0.7rem; padding: 0.85rem 0.95rem; }
  .mstation__title { font-size: 1.18rem; }
}

/* ---- fullscreen takeover: the song's colour owns the viewport -------------- */
body.mcard-lock { overflow: hidden; }
.mcard.is-full {
  position: fixed; inset: 0; z-index: 200;   /* above grain(80) / vignette(81) / lightbox(100) */
  margin: 0; border-radius: 0; box-shadow: none; overflow: auto;
  background-color: var(--mc-bg, var(--paper-hi));
  background-image: var(--mc-grad, none); background-size: cover; background-position: center;
  color: var(--mc-text, var(--ink));
  display: flex; flex-direction: column; justify-content: center; align-items: stretch;
  gap: clamp(0.6rem, 1.6vh, 1.2rem);
  padding: clamp(2.4rem, 7vh, 5rem) clamp(1.4rem, 6vw, 4.5rem) clamp(2.8rem, 8vh, 5.5rem);
  animation: mcard-full-in 460ms cubic-bezier(0.22, 0.61, 0.18, 1) both;
}
.mcard.is-full > * { width: min(100%, 62ch); margin-inline: auto; }
.mcard--paper.is-full::before { opacity: 0.6; background-size: 420px; }
.mcard.is-full.mcard--center { text-align: center; }
.mcard.is-full .mcard__eyebrow { font-size: 0.82rem; letter-spacing: 0.18em; margin-bottom: 0.6rem; }
.mcard.is-full .mcard__title { font-size: clamp(2.6rem, 8vw, 4.6rem); line-height: 1.1; margin-bottom: 0.3rem; }
.mcard.is-full .mcard__artist { font-size: 1rem; margin-bottom: 1.6rem; }
.mcard.is-full .mcard__intro { font-size: clamp(1.05rem, 1.5vw, 1.18rem); line-height: 2.0; max-width: 60ch; }
.mcard.is-full .mcard__lyric { font-size: clamp(1.2rem, 2.2vw, 1.5rem); margin-top: 1.6rem; }
.mcard.is-full .mplayer { margin-top: clamp(1.6rem, 4vh, 2.6rem); }
.mcard.is-full.mcard--center .mcard__lyric { border-left: none; padding-left: 0; }
.mcard.is-full .mcard__permalink { display: none; }
@keyframes mcard-full-in { from { opacity: 0; } to { opacity: 1; } }

/* fullscreen toggle button — corner ⤢ on the card, fixed ✕ in fullscreen */
.mcard__full {
  position: absolute; top: 0.7rem; right: 0.7rem; z-index: 3;
  width: 34px; height: 34px; display: grid; place-items: center; padding: 0;
  cursor: pointer; line-height: 1; opacity: 0.82;
  background: color-mix(in srgb, var(--mc-text, var(--ink)) 14%, transparent);
  color: var(--mc-text, var(--ink-soft));
  border: 1.4px solid color-mix(in srgb, var(--mc-text, var(--ink)) 34%, transparent);
  border-radius: 50%;
  transition: opacity 0.25s ease, color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.mcard__full::before { content: "\2922"; font-size: 1rem; }
.mcard__full:hover {
  opacity: 1; color: var(--mc-accent, var(--seal)); border-color: var(--mc-accent, var(--seal));
  background: color-mix(in srgb, var(--mc-text, var(--ink)) 12%, transparent);
}
.mcard__full:focus-visible { outline: 2px solid var(--mc-accent, var(--seal)); outline-offset: 2px; opacity: 1; }
.mcard.is-full .mcard__full {
  position: fixed; top: clamp(1rem, 3vh, 1.8rem); right: clamp(1rem, 3vw, 1.8rem);
  z-index: 201; width: 40px; height: 40px; opacity: 0.85;
}
.mcard.is-full .mcard__full::before { content: "\2715"; font-size: 1.1rem; }

/* ============================================================================
   MOTION — view transitions (gentle, hand-made; graceful on unsupported)
   ========================================================================== */
@view-transition { navigation: auto; }
.vt-hero { view-transition-name: vt-hero; }
::view-transition-group(vt-hero),
::view-transition-image-pair(vt-hero) {
  animation-duration: 460ms; animation-timing-function: cubic-bezier(0.22, 0.61, 0.18, 1);
}
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 380ms; animation-timing-function: cubic-bezier(0.22, 0.61, 0.18, 1);
}
::view-transition-group(mcard-full),
::view-transition-old(mcard-full),
::view-transition-new(mcard-full) {
  animation-duration: 440ms; animation-timing-function: cubic-bezier(0.22, 0.61, 0.18, 1);
}

/* ============================================================================
   FOOTER & misc
   ========================================================================== */
.footer { padding: 3rem 0 4rem; text-align: center; color: var(--ink-mute); }
.footer .seal { display:inline-block; color: var(--seal); font-family: var(--font-brush); border: 2px solid var(--seal-soft); padding: 0.1em 0.4em; transform: rotate(-4deg); filter: url(#roughen); margin-bottom: 0.8rem; }
/* real carved seal (assets/img/ink/seal.png); multiply drops its white ground onto the paper */
.seal-stamp { display: inline-block; width: 40px; height: auto; transform: rotate(-5deg); margin-bottom: 0.7rem; mix-blend-mode: multiply; opacity: 0.88; }
.footer a { border-bottom: 1px solid var(--ink-faint); }

.backlink { font-family: var(--font-en); letter-spacing: 0.06em; color: var(--ink-mute); }
.backlink:hover { color: var(--seal); }

/* scroll reveal */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2,0.7,0.1,1); }
.reveal.is-visible { opacity: 1; transform: none; }

/* ---- responsive ----------------------------------------------------------- */
@media (max-width: 860px) {
  .hub { grid-template-columns: 1fr; }
  .feed { columns: 2 200px; }
  .gallery { columns: 2 160px; }
  .profile-head { grid-template-columns: 1fr; text-align: center; justify-items: center; }
}

@media (max-width: 620px) {
  body { font-size: 16px; }
  .topnav { gap: 0.9rem; }
  .topnav a .en { display: none; }
  .feed { columns: 1; }
}

/* ---- reduced motion ------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .grain, .shiver, .cover__cue { animation: none; }
  .reveal { transition: none; opacity: 1; transform: none; }
  .mstation__panel { animation: none; }
  .mstation__head { transition: none; }
  .mcard.is-full { animation: none; }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation-duration: 1ms !important; animation-delay: 0ms !important; }
  * { scroll-behavior: auto; }
}
