/* 8-Bit Widgets. One visual world: a black CRT with white phosphor text and blue menu bars. */
@font-face {
  font-family: "KenPixel Mini Square";
  src: url("../fonts/KenPixel%20Mini%20Square.woff") format("woff");
  font-display: swap;
}
@font-face {
  font-family: "More Perfect DOS VGA";
  src: url("../fonts/MorePerfectDOSVGA.ttf") format("truetype");
  font-display: swap;
}
:root {
  /* layout: one centered 1080px "screen"; menus are stacked bars, products are a photo beside text */
  color-scheme: dark;
  --bg: #000000;
  --ink: #f4f4f0;
  --dim: #9aa3b5;
  --bar: #2f6fd0;
  --bar-hot: #5a96f0;
  --alert: #ff4b3a;
  --etsy: #f1641e;
  --line: #2a2f3a;
  --font-display: "KenPixel Mini Square", "Silkscreen", "Courier New", monospace;
  --font-body: "KenPixel Mini Square", "Silkscreen", "Courier New", monospace;
  --font-read: "More Perfect DOS VGA", "Courier New", monospace; /* mixed-case face for longer reading */
  --glow: 0 0 6px rgba(255, 255, 255, .55), 0 0 18px rgba(160, 200, 255, .25);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body {
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.45;
  text-transform: uppercase;
  letter-spacing: .02em;
  text-shadow: var(--glow);
  -webkit-font-smoothing: none;
  font-smooth: never;
  min-height: 100vh;
}
a { color: inherit; }
img { max-width: 100%; image-rendering: pixelated; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
[hidden] { display: none !important; }

.screen { max-width: 1080px; margin: 0 auto; padding: 24px 20px 56px; }

/* header */
.top { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; margin-bottom: 8px; }
.top .spacer { width: 150px; }
.top h1 { margin: 0; text-align: center; font-size: clamp(26px, 5vw, 46px); line-height: 1.1; font-weight: 400; text-wrap: balance; }
.sub { text-align: center; color: var(--dim); font-size: clamp(18px, 3vw, 28px); margin: 0 0 28px; }
.crumbs { text-align: center; font-size: 14px; color: var(--dim); margin: 0 0 20px; }
.crumbs a { text-decoration: none; border-bottom: 2px solid var(--line); }
.crumbs a:hover { color: var(--ink); border-color: var(--ink); }

/* the blue bars */
.btn {
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  background: var(--bar); color: #fff; text-decoration: none;
  font: inherit; text-transform: uppercase; letter-spacing: inherit;
  padding: 8px 18px; min-height: 60px; border: 0; cursor: pointer;
  font-size: clamp(22px, 3.4vw, 30px); line-height: 1.05;
  box-shadow: 0 0 14px rgba(47, 111, 208, .65);
  text-shadow: 0 0 6px rgba(255, 255, 255, .7);
  transition: background .08s steps(2), transform .08s steps(2);
}
.btn:hover, .btn:focus-visible { background: var(--bar-hot); transform: translateY(-2px); }
.btn:active { transform: translateY(2px); }
.btn.back { min-width: 150px; }
.btn.etsy { background: var(--etsy); box-shadow: 0 0 14px rgba(241, 100, 30, .6); }
.btn.ebay { background: #f4f4f0; color: #111; text-shadow: none; box-shadow: 0 0 14px rgba(255, 255, 255, .5); }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 3px var(--bar); }
.btn.small { min-height: 44px; padding: 6px 14px; font-size: 20px; }

.menu { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px 28px; margin: 0; padding: 0; list-style: none; }
.menu .btn { width: 100%; font-size: clamp(24px, 4.2vw, 36px); min-height: 62px; }
.menu.one { grid-template-columns: 1fr; }
h2.sec { font-size: 24px; font-weight: 400; color: var(--dim); margin: 36px 0 16px; border-bottom: 3px solid var(--line); padding-bottom: 8px; }
h2.sec:first-of-type { margin-top: 8px; }

/* product cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; margin: 0; padding: 0; list-style: none; }
.card { display: flex; flex-direction: column; height: 100%; text-decoration: none; border: 3px solid var(--bar); background: #05070c; }
.card:hover, .card:focus-visible { border-color: var(--ink); }
.card .ph { aspect-ratio: 4 / 3; width: 100%; height: auto; object-fit: cover; display: block; background: #0b0f18; }
.card .cap { background: var(--bar); color: #fff; padding: 10px 12px; font-size: 22px; line-height: 1.1; flex: 1; display: flex; align-items: center; }
.card:hover .cap { background: var(--bar-hot); }
.nophoto {
  aspect-ratio: 4 / 3; width: 100%; display: flex; align-items: center; justify-content: center; text-align: center;
  color: var(--dim); font-size: 14px; padding: 12px;
  background: repeating-linear-gradient(45deg, #0b0f18 0 12px, #10151f 12px 24px);
}

/* product page */
.product { display: grid; grid-template-columns: minmax(0, 480px) minmax(0, 1fr); gap: 36px; align-items: start; margin-top: 8px; }
.product .photo { width: 100%; height: auto; display: block; border: 3px solid var(--line); background: #0b0f18; }
.product .nophoto { border: 3px solid var(--line); font-size: 18px; }
.product h2 { font-size: 24px; font-weight: 400; margin: 0 0 12px; color: var(--dim); }
.product p, .product ul { margin: 0 0 16px; font-size: 20px; max-width: 34em; }
.product ul { list-style: none; padding: 0; }
.product li::before { content: "- "; }
.buy { margin-top: 28px; padding-top: 20px; border-top: 3px solid var(--line); display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.buy .lbl { width: 100%; color: var(--dim); font-size: 16px; }
.note { color: var(--dim); font-size: 16px; }
.wip { color: var(--alert); }

/* home */
.logo { font-family: var(--font-display); font-size: clamp(36px, 7.5vw, 76px); line-height: 1; margin: 0 0 28px; font-weight: 400; }
.home { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: 40px; align-items: start; }
.home .menu { gap: 14px; }
.shops { display: flex; gap: 20px; justify-content: center; }
.shops .btn { flex: 1; min-height: 80px; font-size: clamp(30px, 5.4vw, 46px); }
.contact { text-align: center; font-size: 20px; margin: 24px 0 0; }
.contact a { text-decoration: none; border-bottom: 2px solid var(--line); }

.cab { padding: 0; }
#game { width: 100%; height: auto; display: block; image-rendering: pixelated; background: #000; touch-action: manipulation; }

.pad { display: none; gap: 10px; margin-top: 10px; }
.pad .btn { flex: 1; min-height: 64px; font-size: 30px; user-select: none; -webkit-user-select: none; touch-action: none; }
@media (pointer: coarse) { .pad { display: flex; } }

/* news */
.news { list-style: none; margin: 0 auto; padding: 0; max-width: 46em; display: grid; gap: 22px; }
.news li { border-left: 6px solid var(--bar); padding: 4px 0 4px 18px; }
.news time { display: block; color: var(--dim); font-size: 16px; margin-bottom: 4px; }
.news p { margin: 0; font-size: 19px; }
/* one post at a time, with arrows (script adds .paged; without script every post is listed) */
.pager { display: flex; align-items: center; justify-content: center; gap: 22px; margin: 0 0 28px; }
.pager .btn { width: 84px; min-height: 84px; font-size: 40px; padding: 0; }
.pager .btn:disabled { background: var(--line); box-shadow: none; color: var(--dim); cursor: default; transform: none; }
.pager .count { min-width: 7em; text-align: center; color: var(--dim); }
.news.paged { max-width: 40em; min-height: 11em; }
.news.paged li { border-left: 0; padding: 0; }
.news.paged time { font-size: clamp(30px, 6vw, 52px); color: var(--ink); margin-bottom: 18px; line-height: 1.1; }
.news.paged p { font-size: clamp(20px, 2.6vw, 24px); }
.news p { font-family: var(--font-read); text-transform: none; letter-spacing: 0; line-height: 1.4; }
.prose { max-width: 40em; margin: 0 auto; font-size: 22px; }
.prose p { margin: 0 0 22px; }
.links { list-style: none; padding: 0; margin: 0 0 8px; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px 22px; }
.links .btn { width: 100%; }
.intro { text-align: center; max-width: 36em; margin: 0 auto 22px; font-size: 20px; }

/* footer */
.foot { margin-top: 56px; padding-top: 18px; border-top: 3px solid var(--line); display: flex; flex-wrap: wrap; gap: 12px 22px; align-items: center; justify-content: space-between; font-size: 14px; color: var(--dim); }
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.foot a { text-decoration: none; }
.foot .ver { margin-left: auto; }
.foot a:hover { color: var(--ink); }

/* CRT layer. The WebGL canvas draws scanlines, tube corners, flicker and noise over the page. */
#crt { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1000; }
body.crt-css::after { /* fallback when WebGL is unavailable */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 1000;
  background:
    radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, .55) 100%),
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0) 0 2px, rgba(0, 0, 0, .32) 2px 4px);
}
body.crt-off { text-shadow: none; }
body.crt-off #crt { display: none; }
body.crt-off.crt-css::after { display: none; }
body.crt-off .btn { box-shadow: none; text-shadow: none; }

@media (max-width: 820px) {
  body { font-size: 16px; }
  .home, .product { grid-template-columns: 1fr; }
  .top { grid-template-columns: auto 1fr; }
  .top .spacer { display: none; }
  .top h1 { text-align: right; }
  .cab { max-width: 340px; margin: 0 auto; width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }

/* leaving / entering the 8-bit world: the tube powers off before a store link opens, and back on when the visitor returns */
#warp { position: fixed; inset: 0; z-index: 2000; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; padding: 20px; opacity: 0; pointer-events: none; }
#warp.on { opacity: 1; pointer-events: auto; }
#warp .beam { position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; background: #fff; box-shadow: 0 0 18px 4px rgba(255, 255, 255, .8); transform: scaleX(0); }
#warp .big { font-size: clamp(24px, 5vw, 46px); line-height: 1.15; opacity: 0; }
#warp .small { font-size: clamp(14px, 2.4vw, 20px); color: var(--dim); opacity: 0; }
#warp.say .big, #warp.say .small { opacity: 1; transition: opacity .12s steps(2); }
#warp.off .beam { animation: beam-off .5s steps(10) forwards; }
#warp.boot .beam { animation: beam-on .45s steps(9) forwards; }
.screen.tube-off { animation: tube-off .4s cubic-bezier(.6, 0, 1, .4) forwards; transform-origin: 50% 50vh; }
.screen.tube-on { animation: tube-on .45s cubic-bezier(0, .6, .4, 1) both; transform-origin: 50% 50vh; }
@keyframes tube-off { 0% { transform: scale(1, 1); filter: brightness(1); } 70% { transform: scale(1, .01); filter: brightness(3); } 100% { transform: scale(0, .01); filter: brightness(6); } }
@keyframes tube-on { 0% { transform: scale(0, .01); filter: brightness(6); } 35% { transform: scale(1, .01); filter: brightness(3); } 100% { transform: scale(1, 1); filter: brightness(1); } }
@keyframes beam-off { 0% { transform: scaleX(1); } 100% { transform: scaleX(0); } }
@keyframes beam-on { 0% { transform: scaleX(0); } 100% { transform: scaleX(1); } }

/* BBS fill: each page draws in from the top in 24 text rows, like a screen arriving over a slow modem */
#fill { position: fixed; inset: 0; z-index: 900; background: #000; pointer-events: none; transform: translateY(100%); animation: bbs-fill .5s steps(24, jump-none) both; }
@keyframes bbs-fill { from { transform: translateY(0); } to { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { #fill { animation: none; } }

/* settings page */
.settings { max-width: 34em; margin: 0 auto; display: grid; gap: 28px; }
.settings .row { display: grid; gap: 10px; }
.settings .row p { margin: 0; color: var(--dim); font-size: 16px; }
.settings .btn { justify-self: start; min-width: 12em; }
.settings [data-reset] { background: var(--alert); box-shadow: 0 0 14px rgba(255, 75, 58, .55); }

/* first-visit intro: Enter screen, then the logo pieces spring in from the left */
#intro { position: fixed; inset: 0; z-index: 950; background: #000; display: flex; align-items: center; justify-content: center; overflow: hidden; }
#intro .gate { display: flex; flex-direction: column; align-items: center; gap: 22px; text-align: center; padding: 20px; }
#intro .gate .big { margin: 0; font-size: clamp(22px, 4.6vw, 44px); line-height: 1.1; }
#intro .gate .btn { font-size: clamp(34px, 8vw, 72px); min-height: 0; padding: 18px 64px; margin-top: 10px; }
#intro .mark { width: min(56vw, 280px); margin: 10px 0 14px; }
#intro .mark canvas { width: 100%; height: auto; aspect-ratio: 8 / 5; image-rendering: pixelated; display: block; }
#intro .stage { position: relative; width: min(100vw, 125vh); aspect-ratio: 5 / 4; container-type: size; }
#intro .pc { position: absolute; left: 3%; width: 20%; aspect-ratio: 8 / 5; transform: translate(-100vw, -50%); }
#intro .pc canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
#intro .pc.sq { left: 10.5%; width: 5%; aspect-ratio: 1; background: #fff; }
#intro .pc.in { transform: translate(0, -50%); transition: transform .7s cubic-bezier(.22, 1.5, .4, 1); }
#intro .head { top: 14.06%; } #intro .s1 { top: 28.13%; } #intro .torso { top: 42.19%; } #intro .s2 { top: 56.25%; } #intro .legs { top: 70.31%; }
#intro .w { position: absolute; left: 27%; font-size: 17.5cqh; line-height: 1; opacity: 0; white-space: nowrap; }   /* 50% larger; the logo column sits further left to make room */
#intro .w1 { top: 5.3%; } #intro .w2 { top: 33.4%; } #intro .w3 { top: 61.6%; }
#intro .named .w { opacity: 1; }

/* Reading text: sentences are set in the DOS face in normal upper and lower case; buttons, headings and labels stay pixel caps */
.product p, .product ul, .prose, .intro, .note, .settings .row p, #consent p, .sitemap li {
  font-family: var(--font-read); text-transform: none; letter-spacing: 0; line-height: 1.4;
}
.product p, .product ul { font-size: 22px; }
.prose { font-size: 24px; }
.intro { font-size: 22px; }
.note, .settings .row p { font-size: 18px; }
.settings .row p a { color: var(--ink); }

/* home: featured widgets */
.cards.feat { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card .cap small { display: block; font-size: 14px; opacity: .85; margin-top: 4px; }
.card .cap { flex-direction: column; align-items: flex-start; justify-content: center; }
@media (max-width: 620px) { .cards.feat { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } }

/* site map */
.sitemap { columns: 3 260px; column-gap: 36px; }
.sitemap section { break-inside: avoid; margin-bottom: 26px; }
.sitemap h2.sec { margin: 0 0 10px; font-size: 22px; }
.sitemap h2.sec a { text-decoration: none; }
.sitemap ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sitemap li { font-size: 18px; }
.sitemap li span { color: var(--dim); font-size: 15px; }

/* cookie notice */
#consent { position: fixed; left: 0; right: 0; bottom: 0; z-index: 980; background: #05070c; border-top: 3px solid var(--bar); padding: 16px 20px; display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: center; justify-content: center; }
#consent p { margin: 0; font-size: 18px; max-width: 34em; }
#consent .btn { min-height: 48px; font-size: 22px; }
.settings #privacy h2.sec { margin: 8px 0 4px; }
#consent p a { color: var(--ink); }
.news p a { color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.news p a:hover { color: var(--bar-hot); }

/* Etsy / eBay Buy buttons: the original 16x16 icons, shown large and blocky */
.shop { display: inline-block; line-height: 0; border: 3px solid transparent; transition: transform .08s steps(2); }
.shop img { width: 96px; height: 96px; display: block; image-rendering: pixelated; }
.shop:hover, .shop:focus-visible { border-color: var(--ink); transform: translateY(-2px); }
.shop:active { transform: translateY(2px); }

/* long titles must never push the page sideways on a phone */
.top h1 { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 820px) { .btn.back { min-width: 0; padding: 8px 14px; } }

/* system menus (Widgets, Games): identical buttons, platform on the first line and the item count on the second.
   The platform name is sized from the button's own width, so the longest name fits and every button matches. */
/* three across (two on tablets, one on phones); a row that is not full sits centred, however many buttons there are */
.menu.systems { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px 24px; }
.menu.systems li { flex: 0 0 calc((100% - 48px) / 3); min-width: 0; }
@media (max-width: 980px) { .menu.systems li { flex-basis: calc((100% - 24px) / 2); } }
@media (max-width: 640px) { .menu.systems li { flex-basis: 100%; } }
.menu.systems .btn.sys { flex-direction: column; gap: 8px; height: 112px; min-height: 0; padding: 8px 12px; container-type: inline-size; overflow: hidden; }
.btn.sys .pl { font-size: min(34px, 8.4cqw); line-height: 1; white-space: nowrap; }
.btn.sys .ct { font-size: min(18px, 5.4cqw); line-height: 1; opacity: .9; white-space: nowrap; }
