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

:root {
  --cream: #FAF6EC;
  --cream-2: #F4EDDF;
  --card: #FFFDF8;
  --ink: #1B1A17;
  --ink-2: #4E4A42;
  --ink-3: #7B756A;
  --jade: #3D6554;
  --jade-dark: #2F5041;
  --jade-soft: #E8F0EA;
  --tea: #8A6F4E;
  --tea-soft: #F0E7D8;
  --line: rgba(27, 26, 23, 0.12);
  --line-soft: rgba(27, 26, 23, 0.07);
  --nav-dark: rgba(12, 17, 25, 0.88);
  --font-heading: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --head-h: 64px;
}

* { box-sizing: border-box; }

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

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

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: var(--font-body); cursor: pointer; }

a:focus-visible,
button:focus-visible {
  outline: 2px solid #6E9A82;
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- header ---------- */
.site-head {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 90;
  background: var(--nav-dark);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 8px 30px rgba(8, 12, 18, 0.22);
}

@supports not (backdrop-filter: blur(4px)) {
  .site-head { background: #0e131b; }
}

.head-inner {
  max-width: 1180px;
  margin: 0 auto;
  min-height: var(--head-h);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  font-family: var(--font-heading);
  font-size: 26px;
  letter-spacing: 0.02em;
  color: #FAF6EC;
  flex: none;
  line-height: 1;
}

.brand span { color: #A9C4B4; }

.head-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-wrap: wrap;
}

.head-nav a,
.head-nav button {
  color: rgba(250, 246, 236, 0.82);
  background: none;
  border: 0;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 8px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.head-nav a:hover,
.head-nav button:hover,
.head-nav a:focus-visible,
.head-nav button:focus-visible {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.1);
}

.head-cta {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--jade);
  color: #FAF6EC;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 6px;
  white-space: nowrap;
  transition: background-color 0.2s ease;
}

.head-cta:hover { background: var(--jade-dark); color: #fff; }

.head-burger {
  display: none;
  margin-left: auto;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  color: #FAF6EC;
  font-size: 20px;
}

/* ---------- category dropdown ---------- */
.cat-panel {
  position: absolute;
  top: calc(var(--head-h) + 8px);
  right: max(24px, calc((100vw - 1180px) / 2));
  width: min(560px, calc(100vw - 32px));
  background: #111721;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 24px 60px rgba(6, 10, 16, 0.45);
}

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

.cat-panel h2 {
  margin: 0 0 12px;
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(250, 246, 236, 0.55);
  font-weight: 500;
}

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

.cat-grid a {
  color: rgba(250, 246, 236, 0.9);
  font-size: 13px;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background-color 0.18s ease, border-color 0.18s ease;
  overflow-wrap: anywhere;
}

.cat-grid a:hover,
.cat-grid a:focus-visible {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.14);
  color: #fff;
}

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

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-3);
  padding: 22px 0 0;
}

.crumbs a { color: var(--jade); border-bottom: 1px solid rgba(61, 101, 84, 0.3); }
.crumbs a:hover { border-bottom-color: var(--jade); }
.crumbs span[aria-current] { color: var(--ink-2); }

.article {
  max-width: 760px;
  padding-bottom: 56px;
}

.kicker {
  margin: 26px 0 10px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--tea);
  font-weight: 500;
}

h1 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 42px;
  line-height: 1.14;
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}

.lead {
  font-size: 18px;
  line-height: 1.7;
  color: var(--ink-2);
  margin: 0 0 20px;
}

.art-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 14px 0 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-3);
}

.art-meta span { display: inline-flex; align-items: center; gap: 6px; }

.toc {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--jade);
  border-radius: 10px;
  padding: 18px 22px;
  margin: 28px 0 8px;
}

.toc h2 {
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
  margin: 0 0 10px;
}

.toc ol {
  margin: 0;
  padding-left: 18px;
  columns: 2;
  column-gap: 26px;
  font-size: 14px;
}

.toc li { margin: 4px 0; break-inside: avoid; }
.toc a { color: var(--jade); border-bottom: 1px solid rgba(61, 101, 84, 0.25); }
.toc a:hover { border-bottom-color: var(--jade); }

article h2 {
  font-family: var(--font-heading);
  font-size: 28px;
  line-height: 1.25;
  margin: 40px 0 12px;
  scroll-margin-top: 88px;
}

article h3 {
  font-family: var(--font-heading);
  font-size: 21px;
  margin: 26px 0 8px;
}

article p { margin: 0 0 16px; }
article ul, article ol { margin: 0 0 18px; padding-left: 22px; }
article li { margin: 6px 0; }
article strong { font-weight: 600; color: var(--ink); }

article a.inline {
  color: var(--jade);
  border-bottom: 1px solid rgba(61, 101, 84, 0.35);
}

article a.inline:hover { border-bottom-color: var(--jade); background: rgba(61, 101, 84, 0.06); }

.callout {
  background: var(--jade-soft);
  border: 1px solid rgba(61, 101, 84, 0.16);
  border-radius: 10px;
  padding: 16px 20px;
  margin: 22px 0;
  font-size: 15px;
  color: #2C4438;
}

.callout strong { color: #234135; }

.callout.tea {
  background: var(--tea-soft);
  border-color: rgba(138, 111, 78, 0.2);
  color: #5C4A33;
}

.table-scroll {
  overflow-x: auto;
  margin: 20px 0 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  -webkit-overflow-scrolling: touch;
}

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

caption {
  caption-side: top;
  text-align: left;
  padding: 12px 16px 0;
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}

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

thead th {
  background: var(--cream-2);
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-2);
  white-space: nowrap;
}

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

.check {
  list-style: none;
  padding: 0;
  margin: 18px 0 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  overflow: hidden;
}

.check li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 16px;
  margin: 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14.5px;
}

.check li:last-child { border-bottom: 0; }
.check li::before {
  content: "";
  flex: none;
  width: 15px;
  height: 15px;
  margin-top: 4px;
  border: 1.5px solid rgba(61, 101, 84, 0.5);
  border-radius: 3px;
}

.backhome {
  margin: 30px 0 0;
  padding: 16px 20px;
  border-radius: 10px;
  background: var(--cream-2);
  border: 1px solid var(--line);
  font-size: 15px;
}

.backhome a {
  color: var(--jade);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ---------- related ---------- */
.related {
  margin-top: 44px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.related h2 { margin-top: 28px; }

.rel-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.rel-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.rel-card:hover {
  border-color: rgba(61, 101, 84, 0.4);
  background: #fff;
  transform: translateY(-2px);
}

.rel-card small {
  display: block;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tea);
  margin-bottom: 6px;
}

.rel-card span {
  font-family: var(--font-heading);
  font-size: 18px;
  line-height: 1.3;
  display: block;
}

/* ---------- footer ---------- */
.site-foot {
  background: var(--cream-2);
  border-top: 1px solid var(--line);
  padding: 40px 0 34px;
  margin-top: 10px;
}

.foot-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 28px;
}

.foot-brand {
  font-family: var(--font-heading);
  font-size: 24px;
  margin-bottom: 8px;
}

.site-foot p { font-size: 13.5px; color: var(--ink-2); margin: 0 0 10px; max-width: 46ch; }
.site-foot h2 {
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 10px;
  font-weight: 500;
}

.foot-list { list-style: none; padding: 0; margin: 0; font-size: 13.5px; }
.foot-list li { margin: 6px 0; }
.foot-list a { color: var(--ink-2); }
.foot-list a:hover { color: var(--jade); }

.foot-cats {
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.9;
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.foot-cats a { color: var(--ink-3); }
.foot-cats a:hover { color: var(--jade); }

.foot-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 18px;
}

/* ---------- bottom bar ---------- */
.bottombar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  z-index: 80;
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: rgba(12, 17, 25, 0.93);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.bottombar a,
.bottombar button {
  flex: 1 1 0;
  min-height: 48px;
  max-width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: 0;
  color: rgba(250, 246, 236, 0.72);
  font-size: 11px;
  letter-spacing: 0.02em;
  border-radius: 10px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.bottombar i { font-size: 19px; }
.bottombar a:hover, .bottombar button:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.bottombar .is-active { color: #fff; }

/* ---------- sheet ---------- */
.sheet-root { position: fixed; inset: 0; z-index: 120; }
.sheet-root[hidden] { display: none; }

.sheet-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 20, 0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: fadeIn 0.24s ease both;
}

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 85dvh;
  background: #10161F;
  color: rgba(250, 246, 236, 0.92);
  border-radius: 20px 20px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  animation: sheetUp 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
  padding-bottom: env(safe-area-inset-bottom);
}

.sheet-grip {
  width: 44px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  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 rgba(255, 255, 255, 0.1);
  flex: none;
}

.sheet-head h2 {
  margin: 0;
  font-family: var(--font-body);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(250, 246, 236, 0.7);
  font-weight: 500;
}

.sheet-close {
  width: 40px;
  height: 40px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  color: #FAF6EC;
  font-size: 20px;
}

.sheet-close:hover { background: rgba(255, 255, 255, 0.16); }

.sheet-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 18px 26px;
  -webkit-overflow-scrolling: touch;
}

.sheet-body h3 {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(250, 246, 236, 0.5);
  font-weight: 500;
  margin: 6px 0 10px;
}

.sheet-body h3 + .sheet-grid { margin-bottom: 18px; }

.sheet-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.sheet-grid a,
.sheet-link {
  display: block;
  padding: 11px 12px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(250, 246, 236, 0.9);
  font-size: 13.5px;
  line-height: 1.45;
}

.sheet-grid a:hover,
.sheet-link:hover,
.sheet-grid a:focus-visible,
.sheet-link:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* ---------- responsive ---------- */
@media (min-width: 900px) {
  body { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }
  .bottombar {
    width: auto;
    max-width: 470px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    bottom: 18px;
    padding: 4px 6px;
    box-shadow: 0 14px 40px rgba(8, 12, 18, 0.28);
  }
  .bottombar a, .bottombar button { min-height: 46px; padding: 0 14px; }
}

@media (max-width: 899px) {
  .head-nav { display: none; }
  .head-burger { display: inline-flex; }
  .head-inner { gap: 12px; padding: 0 16px; }
  .head-cta { margin-left: auto; padding: 9px 14px; font-size: 13px; }
  .head-burger { margin-left: 0; }
  .cat-panel { display: none !important; }
  .wrap { padding: 0 18px; }
  h1 { font-size: 31px; }
  .lead { font-size: 16.5px; }
  article h2 { font-size: 24px; }
  .toc ol { columns: 1; }
  .rel-grid { grid-template-columns: 1fr; }
  .foot-grid { grid-template-columns: 1fr; gap: 20px; }
  .article { padding-bottom: 40px; }
  .crumbs { padding-top: 16px; }
}

@media (max-width: 480px) {
  h1 { font-size: 27px; }
  .sheet-grid { grid-template-columns: 1fr; }
  .art-meta { font-size: 12px; gap: 6px 14px; }
}

@media (max-height: 480px) and (orientation: landscape) {
  .sheet { max-height: 92dvh; }
  .sheet-head { position: sticky; top: 0; background: #10161F; z-index: 2; }
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

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