@import url("https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:wght@400;700&family=Crimson+Pro:wght@500;600;700&display=swap");

:root {
  --ink: #171717;
  --ink-soft: #34342f;
  --muted: #62645c;
  --paper: #fbf8f0;
  --paper-deep: #f3eee3;
  --panel: rgba(255, 253, 247, 0.86);
  --line: #ded6c8;
  --line-strong: #cfc3b0;
  --accent: #8d3f2f;
  --accent-deep: #6f2e22;
  --gold: #b08a2e;
  --bayes: #b64b35;
  --bayes-a: rgba(226, 106, 70, 0.34);
  --bayes-b: rgba(228, 166, 58, 0.3);
  --fixed: #496f90;
  --fixed-a: rgba(83, 127, 163, 0.21);
  --fixed-b: rgba(105, 147, 127, 0.18);
  --shadow-soft: 0 24px 70px rgba(56, 45, 31, 0.1);
  --shadow-tight: 0 10px 28px rgba(56, 45, 31, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(rgba(80, 64, 42, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(80, 64, 42, 0.025) 1px, transparent 1px),
    linear-gradient(180deg, var(--paper) 0%, #f7f2e8 54%, #fbf8f0 100%);
  background-size: 32px 32px, 32px 32px, auto;
  color: var(--ink);
  font-family:
    "Atkinson Hyperlegible", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  line-height: 1.55;
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid rgba(141, 63, 47, 0.72);
  outline-offset: 3px;
}

.topbar {
  position: sticky;
  top: 14px;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1040px, calc(100% - 38px));
  min-height: 54px;
  margin: 14px auto 0;
  padding: 0 12px 0 18px;
  border: 1px solid rgba(207, 195, 176, 0.8);
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.82);
  box-shadow: 0 12px 36px rgba(56, 45, 31, 0.07);
  backdrop-filter: blur(16px);
}

.brand {
  font-family: "Crimson Pro", Georgia, serif;
  font-size: 22px;
  font-weight: 700;
}

nav {
  display: flex;
  gap: 5px;
}

nav a,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  transition:
    border-color 180ms ease,
    background 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

nav a:hover,
.button:hover {
  border-color: rgba(141, 63, 47, 0.22);
  background: rgba(255, 255, 255, 0.78);
  color: var(--accent-deep);
  transform: translateY(-1px);
}

.hero,
.demo-section,
footer {
  width: min(980px, calc(100% - 38px));
  margin: 0 auto;
}

.hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(72vh - 68px);
  padding: 88px 0 54px;
}

.publication-status {
  width: fit-content;
  margin: 0 0 18px;
  padding: 5px 12px 6px;
  border: 1px solid rgba(176, 138, 46, 0.42);
  border-radius: 999px;
  background: rgba(255, 249, 228, 0.7);
  color: #7d6220;
  font-size: 13px;
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1,
h2 {
  font-family: "Crimson Pro", Georgia, "Times New Roman", serif;
}

h1 {
  margin: 0;
  max-width: 940px;
  font-size: clamp(34px, 4.8vw, 54px);
  line-height: 1.02;
  font-weight: 700;
}

h2 {
  max-width: none;
  margin: 0;
  font-size: 36px;
  line-height: 1.05;
  font-weight: 700;
  white-space: nowrap;
}

h3 {
  margin: 0;
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 700;
}

.lead {
  max-width: 760px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.55;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
}

.button {
  min-height: 42px;
  padding: 0 17px;
  border-color: rgba(207, 195, 176, 0.92);
  background: rgba(255, 253, 247, 0.72);
  box-shadow: 0 8px 18px rgba(56, 45, 31, 0.045);
}

.button.primary {
  border-color: rgba(141, 63, 47, 0.22);
  background: var(--ink);
  color: #fffaf0;
}

.button.primary:hover {
  border-color: var(--ink);
  background: var(--accent-deep);
  color: #fffaf0;
}

.demo-section {
  padding: 58px 0 88px;
}

.demo-header {
  display: block;
  margin-bottom: 18px;
}

.case-select {
  position: relative;
  width: 100%;
  margin-top: 24px;
}

.selector-label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.case-options {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  border: 1px solid rgba(207, 195, 176, 0.7);
  border-radius: 16px;
  background: rgba(255, 253, 247, 0.62);
}

.case-option {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 68px;
  padding: 12px 12px 12px 14px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 180ms ease,
    background 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
}

.case-option::before {
  position: absolute;
  inset: 11px auto 11px 8px;
  width: 2px;
  border-radius: 999px;
  background: transparent;
  content: "";
  transition: background 180ms ease;
}

.case-option:hover,
.case-option.active {
  border-color: rgba(141, 63, 47, 0.18);
  background: rgba(255, 255, 255, 0.78);
  color: var(--accent-deep);
  box-shadow: var(--shadow-tight);
}

.case-option.active::before {
  background: var(--bayes);
}

.case-option strong {
  display: block;
  padding-left: 4px;
  font-size: 13px;
  line-height: 1.24;
}

.question {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  margin: 22px 0 18px;
  padding: 14px 0 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
}

.question span {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.question strong {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.42;
}

.demo-canvas {
  padding: 0;
}

.demo-figure {
  overflow: hidden;
  border: 1px solid rgba(207, 195, 176, 0.82);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.92), rgba(255, 253, 247, 0.74)),
    var(--panel);
  box-shadow: var(--shadow-soft);
}

.curve-head,
.section-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.curve-head {
  padding: 16px 18px 0;
}

.curve-head span,
.section-line span {
  color: var(--muted);
  font-size: 12px;
}

#surprisalChart {
  display: block;
  width: 100%;
  height: 388px;
  margin-top: 6px;
  border-top: 1px solid rgba(207, 195, 176, 0.58);
  border-bottom: 1px solid rgba(207, 195, 176, 0.58);
  background:
    linear-gradient(rgba(96, 78, 54, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(96, 78, 54, 0.035) 1px, transparent 1px),
    rgba(255, 253, 247, 0.66);
  background-size: 42px 42px;
}

.chart-grid {
  stroke: rgba(56, 45, 31, 0.13);
  stroke-width: 1;
}

.chart-area {
  fill: rgba(141, 63, 47, 0.055);
}

.chart-line {
  fill: none;
  stroke: var(--ink);
  stroke-width: 3.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 5px 8px rgba(56, 45, 31, 0.12));
}

.boundary-bayes {
  stroke: var(--bayes);
  stroke-width: 3;
  transition: opacity 150ms ease;
}

.boundary-fixed {
  stroke: var(--fixed);
  stroke-width: 2;
  stroke-dasharray: 8 7;
}

.boundary-muted {
  opacity: 0.12;
}

.boundary-hover {
  stroke-width: 5.5;
  opacity: 1;
  filter: drop-shadow(0 0 10px rgba(182, 75, 53, 0.32));
}

.boundary-label {
  fill: var(--accent-deep);
  font-size: 14px;
  font-weight: 700;
}

.point-highlight {
  fill: var(--bayes);
  stroke: #fffaf0;
  stroke-width: 3;
  filter: drop-shadow(0 0 9px rgba(182, 75, 53, 0.32));
}

.inline-section {
  padding: 14px 18px 0;
}

#surprisalChart + .inline-section {
  padding-top: 13px;
  padding-bottom: 18px;
  background: rgba(255, 253, 247, 0.56);
}

.fixed-section {
  margin-top: 0;
  padding-top: 17px;
  padding-bottom: 20px;
  border-top: 1px solid rgba(207, 195, 176, 0.68);
  background: rgba(243, 238, 227, 0.4);
}

.fixed-section h3,
.fixed-section .chunk-paragraph {
  color: rgba(52, 52, 47, 0.78);
}

.chunk-paragraph {
  margin: 8px 0 0;
  padding: 0;
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.48;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
}

.chunk {
  display: inline;
  padding: 0 2px 1px;
  border-radius: 3px;
  background-repeat: no-repeat;
  background-position: 0 0;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition:
    background 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease;
}

.chunk.bayes {
  background-image: linear-gradient(transparent 42%, var(--bayes-a) 42%);
  cursor: pointer;
}

.chunk.bayes:nth-of-type(even) {
  background-image: linear-gradient(transparent 42%, var(--bayes-b) 42%);
}

.chunk.bayes:hover,
.chunk.bayes.active-step {
  color: #39160f;
  background-image: linear-gradient(transparent 34%, rgba(226, 106, 70, 0.55) 34%);
  box-shadow: inset 0 -2px 0 rgba(141, 63, 47, 0.36);
}

.chunk.fixed {
  background-image: linear-gradient(transparent 42%, var(--fixed-a) 42%);
}

.chunk.fixed:nth-of-type(even) {
  background-image: linear-gradient(transparent 42%, var(--fixed-b) 42%);
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 32px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

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

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 820px) {
  .topbar {
    top: 10px;
    width: min(100% - 28px, 980px);
  }

  footer {
    display: flex;
    align-items: stretch;
    flex-direction: column;
  }

  .curve-head,
  .section-line,
  .question {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .question {
    display: flex;
  }

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

  h2 {
    font-size: 28px;
  }

  #surprisalChart {
    height: 360px;
  }
}

@media (max-width: 620px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    min-height: auto;
    padding: 12px 14px;
    border-radius: 18px;
  }


  nav {
    width: 100%;
  }

  nav a {
    flex: 1;
  }

  .hero,
  .demo-section,
  footer {
    width: min(100% - 28px, 980px);
  }

  .hero {
    min-height: auto;
    padding-top: 58px;
  }

  .lead {
    font-size: 17px;
  }

  h2 {
    font-size: 20px;
  }

  .question strong {
    font-size: 16px;
  }

  .case-options {
    grid-template-columns: 1fr;
  }

  .case-option {
    min-height: 54px;
  }

  #surprisalChart {
    height: 320px;
  }

  .inline-section {
    padding-right: 14px;
    padding-left: 14px;
  }

  .chunk-paragraph {
    font-size: 14px;
    line-height: 1.5;
  }
}

@media (max-width: 390px) {
  h2 {
    font-size: 18px;
  }
}
