/* unspent.world. The page is the slate: a display module stolen from a machine,
   in a patched bezel (docs/LOOK.md). Every colour is src/ui/ui_theme.gd's and the
   one face is src/ui/ui_font.gd's (tools/site/font.py). The face is cut on a
   pixel grid, so every size here is a whole multiple of 10px: one source pixel
   is then a whole number of CSS pixels and no stroke lands between two. */

@font-face {
  font-family: "UNSPENT 5x7";
  src: url("/fonts/unspent-5x7.woff2") format("woff2");
  font-display: block;
}

:root {
  --glass-off: #060a0c;
  --glass: #0b1315;
  --glass-row: #0d1618;
  --glass-lit: #12211f;
  --rim: #050809;
  --ghost: #173029;
  --faint: #2b5c4c;
  --dim: #4f9b81;
  --text: #87d9b5;
  --bright: #c9fbe2;
  --warn: #ff6f4f;
  --machine: #8579c0;
  --machine-bright: #b3a8ea;
  --bezel: #2a2735;
  --bezel-hi: #3b3649;
  --bezel-lo: #17151d;
  --face: "UNSPENT 5x7", ui-monospace, monospace;
  --px: 2px;              /* one source pixel at the body size */
}

* { box-sizing: border-box; }

html {
  background: var(--glass-off);
  color: var(--text);
  font-family: var(--face);
  font-size: 20px;
  line-height: 30px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body { margin: 0; }

a { color: var(--bright); text-decoration: none; }
a:hover, a:focus-visible { color: #fff; }
:focus-visible { outline: var(--px) solid var(--bright); outline-offset: 4px; }

p { margin: 0 0 30px; }
h1, h2, h3 { font-weight: normal; margin: 0; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 20px; top: 20px; z-index: 10; background: var(--glass); padding: 10px 20px; }

/* The glass: near-black, never black, every other row a hair lighter. */
.glass {
  background: repeating-linear-gradient(to bottom, var(--glass) 0 var(--px), var(--glass-row) var(--px) calc(var(--px) * 2));
}

/* The bezel: a salvaged module in a patched frame. A rim of dead glass, the
   frame, one screw at each corner, and a strip of tape on one. */
.slate {
  position: relative;
  border: 4px solid var(--rim);
  box-shadow:
    0 0 0 10px var(--bezel),
    0 0 0 12px var(--bezel-lo),
    inset 0 0 0 2px var(--ghost),
    0 30px 60px rgba(0, 0, 0, 0.55);
  margin: 12px;
}
.slate::before, .slate::after {
  content: "";
  position: absolute;
  width: 6px; height: 6px;
  background: var(--bezel-hi);
  box-shadow: 0 0 0 2px var(--bezel-lo);
  top: -10px; left: -10px;
}
.slate::after { left: auto; right: -10px; }
.slate .tape {
  position: absolute;
  right: -24px; bottom: 10px;
  width: 60px; height: 20px;
  background: rgba(150, 140, 110, 0.28);
  transform: rotate(-24deg);
  pointer-events: none;
}

/* --- The bar --- */
.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 30px;
  background: rgba(6, 10, 12, 0.92);
  border-bottom: 2px solid var(--ghost);
}
.bar .mark { font-size: 30px; line-height: 40px; color: var(--text); letter-spacing: 0; }
.bar nav { display: flex; gap: 30px; align-items: center; }
.bar nav a { color: var(--dim); }
.bar nav a:hover { color: var(--bright); }
.bar nav a.play { color: var(--glass); background: var(--text); padding: 0 20px; }
.bar nav a.play:hover { background: var(--bright); }

/* --- The hero: a real frame of the game, the slate over it --- */
.hero {
  position: relative;
  min-height: min(92vh, 1080px);
  display: flex; align-items: flex-end; justify-content: flex-end;
  overflow: hidden;
  border-bottom: 2px solid var(--ghost);
}
.hero picture, .hero img.frame {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}
.hero img.frame { object-fit: cover; object-position: 50% 40%; }
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(6, 10, 12, 0.85) 0%, rgba(6, 10, 12, 0.2) 35%, rgba(6, 10, 12, 0) 60%);
  pointer-events: none;
}
.hero .slate {
  z-index: 1;
  max-width: 720px;
  margin: 0 80px 80px 0;
  padding: 40px 50px 30px;
}
.hero h1 {
  font-size: 120px; line-height: 120px;
  color: var(--text);
  margin: 0 0 20px -6px;
}
.hero .line { font-size: 30px; line-height: 40px; color: var(--bright); margin-bottom: 30px; }
.actions { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 20px; }
.fine { color: var(--dim); margin: 0; }

/* Buttons: cut corners, as a machine's panel cuts them. */
.btn {
  display: inline-block;
  padding: 10px 30px;
  font-size: 20px; line-height: 30px;
  color: var(--text);
  background: var(--glass-lit);
  border: 0;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  box-shadow: inset 0 0 0 2px var(--faint);
}
.btn:hover, .btn:focus-visible { color: var(--bright); box-shadow: inset 0 0 0 2px var(--dim); }
.btn.primary { color: var(--glass); background: var(--text); box-shadow: none; }
.btn.primary:hover, .btn.primary:focus-visible { background: var(--bright); color: var(--glass-off); }
.btn .arrow { margin-left: 10px; }

/* --- Sections --- */
.section { max-width: 1240px; margin: 0 auto; padding: 120px 40px 0; }
.label { color: var(--dim); margin-bottom: 20px; }
.label::before { content: "> "; color: var(--faint); }
.section h2 { font-size: 40px; line-height: 50px; color: var(--bright); margin-bottom: 40px; max-width: 900px; }

.premise { display: grid; grid-template-columns: 1fr; }
.premise .slate { padding: 40px 50px 10px; max-width: 900px; }
.premise p { font-size: 30px; line-height: 50px; }

/* Frames: the game as it draws, a caption under each in the slate's dim line. */
.frames-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 30px;
}
.frames-grid figure { margin: 0; grid-column: span 3; }
.frames-grid figure.wide { grid-column: span 6; }
.frames-grid figure.third { grid-column: span 2; }
.frames-grid img {
  display: block; width: 100%; height: auto;
  border: 2px solid var(--ghost);
  background: var(--glass);
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.frames-grid figcaption { color: var(--dim); padding-top: 10px; }
.frames-grid figcaption::before { content: "// "; color: var(--faint); }

/* What you do, one panel each. */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 40px 50px; }
.features article { border-top: 2px solid var(--faint); padding-top: 20px; }
.features h3 { font-size: 30px; line-height: 40px; color: var(--bright); margin-bottom: 20px; }
.features p { color: var(--text); }
.features .machine { color: var(--machine-bright); }

/* Downloads. */
.download .slate { padding: 40px 50px 20px; }
.builds { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 30px; margin-bottom: 40px; }
.build {
  padding: 20px 30px 20px;
  box-shadow: inset 0 0 0 2px var(--ghost);
  background: var(--glass);
}
.build.yours { box-shadow: inset 0 0 0 2px var(--dim); background: var(--glass-lit); }
.build h3 { font-size: 30px; line-height: 40px; color: var(--bright); margin-bottom: 10px; }
.build .meta { color: var(--dim); margin-bottom: 20px; min-height: 60px; }
.build .btn { width: 100%; text-align: center; }
.build .btn[aria-disabled="true"] { color: var(--faint); pointer-events: none; box-shadow: inset 0 0 0 2px var(--ghost); background: transparent; }
.sum { color: var(--faint); word-break: break-all; margin: 10px 0 0; }

details { border-top: 2px solid var(--ghost); padding: 20px 0 0; margin-bottom: 20px; }
details summary { cursor: pointer; color: var(--text); list-style: none; }
details summary::before { content: "+ "; color: var(--dim); }
details[open] summary::before { content: "- "; }
details summary::-webkit-details-marker { display: none; }
details ol, details ul { padding-left: 40px; margin: 20px 0; }
details li { margin-bottom: 10px; color: var(--text); }
code { color: var(--bright); background: var(--glass-lit); padding: 0 10px; word-break: break-all; }
.warn { color: var(--warn); }

.needs { color: var(--dim); }

/* --- Footer --- */
footer {
  max-width: 1240px; margin: 160px auto 0; padding: 30px 40px 60px;
  border-top: 2px solid var(--ghost);
  display: flex; flex-wrap: wrap; gap: 20px 40px; justify-content: space-between;
  color: var(--faint);
}
footer a { color: var(--dim); }

/* --- Narrow screens: the same sizes halved, still on the grid --- */
@media (max-width: 900px) {
  /* On a phone the frame is shown whole, the slate under it: cropped to a tall
     box, the people at the fire fell behind the slate. */
  .hero { display: block; min-height: 0; }
  .hero picture, .hero img.frame { position: relative; display: block; height: auto; aspect-ratio: 16 / 9; }
  .hero::after { display: none; }
  .hero .slate { margin: -30px 20px 40px; padding: 30px 20px 20px; max-width: calc(100vw - 40px); }
  .hero h1 { font-size: 60px; line-height: 60px; margin-left: -3px; }
  .hero .line { font-size: 20px; line-height: 30px; }
  .section { padding: 80px 20px 0; }
  .section h2 { font-size: 30px; line-height: 40px; }
  .premise .slate, .download .slate { padding: 30px 30px 10px; }
  .premise p { font-size: 20px; line-height: 30px; }
  .frames-grid figure, .frames-grid figure.third { grid-column: span 6; }
  .bar { padding: 10px 20px; }
  .bar nav { gap: 20px; }
  .bar nav a.hide-narrow { display: none; }
}

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