@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{
  --ink:#1f1726;
  --violet:#56228b;
  --violet-soft:#6f3aa6;
  --ochre:#8b4513;
  --paper:#f8f3ea;
  --paper-2:#efe5d5;
  --card:#fffdfa;
  --line:rgba(31,23,38,.16);
  --r-lg:28px;
  --r-md:18px;
  --r-pill:999px;
  --shadow:0 14px 30px -22px rgba(31,23,38,.75);
}

*{box-sizing:border-box}

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

body{
  margin:0;
  font-family:"Source Serif 4","Songti SC","Noto Serif SC",Georgia,serif;
  font-size:17px;
  line-height:1.7;
  color:var(--ink);
  background-color:var(--paper);
  background-image:
    radial-gradient(rgba(139,69,19,.11) 1px, transparent 1px),
    radial-gradient(rgba(86,34,139,.08) 1px, transparent 1px);
  background-size:19px 19px, 29px 29px;
  background-position:0 0, 9px 13px;
  padding-left:212px;
}

h1,h2,h3{
  font-family:"Playfair Display","Source Serif 4",Georgia,serif;
  line-height:1.2;
  letter-spacing:-.01em;
  margin:0;
}

a{color:var(--violet)}
a:hover{color:var(--ochre)}

.skip{
  position:fixed;
  left:14px;
  top:-70px;
  z-index:60;
  padding:10px 18px;
  min-height:44px;
  display:inline-flex;
  align-items:center;
  background:var(--ink);
  color:#fdf8f1;
  border-radius:var(--r-pill);
  text-decoration:none;
  transition:top .2s;
}
.skip:focus{top:12px;color:#fdf8f1}

/* 左侧竖向药丸导航 */
.pillrail{
  position:fixed;
  left:0;
  top:0;
  bottom:0;
  width:212px;
  padding:26px 16px 30px;
  display:flex;
  flex-direction:column;
  gap:24px;
  overflow-y:auto;
  z-index:30;
  background:linear-gradient(180deg,#fcf8f2 0%,#f3ebde 100%);
  border-right:1px solid var(--line);
}

.pillrail .brand{
  font-family:"Playfair Display",Georgia,serif;
  font-weight:900;
  font-size:26px;
  line-height:1.1;
  letter-spacing:.02em;
  color:var(--violet);
  text-decoration:none;
  padding:6px 10px;
  white-space:nowrap;
}

.pillrail ol{
  list-style:none;
  margin:0;
  padding:0;
  display:flex;
  flex-direction:column;
  gap:9px;
}

.pillrail ol a{
  display:flex;
  align-items:center;
  min-height:44px;
  padding:8px 16px;
  border-radius:var(--r-pill);
  border:1px solid var(--line);
  background:#fffdf9;
  color:var(--ink);
  font-size:16px;
  line-height:1.35;
  text-decoration:none;
  transition:background .22s, border-color .22s, color .22s, transform .22s;
}

.pillrail ol a:hover,
.pillrail ol a:focus-visible{
  background:var(--violet);
  border-color:var(--violet);
  color:#fdf8f1;
  transform:translateX(3px);
}

main{
  max-width:900px;
  margin:0 auto;
  padding:26px 44px 0;
}

/* 首屏 */
.hero{
  min-height:45vh;
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:center;
  gap:10px 18px;
  text-align:center;
  padding:26px 8px 30px;
}

.herofig{
  margin:0;
  color:var(--ochre);
  display:flex;
  align-items:center;
  justify-content:center;
}

.herofig img{
  width:54px;
  height:54px;
  object-fit:contain;
  border-radius:var(--r-md);
}

.hero h1{
  flex:0 1 auto;
  max-width:100%;
  font-size:clamp(31px,6vw,54px);
  font-weight:900;
  color:var(--violet);
  text-wrap:balance;
}

.hero .subtitle{
  flex:0 0 100%;
  margin:6px auto 0;
  max-width:44ch;
  font-size:clamp(16px,2.3vw,19px);
  font-style:italic;
  font-weight:300;
  color:rgba(31,23,38,.74);
}

/* 正文区：aside 在左侧 */
.reading{
  display:grid;
  grid-template-columns:minmax(168px,204px) minmax(0,1fr);
  column-gap:34px;
  align-items:start;
  padding-bottom:12px;
}

.reading > aside{
  grid-column:1;
  grid-row:1 / span 2;
  position:sticky;
  top:26px;
  background:var(--paper-2);
  border:1px solid var(--line);
  border-radius:24px 24px 28px 18px;
  padding:18px 16px 22px;
  box-shadow:var(--shadow);
}

.reading > aside h2{
  font-size:20px;
  font-weight:700;
  color:var(--violet);
}

.reading > aside .subtitle{
  margin:4px 0 14px;
  font-size:16px;
  font-style:normal;
  letter-spacing:.16em;
  color:var(--ochre);
}

.side-list{
  list-style:none;
  margin:0;
  padding:0;
  display:flex;
  flex-direction:column;
  gap:4px;
}

.side-list a{
  display:flex;
  align-items:center;
  min-height:42px;
  padding:6px 12px;
  border-radius:var(--r-md);
  font-size:16px;
  line-height:1.35;
  color:var(--ink);
  text-decoration:none;
  border-bottom:1px solid rgba(31,23,38,.08);
  transition:background .2s, color .2s, padding-left .2s;
}

.side-list a:hover,
.side-list a:focus-visible{
  background:var(--violet);
  color:#fdf8f1;
  padding-left:16px;
}

.reading > figure.vein{
  grid-column:2;
  grid-row:1;
  margin:0 0 10px;
  color:rgba(139,69,19,.55);
  height:16px;
}

.reading > figure.vein svg{display:block;width:100%;height:16px}

.reading > .flow{
  grid-column:2;
  grid-row:2;
  min-width:0;
}

/* 正文内容卡片 */
.flow > article{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:var(--r-lg);
  border-bottom:4px solid var(--ochre);
  padding:24px 26px 30px;
  margin:0 0 26px;
  box-shadow:var(--shadow);
  scroll-margin-top:24px;
}

.flow > article:last-child{margin-bottom:0}

.flow h2{
  font-size:clamp(22px,3.4vw,28px);
  font-weight:700;
  color:var(--violet);
  margin:0 0 6px;
}

.flow h3{
  font-size:clamp(18px,2.6vw,21px);
  font-weight:600;
  color:var(--ink);
  margin:22px 0 6px;
}

.flow p{margin:0 0 14px}
.flow p:last-child{margin-bottom:0}

.flow ul,
.flow ol{
  margin:0 0 14px;
  padding-left:22px;
}

.flow li{margin:0 0 8px}

.flow a{
  color:var(--violet);
  text-decoration:none;
  border-bottom:1px solid rgba(86,34,139,.4);
  padding-bottom:1px;
}

.flow a:hover{color:var(--ochre);border-bottom-color:var(--ochre)}

.flow blockquote{
  margin:0 0 16px;
  padding:14px 20px;
  border-left:4px solid var(--violet);
  border-radius:0 20px 20px 0;
  background:rgba(86,34,139,.06);
  font-style:italic;
}

.flow img{
  max-width:100%;
  height:auto;
  border-radius:var(--r-md);
}

.flow figure{margin:0 0 16px}

/* 页脚 */
footer{
  margin-top:56px;
  padding:52px 32px 44px;
  text-align:center;
  border-top:1px solid var(--line);
  background:linear-gradient(180deg,rgba(239,229,213,.5),rgba(239,229,213,1));
}

footer .cta{
  margin:0 0 22px;
  font-family:"Playfair Display",Georgia,serif;
  font-weight:900;
  font-size:clamp(28px,6vw,46px);
  line-height:1.15;
}

footer .cta a{
  display:inline-block;
  padding-bottom:4px;
  color:var(--violet);
  text-decoration:none;
  border-bottom:3px solid var(--ochre);
  transition:color .22s, letter-spacing .22s;
}

footer .cta a:hover{color:var(--ochre);letter-spacing:.03em}

footer small{
  font-size:16px;
  letter-spacing:.18em;
  color:rgba(31,23,38,.66);
}

/* 滚动显现 */
.reveal{
  opacity:0;
  transform:translateY(16px);
  transition:opacity .6s ease, transform .6s ease;
}

.reveal.in{
  opacity:1;
  transform:none;
}

@media (prefers-reduced-motion: reduce){
  html{scroll-behavior:auto}
  .reveal{opacity:1;transform:none;transition:none}
  .pillrail ol a:hover{transform:none}
  .side-list a:hover{padding-left:12px}
  footer .cta a:hover{letter-spacing:normal}
}

@media (max-width:860px){
  body{padding-left:0;font-size:17px}

  .pillrail{
    position:sticky;
    top:0;
    bottom:auto;
    width:auto;
    flex-direction:row;
    align-items:center;
    gap:10px;
    padding:10px 14px;
    border-right:0;
    border-bottom:1px solid var(--line);
    overflow-x:auto;
    overflow-y:hidden;
    scrollbar-width:thin;
  }

  .pillrail .brand{
    font-size:20px;
    padding:4px 6px;
    flex:0 0 auto;
  }

  .pillrail ol{
    flex-direction:row;
    gap:8px;
  }

  .pillrail ol a{
    min-height:42px;
    padding:7px 14px;
    white-space:nowrap;
    font-size:16px;
  }

  .pillrail ol a:hover{transform:none}

  main{padding:14px 16px 0}

  .hero{min-height:0;padding:18px 4px 24px;gap:8px 12px}

  .herofig img{width:44px;height:44px}

  .reading{display:block}

  .reading > aside{
    position:static;
    margin:0 0 20px;
  }

  .reading > figure.vein{margin:0 0 12px}

  .flow > article{
    padding:20px 18px 24px;
    border-radius:22px;
    scroll-margin-top:96px;
  }

  footer{padding:40px 18px 36px}
}

@media (max-width:400px){
  .pillrail .brand{font-size:18px}
  .flow > article{padding:18px 15px 22px}
}

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