:root {
  color-scheme: light;
  --paper: #f7f4ee;
  --ink: #171817;
  --muted: #64645f;
  --line: #d9d2c7;
  --panel: #ffffff;
  --teal: #0f5d5e;
  --teal-dark: #083f41;
  --brick: #8b3f2f;
  --brass: #b08a3c;
  --shadow: 0 18px 50px rgba(23, 24, 23, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

a {
  color: inherit;
}

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 56px);
  background: rgba(247, 244, 238, 0.86);
  border-bottom: 1px solid rgba(217, 210, 199, 0.78);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  background: var(--ink);
  color: var(--paper);
  border-radius: 8px;
  font-size: 0.82rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(14px, 3vw, 30px);
  color: var(--muted);
  font-size: 0.94rem;
}

.nav-links a {
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--ink);
}

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 132px clamp(18px, 5vw, 72px) 92px;
  background: #020203;
  color: #fffaf0;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at 72% 50%, rgba(0, 0, 0, 0) 0 23%, rgba(0, 0, 0, 0.18) 42%, rgba(0, 0, 0, 0.58) 100%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.74) 0%, rgba(0, 0, 0, 0.42) 34%, rgba(0, 0, 0, 0.06) 68%),
    linear-gradient(0deg, var(--paper) 0, rgba(247, 244, 238, 0) 170px);
  pointer-events: none;
}

.hero-content {
  position: relative;
  max-width: 860px;
  z-index: 2;
}

#black-hole-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.eyebrow,
.section-kicker {
  margin: 0 0 14px;
  color: var(--teal);
  font-size: 0.77rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 9ch;
  margin-bottom: 20px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(4rem, 12vw, 9.5rem);
  line-height: 0.9;
  font-weight: 500;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5vw, 4.25rem);
  line-height: 1.02;
  font-weight: 500;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 12px;
  font-size: 1.08rem;
  line-height: 1.25;
}

.hero-copy {
  max-width: 640px;
  margin-bottom: 30px;
  color: #4a4b47;
  font-size: clamp(1.08rem, 2vw, 1.35rem);
}

.hero .eyebrow {
  color: #fffaf0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4.1vw, 3.6rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
}

.hero .hero-copy {
  max-width: 34rem;
  margin-left: 0.7rem;
  color: rgba(255, 250, 240, 0.92);
  font-size: clamp(1.35rem, 2.25vw, 2rem);
  font-weight: 300;
  line-height: 1.35;
  text-align: center;
  text-shadow: 0 2px 26px rgba(0, 0, 0, 0.74);
}

.hero h1 {
  max-width: none;
  color: #ffffff;
  font-size: clamp(4rem, 8vw, 7rem);
  font-weight: 400;
  text-shadow:
    0 2px 18px rgba(0, 0, 0, 0.92),
    0 0 18px rgba(255, 255, 255, 0.2),
    0 0 2px rgba(255, 255, 255, 0.92);
}

.hero .button {
  border-color: rgba(255, 250, 240, 0.72);
  color: #fffaf0;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
}

.hero .button.primary {
  border-color: rgba(255, 250, 240, 0.9);
  background: rgba(255, 250, 240, 0.92);
  color: #11110c;
}

.hero-actions,
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 750;
}

.button.primary {
  background: var(--ink);
  color: var(--paper);
}

.button.secondary {
  background: rgba(255, 255, 255, 0.42);
}

.button:hover {
  transform: translateY(-1px);
}

.intro-section,
.notes-section,
.research-section,
.contact-section {
  padding: clamp(72px, 10vw, 120px) clamp(18px, 5vw, 72px);
}

/* About section */
.intro-grid {
  display: grid;
  max-width: 1180px;
  margin: 0 auto;
  grid-template-columns: minmax(240px, 380px) minmax(0, 1fr);
  column-gap: clamp(40px, 7vw, 96px);
  row-gap: 40px;
  align-items: center;
}

.about-photo {
  position: relative;
  width: 100%;
  margin: 0;
}

/* Offset brass frame behind the portrait */
.about-photo::before {
  content: "";
  position: absolute;
  inset: 16px -16px -16px 16px;
  border: 1px solid var(--brass);
  border-radius: 10px;
}

.about-photo img {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 40% 30%;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.intro-copy {
  max-width: 640px;
}

.intro-copy h2 {
  margin-bottom: 24px;
  font-size: clamp(2.2rem, 4.2vw, 3.4rem);
}

.intro-copy p:not(.section-kicker) {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 1.08rem;
}

.intro-copy .intro-lede {
  color: var(--ink);
  font-size: 1.18rem;
}

.about-facts {
  display: grid;
  gap: 12px;
  margin: 28px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.about-facts div {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 16px;
}

.about-facts dt {
  padding-top: 0.2em;
  color: var(--brick);
  font-size: 0.77rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.about-facts dd {
  margin: 0;
  color: var(--ink);
}

.notes-section {
  background: #ebe5da;
}

.section-heading {
  display: flex;
  max-width: 1180px;
  margin: 0 auto 26px;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.section-heading.simple {
  display: block;
}

.search-box input {
  width: min(320px, 100%);
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}

.filter-row {
  display: flex;
  max-width: 1180px;
  margin: 0 auto 22px;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-button {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid #c9c0b3;
  border-radius: 8px;
  background: transparent;
  color: #4e504a;
  cursor: pointer;
  font: inherit;
  font-size: 0.93rem;
}

.filter-button.active,
.filter-button:hover {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
}

.notes-grid {
  display: grid;
  max-width: 1180px;
  margin: 0 auto;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.note-card {
  display: flex;
  min-height: 286px;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
  background: var(--panel);
  border: 1px solid rgba(23, 24, 23, 0.08);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.note-card[hidden] {
  display: none;
}

.note-meta,
.note-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 0.87rem;
}

.note-meta span:first-child {
  color: var(--brick);
  font-weight: 800;
}

.note-card p {
  color: var(--muted);
}

.note-footer {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.note-footer a {
  color: var(--teal-dark);
  font-weight: 800;
  text-decoration: none;
}

.research-section {
  background: var(--paper);
}

.interest-list {
  display: grid;
  max-width: 1180px;
  margin: 34px auto 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.interest-list article {
  padding: 28px 28px 18px 0;
  border-bottom: 1px solid var(--line);
}

.interest-list span {
  display: block;
  margin-bottom: 26px;
  color: var(--brass);
  font-weight: 800;
}

.interest-list p {
  color: var(--muted);
}

.contact-section {
  display: flex;
  max-width: 1180px;
  margin: 0 auto;
  align-items: end;
  justify-content: space-between;
  gap: 36px;
}

.contact-section h2 {
  max-width: 720px;
}

.contact-links a {
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 750;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 28px clamp(18px, 5vw, 72px);
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  text-decoration: none;
}

.reader-page {
  background:
    radial-gradient(circle at 88% 12%, rgba(15, 93, 94, 0.18), transparent 30%),
    radial-gradient(circle at 8% 16%, rgba(176, 138, 60, 0.15), transparent 26%),
    var(--paper);
}

.reader-main {
  padding: 118px clamp(18px, 5vw, 72px) clamp(54px, 8vw, 92px);
}

.reader-hero {
  display: flex;
  max-width: 1280px;
  margin: 0 auto 26px;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.reader-hero h1 {
  max-width: 980px;
  margin-bottom: 0;
  font-size: clamp(2.7rem, 7vw, 6.3rem);
}

.reader-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.pdf-stage {
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(10px, 2vw, 18px);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.4)),
    rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(23, 24, 23, 0.1);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.pdf-stage iframe {
  display: block;
  width: 100%;
  height: min(78vh, 960px);
  min-height: 680px;
  border: 0;
  border-radius: 6px;
  background: white;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 840px) {
  .site-header {
    position: sticky;
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 18px;
  }

  .nav-links {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.88rem;
  }

  .hero {
    min-height: 88svh;
    align-items: flex-start;
    padding: 138px 18px 84px;
  }

  .hero-content {
    align-self: start;
  }

  .hero .hero-copy {
    max-width: 23rem;
    margin-left: 0;
    text-align: left;
    font-size: 1.25rem;
  }

  .intro-grid,
  .interest-list {
    grid-template-columns: 1fr;
  }

  .about-photo {
    max-width: 340px;
  }

  .about-photo::before {
    inset: 10px -10px -10px 10px;
  }

  .section-heading,
  .contact-section,
  .reader-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .search-box,
  .search-box input {
    width: 100%;
  }

  .site-footer {
    flex-direction: column;
  }

  .reader-main {
    padding-top: 72px;
  }

  .reader-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .pdf-stage iframe {
    height: 72vh;
    min-height: 560px;
  }
}

@media (max-width: 520px) {
  .brand {
    font-size: 0.95rem;
  }

  .nav-links {
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 2px;
  }

  h1 {
    font-size: 3.7rem;
  }

  .hero h1 {
    max-width: 9ch;
    font-size: clamp(4rem, 18vw, 6.2rem);
  }

  .hero-actions,
    .contact-links,
  .reader-actions {
    width: 100%;
  }

  .button,
  .contact-links a {
    width: 100%;
  }

  .pdf-stage {
    margin-inline: -8px;
  }

  .pdf-stage iframe {
    min-height: 520px;
  }
}

.black-hole-hero h1 {
  max-width: none;
  font-size: clamp(4rem, 8vw, 7rem);
}

@media (max-width: 520px) {
  .black-hole-hero h1 {
    max-width: 9ch;
    font-size: clamp(4rem, 18vw, 6.2rem);
  }
}

/* ==================================================================
   Blog
   ================================================================== */

.blog-main,
.post-main {
  padding: 132px clamp(18px, 5vw, 72px) 96px;
  max-width: 1180px;
  margin: 0 auto;
}

.blog-hero {
  padding-bottom: 48px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 48px;
}

.blog-hero h1 {
  font-size: clamp(2.6rem, 6vw, 4rem);
  margin: 8px 0 18px;
  letter-spacing: -0.02em;
}

.blog-hero-copy {
  max-width: 62ch;
  color: var(--muted);
  font-size: 1.06rem;
  margin: 0;
}

/* --- index list --- */

.post-list {
  display: grid;
  gap: 28px;
}

.post-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px clamp(20px, 3vw, 34px);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.post-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.post-card-meta {
  display: flex;
  gap: 16px;
  font-size: 0.84rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.post-card h3 {
  margin: 12px 0 10px;
  font-size: 1.55rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.post-card h3 a {
  text-decoration: none;
}

.post-card h3 a:hover {
  color: var(--teal);
}

.post-card p {
  margin: 0 0 18px;
  color: var(--muted);
  max-width: 68ch;
}

.post-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.post-tag {
  font-size: 0.78rem;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(15, 93, 94, 0.08);
  color: var(--teal-dark);
  border: 1px solid rgba(15, 93, 94, 0.16);
}

.post-empty,
.post-error {
  color: var(--muted);
  font-style: italic;
}

.post-error {
  color: var(--brick);
  font-style: normal;
}

/* --- single post --- */

.post-article {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0 56px;
  max-width: 1180px;
}

@media (min-width: 1080px) {
  .post-article {
    grid-template-columns: minmax(0, 72ch) 1fr;
  }

  .post-header,
  .post-body,
  .post-footer {
    grid-column: 1;
  }

  .post-toc {
    grid-column: 2;
    grid-row: 2 / span 2;
    position: sticky;
    top: 110px;
    align-self: start;
  }
}

.post-back {
  display: inline-block;
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 22px;
}

.post-back:hover {
  color: var(--teal);
}

.post-header h1 {
  font-size: clamp(2.1rem, 4.6vw, 3.1rem);
  line-height: 1.14;
  letter-spacing: -0.022em;
  margin: 0 0 18px;
  max-width: 24ch;
}

.post-summary {
  font-size: 1.16rem;
  line-height: 1.6;
  color: var(--muted);
  max-width: 62ch;
  margin: 0 0 22px;
}

.post-meta {
  display: flex;
  gap: 18px;
  font-size: 0.86rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-bottom: 22px;
}

.post-header .post-card-tags {
  padding-bottom: 34px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 40px;
}

/* --- table of contents --- */

.post-toc {
  font-size: 0.9rem;
  margin-bottom: 40px;
}

.toc-heading {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
  color: var(--muted);
  margin: 0 0 12px;
}

.post-toc ol {
  list-style: none;
  margin: 0;
  padding: 0 0 0 14px;
  border-left: 2px solid var(--line);
}

.post-toc li {
  margin: 0 0 9px;
  line-height: 1.4;
}

.post-toc .toc-sub {
  padding-left: 14px;
  font-size: 0.86rem;
}

.post-toc a {
  text-decoration: none;
  color: var(--muted);
}

.post-toc a:hover {
  color: var(--teal);
}

/* --- prose --- */

.post-body {
  font-size: 1.08rem;
  line-height: 1.75;
  max-width: 72ch;
}

.post-body > * {
  max-width: 68ch;
}

.post-body h2 {
  font-size: 1.72rem;
  letter-spacing: -0.012em;
  margin: 54px 0 16px;
  padding-top: 6px;
  scroll-margin-top: 100px;
}

.post-body h3 {
  font-size: 1.28rem;
  margin: 38px 0 12px;
  scroll-margin-top: 100px;
}

.post-body p {
  margin: 0 0 22px;
}

.post-body a {
  color: var(--teal);
  text-underline-offset: 3px;
}

.post-body ul,
.post-body ol {
  margin: 0 0 22px;
  padding-left: 24px;
}

.post-body li {
  margin-bottom: 9px;
}

.post-body blockquote {
  margin: 30px 0;
  padding: 6px 0 6px 24px;
  border-left: 3px solid var(--brass);
  color: var(--muted);
  font-style: italic;
}

.post-body blockquote p:last-child {
  margin-bottom: 0;
}

.post-body hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 48px 0;
}

.post-body img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  display: block;
  margin: 32px 0 10px;
}

.post-body figure {
  margin: 32px 0;
}

.post-body figcaption {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 10px;
}

.post-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: rgba(23, 24, 23, 0.05);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
}

.post-body pre {
  background: #1c1d1b;
  color: #f2efe7;
  border-radius: 10px;
  padding: 20px 22px;
  overflow-x: auto;
  margin: 28px 0;
  max-width: 72ch;
}

.post-body pre code {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font-size: 0.88rem;
}

.post-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 28px 0;
  font-size: 0.96rem;
}

.post-body th,
.post-body td {
  border: 1px solid var(--line);
  padding: 9px 13px;
  text-align: left;
}

.post-body th {
  background: rgba(15, 93, 94, 0.06);
}

/* --- maths --- */

.post-body .katex {
  font-size: 1.04em;
}

.post-body .katex-display {
  margin: 28px 0;
  padding: 6px 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.post-footer {
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

@media (max-width: 720px) {
  .post-body {
    font-size: 1.02rem;
  }

  .post-body .katex-display {
    font-size: 0.94em;
  }
}
@media (max-width: 520px) {
  .about-facts div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}
