/* ==========================================================================
   林阿腾的日常小屋 — 全站样式
   纯手写 CSS，无外部依赖
   ========================================================================== */

:root {
  --bg: #fbfaf7;
  --bg-soft: #f3f0ea;
  --card: #ffffff;
  --ink: #17150f;
  --ink-soft: #5a554c;
  --ink-faint: #98918a;
  --line: #e6e1d8;
  --line-soft: #f0ece5;
  --accent: #b0392a;
  --accent-soft: #f8ece9;
  --green: #2f6a5e;
  --max: 1080px;
  --serif: "Songti SC", "STSong", "SimSun", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", Consolas, "Cascadia Mono", Menlo, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

img, svg { display: block; max-width: 100%; }

::selection { background: #f4d9d3; color: var(--ink); }

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 32px;
}

/* ---------- 页头 ---------- */

.site-head {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 250, 247, 0.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.head-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.brand-mark {
  width: 26px;
  height: 26px;
  flex: none;
  color: var(--accent);
}

.nav {
  display: flex;
  gap: 4px;
  align-items: center;
}

.nav a {
  padding: 7px 13px;
  font-size: 14.5px;
  color: var(--ink-soft);
  border-radius: 6px;
  transition: color 0.18s ease, background 0.18s ease;
}

.nav a:hover { color: var(--ink); background: var(--bg-soft); }

.nav a.active { color: var(--ink); font-weight: 600; }

.nav a.active::after {
  content: "";
  display: block;
  height: 2px;
  margin-top: 3px;
  background: var(--accent);
  border-radius: 1px;
}

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.nav-toggle span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--ink);
  position: relative;
}

.nav-toggle span::before,
.nav-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
  width: 16px;
  height: 1.5px;
  background: var(--ink);
}

.nav-toggle span::before { top: -5px; }
.nav-toggle span::after { top: 5px; }

/* ---------- 首屏 ---------- */

.hero {
  padding: 92px 0 72px;
  border-bottom: 1px solid var(--line-soft);
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 26px;
  font-weight: 600;
}

.hero-tag::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--accent);
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(38px, 6vw, 62px);
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 26px;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
  position: relative;
  /* 避免「日常小屋」这类词组被拆到两行 */
  white-space: nowrap;
}

.hero-lede {
  font-size: 17px;
  color: var(--ink-soft);
  max-width: 620px;
  line-height: 1.9;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin-top: 34px;
  font-size: 13.5px;
  color: var(--ink-faint);
}

.hero-meta b {
  color: var(--ink);
  font-weight: 600;
}

/* ---------- 通用区块 ---------- */

.section { padding: 76px 0; }
.section + .section { border-top: 1px solid var(--line-soft); }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 40px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.section-head h2 {
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.section-head .sub {
  font-size: 13.5px;
  color: var(--ink-faint);
  margin-top: 6px;
}

.more-link {
  font-size: 13.5px;
  color: var(--ink-soft);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.18s ease;
}

.more-link:hover { color: var(--accent); }
.more-link::after { content: "→"; transition: transform 0.18s ease; }
.more-link:hover::after { transform: translateX(3px); }

/* ---------- 三大板块入口 ---------- */

.portals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.portal {
  display: flex;
  flex-direction: column;
  padding: 30px 28px 26px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.portal:hover {
  transform: translateY(-3px);
  border-color: #d5cec2;
  box-shadow: 0 12px 30px -18px rgba(23, 21, 15, 0.3);
}

.portal .idx {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
  margin-bottom: 18px;
}

.portal h3 {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 700;
  margin-bottom: 10px;
}

.portal p {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.8;
  flex: 1;
}

.portal .go {
  margin-top: 22px;
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.02em;
}

/* ---------- 作品卡片 ---------- */

.work-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.work-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.work-card:hover {
  transform: translateY(-3px);
  border-color: #d5cec2;
  box-shadow: 0 14px 34px -20px rgba(23, 21, 15, 0.32);
}

.work-thumb {
  height: 168px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--line-soft);
}

.work-thumb .glyph {
  font-family: var(--serif);
  font-size: 44px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
  letter-spacing: 0.06em;
  z-index: 2;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.12);
}

/* 一组明度、饱和度接近的传统色，避免并排时过于跳 */
.work-thumb.c1 { background: linear-gradient(145deg, #8f3325, #b3543c); }
.work-thumb.c2 { background: linear-gradient(145deg, #2a5b51, #41796d); }
.work-thumb.c3 { background: linear-gradient(145deg, #3a3762, #57538c); }
.work-thumb.c4 { background: linear-gradient(145deg, #6d4e1e, #97722f); }
.work-thumb.c5 { background: linear-gradient(145deg, #24241f, #46463f); }
.work-thumb.c6 { background: linear-gradient(145deg, #6b2f47, #8f4a64); }

/* 网点纹理 */
.work-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background-image: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.14) 1px, transparent 0);
  background-size: 13px 13px;
}

/* 上亮下暗，给纯色块一点体积感 */
.work-thumb::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 42%, rgba(0, 0, 0, 0.16));
}

.work-body { padding: 24px 26px 22px; display: flex; flex-direction: column; flex: 1; }

.work-kicker {
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 8px;
  font-weight: 600;
}

.work-body h3 {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.45;
}

.work-body p {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.8;
  flex: 1;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 18px;
}

.tag {
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 4px;
  background: var(--bg-soft);
  color: var(--ink-soft);
  border: 1px solid var(--line-soft);
  font-family: var(--mono);
  letter-spacing: 0.02em;
}

/* ---------- 时间线（学习记录） ---------- */

.timeline { position: relative; }

.tl-item {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 32px;
  padding: 30px 0;
  border-bottom: 1px solid var(--line-soft);
}

.tl-item:first-child { padding-top: 0; }

.tl-date {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-faint);
  letter-spacing: 0.03em;
  padding-top: 4px;
}

.tl-date b {
  display: block;
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink);
  letter-spacing: 0;
  font-weight: 700;
  margin-bottom: 2px;
}

.tl-body h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.5;
}

.tl-body p {
  font-size: 14.5px;
  color: var(--ink-soft);
  line-height: 1.85;
}

.tl-body ul {
  margin: 12px 0 0 0;
  list-style: none;
}

.tl-body li {
  position: relative;
  padding-left: 16px;
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.9;
}

.tl-body li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 11px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.5;
}

/* ---------- 笔记列表 ---------- */

.note-list { display: flex; flex-direction: column; }

.note-item {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: 24px;
  align-items: baseline;
  padding: 22px 0;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.18s ease;
}

.note-item:first-child { border-top: 1px solid var(--line-soft); }

.note-item:hover { background: rgba(243, 240, 234, 0.6); }

.note-date {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-faint);
}

.note-title {
  display: block;
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.55;
}

.note-desc {
  display: block;
  font-size: 13.5px;
  color: var(--ink-soft);
  margin-top: 5px;
  line-height: 1.7;
}

.note-cat {
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 4px;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  white-space: nowrap;
  background: var(--card);
}

/* ---------- 关于页 ---------- */

.about-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 56px;
  align-items: start;
}

.prose p {
  font-size: 15.5px;
  line-height: 1.95;
  color: var(--ink-soft);
  margin-bottom: 18px;
}

.prose p strong { color: var(--ink); font-weight: 600; }

.prose h3 {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin: 40px 0 16px;
}

.prose h3:first-child { margin-top: 0; }

.info-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 28px;
}

.info-card h4 {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.info-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  font-size: 14px;
  border-bottom: 1px dashed var(--line-soft);
}

.info-row:last-child { border-bottom: none; }

.info-row span:first-child { color: var(--ink-faint); flex: none; }

.info-row span:last-child { color: var(--ink); text-align: right; word-break: break-all; }

.skill-group { margin-bottom: 22px; }

.skill-group:last-child { margin-bottom: 0; }

.skill-group .label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 9px;
  font-weight: 600;
}

/* ---------- 声明块 ---------- */

.declare {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 24px 28px;
  margin-top: 32px;
}

.declare h4 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--ink);
}

.declare ol {
  margin-left: 18px;
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.95;
}

.declare li { margin-bottom: 6px; }

.declare li:last-child { margin-bottom: 0; }

/* ---------- 页脚 ---------- */

.site-foot {
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 56px 0 34px;
  margin-top: 0;
}

.foot-top {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 36px;
  border-bottom: 1px solid var(--line);
}

.foot-brand {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
}

.foot-desc {
  font-size: 13px;
  color: var(--ink-faint);
  line-height: 1.85;
  max-width: 320px;
}

.foot-col h5 {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 14px;
  font-weight: 600;
}

.foot-col a,
.foot-col span {
  display: block;
  font-size: 13.5px;
  color: var(--ink-soft);
  padding: 5px 0;
  transition: color 0.18s ease;
}

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

.foot-bottom {
  padding-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--ink-faint);
}

.foot-license {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  align-items: center;
  font-size: 13px;
}

.foot-license a {
  color: var(--ink-soft);
  transition: color 0.18s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

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

.foot-license .sep { color: var(--line); }

/* ---------- 页内标题区 ---------- */

.page-head {
  padding: 72px 0 44px;
  border-bottom: 1px solid var(--line);
}

.page-head .crumb {
  font-size: 12.5px;
  color: var(--ink-faint);
  margin-bottom: 18px;
  font-family: var(--mono);
  letter-spacing: 0.04em;
}

.page-head .crumb a { transition: color 0.18s ease; }
.page-head .crumb a:hover { color: var(--accent); }
.page-head .crumb .slash { margin: 0 8px; opacity: 0.5; }

.page-head h1 {
  font-family: var(--serif);
  font-size: clamp(32px, 5vw, 46px);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

.page-head p {
  font-size: 15.5px;
  color: var(--ink-soft);
  max-width: 640px;
  line-height: 1.9;
}

/* ---------- 文章正文 ---------- */

.article {
  padding: 56px 0 80px;
}

.article-inner {
  max-width: 720px;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 13px;
  color: var(--ink-faint);
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 36px;
  font-family: var(--mono);
}

.article-body h2 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  margin: 44px 0 16px;
  padding-left: 14px;
  border-left: 3px solid var(--accent);
  line-height: 1.4;
}

.article-body h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 32px 0 12px;
}

.article-body p {
  font-size: 16px;
  line-height: 2;
  color: var(--ink-soft);
  margin-bottom: 18px;
}

.article-body strong { color: var(--ink); font-weight: 600; }

.article-body ul,
.article-body ol {
  margin: 0 0 20px 22px;
  font-size: 15.5px;
  line-height: 2;
  color: var(--ink-soft);
}

.article-body li { margin-bottom: 6px; }

.article-body code {
  font-family: var(--mono);
  font-size: 13.5px;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--accent);
}

.article-body pre {
  background: #1e1c17;
  color: #e8e3d8;
  border-radius: 8px;
  padding: 20px 22px;
  overflow-x: auto;
  margin: 20px 0 24px;
  font-size: 13.5px;
  line-height: 1.75;
}

.article-body pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.article-body blockquote {
  border-left: 3px solid var(--line);
  padding-left: 20px;
  margin: 24px 0;
  color: var(--ink-faint);
  font-size: 15px;
}

.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.article-nav a { color: var(--ink-soft); transition: color 0.18s ease; max-width: 45%; }
.article-nav a:hover { color: var(--accent); }

/* ---------- 联系方式防采集 ---------- */
/* 源码里邮箱被插入不可见字符，页面渲染出来仍是完整地址；
   纯文本爬虫按正则匹配不到，人工复制粘贴不受影响 */
.mail-ob {
  font-family: var(--mono);
  color: var(--accent);
}
.mail-ob em,
.mail-ob .at em {
  display: none;
}

/* ---------- 入场动画（纯 CSS，不依赖 JS，JS 失效也不会白屏） ---------- */

/* 默认就是可见的；只有支持动画且用户未要求减少动效时，才播放入场 */
.reveal { opacity: 1; }

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    /* backwards：延迟期间保持首帧，播放结束后不再覆盖 hover 的 transform */
    animation: rise 0.65s cubic-bezier(0.22, 0.61, 0.36, 1) 0.05s backwards;
  }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 逐级延迟 */
[data-delay="50"]  { animation-delay: 0.05s; }
[data-delay="60"]  { animation-delay: 0.06s; }
[data-delay="80"]  { animation-delay: 0.08s; }
[data-delay="100"] { animation-delay: 0.10s; }
[data-delay="120"] { animation-delay: 0.12s; }
[data-delay="140"] { animation-delay: 0.14s; }
[data-delay="150"] { animation-delay: 0.15s; }
[data-delay="160"] { animation-delay: 0.16s; }
[data-delay="180"] { animation-delay: 0.18s; }
[data-delay="240"] { animation-delay: 0.24s; }

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

/* ---------- 响应式 ---------- */

@media (max-width: 900px) {
  .portals { grid-template-columns: 1fr; }
  .work-grid { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; gap: 36px; }
  .foot-top { grid-template-columns: 1fr 1fr; gap: 32px; }
  .foot-top > div:first-child { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .wrap { padding: 0 20px; }

  .head-inner { height: 60px; }

  .nav-toggle { display: flex; }

  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    align-items: stretch;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 8px 20px 16px;
    display: none;
  }

  .nav.open { display: flex; }

  .nav a { padding: 12px 4px; border-radius: 0; }
  .nav a.active::after { display: none; }

  .hero { padding: 56px 0 48px; }
  .hero-meta { gap: 8px 20px; font-size: 12.5px; }

  .section { padding: 52px 0; }

  .section-head { flex-direction: column; align-items: flex-start; gap: 10px; }

  .tl-item { grid-template-columns: 1fr; gap: 10px; }
  .tl-date b { display: inline; margin-right: 8px; }

  .note-item { grid-template-columns: 1fr; gap: 6px; }
  .note-date { order: -1; }
  .note-cat { justify-self: start; margin-top: 4px; }

  .foot-top { grid-template-columns: 1fr; }
  .foot-bottom { flex-direction: column; align-items: flex-start; }

  .page-head { padding: 48px 0 32px; }

  .work-thumb { height: 140px; }

  .article-nav { flex-direction: column; gap: 14px; }
  .article-nav a { max-width: 100%; }
}
