/* 爱百窗小记 — 落地页与短文共用样式 */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --ink: #1a2433;
  --ink-soft: #3d4a5c;
  --muted: #6b7a8d;
  --paper: #eef3f8;
  --surface: rgba(255, 255, 255, 0.92);
  --line: #cfd9e6;
  --accent: #1f7a8c;
  --accent-deep: #155a68;
  --accent-sky: #5ccbff;
  --accent-warm: #f0a12a;
  --code-bg: #0e1620;
  --code-glow: #5ccbff;
  --notebook: #f7f1e6;
  --notebook-line: #d4c4a8;
  --shadow: 0 10px 32px rgba(28, 36, 48, 0.08);
  --radius: 14px;
  --font-display: "Noto Serif SC", "Songti SC", "STSong", serif;
  --font-body: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "Cascadia Code", "Sarasa Mono SC", "Consolas", monospace;
  --frame-inset: clamp(10px, 1.8vw, 18px);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1000px 520px at 8% -8%, rgba(92, 203, 255, 0.18) 0%, transparent 55%),
    radial-gradient(900px 480px at 96% 4%, rgba(240, 161, 42, 0.1) 0%, transparent 48%),
    linear-gradient(180deg, #f5f8fb 0%, var(--paper) 100%);
  min-height: 100vh;
  line-height: 1.7;
  position: relative;
}

a {
  color: var(--accent-deep);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent);
}

.wrap {
  width: min(980px, calc(100% - 2rem));
  margin-left: auto;
  margin-right: auto;
}

.page-shell {
  position: relative;
  z-index: 1;
  padding: calc(var(--frame-inset) + 0.35rem) 0;
}

/* —— 科技线条背景 —— */
.tech-lines {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.85;
}

/* —— 淡雅窗框示意 —— */
.window-frame {
  position: fixed;
  inset: var(--frame-inset);
  z-index: 2;
  pointer-events: none;
  border: 1px solid rgba(90, 140, 170, 0.18);
  border-radius: 10px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.2);
}

.wf-corner {
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: rgba(80, 150, 180, 0.42);
  border-style: solid;
  border-width: 0;
}

.wf-corner.tl { top: 6px; left: 6px; border-top-width: 2px; border-left-width: 2px; }
.wf-corner.tr { top: 6px; right: 6px; border-top-width: 2px; border-right-width: 2px; }
.wf-corner.bl { bottom: 6px; left: 6px; border-bottom-width: 2px; border-left-width: 2px; }
.wf-corner.br { bottom: 6px; right: 6px; border-bottom-width: 2px; border-right-width: 2px; }

.wf-edge {
  position: absolute;
  background: rgba(90, 150, 185, 0.12);
}

.wf-edge.top,
.wf-edge.bottom {
  left: 14%;
  right: 14%;
  height: 1px;
}

.wf-edge.top { top: 0; }
.wf-edge.bottom { bottom: 0; }

.wf-edge.left,
.wf-edge.right {
  top: 12%;
  bottom: 12%;
  width: 1px;
}

.wf-edge.left { left: 0; }
.wf-edge.right { right: 0; }

/* —— 顶栏 —— */
.site-header {
  padding: 1rem 0 0.35rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  color: var(--accent-deep);
}

.brand-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 2px 10px rgba(40, 80, 110, 0.08);
}

.brand-name {
  line-height: 1.2;
}

/* —— 首屏 —— */
.hero {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  padding: 1.35rem 0 1.85rem;
  text-align: left;
}

.hero-banner {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(160, 190, 210, 0.32);
  box-shadow: 0 8px 22px rgba(40, 90, 120, 0.08);
  background: #f4f8fb;
  /* 原图约 1024×285；限制高度，避免首屏被横幅压住 */
  max-height: 148px;
}

.hero-banner img {
  display: block;
  width: 100%;
  height: 148px;
  object-fit: cover;
  object-position: left center;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3.4vw, 2.05rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.3;
  margin-bottom: 0.65rem;
  color: var(--ink);
}

.hero-copy {
  position: relative;
  z-index: 1;
  /* 略提亮，避免背景节点点透到字缝里像行首黑点 */
  padding: 0.15rem 0.1rem;
  background: linear-gradient(90deg, rgba(245, 248, 251, 0.88), rgba(245, 248, 251, 0.55) 70%, transparent);
  border-radius: 6px;
}

.hero-lead {
  font-size: 1.05rem;
  color: var(--ink-soft);
  max-width: none;
  line-height: 1.85;
}

.hero-lead .nowrap {
  white-space: nowrap;
}

/* —— 模块 —— */
.section {
  /* 勿用 margin 简写，否则会冲掉 .wrap 的左右 auto 居中 */
  margin-top: 2rem;
  margin-bottom: 2.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(6px);
}

.section-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  min-height: 280px;
}

.section-grid.reverse {
  grid-template-columns: 0.9fr 1.1fr;
}

.section-grid.reverse .section-copy {
  order: 2;
}

.section-grid.reverse .section-visual {
  order: 1;
}

.section-copy {
  padding: 1.75rem 1.75rem 1.35rem;
}

.section-kicker {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  margin-bottom: 0.65rem;
}

.section-desc {
  color: var(--ink-soft);
  font-size: 0.98rem;
  margin-bottom: 1.15rem;
}

.entry-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.entry-list a {
  display: block;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f8fafc;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.entry-list a:hover {
  border-color: #8ec4d4;
  background: #f0f8fb;
  transform: translateY(-1px);
}

.entry-title {
  font-weight: 600;
  font-size: 0.98rem;
  margin-bottom: 0.15rem;
}

.entry-meta {
  font-size: 0.82rem;
  color: var(--muted);
}

.more-row {
  margin-top: 1rem;
}

.more-link {
  display: inline-flex;
  align-items: center;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--accent-deep);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
}

.more-link:hover {
  color: var(--accent);
  border-bottom-color: rgba(31, 122, 140, 0.35);
}

.section-visual {
  position: relative;
  min-height: 240px;
  border-left: 1px solid var(--line);
}

.section-grid.reverse .section-visual {
  border-left: none;
  border-right: 1px solid var(--line);
}

/* —— 代码瀑布 —— */
.visual-code {
  background: var(--code-bg);
  overflow: hidden;
}

.code-rain {
  position: absolute;
  inset: -8%;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.4rem;
  padding: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.45;
  color: rgba(92, 203, 255, 0.42);
  filter: blur(1.15px);
  opacity: 0.85;
  letter-spacing: 0.02em;
  user-select: none;
  pointer-events: none;
}

.code-col {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  animation: rain-fall 12s linear infinite;
}

.code-col span {
  text-shadow: 0 0 6px rgba(92, 203, 255, 0.22);
}

.code-col:nth-child(2) { animation-duration: 14s; animation-delay: -2s; opacity: 0.7; filter: blur(1.4px); }
.code-col:nth-child(3) { animation-duration: 10s; animation-delay: -5s; opacity: 0.8; }
.code-col:nth-child(4) { animation-duration: 16s; animation-delay: -1s; opacity: 0.55; filter: blur(1.6px); }
.code-col:nth-child(5) { animation-duration: 11s; animation-delay: -7s; }
.code-col:nth-child(6) { animation-duration: 13s; animation-delay: -3s; opacity: 0.72; filter: blur(1.3px); }

@keyframes rain-fall {
  from { transform: translateY(-35%); }
  to { transform: translateY(35%); }
}

.visual-label {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  z-index: 1;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(14, 22, 32, 0.72);
  color: var(--code-glow);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  filter: none;
}

/* —— 笔记本 —— */
.visual-notebook {
  --notebook-row: 28px;
  background:
    linear-gradient(90deg, #e8d7b8 0 14px, transparent 14px),
    repeating-linear-gradient(
      transparent 0,
      transparent calc(var(--notebook-row) - 1px),
      var(--notebook-line) calc(var(--notebook-row) - 1px),
      var(--notebook-line) var(--notebook-row)
    ),
    var(--notebook);
  /* 与文字区顶部对齐，避免字骑线 */
  background-position: 0 0, 0 var(--notebook-row), 0 0;
}

.notebook-scribble {
  position: absolute;
  inset: var(--notebook-row) 1.25rem 1.5rem 2.2rem;
  font-family: var(--font-display);
  color: #5a4a36;
  font-size: 0.92rem;
  line-height: var(--notebook-row);
  opacity: 0.78;
}

.notebook-scribble p {
  margin: 0;
  height: var(--notebook-row);
}

/* —— 键盘（机械卡通） —— */
.visual-keyboard {
  background:
    radial-gradient(circle at 30% 20%, #fff4d6 0%, transparent 42%),
    radial-gradient(circle at 80% 70%, #d4eef8 0%, transparent 40%),
    linear-gradient(165deg, #f0ebe3, #d9e2ec);
  display: grid;
  place-items: center;
  padding: 1.35rem;
}

.keyboard {
  width: min(100%, 300px);
  display: grid;
  gap: 10px;
  padding: 14px 12px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, #3a4554 0%, #2a3340 100%);
  box-shadow:
    0 10px 0 #1a2028,
    0 14px 22px rgba(28, 36, 48, 0.28);
  transform: rotate(-2.5deg);
}

.keyboard-row {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
}

.key {
  aspect-ratio: 1;
  border-radius: 10px;
  background: linear-gradient(180deg, #fffdf8 0%, #e8e0d4 100%);
  border: 2px solid #2a3340;
  box-shadow:
    inset 0 -3px 0 #c4b8a6,
    0 3px 0 #1a2028;
  display: grid;
  place-items: center;
  font-size: 0.68rem;
  font-weight: 800;
  color: #2f3a48;
  transform: rotate(var(--tilt, 0deg));
}

.key:nth-child(odd) { --tilt: -1.5deg; }
.key:nth-child(even) { --tilt: 1.2deg; }

.key.home {
  background: linear-gradient(180deg, #7ed8f0 0%, #3aa8c4 100%);
  color: #0b3d4a;
  box-shadow:
    inset 0 -3px 0 #1f7a90,
    0 3px 0 #1a2028;
}

.key.accent-warm {
  background: linear-gradient(180deg, #ffd89a 0%, #f0a85a 100%);
  color: #5a3208;
  box-shadow:
    inset 0 -3px 0 #c47a30,
    0 3px 0 #1a2028;
}

/* —— 归档列表页 —— */
.list-page {
  padding: 1.5rem 0 2.5rem;
}

.list-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.4rem, 3vw, 2.2rem);
  backdrop-filter: blur(6px);
}

.list-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  margin-bottom: 0.55rem;
}

.list-lead {
  color: var(--ink-soft);
  margin-bottom: 1.25rem;
  max-width: 40em;
}

.list-archive {
  max-width: 40em;
}

.list-footnote {
  margin-top: 1.25rem;
  font-size: 0.88rem;
  color: var(--muted);
}

/* —— 页脚 —— */
.site-footer {
  padding: 2rem 0 2.75rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer a {
  color: var(--muted);
}

.site-footer a:hover {
  color: var(--accent-deep);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  justify-content: center;
  margin-bottom: 0.5rem;
}

/* —— 短文页 —— */
.note-page {
  padding: 2rem 0 3rem;
}

.note-nav {
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.note-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.4rem, 3vw, 2.2rem);
}

.note-card h1 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  margin-bottom: 0.4rem;
}

.note-tag {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 0.06em;
  margin-bottom: 1rem;
}

.note-card p {
  color: var(--ink-soft);
  margin-bottom: 1rem;
}

.note-card h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 1.4rem 0 0.55rem;
  color: var(--ink);
}

.note-card pre,
.note-card code {
  font-family: var(--font-mono);
}

.note-card pre {
  background: var(--code-bg);
  color: #d7e7df;
  padding: 0.9rem 1rem;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 0.85rem;
  margin: 0.75rem 0 1.1rem;
}

.note-card ul {
  margin: 0 0 1rem 1.2rem;
  color: var(--ink-soft);
}

.note-card li + li {
  margin-top: 0.35rem;
}

@media (max-width: 760px) {
  .window-frame {
    inset: 8px;
  }

  .hero {
    gap: 0.95rem;
    padding-top: 1rem;
  }

  .hero-banner,
  .hero-banner img {
    max-height: 112px;
    height: 112px;
  }

  .section-grid,
  .section-grid.reverse {
    grid-template-columns: 1fr;
  }

  .section-grid.reverse .section-copy,
  .section-grid.reverse .section-visual {
    order: initial;
  }

  .section-visual {
    border-left: none;
    border-top: 1px solid var(--line);
    min-height: 200px;
  }

  .section-grid.reverse .section-visual {
    border-right: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .code-col {
    animation: none;
  }
}
