@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600;700&family=Libre+Baskerville:wght@400;700&display=swap');

:root{
  --paper:#f5e6c8;
  --paper-hi:#fbf3e2;
  --sand:#e8d3ad;
  --tan:#d4a574;
  --line:#b7996c;
  --ink:#262117;
  --ink-soft:#4a3f2e;
  --rail:230px;
  --serif:"Cormorant Garamond","Songti SC","Noto Serif SC",Georgia,serif;
  --text:"Libre Baskerville","Songti SC","Noto Serif SC",Georgia,serif;
}

*,*::before,*::after{box-sizing:border-box}

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

body{
  margin:0;
  min-height:100vh;
  font-family:var(--text);
  font-size:1rem;
  line-height:1.8;
  color:var(--ink);
  background-color:var(--paper);
  background-image:
    radial-gradient(circle at 88% -8%, rgba(212,165,116,.52), transparent 46%),
    radial-gradient(circle at 2% 104%, rgba(212,165,116,.4), transparent 44%),
    linear-gradient(180deg,#f8eedd 0%,#f5e6c8 46%,#eedbb9 100%);
  background-attachment:fixed;
  overflow-x:hidden;
}

h1,h2,h3,h4,.brand,.tag{
  font-family:var(--serif);
  font-weight:600;
  letter-spacing:.02em;
}

a{color:inherit;text-decoration:none}
img{max-width:100%}
:focus-visible{outline:2px solid var(--ink);outline-offset:3px}

/* 胶片颗粒 */
.grain{
  position:fixed;
  inset:0;
  z-index:1200;
  pointer-events:none;
  opacity:.26;
  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='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  animation:flicker 5s steps(2) infinite;
}
@keyframes flicker{
  0%,100%{opacity:.2}
  50%{opacity:.32}
}

/* 左侧竖排导航栏 */
.rail{
  position:fixed;
  z-index:1000;
  top:0;
  left:0;
  bottom:0;
  width:var(--rail);
  padding:26px 20px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  align-items:flex-start;
  border-right:1px solid var(--line);
  background:#f4e4c4;
  transition:background .3s ease,border-color .3s ease;
}

.brand{
  writing-mode:vertical-rl;
  font-size:1.5rem;
  line-height:1.25;
  letter-spacing:.32em;
  padding:6px 4px;
  min-height:44px;
  border-left:1px solid var(--line);
  border-right:1px solid var(--line);
  max-height:270px;
  transition:color .3s ease,border-color .3s ease,letter-spacing .3s ease;
}
.brand:hover{letter-spacing:.42em;color:var(--ink-soft)}

.drawer summary{
  list-style:none;
  display:inline-flex;
  align-items:center;
  gap:10px;
  min-height:44px;
  padding:11px 13px;
  border:1px solid var(--line);
  border-radius:4px;
  font-family:var(--text);
  font-size:.92rem;
  letter-spacing:.16em;
  cursor:pointer;
  background:rgba(251,243,226,.7);
  transition:background .25s ease,color .25s ease,border-color .25s ease;
}
.drawer summary::-webkit-details-marker{display:none}
.drawer summary:hover{background:var(--ink);color:var(--paper);border-color:var(--ink)}

.bars{
  display:block;
  width:18px;
  height:2px;
  background:currentColor;
  box-shadow:0 5px 0 currentColor,0 -5px 0 currentColor;
}

.rail:has(.drawer[open]){
  background:#241f16;
  border-right-color:#4a4132;
}
.rail:has(.drawer[open]) .brand{color:var(--paper);border-color:#5d5240}
.rail:has(.drawer[open]) .drawer summary{
  position:relative;
  z-index:950;
  color:var(--paper);
  background:transparent;
  border-color:#6b5f4a;
}
.rail:has(.drawer[open]) .drawer summary:hover{background:#3a3226}

/* 全屏遮罩菜单 */
.drawer menu{
  position:fixed;
  inset:0;
  z-index:900;
  margin:0;
  padding:92px 44px 44px;
  list-style:none;
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap:2px;
  overflow:auto;
  background:#241f16;
  background-image:
    radial-gradient(circle at 84% 6%, rgba(212,165,116,.28), transparent 45%),
    radial-gradient(circle at 8% 96%, rgba(212,165,116,.2), transparent 40%);
}
.drawer menu li{list-style:none;animation:rise .45s both}
.drawer menu li:nth-child(1){animation-delay:.04s}
.drawer menu li:nth-child(2){animation-delay:.09s}
.drawer menu li:nth-child(3){animation-delay:.14s}
.drawer menu li:nth-child(4){animation-delay:.19s}
.drawer menu li:nth-child(5){animation-delay:.24s}
.drawer menu li:nth-child(6){animation-delay:.29s}
.drawer menu li:nth-child(7){animation-delay:.34s}
.drawer menu a{
  display:flex;
  align-items:center;
  min-height:46px;
  padding:12px 4px;
  font-family:var(--serif);
  font-size:1.24rem;
  letter-spacing:.08em;
  color:var(--paper);
  border-bottom:1px solid rgba(245,230,200,.18);
  transition:color .25s ease,padding-left .25s ease;
}
.drawer menu a:hover{color:var(--tan);padding-left:16px}

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

/* 主体 */
main{margin-left:var(--rail)}
.wrap{
  max-width:1120px;
  margin:0 auto;
  padding:44px 44px 30px;
}

.hero{
  min-height:70vh;
  display:grid;
  grid-template-columns:minmax(0,.92fr) minmax(0,1.08fr);
  align-items:center;
  gap:52px;
  padding-bottom:46px;
  border-bottom:1px solid var(--line);
}

.polaroid{
  position:relative;
  margin:0;
  aspect-ratio:4/3;
  padding:13px 13px 40px;
  background:var(--paper-hi);
  border:1px solid var(--line);
  border-radius:4px;
  transform:rotate(-1.7deg);
  transition:transform .4s ease;
  animation:shake .9s ease both;
}
.polaroid:hover{transform:rotate(-.4deg) translateY(-3px)}
.polaroid::after{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  background:repeating-linear-gradient(0deg,rgba(38,33,23,.07) 0 1px,transparent 1px 3px);
  mix-blend-mode:multiply;
}
.hero-img{
  display:block;
  width:100%;
  height:100%;
  object-fit:cover;
  border-radius:2px;
  filter:sepia(.38) saturate(.82) contrast(1.06) brightness(1.02);
}

@keyframes shake{
  from{transform:rotate(-1.7deg) translateY(6px);opacity:.6}
  to{transform:rotate(-1.7deg) translateY(0);opacity:1}
}

.tag{
  position:absolute;
  top:-15px;
  left:-12px;
  z-index:2;
  display:inline-block;
  padding:6px 13px;
  font-size:.85rem;
  letter-spacing:.18em;
  color:var(--paper);
  background:var(--ink);
  border-radius:4px;
  transform:rotate(-3deg);
}

.lede{text-align:right}
.lede h1{
  margin:0 0 18px;
  font-size:clamp(1.9rem,3.6vw,3rem);
  line-height:1.24;
  text-shadow:1px 0 0 rgba(212,165,116,.55),-1px 0 0 rgba(38,33,23,.14);
}
.lede .sub{
  margin:0;
  font-size:1rem;
  line-height:1.9;
  color:var(--ink-soft);
  text-align:right;
  border-right:2px solid var(--tan);
  padding-right:16px;
}

/* 正文 + 侧栏 */
.body{
  display:grid;
  grid-template-columns:minmax(0,1fr) 238px;
  gap:52px;
  align-items:start;
  padding:48px 0 20px;
}

.prose{min-width:0}
.prose div{
  padding:6px 0 34px;
  scroll-margin-top:96px;
  animation:rise .5s both;
}
.prose div + div{border-top:1px dashed var(--line);padding-top:34px}
.prose div:nth-child(1){animation-delay:.03s}
.prose div:nth-child(2){animation-delay:.07s}
.prose div:nth-child(3){animation-delay:.11s}
.prose div:nth-child(4){animation-delay:.15s}
.prose div:nth-child(5){animation-delay:.19s}
.prose div:nth-child(6){animation-delay:.23s}
.prose div:nth-child(7){animation-delay:.27s}

.prose h2{
  margin:.2em 0 .7em;
  font-size:clamp(1.45rem,2.6vw,1.95rem);
  line-height:1.35;
}
.prose h3{
  margin:1.5em 0 .6em;
  font-size:1.16rem;
  line-height:1.5;
}
.prose p{margin:0 0 1.1em}
.prose strong{background:linear-gradient(transparent 62%,rgba(212,165,116,.55) 62%)}
.prose a{
  color:var(--ink);
  text-decoration:underline;
  text-decoration-color:var(--tan);
  text-decoration-thickness:2px;
  text-underline-offset:3px;
}
.prose a:hover{text-decoration-color:var(--ink)}
.prose ul,.prose ol{margin:0 0 1.1em;padding-left:1.35em}
.prose li{margin:.3em 0}
.prose blockquote{
  margin:1.4em 0;
  padding:12px 20px;
  border-left:3px solid var(--tan);
  background:rgba(251,243,226,.55);
  font-style:italic;
  color:var(--ink-soft);
}
.prose img{
  display:block;
  margin:1.4em 0;
  padding:10px 10px 30px;
  background:var(--paper-hi);
  border:1px solid var(--line);
  border-radius:4px;
  filter:sepia(.3) saturate(.85) contrast(1.05);
  transform:rotate(-.5deg);
}
.prose hr{border:0;border-top:1px solid var(--line);margin:1.6em 0}
.prose code{
  font-size:.92em;
  padding:1px 5px;
  background:rgba(212,165,116,.3);
  border-radius:2px;
}

/* 侧栏 */
.side{
  position:sticky;
  top:34px;
  padding:20px 18px;
  border:1px solid var(--line);
  border-radius:4px;
  background:rgba(251,243,226,.6);
}
.side h2{
  margin:0 0 10px;
  font-size:1rem;
  letter-spacing:.28em;
  color:var(--ink-soft);
}
.side hr{border:0;border-top:1px solid var(--line);margin:0 0 12px}
.side ul{list-style:none;margin:0;padding:0}
.side li a{
  display:block;
  min-height:40px;
  padding:9px 3px;
  font-size:.95rem;
  line-height:1.5;
  border-bottom:1px dotted var(--line);
  transition:color .2s ease,padding-left .2s ease,background .2s ease;
}
.side li a:hover{color:var(--ink);background:rgba(212,165,116,.28);padding-left:9px}
.side li:last-child a{border-bottom:0}

/* 页脚 */
footer{
  margin-left:var(--rail);
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  gap:10px 26px;
  padding:20px 44px;
  border-top:1px solid var(--line);
  font-size:.88rem;
  color:var(--ink-soft);
  background:rgba(236,220,190,.5);
}
.foot-brand a{
  display:inline-flex;
  align-items:center;
  min-height:40px;
  font-family:var(--serif);
  font-size:1.05rem;
  letter-spacing:.16em;
  color:var(--ink);
}
.foot-nav{
  display:flex;
  flex-wrap:wrap;
  gap:2px 16px;
}
.foot-nav a{
  display:inline-flex;
  align-items:center;
  min-height:40px;
  padding:4px 0;
  border-bottom:1px solid transparent;
  transition:color .2s ease,border-color .2s ease;
}
.foot-nav a:hover{color:var(--ink);border-bottom-color:var(--tan)}
.foot-copy{letter-spacing:.04em}

/* 移动端 */
@media (max-width:900px){
  :root{--rail:0px}
  .rail{
    right:0;
    bottom:auto;
    width:auto;
    height:64px;
    padding:0 18px;
    flex-direction:row;
    align-items:center;
    justify-content:space-between;
    border-right:0;
    border-bottom:1px solid var(--line);
  }
  .brand{
    writing-mode:horizontal-tb;
    font-size:1.12rem;
    letter-spacing:.2em;
    border-left:0;
    border-right:0;
    padding:0;
    max-height:none;
    display:inline-flex;
    align-items:center;
    min-height:44px;
  }
  .brand:hover{letter-spacing:.26em}
  .drawer menu{padding:86px 22px 30px;justify-content:flex-start}
  .drawer menu a{font-size:1.08rem;padding:11px 3px}
  main{margin-left:0;padding-top:64px}
  .wrap{padding:26px 18px 24px}
  .hero{
    grid-template-columns:1fr;
    gap:26px;
    min-height:0;
    padding-bottom:30px;
  }
  .lede{text-align:left;order:-1}
  .lede .sub{text-align:left;border-right:0;border-left:2px solid var(--tan);padding-left:14px;padding-right:0}
  .polaroid{transform:rotate(-1.1deg)}
  .body{grid-template-columns:1fr;gap:30px;padding-top:30px}
  .prose div{scroll-margin-top:80px}
  .side{position:static;top:auto}
  footer{margin-left:0;padding:16px 18px 22px;gap:6px 18px}
  .foot-nav{gap:0 14px;width:100%;order:3}
  .foot-nav a{font-size:.84rem}
  .foot-copy{font-size:.8rem}
}

@media (max-width:400px){
  .foot-brand a{font-size:.98rem}
  .lede h1{font-size:1.75rem}
}

@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}
