:root {
  --ink: #0f1b2b;
  --ink-2: #1b314f;
  --amber: #e4b363;
  --amber-2: #b17f27;
  --cream: #f5f1e8;
  --cream-2: #ebe4d5;
  --paper: #fffcf5;
  --line: #d9d0be;
  --radius: 10px;
}

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

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

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: "Montserrat", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  font-family: "Cormorant", "Songti SC", "Noto Serif SC", Georgia, serif;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  margin: 0 0 0.5em;
}

p {
  margin: 0 0 1em;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
}

.masthead {
  background: var(--ink);
  color: var(--cream);
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 3px solid var(--amber);
}

.brandrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 12px 16px;
}

.brand {
  margin: 0;
  font-family: "Cormorant", "Songti SC", Georgia, serif;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.logo-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
}

.logo-img {
  height: 32px;
  width: auto;
  max-height: 32px;
  object-fit: contain;
}

.menurow {
  border-top: 1px solid rgba(245, 241, 232, 0.16);
}

.mainnav ol {
  list-style: none;
  margin: 0;
  padding: 4px 10px;
  display: flex;
  justify-content: center;
  gap: 2px;
  overflow-x: auto;
}

.mainnav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  text-decoration: none;
  color: var(--cream);
  font-size: 16px;
  border-bottom: 3px solid transparent;
  transition: color 0.16s ease, background-color 0.16s ease, border-color 0.16s ease;
}

.mainnav a:hover {
  color: var(--ink);
  background: var(--amber);
  border-color: var(--ink);
}

.hero {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 45vh;
  padding: 52px 20px 78px;
  background: var(--ink);
  color: var(--cream);
  text-align: center;
  overflow: hidden;
  clip-path: polygon(0 0, 100% 0, 100% 90%, 0 100%);
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.42;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 840px;
}

.hero-badge {
  display: inline-block;
  margin: 0 0 16px;
  padding: 6px 16px;
  background: var(--amber);
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.08em;
  border-radius: 2px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(30px, 5.6vw, 58px);
  line-height: 1.14;
}

.shell {
  max-width: 1140px;
  margin: 0 auto;
  padding: 44px 20px 68px;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 34px;
  align-items: start;
}

.toc {
  background: var(--cream-2);
  border: 1px solid var(--line);
  border-left: 5px solid var(--amber);
  border-radius: var(--radius);
  padding: 16px;
}

.toc h2 {
  font-size: 22px;
  margin: 0 0 10px;
}

.toc h2 span {
  display: inline-block;
  padding-bottom: 2px;
  border-bottom: 3px solid var(--amber);
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc li {
  margin: 0;
}

.toc a {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 6px 8px;
  font-size: 16px;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.16s ease, color 0.16s ease;
}

.toc li:last-child a {
  border-bottom: 0;
}

.toc a:hover,
.toc a[aria-current] {
  background: var(--ink);
  color: var(--cream);
}

.post {
  min-width: 0;
  overflow-wrap: break-word;
}

.post section {
  background: var(--paper);
  border-bottom: 5px solid var(--amber);
  border-radius: var(--radius);
  padding: 26px 24px 10px;
  margin: 0 0 26px;
  scroll-margin-top: 132px;
}

.post h2 {
  font-size: clamp(24px, 3.4vw, 34px);
  margin: 0 0 16px;
}

.post h2 span {
  display: inline-block;
  padding-bottom: 2px;
  border-bottom: 4px solid var(--amber);
}

.post h3 {
  font-size: 22px;
  margin: 1.4em 0 0.5em;
}

.post h3 span {
  display: inline-block;
  border-bottom: 3px solid var(--amber);
  padding-bottom: 2px;
}

.post p {
  margin: 0 0 1.1em;
}

.post ul,
.post ol {
  margin: 0 0 1.2em;
  padding-left: 1.35em;
}

.post li {
  margin: 0 0 0.4em;
}

.post a {
  color: var(--amber-2);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: background-color 0.16s ease, color 0.16s ease;
}

.post a:hover {
  color: var(--ink);
  background: var(--amber);
}

.post blockquote {
  margin: 0 0 1.2em;
  padding: 12px 18px;
  background: var(--cream-2);
  border-left: 5px solid var(--ink);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.post table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.2em;
  font-size: 16px;
}

.post th,
.post td {
  border: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
}

.post th {
  background: var(--ink);
  color: var(--cream);
}

.post pre {
  overflow-x: auto;
  padding: 14px;
  background: var(--ink);
  color: var(--cream);
  border-radius: 4px;
}

.site-footer {
  background: var(--ink);
  color: var(--cream);
  margin-top: 44px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.f-cta {
  grid-column: 1 / -1;
  background: var(--amber);
  color: var(--ink);
  padding: 48px 24px;
  text-align: center;
}

.f-cta h2 {
  margin: 0 0 18px;
  font-size: clamp(28px, 4.6vw, 46px);
}

.f-cta h2 span {
  display: inline-block;
  padding-bottom: 4px;
  border-bottom: 4px solid var(--ink);
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 28px;
  background: var(--ink);
  color: var(--cream);
  font-size: 17px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 2px;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.cta-btn:hover {
  opacity: 0.85;
  transform: translateY(-2px);
}

.f-col {
  padding: 32px 20px;
  border-top: 1px solid rgba(245, 241, 232, 0.14);
}

.f-col h3 {
  margin: 0 0 12px;
  font-size: 20px;
}

.f-col h3 span {
  display: inline-block;
  padding-bottom: 2px;
  color: var(--cream);
  border-bottom: 3px solid var(--amber);
}

.f-col ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.f-col a {
  display: flex;
  align-items: center;
  min-height: 40px;
  font-size: 16px;
  color: var(--cream);
  opacity: 0.86;
  text-decoration: none;
  transition: opacity 0.16s ease, color 0.16s ease;
}

.f-col a:hover {
  opacity: 1;
  color: var(--amber);
}

.f-wordmark {
  font-family: "Cormorant", "Songti SC", Georgia, serif;
  font-size: 22px;
  letter-spacing: 0.06em;
  color: var(--amber);
}

.f-bar {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  border-top: 1px solid rgba(245, 241, 232, 0.18);
}

.copy {
  margin: 0;
  font-size: 16px;
  opacity: 0.72;
}

.totop {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 4px;
  color: var(--amber);
  font-size: 16px;
  text-decoration: none;
}

.totop:hover {
  text-decoration: underline;
}

@media (prefers-reduced-motion: no-preference) {
  .hero-inner {
    animation: rise 0.5s ease both;
  }

  .toc li {
    animation: rise 0.45s ease both;
  }

  .toc li:nth-child(1) {
    animation-delay: 0.05s;
  }

  .toc li:nth-child(2) {
    animation-delay: 0.09s;
  }

  .toc li:nth-child(3) {
    animation-delay: 0.13s;
  }

  .toc li:nth-child(4) {
    animation-delay: 0.17s;
  }

  .toc li:nth-child(5) {
    animation-delay: 0.21s;
  }

  .toc li:nth-child(6) {
    animation-delay: 0.25s;
  }

  .toc li:nth-child(7) {
    animation-delay: 0.29s;
  }

  .post section {
    animation: fade 0.4s ease both;
  }
}

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

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 900px) {
  .masthead {
    position: static;
  }

  .mainnav ol {
    justify-content: flex-start;
  }

  .shell {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 28px 16px 48px;
  }

  .toc ol {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .toc li {
    flex: 0 0 auto;
  }

  .toc a {
    min-height: 40px;
    padding: 0 14px;
    white-space: nowrap;
    border: 1px solid var(--line);
    border-radius: 999px;
  }

  .post section {
    padding: 20px 16px 6px;
    scroll-margin-top: 14px;
  }

  .site-footer {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .brand {
    font-size: 22px;
    letter-spacing: 0.05em;
  }

  .hero {
    min-height: 44vh;
    padding: 36px 16px 58px;
  }

  .f-cta {
    padding: 36px 18px;
  }

  .site-footer {
    grid-template-columns: 1fr;
  }

  .f-col {
    padding: 26px 18px;
  }
}

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