:root {
  --font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --body-bg: #f6f5f1;
  --surface: #ffffff;
  --ink: #161716;
  --muted: #656b67;
  --line: #dad7ce;
  --accent: #d5a11e;
  --accent-2: #277f73;
  --accent-3: #a64736;
  --panel: #202322;
  --radius: 8px;
  color: var(--ink);
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--body-bg);
  color: var(--ink);
  font-family: var(--font-family);
}

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

.site-header {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px clamp(18px, 4vw, 56px);
  background: rgba(246, 245, 241, 0.88);
  border-bottom: 1px solid rgba(22, 23, 22, 0.08);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--ink);
  font-weight: 800;
  letter-spacing: 0;
  text-decoration: none;
}

.brand img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.site-header nav {
  display: flex;
  gap: clamp(12px, 2vw, 28px);
}

.site-header nav a {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
}

.hero {
  position: relative;
  min-height: 92svh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  padding: 120px clamp(18px, 5vw, 72px) 96px;
  background: #171a19;
  color: #fff;
}

.hero-bg,
.hero-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-bg {
  object-fit: cover;
  object-position: 58% center;
}

.hero-overlay {
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.5) 38%, rgba(0, 0, 0, 0.16) 100%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.72) 0%, transparent 44%);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 740px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: #f0c75a;
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(5rem, 18vw, 13rem);
  line-height: 0.82;
  font-weight: 900;
}

h2 {
  margin: 0;
  max-width: 920px;
  font-size: clamp(2rem, 4.6vw, 4.5rem);
  line-height: 1.02;
  font-weight: 850;
}

h3 {
  margin: 0 0 10px;
  font-size: 1.1rem;
  line-height: 1.25;
}

.hero-copy {
  max-width: 660px;
  margin: 24px 0 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.5;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

[role="button"],
button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  white-space: nowrap;
}

.hero-stats {
  position: absolute;
  z-index: 3;
  right: clamp(18px, 5vw, 72px);
  bottom: 28px;
  width: min(70vw, 980px);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(12px);
  overflow: hidden;
}

.hero-stats div {
  padding: 16px;
  background: rgba(12, 13, 12, 0.58);
}

.hero-stats strong,
.hero-stats span {
  display: block;
}

.hero-stats strong {
  color: #fff;
  font-size: clamp(1.15rem, 2vw, 1.7rem);
}

.hero-stats span {
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.82rem;
}

.section {
  padding: clamp(72px, 10vw, 132px) clamp(18px, 5vw, 72px);
}

.section-heading {
  display: grid;
  gap: 16px;
  margin-bottom: 34px;
}

.section-heading p:not(.eyebrow),
.intro-grid p,
.control-grid p,
.task-grid p {
  max-width: 780px;
  color: var(--muted);
  line-height: 1.65;
}

.intro-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.95fr);
  gap: clamp(28px, 6vw, 88px);
  align-items: start;
  background: var(--surface);
}

.viewer-section {
  background: #e7e8e0;
}

.viewer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: stretch;
}

.viewer-panel {
  position: relative;
  min-height: 620px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

urdf-viewer {
  display: block;
  width: 100%;
  height: 620px;
}

.viewer-toolbar {
  position: absolute;
  left: 16px;
  bottom: 16px;
  display: flex;
  gap: 10px;
}

.spec-list {
  display: grid;
  gap: 1px;
  align-self: stretch;
  border: 1px solid var(--line);
  background: var(--line);
}

.spec-list div {
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 88px;
  padding: 18px;
  background: var(--surface);
}

.spec-list span {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.spec-list strong {
  font-size: 1.05rem;
}

.media-section {
  background: var(--surface);
}

.motor-section {
  background: #202322;
  color: #fff;
}

.motor-section h2,
.motor-section h3 {
  color: #fff;
}

.motor-section .eyebrow {
  color: #8fd0c5;
}

.motor-section .section-heading p:not(.eyebrow) {
  color: rgba(255, 255, 255, 0.82);
}

.motor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: stretch;
}

.motor-figure {
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  background: #0c0d0d;
}

.motor-figure img {
  width: 100%;
  height: 100%;
  min-height: 520px;
  object-fit: cover;
}

.motor-points {
  display: grid;
  gap: 1px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.12);
}

.motor-points article {
  display: grid;
  align-content: center;
  gap: 10px;
  min-height: 160px;
  padding: 22px;
  background: #2a2e2c;
}

.motor-points span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: #d5a11e;
  color: #141513;
  font-weight: 900;
}

.motor-points p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.55;
}

.task-grid,
.control-grid,
.download-grid,
.build-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.task-grid article,
.control-grid article,
.download-grid article,
.build-step {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  overflow: hidden;
}

.task-grid img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.task-grid h3,
.task-grid p {
  padding: 0 16px;
}

.task-grid h3,
.build-step h3,
.bom-section h2,
.download-section h2,
.media-section h2,
.build-section h2,
.intro-grid h2,
.viewer-section h2 {
  color: var(--ink);
}

.task-grid h3 {
  padding-top: 18px;
}

.task-grid p {
  padding-bottom: 20px;
}

.control-section {
  background: #202322;
  color: #fff;
}

.control-section h2,
.control-section h3 {
  color: #fff;
}

.control-section a {
  color: #8fd0c5;
}

.control-section .eyebrow {
  color: #8fd0c5;
}

.control-section .section-heading p,
.control-grid p {
  color: rgba(255, 255, 255, 0.72);
}

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

.control-grid article {
  padding: 22px;
  color: #fff;
  background: #2a2e2c;
  border-color: rgba(255, 255, 255, 0.12);
}

.control-grid h3 {
  color: #fff;
}

.download-section {
  background: #e7e8e0;
}

.download-grid article {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 20px;
}

.download-grid span {
  width: fit-content;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #5d642f;
  font-size: 0.72rem;
  font-weight: 850;
}

.download-grid p {
  min-height: 58px;
  margin: 0;
  color: #4b514d;
  line-height: 1.55;
}

.download-grid a {
  align-self: end;
}

.download-note {
  max-width: 780px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

pre {
  margin: 0;
  padding: 16px;
  border-radius: var(--radius);
  background: #111312;
  color: #e9ece8;
  overflow-x: auto;
}

code {
  font-size: 0.9em;
}

.build-section {
  background: #f7f4ed;
}

.build-steps {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-height: min(980px, 76vh);
  padding: 28px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0,
    #000 34px,
    #000 calc(100% - 34px),
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0,
    #000 34px,
    #000 calc(100% - 34px),
    transparent 100%
  );
}

.build-steps::-webkit-scrollbar {
  width: 10px;
}

.build-steps::-webkit-scrollbar-track {
  background: #e5dfd3;
}

.build-steps::-webkit-scrollbar-thumb {
  border: 2px solid #e5dfd3;
  border-radius: 999px;
  background: #aaa092;
}

.build-step-media {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  background:
    linear-gradient(90deg, rgba(22, 23, 22, 0.07) 1px, transparent 1px),
    linear-gradient(0deg, rgba(22, 23, 22, 0.07) 1px, transparent 1px),
    #ebe7dd;
  background-size: 24px 24px;
  color: var(--muted);
  font-weight: 750;
}

.build-step-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.build-step-body {
  padding: 18px;
  color: var(--ink);
}

.build-step-body p {
  color: #303632;
  line-height: 1.6;
}

.build-step-kicker {
  color: #7d2f24;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.bom-section {
  background: var(--surface);
}

.bom-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  background: var(--line);
}

.bom-summary div {
  padding: 18px;
  background: #fbfaf7;
}

.bom-summary span,
table small {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.bom-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 1.5rem;
}

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

table {
  min-width: 920px;
  margin: 0;
  color: var(--ink);
  background: var(--surface);
}

td,
th {
  vertical-align: top;
}

td a {
  word-break: break-word;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 24px clamp(18px, 5vw, 72px);
  background: #151715;
  color: rgba(255, 255, 255, 0.72);
}

footer a {
  color: #fff;
}

.lucide {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.brand-icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  background: currentColor;
}

.discord-icon {
  -webkit-mask: url("https://cdn.jsdelivr.net/npm/simple-icons@13/icons/discord.svg") center / contain no-repeat;
  mask: url("https://cdn.jsdelivr.net/npm/simple-icons@13/icons/discord.svg") center / contain no-repeat;
}

@media (max-width: 980px) {
  .site-header {
    position: absolute;
  }

  .site-header nav {
    display: none;
  }

  .hero {
    min-height: 900px;
  }

  .hero-stats,
  .intro-grid,
  .viewer-layout,
  .motor-layout,
  .task-grid,
  .control-grid,
  .download-grid,
  .build-steps,
  .bom-summary {
    grid-template-columns: 1fr;
  }

  .viewer-panel,
  urdf-viewer {
    min-height: 520px;
    height: 520px;
  }

  .motor-figure img {
    min-height: 0;
  }
}

@media (max-width: 560px) {
  .hero {
    min-height: 820px;
    padding-bottom: 300px;
  }

  h1 {
    font-size: clamp(4rem, 30vw, 7rem);
  }

  .hero-stats {
    width: auto;
    right: 18px;
    bottom: 18px;
    left: 18px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .viewer-toolbar {
    right: 12px;
    left: 12px;
    flex-wrap: wrap;
  }

  [role="button"],
  button {
    width: 100%;
  }
}
