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

:root {
  --cream: #fff9f2;
  --cream-100: #fbf2e9;
  --cream-200: #f3e7db;
  --cream-300: #e8d8c9;
  --ink: #1b1714;
  --ink-700: #443c37;
  --ink-500: #6b6058;
  --rose: #9c4f62;
  --rose-dark: #803f50;
  --rose-100: #f7e8ec;
  --peach: #e6b49b;
  --peach-100: #fbecdf;
  --sage: #7d8f72;
  --sage-100: #eaf0e4;
  --nav-bg: rgba(12, 17, 25, 0.88);
  --font-heading: 'Fraunces', Georgia, serif;
  --font-body: 'Manrope', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  padding-top: 64px;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

body.sheet-open {
  overflow: hidden;
}

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

a {
  color: var(--rose);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--rose-dark);
}

:focus-visible {
  outline: 2px solid var(--rose);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 200;
  background: #fff;
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 8px;
  transition: top 160ms ease;
}

.skip-link:focus {
  top: 12px;
}

/* ---------- header ---------- */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  height: 64px;
  z-index: 80;
  background: rgba(12, 17, 25, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 30px rgba(12, 17, 25, 0.18);
}

@supports ((-webkit-backdrop-filter: blur(16px)) or (backdrop-filter: blur(16px))) {
  .nav {
    background: var(--nav-bg);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    backdrop-filter: blur(16px) saturate(140%);
  }
}

.nav-inner {
  max-width: 1180px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fdf8f3;
  font-family: var(--font-heading);
  font-size: 21px;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.brand i {
  font-size: 19px;
  color: var(--peach);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  border-radius: 8px;
  color: rgba(255, 249, 242, 0.82);
  font-size: 14px;
  text-decoration: none;
  background: none;
  border: 0;
  font-family: var(--font-body);
  cursor: pointer;
  white-space: nowrap;
}

.nav-link:hover,
.nav-link:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  color: #fff9f2;
}

.nav-cta {
  margin-left: 8px;
  padding: 9px 16px;
  border-radius: 8px;
  background: var(--rose);
  color: #fff9f2;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.nav-cta:hover {
  background: var(--rose-dark);
  color: #fff9f2;
}

/* dropdown */
.dd {
  position: relative;
}

.dd-btn[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.12);
  color: #fff9f2;
}

.dd-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 460px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(12, 17, 25, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 24px 60px rgba(12, 17, 25, 0.5);
  display: none;
  z-index: 90;
}

@supports ((-webkit-backdrop-filter: blur(16px)) or (backdrop-filter: blur(16px))) {
  .dd-panel {
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
  }
}

.dd-panel.open {
  display: block;
  animation: fade 160ms ease-out both;
}

.dd-title {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 249, 242, 0.55);
  margin: 4px 6px 10px;
}

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

.dd-item {
  display: block;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13px;
  color: rgba(255, 249, 242, 0.86);
  text-decoration: none;
  white-space: nowrap;
}

.dd-item:hover,
.dd-item:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  color: #fff9f2;
}

/* ---------- layout ---------- */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-narrow {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px;
}

.crumb {
  padding: 26px 0 0;
  font-size: 13px;
  color: var(--ink-500);
}

.crumb a {
  color: var(--ink-700);
  text-decoration: none;
  border-bottom: 1px solid var(--cream-300);
}

.crumb a:hover {
  color: var(--rose);
  border-color: var(--rose);
}

.crumb span {
  margin: 0 8px;
  color: var(--cream-300);
}

.article-head {
  padding: 18px 0 30px;
  border-bottom: 1px solid var(--cream-200);
  margin-bottom: 34px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--rose-100);
  color: var(--rose-dark);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.article-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 40px;
  line-height: 1.16;
  letter-spacing: -0.02em;
  margin: 18px 0 14px;
}

.article-lead {
  font-size: 17.5px;
  line-height: 1.65;
  color: var(--ink-700);
  margin: 0 0 18px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 12.5px;
  color: var(--ink-500);
}

.meta-row i {
  color: var(--rose);
  margin-right: 5px;
}

/* ---------- prose ---------- */
.prose {
  padding-bottom: 10px;
}

.prose h2 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 25px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 42px 0 12px;
  padding-top: 6px;
}

.prose h2 .h2-num {
  display: inline-block;
  min-width: 30px;
  color: var(--peach);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.prose h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 18.5px;
  margin: 26px 0 8px;
}

.prose p {
  margin: 0 0 16px;
  color: var(--ink-700);
}

.prose strong {
  color: var(--ink);
  font-weight: 700;
}

.prose ul,
.prose ol {
  margin: 0 0 18px;
  padding-left: 22px;
  color: var(--ink-700);
}

.prose li {
  margin-bottom: 8px;
}

.prose li::marker {
  color: var(--rose);
}

.prose a {
  font-weight: 600;
}

.toc {
  background: var(--cream-100);
  border: 1px solid var(--cream-200);
  border-radius: 14px;
  padding: 18px 22px 20px;
  margin: 0 0 34px;
}

.toc p {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-500);
  font-weight: 700;
}

.toc ol {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.6;
}

.toc li {
  margin-bottom: 4px;
}

.toc a {
  color: var(--ink-700);
  text-decoration: none;
}

.toc a:hover {
  color: var(--rose);
  text-decoration: underline;
}

.table-wrap {
  margin: 0 0 22px;
  overflow-x: auto;
  border: 1px solid var(--cream-200);
  border-radius: 12px;
  background: #fffdfa;
}

table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 13.5px;
  line-height: 1.55;
}

th,
td {
  padding: 11px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--cream-200);
}

th {
  background: var(--cream-100);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-500);
  font-weight: 700;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

td strong {
  color: var(--ink);
}

.example {
  background: var(--peach-100);
  border-left: 3px solid var(--peach);
  border-radius: 0 10px 10px 0;
  padding: 16px 20px;
  margin: 0 0 22px;
  font-size: 14.5px;
}

.example p:last-child {
  margin-bottom: 0;
}

.example .tag {
  display: inline-block;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: #8a5a3d;
  margin-bottom: 6px;
}

.checklist {
  list-style: none;
  padding: 0;
  margin: 0 0 22px;
  border: 1px solid var(--cream-200);
  border-radius: 12px;
  overflow: hidden;
  background: #fffdfa;
}

.checklist li {
  margin: 0;
  padding: 11px 16px 11px 42px;
  position: relative;
  border-bottom: 1px solid var(--cream-200);
  font-size: 14.5px;
  color: var(--ink-700);
}

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

.checklist li::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 17px;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--cream-300);
  border-radius: 4px;
  background: #fff;
}

.note {
  font-size: 13.5px;
  color: var(--ink-500);
  border-top: 1px dashed var(--cream-300);
  padding-top: 14px;
  margin-top: 26px;
}

.article-end {
  margin-top: 40px;
  padding: 22px 24px;
  border-radius: 14px;
  background: var(--cream-100);
  border: 1px solid var(--cream-200);
}

.article-end p {
  margin: 0 0 12px;
  font-size: 14.5px;
  color: var(--ink-700);
}

.back-home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  background: var(--rose);
  color: #fff9f2;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.back-home:hover {
  background: var(--rose-dark);
  color: #fff9f2;
}

/* ---------- related ---------- */
.related {
  margin: 46px 0 60px;
  padding-top: 30px;
  border-top: 1px solid var(--cream-200);
}

.related h2 {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 18px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.rcard {
  display: block;
  padding: 18px;
  border-radius: 12px;
  background: #fffdfa;
  border: 1px solid var(--cream-200);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 160ms ease, transform 160ms ease;
}

.rcard:hover {
  border-color: var(--peach);
  transform: translateY(-2px);
  color: var(--ink);
}

.rcard .rcard-num {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--rose);
  font-weight: 700;
}

.rcard h3 {
  font-family: var(--font-heading);
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.35;
  margin: 6px 0 8px;
}

.rcard p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-500);
}

/* ---------- footer ---------- */
.footer {
  background: var(--cream-100);
  border-top: 1px solid var(--cream-200);
  padding: 40px 0 96px;
}

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

.footer-top {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--cream-200);
}

.footer-brand {
  font-family: var(--font-heading);
  font-size: 20px;
  color: var(--ink);
  text-decoration: none;
}

.footer-brand i {
  color: var(--rose);
  margin-right: 6px;
}

.footer-note {
  max-width: 520px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-500);
  margin: 8px 0 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 13.5px;
}

.footer-links a {
  color: var(--ink-700);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--rose);
  text-decoration: underline;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  justify-content: space-between;
  padding-top: 18px;
  font-size: 12px;
  color: var(--ink-500);
}

/* ---------- mobile tabbar + sheet ---------- */
.tabbar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 85;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  background: rgba(12, 17, 25, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: env(safe-area-inset-bottom);
}

.tab {
  flex: 1 1 0;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  background: none;
  border: 0;
  color: rgba(255, 249, 242, 0.72);
  font-family: var(--font-body);
  font-size: 11px;
  text-decoration: none;
  cursor: pointer;
}

.tab i {
  font-size: 20px;
}

.tab:hover,
.tab:focus-visible,
.tab[aria-expanded="true"] {
  color: #fff9f2;
  background: rgba(255, 255, 255, 0.06);
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
}

.sheet.open {
  display: block;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 17, 25, 0.55);
  border: 0;
  padding: 0;
  animation: fade 200ms ease-out both;
}

.sheet-panel {
  position: absolute;
  inset: auto 0 0 0;
  max-height: 85dvh;
  display: flex;
  flex-direction: column;
  background: var(--cream);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -18px 50px rgba(12, 17, 25, 0.32);
  animation: slide 280ms cubic-bezier(0.22, 1, 0.36, 1) both;
  padding-bottom: env(safe-area-inset-bottom);
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.sheet-handle {
  width: 44px;
  height: 4px;
  border-radius: 999px;
  background: var(--cream-300);
  margin: 10px auto 0;
  flex: 0 0 auto;
}

.sheet-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px 12px 22px;
  border-bottom: 1px solid var(--cream-200);
  flex: 0 0 auto;
}

.sheet-head h2 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  flex: 1;
}

.sheet-close {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 999px;
  border: 1px solid var(--cream-300);
  background: #fff;
  color: var(--ink-700);
  font-size: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sheet-close:hover {
  background: var(--cream-100);
}

.sheet-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 18px 24px;
}

.sheet-group-title {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-500);
  font-weight: 700;
  margin: 16px 4px 8px;
}

.sheet-group-title:first-child {
  margin-top: 0;
}

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

.sheet-list li {
  margin: 0;
}

.sheet-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 9px;
  color: var(--ink-700);
  font-size: 14px;
  line-height: 1.4;
  text-decoration: none;
}

.sheet-list a:hover,
.sheet-list a:focus-visible {
  background: var(--cream-100);
  color: var(--rose);
}

.sheet-list a i {
  color: var(--peach);
  font-size: 16px;
}

.sheet-list a .num {
  font-size: 11px;
  color: var(--rose);
  font-weight: 700;
  min-width: 18px;
}

.sheet-list a .ext {
  margin-left: auto;
  color: var(--ink-500);
  font-size: 13px;
}

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

@keyframes slide {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .nav-inner {
    padding: 0 16px;
    gap: 12px;
  }
  .nav-links .nav-link,
  .nav-cta {
    display: none;
  }
  .nav-links .dd {
    display: none;
  }
  .article-title {
    font-size: 30px;
  }
  .article-lead {
    font-size: 16px;
  }
  .container,
  .container-narrow {
    padding: 0 18px;
  }
  .related-grid {
    grid-template-columns: 1fr;
  }
  .prose h2 {
    font-size: 22px;
    margin-top: 34px;
  }
  .footer {
    padding-bottom: 92px;
  }
}

@media (max-width: 480px) {
  .article-title {
    font-size: 26px;
  }
  .toc {
    padding: 16px 16px 18px;
  }
}

@media (min-width: 901px) {
  .tabbar {
    display: none;
  }
  .footer {
    padding-bottom: 40px;
  }
}

@media (orientation: landscape) and (max-height: 480px) {
  .sheet-panel {
    max-height: 88dvh;
  }
  .sheet-head {
    position: sticky;
    top: 0;
    background: var(--cream);
    z-index: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .sheet-panel,
  .sheet-backdrop,
  .dd-panel.open {
    animation: none !important;
  }
  .rcard {
    transition: none;
  }
}