@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Manrope:wght@400;500;600;700&display=swap');

:root {
  --bg: #f6f4f2;
  --bg-soft: #efece8;
  --surface: #fffdfb;
  --ink: #1b1d22;
  --ink-soft: #55585f;
  --ink-faint: #83868d;
  --line: #e2ddd7;
  --accent: #565f83;
  --accent-soft: #e4e6ee;
  --sage: #6f7d70;
  --sage-soft: #e6eae5;
  --clay: #b0897f;
  --nav-bg: rgba(12, 17, 25, 0.88);
  --nav-line: rgba(255, 255, 255, 0.14);
  --radius: 12px;
  --wrap: 1180px;
  --read: 760px;
  --shadow-soft: 0 10px 30px rgba(27, 29, 34, 0.07);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Manrope', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

h1, h2, h3, h4, .display { font-family: 'Fraunces', Georgia, 'Times New Roman', serif; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }

/* ---------- top navigation ---------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 90;
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--nav-line);
  box-shadow: 0 6px 24px rgba(8, 12, 18, 0.28);
  color: #f4f2ef;
}
@supports not ((backdrop-filter: blur(4px)) or (-webkit-backdrop-filter: blur(4px))) {
  .site-nav { background: #0c1119; }
}
.site-nav .wrap { display: flex; align-items: center; gap: 18px; height: 64px; }
.brand {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: #fbf9f6;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.brand:hover { text-decoration: none; color: #ffffff; }
.brand i { color: #c8cddd; font-size: 18px; }
.nav-links { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav-links > a, .nav-drop > button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: #e6e6e6;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.nav-links > a:hover, .nav-drop > button:hover { background: rgba(255, 255, 255, 0.12); color: #fff; text-decoration: none; }
.nav-links > a:focus-visible, .nav-drop > button:focus-visible, .brand:focus-visible,
.nav-cta:focus-visible, .bar a:focus-visible, .bar button:focus-visible {
  outline: 2px solid #cdd3e6;
  outline-offset: 2px;
}
.nav-drop { position: relative; }
.nav-drop-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: 520px;
  max-height: 66vh;
  overflow-y: auto;
  padding: 14px;
  border-radius: var(--radius);
  background: rgba(12, 17, 25, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 22px 50px rgba(6, 9, 14, 0.45);
}
.nav-drop-panel ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.nav-drop-panel a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  color: #e3e4e8;
}
.nav-drop-panel a:hover { background: rgba(255, 255, 255, 0.12); color: #fff; text-decoration: none; }
.nav-drop-panel i { color: #a9b0c6; }
.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 999px;
  background: #f3efe9;
  color: #16181d;
  font-weight: 700;
  font-size: 13.5px;
  white-space: nowrap;
}
.nav-cta:hover { background: #ffffff; text-decoration: none; color: #101216; }

/* ---------- article layout ---------- */
.page-head { padding: 34px 0 10px; border-bottom: 1px solid var(--line); background: var(--bg); }
.crumbs { font-size: 12.5px; color: var(--ink-faint); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.crumbs a { color: var(--ink-soft); }
.eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft);
  padding: 5px 11px; border-radius: 999px; margin: 14px 0 12px;
}
.article-title { font-size: clamp(30px, 4.2vw, 46px); margin: 0 0 14px; max-width: 900px; }
.lede { font-size: 17.5px; color: var(--ink-soft); max-width: 760px; margin: 0 0 18px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 12.5px; color: var(--ink-faint); padding-bottom: 26px; }
.meta-row i { color: var(--sage); margin-right: 4px; }

.cover { margin: 0; padding: 0; background: var(--bg-soft); }
.cover img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: center; }
.cover figcaption { font-size: 12px; color: var(--ink-faint); padding: 8px 24px 0; max-width: var(--wrap); margin: 0 auto; }

.article-shell { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; padding: 34px 0 56px; }
@media (min-width: 1024px) {
  .article-shell { grid-template-columns: 240px minmax(0, 1fr); max-width: var(--wrap); }
}
.toc { display: none; }
@media (min-width: 1024px) {
  .toc { display: block; position: sticky; top: 88px; align-self: start; font-size: 13px; }
}
.toc h2 { font-family: 'Manrope', sans-serif; font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); margin: 0 0 10px; }
.toc ol { list-style: none; margin: 0; padding: 0 0 0 2px; border-left: 2px solid var(--line); }
.toc li a { display: block; padding: 6px 0 6px 12px; color: var(--ink-soft); line-height: 1.4; }
.toc li a:hover { color: var(--accent); text-decoration: none; border-left: 2px solid var(--accent); margin-left: -2px; }

.prose { max-width: var(--read); font-size: 16.5px; }
.prose h2 { font-size: 26px; margin: 44px 0 12px; scroll-margin-top: 88px; }
.prose h3 { font-size: 19px; margin: 26px 0 8px; scroll-margin-top: 88px; }
.prose p { margin: 0 0 16px; }
.prose ul, .prose ol { margin: 0 0 18px; padding-left: 22px; }
.prose li { margin-bottom: 8px; }
.prose strong { color: var(--ink); font-weight: 700; }
.prose h2:first-of-type { margin-top: 30px; }

.callout {
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 0 10px 10px 0;
  padding: 16px 18px;
  margin: 0 0 22px;
  font-size: 15px;
  color: var(--ink-soft);
}
.callout strong { color: var(--accent); }

.tbl-scroll { overflow-x: auto; margin: 0 0 22px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; min-width: 600px; font-size: 14px; }
caption { text-align: left; font-size: 12.5px; color: var(--ink-faint); padding: 10px 14px; border-bottom: 1px solid var(--line); }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f3f0ec; font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-soft); font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; }

.check { list-style: none; padding: 0 !important; margin: 0 0 22px; }
.check li { position: relative; padding: 9px 0 9px 30px; border-bottom: 1px dashed var(--line); font-size: 15px; }
.check li::before {
  content: "";
  position: absolute; left: 0; top: 14px;
  width: 15px; height: 15px; border-radius: 4px;
  border: 1.5px solid var(--accent); background: #fff;
}

.steps { counter-reset: s; list-style: none; padding: 0 !important; margin: 0 0 22px; }
.steps li { counter-increment: s; position: relative; padding-left: 40px; margin-bottom: 14px; }
.steps li::before {
  content: counter(s);
  position: absolute; left: 0; top: 1px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-size: 12.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.note-card {
  background: var(--sage-soft);
  border: 1px solid #d8ded6;
  border-radius: 10px;
  padding: 16px 18px;
  font-size: 14.5px;
  color: #40463f;
  margin: 0 0 22px;
}

.related { border-top: 1px solid var(--line); margin-top: 42px; padding-top: 26px; }
.related h2 { font-size: 21px; margin: 0 0 14px; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.related-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 14.5px;
  color: var(--ink);
  line-height: 1.45;
}
.related-card:hover { border-color: var(--accent); text-decoration: none; }
.related-card span { display: block; font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 6px; }
.back-home { display: inline-flex; align-items: center; gap: 8px; margin-top: 24px; font-weight: 600; font-size: 14.5px; }

/* ---------- footer ---------- */
.site-foot { background: #232a26; color: #d9dcd6; padding: 40px 0 30px; margin-top: 20px; }
.site-foot .wrap { display: grid; gap: 26px; grid-template-columns: 1fr; }
@media (min-width: 820px) { .site-foot .wrap { grid-template-columns: 1.4fr 1fr 1fr; } }
.site-foot h2 { font-size: 15px; margin: 0 0 10px; color: #f2f2ee; font-family: 'Manrope', sans-serif; letter-spacing: 0.02em; }
.site-foot p { font-size: 13px; color: #b6bab3; margin: 0 0 10px; }
.site-foot a { color: #dfe2db; font-size: 13px; }
.site-foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.foot-bottom { border-top: 1px solid rgba(255, 255, 255, 0.12); margin-top: 20px; padding-top: 16px; font-size: 12px; color: #9ba099; display: flex; flex-wrap: wrap; gap: 8px 18px; }

/* ---------- bottom bar + sheet ---------- */
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 95;
  display: flex; align-items: stretch;
  background: rgba(16, 21, 27, 0.95);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: env(safe-area-inset-bottom);
}
.bar a, .bar button {
  flex: 1 1 0; min-height: 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: transparent; border: 0; cursor: pointer;
  color: #cfd3d9; font-family: inherit; font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.02em; padding: 6px 2px; white-space: nowrap;
}
.bar i { font-size: 19px; }
.bar a:hover, .bar button:hover { color: #fff; text-decoration: none; background: rgba(255, 255, 255, 0.06); }
.bar .is-current { color: #fff; }
.bar .is-current i { color: #cdd3e6; }

.sheet-backdrop { position: fixed; inset: 0; z-index: 98; background: rgba(10, 13, 18, 0.55); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 99;
  max-height: 85dvh;
  display: flex; flex-direction: column;
  background: #fbf9f7;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -14px 40px rgba(8, 11, 16, 0.35);
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet-grip { width: 46px; height: 5px; border-radius: 999px; background: #d5d0c9; margin: 10px auto 2px; flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 18px 12px; border-bottom: 1px solid var(--line); flex: none; }
.sheet-head h2 { font-size: 18px; margin: 0; }
.sheet-close {
  width: 44px; height: 44px; flex: none;
  border-radius: 50%; border: 1px solid var(--line); background: #fff;
  font-size: 20px; line-height: 1; color: var(--ink); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 16px 26px; }
.sheet-body h3 { font-family: 'Manrope', sans-serif; font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); margin: 14px 4px 8px; }
.sheet-list { list-style: none; margin: 0; padding: 0; }
.sheet-list a { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 8px 10px; border-radius: 9px; font-size: 14.5px; color: var(--ink); }
.sheet-list a:hover { background: var(--bg-soft); text-decoration: none; }
.sheet-list i { color: var(--accent); font-size: 16px; }
.sheet-list .tag { margin-left: auto; font-size: 10.5px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; }

@media (max-width: 899px) {
  .nav-links { display: none; }
  .site-nav .wrap { height: 58px; gap: 10px; }
}
@media (min-width: 900px) {
  .bar { display: none; }
  body { padding-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}