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

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

:root {
  --bg: #FAF6EC;
  --bg-2: #F4EEE1;
  --bg-3: #EFE7D6;
  --white: #FFFDF7;
  --ink: #24211C;
  --ink-2: #4E493F;
  --ink-3: #6E675B;
  --jade: #3D6554;
  --jade-dark: #2C4C3F;
  --jade-pale: #E6EEE8;
  --tea: #8A6A4F;
  --tea-dark: #74563E;
  --line: #E2DAC7;
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

[id] { scroll-margin-top: 92px; }

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

a { color: var(--jade); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* ---------- Navigation ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(12, 17, 25, 0.88);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid rgba(250, 246, 236, 0.12);
  box-shadow: 0 10px 30px rgba(12, 17, 25, 0.18);
}

@supports not ((backdrop-filter: blur(4px)) or (-webkit-backdrop-filter: blur(4px))) {
  .topbar, .panel { background: #0e141c; }
}

.topbar-in {
  max-width: 1180px;
  margin: 0 auto;
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1;
  color: #F8F3E7;
  text-decoration: none;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--jade);
  color: #F8F3E7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.topnav { display: flex; align-items: center; gap: 4px; }

.topnav a, .topnav button {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(248, 243, 231, 0.85);
  font-family: var(--sans);
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s, color 0.2s;
}

.topnav a:hover, .topnav button:hover,
.topnav a:focus-visible, .topnav button:focus-visible {
  background: rgba(248, 243, 231, 0.1);
  color: #FFFFFF;
  outline: none;
}

.navbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--tea);
  color: #FBF7EC !important;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 6px;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s;
}

.navbtn:hover { background: var(--tea-dark); }

/* ---------- Dock ---------- */
.dock { display: none; }

@media (max-width: 860px) {
  .topnav { display: none; }
  .navbtn { display: none; }
  .topbar-in { padding: 0 18px; }
  body { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }

  .dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: rgba(12, 17, 25, 0.94);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-top: 1px solid rgba(250, 246, 236, 0.12);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .dock a, .dock button {
    appearance: none;
    border: 0;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 58px;
    color: rgba(248, 243, 231, 0.8);
    font-family: var(--sans);
    font-size: 11px;
    text-decoration: none;
    cursor: pointer;
  }

  .dock i { font-size: 19px; }
  .dock a:hover, .dock button:hover { color: #FFFFFF; }
}

/* ---------- Panel / sheet ---------- */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(12, 17, 25, 0.55);
  border: 0;
  padding: 0;
  cursor: pointer;
}

.panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 61;
  max-height: 85dvh;
  display: flex;
  flex-direction: column;
  background: rgba(12, 17, 25, 0.96);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(250, 246, 236, 0.14);
  border-radius: 14px 14px 0 0;
  padding-bottom: env(safe-area-inset-bottom);
  color: #F8F3E7;
}

.panel-grip { width: 40px; height: 4px; border-radius: 2px; background: rgba(248, 243, 231, 0.3); margin: 10px auto 0; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px 8px;
  flex: 0 0 auto;
}

.panel-head h2 { font-family: var(--serif); font-size: 20px; margin: 0; color: #F8F3E7; font-weight: 600; }

.panel-close {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 0;
  background: rgba(248, 243, 231, 0.12);
  color: #F8F3E7;
  font-size: 17px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.panel-close:hover { background: rgba(248, 243, 231, 0.22); }

.panel-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 14px 22px; }

.panel h3 {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #B7CCC0;
  margin: 14px 8px 6px;
  font-weight: 600;
}

.panel ul { list-style: none; margin: 0; padding: 0; }

.panel .cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }

.panel .cat-grid a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  color: rgba(248, 243, 231, 0.88);
  text-decoration: none;
  font-size: 13px;
  line-height: 1.35;
}

.panel .art-list a {
  display: flex;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 6px;
  color: rgba(248, 243, 231, 0.86);
  text-decoration: none;
  font-size: 13px;
  line-height: 1.45;
}

.panel .art-list a span.num { color: #D3B394; font-size: 11px; padding-top: 2px; flex: 0 0 auto; }

.panel a:hover, .panel a:focus-visible { background: rgba(248, 243, 231, 0.1); color: #FFFFFF; outline: none; }

.panel .note { font-size: 11px; color: rgba(248, 243, 231, 0.55); padding: 8px 10px 0; margin: 0; }

@media (min-width: 861px) {
  .scrim { display: none; }
  .panel {
    top: 64px;
    bottom: auto;
    left: 0;
    right: 0;
    max-width: 1120px;
    margin: 0 auto;
    max-height: 74vh;
    border-radius: 0 0 12px 12px;
  }
  .panel-grip { display: none; }
  .panel .cat-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Article ---------- */
.crumbs { padding: 18px 24px 0; font-size: 12px; color: var(--ink-3); }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.crumbs a { color: var(--jade); text-decoration: none; border-bottom: 1px solid rgba(61, 101, 84, 0.32); }
.crumbs a:hover { border-bottom-color: var(--jade); }
.crumbs .sep { color: #B4AC9B; }

.article { max-width: 760px; margin: 0 auto; padding: 6px 24px 8px; }

.kicker {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--tea);
  font-weight: 600;
  margin: 14px 0 0;
}

.article h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 38px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 10px 0 14px;
  color: var(--ink);
}

.lede { font-size: 16px; line-height: 1.68; color: var(--ink-2); margin: 0 0 16px; }

.artmeta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 11.5px;
  color: var(--ink-3);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  margin-bottom: 22px;
}

.artmeta span { display: inline-flex; align-items: center; gap: 5px; }

.toc {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 18px;
  margin: 0 0 24px;
}

.toc p {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tea);
  font-weight: 600;
}

.toc ol { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.8; color: var(--ink-2); }
.toc a { color: var(--jade-dark); text-decoration: none; border-bottom: 1px solid rgba(61, 101, 84, 0.25); }
.toc a:hover { border-bottom-color: var(--jade-dark); }

.prose h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 25px;
  line-height: 1.25;
  margin: 32px 0 10px;
  color: var(--ink);
}

.prose h3 { font-size: 14.5px; font-weight: 700; margin: 22px 0 6px; color: var(--ink); }
.prose p { margin: 0 0 14px; font-size: 15px; line-height: 1.78; color: #312D27; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 20px; font-size: 15px; line-height: 1.75; }
.prose li { margin-bottom: 6px; }
.prose strong { font-weight: 700; color: #1D1A15; }
.prose em { color: var(--ink-2); }
.prose a { color: var(--jade-dark); text-decoration: none; border-bottom: 1px solid rgba(61, 101, 84, 0.35); }
.prose a:hover { border-bottom-color: var(--jade-dark); color: var(--jade); }

.prose h2, .prose h3 { scroll-margin-top: 92px; }

.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 18px 0 10px; border: 1px solid var(--line); border-radius: 8px; }

table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 13px; background: var(--white); }

caption { caption-side: top; text-align: left; font-size: 11.5px; color: var(--ink-3); padding: 8px 12px 6px; }

th {
  background: var(--jade);
  color: #FAF6EC;
  text-align: left;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 600;
  vertical-align: bottom;
}

td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: top; color: var(--ink-2); }
tbody tr:nth-child(even) { background: #F8F3E7; }
td strong { color: var(--ink); }

.callout {
  background: var(--jade-pale);
  border-left: 3px solid var(--jade);
  border-radius: 0 8px 8px 0;
  padding: 12px 16px;
  margin: 18px 0;
  font-size: 13.5px;
  line-height: 1.7;
  color: #2B3B32;
}

.callout strong { color: #1E2A23; }
.callout p:last-child { margin-bottom: 0; }

.check { list-style: none; padding: 0; margin: 16px 0; }
.check li { position: relative; padding-left: 26px; margin-bottom: 8px; font-size: 14px; line-height: 1.65; color: #312D27; }
.check li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  width: 13px;
  height: 13px;
  border: 1.5px solid var(--jade);
  border-radius: 2px;
}

.steps { counter-reset: s; list-style: none; padding: 0; margin: 16px 0; }
.steps li { counter-increment: s; position: relative; padding-left: 34px; margin-bottom: 10px; font-size: 14.5px; line-height: 1.7; }
.steps li::before {
  content: counter(s, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--jade);
  border: 1px solid rgba(61, 101, 84, 0.35);
  border-radius: 4px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.article-foot {
  margin: 28px 0 0;
  padding: 18px 0 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-2);
}

.related { max-width: 760px; margin: 8px auto 40px; padding: 0 24px; }

.related h2 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  margin: 24px 0 12px;
  color: var(--ink);
}

.related ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.related a {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  text-decoration: none;
  font-size: 13.5px;
  line-height: 1.5;
  transition: border-color 0.2s, background-color 0.2s;
}

.related a:hover { border-color: var(--jade); background: var(--jade-pale); }
.related a i { color: var(--jade); font-size: 15px; margin-top: 1px; }

.backhome {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  margin-top: 16px;
  padding: 0 16px;
  border-radius: 6px;
  background: var(--jade);
  color: #FAF6EC;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.backhome:hover { background: var(--jade-dark); }

/* ---------- Footer ---------- */
.sitefoot { background: #34594A; color: #E9E3D4; margin-top: 20px; }

.footin {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: space-between;
  padding-top: 28px;
  padding-bottom: 22px;
}

.brand-foot { font-family: var(--serif); font-size: 20px; color: #FAF6EC; text-decoration: none; }
.sitefoot p { margin: 8px 0 0; font-size: 12.5px; line-height: 1.7; color: rgba(233, 227, 212, 0.78); max-width: 460px; }

.footlinks { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; }
.footlinks a { color: rgba(233, 227, 212, 0.85); text-decoration: none; }
.footlinks a:hover { color: #FFFFFF; text-decoration: underline; }

.footbot {
  border-top: 1px solid rgba(250, 246, 236, 0.18);
  padding-top: 14px;
  padding-bottom: 22px;
  font-size: 11px;
  color: rgba(233, 227, 212, 0.6);
}

@media (min-width: 861px) {
  .footbot { padding-bottom: 20px; }
}

@media (max-width: 860px) {
  .article h1 { font-size: 30px; }
  .article { padding: 4px 18px 8px; }
  .crumbs { padding: 14px 18px 0; }
  .related { padding: 0 18px; margin-bottom: 32px; }
  .wrap { padding: 0 18px; }
  .lede { font-size: 15px; }
  .footin { flex-direction: column; }
  .sitefoot { margin-bottom: 0; }
}

@media (max-width: 420px) {
  .panel .cat-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; }
}