/* Voxel Game Maker — site styles.
   The palette is the app's own: the indigo night of its editor and Code World, and the
   purple → blue → teal → green ramp of the V logo. Gold (the Code Gem) is the one call to action. */
:root {
  --ink: #1c1945;
  --ink-2: #252058;
  --ink-3: #2f2970;
  --line: #3d3790;
  --text: #f3f1ff;
  --muted: #b6b0e2;
  --v1: #9a5cff;
  --v2: #4691fa;
  --v3: #2bbeaa;
  --v4: #46d26e;
  --gold: #ffd84d;
  --gold-ink: #2a2000;
  --code-bg: #15123a;
  --display: "Poppins", "Segoe UI", system-ui, sans-serif;   /* the logo and splash font */
  --body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font: 400 1.0625rem/1.6 var(--body);
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: #a9c8ff; text-underline-offset: 3px; }
a:hover { color: #fff; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--gold); color: var(--gold-ink); padding: 8px 14px; z-index: 50; border-radius: 6px; }
.skip:focus { left: 8px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.1; margin: 0 0 .5em; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.6rem); font-weight: 700; }
h3 { font-size: 1.3rem; font-weight: 600; }
p { margin: 0 0 1em; }
.fine { font-size: .9rem; color: var(--muted); }

/* ---- top bar */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px var(--gutter);
  background: rgba(28, 25, 69, .9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font: 700 1.15rem var(--display); }
.top-nav { display: flex; align-items: center; gap: clamp(10px, 2.5vw, 26px); }
.top-nav a { color: var(--muted); text-decoration: none; font-weight: 700; }
.top-nav a:hover, .top-nav a[aria-current] { color: var(--text); }
.top-nav .top-cta { color: var(--gold-ink); background: var(--gold); padding: 7px 14px; border-radius: 8px; }
.top-nav .top-cta:hover { color: var(--gold-ink); background: #ffe680; }
@media (max-width: 560px) {
  .brand span { display: none; }
  .top-nav .top-cta { padding: 6px 10px; }
}

/* ---- hero: the voxel canvas is the one loud thing */
.hero {
  max-width: var(--wrap); margin: 0 auto;
  padding: clamp(40px, 7vw, 96px) var(--gutter) clamp(32px, 5vw, 64px);
  display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(24px, 4vw, 56px); align-items: center;
}
.hero h1 { font-size: clamp(2.4rem, 5.6vw, 4.4rem); font-weight: 700; letter-spacing: -0.025em; margin-bottom: .4em; }
.lede { font-size: clamp(1.1rem, 1.6vw, 1.3rem); color: #dcd7ff; max-width: 36em; }
.hero-signup { margin-top: 28px; max-width: 30rem; }
.hero-art { margin: 0; position: relative; }
.hero-art canvas {
  width: 100%; height: auto; aspect-ratio: 640 / 560; display: block; cursor: crosshair;
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 40px 40px,
    var(--ink-2);
  border-radius: 18px;
  border: 1px solid var(--line);
  touch-action: manipulation;
}
.hero-art figcaption { font-size: .9rem; color: var(--muted); margin-top: 10px; text-align: center; }
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art { order: -1; max-width: 520px; width: 100%; margin: 0 auto; }
}

/* ---- sign-up form */
.signup-label { display: block; font-weight: 700; margin-bottom: 6px; }
.signup-row { display: flex; gap: 8px; }
.signup input {
  flex: 1; min-width: 0; font: inherit; color: var(--text);
  background: var(--code-bg); border: 2px solid var(--line); border-radius: 10px; padding: 12px 14px;
}
.signup input::placeholder { color: #8079b8; }
.signup input:focus { border-color: var(--gold); outline: none; }
.signup button {
  font: 700 1rem var(--display); color: var(--gold-ink); background: var(--gold);
  border: 0; border-radius: 10px; padding: 0 22px; cursor: pointer; white-space: nowrap;
  box-shadow: 0 4px 0 #c9a21c;
}
.signup button:hover { background: #ffe680; }
.signup button:active { transform: translateY(2px); box-shadow: 0 2px 0 #c9a21c; }
.signup button[disabled] { opacity: .6; cursor: default; }
.signup-msg { min-height: 1.4em; margin: 8px 0 0; font-weight: 700; }
.signup-msg.ok { color: var(--v4); }
.signup-msg.err { color: #ff9a9a; }
@media (max-width: 420px) { .signup-row { flex-direction: column; } .signup button { padding: 12px; } }

/* ---- the four steps: each takes a colour from the logo's ramp, in order */
.loop { max-width: var(--wrap); margin: 0 auto; padding: clamp(40px, 6vw, 80px) var(--gutter); }
.steps { list-style: none; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.step { --c: var(--v1); padding: 22px 20px 20px; background: var(--ink-2); border-radius: 14px; border-top: 6px solid var(--c); }
.step-2 { --c: var(--v2); } .step-3 { --c: var(--v3); } .step-4 { --c: var(--v4); }
.step h3 { display: flex; align-items: center; gap: 10px; font-size: 1.5rem; font-weight: 700; }
.step-n {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 7px;
  background: var(--c); color: var(--ink); font-size: 1.1rem;
  box-shadow: inset -4px -4px 0 rgba(0, 0, 0, .18);
}
.step p { color: #dcd7ff; }
.step a { font-weight: 700; color: var(--text); }
@media (max-width: 940px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; } }

/* ---- sample worlds */
.worlds { max-width: var(--wrap); margin: 0 auto; padding: clamp(24px, 4vw, 48px) var(--gutter) clamp(40px, 6vw, 80px); }
.section-head { max-width: 44rem; }
.section-head p { color: #dcd7ff; }
.gallery { list-style: none; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.shot { margin: 0; }
.shot img { border-radius: 12px; aspect-ratio: 16 / 9; object-fit: cover; width: 100%; border: 1px solid var(--line); }
.shot p { margin: 10px 2px 0; color: var(--muted); font-size: .95rem; }
.shot strong { color: var(--text); display: block; font-family: var(--display); font-size: 1.1rem; }
.shot-big { grid-column: span 2; grid-row: span 2; }
@media (max-width: 860px) { .gallery { grid-template-columns: 1fr 1fr; } .shot-big { grid-column: span 2; grid-row: auto; } }
@media (max-width: 520px) { .gallery { grid-template-columns: 1fr; } .shot-big { grid-column: auto; } }

/* ---- Quick code */
.code { max-width: var(--wrap); margin: 0 auto; padding: clamp(40px, 6vw, 80px) var(--gutter); display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(24px, 4vw, 56px); align-items: center; }
.code-text p { color: #dcd7ff; max-width: 34em; }
.btn-quiet { display: inline-block; margin: 6px 12px 0 0; padding: 9px 14px; border: 2px solid var(--line); border-radius: 9px; color: var(--text); font-weight: 700; text-decoration: none; }
.btn-quiet:hover { border-color: var(--v2); color: var(--text); }
.code-card { margin: 0; background: var(--code-bg); border-radius: 14px; border: 1px solid var(--line); overflow: hidden; }
.code-card figcaption { padding: 12px 18px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .92rem; }
.code-card pre { margin: 0; border: 0; border-radius: 0; }
@media (max-width: 860px) { .code { grid-template-columns: 1fr; } }

pre.code {
  font: 400 .92rem/1.6 var(--mono); background: var(--code-bg); color: #e8e5ff;
  padding: 16px 18px; border-radius: 10px; border: 1px solid var(--line); overflow-x: auto; tab-size: 2;
}
.tk-k { color: #c9a6ff; font-weight: 600; }
.tk-s { color: #8fe3a4; }
.tk-n { color: #ffd884; }
.tk-c { color: #8b85bd; font-style: italic; }
.tk-f { color: #8cc4ff; }

/* ---- sign-up band */
.signup-band {
  max-width: 760px; margin: clamp(20px, 4vw, 40px) auto clamp(60px, 8vw, 110px);
  padding: clamp(28px, 5vw, 48px) var(--gutter);
  text-align: center;
  background: var(--ink-2); border-radius: 20px; border: 1px solid var(--line);
}
.signup-band > p { color: #dcd7ff; }
.signup-band .signup { max-width: 30rem; margin: 18px auto 0; text-align: left; }

/* ---- footer */
.foot { border-top: 1px solid var(--line); background: #191640; }
.foot-inner { max-width: var(--wrap); margin: 0 auto; padding: 28px var(--gutter); display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; justify-content: space-between; }
.foot-brand { display: flex; align-items: center; gap: 8px; margin: 0; font: 700 1rem var(--display); }
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.foot nav a { color: var(--muted); text-decoration: none; }
.foot nav a:hover { color: var(--text); }
.foot-note { margin: 0; color: #8079b8; font-size: .88rem; width: 100%; }

/* ---- docs */
.docs { max-width: 1320px; margin: 0 auto; display: grid; grid-template-columns: 260px minmax(0, 1fr) 200px; gap: 40px; padding: 28px var(--gutter) 80px; }
.docs-home { grid-template-columns: 260px minmax(0, 1fr); }
.side { position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow-y: auto; padding-right: 6px; font-size: .97rem; }
.side ul { list-style: none; padding: 0; margin: 0 0 10px; }
.side li a { display: block; padding: 5px 10px; border-radius: 7px; color: var(--muted); text-decoration: none; border-left: 3px solid transparent; }
.side li a:hover { color: var(--text); background: var(--ink-2); }
.side li a[aria-current] { color: var(--text); background: var(--ink-2); border-left-color: var(--v2); font-weight: 700; }
.side-section { margin-top: 18px; }
.side-title { font: 700 1.05rem var(--display); margin: 0 0 6px 10px; }
.side-group { margin: 12px 0 4px 10px; color: #8a84c2; font-size: .9rem; font-weight: 700; }
.search { position: relative; }
.search input { width: 100%; font: inherit; color: var(--text); background: var(--code-bg); border: 2px solid var(--line); border-radius: 9px; padding: 9px 12px; }
.search input:focus { border-color: var(--v2); outline: none; }
.results { position: absolute; z-index: 10; left: 0; right: 0; top: calc(100% + 6px); list-style: none; margin: 0; padding: 6px; background: var(--ink-3); border: 1px solid var(--line); border-radius: 10px; max-height: 60vh; overflow-y: auto; box-shadow: 0 12px 30px rgba(10, 8, 30, .5); }
.results a { display: block; padding: 8px 10px; border-radius: 7px; color: var(--text); text-decoration: none; }
.results a:hover, .results a:focus { background: var(--ink-2); }
.results small { display: block; color: var(--muted); font-size: .82rem; }
.results .none { padding: 8px 10px; color: var(--muted); }
.side-toggle { display: none; }

.doc { min-width: 0; max-width: 46rem; }
.doc-solo { margin: 0 auto; padding: 48px var(--gutter) 80px; max-width: 46rem; }
.doc h1 { font-size: clamp(2rem, 4vw, 2.9rem); font-weight: 700; margin-top: .2em; }
.doc h2 { font-size: 1.65rem; margin-top: 1.8em; padding-top: .2em; }
.doc h3 { margin-top: 1.5em; }
.doc h2, .doc h3 { position: relative; }
.anchor { position: absolute; left: -1.1em; color: var(--line); text-decoration: none; opacity: 0; }
.doc h2:hover .anchor, .doc h3:hover .anchor, .anchor:focus { opacity: 1; }
.doc-summary { font-size: 1.2rem; color: #dcd7ff; }
.crumb { color: var(--muted); font-size: .92rem; margin: 0; }
.crumb a { color: var(--muted); }
.doc code { font: .9em var(--mono); background: var(--code-bg); padding: .1em .35em; border-radius: 5px; border: 1px solid var(--ink-3); }
.doc pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.doc blockquote { margin: 1em 0; padding: 10px 16px; border-left: 4px solid var(--v3); background: var(--ink-2); border-radius: 0 10px 10px 0; color: #dcd7ff; }
.doc blockquote p:last-child { margin: 0; }
.doc li { margin: .25em 0; }
.table-wrap { overflow-x: auto; margin: 1em 0 1.4em; border: 1px solid var(--line); border-radius: 10px; }
.doc table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.doc th, .doc td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--ink-3); vertical-align: top; }
.doc th { background: var(--ink-2); font-weight: 700; }
.doc tr:last-child td { border-bottom: 0; }
.doc-list { list-style: none; padding: 0; }
.doc-list li { margin: 0 0 12px; }
.doc-list a { font-weight: 700; font-size: 1.08rem; }
.doc-list span { display: block; color: var(--muted); }
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 56px; padding-top: 22px; border-top: 1px solid var(--line); }
.pager a { display: block; padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--text); font-weight: 700; max-width: 48%; }
.pager a:hover { border-color: var(--v2); }
.pager span { display: block; font-size: .85rem; color: var(--muted); font-weight: 400; }
.pager .next { text-align: right; margin-left: auto; }
.toc { position: sticky; top: 92px; align-self: start; font-size: .9rem; }
.toc p { font-weight: 700; margin-bottom: 6px; }
.toc ul { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.toc a { display: block; padding: 3px 0 3px 12px; color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--text); }

@media (max-width: 1180px) { .docs { grid-template-columns: 240px minmax(0, 1fr); } .toc { display: none; } }
@media (max-width: 820px) {
  .docs, .docs-home { grid-template-columns: 1fr; gap: 12px; padding-top: 16px; }
  .side-toggle { display: block; font: 700 1rem var(--body); color: var(--text); background: var(--ink-2); border: 1px solid var(--line); border-radius: 9px; padding: 10px 14px; text-align: left; }
  .docs:not(.docs-home) #side { display: none; }
  .docs.open #side { display: block; }
  .side { position: static; max-height: none; }
  .anchor { display: none; }
}

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

/* ---- feature tour (home): alternating rows, the real editor on one side */
.tour { max-width: var(--wrap); margin: 0 auto; padding: clamp(40px, 6vw, 80px) var(--gutter); }
.feature { display: grid; grid-template-columns: 1.25fr 1fr; gap: clamp(24px, 4vw, 56px); align-items: center; margin-top: clamp(40px, 6vw, 72px); }
.feature.flip { grid-template-columns: 1fr 1.25fr; }
.feature.flip .feature-shot { order: 2; }
.feature-shot { margin: 0; position: relative; }
.feature-shot img { border-radius: 12px; border: 1px solid var(--line); box-shadow: 0 18px 40px rgba(8, 6, 30, .45); width: 100%; }
.feature-shot .inset { position: absolute; width: 46%; right: -4%; bottom: -10%; border: 2px solid var(--v2); }
.feature.flip .feature-shot .inset { right: auto; left: -4%; }
.feature-text h3 { font-size: clamp(1.5rem, 2.6vw, 2.05rem); font-weight: 700; }
.feature-text p { color: #dcd7ff; }
.feature-text ul { list-style: none; padding: 0; margin: 0 0 18px; }
.feature-text li { position: relative; padding-left: 24px; margin: 8px 0; color: #e6e2ff; }
.feature-text li::before { content: ""; position: absolute; left: 0; top: .5em; width: 10px; height: 10px; border-radius: 2px; background: var(--v3); box-shadow: inset -2px -2px 0 rgba(0, 0, 0, .2); }
.feature:nth-of-type(4n + 2) li::before { background: var(--v1); }
.feature:nth-of-type(4n + 3) li::before { background: var(--v2); }
.feature:nth-of-type(4n) li::before { background: var(--v4); }
.feature-text a { font-weight: 700; color: var(--text); }
.tour-all { text-align: center; margin-top: 56px; }
@media (max-width: 860px) {
  .feature, .feature.flip { grid-template-columns: 1fr; }
  .feature.flip .feature-shot { order: 0; }
  .feature-shot .inset { width: 40%; right: 2%; bottom: -8%; }
  .feature.flip .feature-shot .inset { left: auto; right: 2%; }
  .feature-text { margin-top: 12px; }
}

/* ---- features page */
.features-page { max-width: var(--wrap); margin: 0 auto; padding: 40px var(--gutter) 90px; }
.features-head h1 { font-size: clamp(2.3rem, 5vw, 3.6rem); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chips a { padding: 6px 12px; border-radius: 999px; background: var(--ink-2); border: 1px solid var(--line); color: var(--muted); text-decoration: none; font-size: .93rem; }
.chips a:hover { color: var(--text); border-color: var(--v2); }
.fgroup { margin-top: 64px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px 40px; scroll-margin-top: 84px; }
.fgroup-head { grid-column: 1 / -1; max-width: 46rem; }
.fgroup-head h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.fgroup-head p { color: #dcd7ff; font-size: 1.1rem; }
.fgroup-shot { grid-column: 2; grid-row: 2; border-radius: 12px; border: 1px solid var(--line); align-self: start; position: sticky; top: 90px; }
.fitems { grid-column: 1; grid-row: 2; list-style: none; padding: 0; margin: 0; }
.fgroup:not(:has(.fgroup-shot)) .fitems { grid-column: 1 / -1; columns: 2; column-gap: 40px; }
.fitems li { break-inside: avoid; padding: 12px 0; border-top: 1px solid var(--ink-3); }
.fitems strong { display: block; font-family: var(--display); font-size: 1.08rem; }
.fitems span { color: var(--muted); }
@media (max-width: 860px) {
  .fgroup { grid-template-columns: 1fr; }
  .fgroup-shot { grid-column: 1; grid-row: 2; position: static; }
  .fitems { grid-column: 1; grid-row: 3; }
  .fgroup:not(:has(.fgroup-shot)) .fitems { columns: 1; }
}
