:root {
  color-scheme: dark;
  --ink: #0b0f0d;
  --ink-soft: #111713;
  --paper: #eee8db;
  --paper-muted: #aaa99f;
  --green: #78a981;
  --green-deep: #365d42;
  --copper: #9d6145;
  --line: rgba(238, 232, 219, 0.2);
  --serif: Baskerville, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --gutter: clamp(1.4rem, 4vw, 4rem);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 70% 22%, rgba(62, 91, 69, 0.08), transparent 32rem),
    var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  text-rendering: optimizeLegibility;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0.016), transparent 35%, rgba(255, 255, 255, 0.008));
  content: "";
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.72'/%3E%3C/svg%3E");
}

a {
  color: inherit;
}

.site-header {
  display: flex;
  position: relative;
  z-index: 5;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 1.65rem var(--gutter) 0;
}

.wordmark {
  font-family: var(--serif);
  font-size: clamp(1.65rem, 2.2vw, 2.25rem);
  font-weight: 400;
  letter-spacing: -0.04em;
  text-decoration: none;
}

.thesis-link {
  padding-block: 0.3rem;
  border-bottom: 1px solid var(--copper);
  color: var(--paper-muted);
  font-size: 0.9rem;
  text-decoration: none;
  transition: color 180ms ease, border-color 180ms ease;
}

.thesis-link:hover,
.thesis-link:focus-visible {
  border-color: var(--green);
  color: var(--paper);
}

.hero {
  display: grid;
  grid-template-columns: minmax(32rem, 0.96fr) minmax(38rem, 1.04fr);
  min-height: 650px;
  padding: clamp(3.5rem, 6vw, 6.5rem) var(--gutter) 1.5rem;
  border-bottom: 1px solid rgba(157, 97, 69, 0.26);
}

.hero-copy {
  align-self: center;
  z-index: 2;
  max-width: 43rem;
  padding-bottom: 4rem;
}

h1,
.thesis h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.055em;
}

h1 {
  font-size: clamp(4rem, 5.45vw, 5.9rem);
  line-height: 0.94;
}

.accent-rule {
  display: block;
  width: 3.6rem;
  height: 2px;
  margin: clamp(2.4rem, 5vw, 4.5rem) 0 2rem;
  background: var(--green);
}

.hero-copy p {
  max-width: 38rem;
  margin: 0;
  color: #d8d3c8;
  font-size: clamp(1.2rem, 1.65vw, 1.65rem);
  font-weight: 300;
  line-height: 1.65;
}

.context-map {
  --pointer-x: 0;
  --pointer-y: 0;
  position: relative;
  min-height: 580px;
  perspective: 1100px;
}

.lineage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  stroke: rgba(120, 169, 129, 0.75);
  stroke-width: 1.1;
}

.lineage path {
  stroke-dasharray: 6 6;
  animation: drift 12s linear infinite;
}

.lineage circle {
  fill: var(--green-deep);
  stroke: var(--green);
}

.fragment,
.shared-context {
  position: absolute;
  border: 1px solid rgba(211, 218, 205, 0.46);
  background: rgba(24, 30, 26, 0.8);
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.18), inset 0 1px rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(14px);
  transition: border-color 220ms ease, background 220ms ease, transform 320ms cubic-bezier(0.2, 0.75, 0.2, 1);
  transform:
    translate3d(calc(var(--pointer-x) * var(--depth, 1) * 9px), calc(var(--pointer-y) * var(--depth, 1) * 9px), 0)
    rotateX(calc(var(--pointer-y) * -1.25deg))
    rotateY(calc(var(--pointer-x) * 1.25deg));
}

.fragment:hover,
.fragment:focus-visible,
.shared-context:hover,
.shared-context:focus-visible {
  z-index: 4;
  border-color: rgba(120, 169, 129, 0.9);
  outline: none;
  background: rgba(31, 40, 34, 0.96);
}

.fragment {
  width: 14.75rem;
  min-height: 12.5rem;
  padding: 1.125rem;
}

.fragment h2,
.shared-context h2 {
  margin: 0 0 0.75rem;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 400;
}

.fragment p,
.shared-context p,
.shared-context footer {
  color: #c6c6bd;
  font-size: 0.84rem;
  line-height: 1.5;
}

.fragment p {
  min-height: 3.2rem;
  margin: 0;
}

.fragment small {
  display: block;
  margin-top: 0.8rem;
  color: #7f817b;
  font-size: 0.68rem;
  letter-spacing: 0.03em;
}

.fragment-know {
  --depth: 0.8;
  top: 0;
  left: 20%;
}

.fragment-decide {
  --depth: 1.15;
  top: 35%;
  left: 7%;
}

.fragment-changed {
  --depth: 0.95;
  bottom: -2rem;
  left: 0;
}

.fragment-open {
  --depth: 1.3;
  right: 25%;
  bottom: -1rem;
}

.shared-context {
  --depth: 0.45;
  top: 24%;
  right: 0;
  width: 13.5rem;
  min-height: 19.5rem;
  padding: 1.7rem;
  border-bottom: 2px solid var(--copper);
}

.shared-context svg {
  width: 2rem;
  margin-bottom: 1rem;
  stroke: var(--green);
  stroke-width: 1.2;
  fill: none;
}

.shared-context p + p {
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}

.shared-context footer {
  margin-top: 1.7rem;
  color: #888d87;
}

.shared-rule {
  display: block;
  width: 2.1rem;
  height: 1px;
  margin-bottom: 1.15rem;
  background: var(--green-deep);
}

.specimen {
  display: block;
  width: 2rem;
  height: 1.75rem;
  margin-bottom: 0.7rem;
  opacity: 0.9;
}

.specimen-crystal,
.specimen-open {
  border: 1px solid var(--green);
  clip-path: polygon(50% 0, 82% 30%, 72% 82%, 50% 100%, 24% 80%, 16% 31%);
  transform: rotate(4deg);
}

.specimen-open {
  border-color: var(--copper);
  transform: rotate(18deg) scale(0.84);
}

.specimen-branch {
  position: relative;
  width: 1px;
  margin-left: 0.8rem;
  background: var(--copper);
  transform: rotate(-9deg);
}

.specimen-branch::before,
.specimen-branch::after {
  position: absolute;
  width: 1rem;
  height: 1px;
  background: var(--copper);
  content: "";
  transform-origin: left;
}

.specimen-branch::before {
  top: 0.8rem;
  transform: rotate(-38deg);
}

.specimen-branch::after {
  top: 1.45rem;
  transform: rotate(35deg);
}

.specimen-leaf {
  border: 1px solid var(--green);
  border-radius: 100% 0 100% 0;
  transform: rotate(-24deg) scale(0.82);
}

.thesis {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(2.8rem, 5vw, 4.7rem) var(--gutter) clamp(2.4rem, 4vw, 4rem);
  text-align: center;
}

.thesis h2 {
  font-size: clamp(2.7rem, 5vw, 5.25rem);
  line-height: 1;
}

.follow-form {
  display: grid;
  grid-template-columns: minmax(18rem, 30rem) minmax(12rem, 17rem);
  gap: 0.55rem;
  width: min(100%, 48rem);
  margin-top: 2.4rem;
}

.follow-form input,
.follow-form button {
  min-height: 4.1rem;
  border-radius: 0;
  font-family: var(--sans);
  font-size: 1rem;
}

.follow-form input {
  width: 100%;
  padding: 0 1.35rem;
  border: 1px solid rgba(238, 232, 219, 0.38);
  outline: none;
  background: transparent;
  color: var(--paper);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.follow-form input::placeholder {
  color: #6f716c;
}

.follow-form input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(120, 169, 129, 0.12);
}

.follow-form button {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  justify-content: center;
  padding: 0 1.5rem;
  border: 1px solid #78a981;
  background: var(--green-deep);
  color: #f5f0e4;
  cursor: pointer;
  transition: background 180ms ease, transform 180ms ease;
}

.follow-form button:hover,
.follow-form button:focus-visible {
  background: #477552;
  outline: none;
  transform: translateY(-2px);
}

.follow-form button svg {
  width: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
}

.form-note {
  min-height: 1.35rem;
  margin: 0.75rem 0 0;
  color: var(--paper-muted);
  font-size: 0.78rem;
}

.continuum {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: clamp(2.3rem, 4vw, 3.5rem);
  padding-top: 1.55rem;
  border-top: 1px solid rgba(157, 97, 69, 0.38);
  color: #bebdb5;
  font-size: clamp(0.66rem, 0.95vw, 0.82rem);
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.continuum i {
  position: relative;
  width: clamp(2.2rem, 6vw, 6rem);
  height: 1px;
  margin-inline: clamp(0.8rem, 2vw, 1.8rem);
  background: linear-gradient(90deg, transparent, var(--green));
}

.continuum i::after {
  position: absolute;
  top: -3px;
  right: 0;
  width: 6px;
  height: 6px;
  border-top: 1px solid var(--green);
  border-right: 1px solid var(--green);
  content: "";
  transform: rotate(45deg);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  padding: 1.2rem var(--gutter) 1.6rem;
  border-top: 1px solid rgba(238, 232, 219, 0.08);
  color: #666a65;
  font-size: 0.72rem;
}

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

[data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 800ms ease, transform 800ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

@keyframes drift {
  to { stroke-dashoffset: -120; }
}

@media (max-width: 1100px) {
  .hero {
    grid-template-columns: 0.9fr 1.1fr;
  }

  .context-map {
    transform: scale(0.86);
    transform-origin: center right;
  }
}

@media (max-width: 860px) {
  .hero {
    display: block;
    padding-top: 5rem;
  }

  .hero-copy {
    max-width: 44rem;
    padding-bottom: 4rem;
  }

  .context-map {
    width: min(100%, 46rem);
    min-height: 560px;
    margin-inline: auto;
    transform: none;
  }
}

@media (max-width: 620px) {
  .site-header {
    padding-top: 1.2rem;
  }

  .hero {
    min-height: 0;
    padding-top: 4.5rem;
  }

  h1 {
    font-size: clamp(3.35rem, 15.4vw, 5rem);
  }

  .hero-copy p {
    font-size: 1.12rem;
  }

  .context-map {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
    min-height: auto;
    perspective: none;
  }

  .lineage {
    display: none;
  }

  .fragment,
  .shared-context {
    position: static;
    width: auto;
    min-height: 0;
    transform: none;
  }

  .fragment {
    padding: 1.15rem;
  }

  .fragment p {
    min-height: 0;
  }

  .fragment small {
    display: none;
  }

  .specimen {
    height: 1.8rem;
  }

  .shared-context {
    grid-column: 1 / -1;
    padding: 1.35rem;
  }

  .shared-context p + p,
  .shared-context footer {
    margin-top: 0.85rem;
    padding-top: 0.8rem;
  }

  .follow-form {
    grid-template-columns: 1fr;
  }

  .continuum {
    flex-direction: column;
    gap: 1rem;
  }

  .continuum i {
    width: 1px;
    height: 1.6rem;
    margin: 0;
    background: linear-gradient(180deg, transparent, var(--green));
  }

  .continuum i::after {
    top: auto;
    right: -3px;
    bottom: 0;
    transform: rotate(135deg);
  }

  .site-footer {
    gap: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
