@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,700;1,400&family=Nunito:ital,wght@0,700;0,800;0,900;1,700&display=swap');

/* ===== 基础变量 ===== */
:root {
  --cream: #f5e6c8;
  --caramel: #d4a574;
  --ink: #262117;
  --caramel-dark: #b8864e;
  --caramel-light: #e8c99a;
  --ink-soft: #3d3420;
  --ink-mute: #6b5d42;
  --cream-dark: #e8d0a0;
  --radius-card: 28px;
  --radius-sm: 12px;
  --font-body: 'DM Sans', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --font-display: 'Nunito', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --header-h: 64px;
  --anchor-h: 44px;
  --scroll-top: calc(var(--header-h) + var(--anchor-h) + 8px);
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  font-size: 17px;
  background: var(--cream);
  color: var(--ink);
}
body {
  font-family: var(--font-body);
  line-height: 1.65;
  background: var(--cream);
  color: var(--ink);
  overflow-x: hidden;
  position: relative;
  max-width: 100%;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--caramel-dark); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--ink); }
ul, ol { list-style: none; }

/* ===== Film Grain Overlay ===== */
.grain-overlay {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23grain)' opacity='1'/%3E%3C/svg%3E");
  background-repeat: repeat;
  mix-blend-mode: multiply;
  animation: grainShift 0.15s steps(1) infinite;
}

@keyframes grainShift {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-3px, 2px); }
  40%  { transform: translate(2px, -3px); }
  60%  { transform: translate(-2px, -1px); }
  80%  { transform: translate(3px, 3px); }
  100% { transform: translate(0, 0); }
}

/* ===== Light Leak ===== */
.light-leak {
  pointer-events: none;
  position: fixed;
  top: -20%;
  right: 0;
  width: 55%;
  height: 70%;
  z-index: 9998;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(212,165,116,0.18) 0%, rgba(245,230,200,0.08) 50%, transparent 75%);
  animation: leakFloat 8s ease-in-out infinite alternate;
}

@keyframes leakFloat {
  from { transform: translate(0, 0) scale(1); opacity: 0.7; }
  to   { transform: translate(-30px, 20px) scale(1.1); opacity: 1; }
}

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 500;
  height: var(--header-h);
  background: rgba(245,230,200,0.92);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--caramel);
  width: 100%;
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-img {
  height: 36px;
  width: auto;
  border-radius: 8px;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.25rem;
  color: var(--ink);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.main-nav {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  min-width: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  overflow: hidden;
}

.nav-link {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--ink-soft);
  padding: 10px;
  border-radius: var(--radius-sm);
  transition: background 0.2s, color 0.2s;
  min-height: 40px;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.nav-link:hover {
  background: var(--caramel);
  color: var(--ink);
}

/* ===== Anchor Bar ===== */
.anchor-bar {
  position: sticky;
  top: var(--header-h);
  z-index: 490;
  background: var(--ink);
  border-bottom: 2px solid var(--caramel-dark);
  width: 100%;
  overflow: hidden;
}

.anchor-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  overflow-x: auto;
  scrollbar-width: none;
}
.anchor-inner::-webkit-scrollbar { display: none; }

.anchor-dl {
  display: flex;
  align-items: center;
  height: var(--anchor-h);
  width: max-content;
  min-width: 100%;
}

.anchor-dl dt {
  flex-shrink: 0;
}

.anchor-link {
  display: flex;
  align-items: center;
  height: var(--anchor-h);
  padding: 0 14px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--caramel-light);
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: color 0.2s, background 0.2s;
  border-right: 1px solid rgba(212,165,116,0.25);
}

.anchor-link:hover {
  color: var(--cream);
  background: rgba(212,165,116,0.15);
}

/* ===== Section scroll offset ===== */
section[id] {
  scroll-margin-top: var(--scroll-top);
}

/* ===== Hero ===== */
.hero-section {
  position: relative;
  min-height: 45vh;
  background: var(--ink);
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  overflow: hidden;
  padding: 48px 0 40px;
  width: 100%;
}

.hero-bg-text {
  position: absolute;
  bottom: -0.15em;
  left: -0.05em;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(100px, 20vw, 260px);
  color: rgba(212,165,116,0.08);
  line-height: 1;
  letter-spacing: -0.05em;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  max-width: 100%;
}

.hero-inner {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
  text-align: right;
  position: relative;
  z-index: 2;
}

.hero-eyebrow {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  color: var(--caramel);
  border: 1px solid var(--caramel);
  border-radius: 999px;
  padding: 4px 14px;
  margin-bottom: 16px;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.8rem, 5vw, 4.2rem);
  line-height: 1.15;
  color: var(--cream);
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  word-break: break-all;
}

.hero-lead {
  font-size: 1rem;
  color: var(--caramel-light);
  max-width: 480px;
  margin-left: auto;
  line-height: 1.7;
}

.vhs-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    var(--caramel) 0px,
    var(--caramel) 40px,
    transparent 40px,
    transparent 60px
  );
  opacity: 0.6;
  animation: vhsTrack 4s linear infinite;
}

@keyframes vhsTrack {
  from { background-position: 0 0; }
  to   { background-position: 120px 0; }
}

/* ===== Main ===== */
.site-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 48px 24px 64px;
  overflow: hidden;
}

.content-section {
  display: grid;
  grid-template-columns: 200px 1fr;
  grid-template-rows: auto 1fr;
  gap: 32px;
  align-items: start;
  position: relative;
}

/* film frame decoration */
.film-frame {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 4px;
  background: var(--ink);
  border-radius: var(--radius-sm);
  align-items: center;
}

.film-perfs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.perf {
  display: block;
  width: 18px;
  height: 12px;
  border: 2px solid var(--caramel);
  border-radius: 3px;
  opacity: 0.7;
}

/* sidebar */
.sidebar-nav {
  grid-column: 1;
  grid-row: 2;
  background: var(--cream-dark);
  border: 2px solid var(--caramel);
  border-radius: var(--radius-card);
  padding: 24px 18px;
  position: sticky;
  top: calc(var(--header-h) + var(--anchor-h) + 16px);
  min-width: 0;
}

.sidebar-nav h2 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1rem;
  color: var(--ink);
  margin-bottom: 4px;
}

.sidebar-nav .subtitle {
  font-size: 0.78rem;
  color: var(--ink-mute);
  margin-bottom: 16px;
  line-height: 1.5;
}

.sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-list li a {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-soft);
  transition: background 0.2s, color 0.2s;
  min-height: 40px;
}

.sidebar-list li a:hover {
  background: var(--caramel);
  color: var(--ink);
}

/* main content */
.main-content {
  grid-column: 2;
  grid-row: 1 / 3;
  min-width: 0;
  overflow: hidden;
}

/* ===== Content Sections (page.content sections) ===== */
.main-content section {
  margin-bottom: 56px;
  padding-bottom: 40px;
  border-bottom: 1px solid rgba(212,165,116,0.35);
  animation: fadeSlideUp 0.5s ease both;
}

.main-content section:last-child {
  border-bottom: none;
}

.main-content h2 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.2rem, 2.5vw, 1.9rem);
  color: var(--ink);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.main-content h2 + p,
.main-content h2 + .subtitle {
  font-size: 0.95rem;
  color: var(--ink-mute);
  margin-bottom: 20px;
}

.main-content h3 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--ink-soft);
  margin: 28px 0 10px;
}

.main-content p {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--ink-soft);
  margin-bottom: 16px;
  word-break: break-word;
}

.main-content ul,
.main-content ol {
  margin: 12px 0 20px 20px;
  list-style: disc;
}

.main-content ul li,
.main-content ol li {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.main-content ol {
  list-style: decimal;
}

.main-content a {
  color: var(--caramel-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
  word-break: break-all;
}

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

/* Stagger animation for sections */
.main-content section:nth-child(1) { animation-delay: 0.05s; }
.main-content section:nth-child(2) { animation-delay: 0.1s; }
.main-content section:nth-child(3) { animation-delay: 0.15s; }
.main-content section:nth-child(4) { animation-delay: 0.2s; }
.main-content section:nth-child(5) { animation-delay: 0.25s; }
.main-content section:nth-child(6) { animation-delay: 0.3s; }
.main-content section:nth-child(7) { animation-delay: 0.35s; }

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

/* ===== Polaroid card style for any card within content ===== */
.main-content figure {
  border: 4px solid var(--cream-dark);
  border-bottom-width: 32px;
  border-radius: 4px;
  background: var(--cream-dark);
  display: inline-block;
  max-width: 100%;
  margin: 20px 0;
  box-shadow: 3px 4px 12px rgba(38,33,23,0.18);
  filter: sepia(0.15) contrast(1.05) saturate(0.85);
  animation: polaroidShake 6s ease-in-out infinite alternate;
}

@keyframes polaroidShake {
  0%   { transform: rotate(-1.5deg); }
  50%  { transform: rotate(0.5deg); }
  100% { transform: rotate(1deg); }
}

/* ===== Footer ===== */
.site-footer {
  background: var(--ink);
  color: var(--caramel-light);
  padding: 32px 24px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
  width: 100%;
}

.site-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: repeating-linear-gradient(
    90deg,
    var(--caramel) 0px,
    var(--caramel) 30px,
    var(--caramel-dark) 30px,
    var(--caramel-dark) 60px
  );
}

.site-footer p.footer-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--caramel);
  margin-bottom: 10px;
  word-break: break-word;
}

.site-footer small.footer-copy {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-mute);
  letter-spacing: 0.03em;
}

/* ===== VHS body filter ===== */
.vintage-body {
  filter: sepia(0.04) contrast(1.02);
}

/* ===== Responsive ===== */
@media (max-width: 960px) {
  .content-section {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }
  .film-frame {
    display: none;
  }
  .sidebar-nav {
    grid-column: 1;
    grid-row: 1;
    position: static;
  }
  .main-content {
    grid-column: 1;
    grid-row: 2;
  }
  .sidebar-list {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .sidebar-list li a {
    padding: 6px 10px;
    min-height: 36px;
    font-size: 0.82rem;
  }
}

@media (max-width: 640px) {
  :root {
    --header-h: 56px;
    --anchor-h: 40px;
  }
  .header-inner {
    padding: 0 12px;
    gap: 8px;
  }
  .nav-links {
    display: none;
  }
  .brand-name {
    font-size: 1.05rem;
  }
  .anchor-inner {
    padding: 0 6px;
  }
  .anchor-link {
    padding: 0 8px;
    font-size: 0.72rem;
  }
  .hero-section {
    min-height: 42vh;
    padding: 32px 0 28px;
  }
  .hero-inner {
    padding: 0 12px;
  }
  .hero-bg-text {
    font-size: 28vw;
    opacity: 0.06;
  }
  .hero-title {
    font-size: clamp(1.4rem, 7vw, 2.2rem);
    word-break: break-word;
  }
  .hero-lead {
    font-size: 0.9rem;
    max-width: 100%;
  }
  .site-main {
    padding: 24px 12px 40px;
  }
  .content-section {
    gap: 16px;
  }
  .sidebar-nav {
    padding: 14px 10px;
  }
  .site-footer {
    padding: 28px 12px 20px;
  }
}

/* ===== prefers-reduced-motion ===== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .grain-overlay,
  .light-leak,
  .vhs-bar { animation: none !important; }
  .main-content section { animation: none !important; opacity: 1 !important; transform: none !important; }
  .main-content figure { animation: none !important; }
}

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