/* Receipt theme: monospace type, ASCII rules, photos redrawn by retro.js.
   The site uses two colours, --fg (ink) and --bg (paper); each theme below just sets them.
   Photo settings per theme (read by retro.js):
     --img-mode     halftone | dither | full (full = original photos)
     --img-fg/-bg   halftone ink and paper (default: --fg / --bg)
     --img-cell     halftone cell "w h" in CSS px (set from config.php 'retro' => 'halftone')
     --img-ink      auto | shadows | light: which parts get dots (auto keeps the photo positive)
     --img-palette  dither: the fixed colours;  --img-pixel: dither pixel size "w h" in CSS px */
@font-face {
  font-family: "VCR OSD Mono";
  src: url("/fnt/vcrosd-webfont.woff2?v=2") format("woff2"), url("/fnt/vcrosd-webfont.woff?v=2") format("woff");
  font-weight: normal; font-style: normal; font-display: swap;
}
:root {
  --bg: #fff; --fg: #000;
  --img-mode: halftone; --img-cell: 4 4;
  --mono: "VCR OSD Mono", "Courier New", Courier, "Nimbus Mono PS", "Liberation Mono", ui-monospace, monospace;
  /* long character strings for ASCII rules; they are clipped to the width of the element */
  --dash: "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -";
  --dbl: "================================================================================================================================================================";
  --star: "*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*";
  color-scheme: light dark;
  font-family: var(--mono); font-size: 16px; line-height: 1.45;
}
/* No theme chosen (and Full): follow the device's light/dark setting. Paper is always black on white, Night white on black. */
:root[data-theme="paper"] { color-scheme: light; }
:root[data-theme="night"] { --bg: #000; --fg: #fff; color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]), :root[data-theme="full"] { --bg: #000; --fg: #fff; }
}
/* Amber terminal: red-orange ink on brown */
:root[data-theme="amber"] { --bg: #2a1200; --fg: #ff6a1a; color-scheme: dark; }
/* CGA: cyan on black, photos in the 4-colour CGA palette 1 */
:root[data-theme="cga"] {
  --bg: #000; --fg: #55ffff; color-scheme: dark;
  --img-mode: dither; --img-palette: "#000000 #55ffff #ff55ff #ffffff"; --img-pixel: "2 2";
}
/* C64: the blue start-up screen, photos in the 16 C64 colours (Pepto palette) with wide multicolour pixels.
   The ink is a lighter blue than the real C64 one, which is too low-contrast to read. */
:root[data-theme="c64"] {
  --bg: #352879; --fg: #a99cff; color-scheme: dark;
  --img-mode: dither; --img-pixel: "4 2";
  --img-palette: "#000000 #ffffff #68372b #70a4b2 #6f3d86 #588d43 #352879 #b8c76f #6f4f25 #433900 #9a6759 #444444 #6c6c6c #9ad284 #6c5eb5 #959595";
}
/* Full: the receipt look, but the original colour photos */
:root[data-theme="full"] { --img-mode: full; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); scroll-padding-top: 56px; }
body { margin: 0; background: var(--bg); color: var(--fg); -webkit-font-smoothing: antialiased; }
a { color: var(--fg); }
a:hover { background: var(--fg); color: var(--bg); text-decoration: none; }
::selection { background: var(--fg); color: var(--bg); }
:focus-visible { outline: 2px dashed var(--fg); outline-offset: 2px; }
main { max-width: 1040px; margin: 0 auto; padding: 24px 16px 48px; }
h1, h2, h3 { font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }

/* ASCII rule helper: a line of characters, clipped */
.rule, h1::after, .foot::before, .receipt-head::after, .totals::before, .desc::before {
  display: block; max-width: 100%; white-space: nowrap; overflow: hidden; font-weight: 400; letter-spacing: 0; text-transform: none;
}

/* Receipt header (scrolls away) */
.receipt-head { max-width: 1040px; margin: 0 auto; padding: 28px 16px 0; text-align: center; }
.receipt-head::after { content: var(--dbl); margin-top: 12px; }
.brand { display: block; text-decoration: none; font-size: 2rem; font-weight: 700; letter-spacing: .25em; line-height: 1.1; }
.brand::before, .brand::after { content: var(--star); display: block; max-width: 100%; overflow: hidden; white-space: nowrap; font-size: 1rem; letter-spacing: 0; font-weight: 400; }
.brand span { display: inline-block; padding: 6px .5em 6px .75em; }
.brand span::before { content: "* "; }
.brand span::after { content: " *"; }
.brand:hover { background: none; color: var(--fg); }
.brand:hover span { background: var(--fg); color: var(--bg); }
.addr { margin: 10px 0 0; font-size: .9rem; text-transform: uppercase; }

/* Sticky bar with languages and cart */
.top {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 16px;
  padding: 8px max(16px, calc((100% - 1040px) / 2 + 16px));
  background: var(--bg); border-bottom: 1px dashed var(--fg);
  text-transform: uppercase;
}
.langs { display: flex; gap: 4px; margin-right: auto; font-size: .9rem; }
.langs a { text-decoration: none; padding: 0 2px; }
.langs a[aria-current] { font-weight: 700; }
.langs a[aria-current]::before { content: "["; }
.langs a[aria-current]::after { content: "]"; }
.cartlink { text-decoration: none; white-space: nowrap; font-weight: 700; }
.badge { font-weight: 700; }
.badge::before { content: "["; }
.badge::after { content: "]"; }
.badge[hidden] { display: none; }

/* Headings */
h1 { font-size: 1.5rem; margin: 8px 0 20px; text-align: center; }
h1::after { content: var(--dash); font-size: 1rem; margin-top: 4px; }
.product h1 { text-align: left; }
section h2 { font-size: 1.05rem; margin: 32px 0 14px; text-align: center; }
section h2::before { content: "*** "; }
section h2::after { content: " ***"; }
.about h2::before, .about h2::after { content: none; }
.about h2, .checkout h2 { text-align: left; font-size: 1.05rem; }
.about h2::before, .checkout h2::before { content: ">> "; }

/* Product grid: each card is a little dashed-box ticket */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.card { display: block; text-decoration: none; color: inherit; border: 1px solid var(--bg); padding: 8px; background: var(--bg); }
.card:hover, .card:focus-visible { background: var(--bg); color: var(--fg); border-color: var(--fg); }
.card:hover h3 { background: var(--fg); color: var(--bg); }
.card h3 { font-size: .95rem; margin: 10px 0 4px; padding: 0 2px; }
.card p { margin: 0 0 6px; }
.card .excerpt { font-size: .82rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card p:last-child { display: flex; gap: 6px; align-items: baseline; margin: 8px 0 0; border-top: 1px dashed var(--fg); padding-top: 6px; }
.card p:last-child::before { content: "TOTAL"; margin-right: auto; font-size: .82rem; }
.card .price { font-weight: 700; }

/* Flags */
.flag { display: inline-block; padding: 1px 6px; font-size: .78rem; font-weight: 700; text-transform: uppercase; }
.flag::before, .flag::after { content: "*"; }
.flag.sale { background: var(--fg); color: var(--bg); }
.flag.out { background: var(--bg); color: var(--fg); border: 1px solid var(--fg); }
.card .flag { position: absolute; top: 8px; left: 8px; z-index: 3; }
.was { font-size: .9em; margin-left: 6px; }

/* Product page */
.product { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.product > *, .grid > * { min-width: 0; }   /* the long no-wrap ASCII rules must not widen the columns */
@media (max-width: 720px) { .product { grid-template-columns: 1fr; } }
.product .price { font-size: 1.5rem; font-weight: 700; margin: 0; }
.crumb { font-size: .85rem; margin: 0 0 4px; text-transform: uppercase; }
.crumb::before { content: "> "; }
.gallery img[data-main-img] { display: block; width: 100%; height: auto; }
.thumbs { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.thumb { padding: 0; background: var(--bg); width: 72px; }
.thumb::before, .thumb::after { content: none; }
.thumb img { width: 100%; display: block; }
.desc { margin: 20px 0; }
.desc::before { content: var(--dash); margin-bottom: 8px; }
.desc img { max-width: 100%; height: auto; filter: grayscale(1) contrast(1.2); }

/* Forms: boxes drawn like ASCII fields */
form label { display: block; margin: 10px 0; font-size: .9rem; text-transform: uppercase; }
form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px;
  font: inherit; text-transform: none; color: var(--fg); background: var(--bg);
  border: 1px solid var(--fg); border-radius: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px dashed var(--fg); outline-offset: 2px; }
select { appearance: none; -webkit-appearance: none; padding-right: 32px;   /* the arrow: two gradient halves in the ink colour */
  background: linear-gradient(45deg, transparent 50%, var(--fg) 50%) calc(100% - 15px) 55% / 6px 6px no-repeat,
              linear-gradient(135deg, var(--fg) 50%, transparent 50%) calc(100% - 9px) 55% / 6px 6px no-repeat, var(--bg); }
input[type=number] { width: 80px; }
input[type=checkbox] { display: inline; width: auto; margin: 0 6px 0 0; accent-color: var(--fg); }
[data-add-form] input[type=number] { display: inline-block; margin-left: 6px; }
label.check { text-transform: none; }

button {
  font: inherit; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 9px 16px; border: 1px solid var(--fg); border-radius: 0;
  background: var(--fg); color: var(--bg); cursor: pointer;
}
button::before { content: "[ "; }
button::after { content: " ]"; }
button:hover { background: var(--bg); color: var(--fg); }
button:disabled { cursor: wait; background: var(--bg); color: var(--fg); border-style: dashed; }
button.link { background: none; color: var(--fg); border: 0; padding: 0; font-weight: 400; text-decoration: underline; text-transform: none; letter-spacing: 0; }
button.link::before, button.link::after { content: none; }
button.link:hover { background: var(--fg); color: var(--bg); text-decoration: none; }

/* Cart: lines and totals read like the receipt body */
.lines, .totals { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.lines th { text-transform: uppercase; font-size: .85rem; border-bottom: 1px solid var(--fg); }
.lines th, .lines td, .totals td { padding: 8px 6px; border-bottom: 1px dashed var(--fg); text-align: left; vertical-align: top; }
.lines td a { text-decoration: none; font-weight: 700; }
.r { text-align: right !important; white-space: nowrap; }
.totals { max-width: 420px; margin-left: auto; text-transform: uppercase; }
.totals td { border-bottom: 0 !important; padding: 3px 6px !important; }
.totals .grand td { font-weight: 700; font-size: 1.15rem; border-top: 3px double var(--fg); border-bottom: 3px double var(--fg) !important; padding: 8px 6px !important; }
.totals small { text-transform: none; }
.checkout { max-width: 520px; margin-top: 32px; }
.muted, .muted td { font-size: .85rem; }
.error { font-weight: 700; border: 1px solid var(--fg); padding: 6px 10px; }
.error::before { content: "!! "; }
.ok { margin-left: 12px; font-weight: 700; }
.totals .pending td { font-style: italic; }

/* Footer: barcode, thank-you line and a cut line */
.foot { text-align: center; padding: 8px 16px 0; max-width: 1040px; margin: 0 auto; }
.foot::before { content: var(--dbl); margin-bottom: 18px; }
.foot p { margin: 0 0 8px; }
.barcode { font-size: 1.6rem; line-height: 1; letter-spacing: -.2em; transform: scaleY(1.8); transform-origin: top; margin-bottom: 26px !important; overflow: hidden; white-space: nowrap; }
.thanks { font-weight: 700; letter-spacing: .05em; white-space: nowrap; overflow: hidden; text-overflow: clip; }
@media (max-width: 480px) {
  .thanks { font-size: 3.6vw; letter-spacing: 0; }
  .brand { font-size: 1.5rem; letter-spacing: .15em; }
}
.brand span { white-space: nowrap; }
.small { font-size: .85rem; }
.foot a { font-weight: 700; text-decoration: none; }
.cut { position: relative; margin: 28px -16px 0 !important; padding-bottom: 12px; overflow: hidden; white-space: nowrap; }
.cut::before { content: var(--dash); position: absolute; left: 0; right: 0; top: 0; overflow: hidden; }
.cut span { position: relative; background: var(--bg); padding: 0 8px; }

/* About page / contact form */
.about { max-width: 640px; margin: 0 auto; }
.about address { font-style: normal; line-height: 1.6; border: 1px dashed var(--fg); padding: 10px 14px; display: inline-block; }
.contact { max-width: 520px; }
textarea { resize: vertical; min-height: 140px; }
.contact .hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.captcha { display: flex; align-items: center; gap: 12px; margin: 4px 0 6px; }
.captcha img { display: block; border: 1px solid #000; background: #fff; filter: grayscale(1) contrast(1.4); }
input.short { width: 140px; letter-spacing: .15em; }
.contact .ok { margin-left: 0; }

/* Photos: retro.js lays a canvas over each photo box and draws the photo in the theme's colours.
   The <img> and video loop stay underneath (for alt text, and as the source of the frames). */
.card .img, .main-img, .thumb { position: relative; display: block; overflow: hidden; }
.card .img { aspect-ratio: 4 / 3; }
.card .img img { width: 100%; height: 100%; object-fit: cover; display: block; }
canvas.retro { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; display: none; pointer-events: none; }
.retro-on canvas.retro { display: block; }
.retro-on { background: var(--bg) !important; }   /* hide the blurred colour placeholder */
.thumb { border: 0; outline: 1px dashed var(--fg); outline-offset: 2px; }
.thumb:hover, .thumb:focus-visible { outline-style: solid; }

/* Theme switcher in the top bar */
.top { flex-wrap: wrap; row-gap: 4px; }
.themes { display: flex; gap: 2px; font-size: .85rem; }
@media (max-width: 600px) { .themes { order: 3; width: 100%; } }   /* phones: themes on their own row under languages + cart */
.themes button { background: none; color: var(--fg); border: 0; padding: 0 3px; font-weight: 400; letter-spacing: 0; }
.themes button::before, .themes button::after { content: none; }
.themes button:hover { background: var(--fg); color: var(--bg); }
.themes button[aria-pressed="true"] { font-weight: 700; }
.themes button[aria-pressed="true"]::before { content: "["; }
.themes button[aria-pressed="true"]::after { content: "]"; }

/* fast images: the placeholder is the background of .img / .main-img; the still fades in over it */
.js .img img, .js .main-img img { opacity: 0; transition: opacity .25s ease-out; animation: img-failsafe 0s 3s forwards; }
@keyframes img-failsafe { to { opacity: 1; } }   /* if shop.js never runs, show the images anyway */
.js .img img.ready, .js .main-img img.ready { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .js .img img, .js .main-img img { transition: none; } }

/* video loops: laid exactly over the still, faded in once playing */
.img, .main-img { position: relative; }
.loop-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s; pointer-events: none; }
.loop-video.on { opacity: 1; }

/* Terms and conditions page */
.terms { max-width: 720px; margin: 0 auto; }
.terms h1 { text-align: left; }
.terms h2 { font-size: 1rem; margin: 28px 0 8px; }
.terms ul { padding-left: 1.2em; }
.terms li { margin: 6px 0; }
.form-copy { white-space: pre-wrap; font: inherit; font-size: .9rem; border: 1px dashed var(--fg); padding: 12px 14px; overflow-x: auto; }
label.check a { font-weight: 700; }

/* Customer reviews on the product page */
.rating { margin: -12px 0 12px; font-size: .9rem; }
.rating a { text-decoration: none; }
.reviews { margin-top: 32px; }
.reviews h2 { text-align: left; }
.reviews h2::after { content: none; }
.reviews h2::before { content: var(--dash); display: block; max-width: 100%; overflow: hidden; white-space: nowrap; font-weight: 400; margin-bottom: 8px; }
.review { margin: 0 0 16px; max-width: 720px; }
.review p { margin: 0 0 4px; }
.review-head .muted { margin-left: 8px; }
