:root {
  --paper: #e6e7e3;
  --surface: #f3f4f1;
  --ink: #1c2024;
  --muted: #5d666d;
  --line: #c5c8c2;
  --cobalt: #2546b8;
  --cobalt-soft: #d9dff3;
  --stage: #34393d;
  --stage-deep: #202427;
  --display: "Bahnschrift", "DIN Alternate", "Franklin Gothic Medium", "Arial Narrow", sans-serif;
  --text: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.55 var(--text);
  font-variant-numeric: tabular-nums;
}

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

img {
  height: auto;
}

a {
  color: var(--cobalt);
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--cobalt);
  outline-offset: 3px;
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 600;
  font-stretch: 87.5%;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0;
}

h1 {
  font-size: clamp(2.6rem, 6.4vw, 5.4rem);
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.3rem);
}

h3 {
  font-size: 1.25rem;
}

p {
  margin: 0 0 1em;
  max-width: 62ch;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--surface);
  padding: 8px 14px;
  z-index: 10;
}

.skip:focus {
  left: 8px;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px var(--gutter);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.45rem;
  letter-spacing: 0.01em;
}

.wordmark img {
  width: 28px;
  height: 28px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
}

.nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}

.nav a:hover,
.nav a[aria-current="page"] {
  border-bottom-color: var(--cobalt);
}

main {
  display: block;
}

.wrap {
  padding: 0 var(--gutter);
  max-width: 1400px;
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 64px);
  align-items: center;
  padding-top: clamp(32px, 6vw, 80px);
  padding-bottom: clamp(32px, 6vw, 72px);
}

.hero h1 {
  max-width: 11ch;
  margin-bottom: 0.4em;
}

.hero .lede {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 44ch;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.facts strong {
  display: block;
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1;
}

.facts span {
  color: var(--muted);
  font-size: 0.9rem;
}

.stage {
  position: relative;
  background: radial-gradient(circle at 50% 38%, var(--stage) 0%, var(--stage-deep) 78%);
  border-radius: 4px;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  touch-action: none;
  cursor: grab;
}

.stage:active {
  cursor: grabbing;
}

.stage canvas {
  width: 100%;
  height: 100%;
}

.stage-caption {
  position: absolute;
  left: 16px;
  bottom: 14px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  color: #e9ebe6;
  font-size: 0.9rem;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

.stage-caption b {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.1rem;
}

.stage-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #e9ebe6;
  padding: 24px;
  text-align: center;
}

.stage-fallback[hidden] {
  display: none;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.swatch {
  width: 46px;
  height: 46px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 3px;
  background: var(--surface);
  cursor: pointer;
  overflow: hidden;
}

.swatch img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.swatch[aria-pressed="true"] {
  border-color: var(--cobalt);
}

.shapes {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 14px;
}

.shapes button {
  font: inherit;
  font-size: 0.9rem;
  padding: 6px 14px;
  border: 0;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.shapes button + button {
  border-left: 1px solid var(--line);
}

.shapes button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--surface);
}

.section {
  padding-top: 40px;
  padding-bottom: 64px;
  border-top: 1px solid var(--line);
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 16px 32px;
  margin-bottom: 28px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filters button {
  font: inherit;
  font-size: 0.95rem;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.filters button[aria-pressed="true"] {
  background: var(--cobalt);
  border-color: var(--cobalt);
  color: #fff;
}

.catalogue {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 28px 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.catalogue li[hidden] {
  display: none;
}

.card {
  display: block;
  color: var(--ink);
  text-decoration: none;
}

.card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 3px;
  background: var(--line);
}

.tag {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 2px solid var(--ink);
}

.tag .code {
  grid-row: span 2;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--cobalt);
  padding-top: 2px;
}

.tag .name {
  font-weight: 600;
}

.tag .meta {
  color: var(--muted);
  font-size: 0.88rem;
}

.card:hover .name {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.crumbs {
  padding-top: 22px;
  font-size: 0.92rem;
  color: var(--muted);
}

.crumbs a {
  color: var(--muted);
}

.material {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 64px);
  padding-top: 20px;
  padding-bottom: 56px;
  align-items: start;
}

.material-view {
  position: sticky;
  top: 20px;
}

.material-info h1 {
  font-size: clamp(2.3rem, 4.6vw, 4rem);
  margin: 6px 0 18px;
}

.material-info .code {
  font-family: var(--display);
  font-weight: 700;
  color: var(--cobalt);
}

.specs {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 24px;
  margin: 24px 0;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.specs dt {
  color: var(--muted);
}

.specs dd {
  margin: 0;
}

.download {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  background: var(--ink);
  color: var(--surface);
  text-decoration: none;
  border-radius: 3px;
  font-weight: 600;
}

.download small {
  font-weight: 400;
  opacity: 0.75;
}

.download:hover {
  background: var(--cobalt);
}

.maps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 36px 0 0;
}

.maps figure {
  margin: 0;
}

.maps img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 3px;
}

.maps figcaption {
  margin-top: 8px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.maps figcaption span {
  display: block;
  color: var(--muted);
}

.tiling {
  margin-top: 40px;
}

.tiling-grid {
  height: 300px;
  border-radius: 3px;
  background-color: var(--line);
  background-size: 150px 150px;
  background-repeat: repeat;
  margin-top: 12px;
}

.tiling p {
  color: var(--muted);
  font-size: 0.95rem;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 24px;
  padding-bottom: 56px;
  border-top: 1px solid var(--line);
}

.pager a {
  text-decoration: none;
  color: var(--ink);
}

.pager span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
}

.pager b {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.25rem;
}

.pager .next {
  text-align: right;
}

.packs {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.packs th,
.packs td {
  text-align: left;
  padding: 12px 12px 12px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.packs th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.9rem;
}

.packs td:last-child,
.packs th:last-child {
  text-align: right;
  padding-right: 0;
}

.packs img {
  width: 52px;
  height: 52px;
  border-radius: 2px;
  object-fit: cover;
}

.packs .num {
  white-space: nowrap;
}

.prose {
  max-width: 70ch;
  padding-top: 40px;
  padding-bottom: 72px;
}

.prose h1 {
  font-size: clamp(2.4rem, 5vw, 4rem);
  margin-bottom: 28px;
}

.prose h2 {
  margin: 44px 0 14px;
}

.prose ol,
.prose ul {
  padding-left: 1.3em;
  max-width: 62ch;
}

.prose li {
  margin-bottom: 0.5em;
}

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
}

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 2.4em 1fr;
  gap: 8px;
}

.steps li::before {
  content: counter(step);
  font-family: var(--display);
  font-weight: 700;
  color: var(--cobalt);
  font-size: 1.3rem;
  line-height: 1.2;
}

.lost {
  min-height: 62vh;
  display: grid;
  align-content: center;
  gap: 10px;
  padding-top: 48px;
  padding-bottom: 48px;
}

.lost .big {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(6rem, 22vw, 15rem);
  line-height: 0.85;
  color: transparent;
  background: url("/assets/textures/saplaisajusi-zeme/albedo-1k.jpg") center / 420px;
  -webkit-background-clip: text;
  background-clip: text;
}

.footer {
  border-top: 1px solid var(--line);
  padding: 28px var(--gutter) 36px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.footer a {
  color: var(--muted);
}

@media (max-width: 900px) {
  .hero,
  .material {
    grid-template-columns: 1fr;
  }

  .material-view {
    position: static;
  }
}

@media (max-width: 560px) {
  .masthead {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

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

  .catalogue {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 12px;
  }

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

  .tag .code {
    grid-row: auto;
  }

  .packs .hide-narrow {
    display: none;
  }

  .stage-caption {
    flex-direction: column;
    gap: 2px;
  }
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.packs .code {
  color: var(--muted);
  font-size: 0.85rem;
}

.stage-caption a {
  color: #e9ebe6;
  pointer-events: auto;
}
