@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400..800;1,9..144,400..700&family=DM+Sans:ital,opsz,wght@0,9..40,300..700;1,9..40,300..700&display=swap');

:root {
  --cream: #fff9f2;
  --card: #fffdfa;
  --ink: #221815;
  --ink-soft: #4a3b36;
  --muted: #7a6a63;
  --line: #eee3d8;
  --line-soft: #f4ece3;
  --rose: #9c4f62;
  --rose-dark: #7f3d4e;
  --rose-soft: #f7e6e3;
  --peach: #f8e7da;
  --sage: #e9eee5;
  --dark: rgba(12, 17, 25, 0.9);
  --font-head: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}

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

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

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

.wrap {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px;
}

@media (min-width: 768px) {
  .wrap { padding: 0 32px; }
}

/* ---------- navigation ---------- */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  background: var(--dark);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 10px 30px rgba(8, 12, 18, 0.28);
  color: #fdf7f1;
}

@supports not ((-webkit-backdrop-filter: blur(2px)) or (backdrop-filter: blur(2px))) {
  .nav { background: #0c1119; }
}

.nav-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff9f2;
  font-family: var(--font-head);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand:hover { color: #fff; }

.mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 7px;
  background: var(--rose);
  color: #fff9f2;
  font-size: 15px;
  font-weight: 600;
}

.nav-links {
  display: none;
  align-items: center;
  gap: 2px;
}

.nav-links > a,
.dd-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 249, 242, 0.86);
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.nav-links > a:hover,
.dd-btn:hover,
.dd-btn[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.nav-cta {
  display: none;
  align-items: center;
  height: 38px;
  padding: 0 16px;
  border-radius: 6px;
  background: #f3d3cb;
  color: #241419;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.nav-cta:hover { background: #f8e2dc; color: #241419; }

.dd { position: relative; }

.dd-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: 360px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(12, 17, 25, 0.98);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.dd-panel[hidden] { display: none; }

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

.dd-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  max-height: 320px;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dd-grid a {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  color: rgba(255, 249, 242, 0.86);
  font-size: 14px;
}

.dd-grid a:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

@media (min-width: 992px) {
  .nav-links { display: flex; }
  .nav-cta { display: inline-flex; }
}

/* ---------- article shell ---------- */
main { padding-top: 64px; }

.crumbs {
  padding: 18px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.crumbs a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.crumbs a:hover { color: var(--rose); }
.crumbs span { color: var(--ink-soft); }

.post {
  max-width: 760px;
  margin: 0 auto;
  padding: 10px 0 8px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--sage);
  color: #4d5a45;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.post h1 {
  margin: 14px 0 0;
  font-family: var(--font-head);
  font-size: 29px;
  line-height: 1.18;
  font-weight: 600;
  letter-spacing: -0.015em;
}

@media (min-width: 768px) {
  .post h1 { font-size: 38px; }
}

.lead {
  margin: 14px 0 0;
  padding-left: 14px;
  border-left: 3px solid var(--rose);
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin: 18px 0 6px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.toc {
  margin: 20px 0 6px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}

.toc h2 {
  margin: 0 0 8px;
  border: 0;
  padding: 0;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: var(--font-body);
}

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

.toc a { color: var(--ink-soft); }
.toc a:hover { color: var(--rose); }

.post h2 {
  margin: 34px 0 0;
  font-family: var(--font-head);
  font-size: 22px;
  line-height: 1.28;
  font-weight: 600;
  scroll-margin-top: 88px;
}

@media (min-width: 768px) {
  .post h2 { font-size: 25px; }
}

.post h3 {
  margin: 22px 0 0;
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 600;
}

.post p { margin: 12px 0 0; }

.post ul,
.post ol { margin: 12px 0 0; padding-left: 20px; }

.post li { margin-top: 6px; }

.post strong { font-weight: 600; color: var(--ink); }

.note {
  margin: 18px 0 0;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 14px;
  color: var(--ink-soft);
}

.note b { color: var(--ink); }

.note--rose { background: var(--rose-soft); border-color: #eed6d1; }

/* tables */
.table-scroll {
  margin: 18px 0 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 13px;
}

caption {
  caption-side: top;
  padding: 10px 12px;
  text-align: left;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line-soft);
}

th, td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}

th {
  font-weight: 600;
  color: var(--ink);
  background: #fbf3ea;
  font-size: 12px;
  letter-spacing: 0.02em;
}

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

/* checklist */
.checklist {
  margin: 18px 0 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  list-style: none;
}

.checklist li {
  position: relative;
  margin: 0;
  padding: 7px 0 7px 26px;
  border-bottom: 1px dashed var(--line);
  font-size: 13.5px;
  color: var(--ink-soft);
}

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

.checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  width: 13px;
  height: 13px;
  border: 1.5px solid #c9b7ac;
  border-radius: 3px;
  background: #fff;
}

/* related */
.related {
  max-width: 760px;
  margin: 30px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

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

.rel-grid {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 700px) {
  .rel-grid { grid-template-columns: repeat(3, 1fr); }
}

.rel-grid a {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.45;
}

.rel-grid a:hover { border-color: #dcc4bd; background: #fff; color: var(--ink); }

.rel-grid .rel-no {
  font-family: var(--font-head);
  font-size: 11px;
  color: #b09c93;
  letter-spacing: 0.08em;
}

.back-home {
  max-width: 760px;
  margin: 22px auto 0;
}

.back-home a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 6px;
  background: var(--rose);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

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

/* footnote / sources */
.sources {
  max-width: 760px;
  margin: 26px auto 0;
  padding: 14px 16px;
  border-radius: 8px;
  background: #f6efe6;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}

.sources b { color: var(--ink-soft); }

/* footer */
.site-footer {
  margin-top: 40px;
  background: #37202a;
  color: #f6e9e2;
}

.foot-in {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 28px;
  padding-bottom: 26px;
}

.foot-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
}

.foot-links a { color: #f6e9e2; }
.foot-links a:hover { color: #f3d3cb; }

.foot-note {
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 11.5px;
  line-height: 1.7;
  color: rgba(246, 233, 226, 0.66);
}

/* ---------- mobile bar + sheet ---------- */
.mbar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  background: rgba(255, 253, 250, 0.97);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  padding-bottom: env(safe-area-inset-bottom);
}

.mbar a,
.mbar button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 56px;
  padding: 8px 2px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 10.5px;
  cursor: pointer;
}

.mbar i { font-size: 18px; }

.mbar a:hover,
.mbar button:hover { color: var(--rose); }

@media (min-width: 992px) {
  .mbar { display: none; }
  body { padding-bottom: 0; }
}

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

.sheet-overlay.is-open { display: block; }

.sheet-scrim {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: rgba(27, 16, 19, 0.55);
  cursor: pointer;
}

.sheet {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  flex-direction: column;
  max-height: 85dvh;
  border-radius: 16px 16px 0 0;
  border: 1px solid var(--line);
  background: var(--cream);
  padding-bottom: env(safe-area-inset-bottom);
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.sheet-overlay.is-open .sheet { transform: translateY(0); }

.sheet-grip {
  display: flex;
  justify-content: center;
  padding-top: 10px;
}

.sheet-grip span {
  width: 40px;
  height: 6px;
  border-radius: 999px;
  background: #ddcabd;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 16px 8px;
}

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

.sheet-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  font-size: 18px;
  cursor: pointer;
}

.sheet-body {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 16px 20px;
}

.sheet-cats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sheet-cats a {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 12.5px;
  word-break: break-word;
}

.sheet-arts {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}

.sheet-arts a {
  display: flex;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.4;
}

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

.sheet-no {
  font-family: var(--font-head);
  font-size: 11px;
  color: #b09c93;
}

.sheet-hint {
  margin: 12px 0 0;
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
}

.sr-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 99;
  padding: 10px 14px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
}

.sr-skip:focus { left: 8px; top: 8px; }

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