:root {
  --page-bg: #f4efe7;
  --paper: rgba(255, 255, 255, 0.92);
  --paper-strong: #ffffff;
  --ink: #12242d;
  --muted: #52636d;
  --accent: #0b6b69;
  --accent-strong: #083a45;
  --accent-soft: rgba(11, 107, 105, 0.11);
  --line: rgba(18, 36, 45, 0.12);
  --line-strong: rgba(18, 36, 45, 0.2);
  --shadow: 0 18px 60px rgba(12, 23, 31, 0.12);
  --radius: 28px;
  --content-width: 1500px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(11, 107, 105, 0.14), transparent 32%),
    radial-gradient(circle at top right, rgba(164, 114, 67, 0.12), transparent 28%),
    linear-gradient(180deg, #f8f4ec 0%, #f1ebe2 46%, #ece5db 100%);
  line-height: 1.75;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(18, 36, 45, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 36, 45, 0.03) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.34), transparent 78%);
}

a {
  color: var(--accent-strong);
  text-decoration-color: rgba(8, 58, 69, 0.28);
  text-underline-offset: 0.18em;
}

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

.progress-bar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  height: 4px;
  background: linear-gradient(90deg, var(--accent) 0%, #1d8f8d 40%, #da8c49 100%);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

.page-shell {
  position: relative;
}

.hero {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 4.75rem 1rem 1.75rem;
}

.hero-card {
  position: relative;
  overflow: hidden;
  padding: 1.4rem;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: calc(var(--radius) + 4px);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.7)),
    linear-gradient(120deg, rgba(11, 107, 105, 0.16), transparent 45%);
  box-shadow: var(--shadow);
  isolation: isolate;
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: auto -12% -42% auto;
  width: 240px;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.72), transparent 46%),
    radial-gradient(circle, rgba(11, 107, 105, 0.22), transparent 67%);
  z-index: -1;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 1rem;
  padding: 0.42rem 0.72rem;
  border-radius: 999px;
  background: rgba(8, 58, 69, 0.08);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  max-width: 14ch;
  font-size: clamp(2.15rem, 10vw, 4.9rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.hero p {
  margin: 1rem 0 0;
  max-width: 67ch;
  color: var(--muted);
  font-size: 1rem;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.52rem 0.78rem;
  border: 1px solid rgba(8, 58, 69, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--accent-strong);
  font-size: 0.85rem;
  font-weight: 500;
}

.layout {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 1rem 4rem;
  display: grid;
  gap: 1rem;
}

.sidebar {
  display: grid;
  gap: 1rem;
}

.panel,
.paper {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.78));
  backdrop-filter: blur(14px);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, rgba(11, 107, 105, 0.75), rgba(218, 140, 73, 0.34));
}

.panel-inner {
  padding: 1.15rem;
}

.card-kicker {
  margin: 0 0 0.65rem;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.author-header {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  margin-bottom: 1rem;
}

.portrait-badge {
  width: 3.4rem;
  height: 3.4rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    linear-gradient(135deg, rgba(11, 107, 105, 0.95), rgba(8, 58, 69, 0.92));
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  box-shadow: 0 12px 30px rgba(8, 58, 69, 0.28);
}

.author-card h2,
.toc-card h2,
.note-card h2 {
  margin: 0;
  font-size: 1.34rem;
  line-height: 1.1;
}

.author-card p {
  margin: 0;
}

.author-summary {
  color: var(--muted);
}

.author-facts {
  margin: 1rem 0 0;
  display: grid;
  gap: 0.8rem;
}

.author-facts div {
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
}

.author-facts dt {
  margin-bottom: 0.2rem;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 500;
}

.author-facts dd {
  margin: 0;
  font-weight: 600;
}

.author-facts .pending {
  color: #8f4d1f;
  font-weight: 600;
}

.toc-list {
  display: flex;
  gap: 0.65rem;
  margin-top: 1rem;
  overflow-x: auto;
  padding-bottom: 0.2rem;
  scrollbar-width: thin;
}

.toc-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.72rem 0.86rem;
  min-width: 11rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.toc-link:hover,
.toc-link:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(11, 107, 105, 0.35);
}

.toc-link.is-active {
  background: linear-gradient(135deg, rgba(11, 107, 105, 0.16), rgba(255, 255, 255, 0.92));
  border-color: rgba(11, 107, 105, 0.4);
}

.toc-link strong {
  display: block;
  font-size: 0.95rem;
}

.toc-link span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.note-card p {
  margin: 0.8rem 0 0;
  color: var(--muted);
}

.paper {
  padding: 1.2rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.92)),
    linear-gradient(135deg, rgba(11, 107, 105, 0.04), transparent 26%);
}

.paper-header {
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--line);
}

.paper-header h2 {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.12;
}

.paper-header p {
  margin: 0.75rem 0 0;
  max-width: 72ch;
  color: var(--muted);
}

.chapter {
  padding: 2.25rem 0 0;
}

.chapter + .chapter {
  margin-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.chapter-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.85rem;
  padding: 0.38rem 0.64rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chapter h3 {
  margin: 0 0 0.8rem;
  font-size: clamp(1.65rem, 4vw, 2.5rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
}

.subsection {
  padding-top: 1.6rem;
}

.subsection + .subsection {
  border-top: 1px dashed rgba(18, 36, 45, 0.09);
}

.subsection-title {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  margin-bottom: 0.9rem;
}

.subsection-title .index {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.subsection-title h4 {
  margin: 0;
  font-size: clamp(1.08rem, 2.6vw, 1.36rem);
  line-height: 1.25;
}

.subsection p {
  margin: 0.9rem 0 0;
  font-size: 1rem;
}

.chapter-body {
  padding-top: 0.55rem;
}

.chapter-body p {
  margin: 0.9rem 0 0;
  font-size: 1rem;
}

.chapter-body > .dash-list,
.chapter-body > .equation {
  margin-top: 0.9rem;
}

.dash-list {
  list-style: none;
  margin: 0.9rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.dash-list li {
  position: relative;
  padding-left: 1.1rem;
}

.dash-list li::before {
  content: "–";
  position: absolute;
  inset: 0 auto auto 0;
  color: var(--accent);
  font-weight: 700;
}

.equation {
  margin: 1rem 0 0;
  padding: 1rem 1rem;
  overflow-x: auto;
  border: 1px solid rgba(8, 58, 69, 0.08);
  border-left: 4px solid rgba(11, 107, 105, 0.5);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(11, 107, 105, 0.06), rgba(255, 255, 255, 0.96));
}

.equation mjx-container {
  margin: 0 !important;
  font-size: 105% !important;
}

.gallery-note {
  margin: 1rem 0 0;
  color: var(--muted);
}

.figure-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1.2rem;
}

.research-figure {
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(8, 58, 69, 0.08);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 249, 250, 0.96));
  box-shadow: 0 18px 44px rgba(12, 23, 31, 0.08);
}

.research-figure img {
  width: 100%;
  height: auto;
  display: block;
  background: #dfe7ea;
}

.research-figure figcaption {
  padding: 0.95rem 1rem 1.05rem;
}

.research-figure strong {
  display: block;
  font-size: 1rem;
  line-height: 1.25;
}

.research-figure p {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.figure-source {
  display: block;
  margin-top: 0.65rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.page-footer {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 1rem 4rem;
}

.footer-card {
  padding: 1.2rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(8, 58, 69, 0.96), rgba(11, 107, 105, 0.94));
  color: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.footer-card p {
  margin: 0;
}

.footer-date {
  display: block;
  margin-top: 0.25rem;
  font-size: clamp(1.25rem, 4vw, 1.7rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 500ms ease, transform 500ms ease;
}

[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (min-width: 720px) {
  .hero {
    padding: 5.25rem 1.5rem 2.2rem;
  }

  .hero-card,
  .paper,
  .panel-inner {
    padding: 1.6rem;
  }

  .paper-header h2 {
    font-size: 1.75rem;
  }

  .subsection p {
    font-size: 1.03rem;
  }

  .chapter-body p {
    font-size: 1.03rem;
  }

  .figure-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .layout,
  .page-footer {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 1040px) {
  .layout {
    grid-template-columns: minmax(270px, 320px) minmax(0, 1fr);
    align-items: start;
    gap: 1.3rem;
  }

  .sidebar {
    position: sticky;
    top: 1.2rem;
  }

  .toc-list {
    display: grid;
    gap: 0.7rem;
    overflow: visible;
  }

  .toc-link {
    min-width: 0;
  }

  .paper {
    padding: 2rem 2.2rem;
  }

  .chapter {
    padding-top: 3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    animation: none !important;
    transition: none !important;
  }

  [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
