/* Moss 博客 · 近黑底、大标题、血红细线 */
:root {
  --bg: #0a0a0c;
  --bg-2: #111114;
  --ink: #eee6ef;
  --ink-dim: #9a949a;
  --mute: #6d686e;
  --line: #b0000a;
  --run: #e8453a;
  --pink: #f3c4cf;
  --plate: #f3eef1;
  --hair: rgba(238, 230, 239, 0.14);
  --display: "Moss Serif", "Noto Serif CJK SC", "Noto Serif SC", serif;
  --body: "Moss Serif Text", "Noto Serif CJK SC", "Noto Serif SC", serif;
  --serif: var(--display);
  --sans: "Moss Sans", "Noto Sans CJK SC", "Noto Sans SC", sans-serif;
  --pad-x: max(1.25rem, env(safe-area-inset-left, 0px), 4vw);
  --pad-r: max(1.25rem, env(safe-area-inset-right, 0px), 4vw);
  --pad-t: max(0.7rem, env(safe-area-inset-top, 0px));
  --pad-b: max(1.5rem, env(safe-area-inset-bottom, 0px));
}

@font-face {
  font-family: "Moss Serif";
  src: url("../fonts/NotoSerifSC-Bold-site.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Moss Serif Text";
  src: url("../fonts/NotoSerifSC-Regular-site.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Moss Sans";
  src: url("../fonts/NotoSansSC-Regular-site.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Moss Sans";
  src: url("../fonts/NotoSansSC-Bold-site.woff") format("woff");
  font-weight: 600 800;
  font-style: normal;
  font-display: swap;
}
/* 同文件别名：皮肤栈可直接写 Noto / 像素 / 楷体 / Plex 家族名 */
@font-face {
  font-family: "Noto Sans CJK SC";
  src: url("../fonts/NotoSansSC-Regular-site.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans CJK SC";
  src: url("../fonts/NotoSansSC-Bold-site.woff") format("woff");
  font-weight: 600 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans Mono CJK SC";
  src: url("../fonts/NotoSansMonoSC-Regular-site.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans Mono CJK SC";
  src: url("../fonts/NotoSansMonoSC-Bold-site.woff") format("woff");
  font-weight: 600 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "LXGW WenKai";
  src: url("../fonts/LXGWWenKai-Regular-site.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Press Start 2P";
  src: url("../fonts/PressStart2P-Regular.woff") format("woff");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/IBMPlexMono-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/IBMPlexMono-Bold.woff") format("woff");
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.7;
  background: var(--bg);
  color: var(--ink);
}

.fx { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.fx-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(238, 230, 239, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(238, 230, 239, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 75%);
}
.fx-vignette {
  position: absolute; inset: 0;
  box-shadow: inset 0 0 180px 40px #0a0a0c, inset 0 -80px 80px -40px #0a0a0c;
}
.fx-grain {
  position: absolute; inset: -40px;
  opacity: 0.05;
  background-image: url("../img/grain.svg");
  background-size: 180px 180px;
}

.wrap { position: relative; z-index: 1; min-height: 100dvh; display: flex; flex-direction: column; }

.site-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: var(--pad-t) var(--pad-r) 0.75rem var(--pad-x);
  border-bottom: 1px solid var(--hair);
}
.brand {
  display: flex; align-items: center; gap: 0.65rem;
  text-decoration: none; color: var(--ink);
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.28em;
  font-size: 0.92rem;
}
.brand span { transform: translateY(0.04em); }
.runlight {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--run);
  box-shadow: 0 0 8px 2px rgba(232, 69, 58, 0.55);
  animation: pulse 2.8s ease-in-out infinite;
  flex: 0 0 auto;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px 2px rgba(232, 69, 58, 0.55); }
  50% { opacity: 0.7; box-shadow: 0 0 5px 1px rgba(232, 69, 58, 0.3); }
}
.site-nav {
  display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.15rem 1.05rem;
  font-family: var(--sans);
}
.site-nav a {
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  padding: 0.2rem 0;
  border-bottom: 1px solid transparent;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--line);
}

main {
  flex: 1;
  padding: 2.2rem var(--pad-r) 3rem var(--pad-x);
  width: 100%;
}
.inner { width: min(1120px, 100%); margin: 0 auto; }

.hero {
  display: grid;
  grid-template-columns: 1fr minmax(240px, 42%);
  gap: 3rem;
  align-items: end;
  min-height: calc(100dvh - 8rem);
  width: min(1120px, 100%);
  margin: 0 auto;
  padding-bottom: 1rem;
}
.kicker {
  margin: 0 0 1.1rem;
  color: var(--ink-dim);
  letter-spacing: 0.28em;
  font-size: 0.72rem;
}
.hero h1, .page-title h1 {
  font-family: var(--display);
  font-weight: 700;
  margin: 0;
  line-height: 0.95;
  letter-spacing: 0.22em;
}
.hero h1 { font-size: clamp(4.2rem, 14vw, 8.5rem); }
.hairline {
  display: block;
  width: 7.5rem;
  height: 1px;
  background: var(--line);
  margin: 1.35rem 0 1.25rem;
  border: 0;
}
.lead {
  margin: 0;
  font-size: 1.05rem;
  color: var(--ink);
  max-width: 22em;
}
.sublead {
  margin: 0.55rem 0 0;
  color: var(--ink-dim);
  font-size: 0.92rem;
  max-width: 28em;
}
.cta { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 2rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.6rem;
  padding: 0.45rem 1.25rem;
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.18em;
  font-size: 0.82rem;
  background: transparent;
}
.btn:hover { background: rgba(176, 0, 10, 0.14); }
.btn-ghost { border-color: var(--hair); }
.btn-ghost:hover { border-color: var(--ink-dim); background: transparent; }

.hero-fig {
  margin: 0;
  background: var(--plate);
  padding: 0.7rem 0.7rem 0;
  align-self: stretch;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.hero-fig img, .plate img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(78dvh, 820px);
  object-fit: contain;
  object-position: bottom center;
}

.page-title { margin-bottom: 2.2rem; max-width: 40rem; }
.page-title h1 {
  font-size: clamp(2.4rem, 8vw, 4.2rem);
  letter-spacing: 0.16em;
}
.page-title p { margin: 0; color: var(--ink-dim); max-width: 34em; }

.prose { max-width: 38rem; }
.prose p { margin: 0 0 1.05rem; color: var(--ink); }
.prose .dim { color: var(--ink-dim); }

.spec {
  list-style: none;
  margin: 1.6rem 0 2rem;
  padding: 0;
  border-top: 1px solid var(--hair);
  max-width: 40rem;
}
.spec li {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--hair);
  font-size: 0.95rem;
}
.spec dt, .spec .k { color: var(--mute); letter-spacing: 0.08em; font-size: 0.78rem; padding-top: 0.2rem; }
.spec dd, .spec .v { margin: 0; }

.plate {
  margin: 2.2rem 0 0;
  background: var(--plate);
  padding: 0.85rem;
  max-width: 900px;
}
.plate figcaption, .hero-fig figcaption {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--mute);
  padding: 0.65rem 0.1rem 0.15rem;
}
.plate figcaption { color: #5c575c; }

.works { display: grid; gap: 0; max-width: 42rem; border-top: 1px solid var(--hair); }
.work {
  display: grid;
  gap: 0.35rem;
  padding: 1.35rem 0;
  border-bottom: 1px solid var(--hair);
  text-decoration: none;
  color: inherit;
}
.work h2 {
  font-family: var(--display);
  font-size: 1.45rem;
  letter-spacing: 0.06em;
  margin: 0;
  line-height: 1.3;
}
.tag {
  display: inline-block;
  color: var(--ink-dim);
  letter-spacing: 0.16em;
  font-size: 0.68rem;
}
.tag-run { color: var(--run); }
.work p, .card p { margin: 0; color: var(--ink-dim); font-size: 0.92rem; }

.section-label {
  margin: 2.4rem 0 1rem;
  letter-spacing: 0.22em;
  font-size: 0.72rem;
  color: var(--ink-dim);
}
.section-label:first-child { margin-top: 0; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0;
  background: transparent;
  border: 0;
}
.card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1.25rem 1.15rem 1.2rem;
  background: var(--bg);
  color: inherit;
  text-decoration: none;
  min-height: 10.5rem;
  border: 1px solid var(--hair);
  margin: 0 -1px -1px 0;
}
.card:hover { background: var(--bg-2); }
.card h2 {
  font-family: var(--display);
  font-size: 1.28rem;
  letter-spacing: 0.06em;
  margin: 0;
  line-height: 1.25;
}
.card .meta {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.8rem;
  letter-spacing: 0.14em;
  font-size: 0.66rem;
  color: var(--mute);
  padding-top: 0.6rem;
}
.card .meta .ok { color: var(--run); }
.card .meta .wait { color: var(--ink-dim); }
.card.is-off {
  pointer-events: none;
  opacity: 0.72;
}
.card.is-off:hover { background: var(--bg); }
.note { color: var(--ink-dim); font-size: 0.88rem; max-width: 38rem; }

.note-list { list-style: none; margin: 0; padding: 0; max-width: 40rem; border-top: 1px solid var(--hair); }
.note-list li { border-bottom: 1px solid var(--hair); }
.note-list a {
  display: grid;
  gap: 0.2rem;
  padding: 1.2rem 0;
  color: inherit;
  text-decoration: none;
}
.note-list a:hover h2 { color: var(--pink); }
.note-list time { color: var(--mute); font-size: 0.75rem; letter-spacing: 0.12em; }
.note-list h2 {
  font-family: var(--display);
  font-size: 1.35rem;
  margin: 0;
  letter-spacing: 0.04em;
}

.article { max-width: 36rem; }
.article h1 {
  font-family: var(--display);
  font-size: clamp(2rem, 6vw, 3rem);
  letter-spacing: 0.1em;
  line-height: 1.2;
  margin: 0 0 0.4rem;
}
.article .byline { color: var(--mute); font-size: 0.78rem; letter-spacing: 0.1em; margin-bottom: 1.6rem; }
.article p { margin: 0 0 1.1rem; }

.site-foot {
  padding: 1.2rem var(--pad-r) var(--pad-b) var(--pad-x);
  border-top: 1px solid var(--hair);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.4rem;
  justify-content: space-between;
  color: var(--mute);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
}
.site-foot p { margin: 0; }
.site-foot a {
  color: inherit;
  font-family: inherit;
  text-decoration: none;
}
.site-foot a:hover,
.site-foot a:focus-visible {
  color: var(--ink-dim);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

/* Homepage ICP only: 主页底部中央. 略放大但仍单行、保持页脚原样，不要怪. */
.site-foot--beian {
  justify-content: center;
  text-align: center;
  font-size: clamp(1.12rem, 4.5vw, 1.4rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1.4;
  white-space: nowrap;
}
.site-foot--beian a {
  color: inherit;
}


@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: start;
    min-height: auto;
  }
  .hero-fig {
    order: 1;
    max-width: 420px;
    width: 100%;
    margin-inline: auto;
  }
  .hero-copy { order: 0; }
  .spec li { grid-template-columns: 1fr; gap: 0.25rem; }
}

@media (max-width: 560px) {
  .site-head { flex-direction: column; align-items: flex-start; gap: 0.55rem; }
  .site-nav { gap: 0.15rem 0.9rem; }
  .hero h1 { letter-spacing: 0.14em; }
  .cards { grid-template-columns: 1fr; }
}

/* iPhone 横屏短视口：标题与立绘并排，避开左右安全区 */
@media (orientation: landscape) and (max-height: 500px) {
  .site-head { padding-top: max(0.35rem, env(safe-area-inset-top, 0px)); padding-bottom: 0.35rem; }
  main { padding-top: 1rem; padding-bottom: 1.2rem; }
  .hero {
    grid-template-columns: 1fr minmax(180px, 38%);
    gap: 1.4rem;
    min-height: calc(100dvh - 5.5rem);
    align-items: center;
  }
  .hero h1 { font-size: clamp(2.6rem, 14vh, 4.8rem); }
  .hairline { margin: 0.7rem 0 0.7rem; }
  .cta { margin-top: 0.9rem; }
  .hero-fig { align-self: stretch; }
  .hero-fig img { max-height: calc(100dvh - 5rem); }
}

/* 日记首页 · 长文阅读 */
.is-diary .fx-grid { opacity: 0.4; }
.is-diary .fx-grain { opacity: 0.035; }

.diary {
  width: min(46em, 100%);
  margin: 0 auto;
  padding: 2.4rem var(--pad-r) 4.2rem var(--pad-x);
  flex: 1;
}
.diary-masthead { margin-bottom: 2.6rem; }
.diary-masthead h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.15rem, 7.5vw, 3.35rem);
  letter-spacing: 0.1em;
  line-height: 1.15;
  margin: 0;
}
.diary-masthead .hairline { margin: 1.2rem 0 1.5rem; }

.diary-toc { margin: 0; }
.diary-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--hair);
}
.diary-toc li { border-bottom: 1px solid var(--hair); }
.diary-toc a {
  display: grid;
  grid-template-columns: 8.6rem 1fr;
  gap: 0.8rem;
  align-items: baseline;
  padding: 0.62rem 0;
  color: inherit;
  text-decoration: none;
}
.diary-toc a:hover span { color: var(--ink); }
.diary-toc time {
  font-family: var(--sans);
  color: var(--mute);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  font-size: 0.82rem;
}
.diary-toc span {
  color: var(--ink-dim);
  font-size: 0.95rem;
}

.entry {
  padding: 2.15rem 0 0.4rem;
  border-top: 1px solid var(--hair);
  scroll-margin-top: 4.5rem;
}
.entry-head { margin: 0 0 1.25rem; }
.entry-head time {
  display: block;
  font-family: var(--sans);
  color: var(--mute);
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.45rem;
}
.entry-head h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.35rem, 3.4vw, 1.75rem);
  letter-spacing: 0.04em;
  line-height: 1.35;
  margin: 0;
}
.entry p {
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 2;
  letter-spacing: 0.04em;
  color: var(--ink);
  margin: 0 0 0.15em;
  text-align: justify;
  text-justify: inter-ideograph;
  text-indent: 2em;
}
.entry p:last-child { margin-bottom: 0; }

@media (max-width: 560px) {
  .diary { padding-top: 1.6rem; padding-bottom: 3rem; }
  .diary-toc a { grid-template-columns: 1fr; gap: 0.15rem; padding: 0.7rem 0; }
  .entry { padding-top: 1.7rem; }
  .entry p { font-size: 1.02rem; line-height: 1.92; }
}

.site-nav { margin-left: auto; }
@media (max-width: 560px) {
  .site-head { align-items: flex-start; }
  .site-nav { margin-left: 0; }
}

a.title-home {
  color: inherit;
  text-decoration: none;
  display: inline-block;
  min-height: 44px;
}
a.title-home:hover { color: var(--ink); }

/* 视频页封面网格 */
.video-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0;
}
.video-card {
  display: flex;
  flex-direction: column;
  color: inherit;
  text-decoration: none;
  background: var(--bg);
  border: 1px solid var(--hair);
  margin: 0 -1px -1px 0;
}
.video-card:hover { background: var(--bg-2); }
.video-card .cover {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg-2);
}
.video-card .cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.video-card h2 {
  font-family: var(--display);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.35;
  margin: 0;
  padding: 0.8rem 0.9rem 0.15rem;
}
.video-card time {
  font-family: var(--sans);
  color: var(--mute);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  padding: 0.2rem 0.9rem 0.95rem;
}
.page-title p a {
  color: var(--ink);
  text-underline-offset: 0.18em;
}
@media (max-width: 560px) {
  .video-cards { grid-template-columns: 1fr; }
}
