:root {
  --tea-nav-paper: var(--tc-line);
  --tea-nav-backdrop: var(--tc-paper);
  --tea-cinematic-ease: cubic-bezier(.22, 1, .36, 1);
  --tea-intro-outer-line: 3px;
  --tea-intro-center-line: 1.5px;
  --tea-intro-seal-size: clamp(76px, 7vw, 100px);
}

/* Keep wheel, touch and keyboard scrolling, without a visible scroll track. */
html, body, .sidebar-links, .community-topics nav, .topnav { scrollbar-width: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar,
.sidebar-links::-webkit-scrollbar, .community-topics nav::-webkit-scrollbar,
.topnav::-webkit-scrollbar { display: none; }

/* Every page uses the same restrained, translucent index topbar. */
body .topbar {
  position: fixed !important;
  left: 0;
  right: 0;
  top: 0;
  z-index: 80;
  background: var(--tea-nav-backdrop) !important;
  border: 0 !important;
  box-shadow: none !important;
  color: var(--tc-ink);
  transform: translate3d(0, 0, 0) !important;
  opacity: 1;
  transition: transform .54s var(--tea-cinematic-ease), opacity .54s ease !important;
}
body .topbar.topbar-hidden {
  transform: translate3d(0, calc(-100% - 8px), 0) !important;
  pointer-events: none;
}
body .topbar.nav-revealing {
  transform: translate3d(0, 0, 0) !important;
  transition: none !important;
  animation: tea-nav-reveal .88s var(--tea-cinematic-ease) both;
}
@keyframes tea-nav-reveal {
  from { clip-path: inset(0 100% 0 0); opacity: 1; }
  to { clip-path: inset(0); opacity: 1; }
}
body .topbar .mc-nav,
body .topbar .nav-more > summary.mc-nav {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  outline: 0;
  text-shadow: none !important;
  color: inherit;
}
body .topbar .nav-more > div,
body .topbar .topnav.mobile-open {
  background: var(--tc-paper) !important;
}
body .topbar .nav-more:not([open]) > div { display: none; }
body .topbar .nav-more[open] { z-index: 90; }
html { scroll-snap-type: none !important; scroll-behavior: smooth; }
html:has(.moderation-page) { scroll-behavior: auto; }
body.moderation-page .page-title-inner > :is(h1,p) { animation: none !important; opacity: 1 !important; transform: none !important; clip-path: none !important; }
.topbar-music-toggle {
  display: inline-grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px;
  color: var(--tc-ink); background: transparent; border: 1px solid var(--tc-line);
  border-radius: 50%; cursor: pointer; transition: background .22s ease, border-color .22s ease, color .22s ease;
}
.topbar-music-toggle:hover, .topbar-music-toggle:focus-visible { background: var(--tc-ink); border-color: var(--tc-ink); color: var(--tc-paper); }
.topbar-music-toggle:focus-visible { outline: 2px solid var(--tc-accent); outline-offset: 3px; }
.topbar-music-toggle svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.topbar-music-toggle .speaker-off, .topbar-music-toggle.is-muted .speaker-on { display: none; }
.topbar-music-toggle.is-muted .speaker-off { display: block; }
.reveal-on-scroll { opacity: .72; transform: translate3d(0,14px,0); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.75,.25,1); }
.reveal-on-scroll.reveal-visible { opacity: 1; transform: none; }
html[data-intro-skipped="true"] .home-hero-content > h1 { animation: none !important; opacity: 1 !important; transform: none !important; }
@media (prefers-reduced-motion: reduce) { .reveal-on-scroll { opacity: 1 !important; transform: none !important; transition: none !important; } }
[data-copy-edited] { white-space: pre-line; }
.site-custom-section { margin-top: clamp(24px, 3vw, 42px); padding: clamp(18px, 2vw, 27px); border-left: 3px solid #7e9877; background: rgba(233, 235, 221, .62); }
.site-custom-section h3 { margin: 0 0 10px; font-size: clamp(1.25rem, 2vw, 1.7rem); }
.site-custom-section p { margin: 0; line-height: 1.85; white-space: pre-line; overflow-wrap: anywhere; }
.site-custom-section[hidden] { display: none; }
body .topbar::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--tea-nav-paper);
  transform: scaleX(0);
  transform-origin: left center;
  pointer-events: none;
}
body.site-nav-reveal .topbar::after {
  animation: tea-nav-line-in 1.08s var(--tea-cinematic-ease) both;
}
@keyframes tea-nav-line-in { to { transform: scaleX(1); } }
/* Reveal the header as the panels open. Scroll can hide it afterward. */
body.site-intro-pending:not(.site-nav-reveal) .topbar {
  opacity: 0 !important;
  pointer-events: none;
}
/* When there is no intro on a page, the nav remains accessible immediately. */
body:not(.site-intro-pending):not(.site-nav-reveal) .topbar::after { transform: scaleX(1); }
/* Old invisible trigger area is no longer required. */
.topbar-hotzone { display: none !important; pointer-events: none !important; }

/* Intro panels: only GPU-composited translations; never resize the panels. */
.site-intro {
  background: transparent;
  animation: tea-intro-finish .01s linear 3.15s forwards !important;
  contain: layout style paint;
}
.site-intro-panel {
  border: 0 !important;
  background: var(--intro-paper);
  animation: tea-intro-door 1.15s cubic-bezier(.76, 0, .18, 1) 1.90s both !important;
  transform: translate3d(0,0,0);
  backface-visibility: hidden;
  will-change: transform;
}
.site-intro-panel::before { display: none !important; }
.site-intro-line {
  position: absolute;
  z-index: 1;
  width: var(--tea-intro-outer-line);
  top: 0;
  height: 100%;
  background: var(--intro-ink);
  transform: scaleY(1);
  pointer-events: none;
  will-change: transform;
}
/* Left disappears from top to bottom; right disappears from bottom to top. */
.site-intro-line-left {
  left: 7.2%;
  transform-origin: 50% 100%;
  animation: tea-intro-line-retract 1.5s linear .30s forwards;
}
.site-intro-line-right {
  right: 7.2%;
  transform-origin: 50% 0%;
  animation: tea-intro-line-retract 1.5s linear .30s forwards;
}
.site-intro-line-middle-top,
.site-intro-line-middle-bottom {
  left: 50%;
  width: var(--tea-intro-center-line);
  height: 50%;
  animation: tea-intro-line-retract 1s ease-in-out .80s forwards;
}
.site-intro-line-middle-top { top: 0; transform-origin: 50% 0%; }
.site-intro-line-middle-bottom { top: 50%; transform-origin: 50% 100%; }
@keyframes tea-intro-line-retract { to { transform: scaleY(0); } }
.site-intro-seal {
  display: grid;
  place-items: center;
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: var(--tea-intro-seal-size);
  aspect-ratio: 1;
  background: var(--intro-paper);
  color: var(--intro-ink);
  border: 0 !important;
  border-radius: 50%;
  transform: translate(-50%, -50%) !important;
  animation: none !important;
}
.site-intro-seal-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  overflow: visible;
}
.site-intro-seal-ring circle {
  fill: none;
  stroke: var(--intro-ink);
  stroke-width: .3;
  stroke-linecap: round;
  stroke-dasharray: none;
  stroke-dashoffset: 0;
}
.site-intro-seal-text {
  font: 400 clamp(31px, 3.4vw, 46px)/1 "Noto Serif TC", "Songti TC", "PMingLiU", serif;
}
html[data-font-style="pixel"] .site-intro-seal-text {
  font-family: "Noto Serif TC", "Songti TC", "PMingLiU", serif !important;
}
/* The glyph fades with the split centre line. The ring is a progress stroke: on the home loader it
   fills as the film loads (--intro-progress, intro-gate.js), then it erases over exactly the side
   lines' window (1.5s linear from .30s), so the ring runs out the moment the lines reach the end. */
.site-intro-seal-text { animation: tea-intro-seal-complete 1s ease-in-out .80s forwards; }
.site-intro-seal { animation: tea-intro-seal-complete .12s linear 1.78s forwards !important; }
@keyframes tea-intro-seal-complete { to { opacity: 0; } }
.site-intro-seal-ring circle { stroke-dasharray: 100 !important; stroke-dashoffset: calc(100 - var(--intro-progress, 1) * 100) !important; stroke-width: .5; transition: stroke-dashoffset .45s ease; }
.intro-play .site-intro-seal-ring circle { animation: tea-intro-ring-erase 1.5s linear .30s both; }
@keyframes tea-intro-ring-erase { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -100; } }

/* Gate: nothing animates until intro-gate.js says play; skipped intros never paint. */
body:not(.intro-play) .site-intro, body:not(.intro-play) .site-intro * { animation: none !important; }
.intro-skip .site-intro { display: none !important; }
/* Home loader paints in the visitor's theme, so the night film never follows a flash of day. */
body.ink-home.theme-night { --intro-paper: #0c1423; --intro-ink: #d9d3c4; }

/* Avoid layout/size animation on the outgoing page curtain as well. */
.page-transition {
  clip-path: none !important;
  transform: translate3d(0, 101%, 0);
  transition: transform .54s var(--tea-cinematic-ease) !important;
  backface-visibility: hidden;
  will-change: transform;
}
body.is-page-leaving .page-transition { transform: translate3d(0,0,0); }
.page-transition::before { display: none; }
.page-transition-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--tea-intro-outer-line);
  background: var(--intro-ink);
}
.page-transition-line-left { left: 7.2%; }
.page-transition-line-middle { left: 50%; width: var(--tea-intro-center-line); }
.page-transition-line-right { right: 7.2%; }
.page-transition-seal {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--tea-intro-seal-size);
  border: 0;
  transform: translate(-50%, -50%);
  font-size: 0 !important;
}
.page-transition-seal-ring { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; transform: rotate(-90deg); }
.page-transition-seal-ring circle { fill: none; stroke: var(--intro-ink); stroke-width: .3; }
.page-transition-seal-text { font: 400 clamp(31px, 3.4vw, 46px)/1 "Noto Serif TC", "Songti TC", "PMingLiU", serif; }
html[data-font-style="pixel"] .page-transition-seal-text { font-family: "Noto Serif TC", "Songti TC", "PMingLiU", serif !important; }

.home-page .home-hero-shade {
  background: linear-gradient(180deg, rgba(0,0,0,.11), rgba(0,0,0,.04) 50%, rgba(0,0,0,.51)) !important;
}

@media (max-width: 760px) {
  .home-page .home-hero-fallback { background-position: 56% center !important; }
}
@media (prefers-reduced-motion: reduce) {
  .page-transition { display: none !important; }
  /* the home loader still covers loading, then simply lifts */
  .intro-play .site-intro { animation: tea-intro-finish .01s linear .2s forwards !important; }
  .intro-play .site-intro * { animation: none !important; }
  body .topbar { animation: none !important; opacity: 1 !important; pointer-events: auto !important; }
  body .topbar::after { animation: none !important; transform: scaleX(1) !important; }
}
html[data-motion="reduced"] .page-transition { display: none !important; }
html[data-motion="reduced"] .intro-play .site-intro { animation: tea-intro-finish .01s linear .2s forwards !important; }
html[data-motion="reduced"] .intro-play .site-intro * { animation: none !important; }
html[data-motion="reduced"] body .topbar { animation: none !important; opacity: 1 !important; pointer-events: auto !important; }
html[data-motion="reduced"] body .topbar::after { animation: none !important; transform: scaleX(1) !important; }

.music-track-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 12px 0;
  border-top: 2px solid #8d8d87;
}
.music-track-controls small { display: block; margin-top: 3px; color: #555; }
.music-track-controls .mc-menu-button { min-height: 38px; }
@media (max-width: 700px) {
  .music-track-controls { grid-template-columns: 1fr 1fr; }
  .music-track-controls > div { grid-column: 1 / -1; }
}

/* The complete opening sentence stays on a single line at every width. */
.home-page .home-hero-content { grid-template-columns: minmax(0, 1fr) minmax(0, 31vw); }
.home-page .home-hero-tagline {
  max-width: none;
  white-space: nowrap;
  font-size: clamp(12px, 1.65vw, 25px);
  letter-spacing: .025em;
}
@media (max-width: 760px) {
  .home-page .home-hero-content { grid-template-columns: 1fr; }
  .home-page .home-hero-tagline { font-size: clamp(11px, 3.3vw, 16px); }
}
