@import url('https://fonts.googleapis.com/css2?family=Abril+Fatface&family=Merriweather:wght@300;400;700&display=swap');

:root {
  --paper: #f5e6c8;
  --paper-2: #efdcc0;
  --paper-3: #fffaee;
  --caramel: #d4a574;
  --ink: #262117;
  --ink-soft: #57493a;
  --rail: 268px;
  --rail-h: 0px;
  --serif: "Merriweather", Georgia, "Songti SC", "SimSun", "Noto Serif CJK SC", serif;
  --drama: "Abril Fatface", Georgia, "Songti SC", "SimSun", serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.85;
  overflow-x: hidden;
}

img { max-width: 100%; }

/* 胶片颗粒 */
.grain {
  position: fixed;
  inset: -20%;
  z-index: 30;
  pointer-events: none;
  opacity: 0.2;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

/* 漏光 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0.45;
  mix-blend-mode: screen;
  background:
    radial-gradient(46% 38% at 92% 4%, rgba(212, 165, 116, 0.55), transparent 72%),
    radial-gradient(36% 30% at 2% 94%, rgba(190, 112, 66, 0.34), transparent 74%),
    radial-gradient(28% 24% at 62% 52%, rgba(255, 243, 214, 0.42), transparent 72%);
}

/* 侧栏 */
.rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--rail);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px 18px 22px;
  overflow-y: auto;
  background: linear-gradient(180deg, #f0e1c1 0%, #e7d3ad 62%, #ddc69c 100%);
  border-right: 1px solid rgba(38, 33, 23, 0.3);
  box-shadow: 6px 0 22px rgba(38, 33, 23, 0.1);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 2px 12px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 2px solid var(--ink);
  line-height: 1.15;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 3px;
  object-fit: cover;
  filter: sepia(0.35) contrast(1.05);
  flex: 0 0 auto;
}

.brand-name {
  font-family: var(--drama);
  font-size: 1.32rem;
  letter-spacing: 0.03em;
}

/* 胶囊导航 */
.rail-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  counter-reset: railnav;
}

.rail-nav li {
  position: relative;
  counter-increment: railnav;
}

.rail-nav li::before {
  content: counter(railnav, decimal-leading-zero);
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--caramel);
  pointer-events: none;
  transition: color 0.2s ease;
}

.rail-nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 16px 10px 46px;
  border: 1px solid rgba(38, 33, 23, 0.34);
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  background: rgba(255, 250, 238, 0.32);
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.rail-nav a:hover,
.rail-nav a:focus-visible {
  background: var(--ink);
  color: var(--paper-2);
  border-color: var(--ink);
  transform: translateX(2px);
}

.rail-nav li:hover::before,
.rail-nav a:focus-visible::before {
  color: var(--paper-2);
}

.rail-nav a.is-on {
  background: var(--caramel);
  border-color: var(--ink);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--paper-3);
}

/* 搜索 */
.rail-search {
  margin-top: auto;
  display: flex;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px dashed rgba(38, 33, 23, 0.28);
}

.rail-search input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  padding: 8px 14px;
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(38, 33, 23, 0.4);
  border-radius: 999px;
  outline-offset: 2px;
}

.rail-search button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 8px 16px;
  font-family: var(--serif);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--caramel);
  border: 1px solid var(--ink);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.rail-search button:hover { background: var(--paper-3); }

/* 主体 */
main {
  margin-left: var(--rail);
  padding-top: var(--rail-h);
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 28px 64px;
}

/* 首屏 */
.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  min-height: 100vh;
  min-height: 100svh;
  padding: 90px 0 76px;
  overflow: hidden;
  background: #241f16;
  border-bottom: 3px solid var(--caramel);
}

.hero-photo {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  will-change: transform;
}

.hero-photo img {
  width: 100%;
  height: 118%;
  margin-top: -9%;
  object-fit: cover;
  filter: sepia(0.4) contrast(1.08) saturate(0.78);
  animation: vhs 7s ease-in-out infinite;
}

.hero-veil {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(103deg, rgba(36, 31, 22, 0.35) 0%, rgba(36, 31, 22, 0.5) 44%, rgba(20, 17, 11, 0.9) 100%),
    repeating-linear-gradient(180deg, rgba(245, 230, 200, 0.05) 0 2px, transparent 2px 5px);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.42;
  background-image: radial-gradient(rgba(245, 230, 200, 0.5) 1px, transparent 1px);
  background-size: 17px 17px;
}

.hero-copy {
  position: relative;
  z-index: 3;
  text-align: right;
  max-width: 780px;
  animation: fadeup 0.9s ease both;
}

.hero-copy h1 {
  margin: 0;
  font-family: var(--drama);
  font-weight: 400;
  font-size: clamp(2.5rem, 6.2vw, 4.9rem);
  line-height: 1.05;
  letter-spacing: 0.01em;
  color: #f8eed9;
  text-shadow: 0 2px 0 rgba(20, 17, 11, 0.6), 0 0 26px rgba(20, 17, 11, 0.5);
}

/* 左右分栏 */
.grid {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 44px;
  align-items: start;
  padding-top: 52px;
}

.side {
  position: sticky;
  top: 30px;
  padding: 2px 0 6px 16px;
  border-left: 3px solid var(--caramel);
}

.side h2 {
  margin: 0 0 10px;
  font-family: var(--drama);
  font-weight: 400;
  font-size: 1.45rem;
  line-height: 1.25;
  color: var(--ink);
}

.subtitle {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--ink-soft);
}

/* 正文 */
.prose {
  min-width: 0;
  font-size: 1.03rem;
}

.prose > section {
  position: relative;
  margin: 0 0 34px;
  padding: 30px 28px 34px;
  background: rgba(255, 248, 232, 0.66);
  border-radius: 4px;
  border-bottom: 3px solid var(--caramel);
  box-shadow: 0 1px 0 rgba(38, 33, 23, 0.14), 0 14px 30px -22px rgba(38, 33, 23, 0.6);
  scroll-margin-top: 26px;
}

.prose > section::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(38, 33, 23, 0.13);
  border-radius: 3px;
  pointer-events: none;
}

.prose > div:nth-of-type(even) { transform: rotate(-0.18deg); }
.prose > div:nth-of-type(odd) { transform: rotate(0.12deg); }

.prose h2 {
  margin: 0.1em 0 0.55em;
  font-family: var(--drama);
  font-weight: 400;
  font-size: clamp(1.5rem, 2.7vw, 2.1rem);
  line-height: 1.22;
  color: var(--ink);
}

.prose h3 {
  margin: 1.5em 0 0.5em;
  font-size: 1.14rem;
  line-height: 1.5;
  color: var(--ink);
  border-left: 4px solid var(--caramel);
  padding-left: 10px;
}

.prose p { margin: 0 0 1em; }

.prose ul,
.prose ol { margin: 0 0 1em; padding-left: 1.35em; }

.prose li { margin: 0.3em 0; }

.prose a {
  color: #8b5624;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.prose a:hover { color: var(--ink); }

.prose blockquote {
  margin: 1.2em 0;
  padding: 12px 18px;
  border-left: 4px solid var(--caramel);
  background: rgba(212, 165, 116, 0.2);
  font-style: italic;
  color: var(--ink-soft);
}

.prose strong { color: #6d3f16; }

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.4em 0;
  border: 9px solid var(--paper-3);
  border-bottom-width: 26px;
  border-radius: 2px;
  box-shadow: 0 10px 24px -12px rgba(38, 33, 23, 0.7);
  filter: sepia(0.3) saturate(0.85);
  transform: rotate(-0.8deg);
}

.prose time {
  font-size: 0.95rem;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.98rem;
}

.prose th,
.prose td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(38, 33, 23, 0.2);
  text-align: left;
}

/* 页脚 */
.foot {
  margin-left: var(--rail);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  padding: 18px 30px;
  background: var(--ink);
  color: #d9c9a9;
  border-top: 3px solid var(--caramel);
}

.foot address {
  font-style: normal;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}

.foot ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.foot a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 12px;
  color: var(--caramel);
  font-size: 0.95rem;
  text-decoration: none;
  transition: color 0.2s ease;
}

.foot a:hover { color: var(--paper-3); }

/* 动效 */
@keyframes fadeup {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes vhs {
  0%, 100% { transform: translate3d(0, 0, 0) skewX(0deg); }
  47% { transform: translate3d(0, 0, 0) skewX(0.14deg); }
  53% { transform: translate3d(0, -2px, 0) skewX(-0.14deg); }
}

/* 平板 */
@media (max-width: 1040px) {
  .grid { grid-template-columns: 200px minmax(0, 1fr); gap: 30px; }
}

/* 移动端 */
@media (max-width: 900px) {
  :root { --rail-h: 70px; }

  .rail {
    inset: 0 0 auto 0;
    width: auto;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    height: var(--rail-h);
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid rgba(38, 33, 23, 0.32);
    box-shadow: 0 4px 16px rgba(38, 33, 23, 0.14);
  }

  .brand {
    flex: 0 0 auto;
    padding: 0 8px 0 0;
    border-bottom: 0;
    border-right: 2px solid rgba(38, 33, 23, 0.35);
    height: 44px;
  }

  .brand-name { font-size: 1.1rem; white-space: nowrap; }
  .brand-mark { width: 28px; height: 28px; }

  .rail-nav {
    flex-direction: row;
    gap: 6px;
    flex: 0 0 auto;
    counter-reset: railnav;
  }

  .rail-nav li::before { display: none; }

  .rail-nav a {
    padding: 10px 14px;
    min-height: 44px;
    font-size: 0.95rem;
    white-space: nowrap;
  }

  .rail-search {
    margin-top: 0;
    flex: 0 0 auto;
    padding-top: 0;
    border-top: 0;
  }

  .rail-search input { width: 108px; flex: 0 0 auto; }
  .rail-search button { padding: 8px 12px; }

  main { margin-left: 0; }
  .wrap { padding: 0 16px 48px; }

  .hero {
    min-height: calc(100vh - var(--rail-h));
    min-height: calc(100svh - var(--rail-h));
    padding: 64px 0 52px;
  }

  .hero-copy h1 { font-size: clamp(2.1rem, 9vw, 3.2rem); }

  .grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
    padding-top: 34px;
  }

  .side { position: static; }

  .prose > div {
    padding: 24px 18px 26px;
    margin-bottom: 26px;
    scroll-margin-top: calc(var(--rail-h) + 18px);
  }

  .prose > div:nth-of-type(even),
  .prose > div:nth-of-type(odd) { transform: none; }

  .prose img { border-width: 7px; border-bottom-width: 20px; transform: none; }

  .foot {
    margin-left: 0;
    padding: 16px 16px 20px;
    flex-direction: column;
    align-items: flex-start;
  }

  .grain { opacity: 0.14; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

button[aria-expanded]{min-width:44px;min-height:44px}
