.hero {
  position: relative;
  min-height: calc(900px - var(--header-height));
  overflow-x: clip;
}

.hero-inner {
  width: 100%;
  max-width: calc(var(--page-width) + (var(--gutter) * 2));
  min-height: calc(900px - var(--header-height));
  margin-inline: auto;
  padding: 30px var(--gutter) 48px;
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(440px, 0.82fr);
  gap: 52px;
  align-items: center;
}

.hero-copy {
  position: relative;
  z-index: 3;
  padding-right: 12px;
}

.hero-description {
  max-width: 510px;
  margin: 26px 0 0;
  color: var(--color-text-muted);
  font-size: 1.0625rem;
  line-height: 1.82;
}

.hero-description strong {
  color: var(--color-text);
  text-decoration-line: underline;
  text-decoration-color: var(--color-brass);
  text-decoration-thickness: 5px;
  text-underline-offset: 3px;
  text-decoration-skip-ink: none;
}

.hero .actions {
  margin-top: 30px;
}

.hero .chip-row {
  margin-top: 25px;
}

.technical-strip {
  margin-top: 24px;
  padding-top: 17px;
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: start;
  gap: 24px;
  border-top: var(--border-thin) dashed var(--color-border);
  font-family: var(--font-mono);
}

.technical-item {
  display: grid;
  gap: 4px;
}

.technical-label {
  color: var(--color-text-muted);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.technical-value {
  color: var(--color-accent-dark);
  font-size: 0.7rem;
  font-weight: 700;
}

.model-column {
  min-width: 0;
  display: flex;
  align-items: center;
}

.model-shell {
  position: relative;
  width: 100%;
  max-width: 790px;
  aspect-ratio: 1.17 / 1;
  padding: 14px;
  border: var(--border-heavy) solid var(--color-accent-dark);
  border-radius: var(--radius-lg);
  background: repeating-linear-gradient(
    90deg,
    var(--color-accent) 0 16px,
    var(--color-accent-dark) 16px 18px,
    var(--color-accent) 18px 36px
  );
}

.model-shell::before {
  position: absolute;
  inset: 7px;
  pointer-events: none;
  border: var(--border-thin) solid var(--color-brass-light);
  border-radius: calc(var(--radius-lg) - 10px);
  content: "";
}

.model-plate {
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: var(--border-medium) solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-panel);
}

.model-plate svg {
  width: 100%;
  height: 100%;
}

.model-caption {
  position: absolute;
  z-index: 2;
  top: 28px;
  left: 32px;
  padding: 7px 11px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: var(--border-thin) solid var(--color-border);
  border-radius: var(--radius-pill);
  color: var(--color-accent-dark);
  background: var(--color-bg);
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.model-caption-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--color-success);
}

.dimension-note {
  position: absolute;
  z-index: 2;
  right: 34px;
  bottom: 28px;
  padding: 9px 11px;
  display: grid;
  grid-template-columns: auto auto;
  gap: 4px 12px;
  border: var(--border-thin) dashed var(--color-accent);
  border-radius: var(--radius-sm);
  color: var(--color-accent-dark);
  background: var(--color-bg);
  font-family: var(--font-mono);
  font-size: 0.56rem;
  line-height: 1.4;
}

.dimension-note span:nth-child(odd) {
  color: var(--color-text-muted);
}

.next-section-edge {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 20px;
  border-top: var(--border-medium) solid var(--color-border);
  background: repeating-linear-gradient(
    90deg,
    var(--color-panel-soft) 0 32px,
    var(--color-panel) 32px 64px
  );
}

.sand-base {
  fill: var(--color-panel);
}

.sand-grid {
  fill: none;
  stroke: var(--color-paper-line);
  stroke-width: 1;
}

.grass-patch {
  fill: var(--color-green-soft);
  stroke: var(--color-green-dark);
  stroke-width: 1.2;
}

.pond {
  fill: var(--color-sky);
  stroke: var(--color-accent);
  stroke-width: 1.5;
}

.stone-path {
  fill: none;
  stroke: var(--color-stone);
  stroke-width: 20;
  stroke-linecap: round;
  stroke-dasharray: 3 7;
}

.track-sleeper {
  fill: none;
  stroke: var(--color-sleeper);
  stroke-width: 19;
  stroke-linecap: butt;
  stroke-dasharray: 3 8;
}

.track-bed {
  fill: none;
  stroke: var(--color-stone);
  stroke-width: 11;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.track-rail {
  fill: none;
  stroke: var(--color-rail);
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.track-center {
  fill: none;
  stroke: var(--color-rail-light);
  stroke-width: 1;
  stroke-dasharray: 5 6;
}

.platform {
  fill: var(--color-panel-soft);
  stroke: var(--color-accent);
  stroke-width: 2;
}

.platform-line {
  stroke: var(--color-warn);
  stroke-width: 3;
  stroke-dasharray: 8 5;
}

.station-wall {
  fill: var(--color-panel-soft);
  stroke: var(--color-accent-dark);
  stroke-width: 2.5;
}

.station-front {
  fill: var(--color-bg);
  stroke: var(--color-accent-dark);
  stroke-width: 2.5;
}

.station-roof {
  fill: var(--color-roof);
  stroke: var(--color-accent-dark);
  stroke-width: 2.5;
}

.station-roof-line {
  stroke: var(--color-cream);
  stroke-width: 1.2;
  opacity: 0.55;
}

.station-door {
  fill: var(--color-accent);
  stroke: var(--color-accent-dark);
  stroke-width: 2;
}

.station-window {
  fill: var(--color-window);
  stroke: var(--color-accent-dark);
  stroke-width: 2;
}

.station-sign {
  fill: var(--color-accent-dark);
  stroke: var(--color-brass);
  stroke-width: 1.5;
}

.station-sign-text {
  fill: var(--color-cream);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
}

.svg-mono {
  fill: var(--color-accent-dark);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
}

.svg-small {
  fill: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
}

.route-board {
  fill: var(--color-bg);
  stroke: var(--color-accent);
  stroke-width: 1.5;
}

.route-board-line,
.measure-tick {
  stroke: var(--color-accent);
  stroke-width: 1.2;
}

.flag-pole {
  stroke: var(--color-accent-dark);
  stroke-width: 3;
}

.flag {
  fill: var(--color-error);
  stroke: var(--color-accent-dark);
  stroke-width: 1.5;
}

.flag-text {
  fill: var(--color-white);
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 900;
}

.tree-trunk {
  fill: var(--color-accent);
}

.tree-top {
  fill: var(--color-success);
  stroke: var(--color-green-dark);
  stroke-width: 1.5;
}

.train-engine {
  fill: var(--color-accent);
  stroke: var(--color-accent-dark);
  stroke-width: 2;
}

.train-cargo {
  fill: var(--color-brass);
  stroke: var(--color-accent-dark);
  stroke-width: 2;
}

.train-roof {
  fill: var(--color-error);
  stroke: var(--color-accent-dark);
  stroke-width: 1.5;
}

.train-wheel {
  fill: var(--color-rail);
  stroke: var(--color-bg);
  stroke-width: 1;
}

.train-window {
  fill: var(--color-window);
  stroke: var(--color-accent-dark);
  stroke-width: 1;
}

.mini-train {
  transform-box: fill-box;
  transform-origin: center;
  animation: train-drift 7s ease-in-out infinite alternate;
}

.switch-lever {
  transform-box: fill-box;
  transform-origin: 50% 90%;
  animation: switch-route 4.8s ease-in-out infinite;
}

.lever-base {
  fill: var(--color-brass);
  stroke: var(--color-accent-dark);
  stroke-width: 2;
}

.lever-arm {
  stroke: var(--color-accent-dark);
  stroke-width: 6;
  stroke-linecap: round;
}

.lever-handle {
  fill: var(--color-error);
  stroke: var(--color-accent-dark);
  stroke-width: 2;
}

.download-plate {
  fill: var(--color-brass-light);
  stroke: var(--color-accent-dark);
  stroke-width: 2;
}

.download-plate-text {
  fill: var(--color-accent-dark);
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 900;
}

.measure-line {
  fill: none;
  stroke: var(--color-accent);
  stroke-width: 1;
  stroke-dasharray: 3 4;
}

.tabs {
  min-width: 0;
}

.tab-list {
  max-width: 100%;
  padding: 7px;
  display: flex;
  gap: 5px;
  overflow-x: auto;
  border: var(--border-medium) solid var(--color-accent-dark);
  border-radius: var(--radius-sm);
  background: var(--color-panel);
  scrollbar-width: thin;
}

.tab-button {
  min-height: 44px;
  padding: 9px 16px;
  flex: 0 0 auto;
  border: var(--border-thin) solid var(--color-transparent);
  border-radius: var(--radius-xs);
  color: var(--color-text-muted);
  background: var(--color-transparent);
  font-weight: 800;
  white-space: nowrap;
}

.tab-button:hover {
  color: var(--color-accent-dark);
  background: var(--color-panel-soft);
}

.tab-button[aria-selected="true"],
.tab-button.is-active {
  color: var(--color-white);
  border-color: var(--color-accent-dark);
  background: var(--color-accent);
}

.tab-panel {
  margin-top: 18px;
}

.tab-panel[hidden] {
  display: none;
}

.toc-tabs {
  position: sticky;
  z-index: 20;
  top: 12px;
  max-width: 100%;
  margin-bottom: 40px;
  padding: 9px;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  border: var(--border-medium) solid var(--color-accent-dark);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
}

.toc-tabs a {
  min-height: 40px;
  padding: 8px 13px;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  border-radius: var(--radius-xs);
  color: var(--color-text-muted);
  font-weight: 750;
  white-space: nowrap;
}

.toc-tabs a:hover {
  color: var(--color-accent-dark);
  background: var(--color-panel-soft);
}

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

.faq-item {
  overflow: hidden;
  border: var(--border-medium) solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
}

.faq-item[open] {
  border-color: var(--color-accent);
}

.faq-question {
  min-height: 58px;
  padding: 15px 52px 15px 18px;
  position: relative;
  cursor: pointer;
  color: var(--color-accent-dark);
  font-weight: 800;
  list-style: none;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-question::after {
  position: absolute;
  top: 50%;
  right: 18px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: var(--border-thin) solid var(--color-border);
  border-radius: 50%;
  background: var(--color-panel-soft);
  transform: translateY(-50%);
  content: "+";
}

.faq-item[open] .faq-question::after {
  content: "−";
}

.faq-answer {
  padding: 0 18px 18px;
  color: var(--color-text-muted);
}

.faq-answer > :last-child {
  margin-bottom: 0;
}

.glossary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.term-card {
  position: relative;
  min-width: 0;
  padding: 24px 24px 22px;
  border: var(--border-medium) solid var(--color-border);
  border-radius: var(--radius-md) var(--radius-md) var(--radius-xs) var(--radius-md);
  background: var(--color-panel-soft);
}

.term-card::before {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--color-success);
  content: "";
}

.term-name {
  margin: 0 26px 8px 0;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 800;
}

.term-category {
  margin-bottom: 12px;
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
}

.term-card p:last-child {
  margin-bottom: 0;
}

.download-grid {
  display: grid;
  gap: 18px;
}

.client-card {
  position: relative;
  min-width: 0;
  padding: 26px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  border: var(--border-medium) solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
}

.client-card.is-featured {
  border-width: var(--border-heavy);
  border-color: var(--color-accent-dark);
  background: var(--color-panel-soft);
}

.client-card.is-archived {
  border-style: dashed;
}

.client-heading {
  display: flex;
  align-items: center;
  gap: 14px;
}

.client-icon {
  width: 54px;
  height: 54px;
  flex-shrink: 0;
}

.client-meta {
  margin: 8px 0 0;
  color: var(--color-text-muted);
}

.version-slot:empty {
  display: none;
}

.version-slot:not(:empty) {
  margin-top: 8px;
  display: block;
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.post-card {
  min-width: 0;
  padding: 26px;
  display: flex;
  flex-direction: column;
  border: var(--border-medium) solid var(--color-border);
  border-radius: var(--radius-xs) var(--radius-lg) var(--radius-xs) var(--radius-lg);
  background: var(--color-bg);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.post-card:hover {
  border-color: var(--color-accent-dark);
  transform: translateY(-3px);
}

.post-card-meta {
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.post-card h3 {
  font-size: 1.35rem;
}

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

.post-card-link {
  margin-top: auto;
  color: var(--color-error);
  font-weight: 800;
}

.callout {
  position: relative;
  margin: 24px 0;
  padding: 20px 22px 20px 28px;
  overflow: hidden;
  border: var(--border-medium) solid var(--color-border);
  border-radius: var(--radius-xs) var(--radius-md) var(--radius-md) var(--radius-xs);
  background: var(--color-panel-soft);
}

.callout::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 7px;
  background: var(--color-brass);
  content: "";
}

.callout-success::before {
  background: var(--color-success);
}

.callout-warning::before {
  background: var(--color-warn);
}

.callout-error::before {
  background: var(--color-error);
}

.callout-title {
  margin-bottom: 6px;
  color: var(--color-accent-dark);
  font-weight: 850;
}

.callout > :last-child {
  margin-bottom: 0;
}

.download-cta-card {
  margin-top: 48px;
  padding: clamp(24px, 4vw, 38px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: center;
  border: var(--border-heavy) solid var(--color-accent-dark);
  border-radius: var(--radius-md);
  background: var(--color-panel);
}

.download-cta-card p {
  margin-bottom: 0;
  color: var(--color-text-muted);
}

.dl-fab {
  position: fixed;
  z-index: 80;
  right: max(18px, var(--gutter));
  bottom: 18px;
  max-width: calc(100vw - (var(--gutter) * 2));
  min-height: 54px;
  padding: 9px 16px 9px 10px;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  border: var(--border-medium) solid var(--color-accent-dark);
  border-radius: var(--radius-pill);
  color: var(--color-white);
  background: var(--color-error);
  font-weight: 850;
}

.dl-fab-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 50%;
  color: var(--color-accent-dark);
  background: var(--color-cream);
}

.dl-fab-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.prose > .data-table {
  max-width: 100%;
  min-width: 0;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.swatch {
  overflow: hidden;
  border: var(--border-medium) solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
}

.swatch-color {
  height: 82px;
  border-bottom: var(--border-thin) solid var(--color-border);
}

.swatch-info {
  padding: 10px 12px;
  display: grid;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.swatch-bg .swatch-color { background: var(--color-bg); }
.swatch-panel .swatch-color { background: var(--color-panel); }
.swatch-panel-soft .swatch-color { background: var(--color-panel-soft); }
.swatch-border .swatch-color { background: var(--color-border); }
.swatch-accent .swatch-color { background: var(--color-accent); }
.swatch-accent-dark .swatch-color { background: var(--color-accent-dark); }
.swatch-text .swatch-color { background: var(--color-text); }
.swatch-muted .swatch-color { background: var(--color-text-muted); }
.swatch-success .swatch-color { background: var(--color-success); }
.swatch-warn .swatch-color { background: var(--color-warn); }
.swatch-error .swatch-color { background: var(--color-error); }
.swatch-brass .swatch-color { background: var(--color-brass); }

.type-specimen {
  display: grid;
  gap: 0;
  border-top: var(--border-medium) solid var(--color-accent-dark);
}

.type-row {
  padding: 24px 0;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 28px;
  align-items: baseline;
  border-bottom: var(--border-thin) dashed var(--color-border);
}

.type-label {
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

@keyframes train-drift {
  from { transform: translateX(-16px); }
  to { transform: translateX(34px); }
}

@keyframes switch-route {
  0%,
  45%,
  100% { transform: rotate(-7deg); }
  55%,
  88% { transform: rotate(7deg); }
}

@media (max-width: 1260px) {
  .hero-inner {
    gap: 34px;
    grid-template-columns: minmax(0, 1.18fr) minmax(410px, 0.82fr);
  }

  .technical-strip {
    gap: 16px;
  }
}

@media (max-width: 980px) {
  .hero,
  .hero-inner {
    min-height: 0;
  }

  .hero-inner {
    padding-top: 42px;
    padding-bottom: 74px;
    grid-template-columns: minmax(0, 1fr);
  }

  .model-column {
    order: 1;
  }

  .hero-copy {
    order: 2;
    max-width: 720px;
  }

  .model-shell {
    max-width: 760px;
    margin-inline: auto;
  }

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

@media (max-width: 720px) {
  .glossary-grid,
  .post-grid {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .client-card .button,
  .download-cta-card .button-row {
    width: 100%;
  }

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

  .type-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
}

@media (max-width: 640px) {
  .hero-inner {
    padding-top: 24px;
    padding-bottom: 58px;
    gap: 30px;
  }

  .model-shell {
    padding: 8px;
    border-width: 5px;
    border-radius: var(--radius-md);
  }

  .model-caption {
    top: 18px;
    left: 18px;
    max-width: calc(100% - 36px);
    overflow: hidden;
    font-size: 0.5rem;
    white-space: nowrap;
  }

  .dimension-note {
    display: none;
  }

  .hero-description {
    margin-top: 18px;
    font-size: 0.98rem;
  }

  .hero .actions {
    margin-top: 22px;
  }

  .technical-strip {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

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

  .toc-tabs {
    top: 6px;
  }

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

  .dl-fab {
    right: var(--gutter);
    bottom: 12px;
  }
}