:root {
  --bg: #0e0e11;
  --surface: #151519;
  --surface-hover: #19191f;
  --text: #f2f1f5;
  --text-soft: #c7c4ce;
  --muted: #85818d;
  --faint: #5f5b67;
  --line: #29272f;
  --accent: #c8b4ff;
  --accent-strong: #aa86ff;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  --site-width: 1080px;
  --content-width: 760px;
}

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

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent);
  color: #17131f;
}

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

img {
  max-width: 100%;
  height: auto;
}

button,
input,
textarea {
  font: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.accent {
  color: var(--accent);
}

/* Header */
.site-head {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(41, 39, 47, 0.75);
  background: rgba(14, 14, 17, 0.88);
  backdrop-filter: blur(16px);
}

.site-head-inner {
  width: min(100%, var(--site-width));
  min-height: 76px;
  margin: 0 auto;
  padding: 0.9rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.brand {
  flex: 0 0 auto;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.brand-name {
  transition: color 160ms ease;
}

.brand:hover .brand-name {
  color: var(--text-soft);
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.2rem;
}

.nav-a {
  position: relative;
  padding: 0.5rem 0.65rem;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 160ms ease;
}

.nav-a::after {
  content: "";
  position: absolute;
  right: 0.65rem;
  bottom: 0.2rem;
  left: 0.65rem;
  height: 1px;
  background: var(--accent);
  opacity: 0;
  transform: scaleX(0.45);
  transition: opacity 160ms ease, transform 160ms ease;
}

.nav-a:hover,
.nav-a.on {
  color: var(--text);
}

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

.nav-external {
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
}

.nav-external span {
  color: var(--faint);
  font-size: 0.7rem;
}

.nav-toggle {
  display: none;
}

/* Global layout */
main {
  flex: 1;
}

.site-foot {
  border-top: 1px solid var(--line);
}

.foot-line {
  width: min(100%, var(--site-width));
  margin: 0 auto;
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--faint);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}

.foot-line a {
  transition: color 160ms ease;
}

.foot-line a:hover {
  color: var(--accent);
}

/* Home */
.home-wrap {
  width: min(100%, 900px);
  margin: 0 auto;
  padding: clamp(5.5rem, 12vw, 9rem) 2rem 7rem;
}

.home-intro {
  max-width: 720px;
}

.home-eyebrow,
.page-kicker {
  margin: 0 0 1rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.home-title-name {
  margin: 0;
  font-size: clamp(3.25rem, 8vw, 5.75rem);
  font-weight: 700;
  letter-spacing: -0.065em;
  line-height: 0.98;
}

.home-bio {
  max-width: 680px;
  margin: 1.75rem 0 0;
  color: var(--text-soft);
  font-family: var(--serif);
  font-size: clamp(1.18rem, 2.4vw, 1.4rem);
  line-height: 1.6;
}

.home-recent {
  margin-top: clamp(5.5rem, 12vw, 8.5rem);
}

.home-section-head {
  padding-bottom: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
}

.home-section-title {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.home-section-link {
  color: var(--muted);
  font-size: 0.8rem;
  transition: color 160ms ease;
}

.home-section-link:hover {
  color: var(--accent);
}

.home-featured {
  display: grid;
}

.feat-item {
  min-height: 76px;
  padding: 1.25rem 0;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.25rem;
  border-bottom: 1px solid var(--line);
  transition: color 160ms ease, padding 160ms ease;
}

.feat-kind {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.feat-title {
  font-size: clamp(1rem, 2vw, 1.12rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.feat-arrow,
.entry-arrow {
  color: var(--faint);
  transition: color 160ms ease, transform 160ms ease;
}

.feat-item:hover {
  padding-left: 0.35rem;
  color: var(--accent);
}

.feat-item:hover .feat-arrow,
.entry-row:hover .entry-arrow {
  color: var(--accent);
  transform: translate(2px, -2px);
}

/* Works and blog indexes */
.listing-page {
  width: min(100%, 900px);
  margin: 0 auto;
  padding: clamp(4.5rem, 10vw, 7.5rem) 2rem 7rem;
}

.page-heading {
  max-width: 680px;
  margin-bottom: clamp(4rem, 9vw, 6.5rem);
}

.page-heading h1,
.not-found h1 {
  margin: 0;
  font-size: clamp(3.1rem, 7vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.06em;
  line-height: 1;
}

.page-intro {
  margin: 1.35rem 0 0;
  color: var(--text-soft);
  font-family: var(--serif);
  font-size: clamp(1.08rem, 2.1vw, 1.25rem);
  line-height: 1.65;
}

.work-group + .work-group {
  margin-top: 5rem;
}

.group-heading {
  padding-bottom: 0.8rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
}

.group-heading h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.group-heading > span {
  color: var(--faint);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.entry-list {
  display: grid;
}

.entry-row {
  padding: 1.45rem 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 2rem;
  border-bottom: 1px solid var(--line);
  transition: padding 160ms ease, background 160ms ease;
}

.entry-main {
  min-width: 0;
  display: grid;
  gap: 0.35rem;
}

.entry-title {
  font-size: 1.06rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  transition: color 160ms ease;
}

.entry-desc {
  max-width: 670px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 0.98rem;
  line-height: 1.5;
}

.entry-side {
  padding-top: 0.15rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.entry-kind,
.entry-meta {
  color: var(--faint);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.entry-row:hover {
  padding-right: 0.35rem;
  padding-left: 0.35rem;
  background: var(--surface);
}

.entry-row:hover .entry-title {
  color: var(--accent);
}

.blog-row {
  padding-top: 1.7rem;
  padding-bottom: 1.7rem;
}

.blog-row .entry-title {
  font-size: clamp(1.08rem, 2.4vw, 1.3rem);
}

.blog-row .entry-meta {
  margin-top: 0.25rem;
}

/* Article and work detail pages */
.prose-page {
  width: min(100%, var(--content-width));
  margin: 0 auto;
  padding: clamp(4rem, 9vw, 7rem) 2rem 7rem;
}

.prose-back {
  margin-bottom: 2.5rem;
  display: inline-block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  transition: color 160ms ease, transform 160ms ease;
}

.prose-back:hover {
  color: var(--accent);
  transform: translateX(-2px);
}

.prose-title {
  margin: 0;
  font-size: clamp(2.35rem, 6vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.055em;
  line-height: 1.08;
}

.prose-byline,
.prose-meta {
  margin: 1.1rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.prose-meta {
  margin-top: 0.35rem;
  color: var(--faint);
}

.byline-author {
  color: var(--text-soft);
  font-weight: 500;
}

.byline-sep {
  padding: 0 0.3rem;
  color: var(--faint);
}

.prose-rule {
  height: 1px;
  margin: 2.5rem 0 3.25rem;
  background: var(--line);
}

.game-summary {
  margin: 0 0 1.5rem;
  color: var(--text-soft);
  font-family: var(--serif);
  font-size: 1.2rem;
  line-height: 1.65;
}

.text-link,
.prose-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(200, 180, 255, 0.38);
  text-underline-offset: 0.2em;
  transition: color 160ms ease, text-decoration-color 160ms ease;
}

.text-link:hover,
.prose-body a:hover {
  color: #ded1ff;
  text-decoration-color: currentColor;
}

.prose-body {
  color: #d5d2da;
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.82;
}

.prose-body > *:first-child {
  margin-top: 0;
}

.prose-body p,
.prose-body ul,
.prose-body ol,
.prose-body blockquote,
.prose-body pre,
.prose-body table {
  margin: 1.4rem 0;
}

.prose-body h1,
.prose-body h2,
.prose-body h3,
.prose-body h4 {
  margin: 2.8rem 0 1rem;
  color: var(--text);
  font-family: var(--sans);
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.25;
}

.prose-body h1 { font-size: 2rem; }
.prose-body h2 { font-size: 1.55rem; }
.prose-body h3 { font-size: 1.25rem; }

.prose-body ul,
.prose-body ol {
  padding-left: 1.35rem;
}

.prose-body li + li {
  margin-top: 0.45rem;
}

.prose-body blockquote {
  padding: 0.1rem 0 0.1rem 1.4rem;
  border-left: 2px solid var(--accent);
  color: var(--text-soft);
  font-style: italic;
}

.prose-body code {
  padding: 0.12em 0.35em;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.86em;
}

.prose-body pre {
  padding: 1rem 1.15rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.prose-body pre code {
  padding: 0;
  border: 0;
  background: transparent;
}

.prose-body hr {
  height: 1px;
  margin: 3rem 0;
  border: 0;
  background: var(--line);
}

.prose-body img {
  margin: 2rem auto;
  display: block;
  border-radius: 4px;
}

.prose-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.prose-body th,
.prose-body td {
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

/* Generic and error pages */
.not-found {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: clamp(6rem, 14vw, 11rem) 2rem 8rem;
}

.not-found-line {
  margin: 1.5rem 0 2rem;
  color: var(--text-soft);
  font-family: var(--serif);
  font-size: 1.15rem;
}

/* Mobile navigation and responsive layout */
@media (max-width: 720px) {
  body.nav-open {
    overflow: hidden;
  }

  .site-head {
    backdrop-filter: none;
  }

  .site-head-inner {
    min-height: 68px;
    padding: 0.7rem 1rem;
  }

  .brand {
    position: relative;
    z-index: 102;
  }

  .nav-toggle {
    position: relative;
    z-index: 102;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
  }

  .nav-toggle-line {
    width: 23px;
    height: 1.5px;
    display: block;
    background: currentColor;
    transition: transform 180ms ease, opacity 180ms ease;
  }

  .nav-toggle.open .nav-toggle-line:nth-child(1) {
    transform: translateY(6.5px) rotate(45deg);
  }

  .nav-toggle.open .nav-toggle-line:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle.open .nav-toggle-line:nth-child(3) {
    transform: translateY(-6.5px) rotate(-45deg);
  }

  .site-nav {
    position: fixed;
    inset: 0;
    z-index: 101;
    padding: 6rem 1.5rem 2rem;
    flex-direction: column;
    justify-content: center;
    gap: 0.25rem;
    overflow-y: auto;
    background: var(--bg);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 180ms ease, visibility 180ms ease;
  }

  .site-nav.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .site-nav .nav-a {
    min-width: min(260px, 82vw);
    padding: 0.5rem 1rem;
    justify-content: center;
    color: var(--text-soft);
    font-size: clamp(1.7rem, 8vw, 2.2rem);
    font-weight: 600;
    letter-spacing: -0.04em;
    text-align: center;
  }

  .site-nav .nav-a::after {
    right: 1rem;
    bottom: 0.35rem;
    left: 1rem;
  }

  .nav-external span {
    font-size: 0.8rem;
  }

  .home-wrap,
  .listing-page,
  .prose-page,
  .not-found {
    padding-right: 1.25rem;
    padding-left: 1.25rem;
  }

  .home-wrap {
    padding-top: 5rem;
  }

  .home-recent {
    margin-top: 5.5rem;
  }

  .feat-item {
    grid-template-columns: 72px minmax(0, 1fr) auto;
    gap: 0.8rem;
  }

  .entry-row {
    gap: 1rem;
  }

  .entry-kind {
    display: none;
  }

  .foot-line {
    padding-right: 1.25rem;
    padding-left: 1.25rem;
  }
}

@media (max-width: 480px) {
  .home-title-name {
    font-size: clamp(3rem, 17vw, 4.25rem);
  }

  .feat-item {
    grid-template-columns: 1fr auto;
    gap: 0.5rem 1rem;
  }

  .feat-kind {
    grid-column: 1 / -1;
  }

  .entry-desc {
    font-size: 0.94rem;
  }

  .page-heading {
    margin-bottom: 3.5rem;
  }
}

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

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