:root {
  --paper: #f7f4ed;
  --paper-soft: #fbfaf6;
  --white: #ffffff;
  --ink: #1a2330;
  --muted: #687485;
  --green: #2d5f5a;
  --green-dark: #204943;
  --green-soft: #e9f1ee;
  --line: #ded8cc;
  --gold: #c6a86e;
  --shadow: 0 18px 52px rgba(31, 44, 52, 0.09);
  --max: 1320px;
  --reading: 820px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, rgba(45, 95, 90, 0.07), transparent 26rem),
    linear-gradient(180deg, #fbfaf7 0, var(--paper) 38rem, #f3efe6 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.68;
}

a { color: inherit; }
img { max-width: 100%; }

.library-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(251, 250, 246, 0.94);
  border-bottom: 1px solid rgba(222, 216, 204, 0.88);
  backdrop-filter: blur(18px) saturate(1.25);
}

.library-header-inner {
  width: min(var(--max), calc(100% - 42px));
  min-height: 74px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  color: var(--green);
  font: italic 600 24px/1 Georgia, "Times New Roman", serif;
  letter-spacing: -0.035em;
  text-decoration: none;
  white-space: nowrap;
}

.brand strong { color: var(--ink); font-style: normal; font-weight: 700; }
.brand small {
  color: #8a929c;
  font: 500 9px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.22em;
  margin-left: 3px;
}

.library-header nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(12px, 2.2vw, 30px);
}

.library-header nav a {
  color: #58677a;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
}

.library-header nav a:hover,
.library-header nav a[aria-current="page"] { color: var(--green); }

.language-link {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  padding: 8px 13px;
}

.library-shell,
.entry-shell {
  width: min(var(--max), calc(100% - 42px));
  margin: 0 auto;
}

.library-hero {
  margin: 34px 0 8px;
  padding: clamp(34px, 5vw, 66px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.library-hero h1,
.entry-hero h1 {
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.03;
}

.library-hero h1 { max-width: 820px; font-size: clamp(2.5rem, 5.6vw, 5.2rem); }
.library-hero > p:not(.eyebrow) { max-width: 760px; color: var(--muted); font-size: 17px; }

.library-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.library-stat {
  border: 1px solid #d7dfdb;
  border-radius: 12px;
  background: var(--green-soft);
  padding: 10px 14px;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 700;
}

.library-search { display: flex; gap: 10px; margin: 28px 0 18px; }
.library-search input {
  min-width: 0;
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--white);
  color: var(--ink);
  padding: 15px 16px;
  font: inherit;
  outline: none;
}
.library-search input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(45, 95, 90, 0.1); }
.library-search button {
  border: 0;
  border-radius: 11px;
  background: var(--green);
  color: var(--white);
  padding: 0 25px;
  font-weight: 800;
  cursor: pointer;
}

.type-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.type-pills a {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--muted);
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.type-pills a.active { border-color: var(--green); background: var(--green); color: var(--white); }

.type-section { padding: 34px 0 54px; }
.type-section + .type-section { border-top: 1px solid var(--line); }
.type-section-header { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.type-section h2 { margin: 0; font: 500 clamp(1.8rem, 3vw, 2.65rem)/1.1 Georgia, "Times New Roman", serif; }
.type-section h2 span {
  display: inline-block;
  vertical-align: middle;
  margin-left: 7px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-dark);
  padding: 4px 9px;
  font: 800 11px/1.2 Inter, sans-serif;
}
.type-section-header p { margin: 0; color: var(--muted); font-size: 13px; }

.protocol-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.protocol-card {
  position: relative;
  display: flex;
  min-height: 228px;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  padding: 20px;
  box-shadow: 0 5px 18px rgba(31, 44, 52, 0.045);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.protocol-card:hover { transform: translateY(-3px); border-color: rgba(45, 95, 90, 0.45); box-shadow: 0 12px 26px rgba(31, 44, 52, 0.09); }
.protocol-card .card-type { margin: 0 0 13px; color: var(--green); font-size: 10px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.protocol-card h3 { margin: 0; font: 600 20px/1.2 Georgia, "Times New Roman", serif; }
.protocol-card .card-strength { margin: 8px 0 0; color: var(--green); font: 700 14px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
.protocol-card .card-copy { margin: 15px 0 22px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.protocol-card .card-link { margin-top: auto; color: var(--green); font-size: 13px; font-weight: 800; text-decoration: none; }
.protocol-card .card-link::after { content: " →"; }
.protocol-card .card-link::before { content: ""; position: absolute; inset: 0; }
.empty-state { padding: 80px 0; color: var(--muted); text-align: center; }

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 20px 0 12px;
  color: var(--muted);
  font-size: 13px;
}
.breadcrumbs a { color: var(--green); font-weight: 700; text-decoration: none; }

.entry-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 390px);
  gap: clamp(22px, 4vw, 50px);
  align-items: center;
  padding: clamp(28px, 4.3vw, 52px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}
.entry-hero h1 { max-width: 800px; font-size: clamp(2.65rem, 5.7vw, 5.5rem); }
.entry-hero .strength { margin: 16px 0 0; color: var(--green); font-size: 1.18rem; font-weight: 850; }
.entry-intro { max-width: 720px; margin: 12px 0 0; color: var(--muted); font-size: 16px; }
.notice {
  margin-top: 16px;
  border: 1px solid #cbdcd7;
  border-radius: 12px;
  background: var(--green-soft);
  color: #345c56;
  padding: 11px 14px;
  font-size: 13px;
}

.entry-hero.entry-hero-no-image { grid-template-columns: minmax(0, 1fr); }
.protocol-hero-media {
  display: flex;
  width: 100%;
  min-height: 300px;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  margin: 0;
}
.protocol-hero-media img {
  display: block;
  width: min(100%, 390px);
  height: auto;
  max-height: 430px;
  object-fit: contain;
}
.protocol-coa-action {
  display: flex;
  width: fit-content;
  margin: 14px 0 0;
}
.protocol-coa-action a {
  display: inline-flex;
  min-width: 184px;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid #214d47;
  border-radius: 9px;
  background: var(--green);
  color: var(--white);
  padding: 8px 15px;
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(45,95,90,.12);
}
.protocol-coa-action a:hover { border-color: var(--green-dark); background: var(--green-dark); }
.protocol-coa-action a:focus-visible { outline: 3px solid rgba(45,95,90,.28); outline-offset: 3px; }

.entry-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, var(--reading));
  justify-content: center;
  gap: clamp(30px, 5vw, 62px);
  padding: 28px 0 50px;
}
.entry-toc { align-self: start; position: sticky; top: 98px; }
.entry-toc p { margin: 0 0 8px; color: var(--ink); font-size: 13px; font-weight: 850; }
.entry-toc ol { margin: 0; padding: 0; list-style: none; }
.entry-toc li + li { margin-top: 2px; }
.entry-toc a { display: block; border-left: 2px solid var(--line); color: var(--muted); padding: 5px 0 5px 13px; font-size: 12px; line-height: 1.35; text-decoration: none; }
.entry-toc a:hover { border-left-color: var(--green); color: var(--green); }

.entry-sections { min-width: 0; line-height: 1.6; }
.entry-sections section {
  scroll-margin-top: 100px;
  border-bottom: 1px solid var(--line);
  padding: 0 0 22px;
  margin-bottom: 22px;
}
.entry-sections section:last-child { margin-bottom: 0; border-bottom: 0; padding-bottom: 0; }
.entry-sections h2 { margin: 0 0 8px; font: 600 clamp(1.5rem, 2.8vw, 2.15rem)/1.2 Georgia, "Times New Roman", serif; letter-spacing: -0.02em; }
.entry-sections p { margin: 0; color: #4f5e6f; }
.section-kicker { margin-bottom: 7px !important; color: var(--green) !important; font-size: 10px; font-weight: 850; letter-spacing: 0.12em; text-transform: uppercase; }
.storage-copy p + p { margin-top: 8px; }
.storage-copy strong { color: var(--ink); }

.fact-table,
.measurement-table { overflow-x: auto; margin-top: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); }
.source-table-block { margin-top: 15px; }
.source-table-block + .source-table-block { padding-top: 12px; border-top: 1px dashed var(--line); }
.source-table-block h3 { margin: 0 0 7px; color: var(--navy); font-family: "DM Sans", sans-serif; font-size: 18px; }
.source-table-block tbody tr:nth-child(even) { background: rgba(36, 102, 91, .035); }
table { width: 100%; min-width: 560px; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; }
tr:last-child th, tr:last-child td { border-bottom: 0; }
thead th { background: var(--green); color: var(--white); font-size: 12px; letter-spacing: 0.03em; }
tbody th { width: 42%; background: #f8f6f0; color: #42505e; font-size: 13px; }
tbody td { color: var(--ink); font-size: 13px; font-weight: 650; }
.table-note { margin-top: 12px !important; color: var(--muted) !important; font-size: 12px; }

.related-variations { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 11px; }
.related-variation {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  padding: 14px;
  text-decoration: none;
}
.related-variation strong { font-size: 13px; }
.related-variation span { color: var(--green); font: 700 12px/1.4 ui-monospace, monospace; margin-top: 5px; }

.references { margin: 11px 0 0; padding: 0; list-style: none; }
.references li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.references li:last-child { border-bottom: 0; }
.references a { color: var(--green); font-size: 13px; font-weight: 700; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.references span { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }

footer { border-top: 1px solid var(--line); background: rgba(251, 250, 246, 0.75); padding: 22px 20px; color: var(--muted); text-align: center; font-size: 12px; }

@media (max-width: 1080px) {
  .library-header nav .desktop-secondary { display: none; }
  .protocol-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .entry-layout { grid-template-columns: 210px minmax(0, 1fr); }
}

@media (max-width: 820px) {
  .library-header-inner { min-height: 66px; }
  .library-header nav a:not(.language-link):not(.mobile-primary) { display: none; }
  .protocol-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .entry-hero { grid-template-columns: 1fr; }
  .protocol-hero-media { min-height: 0; }
  .protocol-hero-media img { width: min(100%, 340px); max-height: 360px; }
  .entry-layout { display: block; padding-top: 20px; }
  .entry-toc { position: static; margin-bottom: 22px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.7); padding: 14px; }
  .entry-toc ol { columns: 2; column-gap: 22px; }
  .entry-toc li { break-inside: avoid; }
}

@media (max-width: 560px) {
  .library-header-inner, .library-shell, .entry-shell { width: min(100% - 24px, var(--max)); }
  .brand { font-size: 20px; }
  .library-header nav { gap: 8px; }
  .library-header nav a { font-size: 11px; }
  .library-hero, .entry-hero { margin-top: 14px; border-radius: 18px; padding: 21px 18px; }
  .library-hero h1, .entry-hero h1 { font-size: clamp(2.25rem, 13vw, 3.45rem); }
  .protocol-hero-media img { width: min(100%, 290px); max-height: 310px; }
  .protocol-coa-action { margin-top: 12px; }
  .protocol-coa-action a { min-height: 44px; }
  .library-search { flex-direction: column; }
  .library-search button { padding: 13px; }
  .type-section-header { align-items: flex-start; flex-direction: column; gap: 8px; }
  .protocol-grid { grid-template-columns: 1fr; }
  .protocol-card { min-height: 194px; }
  .entry-toc ol { columns: 1; }
  .related-variations { grid-template-columns: 1fr; }
  .references li { grid-template-columns: 1fr; gap: 4px; }
}

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