/* ============================================================
   yunikaliu.com · Lila · layout & scenes
   规格权威: BRAND.md + 工单二号 (2026-07-07)。
   排版铁律 §4: 禁 em dash; 行宽 ~65ch;
   关卡元素只在页眉页脚, 正文区永远干净可读。
   关卡元素封版, 只减不增 (§5)。砖上永远不出现问号。
   词块四枚 = 主句括号的场景化搬家 (§5 唯一开例)。
   ============================================================ */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* 跨页翻页: 支持 View Transitions 的浏览器里, 页与页像翻书一样淡过去 */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.7;
  background: var(--bg);
  color: var(--ink);
  transition: background-color 0.5s ease, color 0.5s ease;
}
@media (prefers-reduced-motion: reduce) {
  body { transition: none; }
}

/* 呼吸切换 · BRAND.md §7.1 */
html.breathing::after {
  content: "";
  position: fixed;
  inset: 0;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  z-index: 999;
  animation: breath 0.9s ease;
}
@keyframes breath {
  0% { opacity: 0; }
  45% { opacity: 0.9; }
  100% { opacity: 0; }
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.3;
  text-wrap: balance;
}
h1 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); }

a { color: var(--link); text-underline-offset: 3px; }
a:hover { color: var(--accent); }

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

/* 统一 container (工单二号 §A5: 标题/正文/按钮左缘对齐) */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding-left: clamp(1.75rem, 5vw, 2.5rem);
  padding-right: clamp(1.75rem, 5vw, 2.5rem);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- 滚动展开 (展开网站就像展开故事) ----------
   仅在 JS 可用时隐藏; 无 JS / 减少动态 = 直接全部可见 */
html.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
html.js .reveal.in {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  html.js .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- header / nav / HUD ---------- */
.site-head { position: relative; z-index: 5; }

.hud {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  background: var(--hud-bg);
  color: var(--hud-ink);
  backdrop-filter: blur(4px);
}
.hud-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}
.hud .world { white-space: nowrap; }
.hud .world .w-day { display: inline; }
.hud .world .w-night { display: none; }
:root[data-theme="night"] .hud .world .w-day { display: none; }
:root[data-theme="night"] .hud .world .w-night { display: inline; }

nav.main-nav {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
nav.main-nav a { color: var(--hud-ink); text-decoration: none; }
nav.main-nav a:hover,
nav.main-nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 4px; }

.half-switch {
  border: none;
  background: transparent;
  color: var(--hud-ink);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.45rem;
  border-radius: 999px;
}
.half-switch:hover { background: var(--chip-alt-bg); }
.half-switch .moon { display: inline; }
.half-switch .sun { display: none; }
:root[data-theme="night"] .half-switch .moon { display: none; }
:root[data-theme="night"] .half-switch .sun { display: inline; }

/* ---------- 场景横条: 250px 的屋檐 (工单二号 §A1) ---------- */
.scene-band {
  position: relative;
  height: 250px;
  overflow: hidden;
}

/* --- day scene --- */
.scene-day {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, var(--sky) 0%, #BFE6F7 52%, #DFF2E9 80%, #CBEAC0 100%);
}
:root[data-theme="night"] .scene-day { display: none; }

.sunface {
  position: absolute; top: 16px; right: 7%;
  width: 52px; height: 52px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #FFF3C4, #F2C14E 70%);
  box-shadow: 0 0 0 10px rgba(242, 193, 78, 0.2), 0 0 40px rgba(242, 193, 78, 0.5);
}
.cloud {
  position: absolute; background: #fff; border-radius: 999px; opacity: 0.95;
  animation: drift 34s ease-in-out infinite alternate;
}
.cloud::before, .cloud::after { content: ""; position: absolute; background: #fff; border-radius: 50%; }
@keyframes drift {
  from { margin-left: 0; }
  to { margin-left: 26px; }
}
.c1 { width: 84px; height: 24px; top: 26px; left: 14%; }
.c1::before { width: 32px; height: 32px; top: -15px; left: 14px; }
.c1::after { width: 24px; height: 24px; top: -10px; left: 44px; }
.c2 { width: 60px; height: 19px; top: 58px; right: 24%; animation-delay: -17s; }
.c2::before { width: 24px; height: 24px; top: -11px; left: 9px; }
.c2::after { width: 19px; height: 19px; top: -8px; left: 32px; }

.hill { position: absolute; bottom: 46px; border-radius: 50% 50% 0 0; background: #8FCB86; }
.h1 { width: 360px; height: 120px; left: -70px; }
.h2 { width: 320px; height: 92px; right: -50px; background: #A5D89A; }

.platform {
  position: absolute; bottom: 0; height: 46px; left: 0; right: 0;
  background: linear-gradient(180deg, var(--accent) 0 13px, var(--dirt) 13px 100%);
}
.platform::before {
  content: ""; position: absolute; top: 11px; left: 0; right: 0; height: 4px;
  background: var(--accent-deep); opacity: 0.35;
}
.gap {
  position: absolute; bottom: 0; width: 70px; height: 46px; left: 58%;
  background: linear-gradient(180deg, #9ED4F0, #7FC2E6);
}

/* --- night scene --- */
.scene-night {
  position: absolute; inset: 0; display: none;
  background: linear-gradient(180deg, #0D1322 0%, #131A2E 45%, #1A2038 100%);
}
:root[data-theme="night"] .scene-night { display: block; }

.rain {
  position: absolute; inset: 0; opacity: 0.32; pointer-events: none;
  background: repeating-linear-gradient(115deg, transparent 0 26px, rgba(146, 180, 214, 0.16) 26px 27px);
  animation: fall 1.6s linear infinite;
}
@keyframes fall {
  from { background-position: 0 0; }
  to { background-position: -54px 108px; }
}

.skyline {
  position: absolute; left: 0; right: 0; bottom: 46px; height: 74px; opacity: 0.75;
  background:
    linear-gradient(180deg, transparent 55%, #0A0F1D 56%),
    radial-gradient(2px 2px at 8% 60%, #C86BC9 50%, transparent 51%),
    radial-gradient(2px 2px at 16% 44%, #5BC8DF 50%, transparent 51%),
    radial-gradient(2px 2px at 27% 68%, #E9A65A 50%, transparent 51%),
    radial-gradient(2px 2px at 38% 52%, #5BC8DF 50%, transparent 51%),
    radial-gradient(2px 2px at 52% 38%, #C86BC9 50%, transparent 51%),
    radial-gradient(2px 2px at 64% 62%, #EDEBE4 50%, transparent 51%),
    radial-gradient(2px 2px at 76% 46%, #E9A65A 50%, transparent 51%),
    radial-gradient(2px 2px at 88% 58%, #5BC8DF 50%, transparent 51%);
}
.nplatform {
  position: absolute; bottom: 0; height: 46px; left: 0; right: 0;
  /* 下缘淡入正文底色, 屋檐与正房无缝 */
  background: linear-gradient(180deg, #232B45 0 13px, #1A2038 13px, var(--bg) 100%);
}
.camper-wrap {
  position: absolute; bottom: 46px; right: 6%;
  transform: scale(0.82); transform-origin: bottom right;
}
.camper {
  position: relative;
  width: 150px; height: 84px; border-radius: 14px 18px 8px 8px;
  background: linear-gradient(180deg, #7BA6B5 0 55%, #5F8996 55% 100%);
  border: 2.5px solid #3E5D68;
}
.camper .win {
  position: absolute; top: 16px; left: 16px; width: 52px; height: 30px; border-radius: 6px;
  background: radial-gradient(circle at 50% 45%, #FFE3AE, #E9A65A 75%);
  box-shadow: 0 0 22px rgba(233, 166, 90, 0.8);
  border: 2px solid #3E5D68;
}
.camper .door {
  position: absolute; top: 22px; right: 14px; width: 30px; height: 52px;
  border-radius: 6px 6px 0 0; background: #40606C; border: 2px solid #2E4650;
}
.camper .wheel {
  position: absolute; bottom: -10px; width: 22px; height: 22px; border-radius: 50%;
  background: #22303B; border: 3px solid #10181E;
}
.camper .w1 { left: 18px; }
.camper .w2 { right: 22px; }
/* 霓虹粉瓷白相间的小雨棚 (封版清单原有成员, 2026-07-07 深夜归位) */
.awning {
  position: absolute; top: -11px; left: -10px;
  width: 96px; height: 10px; border-radius: 4px;
  background: repeating-linear-gradient(90deg, #C86BC9 0 16px, #EDEBE4 16px 32px);
  transform: rotate(-4deg); opacity: 0.9;
}

/* motto 住在夜半场, camper 暖灯旁 (旁白第三人称, BRAND §0) */
.scene-motto {
  position: absolute;
  bottom: 68px;
  right: calc(6% + 145px);
  margin: 0;
  max-width: 20ch;
  text-align: right;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.82rem;
  line-height: 1.5;
  color: rgba(237, 235, 228, 0.75);
  text-shadow: 0 1px 10px rgba(13, 19, 34, 0.9);
  pointer-events: none;
}

/* --- 词块四枚 (dreams / birth charts / memories / life stories) --- */
.chips { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.wchip {
  position: absolute;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  background: var(--wchip-bg);
  color: var(--wchip-ink);
  border: 1.5px solid var(--wchip-border);
  box-shadow: 0 2px 8px rgba(30, 50, 30, 0.12);
  animation: bob 3.6s ease-in-out infinite;
}
.wchip::after { content: "✦"; margin-left: 0.35rem; color: var(--wchip-star); }
.wc1 { bottom: 96px; left: 9%; }
.wc2 { bottom: 132px; left: 30%; animation-delay: 0.9s; }
.wc3 { bottom: 104px; left: 64%; animation-delay: 1.8s; }
.wc4 { bottom: 140px; left: 81%; animation-delay: 2.7s; }
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* --- 双龟跑酷 (§6 双龟法条: 从不单独出现) --- */
.runner {
  position: absolute; left: -12%; bottom: 46px; z-index: 3;
  animation: runX var(--run) linear infinite;
}
.runner .body { animation: jump var(--run) linear infinite; }
.runner.blue { bottom: 76px; animation-delay: 1.6s; }
.runner.blue .body { animation: hoverY 3s ease-in-out infinite; }
@keyframes runX {
  from { left: -12%; }
  to { left: 105%; }
}
@keyframes jump {
  0%, 52% { transform: translateY(0); }
  56% { transform: translateY(-46px); }
  60%, 100% { transform: translateY(0); }
}
@keyframes hoverY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.tl .glow { opacity: var(--t2-glow); }
:root[data-theme="night"] .runner .glow,
:root[data-theme="night"] .foot-turtles .glow {
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.28; }
  50% { opacity: 0.55; }
}

/* 减少动态: 全部静止, 双龟停在场景中, 仍是两只 (工单二号 §A2) */
@media (prefers-reduced-motion: reduce) {
  .runner, .runner .body, .wchip, .rain, .cloud, .glow { animation: none !important; }
  .runner { left: 30%; }
  .runner.blue { left: 44%; }
}

/* ---------- content ---------- */
main { padding: 4rem 0 4.5rem; }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--eyebrow);
  margin: 0 0 1.4rem;
}

.intro h1 {
  font-size: clamp(1.7rem, 3.6vw, 2.5rem);
  line-height: 1.26;
  margin: 0;
  max-width: 22ch;
}
.em-cry {
  font-style: normal;
  color: var(--em-ink);
  background-image: var(--em-bg);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  padding: 0 2px;
  text-shadow: var(--em-shadow);
}
/* 荧光笔从左到右划过 cry over (仅首屏一次) */
html.js .intro .em-cry {
  background-size: 0% 100%;
  animation: sweep 0.9s ease 0.7s forwards;
}
@keyframes sweep {
  to { background-size: 100% 100%; }
}
@media (prefers-reduced-motion: reduce) {
  html.js .intro .em-cry { animation: none; background-size: 100% 100%; }
}

.sub {
  font-size: 1rem;
  line-height: 1.75;
  max-width: 58ch;
  margin: 1.7rem 0 0;
  color: var(--ink-soft);
}
.cta-row { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 2.4rem; }
.btn {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.65rem 1.35rem;
  border-radius: 11px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn.primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-ink);
  box-shadow: 0 3px 0 var(--accent-btn-shadow);
}
.btn.ghost {
  background: transparent;
  color: var(--btn-ghost-ink);
  border: 2px solid currentColor;
}

/* 印章分隔符 (§6 印章轮班: 白天砧木花 / 夜里暖咖啡) */
.stamp-divider {
  display: flex;
  justify-content: center;
  margin: 3.4rem auto;
  opacity: 0.85;
}

.prose { max-width: 65ch; }
.prose p { margin: 0 0 1.1rem; }
.prose h2 { font-size: 1.35rem; margin: 0 0 1rem; }
.prose h3 { font-size: 1.05rem; margin: 1.6rem 0 0.5rem; }
.prose .eyebrow { margin-bottom: 0.6rem; }

.back { margin: 0 0 2rem; }
.back a {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
}

.chip {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.05em;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--chip-ink);
}
.chip.alt { background: var(--chip-alt-bg); color: var(--chip-alt-ink); }

/* ---------- cards (Level Select) ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 1.4rem 1.6rem;
}
.card + .card { margin-top: 1rem; }
.card h3 { margin: 0 0 0.4rem; }
.card .meta {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 0.5rem;
}
.card p { margin: 0; color: var(--ink-soft); font-size: 0.94rem; }
a.card {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
a.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 26px rgba(20, 25, 20, 0.14);
  border-color: var(--accent);
  color: inherit;
}
.card .go {
  display: inline-block;
  color: var(--link);
  transition: transform 0.25s ease;
}
a.card:hover .go { transform: translateX(4px); }

.now-card { border-left: 4px solid var(--accent); }

/* 缝合线: 这个项目教会我的, 现在用在哪 (工单二号 §B9) */
.stitch {
  margin-top: 2.6rem;
  padding-top: 1.3rem;
  border-top: 1px dashed var(--rule);
}
.stitch .eyebrow { margin-bottom: 0.5rem; }
.stitch p {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-soft);
  margin: 0;
}

/* 视频素材 (YouTube 住在 YouTube, 工单二号 §C12) */
.video-frame {
  aspect-ratio: 16 / 9;
  width: 100%;
  margin: 1.8rem 0;
  border: 1px solid var(--rule);
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-soft);
}
.video-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

/* PDF 素材 (Google Drive preview 嵌入) */
.pdf-frame {
  width: 100%;
  height: clamp(420px, 70vh, 600px);
  margin: 1.8rem 0;
  border: 1px solid var(--rule);
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-soft);
}
.pdf-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

/* 金元宝彩蛋: 给未来的存档位 (白天点太阳 / 夜里点车窗, 出现一下下就走) */
.egg-ingot {
  position: absolute;
  z-index: 9;
  pointer-events: none;
  animation: ingotUp 1.7s ease-out forwards;
}
@keyframes ingotUp {
  0% { transform: translateY(8px) scale(0.5); opacity: 0; }
  18% { transform: translateY(-8px) scale(1); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translateY(-52px) scale(1); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .egg-ingot { animation: ingotFade 1.4s ease forwards; }
  @keyframes ingotFade {
    0%, 60% { opacity: 1; }
    100% { opacity: 0; }
  }
}

/* ---------- photography ---------- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.9rem;
  margin-top: 1.6rem;
}
@media (max-width: 760px) { .photo-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px) {
  .photo-grid { grid-template-columns: 1fr; }
  .photo-grid img.feat { grid-column: span 1; grid-row: span 1; }
}
.photo-grid img {
  width: 100%; height: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 10px;
  transition: transform 0.35s ease;
}
.photo-grid img:hover { transform: scale(1.02); }
@media (prefers-reduced-motion: reduce) {
  .photo-grid img { transition: none; }
  .photo-grid img:hover { transform: none; }
}
.photo-grid img.feat { grid-column: span 2; grid-row: span 2; }
.photo-note {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-faint);
  margin-top: 1.4rem;
}

/* ---------- footer (印章轮班 §6 + 双龟 §9.5) ---------- */
footer.site-foot {
  position: relative;
  border-top: 1px solid var(--rule);
  padding: 2rem 0 2.6rem;
  margin-top: 2rem;
}
/* 双龟坐在页脚的地平线上, 陪你到每一页的结尾 */
.foot-turtles {
  position: absolute;
  top: 1px; right: 9%;
  transform: translateY(-100%);
  display: flex;
  align-items: flex-end;
  gap: 0.2rem;
  pointer-events: none;
}
.foot-turtles svg { display: block; }
.foot-turtles .tl-green { animation: bobSoft 4.5s ease-in-out infinite; }
.foot-turtles .tl-blue { animation: bobSoft 4.5s ease-in-out 0.6s infinite; }
@keyframes bobSoft {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
  .foot-turtles .tl-green, .foot-turtles .tl-blue { animation: none; }
}
.foot-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.foot-stamp { display: flex; align-items: center; gap: 0.8rem; }
.stamp-day { display: block; }
.stamp-night { display: none; }
:root[data-theme="night"] .stamp-day { display: none; }
:root[data-theme="night"] .stamp-night { display: block; }
.foot-note {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}
.foot-links { display: flex; gap: 1rem; font-size: 0.8rem; }

/* ---------- 半场专属显隐 ---------- */
.only-night { display: none; }
:root[data-theme="night"] .only-night { display: revert; }
:root[data-theme="night"] .only-day { display: none; }

/* ---------- mobile (手机用户友好) ---------- */
@media (max-width: 640px) {
  .scene-band { height: 210px; }
  .hud-inner { flex-wrap: wrap; row-gap: 0.3rem; }
  nav.main-nav { font-size: 0.68rem; gap: 0.9rem; }
  .runner { transform: scale(0.82); transform-origin: bottom left; }
  .camper-wrap { transform: scale(0.68); }
  .scene-motto { display: none; }
  .wchip { font-size: 0.6rem; padding: 0.26rem 0.55rem; }
  .wc1 { bottom: 78px; left: 5%; }
  .wc2 { bottom: 128px; left: 24%; }
  .wc3 { bottom: 84px; left: 56%; }
  .wc4 { bottom: 142px; left: 58%; }
  .skyline { bottom: 46px; }
  .hill.h2 { right: -120px; }
  main { padding: 3rem 0 3.5rem; }
  .stamp-divider { margin: 2.6rem auto; }
  .foot-turtles { right: 6%; }
}
