:root {
  --paper: #e8ddc6;
  --paper-deep: #d8c9aa;
  --paper-light: #f0e8d8;
  --ink: #2c2a23;
  --ink-soft: #625d50;
  --rule: rgba(67, 59, 45, 0.3);
  --rule-strong: rgba(51, 44, 33, 0.62);
  --rust: #86462f;
  --rust-dark: #663322;
  --sans: "Helvetica Neue", "Neue Haas Grotesk Text Pro", Arial, sans-serif;
  --serif:
    "Iowan Old Style", "Palatino Linotype", Palatino, Baskerville, Georgia,
    serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --page-gutter: clamp(1.25rem, 4.6vw, 4.75rem);
  --max-width: 1240px;
}

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

html {
  background: var(--paper);
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(
      circle at 12% 8%,
      rgba(255, 252, 239, 0.28),
      transparent 28rem
    ),
    radial-gradient(
      circle at 86% 46%,
      rgba(135, 87, 50, 0.05),
      transparent 34rem
    ),
    var(--paper);
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

::selection {
  color: var(--paper-light);
  background: var(--rust);
}

a {
  color: inherit;
  text-decoration-color: var(--rule-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.24em;
  transition:
    color 160ms ease,
    text-decoration-color 160ms ease;
}

a:hover {
  color: var(--rust-dark);
  text-decoration-color: currentColor;
}

a:focus-visible,
button:focus-visible,
canvas:focus-visible {
  outline: 2px solid var(--rust);
  outline-offset: 4px;
}

p,
h1,
h2,
h3 {
  margin-top: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.svg-definitions {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.skip-link {
  position: absolute;
  top: 0.75rem;
  left: var(--page-gutter);
  z-index: 100;
  padding: 0.55rem 0.8rem;
  color: var(--paper-light);
  background: var(--ink);
  font-family: var(--sans);
  font-size: 0.8rem;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: calc(var(--max-width) + (2 * var(--page-gutter)));
  margin: 0 auto;
  padding: 1.15rem var(--page-gutter);
  border-bottom: 1px solid var(--rule);
  background: rgba(232, 221, 198, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.wordmark {
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-decoration: none;
  cursor: pointer;
}

.lorenz-warhol {
  width: min(94vw, calc(100svh - 2rem));
  max-width: none;
  max-height: none;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
}

.lorenz-warhol::backdrop {
  background: rgba(44, 42, 35, 0.84);
  backdrop-filter: blur(0.45rem);
  -webkit-backdrop-filter: blur(0.45rem);
}

.lorenz-warhol-panel {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
}

.lorenz-warhol-grid {
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  width: 100%;
  height: 100%;
  padding: 0;
  gap: clamp(2px, 0.32vw, 4px);
  overflow: hidden;
  border: 0;
  background: var(--ink);
  box-shadow: 0 1.5rem 4rem rgba(22, 20, 16, 0.38);
  cursor: pointer;
}

.lorenz-warhol-grid canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.lorenz-warhol-grid canvas:nth-child(1) {
  background: #f6b6c8;
}

.lorenz-warhol-grid canvas:nth-child(2) {
  background: #a8d8c8;
}

.lorenz-warhol-grid canvas:nth-child(3) {
  background: #f7d58b;
}

.lorenz-warhol-grid canvas:nth-child(4) {
  background: #b9c8f0;
}

.lorenz-warhol-grid canvas:nth-child(5) {
  background: #efb38e;
}

.lorenz-warhol-grid canvas:nth-child(6) {
  background: #d7b7df;
}

.lorenz-warhol-grid canvas:nth-child(7) {
  background: #a9dce3;
}

.lorenz-warhol-grid canvas:nth-child(8) {
  background: #f3c1a4;
}

.lorenz-warhol-grid canvas:nth-child(9) {
  background: #c7d79b;
}

.lorenz-warhol-close {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  z-index: 1;
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(44, 42, 35, 0.68);
  border-radius: 50%;
  color: var(--ink);
  background: rgba(240, 232, 216, 0.88);
  font-family: var(--sans);
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  transition:
    color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.lorenz-warhol-close:hover {
  color: var(--paper-light);
  background: var(--ink);
  transform: rotate(8deg);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: clamp(0.9rem, 2.4vw, 2rem);
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.site-nav a {
  position: relative;
  text-decoration: none;
}

.site-nav a::after {
  position: absolute;
  right: 0;
  bottom: -0.35rem;
  left: 0;
  height: 1px;
  background: currentColor;
  content: "";
  opacity: 0;
  transform: scaleX(0.25);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.site-nav a:hover::after,
.site-nav a[aria-current="true"]::after {
  opacity: 1;
  transform: scaleX(1);
}

main,
.site-footer {
  width: min(var(--max-width), calc(100% - (2 * var(--page-gutter))));
  margin-inline: auto;
}

.hero {
  padding: clamp(2.25rem, 4.5vw, 4rem) 0 clamp(3.5rem, 6vw, 5rem);
}

.hero-copy {
  display: flex;
  gap: 2rem;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.35rem;
}

.eyebrow,
.section-index,
.entry-meta {
  font-family: var(--mono);
  font-size: 0.69rem;
  line-height: 1.4;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow {
  margin-bottom: 0;
  color: var(--rust-dark);
  font-weight: 400;
}

.hero-summary {
  max-width: none;
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: clamp(0.95rem, 1.25vw, 1.1rem);
  text-align: right;
}

.gravity-banner {
  position: relative;
  left: 50%;
  width: min(92rem, calc(100vw - 2rem));
  height: clamp(10.5rem, 17vw, 15rem);
  overflow: hidden;
  transform: translateX(-50%);
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule-strong);
  background:
    linear-gradient(100deg, rgba(255, 250, 235, 0.2), transparent 38%),
    var(--paper-deep);
  isolation: isolate;
  cursor: none;
}

.gravity-banner::before,
.gravity-banner::after {
  position: absolute;
  z-index: 2;
  width: 1.4rem;
  height: 1.4rem;
  border-color: var(--rule-strong);
  pointer-events: none;
  content: "";
}

.gravity-banner::before {
  top: 0.75rem;
  left: 0.75rem;
  border-top: 1px solid;
  border-left: 1px solid;
}

.gravity-banner::after {
  right: 0.75rem;
  bottom: 0.75rem;
  border-right: 1px solid;
  border-bottom: 1px solid;
}

#gravity-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: pan-y;
  cursor: none;
}

.gravity-energy {
  position: absolute;
  right: 2.75rem;
  bottom: 0.65rem;
  z-index: 3;
  margin: 0;
  padding: 0.12rem 0.38rem;
  color: var(--ink-soft);
  background: rgba(216, 201, 170, 0.78);
  font-family: var(--mono);
  font-size: 0.62rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  letter-spacing: 0.04em;
  white-space: nowrap;
  pointer-events: none;
}

#gravity-energy-value {
  display: inline-block;
  min-width: 9ch;
  text-align: right;
}

.section {
  display: grid;
  grid-template-columns: minmax(8.5rem, 0.25fr) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 7rem);
  padding: clamp(4.75rem, 9vw, 8rem) 0;
  border-top: 1px solid var(--rule-strong);
}

.section-heading {
  align-self: start;
}

.section-index {
  margin-bottom: 1rem;
  color: var(--rust-dark);
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: clamp(1.65rem, 2.6vw, 2.35rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.035em;
}

.section-content {
  min-width: 0;
}

.about-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(9.5rem, 15vw, 12.5rem);
  gap: clamp(2.5rem, 6vw, 5.5rem);
  align-items: start;
}

.about-text > p {
  max-width: 49rem;
  color: var(--ink);
  font-size: clamp(1.05rem, 1.45vw, 1.22rem);
  font-weight: 400;
  line-height: 1.6;
}

.profile-portrait {
  width: 100%;
  margin: 0;
  justify-self: end;
}

.profile-portrait img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border: 1px solid var(--rule-strong);
  border-radius: 50%;
  object-fit: cover;
  filter: sepia(0.28) saturate(0.82) contrast(0.96);
}

.line-list {
  margin-top: clamp(2.5rem, 5vw, 4.5rem);
  border-top: 1px solid var(--rule);
}

.line-item {
  display: grid;
  grid-template-columns: auto minmax(1.5rem, 1fr) max-content;
  gap: clamp(0.75rem, 2vw, 1.4rem);
  align-items: center;
  min-height: 3.75rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--rule);
}

.line-label {
  font-size: clamp(1.02rem, 1.5vw, 1.2rem);
  line-height: 1.35;
}

.line-rule {
  min-width: 1rem;
  border-top: 1px solid var(--rule);
}

.line-item a,
.entry-links a,
.single-entry-link,
.site-footer a {
  font-family: var(--sans);
  font-size: 0.71rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.085em;
  text-transform: uppercase;
  white-space: nowrap;
}

.entry-list {
  border-top: 1px solid var(--rule);
}

.entry-row {
  display: grid;
  grid-template-columns: minmax(18rem, 4fr) minmax(2rem, 1fr) max-content;
  gap: clamp(0.9rem, 2.2vw, 1.8rem);
  align-items: center;
  padding: clamp(1.45rem, 2.8vw, 2.15rem) 0;
  border-bottom: 1px solid var(--rule);
}

.entry-copy {
  min-width: 0;
}

.entry-meta {
  margin-bottom: 0.55rem;
  color: var(--rust-dark);
}

.entry-row h3 {
  max-width: 34ch;
  margin-bottom: 0.55rem;
  font-size: clamp(1.28rem, 2.1vw, 1.78rem);
  font-weight: 400;
  line-height: 1.13;
  letter-spacing: -0.025em;
}

.entry-note {
  max-width: 65ch;
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.45;
}

.entry-links {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  align-items: flex-end;
}

.section-intro {
  max-width: 38rem;
  margin-bottom: 2rem;
  color: var(--ink-soft);
  font-size: clamp(1.12rem, 1.8vw, 1.4rem);
}

.derivation-list {
  margin-top: 0;
}

.derivation-item {
  border-bottom: 1px solid var(--rule);
}

.derivation-summary {
  display: grid;
  grid-template-columns: auto minmax(1.5rem, 1fr) max-content;
  gap: clamp(0.75rem, 2vw, 1.4rem);
  align-items: center;
  min-height: 3.75rem;
  padding: 0.9rem 0;
  cursor: pointer;
  list-style: none;
}

.derivation-summary::-webkit-details-marker {
  display: none;
}

.derivation-summary::marker {
  content: "";
}

.derivation-summary:focus-visible {
  outline: 2px solid var(--rust);
  outline-offset: 4px;
}

.derivation-toggle::before {
  content: "Read +";
  font-family: var(--sans);
  font-size: 0.71rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.085em;
  text-transform: uppercase;
  white-space: nowrap;
}

.derivation-item[open] .derivation-toggle::before {
  content: "Close −";
}

.derivation-body {
  max-width: 68rem;
  padding: 1rem 0 clamp(2.25rem, 4vw, 3.5rem);
  color: var(--ink-soft);
}

.derivation-body p {
  max-width: 68ch;
}

.derivation-body mjx-container[display="true"] {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.6rem 0;
  text-align: left !important;
}

.contact-section {
  padding-bottom: clamp(5rem, 11vw, 9rem);
}

.contact-icons {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(1.25rem, 3.2vw, 2.6rem);
  align-items: center;
  justify-content: center;
}

.contact-icons a {
  display: grid;
  place-items: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  color: var(--ink);
  font-size: clamp(2.1rem, 4vw, 3.15rem);
  line-height: 1;
  text-decoration: none;
  transition:
    color 160ms ease,
    transform 160ms ease;
}

.contact-icons a:hover {
  color: var(--rust-dark);
  transform: translateY(-0.12rem);
}

.contact-icon {
  display: block;
  width: 1em;
  height: 1em;
  fill: currentColor;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.75rem 0 2.4rem;
  border-top: 1px solid var(--rule-strong);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.69rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.site-footer p {
  margin-bottom: 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: flex-end;
}

@media (min-width: 860px) {
  .section-heading {
    position: sticky;
    top: 6.5rem;
  }
}

@media (max-width: 760px) {
  .site-header {
    gap: 1.25rem;
  }

  .site-nav {
    gap: 0.75rem 1rem;
    font-size: 0.65rem;
  }

  .hero-copy {
    flex-direction: column;
    gap: 0.35rem;
    align-items: flex-start;
  }

  .hero-summary {
    text-align: left;
  }

  .section {
    grid-template-columns: 1fr;
    gap: 2.75rem;
  }

  .section-heading {
    display: flex;
    align-items: baseline;
    gap: 1.2rem;
  }

  .section-index {
    margin-bottom: 0;
  }

  .entry-row {
    grid-template-columns: minmax(0, 1fr) minmax(1.25rem, 0.3fr) max-content;
  }
}

@media (max-width: 520px) {
  :root {
    --page-gutter: 1.15rem;
  }

  html {
    scroll-padding-top: 8rem;
  }

  .site-header {
    align-items: flex-start;
    padding-block: 0.9rem;
  }

  .wordmark {
    line-height: 1;
  }

  .site-nav {
    max-width: 15rem;
  }

  .gravity-banner {
    height: 10.5rem;
  }

  .gravity-energy {
    right: 2.4rem;
    bottom: 0.55rem;
    padding-inline: 0.3rem;
    font-size: 0.58rem;
  }

  .line-item {
    grid-template-columns: minmax(0, auto) minmax(0.75rem, 1fr) max-content;
  }

  .derivation-summary {
    grid-template-columns: minmax(0, auto) minmax(0.75rem, 1fr) max-content;
  }

  .line-label {
    font-size: 0.96rem;
  }

  .entry-row {
    grid-template-columns: minmax(0, 1fr) minmax(0.75rem, 0.16fr) max-content;
    gap: 0.7rem;
  }

  .entry-note {
    display: none;
  }

  .entry-row h3 {
    margin-bottom: 0;
    font-size: 1.18rem;
  }

  .entry-links {
    gap: 0.55rem;
  }

  .entry-links a,
  .single-entry-link,
  .line-item a,
  .derivation-toggle::before {
    font-size: 0.64rem;
  }

  .about-intro {
    grid-template-columns: 1fr;
  }

  .profile-portrait {
    width: 7.75rem;
    order: -1;
    justify-self: start;
  }
}

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

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

@media print {
  .site-header,
  .gravity-banner,
  .lorenz-warhol,
  .site-footer a {
    display: none;
  }

  body {
    background: white;
  }

  main,
  .site-footer {
    width: 100%;
  }
}
