/* 课间 · site-wide styles. Colours come from the 天光 engine as custom properties on :root
   (set before first paint by boot.js and kept in step by js/lib/theme.js). */

@font-face {
  font-family: 'Kejian Serif';
  src: url('/assets/fonts/kejian-serif-700.woff2?v=1f29e6d402') format('woff2');
  font-weight: 600 900;
  font-display: swap;
}

:root {
  --bg: #f5f3ee; --surface: #fbfaf7; --raised: #ffffff; --text: #1c1b19; --text-2: #635e56; --text-3: #a8a197;
  --line: #e2ddd3; --accent: #ae3f27; --accent-soft: #f6e3dc; --on-accent: #ffffff;

  --serif: 'Kejian Serif', 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', 'STSong', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'HarmonyOS Sans SC', 'MiSans', 'HONOR Sans CN', 'Microsoft YaHei UI', 'Microsoft YaHei', 'Noto Sans CJK SC', 'Source Han Sans SC', system-ui, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', 'JetBrains Mono', Consolas, monospace;

  /* the app's three spring tiers (TgMotion), sampled into CSS linear() */
  --spring-fast: cubic-bezier(.2, .9, .3, 1.04);
  --spring: cubic-bezier(.2, .8, .25, 1);
  --spring-gentle: cubic-bezier(.22, .7, .25, 1);
  --exit: cubic-bezier(.4, 0, 1, 1);
  --d-fast: 340ms; --d-std: 500ms; --d-gentle: 690ms; --d-exit: 280ms;

  --wrap: 1240px;
  --gutter: clamp(20px, 5vw, 56px);
  --header-h: 64px;
  --r-sm: 9px; --r-md: 14px; --r: 20px; --r-lg: 28px;
  --shadow: 0 1px 2px rgb(30 22 14 / .06), 0 10px 30px -12px rgb(30 22 14 / .18);
  --shadow-lg: 0 2px 6px rgb(30 22 14 / .08), 0 40px 80px -30px rgb(30 22 14 / .35);
}
@supports (transition-timing-function: linear(0, 1)) {
  :root {
    --spring-fast: linear(0, 0.049, 0.162, 0.302, 0.446, 0.578, 0.693, 0.786, 0.859, 0.914, 0.954, 0.981, 0.998, 1.008, 1.013, 1.015, 1.015, 1.013, 1.011, 1.009, 1.007, 1.005, 1.004, 1.002, 1);
    --spring: linear(0, 0.044, 0.146, 0.273, 0.402, 0.524, 0.63, 0.72, 0.793, 0.851, 0.895, 0.929, 0.953, 0.971, 0.983, 0.991, 0.997, 1, 1.002, 1.003, 1.003, 1.003, 1.003, 1.002, 1);
    --spring-gentle: linear(0, 0.038, 0.125, 0.234, 0.349, 0.458, 0.557, 0.643, 0.716, 0.777, 0.826, 0.866, 0.898, 0.923, 0.942, 0.957, 0.968, 0.977, 0.983, 0.988, 0.992, 0.994, 0.996, 0.997, 1);
    --spring-knob: linear(0, 0.057, 0.197, 0.378, 0.566, 0.738, 0.882, 0.992, 1.066, 1.108, 1.125, 1.123, 1.108, 1.087, 1.063, 1.04, 1.021, 1.005, 0.994, 0.988, 0.985, 0.984, 0.986, 0.988, 0.991, 0.994, 0.997, 0.999, 1, 1.001, 1.002, 1.002, 1);
  }
}
html[data-family='dark'] {
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 30px -12px rgb(0 0 0 / .6);
  --shadow-lg: 0 2px 6px rgb(0 0 0 / .35), 0 40px 80px -30px rgb(0 0 0 / .8);
}

/* ---------- reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 400 17px/1.75 var(--sans); letter-spacing: .01em;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  text-autospace: normal; text-spacing-trim: trim-start;
  overflow-x: clip;
}
body::after { /* paper grain, the same 7 % texture as the film */
  content: ''; position: fixed; inset: 0; z-index: 90; pointer-events: none; opacity: .05;
  background-image: 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='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
html[data-family='dark'] body::after { opacity: .07; filter: invert(1); }
img, svg, video, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
p a, li a, .link { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .22em; text-decoration-color: color-mix(in oklab, var(--accent) 40%, transparent); }
p a:hover, li a:hover, .link:hover { text-decoration-color: var(--accent); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--accent); color: var(--on-accent); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 200; padding: 8px 14px; border-radius: 10px; background: var(--text); color: var(--bg); transition: top .2s; }
.skip:focus { top: 12px; }
code, kbd, .mono { font-family: var(--mono); font-size: .88em; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: calc(var(--wrap) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: clamp(88px, 13vw, 168px); position: relative; }
.section-tight { padding-block: clamp(56px, 8vw, 104px); }
.hairline { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---------- type ---------- */
.serif { font-family: var(--serif); }
.kicker {
  display: inline-flex; align-items: center; gap: 10px; font: 600 14px/1.4 var(--sans); letter-spacing: .14em; color: var(--accent);
}
.kicker::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.display {
  font-family: var(--serif); font-weight: 700; font-size: clamp(40px, 6.4vw, 88px); line-height: 1.16; letter-spacing: -.01em;
  text-wrap: balance;
}
.h2 { font-family: var(--serif); font-weight: 700; font-size: clamp(32px, 4.6vw, 60px); line-height: 1.2; letter-spacing: -.005em; text-wrap: balance; }
.h3 { font-family: var(--serif); font-weight: 700; font-size: clamp(22px, 2.4vw, 30px); line-height: 1.35; }
.accent { color: var(--accent); }
.lede { font-size: clamp(17px, 1.6vw, 21px); line-height: 1.8; color: var(--text-2); max-width: 36em; text-wrap: pretty; }
.muted { color: var(--text-2); }
.small { font-size: 14px; line-height: 1.7; }
.head-block { display: grid; gap: 18px; max-width: 860px; }
.head-block.center { margin-inline: auto; text-align: center; justify-items: center; }

/* ---------- buttons, chips, cards ---------- */
.btn {
  --h: 52px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: var(--h); padding: 0 24px; border-radius: calc(var(--h) / 2);
  font: 600 16px/1 var(--sans); letter-spacing: .02em; white-space: nowrap; position: relative; isolation: isolate;
  transition: transform var(--d-fast) var(--spring-fast), background-color .2s, color .2s, box-shadow .3s;
}
.btn:active { transform: scale(.96); }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 8px 24px -10px color-mix(in oklab, var(--accent) 70%, transparent); }
.btn-primary:hover { box-shadow: 0 14px 30px -12px color-mix(in oklab, var(--accent) 80%, transparent); }
.btn-ghost { border: 1px solid var(--line); background: color-mix(in oklab, var(--surface) 70%, transparent); }
.btn-ghost:hover { border-color: var(--text-3); }
.btn-sm { --h: 38px; padding: 0 16px; font-size: 14px; }
.btn .arrow { transition: transform var(--d-fast) var(--spring-fast); }
.btn:hover .arrow { transform: translateX(3px); }
.btn small { font-weight: 400; opacity: .78; font-size: 13px; }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 15px; border: 1px solid var(--line); font-size: 13px; color: var(--text-2); background: var(--surface); white-space: nowrap; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.pill { display: inline-block; padding: 1px 9px; border-radius: 10px; font-size: 12px; font-weight: 600; background: var(--accent-soft); color: var(--accent); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }

/* ---------- header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 50; height: var(--header-h); view-transition-name: site-header;
  transition: background-color .35s, box-shadow .35s, backdrop-filter .35s;
}
.site-header.scrolled {
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  backdrop-filter: saturate(1.2) blur(16px); -webkit-backdrop-filter: saturate(1.2) blur(16px);
  box-shadow: 0 1px 0 color-mix(in oklab, var(--line) 80%, transparent);
}
.site-header .bar { height: 100%; display: flex; align-items: center; gap: 28px; }
.brand { display: inline-flex; align-items: center; gap: 10px; view-transition-name: brand; }
.mark { width: 34px; height: 34px; overflow: visible; }
.mark-sun { fill: var(--accent); }
.mark-ln { stroke: var(--text); stroke-width: 3.2; stroke-linecap: round; fill: none; }
.mark-ln.o2 { opacity: .45; }
.mark-ln.o3 { opacity: .22; }
.brand-name { font: 700 22px/1 var(--serif); letter-spacing: .06em; }
.nav { display: flex; gap: 6px; margin-left: 8px; }
.nav a { position: relative; padding: 8px 12px; font-size: 15px; color: var(--text-2); border-radius: 10px; transition: color .2s; }
.nav a:hover { color: var(--text); }
.nav a[aria-current='page'] { color: var(--text); }
.nav a[aria-current='page']::after { content: ''; position: absolute; left: 50%; bottom: 0; width: 4px; height: 4px; margin-left: -2px; border-radius: 2px; background: var(--accent); }
.clock {
  margin-left: auto; display: inline-flex; align-items: center; gap: 12px; height: 44px; padding: 0 6px 0 14px; border-radius: 22px;
  transition: background-color .2s;
}
.clock:hover, .clock[aria-expanded='true'] { background: color-mix(in oklab, var(--text) 6%, transparent); }
.clock-text { display: grid; text-align: right; line-height: 1.15; }
.clock-time { font: 700 16px/1.1 var(--serif); font-variant-numeric: tabular-nums; }
.clock-period { font-size: 12px; color: var(--text-2); }
.clock .hz { width: 66px; height: 36px; overflow: visible; }
.menu-btn { display: none; width: 44px; height: 44px; border-radius: 22px; position: relative; }
.menu-btn i { position: absolute; left: 13px; width: 18px; height: 1.6px; border-radius: 1px; background: var(--text); transition: transform var(--d-std) var(--spring); }
.menu-btn i:nth-of-type(1) { top: 18px; }
.menu-btn i:nth-of-type(2) { top: 25px; }
.menu-btn[aria-expanded='true'] i:nth-of-type(1) { transform: translateY(3.5px) rotate(45deg); }
.menu-btn[aria-expanded='true'] i:nth-of-type(2) { transform: translateY(-3.5px) rotate(-45deg); }

.theme-pop {
  position: absolute; right: max(var(--gutter), calc((100vw - var(--wrap)) / 2)); top: calc(var(--header-h) - 4px); width: 320px; padding: 18px;
  border-radius: var(--r); background: var(--raised); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  transform-origin: 85% 0; animation: pop-in var(--d-std) var(--spring) both;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(.96); } }
.tp-title { font: 700 18px/1.3 var(--serif); margin-bottom: 12px; }
.tp-title span { font: 400 12px var(--sans); color: var(--text-2); margin-left: 6px; }
.tp-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tp-modes button { text-align: left; padding: 12px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); display: grid; gap: 2px; transition: border-color .2s, background-color .2s; }
.tp-modes button b { font-size: 15px; }
.tp-modes button small { font-size: 12px; color: var(--text-2); line-height: 1.4; }
.tp-modes button[aria-checked='true'] { border-color: var(--accent); background: var(--accent-soft); }
.tp-modes button[aria-checked='true'] b { color: var(--accent); }
.tp-sun { margin-top: 12px; font-size: 13px; color: var(--text-2); }
.tp-sun b { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; }

/* mobile menu */
.menu {
  position: fixed; inset: 0; z-index: 45; background: var(--bg); padding-top: calc(var(--header-h) + 24px);
  display: flex; flex-direction: column; justify-content: space-between; gap: 28px; overflow-y: auto; padding-bottom: max(28px, env(safe-area-inset-bottom));
}
.menu[hidden] { display: none; }
.menu-nav { display: grid; gap: 4px; }
.menu-nav a {
  font: 700 clamp(30px, 9vw, 44px)/1.45 var(--serif); letter-spacing: .02em; display: flex; align-items: center; gap: 14px;
  opacity: 0; transform: translateY(18px); animation: menu-in var(--d-gentle) var(--spring-gentle) forwards;
}
.menu-nav a[aria-current='page']::after { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.menu-nav a:nth-child(2) { animation-delay: 30ms; } .menu-nav a:nth-child(3) { animation-delay: 60ms; } .menu-nav a:nth-child(4) { animation-delay: 90ms; }
.menu-nav a:nth-child(5) { animation-delay: 120ms; } .menu-nav a:nth-child(6) { animation-delay: 150ms; } .menu-nav a:nth-child(7) { animation-delay: 180ms; } .menu-nav a:nth-child(8) { animation-delay: 210ms; }
@keyframes menu-in { to { opacity: 1; transform: none; } }
.menu-foot { display: flex; justify-content: space-between; font-size: 14px; color: var(--text-2); }
html.menu-open { overflow: hidden; }

/* ---------- footer ---------- */
.site-footer { position: relative; margin-top: 40px; padding-bottom: max(32px, env(safe-area-inset-bottom)); }
/* the page sets like the mark: a half sun on the horizon over two ripples */
.foot-sky { height: 150px; position: relative; overflow: hidden; }
.foot-sky i { position: absolute; left: 50%; display: block; }
.fs-line { left: 0 !important; right: 0; bottom: 52px; height: 1.5px; background: linear-gradient(90deg, transparent, var(--text) 18%, var(--text) 82%, transparent); opacity: .7; }
.fs-sun { bottom: 53px; width: 76px; height: 38px; margin-left: -38px; border-radius: 76px 76px 0 0; background: var(--accent); transform: translateY(40px); transition: transform 1.1s var(--spring-gentle) .15s; }
.fs-rip { bottom: 36px; width: 86px; height: 4px; margin-left: -43px; border-radius: 2px; background: var(--text); opacity: .45; }
.fs-rip.r2 { bottom: 22px; width: 42px; margin-left: -21px; opacity: .22; }
.foot-sky.in .fs-sun, html:not(.js) .fs-sun { transform: none; }
.foot-top { display: grid; grid-template-columns: 1.2fr 2fr; gap: 48px; padding-top: 36px; }
.foot-brand p { margin: 16px 0 22px; color: var(--text-2); font-size: 15px; }
.foot-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.foot-cols h2 { font: 600 13px/1 var(--sans); letter-spacing: .14em; color: var(--text-3); margin-bottom: 18px; }
.foot-cols a { display: block; padding: 5px 0; color: var(--text-2); font-size: 15px; transition: color .2s; }
.foot-cols a:hover { color: var(--text); }
.foot-legal { margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; font-size: 13px; color: var(--text-3); }
.foot-legal p:last-child { display: flex; gap: 14px; flex-wrap: wrap; }
.icp:empty { display: none; }
.icp { color: var(--text-3); }

/* ---------- horizon widget (shared by header, phones, hero, footer) ---------- */
.hz .track { fill: none; stroke: var(--text-3); stroke-width: .9; stroke-linecap: round; stroke-dasharray: 1 2.6; }
.hz .ground { stroke: var(--line); stroke-width: 1; }
.hz .mk { fill: var(--text-2); }
.hz .sun { fill: var(--accent); }
.hz .halo { fill: var(--accent); opacity: .17; }
.hz .moon { fill: var(--text); }
.hz .moon-glow { fill: var(--text-2); opacity: .22; }
.hz .star { fill: var(--text); }
@keyframes twinkle { from { fill-opacity: .3; } to { fill-opacity: 1; } }

/* ---------- reveal on scroll ---------- */
.rv [data-reveal] { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--spring-gentle), transform 1s var(--spring-gentle); transition-delay: calc(var(--i, 0) * 70ms); }
.rv [data-reveal].in { opacity: 1; transform: none; }
.js [data-reveal='fade'] { transform: none; }
.js [data-reveal='scale'] { transform: scale(.96); }

/* ---------- page transitions (cross-document view transitions) ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out 220ms var(--exit) both; }
::view-transition-new(root) { animation: vt-in 520ms var(--spring) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-10px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(18px); } }

/* ---------- page heads for inner pages ---------- */
.page-head { padding-top: calc(var(--header-h) + clamp(56px, 9vw, 120px)); padding-bottom: clamp(40px, 6vw, 80px); }
.page-head .display { margin-top: 18px; max-width: 14em; }
.page-head .lede { margin-top: 22px; }
.crumb { font-size: 14px; color: var(--text-3); }

/* ---------- prose ---------- */
.prose { max-width: 720px; }
.prose > * + * { margin-top: 1em; }
.prose h2 { font: 700 clamp(24px, 2.6vw, 32px)/1.35 var(--serif); margin-top: 2.2em; }
.prose h3 { font: 700 20px/1.4 var(--serif); margin-top: 1.8em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: .4em; }
.prose li::marker { color: var(--accent); }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td { text-align: left; padding: 14px 16px 14px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-weight: 600; color: var(--text-3); font-size: 13px; letter-spacing: .08em; }
.table td:first-child { font-weight: 600; white-space: nowrap; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* QR codes stay dark-on-light in every palette: inverted codes defeat many scanners */
.qr { width: 172px; height: 172px; padding: 6px; border-radius: 14px; background: #fff; color: #16130f; }
.qr svg { width: 100%; height: 100%; display: block; }

/* ---------- responsive ---------- */
@media (max-width: 1040px) {
  .nav { display: none; }
  .menu-btn { display: block; }
  .site-header .bar { gap: 8px; }
  .header-cta { display: none; }
  .clock { margin-left: auto; padding-left: 10px; }
}
@media (max-width: 720px) {
  :root { --header-h: 58px; }
  body { font-size: 16px; }
  .clock-text { display: none; }
  .clock { padding: 0 8px; }
  .theme-pop { left: 12px; right: 12px; width: auto; }
  .foot-top { grid-template-columns: 1fr; gap: 36px; }
  .foot-cols { grid-template-columns: repeat(2, 1fr); }
  .table { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; transition-delay: 0ms !important; scroll-behavior: auto !important; }
  .rv [data-reveal] { opacity: 1; transform: none; }
  @view-transition { navigation: none; }
}
