/* A late-1990s software site, made responsive without changing its character. */

:root {
  --desktop: #c9b99b;
  --page: #eee4ce;
  --light: #ffffff;
  --shadow: #97846a;
  --dark-shadow: #514233;
  --ink: #342b22;
  --link: #704b2d;
  --link-hover: #895c32;
  --surface: #f8f0df;
  --surface-muted: #e5d8be;
  --rule: #cbbba0;
  --muted: #6f604e;
  --title: #493321;
  --screen: #000000;
  --code-ink: #65452b;
  --mono: Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --serif: "Times New Roman", Times, serif;
  --sans: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

html {
  max-width: 100%;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  max-width: 100%;
  min-width: 19rem;
  margin: 0;
  padding: 28px 18px;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 50% 0, #756047 0, transparent 65%),
    linear-gradient(155deg, #453629 0%, #30261e 55%, #201a15 100%);
  background-attachment: fixed;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.55;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:visited { color: var(--link); }
a:hover { color: var(--link-hover); }

.page {
  width: min(1120px, 100%);
  max-width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: 12px 24px 32px;
  border: 1px solid var(--rule);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.42);
  background: linear-gradient(180deg, #faf3e3 0, var(--page) 650px);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 4px;
  left: 4px;
  padding: 4px 8px;
  border: 1px solid #9a866b;
  color: var(--ink);
  background: var(--page);
  font-family: var(--sans);
  font-size: 13px;
  transform: translateY(-150%);
}

.skip-link:focus { transform: none; }

/* ---------------------------------------------------------------- header */

.banner {
  position: relative;
  overflow: hidden;
  display: flex;
  min-height: 180px;
  padding: 24px 20px 84px;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  border: 1px solid #58432f;
  background:
    radial-gradient(ellipse at 50% 115%, #806347 0, transparent 70%),
    linear-gradient(125deg, #2c2119 0%, #513c2a 50%, #35271e 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Mask the existing silhouettes so the spectrum spans the whole banner. */
.banner::before {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 74px;
  pointer-events: none;
  background: linear-gradient(90deg,
    #ed777b 0%, #eca366 17%, #e4cf79 33%, #86c692 50%,
    #70bacc 66%, #8799d7 83%, #bd8dce 100%);
  -webkit-mask-image: url("/mountain.svg"), url("/mountain.svg");
  mask-image: url("/mountain.svg"), url("/mountain.svg");
  -webkit-mask-position: left bottom -8px, left 142px bottom -8px;
  mask-position: left bottom -8px, left 142px bottom -8px;
  -webkit-mask-repeat: repeat-x, repeat-x;
  mask-repeat: repeat-x, repeat-x;
  -webkit-mask-size: 284px 74px, 284px 74px;
  mask-size: 284px 74px, 284px 74px;
}

.banner-title,
.banner-title:visited {
  display: block;
  max-width: 100%;
  color: #fff6e3;
  text-decoration: none;
}

.banner-title svg {
  display: block;
  width: auto;
  max-width: 100%;
  height: 49px;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35));
}

.banner-title:hover { color: #fff6e3; }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule);
  font: 13px/1.3 var(--sans);
}

.site-nav a {
  display: inline-flex;
  min-height: 44px;
  padding: 12px 4px;
  align-items: center;
  border-bottom: 2px solid transparent;
  color: var(--title);
  text-align: center;
  text-decoration: none;
}

.site-nav a:hover { color: var(--link-hover); border-bottom-color: var(--rule); }
.site-nav a:active { color: var(--title); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--title); }

:focus-visible { outline: 2px dotted var(--title); outline-offset: 3px; }
#canvas:focus-visible { outline: 2px solid #d8bd79; outline-offset: -2px; }

/* --------------------------------------------------------------- content */

main section { scroll-margin-top: 10px; }

main > section {
  max-width: 1050px;
  margin: 0 auto;
  padding: 40px 10px;
}

.about-page {
  max-width: calc(72ch + 20px);
  line-height: 1.65;
}

.about-page p { margin-bottom: 24px; }
.about-page p:last-child { margin-bottom: 0; }

h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  color: var(--title);
  font-size: 25px;
  line-height: 1.2;
}

h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 19px;
}

p { margin: 0 0 16px; }

code,
samp {
  color: var(--code-ink);
  font-family: var(--mono);
  font-size: 0.84em;
}

.lead {
  margin-bottom: 24px;
  font-size: 21px;
  line-height: 1.5;
}

hr {
  height: 1px;
  margin: 0;
  border: 0;
  border-top: 1px solid var(--rule);
}

/* -------------------------------------------------------------- emulator */

.program-window {
  width: 100%;
  max-width: 820px;
  min-width: 0;
  margin: 18px auto 10px;
  padding: 0;
  border: 1px solid #9a866b;
  background: #d5c7ac;
  box-shadow: 0 5px 13px rgba(0, 0, 0, 0.18);
}

.window-body { min-width: 0; padding: 10px; }

.bezel {
  width: 100%;
  max-width: 760px;
  min-width: 0;
  margin: 0 auto;
  padding: 5px;
  border: 1px solid #554738;
  background: #29241d;
}

.screen {
  position: relative;
  min-width: 0;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--screen);
}

#canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 100%;
  object-fit: contain;
  outline: none;
  background: var(--screen);
  image-rendering: pixelated;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  padding: 16px;
  place-items: center;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.86);
  font-family: var(--sans);
  text-align: center;
}

.overlay[hidden] { display: none; }

.loading-text {
  margin: 8px 0 0;
  font-size: 13px;
}

.spinner {
  width: 26px;
  height: 26px;
  margin: 0 auto;
  border: 3px solid #555555;
  border-top-color: #dddddd;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.spinner[hidden] { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.lost {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.lost-text {
  max-width: 420px;
  margin: 0 0 12px;
  font-size: 14px;
}

#lost-reload { align-self: center; }

.controls { margin: 12px auto 0; }

.buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.buttons button,
.buttons a,
#lost-reload {
  display: inline-flex;
  min-height: 36px;
  padding: 8px 16px;
  align-items: center;
  justify-content: center;
  border: 1px solid #9a866b;
  border-radius: 0;
  color: var(--ink);
  background: var(--surface);
  font: 13px/1.1 var(--sans);
  text-decoration: none;
  cursor: pointer;
}

.buttons button:hover:not(:disabled),
.buttons a:hover,
#lost-reload:hover { color: var(--ink); background: var(--surface-muted); }

.buttons button:active:not(:disabled),
.buttons a:active,
#lost-reload:active { background: #d6c5a6; transform: translateY(1px); }

.buttons button:disabled { color: #786b58; cursor: default; }
.buttons button[aria-pressed="true"] { border-color: #7c654a; background: #ccba99; }

#canvas:fullscreen {
  width: 100vw;
  height: 100vh;
  object-fit: contain;
  background: #000000;
}

.note {
  max-width: 820px;
  margin: 16px auto 0;
  padding: 0;
  color: var(--muted);
  font-size: 14px;
}

/* --------------------------------------------------------- on-screen keys */

.keyboard {
  width: 100%;
  max-width: 720px;
  min-width: 0;
  margin: 10px auto 0;
  padding-top: 8px;
  border-top: 1px solid var(--shadow);
  user-select: none;
  -webkit-user-select: none;
}

.keyboard[hidden],
.klayer[hidden] { display: none; }

.klayer { display: flex; flex-direction: column; gap: 3px; }
.krow { display: flex; gap: 3px; }

.krow button {
  flex: 1 1 0;
  min-width: 0;
  height: 42px;
  padding: 0;
  overflow: hidden;
  border: 1px solid #9a866b;
  border-radius: 0;
  color: var(--ink);
  background: #e9ddc5;
  font: bold 12px/1 var(--sans);
  cursor: pointer;
  touch-action: manipulation;
}

.krow button:active,
.krow button[aria-pressed="true"] {
  border-color: #7c654a;
  background: #ccba99;
}

.krow button.wide { font-size: 10px; }

/* ------------------------------------------------------------ quick start */

.demo-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 24px;
  align-items: start;
  margin-top: 24px;
}

.emulator-column { min-width: 0; }

.demo-layout .program-window {
  margin-top: 0;
}

.getting-started-window {
  max-width: 820px;
  margin-top: 24px;
  background: var(--surface);
}

.getting-started-tabs {
  display: flex;
  gap: 16px;
  padding: 0 24px;
  border-bottom: 1px solid var(--rule);
}

.getting-started-tabs button {
  min-height: 44px;
  padding: 12px 0;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--muted);
  background: transparent;
  font: bold 12px/1.2 var(--sans);
  cursor: pointer;
}

.getting-started-tabs button:hover { color: var(--title); }

.getting-started-tabs button[aria-selected="true"] {
  border-bottom-color: var(--title);
  color: var(--title);
}

.getting-started-panel {
  padding: 24px;
}

.getting-started-panel[hidden] { display: none; }
.getting-started-panel h3 { margin-top: 0; }
.getting-started-panel ol { margin: 16px 0 0; padding-left: 24px; }
.getting-started-panel li { margin-bottom: 12px; }
.getting-started-panel li:last-child { margin-bottom: 0; }

.getting-started-panel code {
  display: inline-block;
  padding: 1px 5px;
  background: var(--surface-muted);
  line-height: 1.45;
  white-space: nowrap;
}

.tutorial-tab-link {
  padding: 0;
  border: 0;
  color: var(--link);
  background: transparent;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.tutorial-tab-link:hover { color: var(--link-hover); }

.key-hint {
  margin: 24px 0 0;
  padding: 12px 16px;
  border-left: 2px solid var(--rule);
  color: var(--muted);
  background: var(--surface-muted);
  font-size: 14px;
}

.keyboard-reference {
  max-width: 820px;
  margin-top: 32px;
}

.keyboard-reference h3 { margin-bottom: 16px; }
.keyboard-reference p { font-size: 14px; }

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  background: var(--surface);
}

.keyboard-reference table {
  width: 100%;
  border-collapse: collapse;
  font: 14px/1.3 var(--sans);
}

.keyboard-reference th,
.keyboard-reference td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  white-space: nowrap;
}

.keyboard-reference tbody tr:last-child td { border-bottom: 0; }

.keyboard-reference th {
  color: var(--title);
  background: var(--surface-muted);
  font-weight: bold;
}

kbd {
  display: inline-block;
  min-width: 1.65em;
  padding: 1px 5px;
  border: 1px solid #cbbba0;
  border-bottom-color: #9a866b;
  color: var(--code-ink);
  background: var(--surface);
  font: 12px/1.5 var(--mono);
  text-align: center;
  white-space: nowrap;
}

.source-example {
  min-width: 0;
  padding: 20px;
  background: var(--surface);
}

.source-example h3 {
  margin: 0;
  padding: 0;
  color: var(--title);
  background: transparent;
  font: bold 15px/1.3 var(--sans);
}

.example-picker {
  display: flex;
  padding: 16px 0;
  align-items: center;
  gap: 7px;
  font: bold 12px/1.2 var(--sans);
}

.example-picker select {
  min-width: 0;
  flex: 1;
  height: 27px;
  padding: 2px 24px 2px 6px;
  border: 1px solid var(--rule);
  border-radius: 0;
  color: var(--ink);
  background: var(--surface);
  font: 12px/1 var(--sans);
}

.source-example pre {
  max-width: 100%;
  min-height: 21em;
  margin: 0;
  padding: 16px 0 0;
  overflow-x: auto;
  border: 0;
  border-top: 1px solid var(--rule);
  color: var(--code-ink);
  background: transparent;
  font: 13px/1.45 var(--mono);
  tab-size: 2;
}

.source-example pre code { font: inherit; }

/* ------------------------------------------------------------------- shop */

.shop-intro { max-width: 760px; }

.shop-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  color: var(--title);
  font-size: 28px;
  line-height: 1.2;
}

.product-window {
  max-width: 850px;
  margin: 32px auto 0;
}

.product-window .window-body { padding: 0; }

.product-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 32px;
  padding: 32px;
  align-items: center;
  background: var(--surface);
}

.product-placeholder {
  width: 100%;
  margin: 0 auto;
}

.product-placeholder img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--surface);
}

.product-placeholder figcaption {
  margin-top: 6px;
  color: #6f604e;
  font: 11px/1.35 var(--sans);
}

.product-status {
  display: inline-block;
  margin: 0 0 10px;
  padding: 4px 8px;
  color: var(--title);
  background: var(--surface-muted);
  font: bold 11px/1.2 var(--mono);
  letter-spacing: 1px;
}

.product-copy h2 {
  display: block;
  margin: 0 0 12px;
  color: var(--title);
  font-size: 24px;
}

.product-price {
  margin: 14px 0;
  color: var(--title);
  font: bold 28px/1 var(--mono);
}

.coming-soon-button {
  min-width: 150px;
  padding: 7px 14px;
  border: 1px solid #9a866b;
  border-radius: 0;
  color: #786b58;
  background: #e9ddc5;
  font: bold 13px/1.2 var(--sans);
}

/* ---------------------------------------------------------------- footer */

footer {
  padding: 0 10px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

footer hr { margin-bottom: 24px; }
footer p { margin: 8px 0 0; }

footer .footer-support { margin-top: 16px; }

.support-link {
  display: inline-flex;
  min-height: 44px;
  padding: 8px 4px;
  align-items: center;
  gap: 12px;
  font: 13px/1.4 var(--sans);
  text-decoration: none;
}

.support-link img { display: block; flex-shrink: 0; }
.support-link:hover span { text-decoration: underline; text-underline-offset: 0.18em; }

/* ------------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .demo-layout { grid-template-columns: 1fr; }
  .source-example { width: min(560px, 100%); margin-inline: auto; }
}

@media (max-width: 700px) {
  body { padding: 0; }

  .page {
    padding: 8px 10px 24px;
    border: 0;
  }

  .banner {
    min-height: 140px;
    padding: 18px 8px 62px;
  }

  .banner::before {
    height: 52px;
    -webkit-mask-position: left bottom -6px, left 100px bottom -6px;
    mask-position: left bottom -6px, left 100px bottom -6px;
    -webkit-mask-size: 200px 52px, 200px 52px;
    mask-size: 200px 52px, 200px 52px;
  }

  .banner-title svg { height: 35px; }
  .site-nav { gap: 12px; }
  .site-nav a { padding: 12px 4px; }
  h2 { font-size: 22px; gap: 8px; }
  .lead { font-size: 19px; }

  main > section { padding: 32px 4px; }

  .source-example pre { max-height: 280px; }

  .getting-started-tabs { gap: 12px; padding-inline: 16px; }
  .getting-started-tabs button { flex: 1; }
  .getting-started-panel { padding: 20px 16px; }

  .product-layout { grid-template-columns: 1fr; padding: 24px 16px; gap: 24px; }
  .product-copy { text-align: center; }
  .product-copy h2 { font-size: 21px; }
  .window-body { padding: 5px; }
  .bezel { padding: 2px; }
  .buttons { display: grid; grid-template-columns: repeat(3, 1fr); }
  .buttons button, .buttons a { width: 100%; min-height: 44px; }

  .krow, .klayer { gap: 2px; }
  .krow button { height: 40px; padding: 0; font-size: 11px; }
  .krow button.wide { font-size: 9px; }

}

@media (max-width: 400px) {
  .banner-title svg { height: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .spinner { animation: none; }
}

.screen,
.buttons button,
.buttons a,
.krow button { touch-action: manipulation; }
