:root {
  --bg-canvas: #1c1917;
  --bg-surface: #292524;
  --bg-surface-hover: #36302c;
  --text-primary: #f4f1ea;
  --text-muted: #c9c0b3;
  --accent-primary: #d4a84b;
  --accent-secondary: #e7c883;
  --border-subtle: #51473c;
  --ease-kinetic: cubic-bezier(.16, 1, .3, 1);
  --shadow-elevation: 0 12px 32px -4px rgba(0, 0, 0, .25);
  --glow-accent: 0 0 24px -4px #d4a84b44;
  --glass-backdrop: blur(16px) saturate(180%);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

body {
  margin: 0;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font: 16px/1.7 "Trebuchet MS", "Segoe UI", sans-serif;
  overflow-wrap: anywhere;
  hyphens: auto;
}

h1,
h2,
h3 {
  line-height: 1.18;
  letter-spacing: -.025em;
  text-wrap: balance;
}

h1 {
  margin: .3em 0;
  font-size: clamp(2.25rem, 5vw, 4.5rem);
}

h2 {
  font-size: clamp(1.65rem, 3vw, 2.5rem);
}

h3 {
  font-size: 1.28rem;
}

p {
  margin: 0 0 1.2em;
}

a {
  color: var(--accent-secondary);
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

a:hover {
  color: var(--text-primary);
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a,
input,
textarea,
select {
  touch-action: manipulation;
}

:focus-visible {
  outline: 3px solid var(--accent-primary);
  outline-offset: 5px;
}

img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 4px;
  object-fit: cover;
}

figure {
  margin: 0;
}

figcaption {
  padding: .65rem 0;
  color: var(--text-muted);
  font-size: .81rem;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: .6;
}

[hidden] {
  display: none !important;
}

.wrap {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 28px;
}

.site-header {
  position: relative;
  z-index: 10;
  border-bottom: 1px solid var(--border-subtle);
  background: transparent;
  transition: background .3s;
}

.site-header.scrolled {
  background: var(--bg-surface);
}

.header-inner {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 28px;
}

.brand {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  position: relative;
  width: 25px;
  height: 25px;
  flex-shrink: 0;
  transform: rotate(45deg);
  border: 1px solid var(--accent-primary);
}

.brand-mark:after {
  position: absolute;
  inset: 6px;
  border: 1px solid var(--accent-primary);
  content: "";
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(10px, 1.5vw, 19px);
  min-width: 0;
}

.site-nav a {
  position: relative;
  color: var(--text-muted);
  font-size: .86rem;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav a:after,
.text-link:after {
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent-primary);
  content: "";
  transition: width .3s;
}

.site-nav a:hover:after,
.site-nav a[aria-current="page"]:after,
.text-link:hover:after {
  width: 100%;
}

.site-nav a[aria-current="page"] {
  color: var(--accent-secondary);
}

.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  background: transparent;
  color: var(--text-primary);
  font-size: 2rem;
  line-height: 1;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 100;
  padding: 10px;
  background: var(--accent-primary);
  color: var(--bg-canvas);
}

.skip-link:focus {
  top: 8px;
}

.hero {
  position: relative;
  isolation: isolate;
  padding: 38px 0 32px;
}

.hero:before,
.drafting:before {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(#d4a84b0a 1px, transparent 1px),
    linear-gradient(90deg, #d4a84b0a 1px, transparent 1px);
  background-size: 34px 34px;
  content: "";
}

.hero:after {
  position: absolute;
  inset: 0;
  z-index: -2;
  background: linear-gradient(115deg, #1c1917, #342a1b, #1c1917);
  background-size: 200% 200%;
  content: "";
  opacity: .6;
  animation: gradientShift 12s ease infinite;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-primary);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.hero p:not(.eyebrow) {
  max-width: 70ch;
  color: var(--text-muted);
}

.section {
  padding: 48px 0;
  border-top: 1px solid var(--border-subtle);
}

/* Keep content inside section wrappers away from the viewport edges. */
.section.wrap {
  padding-right: 28px;
  padding-left: 28px;
}

.section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.section-header h2 {
  margin: 0;
}

.section-number {
  color: var(--accent-primary);
  font-size: .8rem;
  letter-spacing: .12em;
}

.bento {
  display: grid;
  grid-template-areas:
    "wide wide side"
    "design assets runtime";
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.wide-tile {
  grid-area: wide;
}

.side-tile {
  grid-area: side;
}

.design-tile {
  grid-area: design;
}

.assets-tile {
  grid-area: assets;
}

.runtime-tile {
  grid-area: runtime;
}

.card,
.panel {
  min-width: 0;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  background: var(--bg-surface);
}

.card {
  position: relative;
  transition:
    transform .45s var(--ease-kinetic),
    box-shadow .45s,
    border-color .45s;
}

.card:hover {
  transform: translateY(-5px) scale(1.015);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-elevation), var(--glow-accent);
}

.card-content {
  min-width: 0;
  padding: 24px;
}

.card-content h3 {
  margin: 4px 0 14px;
}

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

.card-image {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.card-image.wide {
  aspect-ratio: 16 / 9;
}

.badge {
  position: absolute;
  bottom: 10px;
  left: 20px;
  padding: 3px 11px;
  border-radius: 4px;
  background: var(--accent-primary);
  color: var(--bg-canvas);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.image-card .card-content {
  padding-top: 24px;
}

.text-link {
  position: relative;
  display: inline-block;
  text-underline-offset: 4px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  padding: 11px 19px;
  border: 1px solid var(--accent-primary);
  border-radius: 4px;
  background: var(--accent-primary);
  color: var(--bg-canvas);
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  transition:
    transform .35s var(--ease-kinetic),
    box-shadow .35s;
}

.button:hover {
  transform: translateY(-3px);
  background: var(--accent-secondary);
  color: var(--bg-canvas);
  box-shadow: var(--shadow-elevation), var(--glow-accent);
}

.button-secondary {
  padding: 9px 0;
  border: 0;
  background: transparent;
  color: var(--accent-secondary);
  text-decoration: underline;
  text-underline-offset: 5px;
}

.button-secondary:hover {
  color: var(--text-primary);
}

.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 22px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 24px;
}

.split-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  overflow: hidden;
}

.split-card .card-image {
  height: 100%;
  aspect-ratio: 4 / 3;
}

.split-card .card-content {
  align-self: center;
}

.drafting {
  position: relative;
  isolation: isolate;
}

.diagram {
  position: relative;
  min-height: 280px;
  overflow: hidden;
  padding: 28px;
  border-radius: 4px;
  background: linear-gradient(145deg, #3b352c, #25211e);
}

.terrain-model {
  position: relative;
  width: 82%;
  height: 135px;
  margin: 0 auto 24px;
  filter: drop-shadow(10px 18px 12px #0006);
}

.terrain-model span {
  position: absolute;
  width: 42%;
  height: 85px;
  transform: skewY(-10deg);
  border-bottom: 18px solid #554b39;
  border-radius: 4px;
  background: linear-gradient(145deg, #b4ac83, #777b50);
  box-shadow: inset -12px 10px 22px #f4f1ea22;
}

.terrain-model span:nth-child(1) {
  top: 28px;
  left: 4%;
}

.terrain-model span:nth-child(2) {
  top: 10px;
  left: 32%;
  height: 105px;
  background: linear-gradient(140deg, #a69b85, #6f6a57);
}

.terrain-model span:nth-child(3) {
  top: 45px;
  left: 58%;
  height: 70px;
  background: linear-gradient(140deg, #a8ab7b, #676b43);
}

.diagram-nodes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.diagram-node {
  padding-top: 12px;
  border-top: 2px solid var(--accent-primary);
  font-size: .84rem;
}

.diagram-node strong {
  display: block;
  color: var(--accent-secondary);
}

.diagram-caption {
  margin: 20px 0 0;
  color: var(--text-muted);
  font-size: .8rem;
}

.note {
  margin: 24px 0;
  padding: 15px 20px;
  border-left: 3px solid var(--accent-primary);
  background: #d4a84b0b;
  color: var(--text-muted);
}

.feature-overlay {
  position: relative;
  display: flex;
  min-height: 340px;
  align-items: end;
  isolation: isolate;
  overflow: hidden;
}

.feature-overlay > img {
  position: absolute;
  inset: 0;
  z-index: -2;
}

.feature-overlay:after {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(transparent, #1c1917 90%);
  content: "";
}

.feature-overlay .card-content {
  margin: 20px;
  border-radius: 4px;
  background: #292524e8;
  backdrop-filter: var(--glass-backdrop);
}

.thumbnail-row {
  display: flex;
  align-items: center;
  gap: 18px;
}

.thumbnail {
  width: 90px;
  height: 90px;
  flex-shrink: 0;
  aspect-ratio: 1;
  overflow: hidden;
}

.muted {
  color: var(--text-muted);
}

.small {
  font-size: .85rem;
}

.reading {
  width: 100%;
  max-width: 72ch;
  margin: 0 auto;
}

.reading h2 {
  margin-top: 1.8em;
  font-size: 1.8rem;
  scroll-margin-top: 24px;
}

.reading h3 {
  margin-top: 1.6em;
}

.reading li {
  margin-bottom: 10px;
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr);
  align-items: start;
  gap: 38px;
}

.article-layout > *,
.article-body {
  min-width: 0;
}

.article-layout aside {
  padding: 24px;
}

.article-layout aside h2 {
  margin: 0 0 16px;
  font-size: 1.2rem;
}

.article-layout aside ul {
  padding-left: 20px;
}

.article-banner {
  margin-bottom: 32px;
}

.article-banner .image-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 420px;
  overflow: hidden;
}

.article-banner .image-frame img {
  width: 100%;
  height: 100%;
}

.article-body .reading {
  max-width: 72ch;
}

.rail {
  margin: 18px 0;
  padding: 0;
  list-style: none;
}

.rail li {
  position: relative;
  padding: 0 0 24px 24px;
  border-left: 1px solid var(--accent-primary);
}

.rail li:before {
  position: absolute;
  top: 9px;
  left: -5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-primary);
  content: "";
}

.rail strong {
  display: block;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-color: var(--border-subtle) var(--bg-canvas);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
  text-align: left;
}

th,
td {
  padding: 15px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}

th {
  color: var(--accent-secondary);
}

caption {
  padding: 0 0 16px;
  color: var(--text-muted);
  text-align: left;
}

.faq-list {
  display: grid;
  gap: 12px;
}

.faq-list details {
  scroll-margin-top: 24px;
  padding: 18px 22px;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  background: var(--bg-surface);
}

.faq-list summary {
  color: var(--text-primary);
  font-weight: 700;
  cursor: pointer;
}

.faq-list details p {
  margin: 16px 0 0;
  color: var(--text-muted);
}

.faq-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border-subtle);
  text-decoration: none;
}

.faq-row:after {
  flex-shrink: 0;
  color: var(--accent-primary);
  content: "↗";
}

.site-footer {
  margin-top: 48px;
  padding: 40px 0 24px;
  border-top: 1px solid var(--border-subtle);
  background: #171412;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 32px;
}

.site-footer h2 {
  margin-top: 0;
  color: var(--accent-primary);
  font-size: .82rem;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.footer-links {
  display: grid;
  gap: 6px;
}

.site-footer a {
  font-size: .9rem;
}

.site-footer p,
.site-footer address {
  color: var(--text-muted);
  font-size: .88rem;
  font-style: normal;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: .8rem;
}

.workbench {
  padding: 28px;
}

.steps {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  padding: 0;
  color: var(--text-muted);
  font-size: .86rem;
  list-style: none;
}

.steps .active {
  color: var(--accent-primary);
  font-weight: 700;
}

.field {
  display: grid;
  gap: 7px;
  margin: 20px 0;
}

.field label {
  font-weight: 700;
}

.field small {
  color: var(--text-muted);
}

input,
textarea,
select {
  width: 100%;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  background: var(--bg-canvas);
  color: var(--text-primary);
}

textarea {
  min-height: 180px;
  resize: vertical;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 12px;
  font-size: 1.3rem;
  font-weight: 700;
}

.preview-text {
  max-width: 100%;
  padding: 20px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  background: var(--bg-canvas);
  font: inherit;
}

.status {
  min-height: 1.7em;
  color: var(--accent-secondary);
}

.preference-choice {
  display: flex;
  align-items: start;
  gap: 12px;
  margin: 16px 0;
}

.preference-choice input {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  margin-top: 4px;
}

.reveal-enabled .reveal {
  transform: translateY(24px);
  opacity: 0;
  transition:
    opacity .7s var(--ease-kinetic),
    transform .7s var(--ease-kinetic);
}

.reveal-enabled .reveal-visible {
  transform: translateY(0);
  opacity: 1;
}

@keyframes gradientShift {
  0%,
  100% {
    background-position: 0 50%;
  }

  50% {
    background-position: 100% 50%;
  }
}

@media (min-width: 1025px) {
  .wide-tile .diagram {
    min-height: 300px;
  }

  .hero h1 {
    max-width: 19ch;
  }
}

@media (min-width: 769px) and (max-width: 1100px) {
  .header-inner {
    flex-wrap: wrap;
    gap: 12px 24px;
  }

  .site-nav {
    width: 100%;
    justify-content: space-between;
    gap: 12px;
  }

  .site-nav a {
    font-size: .82rem;
  }

  .bento {
    grid-template-areas:
      "wide wide"
      "side design"
      "assets runtime";
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .article-layout {
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 28px;
  }

  .footer-grid {
    gap: 22px;
  }
}

@media (max-width: 768px) {
  .header-inner {
    min-height: 76px;
  }

  .menu-toggle {
    display: block;
    flex: 0 0 44px;
  }

  .site-nav {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    display: none;
    padding: 12px 28px 20px;
    border-bottom: 1px solid var(--accent-primary);
    background: var(--bg-surface);
    box-shadow: var(--shadow-elevation);
  }

  .site-nav.open {
    display: grid;
    gap: 0;
    animation: menuDrop .25s var(--ease-kinetic);
  }

  .site-nav a {
    padding: 12px 0;
  }

  .site-nav a:after {
    bottom: 7px;
  }

  .bento {
    grid-template-areas:
      "wide wide"
      "side design"
      "assets runtime";
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .article-layout {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .article-layout aside {
    order: 2;
  }

  .split-card {
    grid-template-columns: 1fr;
  }

  .split-card .card-image {
    height: auto;
    aspect-ratio: 16 / 9;
  }

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

  .footer-grid > div:last-child {
    grid-column: 1 / -1;
  }

  .hero {
    padding: 30px 0;
  }

  .section {
    padding: 34px 0;
  }

  .section-header {
    align-items: start;
    flex-direction: column;
    gap: 8px;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .card-content {
    padding: 20px;
  }

  .wrap {
    padding-right: 24px;
    padding-left: 24px;
  }

  .section.wrap {
    padding-right: 24px;
    padding-left: 24px;
  }
}

@media (max-width: 480px) {
  .wrap {
    padding-right: 18px;
    padding-left: 18px;
  }

  .section.wrap {
    padding-right: 18px;
    padding-left: 18px;
  }

  .header-inner {
    gap: 12px;
    padding: 15px 18px;
  }

  .brand {
    font-size: .94rem;
  }

  .bento {
    display: flex;
    flex-direction: column;
  }

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

  .diagram {
    min-height: 0;
    padding: 20px;
  }

  .diagram-nodes {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .diagram-node {
    padding-top: 8px;
  }

  .terrain-model {
    height: 120px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .footer-grid > div:last-child {
    grid-column: auto;
  }

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

  .workbench {
    padding: 20px;
  }

  .hero h1 {
    font-size: 2.3rem;
  }

  .actions {
    gap: 14px;
  }

  .thumbnail {
    width: 68px;
    height: 68px;
  }

  .feature-overlay {
    min-height: 300px;
  }

  .feature-overlay .card-content {
    margin: 12px;
  }

  .article-banner {
    margin-bottom: 22px;
  }

  .reading h2 {
    font-size: 1.55rem;
  }

  th,
  td {
    min-width: 135px;
    padding: 12px;
  }

  .steps {
    gap: 12px;
  }
}

@keyframes menuDrop {
  from {
    transform: translateY(-8px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
  }

  .reveal-enabled .reveal {
    transform: none;
    opacity: 1;
  }

  .card:hover,
  .button:hover {
    transform: none;
  }
}