:root {
  --paper: #f6f5ef;
  --sage-50: #eef1e8;
  --line: #cfd7c2;
  --olive: #586643;
  --ink: #273024;
  --muted: #51604a;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 8%, rgba(157, 173, 135, 0.18), transparent 34%),
    linear-gradient(180deg, var(--paper), #f2f1ea);
  line-height: 1.6;
}

.leaf-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.leaf-cell {
  position: absolute;
  width: 26px;
  height: 26px;
  transform: translate(-50%, -50%);
  opacity: 0.2;
  will-change: transform, opacity;
}

.leaf-cell svg {
  width: 100%;
  height: 100%;
  display: block;
}

.leaf-outline {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.05;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.leaf-vein {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.05;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.9;
}

.wrap {
  position: relative;
  z-index: 1;
  width: min(980px, calc(100% - 2rem));
  margin: 1.25rem auto 2.5rem;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.8rem 1rem;
  background: rgba(246, 245, 239, 0.92);
}

.top a {
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  background: #fff;
}

.paper {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.62);
}

h1,
h2 {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
}

h1 {
  line-height: 1.2;
}

.meta {
  color: var(--muted);
  margin-top: 0.45rem;
}

.doi {
  margin-top: 0.8rem;
}

.doi a {
  color: var(--olive);
  font-weight: 700;
}

.abstract {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcf8;
  padding: 0.9rem;
}

.abstract p {
  margin: 0.7rem 0 0;
  color: var(--muted);
}

.figures {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.figure-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem;
  background: #fbfcf8;
}

.figure-card.single-figure {
  grid-column: 1 / -1;
}

.figure-media {
  position: relative;
  border-radius: 8px;
  border: 1px solid #9aaa97;
  background: #edf2e4;
  overflow: hidden;
  aspect-ratio: 16 / 10;
}

.figure-placeholder {
  border: 1px dashed #9aaa97;
  border-radius: 8px;
  min-height: 140px;
  background: linear-gradient(135deg, #f5f7f1, #edf2e4);
  display: grid;
  place-items: center;
  text-align: center;
  color: #657460;
  font-size: 0.9rem;
  padding: 0.7rem;
}

.figure-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #f5f7f1;
  cursor: zoom-in;
  transition: transform 180ms ease;
}

.sensitive-media .figure-image {
  filter: blur(14px) saturate(0.72);
  transform: scale(1.03);
  transition: filter 240ms ease, transform 240ms ease;
}

.sensitive-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(39, 48, 36, 0.38), rgba(39, 48, 36, 0.58));
  color: #f7f8f3;
  display: grid;
  place-content: center;
  gap: 0.65rem;
  text-align: center;
  padding: 0.9rem;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.sensitive-overlay p {
  margin: 0;
  font-weight: 600;
  line-height: 1.35;
}

.sensitive-ok {
  justify-self: center;
  border: 1px solid rgba(247, 248, 243, 0.78);
  border-radius: 999px;
  background: rgba(247, 248, 243, 0.12);
  color: #f7f8f3;
  padding: 0.4rem 0.85rem;
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
}

.sensitive-ok:hover {
  background: rgba(247, 248, 243, 0.2);
}

.sensitive-media.revealed .figure-image {
  filter: none;
  transform: none;
}

.sensitive-media.revealed .sensitive-overlay {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.sensitive-toggle {
  margin-top: 0.55rem;
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7f9f2;
  color: var(--muted);
  padding: 0.3rem 0.62rem;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.sensitive-toggle:hover {
  background: #eef2e6;
}

.sensitive-toggle svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(21, 27, 19, 0.72);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.image-viewer.is-open {
  opacity: 1;
  visibility: visible;
}

.image-viewer img {
  width: min(1120px, 96vw);
  max-height: 92vh;
  border-radius: 10px;
  border: 1px solid #9aaa97;
  background: #f5f7f1;
  box-shadow: 0 16px 40px rgba(17, 22, 15, 0.3);
  object-fit: contain;
}

.image-viewer-close {
  position: absolute;
  top: 14px;
  right: 14px;
  border: 1px solid rgba(247, 248, 243, 0.75);
  border-radius: 999px;
  background: rgba(247, 248, 243, 0.14);
  color: #f7f8f3;
  padding: 0.35rem 0.78rem;
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
}

.image-viewer-close:hover {
  background: rgba(247, 248, 243, 0.24);
}

.caption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.no-ligature {
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
}

@media (max-width: 760px) {
  .leaf-cell {
    width: 22px;
    height: 22px;
  }

  .figures {
    grid-template-columns: 1fr;
  }
}
