:root {
  --white: #fbfdf8;
  --paper: #f3f8ee;
  --mint: #dcebd2;
  --sage: #b8d0ac;
  --deep: #10261f;
  --ink: #23352e;
  --muted: #66746d;
  --line: rgba(16, 38, 31, 0.14);
  --code: #265f4f;
  --accent: #96bd7f;
  --shadow: 0 24px 70px rgba(30, 60, 45, 0.14);
  --glow: 0 30px 110px rgba(126, 168, 101, 0.28);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 82% 12%, rgba(184, 208, 172, 0.3), transparent 30rem),
    linear-gradient(180deg, var(--white), var(--paper) 48%, #ffffff 100%);
  color: var(--deep);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(16, 38, 31, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 38, 31, 0.04) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.45), transparent 70%);
  z-index: -1;
  animation: gridDrift 18s linear infinite;
}

body.piece-page {
  background: var(--white);
}

body.piece-page::before {
  background-image:
    linear-gradient(rgba(16, 38, 31, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 38, 31, 0.035) 1px, transparent 1px);
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.28), transparent 62%);
}

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

img {
  display: block;
  max-width: 100%;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  background: rgba(251, 253, 248, 0.78);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  font-weight: 700;
  letter-spacing: 0;
}

.brand-mark {
  display: grid;
  width: 2.4rem;
  height: 2.4rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--mint);
  color: var(--code);
  font-family: "Space Mono", monospace;
  font-size: 0.95rem;
  animation: markBob 4.5s ease-in-out infinite;
}

.nav-toggle {
  display: none;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  color: var(--deep);
}

.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  display: block;
  width: 1rem;
  height: 2px;
  background: currentColor;
  content: "";
}

.nav-toggle span::before {
  transform: translateY(-0.35rem);
}

.nav-toggle span::after {
  transform: translateY(0.23rem);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.site-nav a {
  position: relative;
  border-radius: 999px;
  padding: 0.55rem 0.85rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0.85rem;
  right: 0.85rem;
  bottom: 0.42rem;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.site-nav a:hover::after,
.site-nav a.active::after {
  transform: scaleX(1);
}

.site-nav a:hover,
.site-nav a.active {
  background: var(--deep);
  color: var(--white);
  transform: translateY(-1px);
}

.main {
  position: relative;
  opacity: 1;
  transform: none;
  overflow: visible;
}

.main.leaving {
  transform: translateY(2px);
  transition: transform 140ms ease;
}

.container {
  position: relative;
  z-index: 1;
  width: min(1160px, calc(100% - 2rem));
  margin: 0 auto;
}

.hero {
  position: relative;
  display: grid;
  min-height: calc(100vh - 74px);
  grid-template-columns: minmax(0, 1.02fr) minmax(320px, 0.98fr);
  align-items: center;
  gap: clamp(2rem, 6vw, 5rem);
  padding: clamp(3rem, 8vw, 7rem) 0;
}

.hero::after {
  content: "";
  position: absolute;
  right: -10vw;
  bottom: 8vh;
  width: min(48vw, 42rem);
  aspect-ratio: 1;
  border-radius: 42% 58% 65% 35% / 40% 38% 62% 60%;
  background: rgba(184, 208, 172, 0.32);
  filter: blur(20px);
  opacity: 0.72;
  animation: liquidBlob 12s ease-in-out infinite alternate;
  z-index: 0;
}

.hero-text,
.hero-visual {
  position: relative;
  z-index: 1;
}

.hero h1,
.page-hero h1 {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(3.2rem, 8.5vw, 7.4rem);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: 0;
  animation: titleRise 850ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hero-copy {
  margin: 1.5rem 0 0;
  max-width: 38rem;
  color: var(--ink);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
}

.byline {
  margin: 1.1rem 0 0;
  color: var(--code);
  font-family: "Space Mono", monospace;
  font-size: clamp(0.9rem, 1.5vw, 1rem);
  font-weight: 700;
  text-transform: uppercase;
  animation: trackingSettle 900ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.byline + .hero-copy {
  margin-top: 0.85rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 2rem;
}

.button {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.1rem;
  border: 1px solid var(--deep);
  border-radius: 999px;
  padding: 0 1.2rem;
  background: var(--deep);
  color: var(--white);
  font-size: 0.95rem;
  font-weight: 750;
  transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 320ms ease, background 320ms ease, color 320ms ease;
}

.button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.28), transparent 62%);
  transform: translateX(-120%);
  transition: transform 500ms cubic-bezier(0.16, 1, 0.3, 1);
}

.button:hover::before {
  transform: translateX(120%);
}

.button:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: var(--glow);
}

.button.secondary {
  background: transparent;
  color: var(--deep);
}

.button.secondary:hover {
  background: var(--mint);
}

.hero-visual {
  position: relative;
  min-height: 32rem;
  transition: transform 700ms cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.terminal-card {
  position: absolute;
  inset: 4rem 0 auto auto;
  width: min(30rem, 92%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(251, 253, 248, 0.9);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: floatTerminal 7s ease-in-out infinite;
}

.terminal-card::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.52), transparent 58%);
  transform: translateX(-35%);
  animation: sheen 6s ease-in-out infinite;
  pointer-events: none;
}

.terminal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 0.8rem 1rem;
  color: var(--muted);
  font-family: "Space Mono", monospace;
  font-size: 0.8rem;
}

.dots {
  display: flex;
  gap: 0.35rem;
}

.dots i {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 50%;
  background: var(--sage);
  animation: dotPulse 1.8s ease-in-out infinite;
}

.dots i:nth-child(2) {
  animation-delay: 160ms;
}

.dots i:nth-child(3) {
  animation-delay: 320ms;
}

.code-lines {
  margin: 0;
  padding: 1.2rem;
  color: var(--code);
  font-family: "Space Mono", monospace;
  font-size: clamp(0.78rem, 1.6vw, 0.98rem);
  line-height: 1.85;
  white-space: pre-wrap;
}

.floating-note {
  position: absolute;
  left: 0;
  bottom: 2rem;
  width: min(23rem, 80%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem;
  background: var(--mint);
  box-shadow: var(--shadow);
  transform: rotate(-3deg);
  animation: floatNote 7.5s ease-in-out infinite;
}

.floating-note strong {
  display: block;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.5rem;
  line-height: 1.1;
}

.floating-note span {
  display: block;
  margin-top: 0.55rem;
  color: var(--ink);
}

.section {
  padding: clamp(4rem, 8vw, 7rem) 0;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
}

.section-heading h2 {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(2.4rem, 5vw, 4.8rem);
  line-height: 0.95;
  animation: sectionSway 8s ease-in-out infinite;
}

.section-heading p {
  max-width: 30rem;
  margin: 0;
  color: var(--muted);
}

.piece-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.piece-card {
  position: relative;
  min-height: 18rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem;
  background: rgba(255, 255, 255, 0.56);
  overflow: hidden;
  transition: transform 360ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 360ms ease, background 360ms ease, border-color 360ms ease;
  will-change: transform;
}

.piece-card::after {
  content: "";
  position: absolute;
  inset: auto -20% -45% -20%;
  height: 65%;
  background: radial-gradient(circle, rgba(184, 208, 172, 0.42), transparent 62%);
  opacity: 0;
  transition: opacity 360ms ease, transform 360ms cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.piece-card:hover {
  background: var(--white);
  border-color: rgba(38, 95, 79, 0.28);
  box-shadow: var(--glow);
  transform: translateY(-7px) scale(1.012);
}

.piece-card:hover::after {
  opacity: 1;
  transform: translateY(-10%);
}

.piece-card:focus-visible {
  outline: 3px solid rgba(38, 95, 79, 0.35);
  outline-offset: 3px;
}

.piece-card .number {
  display: inline-flex;
  margin-bottom: 2.2rem;
  color: var(--code);
  font-family: "Space Mono", monospace;
  font-size: 0.85rem;
}

.piece-card h3 {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 2rem;
  line-height: 1;
}

.piece-card p {
  margin: 1rem 0 0;
  color: var(--muted);
}

.ticker {
  display: flex;
  overflow: hidden;
  border-block: 1px solid var(--line);
  padding: 1rem 0;
  color: var(--code);
  font-family: "Space Mono", monospace;
  font-size: 0.85rem;
  white-space: nowrap;
  background: rgba(251, 253, 248, 0.42);
  backdrop-filter: blur(12px);
}

.ticker-track {
  display: flex;
  flex: 0 0 auto;
  min-width: max-content;
  gap: 1.5rem;
  padding-right: 1.5rem;
  animation: ticker 34s linear infinite;
  will-change: transform;
}

@keyframes ticker {
  to {
    transform: translateX(-100%);
  }
}

.page-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(280px, 0.5fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: end;
  padding: clamp(4rem, 9vw, 8rem) 0 clamp(2.5rem, 5vw, 4rem);
}

.page-hero::before {
  content: none;
  position: absolute;
  inset: 18% -6% auto auto;
  width: min(38vw, 32rem);
  aspect-ratio: 1;
  border-radius: 48% 52% 34% 66% / 44% 38% 62% 56%;
  background: rgba(220, 235, 210, 0.6);
  filter: blur(26px);
  animation: liquidBlob 11s ease-in-out infinite alternate;
  z-index: -1;
}

.page-hero h1 {
  font-size: clamp(3rem, 8vw, 6.5rem);
}

.page-hero p {
  margin: 1.2rem 0 0;
  max-width: 42rem;
  color: var(--ink);
  font-size: clamp(1.05rem, 2vw, 1.28rem);
}

.page-meta {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
  box-shadow: 0 16px 46px rgba(30, 60, 45, 0.08);
  animation: softSlideLeft 780ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.page-meta span {
  display: block;
  color: var(--code);
  font-family: "Space Mono", monospace;
  font-size: 0.9rem;
  text-transform: uppercase;
}

.content-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(280px, 0.38fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
  padding-bottom: clamp(4rem, 8vw, 7rem);
}

.side-stack {
  position: sticky;
  top: 6rem;
  display: grid;
  gap: 1rem;
}

.content-layout.photo-layout {
  grid-template-columns: minmax(300px, 0.48fr) minmax(420px, 0.82fr);
  gap: clamp(1.6rem, 4vw, 3rem);
}

.photo-layout .content-panel {
  position: sticky;
  top: 6rem;
}

.photo-layout .media-frame {
  position: relative;
  top: auto;
  padding: clamp(0.55rem, 1.2vw, 0.9rem);
}

.photo-layout .media-frame.tall img {
  max-height: none;
  width: 100%;
  object-fit: contain;
}

.content-panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.2rem, 4vw, 2.6rem);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 54px rgba(30, 60, 45, 0.08);
  overflow-wrap: anywhere;
}

.content-panel h2,
.content-panel h3 {
  margin: 0 0 1rem;
  font-family: "Playfair Display", Georgia, serif;
  line-height: 1;
}

.content-panel h2 {
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.side-stack .content-panel h2 {
  font-size: clamp(1.75rem, 3vw, 2.35rem);
}

.content-panel h3 {
  margin-top: 2rem;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

.content-panel p {
  margin: 0 0 1.1rem;
  color: var(--ink);
}

.content-panel .essay p {
  text-indent: 2rem;
}

.poem {
  color: var(--deep);
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(1.55rem, 3vw, 2.5rem);
  line-height: 1.32;
}

.poem stanza {
  display: block;
  margin-bottom: 1.6rem;
}

.reflection {
  border-left: 4px solid var(--accent);
}

.source-panel {
  background: var(--mint);
}

.source-panel .source-list {
  font-size: 0.92rem;
  line-height: 1.55;
}

.reflection-panel p {
  font-size: 0.98rem;
}

.media-frame {
  position: sticky;
  top: 6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.7rem;
  background: var(--white);
  box-shadow: var(--shadow);
  animation: imageFloat 8s ease-in-out infinite;
}

.media-frame img {
  width: 100%;
  border-radius: calc(var(--radius) - 2px);
  object-fit: cover;
}

.media-frame.tall img {
  max-height: 76vh;
  object-fit: contain;
  background: #ffffff;
}

.callout-list {
  display: grid;
  gap: 0.8rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

.callout-list li,
.source-list li {
  border-top: 1px solid var(--line);
  padding-top: 0.8rem;
}

.source-list {
  display: grid;
  gap: 0.75rem;
  margin: 1rem 0 0;
  padding: 0;
  color: var(--ink);
  list-style: none;
}

.qa-block {
  display: grid;
  gap: 1rem;
}

.qa-item {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.qa-item strong {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--code);
  font-family: "Space Mono", monospace;
}

.split-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.mini-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  background: var(--paper);
}

.mini-card h3 {
  margin-top: 0;
  font-size: 1.4rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 2rem clamp(1rem, 4vw, 3rem);
  color: var(--muted);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(1160px, 100%);
  margin: 0 auto;
}

.reveal {
  opacity: 1;
  transform: translateY(14px);
  transition: transform 720ms cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.visible {
  transform: translateY(0) scale(1);
}

@keyframes liquidBlob {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
    border-radius: 42% 58% 65% 35% / 40% 38% 62% 60%;
  }
  50% {
    transform: translate3d(-3%, 4%, 0) rotate(12deg) scale(1.08);
    border-radius: 62% 38% 42% 58% / 55% 44% 56% 45%;
  }
  100% {
    transform: translate3d(4%, -2%, 0) rotate(-8deg) scale(0.96);
    border-radius: 36% 64% 58% 42% / 45% 60% 40% 55%;
  }
}

@keyframes gridDrift {
  to {
    background-position: 44px 44px;
  }
}

@keyframes markBob {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-3px) rotate(-4deg);
  }
}

@keyframes titleRise {
  from {
    transform: translateY(18px) skewY(1.5deg);
  }
  to {
    transform: translateY(0) skewY(0deg);
  }
}

@keyframes trackingSettle {
  from {
    letter-spacing: 0.16em;
    transform: translateX(8px);
  }
  to {
    letter-spacing: 0;
    transform: translateX(0);
  }
}

@keyframes sectionSway {
  0%, 100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(4px);
  }
}

@keyframes softSlideLeft {
  from {
    transform: translateX(18px);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes imageFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-7px);
  }
}

@keyframes floatTerminal {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-12px) rotate(0.8deg);
  }
}

@keyframes floatNote {
  0%, 100% {
    transform: translateY(0) rotate(-3deg);
  }
  50% {
    transform: translateY(11px) rotate(-1deg);
  }
}

@keyframes sheen {
  0%, 45% {
    transform: translateX(-45%) rotate(8deg);
  }
  75%, 100% {
    transform: translateX(45%) rotate(8deg);
  }
}

@keyframes dotPulse {
  0%, 100% {
    opacity: 0.5;
    transform: scale(0.86);
  }
  50% {
    opacity: 1;
    transform: scale(1.12);
  }
}

@media (max-width: 920px) {
  .nav-toggle {
    display: grid;
  }

  .site-nav {
    position: fixed;
    inset: 4.7rem 1rem auto 1rem;
    display: none;
    flex-direction: column;
    align-items: stretch;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.5rem;
    background: var(--white);
    box-shadow: var(--shadow);
  }

  .site-nav.open {
    display: flex;
  }

  .site-nav a {
    border-radius: 6px;
  }

  .hero,
  .page-hero,
  .content-layout,
  .content-layout.photo-layout {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .hero-visual {
    min-height: 27rem;
  }

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

  .media-frame {
    position: static;
  }

  .photo-layout .content-panel {
    position: static;
  }

  .side-stack {
    position: static;
  }
}

@media (max-width: 640px) {
  .site-header {
    padding-inline: 1rem;
  }

  .hero h1,
  .page-hero h1 {
    font-size: clamp(2.8rem, 13vw, 3.75rem);
  }

  .piece-grid,
  .split-list {
    grid-template-columns: 1fr;
  }

  .section-heading {
    display: block;
  }

  .section-heading p {
    margin-top: 1rem;
  }

  .terminal-card,
  .floating-note {
    position: relative;
    inset: auto;
    width: 100%;
    transform: none;
    animation: none;
  }

  .hero-visual {
    display: grid;
    gap: 1rem;
    min-height: auto;
  }

  .footer-inner {
    display: block;
  }
}

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

}
