:root {
  color-scheme: light;
  --paper: #f7f4ee;
  --ink: #171513;
  --muted: #665f55;
  --line: #d8cfc1;
  --accent: #386641;
  --accent-strong: #1d4f2a;
  --card: #fffdf8;
  --wash: #ece8df;
  --wash-strong: #e6ecdf;
  --tag: #f2eee5;
}

* {
  box-sizing: border-box;
}

html {
  max-width: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.55;
  max-width: 100%;
  overflow-x: hidden;
}

a {
  color: var(--accent-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.site-header,
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1120px, calc(100vw - 40px));
  margin: 0 auto;
}

.site-header {
  min-height: 76px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
}

.brand::before {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  background: url("favicon.svg") center / contain no-repeat;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-family: Arial, sans-serif;
  font-size: 0.9rem;
  max-width: 100%;
  min-width: 0;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--ink);
}

main {
  width: min(1120px, calc(100vw - 40px));
  margin: 0 auto;
}

.hero {
  min-height: 48vh;
  display: grid;
  align-content: center;
  padding: 72px 0 64px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-family: Arial, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: break-word;
}

h1 {
  max-width: 860px;
  margin: 0;
  font-size: 7rem;
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 3rem;
  line-height: 1;
  letter-spacing: 0;
}

h3 {
  margin: 0 0 12px;
  font-size: 1.35rem;
  line-height: 1.2;
}

.motto {
  max-width: 760px;
  margin: 18px 0 0;
  color: var(--ink);
  font-size: 2rem;
  line-height: 1.18;
}

.hero-copy {
  max-width: 720px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1.18rem;
}

.page-hero {
  padding: 72px 0 56px;
  border-bottom: 1px solid var(--line);
}

.page-hero h1 {
  font-size: 4.4rem;
}

.page-hero .hero-copy {
  max-width: 640px;
}

.content-section {
  display: grid;
  grid-template-columns: minmax(300px, 0.42fr) minmax(0, 1fr);
  gap: 44px;
  padding: 64px 0 76px;
}

.content-section + .content-section {
  border-top: 1px solid var(--line);
}

.section-heading {
  position: sticky;
  top: 24px;
  align-self: start;
}

.section-heading h2 {
  font-size: 2.8rem;
}

.section-heading p:not(.eyebrow) {
  max-width: 340px;
  margin: 18px 0 0;
  color: var(--muted);
}

.purpose-section {
  padding-top: 56px;
  padding-bottom: 56px;
}

.purpose-copy {
  max-width: 760px;
  font-size: 1.08rem;
}

.purpose-copy p {
  margin: 0 0 18px;
  color: var(--muted);
}

.purpose-copy p:first-child {
  color: var(--ink);
  font-size: 1.16rem;
}

.text-link {
  font-family: Arial, sans-serif;
  font-weight: 700;
}

.entry-list {
  display: grid;
  gap: 16px;
}

.reading-note {
  padding: 18px 20px;
  background: var(--wash);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
}

.reading-note strong {
  display: block;
  margin-bottom: 6px;
  font-family: Arial, sans-serif;
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.reading-note p {
  margin: 0 0 10px;
  color: var(--muted);
}

.reading-note p:last-child {
  margin-bottom: 0;
}

.note-card,
.mechanism-card,
.problem-block {
  min-height: 0;
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(60, 45, 25, 0.04);
}

.note-card.muted {
  background: var(--wash-strong);
}

.note-card p,
.mechanism-card p,
.problem-block p {
  margin: 0 0 18px;
  color: var(--muted);
}

.note-card p:last-child,
.mechanism-card p:last-child,
.problem-block p:last-child {
  margin-bottom: 0;
}

.note-card a {
  font-family: Arial, sans-serif;
  font-weight: 700;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.tag-list li {
  padding: 4px 7px;
  background: var(--tag);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.about-section {
  padding: 48px 0 60px;
}

.about-copy {
  max-width: 720px;
}

.about-copy p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 1.05rem;
}

.about-copy p:first-child {
  color: var(--ink);
}

.about-copy p:last-child {
  margin-bottom: 0;
}

.reference-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 1.2rem;
}

.reference-list a {
  font-family: Arial, sans-serif;
  font-weight: 700;
}

.fact-list {
  display: grid;
  gap: 0;
  margin: 0 0 18px;
}

.fact-list div {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.fact-list div:last-child {
  border-bottom: 1px solid var(--line);
}

.fact-list dt {
  margin: 0;
  color: var(--accent);
  font-family: Arial, sans-serif;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.fact-list dd {
  margin: 4px 0 0;
  color: var(--muted);
}

.fact-list code {
  color: var(--ink);
  font-family: "Courier New", monospace;
  font-size: 0.9em;
  overflow-wrap: anywhere;
}

.note-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: center;
  font-family: Arial, sans-serif;
}

.problem-index ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 1.2rem;
}

.problem-index li {
  color: var(--muted);
}

.problem-index a {
  font-family: Arial, sans-serif;
  font-weight: 700;
}

.problem-index span {
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 0.78rem;
}

.problem-index span::before {
  content: " / ";
  color: var(--line);
}

.problem-list {
  counter-reset: problem;
}

.problem-block {
  scroll-margin-top: 24px;
}

.problem-block h3 {
  font-size: 1.55rem;
}

.math,
.math-display {
  color: var(--ink);
  font-family: "Times New Roman", Georgia, serif;
}

.math {
  white-space: normal;
}

.math-display {
  margin: 10px 0 20px;
  padding: 16px 18px;
  overflow-x: auto;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 1.15rem;
  line-height: 1.4;
  white-space: nowrap;
}

.sum-symbol {
  display: inline-block;
  margin-right: 2px;
  font-size: 1.9rem;
  line-height: 1;
  vertical-align: middle;
}

.math-bracket {
  margin-left: 6px;
}

.binom-wrap {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.binom {
  position: relative;
  display: inline-grid;
  grid-template-rows: auto auto;
  min-width: 2.6em;
  padding: 0 0.35em;
  text-align: center;
  font-size: 0.82em;
  line-height: 1;
}

.binom::before,
.binom::after {
  position: absolute;
  top: 50%;
  color: var(--ink);
  font-size: 2.1em;
  line-height: 1;
  transform: translateY(-50%);
}

.binom::before {
  content: "(";
  left: -0.12em;
}

.binom::after {
  content: ")";
  right: -0.12em;
}

.problem-conditions {
  display: grid;
  gap: 8px;
  margin: 0 0 18px;
  padding-left: 1.2rem;
  color: var(--muted);
}

.verification-note {
  margin: 14px 0 0;
  font-size: 0.92rem;
}

.verification-note code,
.note-card code {
  color: var(--ink);
  font-family: "Courier New", monospace;
  font-size: 0.9em;
  overflow-wrap: anywhere;
}

.verification-badge {
  display: inline-flex;
  margin-top: 12px;
  line-height: 0;
}

.verification-badge img {
  height: 20px;
}

.note-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem;
  margin: 0 0 14px;
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
}

.note-meta span:first-child {
  color: var(--accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.note-meta span[aria-hidden="true"] {
  color: var(--line);
}

.mechanism-page {
  align-items: start;
}

.mechanism-grid,
.principle-list {
  display: grid;
  gap: 16px;
}

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

.mechanism-card h3 {
  font-size: 1.2rem;
}

.principle-list .mechanism-card {
  background: var(--card);
}

.site-footer {
  min-height: 96px;
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0;
}

.redirect-page {
  max-width: 680px;
  padding: 72px 0;
}

.redirect-page p {
  color: var(--muted);
  font-size: 1.08rem;
}

@media (max-width: 900px) {
  h1 {
    font-size: 5rem;
  }

  .page-hero h1 {
    font-size: 3.6rem;
  }

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

@media (max-width: 760px) {
  .site-header,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
  }

  .site-header {
    padding: 18px 0;
  }

  .site-nav {
    gap: 10px 14px;
    width: 100%;
  }

  .hero {
    min-height: 46vh;
    padding: 52px 0 48px;
  }

  h1 {
    font-size: clamp(2.95rem, 13vw, 3.45rem);
  }

  h2,
  .section-heading h2 {
    font-size: clamp(2rem, 9vw, 2.3rem);
  }

  .motto {
    font-size: 1.45rem;
  }

  .hero-copy {
    font-size: 1.05rem;
  }

  .page-hero {
    padding: 52px 0 44px;
  }

  .page-hero h1 {
    font-size: clamp(2.15rem, 10.5vw, 2.75rem);
  }

  .content-section {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 44px 0 60px;
  }

  .section-heading {
    position: static;
  }

  .note-card,
  .mechanism-card,
  .problem-block {
    padding: 20px;
  }

  .problem-block h3 {
    font-size: 1.32rem;
  }

  .math-display {
    padding: 14px 16px;
    font-size: 1.02rem;
  }
}

@media (max-width: 420px) {
  .site-header,
  .site-footer,
  main {
    width: calc(100vw - 32px);
  }

  .hero-copy,
  .motto,
  .page-hero .hero-copy {
    max-width: 100%;
  }

  .page-hero h1 {
    font-size: 2.25rem;
    line-height: 1.06;
  }
}
