/* Layout and components. Colours and fonts live in theme.css. */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
}

/* CRT scanlines */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 2px,
    rgba(0, 0, 0, var(--scanlines)) 2px 4px
  );
}

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-2); }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: 0.02em;
  color: var(--accent);
  text-shadow: 0 0 14px color-mix(in srgb, var(--accent) calc(var(--glow) * 100%), transparent);
  margin: 0 0 0.4em;
}
h1 { font-size: clamp(2.6rem, 7vw, 4.4rem); }
h2 { font-size: clamp(1.9rem, 4vw, 2.5rem); }
h3 { font-size: 1.55rem; }
p { margin: 0 0 1em; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
main { flex: 1; padding: 28px 0 64px; }
.dim { color: var(--dim); }
.hl { color: var(--accent-2); }
.hidden { display: none !important; }

/* ── Header ─────────────────────────────────────────────────── */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  flex-wrap: wrap;
  padding-top: 10px;
  padding-bottom: 10px;
}
.logo {
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.04em;
  white-space: nowrap;
  text-shadow: 0 0 14px color-mix(in srgb, var(--accent) calc(var(--glow) * 100%), transparent);
}
.logo .sep { color: var(--accent-2); }
.logo:hover { color: var(--accent); }
.cursor {
  display: inline-block;
  width: 0.5em;
  height: 0.85em;
  margin-left: 4px;
  vertical-align: -0.05em;
  background: currentColor;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.nav { display: flex; align-items: center; gap: 4px 18px; flex-wrap: wrap; }
.nav a {
  color: var(--text);
  text-decoration: none;
  text-transform: uppercase;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  padding: 4px 0;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--accent); }
.nav a[aria-current="page"]::before { content: "> "; }
.nav .basket {
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: var(--radius);
}
.nav .basket:hover { background: var(--accent); color: var(--accent-ink); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 1.4rem;
  line-height: 1;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  padding: 10px 18px 9px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 4px 4px 0 color-mix(in srgb, var(--accent) 30%, transparent);
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:hover { color: var(--accent-ink); transform: translate(-1px, -1px); box-shadow: 5px 5px 0 color-mix(in srgb, var(--accent) 40%, transparent); }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 color-mix(in srgb, var(--accent) 30%, transparent); }
.btn.ghost { background: transparent; color: var(--accent); box-shadow: none; }
.btn.ghost:hover { background: var(--panel-2); color: var(--accent); transform: none; }
.btn.small { font-size: 1.15rem; padding: 7px 12px 6px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.block { display: block; width: 100%; text-align: center; }

/* ── Terminal window / panels ───────────────────────────────── */
.window {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.window > .bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 12px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}
.window > .body { padding: 18px; }

/* ── Hero ───────────────────────────────────────────────────── */
.hero { display: grid; grid-template-columns: 1.15fr 1fr; gap: 28px; align-items: center; margin-bottom: 44px; }
.hero p.lead { font-size: 1.05rem; max-width: 46ch; }
.hero .actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 22px; }
.boot { font-size: 0.85rem; line-height: 1.55; white-space: pre-wrap; min-height: 15.5em; margin: 0; font-family: var(--font-body); }
.boot .ok { color: var(--accent); }

.trust { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 44px; }
.trust div { border: 1px dashed var(--line); padding: 12px 14px; border-radius: var(--radius); font-size: 0.85rem; }
.trust b { display: block; font-family: var(--font-display); font-weight: 400; font-size: 1.35rem; color: var(--accent-2); line-height: 1.1; margin-bottom: 4px; }

/* ── Catalogue ──────────────────────────────────────────────── */
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 16px; }
.section-head h2 { margin: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font-family: var(--font-body);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: transparent;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 5px 10px;
  cursor: pointer;
}
.chip:hover { color: var(--text); border-color: var(--dim); }
.chip[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.card { display: flex; flex-direction: column; transition: border-color 0.12s, transform 0.12s; }
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card .thumb {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  text-decoration: none;
}
.card .thumb img, .gallery .main img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ascii { margin: 0; font-family: var(--font-body); font-size: 11px; line-height: 1.15; color: var(--accent); opacity: 0.85; white-space: pre; }
.card .body { display: flex; flex-direction: column; gap: 8px; flex: 1; padding: 14px; }
.card h3 { margin: 0; font-size: 1.5rem; }
.card h3 a { color: inherit; text-decoration: none; }
.card h3 a:hover { color: var(--accent-2); }
.card .summary { font-size: 0.82rem; color: var(--dim); margin: 0; flex: 1; }
.card .foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 6px; }
.price { font-family: var(--font-display); font-size: 2rem; line-height: 1; color: var(--accent-2); white-space: nowrap; }
.grade { color: var(--accent-2); }
.sold-stamp {
  position: absolute;
  inset: auto auto 50% 50%;
  transform: translate(-50%, 50%) rotate(-12deg);
  font-family: var(--font-display);
  font-size: 3rem;
  line-height: 1;
  letter-spacing: 0.1em;
  color: var(--danger);
  border: 3px solid var(--danger);
  padding: 2px 16px;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
}
.card.sold .thumb img, .card.sold .ascii { opacity: 0.3; }
.empty { border: 1px dashed var(--line); padding: 40px 20px; text-align: center; color: var(--dim); }

/* ── Product page ───────────────────────────────────────────── */
.crumbs { font-size: 0.8rem; color: var(--dim); margin-bottom: 16px; text-transform: uppercase; letter-spacing: 0.08em; }
.crumbs a { color: var(--dim); }
.product { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
.gallery .main { display: grid; place-items: center; aspect-ratio: 4 / 3; background: var(--bg); overflow: hidden; }
.gallery .main .ascii { font-size: 15px; }
.gallery .thumbs { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.gallery .thumbs button { width: 64px; height: 48px; padding: 0; border: 1px solid var(--line); background: none; cursor: pointer; }
.gallery .thumbs button[aria-current="true"] { border-color: var(--accent); }
.gallery .thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); }
.product .price { font-size: 3rem; }
.buy { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 18px 0; }
.stockline { font-size: 0.85rem; }
.stockline.in { color: var(--accent); }
.stockline.out { color: var(--danger); }

.specs { list-style: none; margin: 0; padding: 0; font-size: 0.88rem; }
.specs li { display: flex; align-items: baseline; gap: 8px; padding: 3px 0; }
.specs .k { color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.78rem; white-space: nowrap; }
.specs .dots { flex: 1; border-bottom: 1px dotted var(--line); min-width: 16px; transform: translateY(-4px); }
.specs .v { text-align: right; }
.stack > * + * { margin-top: 18px; }

/* ── Basket ─────────────────────────────────────────────────── */
.basket-layout { display: grid; grid-template-columns: 1.7fr 1fr; gap: 24px; align-items: start; }
.line { display: grid; grid-template-columns: 1fr auto auto; gap: 8px 18px; align-items: center; padding: 14px 0; border-bottom: 1px dashed var(--line); }
.line:first-child { padding-top: 0; }
.line:last-child { border-bottom: 0; padding-bottom: 0; }
.line .name a { color: var(--text); text-decoration: none; font-weight: 600; }
.line .name a:hover { color: var(--accent); }
.line .meta { font-size: 0.8rem; color: var(--dim); }
.line .amt { font-family: var(--font-display); font-size: 1.6rem; color: var(--accent-2); min-width: 5.5ch; text-align: right; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius); }
.qty button { font-family: var(--font-body); font-size: 1rem; width: 30px; height: 30px; background: none; border: 0; color: var(--accent); cursor: pointer; }
.qty button:hover:not([disabled]) { background: var(--panel-2); }
.qty button[disabled] { opacity: 0.3; cursor: not-allowed; }
.qty span { min-width: 2.2ch; text-align: center; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; font-size: 0.78rem; color: var(--dim); text-decoration: underline; cursor: pointer; }
.linkbtn:hover { color: var(--danger); }
.totals { list-style: none; margin: 0 0 16px; padding: 0; }
.totals li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.totals .grand { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 12px; align-items: baseline; }
.totals .grand span:last-child { font-family: var(--font-display); font-size: 2.2rem; line-height: 1; color: var(--accent-2); }
.notice { border: 1px solid var(--danger); color: var(--danger); padding: 10px 12px; margin-bottom: 14px; font-size: 0.85rem; border-radius: var(--radius); }
.small { font-size: 0.78rem; }

/* ── Text pages ─────────────────────────────────────────────── */
.prose { max-width: 74ch; }
.prose h2 { margin-top: 1.4em; font-size: 1.9rem; }
.prose ul { padding-left: 1.3em; }
.prose li { margin-bottom: 0.4em; }
.prose table { border-collapse: collapse; width: 100%; margin-bottom: 1em; font-size: 0.88rem; }
.prose th, .prose td { text-align: left; vertical-align: top; border: 1px solid var(--line); padding: 8px 10px; }
.prose th { color: var(--accent); font-weight: 600; background: var(--panel-2); white-space: nowrap; }
.center { text-align: center; padding: 40px 0; }
.center .ascii { display: inline-block; text-align: left; font-size: 14px; margin-bottom: 18px; }

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--line); background: var(--panel); font-size: 0.8rem; color: var(--dim); padding: 26px 0 30px; }
.site-footer .cols { display: flex; justify-content: space-between; gap: 20px 40px; flex-wrap: wrap; margin-bottom: 16px; }
.site-footer nav { display: flex; gap: 6px 18px; flex-wrap: wrap; }
.site-footer a { color: var(--text); }
.site-footer p { margin: 0 0 0.4em; max-width: 90ch; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 820px) {
  .hero, .product, .basket-layout { grid-template-columns: 1fr; }
  .trust { grid-template-columns: repeat(2, 1fr); }
  .boot { min-height: 0; }
}
@media (max-width: 480px) {
  body { font-size: 14px; }
  .logo { font-size: 1.7rem; }
  .line { grid-template-columns: 1fr auto; }
  .line .name { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
