@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&family=Playfair+Display:ital,wght@0,400;0,700;0,900;1,400&family=Source+Serif+4:ital,wght@0,300;0,400;0,600;1,300&display=swap');

/* ===== 根变量 ===== */
:root {
  --cream: #f5e6c8;
  --amber: #d4a574;
  --ink: #262117;
  --ink-light: #4a3f2f;
  --ink-muted: #7a6a52;
  --amber-dark: #b8865a;
  --amber-light: #e8c89a;
  --cream-dark: #e8d0a0;
  --radius-pill: 999px;
  --radius-card: 0px;
  --shadow-card: 4px 6px 24px rgba(38,33,23,0.18);
  --shadow-lift: 2px 4px 16px rgba(38,33,23,0.22);
  --nav-h: 64px;
  --font-serif: 'Playfair Display', 'Source Serif 4', Georgia, serif;
  --font-body: 'Source Serif 4', Georgia, serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* ===== 重置 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 17px; }
body { background: var(--cream); color: var(--ink); font-family: var(--font-body); line-height: 1.7; overflow-x: hidden; }

img { max-width: 100%; height: auto; display: block; }
a { color: var(--amber-dark); text-decoration: none; }
a:hover { color: var(--ink); }
h1,h2,h3,h4 { font-family: var(--font-serif); line-height: 1.25; }

/* ===== Film grain overlay ===== */
.grain-overlay {
  position: fixed; inset: 0; pointer-events: none; z-index: 9999;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23g)' opacity='0.08'/%3E%3C/svg%3E");
  opacity: 0.55;
  mix-blend-mode: multiply;
  animation: grain-shift 0.12s steps(1) infinite;
}
@keyframes grain-shift {
  0%   { transform: translate(0,0); }
  20%  { transform: translate(-2px, 2px); }
  40%  { transform: translate(2px,-1px); }
  60%  { transform: translate(-1px,3px); }
  80%  { transform: translate(3px,-2px); }
  100% { transform: translate(0,0); }
}

/* ===== Light leak ===== */
.light-leak {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 9998;
  background: radial-gradient(ellipse at 10% 10%, rgba(212,165,116,0.18) 0%, transparent 60%),
              radial-gradient(ellipse at 90% 80%, rgba(245,230,200,0.12) 0%, transparent 50%);
  animation: leak-pulse 8s ease-in-out infinite alternate;
}
@keyframes leak-pulse {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}

/* ===== HEADER ===== */
.site-header {
  position: sticky; top: 0; z-index: 500;
  background: rgba(245,230,200,0.94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--amber);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1.25rem;
  height: var(--nav-h);
  filter: sepia(0.15);
}
.header-brand { flex-shrink: 0; }
.brand-link { display: flex; align-items: center; }
.brand-icon { width: 44px; height: 44px; object-fit: contain; border-radius: 50%; }
.brand-text-icon {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--ink); color: var(--cream);
  font-family: var(--font-serif); font-size: 1.1rem; font-weight: 700;
}
.site-nav { flex: 1; overflow-x: auto; scrollbar-width: none; }
.site-nav::-webkit-scrollbar { display: none; }
.nav-links {
  display: flex; flex-wrap: nowrap; gap: 0.4rem;
  white-space: nowrap; padding: 0.25rem 0;
}
.nav-links a {
  display: inline-flex; align-items: center;
  padding: 0 0.85rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--amber);
  background: transparent;
  color: var(--ink); font-size: 0.82rem;
  font-family: var(--font-serif);
  transition: background 0.2s, color 0.2s;
  min-height: 40px;
  white-space: nowrap;
}
.nav-links a:hover, .nav-links a:focus {
  background: var(--amber); color: var(--ink);
}

/* ===== MAIN ===== */
.site-main { min-height: 80vh; padding-bottom: calc(var(--nav-h) + 1.5rem); }
.page-article {}

/* ===== HERO ===== */
.hero-section {
  position: relative; min-height: 70vh;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  background: var(--cream);
  filter: sepia(0.1) contrast(1.02);
}
.hero-grid-bg {
  position: absolute; inset: 0; z-index: 0;
  background-image:
    linear-gradient(rgba(38,33,23,0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(38,33,23,0.07) 1px, transparent 1px);
  background-size: 36px 36px;
  opacity: 0.7;
}
.hero-inner {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 1.5rem;
  padding: 3rem 1.5rem;
  max-width: 700px; margin: 0 auto;
}
.hero-illustration { margin-bottom: 0.5rem; }
.hero-illustration img {
  max-width: 120px; border: 8px solid var(--cream);
  box-shadow: var(--shadow-card);
  filter: sepia(0.3) contrast(1.05);
  animation: polaroid-shake 6s ease-in-out infinite;
}
.hero-icon-placeholder {
  display: flex; align-items: center; justify-content: center;
  width: 90px; height: 90px;
  border: 6px solid var(--amber);
  background: var(--cream-dark);
  box-shadow: var(--shadow-card);
  animation: polaroid-shake 6s ease-in-out infinite;
}
.film-reel { font-size: 2.8rem; color: var(--amber-dark); font-family: var(--font-mono); }
@keyframes polaroid-shake {
  0%,100% { transform: rotate(-1.5deg); }
  50%      { transform: rotate(1.5deg); }
}
.hero-h1 {
  font-size: clamp(1.9rem, 6vw, 3.4rem);
  font-weight: 900; color: var(--ink);
  letter-spacing: 0.01em;
  text-shadow: 1px 1px 0 var(--amber-light);
}
.hero-sub {
  font-size: 1.05rem; color: var(--ink-light);
  max-width: 480px; margin: 0 auto;
}
.btn-capsule {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 2.2rem;
  border-radius: var(--radius-pill);
  background: var(--amber);
  color: var(--ink);
  font-family: var(--font-serif); font-size: 1rem; font-weight: 700;
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform 0.15s, box-shadow 0.15s;
  min-height: 44px;
}
.btn-capsule:hover {
  transform: translate(-2px,-2px);
  box-shadow: 5px 5px 0 var(--ink);
  color: var(--ink);
}
.vhs-scanline {
  position: absolute; bottom: 0; left: 0; right: 0; height: 3px; z-index: 3;
  background: linear-gradient(90deg, transparent, var(--amber) 30%, var(--amber-light) 50%, var(--amber) 70%, transparent);
  animation: vhs-track 3s linear infinite;
  opacity: 0.6;
}
@keyframes vhs-track {
  0%   { transform: scaleX(0.6) skewX(-3deg); opacity: 0.3; }
  50%  { transform: scaleX(1) skewX(0deg); opacity: 0.7; }
  100% { transform: scaleX(0.6) skewX(3deg); opacity: 0.3; }
}

/* ===== CONTENT SECTION WITH ASIDE ===== */
.content-section {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2.5rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}
.content-aside {
  position: sticky; top: calc(var(--nav-h) + 1rem);
  align-self: start;
  background: var(--cream-dark);
  border: 1px solid var(--amber);
  padding: 1.25rem 1rem;
  box-shadow: var(--shadow-card);
  filter: sepia(0.08);
}
.aside-title {
  font-size: 0.88rem; font-weight: 700;
  letter-spacing: 0.08em; color: var(--ink-muted);
  margin-bottom: 0.85rem;
  font-family: var(--font-mono);
  border-bottom: 1px solid var(--amber);
  padding-bottom: 0.5rem;
}
.aside-title span { display: inline; }
.aside-link {
  display: block;
  padding: 0.42rem 0.5rem;
  font-size: 0.87rem; color: var(--ink-light);
  border-left: 2px solid transparent;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  font-family: var(--font-serif);
  min-height: 40px; line-height: 1.8;
}
.aside-link:hover {
  border-left-color: var(--amber);
  background: rgba(212,165,116,0.12);
  color: var(--ink);
}

/* ===== 正文 page.content 区域 ===== */
.content-body {
  min-width: 0;
}
.content-body article {
  margin-bottom: 3.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--amber-light);
  scroll-margin-top: calc(var(--nav-h) + 16px);
  animation: fade-up 0.5s ease both;
}
.content-body article:last-child { border-bottom: none; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.content-body h2 {
  font-size: clamp(1.3rem, 3vw, 1.9rem);
  color: var(--ink);
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--amber);
  display: flex; align-items: baseline; gap: 0.5rem;
}
.content-body h2 span { display: inline; }
.content-body h3 {
  font-size: 1.15rem; color: var(--ink-light);
  margin: 1.5rem 0 0.6rem;
}
.content-body h3 span { display: inline; }
.content-body p { margin-bottom: 1rem; color: var(--ink-light); }
.content-body ul, .content-body ol {
  margin: 0.8rem 0 1rem 1.4rem;
  color: var(--ink-light);
}
.content-body li { margin-bottom: 0.4rem; }
.content-body strong { color: var(--ink); font-weight: 700; }
.content-body a {
  color: var(--amber-dark);
  border-bottom: 1px solid var(--amber-light);
  transition: border-color 0.2s;
}
.content-body a:hover { border-color: var(--amber-dark); }
.content-body blockquote {
  border-left: 3px solid var(--amber);
  margin: 1.2rem 0; padding: 0.6rem 1.2rem;
  background: rgba(212,165,116,0.08);
  font-style: italic; color: var(--ink-light);
}
.content-body table {
  width: 100%; border-collapse: collapse; margin: 1rem 0;
  font-size: 0.93rem;
}
.content-body th {
  background: var(--ink); color: var(--cream);
  padding: 0.5rem 0.8rem; text-align: left;
  font-family: var(--font-serif);
}
.content-body td {
  padding: 0.45rem 0.8rem;
  border-bottom: 1px solid var(--amber-light);
  color: var(--ink-light);
}
.content-body tr:nth-child(even) td { background: rgba(212,165,116,0.06); }

/* ===== FOOTER ===== */
.site-footer {
  background: var(--ink);
  color: var(--cream);
  text-align: center;
  padding: 2.5rem 1.5rem 1.5rem;
  filter: sepia(0.1);
}
.footer-brand {
  font-family: var(--font-serif); font-size: 1.05rem;
  color: var(--amber); margin-bottom: 0.75rem;
}
.footer-copy {
  display: block; font-size: 0.78rem;
  color: rgba(245,230,200,0.55);
  line-height: 1.6;
}

/* ===== 底部固定导航条 ===== */
.bottom-nav-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 600;
  background: rgba(38,33,23,0.97);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--amber);
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  min-height: var(--nav-h);
}
.bottom-brand-btn {
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--amber);
  border: 2px solid var(--cream);
}
.bottom-brand-btn .brand-icon { width: 28px; height: 28px; }
.bottom-brand-btn .brand-text-icon { width: 28px; height: 28px; font-size: 0.9rem; background: var(--ink); color: var(--cream); }
.bottom-capsule-group {
  display: flex; flex-wrap: nowrap; gap: 0.35rem;
  overflow-x: auto; scrollbar-width: none; flex: 1;
}
.bottom-capsule-group::-webkit-scrollbar { display: none; }
.bottom-pill {
  display: inline-flex; align-items: center;
  padding: 0 0.9rem;
  border-radius: var(--radius-pill);
  background: transparent;
  border: 1px solid var(--amber);
  color: var(--amber-light);
  font-size: 0.78rem;
  font-family: var(--font-serif);
  white-space: nowrap;
  min-height: 44px;
  transition: background 0.18s, color 0.18s;
}
.bottom-pill:hover {
  background: var(--amber); color: var(--ink);
}

/* ===== scroll-margin for sections ===== */
article[id] { scroll-margin-top: calc(var(--nav-h) + 12px); }

/* ===== Scroll Reveal ===== */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.55s ease, transform 0.55s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  html { font-size: 16px; }
  .content-section {
    grid-template-columns: 1fr;
    padding: 1.75rem 1rem;
    gap: 1.5rem;
  }
  .content-aside {
    position: static;
    display: flex; flex-wrap: wrap; gap: 0.4rem;
    padding: 0.85rem;
  }
  .aside-title { width: 100%; }
  .aside-link {
    display: inline-flex; align-items: center;
    border-left: none;
    border: 1px solid var(--amber);
    border-radius: var(--radius-pill);
    padding: 0 0.8rem;
    font-size: 0.8rem;
    min-height: 44px;
  }
  .hero-inner { padding: 2.5rem 1rem; }
  .hero-h1 { font-size: 1.75rem; }
  .site-header { padding: 0 0.75rem; }
  .nav-links a { font-size: 0.76rem; padding: 0 0.65rem; min-height: 40px; }
  .bottom-nav-bar { padding: 0.4rem 0.6rem; }
}

@media (max-width: 480px) {
  .hero-section { min-height: 65vh; }
  .hero-h1 { font-size: 1.5rem; }
}

/* ===== prefers-reduced-motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .grain-overlay, .light-leak, .vhs-scanline { display: none; }
}

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