:root {
  color-scheme: dark;
  --bg: #070807;
  --bg-2: #11110f;
  --ink: #f3ecde;
  --muted: #aaa191;
  --quiet: #756e63;
  --line: rgba(243, 236, 222, 0.12);
  --line-strong: rgba(243, 236, 222, 0.24);
  --accent: #c0a66c;
  --bronze: #8b7651;
  --cool: #7f9189;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: Georgia, "Times New Roman", serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --scene-progress: 0;
  --light-x: 70%;
  --light-y: 42%;
  --mask-x: 62%;
  --thought-opacity: 0.98;
  --thought-x: 0vw;
  --thought-y: 0vh;
  --thought-scale: 1.02;
  --copy-x: 0vw;
  --copy-y: 0vh;
  --copy-scale: 1;
  --copy-opacity: 1;
  --depth-x: 0vw;
  --depth-y: 0vh;
  --depth-rotate: -9deg;
  --depth-opacity: 0.8;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse at 28% 12%, rgba(192, 166, 108, 0.08), transparent 38rem),
    radial-gradient(ellipse at 80% 35%, rgba(127, 145, 137, 0.065), transparent 44rem),
    linear-gradient(180deg, var(--bg), var(--bg-2) 52rem, var(--bg));
  color: var(--ink);
  font-family: var(--sans);
  letter-spacing: 0;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -10;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 44%, transparent 0 42%, rgba(0, 0, 0, 0.45) 100%),
    repeating-radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 4px);
  opacity: 0.72;
}

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

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 5px;
}

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

.site-header {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 40;
  width: min(calc(100% - 32px), 960px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 8px 22px;
  border: 1px solid rgba(243, 236, 222, 0.075);
  border-top-color: rgba(243, 236, 222, 0.13);
  border-radius: 999px;
  background: rgba(10, 11, 10, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
  backdrop-filter: blur(8px);
  animation: navEnter 760ms 120ms ease;
}

.brand {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 680;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(13px, 3vw, 28px);
  color: var(--muted);
  font-size: 0.69rem;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.site-nav a {
  position: relative;
  padding: 5px 0;
  transition: color 180ms ease, opacity 180ms ease;
}

.site-nav a::after,
.article-body a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 0;
  height: 1px;
  background: var(--accent);
  transition: right 180ms ease;
}

.site-nav a:hover,
.locale {
  color: var(--ink);
}

.site-nav a:hover::after,
.article-body a:hover::after {
  right: 0;
}

.home-main {
  position: relative;
}

.home-scene {
  position: relative;
  min-height: 360svh;
  isolation: isolate;
  overflow: clip;
}

.scene-canvas-layer {
  position: sticky;
  top: 0;
  z-index: -2;
  height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(ellipse at var(--light-x) var(--light-y), rgba(192, 166, 108, 0.16), transparent 34rem),
    radial-gradient(ellipse at 14% 84%, rgba(127, 145, 137, 0.09), transparent 38rem),
    linear-gradient(180deg, rgba(7, 8, 7, 0.18), rgba(7, 8, 7, 0.84));
}

.thought-space {
  width: 100%;
  height: 100%;
  display: block;
  opacity: var(--thought-opacity);
  transform:
    translate3d(var(--thought-x), var(--thought-y), 0)
    scale(var(--thought-scale));
  transition: opacity 200ms linear;
}

.scene-canvas-layer::before,
.scene-canvas-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.scene-canvas-layer::before {
  background:
    linear-gradient(90deg, rgba(7, 8, 7, 0.92), transparent 34%, rgba(7, 8, 7, 0.26) 72%, rgba(7, 8, 7, 0.74)),
    radial-gradient(circle at var(--mask-x) 48%, transparent 0 36%, rgba(0, 0, 0, 0.52) 100%);
}

.scene-canvas-layer::after {
  opacity: 0.52;
  background: repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 7px);
  mix-blend-mode: soft-light;
}

.scene-hero {
  min-height: 108svh;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(280px, 0.62fr);
  align-items: center;
  gap: clamp(28px, 7vw, 112px);
  margin-top: -100svh;
  padding: 120px clamp(18px, 7vw, 100px) 9svh;
}

.scene-copy {
  position: relative;
  z-index: 2;
  max-width: 850px;
  transform:
    translate3d(var(--copy-x), var(--copy-y), 0)
    scale(var(--copy-scale));
  opacity: var(--copy-opacity);
}

.scene-kicker {
  display: block;
  margin-bottom: 24px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hero-title {
  max-width: 15ch;
  margin-bottom: 28px;
  font-family: var(--display);
  font-size: clamp(3.9rem, 7.4vw, 7.8rem);
  font-weight: 400;
  line-height: 0.91;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.char {
  display: inline-block;
  opacity: 1;
  transform: none;
  animation: charReveal 860ms calc(260ms + var(--char-index) * 23ms) cubic-bezier(0.18, 0.76, 0.18, 1);
}

.word {
  display: inline-block;
  white-space: nowrap;
}

.hero-deck {
  max-width: 510px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.35vw, 1.16rem);
  line-height: 1.75;
  animation: softEnter 940ms 800ms ease;
}

.read-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 34px;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  animation: softEnter 940ms 960ms ease;
  transition: color 180ms ease;
}

.read-link::after {
  content: "";
  width: 52px;
  height: 1px;
  background: rgba(192, 166, 108, 0.5);
  transition: width 180ms ease, background 180ms ease;
}

.read-link:hover {
  color: var(--ink);
}

.read-link:hover::after {
  width: 72px;
  background: var(--accent);
}

.scene-depth-object {
  position: relative;
  width: min(30vw, 420px);
  aspect-ratio: 0.72;
  justify-self: center;
  opacity: var(--depth-opacity);
  transform:
    translate3d(var(--depth-x), var(--depth-y), 0)
    rotate(var(--depth-rotate));
}

.scene-depth-object::before,
.scene-depth-object::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(243, 236, 222, 0.09);
  border-radius: 50%;
  transform: rotate(26deg) scaleY(0.58);
}

.scene-depth-object::after {
  inset: 13%;
  border-color: rgba(192, 166, 108, 0.15);
  filter: blur(1px);
  transform: rotate(-18deg) scaleY(0.42);
}

.scene-section {
  position: relative;
  z-index: 4;
  width: min(1180px, calc(100% - clamp(36px, 12vw, 180px)));
  margin-inline: auto;
  padding: clamp(82px, 12vw, 150px) 0;
}

.scene-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: min(420px, 46vw);
  height: 1px;
  background: linear-gradient(90deg, rgba(192, 166, 108, 0.62), transparent);
}

.scene-section.writing-scene {
  margin-top: -4svh;
}

.scene-section.notes-scene {
  margin-top: 12svh;
  width: min(950px, calc(100% - clamp(36px, 18vw, 260px)));
  margin-left: clamp(18px, 14vw, 210px);
  margin-right: auto;
}

.scene-section.projects-scene {
  margin-top: 10svh;
  padding-bottom: clamp(110px, 18vw, 190px);
}

.section-heading {
  margin-bottom: 30px;
}

.section-heading h2,
.about-grid h2,
.index-header h1,
.detail-header h1,
.project-hero h1 {
  margin-bottom: 0;
  font-family: var(--display);
  font-size: clamp(2.8rem, 7vw, 6.1rem);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.archive-list {
  border-top: 1px solid var(--line-strong);
}

.archive-row,
.fragment-row,
.project-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px clamp(22px, 5vw, 54px);
  padding: clamp(28px, 5vw, 58px) 0;
  border-bottom: 1px solid var(--line);
}

.archive-row::after,
.project-row::after {
  content: "";
  position: absolute;
  top: 22%;
  right: 0;
  width: min(220px, 24vw);
  height: 54%;
  opacity: 0;
  background:
    linear-gradient(100deg, transparent, rgba(192, 166, 108, 0.12), transparent),
    radial-gradient(ellipse at 70% 50%, rgba(127, 145, 137, 0.14), transparent 72%);
  transform: translateX(12px);
  transition: opacity 220ms ease, transform 220ms ease;
  pointer-events: none;
}

.archive-row:hover::after,
.project-row:hover::after {
  opacity: 1;
  transform: translateX(0);
}

.archive-row strong,
.fragment-row strong,
.project-row strong {
  grid-column: 1 / -1;
  font-family: var(--display);
  font-size: clamp(2.2rem, 5.4vw, 5.05rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.025em;
  text-wrap: balance;
  transition: color 180ms ease, transform 180ms ease;
}

.fragment-row strong {
  font-size: clamp(1.8rem, 4vw, 3.5rem);
}

.archive-row span:not(.archive-meta),
.fragment-row span:not(.archive-meta),
.project-row span:not(.archive-meta) {
  max-width: 680px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.75;
}

.empty-state {
  margin: 0;
  padding: clamp(28px, 5vw, 48px) 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.archive-meta,
.article-meta,
.detail-kicker {
  color: var(--quiet);
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.archive-row em,
.fragment-row em,
.project-row em {
  align-self: end;
  color: var(--accent);
  font-style: normal;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: transform 180ms ease;
}

.archive-row:hover strong,
.fragment-row:hover strong,
.project-row:hover strong {
  color: #fff7e8;
  transform: translateX(4px);
}

.archive-row:hover em,
.fragment-row:hover em,
.project-row:hover em {
  transform: translateX(5px);
}

.band {
  padding: clamp(70px, 10vw, 120px) clamp(18px, 6vw, 86px);
  border-top: 1px solid var(--line);
}

.about-grid,
.index-header,
.detail-header,
.article-body,
.project-hero {
  width: min(1080px, 100%);
  margin-inline: auto;
}

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(260px, 0.72fr);
  gap: clamp(34px, 8vw, 110px);
}

.section-copy,
.detail-description,
.article-subtitle,
.project-hero p,
.index-header p {
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.82;
}

.eyebrow {
  display: block;
  margin-bottom: 18px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.theme-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.theme-list span {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

.theme-list span::after {
  content: attr(data-code);
  color: var(--quiet);
  font-family: var(--mono);
  font-size: 0.74rem;
  text-transform: uppercase;
}

.index-main,
.detail-main,
.project-main {
  padding: 136px clamp(18px, 6vw, 86px) clamp(72px, 9vw, 124px);
}

.detail-main article {
  width: auto;
  max-width: 790px;
  margin-inline: auto;
  min-width: 0;
}

.index-header {
  margin-bottom: clamp(34px, 7vw, 76px);
}

.index-header h1,
.detail-header h1 {
  margin: 14px 0 20px;
}

.index-header p,
.detail-description {
  width: min(660px, 100%);
}

.detail-header,
.article-body {
  width: auto;
  max-width: 100%;
  min-width: 0;
}

.detail-header {
  padding-bottom: clamp(34px, 6vw, 64px);
}

.article-body {
  font-size: 1.08rem;
  line-height: 1.88;
  overflow-wrap: break-word;
}

.article-body sup,
table sup {
  font-size: 0.66em;
  line-height: 0;
}

.article-body a {
  position: relative;
  color: var(--ink);
}

.article-body p,
.article-body ul,
.article-body blockquote,
.article-body pre,
.article-body .table-wrap,
.technical-callout,
.engine-output,
.move-sequence,
.principal-variation,
.article-figure,
.chess-position {
  margin-bottom: 30px;
}

.article-body h2,
.article-body h3 {
  margin: 58px 0 20px;
  font-family: var(--display);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.018em;
}

.article-body h2 {
  font-size: clamp(2rem, 5vw, 3.5rem);
}

.article-body h3 {
  font-size: clamp(1.6rem, 4vw, 2.5rem);
}

.article-body ul {
  padding-left: 22px;
}

.article-body li + li {
  margin-top: 10px;
}

.article-body blockquote {
  margin-left: 0;
  padding-left: 20px;
  border-left: 1px solid var(--accent);
  color: var(--muted);
  font-family: var(--display);
  font-size: 1.36rem;
  line-height: 1.46;
}

.technical-callout {
  padding: 18px 0 1px 20px;
  border-left: 1px solid var(--accent);
  background: linear-gradient(90deg, rgba(192, 166, 108, 0.07), transparent);
}

.technical-callout strong,
.principal-variation span {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 0.82rem;
}

th,
td {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--accent);
  font-weight: 600;
}

td {
  color: var(--muted);
}

.engine-output,
.move-sequence,
.principal-variation,
.code-block {
  border: 1px solid var(--line);
  background: rgba(8, 9, 8, 0.72);
  font-family: var(--mono);
}

.engine-output div {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 18px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.engine-output div:last-child {
  border-bottom: 0;
}

.engine-output span,
.engine-output code,
.move-sequence code,
.principal-variation code,
.code-block code {
  color: var(--muted);
  white-space: normal;
}

.move-sequence,
.principal-variation,
.code-block {
  overflow-x: auto;
  padding: 16px;
}

.principal-variation {
  display: flex;
  gap: 14px;
}

.article-figure {
  margin-left: 0;
  margin-right: 0;
}

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

.article-figure figcaption,
.chess-position figcaption {
  margin-top: 10px;
  color: var(--quiet);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.chess-position {
  margin-left: 0;
  margin-right: 0;
}

.chess-position > div {
  width: min(100%, 340px);
  aspect-ratio: 1;
  border: 1px solid var(--line);
  background:
    conic-gradient(#1c1d18 25%, #0f100e 0 50%, #1c1d18 0 75%, #0f100e 0) 0 0 / 25% 25%;
}

.project-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.94fr) minmax(280px, 0.82fr);
  gap: clamp(34px, 8vw, 100px);
  align-items: center;
  min-height: 68svh;
}

.project-hero h1 {
  margin: 12px 0 18px;
}

.project-search-tree {
  width: 100%;
  min-height: 300px;
  opacity: 0.88;
  border-left: 1px solid var(--line);
}

.tree-branch {
  fill: none;
  stroke: rgba(243, 236, 222, 0.13);
  stroke-width: 0.9;
  stroke-linecap: round;
  stroke-dasharray: 560;
  stroke-dashoffset: 0;
  animation: none;
}

.tree-branch.soft {
  stroke: rgba(164, 156, 141, 0.1);
}

.tree-branch.cut {
  stroke: rgba(129, 96, 75, 0.18);
  animation: evidenceFade 5200ms 3300ms ease-in-out infinite alternate;
}

.tree-branch.pv {
  stroke: rgba(214, 194, 140, 0.38);
  stroke-width: 1.08;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 26px clamp(18px, 6vw, 86px);
  border-top: 1px solid var(--line);
  color: var(--quiet);
  font-family: var(--mono);
  font-size: 0.74rem;
}

@keyframes navEnter {
  from {
    opacity: 0;
    transform: translate(-50%, -10px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes softEnter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes charReveal {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pathTrace {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes evidenceFade {
  from {
    opacity: 1;
  }
  to {
    opacity: 0.32;
  }
}

@media (max-width: 900px) {
  .scene-hero {
    grid-template-columns: 1fr;
    align-items: end;
  }

  .scene-depth-object {
    position: absolute;
    right: 4vw;
    bottom: 11vh;
    width: min(48vw, 280px);
  }

  .hero-title {
    max-width: 13ch;
    font-size: clamp(3.6rem, 12vw, 6.7rem);
  }
}

@media (max-width: 760px) {
  .site-header {
    top: 12px;
    left: 10px;
    right: 10px;
    width: auto;
    transform: none;
    display: grid;
    grid-template-columns: 1fr;
    align-items: flex-start;
    justify-content: stretch;
    border-radius: 18px;
    padding: 11px 14px;
  }

  .brand {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .site-nav {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px 14px;
    font-size: 0.64rem;
  }

  .home-scene {
    min-height: 340svh;
  }

  .scene-canvas-layer::before {
    background:
      linear-gradient(90deg, rgba(7, 8, 7, 0.76), transparent 58%, rgba(7, 8, 7, 0.55)),
      radial-gradient(circle at 60% 47%, transparent 0 30%, rgba(0, 0, 0, 0.55) 100%);
  }

  .scene-hero {
    min-height: 105svh;
    padding: 116px 18px 9svh;
  }

  .scene-copy {
    transform: translate3d(0, var(--copy-y), 0);
  }

  .hero-title {
    max-width: 100%;
    font-size: clamp(2.95rem, 12.2vw, 4.6rem);
    line-height: 0.94;
  }

  .index-main,
  .detail-main,
  .project-main {
    padding-left: 22px;
    padding-right: 22px;
  }

  .detail-main article,
  .detail-header,
  .article-body,
  .detail-header h1,
  .article-subtitle,
  .article-meta,
  .article-body p,
  .article-body ul,
  .article-body blockquote,
  .article-body pre,
  .article-body .table-wrap {
    width: 280px;
    max-width: 100%;
  }

  .detail-header h1 {
    font-size: clamp(2.2rem, 10vw, 2.72rem);
    line-height: 1;
    text-wrap: auto;
    overflow-wrap: normal;
  }

  .article-body {
    font-size: 1rem;
    line-height: 1.78;
  }

  .hero-deck {
    max-width: 350px;
  }

  .scene-depth-object {
    width: 58vw;
    opacity: 0.38;
  }

  .scene-section,
  .scene-section.notes-scene,
  .scene-section.projects-scene {
    width: calc(100% - 36px);
    margin-left: auto;
    margin-right: auto;
    padding: 76px 0;
  }

  .archive-row,
  .fragment-row,
  .project-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .archive-row strong,
  .project-row strong {
    font-size: clamp(2.1rem, 12vw, 3.8rem);
  }

  .about-grid,
  .project-hero {
    grid-template-columns: 1fr;
  }

  .project-search-tree {
    min-height: 220px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .engine-output div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

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

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

  .char {
    opacity: 1;
    transform: none;
  }
}
