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

:root {
  --bg: #f6f4f2;
  --bg-2: #efece8;
  --bg-3: #e6e1db;
  --line: #ddd7d1;
  --ink: #1c2027;
  --muted: #5c6069;
  --primary: #565f83;
  --primary-dark: #444c6c;
  --primary-soft: #eceef3;
  --sage: #9aa88f;
  --sage-soft: #eaeee4;
  --clay: #c9b7b3;
  --clay-soft: #f2e9e6;
  --olive: #39412f;
  --font-heading: 'Fraunces', Georgia, serif;
  --font-body: 'Karla', system-ui, sans-serif;
}

* { box-sizing: border-box; }

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

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

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

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 200;
  background: #fff;
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 8px;
}
.skip-link:focus { left: 12px; }

/* ---------- header ---------- */
.site-head {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 60;
  background: rgba(12, 17, 25, 0.88);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
  .site-head { background: #0c1119; }
}
.head-in {
  max-width: 1180px;
  margin: 0 auto;
  height: 60px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-decoration: none;
  font-family: var(--font-heading);
  font-size: 20px;
  letter-spacing: -0.01em;
}
.logo:hover { color: #fff; }
.logo .mark {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.14);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.head-nav { display: none; align-items: center; gap: 2px; }
.head-nav a {
  color: #dfe3ea;
  text-decoration: none;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 6px;
}
.head-nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }
.head-nav a.shop-link {
  background: #fff;
  color: #14181f;
  font-weight: 600;
  margin-left: 8px;
  white-space: nowrap;
}
.head-nav a.shop-link:hover { background: #eceae6; color: #14181f; }
.menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.menu-btn:hover { background: rgba(255, 255, 255, 0.1); }
a:focus-visible, button:focus-visible {
  outline: 2px solid #8e97b8;
  outline-offset: 2px;
}

@media (min-width: 860px) {
  .head-in { height: 72px; padding: 0 24px; }
  .head-nav { display: flex; }
  .menu-btn { display: none; }
}

/* ---------- layout ---------- */
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 84px 16px 0;
}
@media (min-width: 860px) {
  .page { padding: 104px 24px 0; }
}
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
}
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--primary); text-decoration: underline; }
.crumbs span[aria-hidden] { color: #b6aea6; }

.post { max-width: 760px; }
.kicker {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--primary);
  margin: 0 0 8px;
}
h1 {
  font-family: var(--font-heading);
  font-size: 30px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
}
@media (min-width: 768px) {
  h1 { font-size: 40px; }
}
.lede {
  font-size: 16px;
  color: #3d424b;
  margin: 0 0 18px;
}
@media (min-width: 768px) {
  .lede { font-size: 17px; }
}
.cover {
  margin: 0 0 22px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-2);
}
.cover img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 12px;
  color: var(--muted);
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}
h2 {
  font-family: var(--font-heading);
  font-size: 22px;
  line-height: 1.3;
  font-weight: 600;
  margin: 32px 0 10px;
}
h3 {
  font-family: var(--font-heading);
  font-size: 18px;
  margin: 22px 0 8px;
  font-weight: 600;
}
p { margin: 0 0 14px; }
ul, ol { margin: 0 0 16px; padding-left: 20px; }
li { margin-bottom: 7px; }
strong { font-weight: 700; }

.toc {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 0 0 26px;
}
.toc p {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}
.toc ol { margin: 0; padding-left: 18px; font-size: 14px; }
.toc li { margin-bottom: 4px; }

.callout {
  border-left: 3px solid var(--primary);
  background: var(--primary-soft);
  border-radius: 0 8px 8px 0;
  padding: 12px 16px;
  margin: 0 0 20px;
  font-size: 14px;
}
.callout.sage { border-color: var(--sage); background: var(--sage-soft); }
.callout.clay { border-color: #a9908b; background: var(--clay-soft); }
.callout p:last-child { margin-bottom: 0; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  margin: 0 0 20px;
}
table { border-collapse: collapse; width: 100%; min-width: 520px; font-size: 13px; }
caption {
  caption-side: top;
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
th, td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { background: var(--bg-2); font-weight: 600; font-size: 12px; }
tbody tr:last-child td { border-bottom: none; }
td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }

.checklist {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.checklist li {
  display: flex;
  gap: 10px;
  margin: 0;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.checklist li:last-child { border-bottom: none; }
.checklist i { color: var(--primary); font-size: 15px; line-height: 1.5; }

.example-label {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: var(--clay-soft);
  color: #6b5450;
  border-radius: 999px;
  padding: 2px 8px;
  margin-bottom: 8px;
}

.related {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.related h2 { font-size: 20px; margin-top: 0; }
.related ul { list-style: none; padding: 0; display: grid; gap: 8px; }
@media (min-width: 700px) {
  .related ul { grid-template-columns: repeat(3, 1fr); }
}
.related li { margin: 0; }
.related a {
  display: block;
  height: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  text-decoration: none;
  font-size: 14px;
  color: var(--ink);
}
.related a:hover { border-color: #b3b9cd; }
.related a span {
  display: block;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.back-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 24px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}
.back-home:hover { background: var(--primary-dark); color: #fff; }

.author-note {
  margin-top: 28px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px dashed var(--line);
  padding-top: 14px;
}

/* ---------- footer ---------- */
.site-foot { margin-top: 56px; background: var(--olive); color: #e9ebe3; }
.foot-in {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 16px;
  display: grid;
  gap: 22px;
}
@media (min-width: 760px) {
  .foot-in { grid-template-columns: 1.5fr 1fr 1fr; padding: 36px 24px; }
}
.site-foot .brand { font-family: var(--font-heading); font-size: 22px; color: #fff; margin: 0 0 8px; }
.site-foot p { font-size: 13px; color: #cdd2c3; margin: 0 0 10px; }
.site-foot h2 {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #a9b19b;
  margin: 0 0 10px;
}
.site-foot ul { list-style: none; padding: 0; margin: 0; }
.site-foot li { margin-bottom: 6px; }
.site-foot a { color: #eef0e8; text-decoration: none; font-size: 13px; }
.site-foot a:hover { color: #fff; text-decoration: underline; }
.foot-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 11px;
  color: #a9b19b;
}
.foot-bottom div {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 16px 90px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  justify-content: space-between;
}
@media (min-width: 860px) {
  .foot-bottom div { padding: 14px 24px; }
}

/* ---------- injected mobile dock + sheet ---------- */
.dock {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 55;
  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(255, 255, 255, 0.1);
  padding-bottom: env(safe-area-inset-bottom);
}
.dock a, .dock button {
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: 0;
  color: #dfe3ea;
  font: inherit;
  font-size: 11px;
  text-decoration: none;
  cursor: pointer;
}
.dock a:hover, .dock button:hover { color: #fff; }
.dock i { font-size: 18px; }
@media (min-width: 860px) { .dock { display: none; } }

.sheet-open { overflow: hidden; }
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(15, 19, 26, 0.55);
  display: flex;
  align-items: flex-end;
}
.sheet {
  width: 100%;
  max-height: 85dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: 14px 14px 0 0;
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet-top { padding: 10px 16px 0; display: flex; align-items: center; justify-content: center; }
.sheet-handle { width: 40px; height: 4px; border-radius: 999px; background: #cdc5bd; }
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
}
.sheet-title { font-family: var(--font-heading); font-size: 18px; margin: 0; }
.sheet-tabs { display: inline-flex; gap: 4px; background: var(--bg-2); border-radius: 999px; padding: 4px; }
.sheet-tabs button {
  border: 0;
  background: none;
  font: inherit;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
}
.sheet-tabs button[aria-selected="true"] { background: var(--primary); color: #fff; }
.sheet-close {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: none;
  font-size: 20px;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
}
.sheet-close:hover { background: var(--bg-2); }
.sheet-body { overflow-y: auto; padding: 4px 16px 20px; }
.sheet-body p { font-size: 12px; color: var(--muted); }
.cat-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cat-grid a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink);
  text-decoration: none;
}
.cat-grid a:hover { border-color: #b3b9cd; color: var(--primary); }
.sheet-list { list-style: none; padding: 0; margin: 0; }
.sheet-list a {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  min-height: 44px;
  padding: 8px 6px;
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.sheet-list a:hover { color: var(--primary); }
.sheet-list em { font-style: normal; font-size: 11px; color: var(--muted); min-width: 18px; }

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