:root {
  --bg: #03120c;
  --fg: #f4f0dc;
  --muted: rgba(210, 224, 200, 0.64);
  --gold: #e8c36a;
  --sea: #5ed9a0;
  --accent: var(--gold);
  --font: "Inter", "Segoe UI", sans-serif;
  --serif: "Instrument Serif", "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  overflow-x: hidden;
}

a {
  color: inherit;
}

a:focus-visible,
#stars:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

#stars {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}

#stars.dragging {
  cursor: grabbing;
}

.page {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  max-width: 40rem;
  margin: 0 auto;
  padding: 48px 20px calc(48px + env(safe-area-inset-bottom));
  text-align: center;
  pointer-events: none;
}

.page a {
  pointer-events: auto;
}

.brand {
  display: flex;
  align-items: center;
  background: transparent;
  border-radius: 22px;
  padding: 0;
  line-height: 0;
  margin-bottom: 8px;
}

.brand img {
  display: block;
  height: 96px;
  width: auto;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.35));
}

.kicker {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--sea);
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(48px, 10vw, 88px);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
}

.lead {
  margin: 0;
  max-width: 28rem;
  font-size: 17px;
  line-height: 1.55;
  color: var(--muted);
}

.byline {
  margin: 2px 0 0;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.byline a {
  color: var(--gold);
  text-decoration: none;
}

.byline a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.project {
  width: 100%;
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid rgba(184, 176, 110, 0.2);
  pointer-events: auto;
}

.project .kicker {
  margin-bottom: 8px;
}

.project h2 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 400;
  color: var(--gold);
}

.project p:not(.kicker) {
  margin: 0 0 18px;
  font-size: 16px;
  line-height: 1.55;
  color: var(--muted);
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.project-links a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(184, 176, 110, 0.28);
  border-radius: 999px;
  color: var(--fg);
  text-decoration: none;
  font-size: 14px;
}

.project-links a:hover {
  border-color: var(--gold);
}

/* ---- story: why / how / what ---- */

.story-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 6px 0 22px;
}

.story-tab[aria-selected="true"] {
  background: var(--gold);
  border-color: var(--gold);
  color: #03120c;
}

.story-panel {
  max-width: 32rem;
  margin: 0 auto;
  animation: story-in 0.3s ease both;
}

@keyframes story-in {
  from {
    opacity: 0;
  }
}

.chain {
  max-width: 24rem;
  margin: 0 auto 18px;
  text-align: left;
}

.chain-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid rgba(184, 176, 110, 0.2);
}

.chain-step {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(184, 176, 110, 0.2);
  font-size: 15px;
  color: var(--muted);
  transition: color 0.3s;
}

.chain-a {
  color: var(--gold);
  opacity: 0;
  transition: opacity 0.3s;
}

.chain-step.is-active,
.chain-step.is-done {
  color: var(--fg);
}

.chain-step.is-done .chain-a {
  opacity: 1;
}

.chain-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.project p.chain-stats {
  margin: 0;
  font-size: 14px;
}

.story-rules {
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  font-size: 16px;
  line-height: 1.55;
  color: var(--fg);
}

.story-rules li + li {
  margin-top: 6px;
}

@media (prefers-reduced-motion: reduce) {
  .story-panel {
    animation: none;
  }

  .chain-step,
  .chain-a {
    transition: none;
  }
}

@media (max-width: 640px) {
  .story-tab {
    flex: 1 1 0;
    justify-content: center;
    min-height: 44px;
  }
}

@media (max-width: 640px) {
  .brand {
    border-radius: 18px;
    padding: 0;
  }

  .brand img {
    height: 72px;
  }

  .project-links a {
    flex: 1 1 calc(50% - 10px);
    justify-content: center;
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #stars {
    pointer-events: none;
  }
}

body.doc-page #stars {
  pointer-events: none;
  cursor: default;
}

.page.doc {
  justify-content: flex-start;
  align-items: stretch;
  text-align: left;
  max-width: 48rem;
  gap: 0;
  pointer-events: auto;
  padding: 28px 20px calc(64px + env(safe-area-inset-bottom));
}

.page.doc h1 {
  font-size: clamp(40px, 8vw, 64px);
  margin: 0 0 16px;
}

.page.doc .lead {
  max-width: 38rem;
  margin-bottom: 12px;
}

.page.doc .lead a,
.page.doc .block a:not(.btn) {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.mast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 40px;
}

.brand-sm {
  margin-bottom: 0;
  padding: 0;
  border-radius: 10px;
}

.brand-sm img {
  height: 40px;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 14px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

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

.langs {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  line-height: 1.7;
  color: var(--sea);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 0;
}

.page:not(.doc) .actions {
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(184, 176, 110, 0.28);
  border-radius: 999px;
  background: transparent;
  color: var(--fg);
  font-family: var(--font);
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
}

.btn:focus-visible,
.story-panel:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.btn:hover {
  border-color: var(--gold);
}

.btn-solid {
  background: var(--gold);
  border-color: var(--gold);
  color: #03120c;
}

.btn-solid:hover {
  background: #f4d78a;
  border-color: #f4d78a;
  color: #03120c;
}

.shots {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 12px;
  margin: 32px 0 8px;
}

.shot {
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(184, 176, 110, 0.2);
  border-radius: 14px;
}

.shot img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top left;
}

.block {
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid rgba(184, 176, 110, 0.2);
}

.block h2 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 400;
  color: var(--gold);
}

.block h3 {
  margin: 24px 0 12px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
}

.block p {
  margin: 0 0 14px;
  font-size: 16px;
  line-height: 1.55;
  color: var(--muted);
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 32px;
}

.points {
  margin: 0;
  padding-left: 1.15em;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.points li + li {
  margin-top: 8px;
}

.points strong {
  color: var(--fg);
}

.get-cmd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding: 14px 16px;
  border: 1px solid rgba(184, 176, 110, 0.2);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
}

.get-cmd code {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  color: var(--fg);
}

.cmd-copy {
  flex-shrink: 0;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(184, 176, 110, 0.28);
  border-radius: 999px;
  background: transparent;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
}

.cmd-copy:hover {
  border-color: var(--gold);
}

.colophon {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid rgba(184, 176, 110, 0.2);
}

@media (max-width: 720px) {
  .mast {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-nav {
    justify-content: flex-start;
  }

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

  .get-cmd {
    flex-direction: column;
  }

  .actions .btn {
    justify-content: center;
  }
}
