/* 基础：重置、桌面、文字、焦点、滚动条 */

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--desk);
  transition: background-color 0.9s ease;
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  font: var(--t-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* 文楷只有一个字重，不让浏览器硬加粗 */
  font-synthesis-weight: none;
  overflow-x: hidden;
  /* 桌面的底色画在 html 上；body 透明，木纹那一层（.desk-bg，z-index 为负）才露得出来 */
  background: transparent;
  transition: color 0.6s ease;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 400;
}
h1,
h2,
h3,
.kai {
  font-family: var(--font-kai);
  font-weight: 400;
  letter-spacing: 0;
}
p {
  margin: 0;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
::selection {
  background: var(--accent-soft);
}
.num {
  font-variant-numeric: tabular-nums;
}
.nw {
  white-space: nowrap;
}
/* 标题里的短语：短语之间才换行；一个短语比一行还长时照常在里面断 */
.phrase {
  display: inline-block;
  max-width: 100%;
}
.muted {
  color: var(--ink-2);
}
.faint {
  color: var(--ink-3);
}
[hidden] {
  display: none !important;
}
.spacer {
  flex: 1;
}
.row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.row.wrap {
  flex-wrap: wrap;
}
.stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
}

/* —— 桌面：横向木纹 + 四角压暗。fixed 一层，滚动时不动，像真的桌子 —— */
.desk-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background: linear-gradient(180deg, var(--desk-2), var(--desk));
  transition: background-color 0.9s ease;
}
.desk-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('/img/wood.svg') 0 0 / 900px 900px;
  opacity: var(--wood);
}
.desk-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 110% 85% at 50% 14%, transparent 44%, var(--vignette)),
    repeating-linear-gradient(0.6deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 6px, rgba(0, 0, 0, 0.04) 6px 7px, transparent 7px 17px);
}

/* —— 滚动条：照 Harness，滑块跟着表面走，轨道透明 —— */
@supports not selector(::-webkit-scrollbar) {
  body,
  body * {
    scrollbar-width: thin;
    scrollbar-color: var(--line-2) transparent;
  }
}
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--line-2);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--ink-3);
}
::-webkit-scrollbar-corner {
  background: transparent;
}

/* —— 启动画面：灯慢慢亮起来 —— */
.boot {
  min-height: 100dvh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  color: var(--ink-3);
}
.boot-bar {
  width: 180px;
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(180deg, var(--alu-2), var(--alu-4));
  box-shadow: 0 10px 40px 4px rgba(var(--warm), 0.35);
  animation: boot-warm 2.4s var(--ease) infinite;
}
@keyframes boot-warm {
  0%,
  100% {
    box-shadow: 0 10px 30px 0 rgba(var(--warm), 0.18);
  }
  50% {
    box-shadow: 0 12px 46px 6px rgba(var(--warm), 0.42);
  }
}

/* —— 出现、高亮 —— */
.reveal {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 50ms);
}
.reveal.in {
  opacity: 1;
  transform: none;
}
/* 导师刚改过的东西：亮一下（像灯下被翻了一下） */
.flash {
  animation: flash 2.4s var(--ease-out);
}
@keyframes flash {
  12% {
    box-shadow: 0 0 0 3px rgba(var(--warm), 0.55), 0 0 28px rgba(var(--warm), 0.45);
  }
}
.row-flash {
  animation: row-flash 2.4s var(--ease-out);
}
@keyframes row-flash {
  12% {
    background-color: var(--accent-soft);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.12s !important;
    scroll-behavior: auto !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}
