/* ==========================================================================
   DESIGN TOKENS — "Bench" theme
   An instrument-panel aesthetic drawn from oscilloscope displays, PCB
   silkscreen, and datasheet typography. Built for a hardware/firmware
   engineering practice, not a generic SaaS dark-mode.
   ========================================================================== */
:root {
  /* Color */
  --bg:          #0e1512;   /* PCB-black, faint green cast */
  --panel:       #16211c;   /* raised panel surface */
  --panel-2:     #1c2a23;   /* nested panel / hover */
  --line:        #2a3a32;   /* hairline / graticule */
  --text:        #ede9e0;   /* off-white, warm */
  --text-dim:    #93a49b;   /* muted labels */
  --amber:       #ffb000;   /* phosphor amber — primary accent, CTAs */
  --amber-dim:   #a87700;
  --teal:        #4fd1c5;   /* signal teal — secondary accent, data traces */
  --danger:      #ff6b5e;

  /* Type */
  --font-display: 'IBM Plex Mono', 'Courier New', monospace;
  --font-body:    'IBM Plex Sans', -apple-system, Segoe UI, sans-serif;
  --font-data:    'IBM Plex Mono', monospace;

  /* Scale */
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.75rem;
  --step-3: 2.5rem;
  --step-4: 3.5rem;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 32px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 32px 100%,
    var(--bg);
  background-blend-mode: normal;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* graticule opacity kept low so it reads as texture, not a grid UI */
body { position: relative; }
body::before {
  content: "";
  position: fixed; inset: 0;
  background: inherit;
  opacity: 0.35;
  z-index: -1;
  pointer-events: none;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
}
h1 { font-size: var(--step-4); line-height: 1.05; }
h2 { font-size: var(--step-3); line-height: 1.1; }
h3 { font-size: var(--step-2); }
p  { margin: 0 0 1em; color: var(--text); }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- eyebrow / silkscreen labels ---- */
.label {
  font-family: var(--font-data);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.label::before {
  content: "";
  width: 8px; height: 8px;
  background: var(--amber);
  border-radius: 1px;
  display: inline-block;
}

/* ---- top toolbar ---- */
.toolbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(14, 21, 18, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.toolbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  max-width: 1080px; margin: 0 auto;
}
.brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.brand .dot { width: 10px; height: 10px; background: var(--amber); border-radius: 50%; box-shadow: 0 0 8px var(--amber); }
.nav-links { display: flex; gap: 28px; font-family: var(--font-data); font-size: 0.85rem; }
.nav-links a { color: var(--text-dim); }
.nav-links a.active, .nav-links a:hover { color: var(--amber); text-decoration: none; }
.cart-btn {
  font-family: var(--font-data);
  font-size: 0.85rem;
  color: var(--bg);
  background: var(--amber);
  border: none;
  padding: 8px 14px;
  border-radius: 3px;
  cursor: pointer;
}
.cart-btn:hover { background: #ffc233; }

/* ---- hero ---- */
.hero {
  padding: 100px 0 70px;
  position: relative;
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
}
.hero h1 { font-size: clamp(2rem, 4.2vw, 3.4rem); }
.hero .lede { font-size: 1.1rem; color: var(--text-dim); max-width: 46ch; }
.hero-actions { display: flex; gap: 14px; margin-top: 28px; flex-wrap: wrap; }

.btn {
  font-family: var(--font-data);
  font-size: 0.9rem;
  padding: 12px 20px;
  border-radius: 3px;
  border: 1px solid var(--line);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary { background: var(--amber); color: var(--bg); border-color: var(--amber); }
.btn-primary:hover { background: #ffc233; text-decoration: none; }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { border-color: var(--teal); color: var(--teal); text-decoration: none; }

/* oscilloscope trace, the page's signature element */
.scope {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 18px;
}
.scope-head {
  display: flex; justify-content: space-between;
  font-family: var(--font-data); font-size: 0.72rem; color: var(--text-dim);
  margin-bottom: 8px;
}
.scope svg { width: 100%; height: auto; display: block; }
.scope-trace {
  fill: none;
  stroke: var(--teal);
  stroke-width: 2;
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: draw 2.6s ease-out forwards, pulse 4s ease-in-out 2.6s infinite;
}
.scope-trace.b { stroke: var(--amber); opacity: 0.7; animation-delay: 0.3s, 2.9s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

/* ---- sections ---- */
section { padding: 64px 0; }
.section-head { margin-bottom: 36px; }
.section-head h2 { margin-top: 10px; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 22px;
}
.card h3 { font-size: 1.15rem; margin-bottom: 6px; }
.spec-row {
  display: flex; justify-content: space-between;
  font-family: var(--font-data); font-size: 0.82rem;
  color: var(--text-dim);
  padding: 6px 0;
  border-top: 1px dashed var(--line);
}
.spec-row span:last-child { color: var(--text); }

/* ---- product / store grid ---- */
.product-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.product-media {
  aspect-ratio: 4 / 3;
  background: var(--panel-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
  font-family: var(--font-data); font-size: 0.75rem;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.product-media img { width: 100%; height: 100%; object-fit: cover; }
.product-body { padding: 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.product-body h3 { margin: 0; font-size: 1.05rem; }
.product-desc { color: var(--text-dim); font-size: 0.92rem; flex: 1; }
.product-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.price { font-family: var(--font-data); color: var(--amber); font-size: 1.1rem; }
.stock-tag {
  font-family: var(--font-data); font-size: 0.7rem; letter-spacing: 0.08em;
  padding: 3px 8px; border-radius: 2px; text-transform: uppercase;
}
.stock-tag.in { background: rgba(79,209,197,0.12); color: var(--teal); }
.stock-tag.low { background: rgba(255,176,0,0.12); color: var(--amber); }
.stock-tag.out { background: rgba(255,107,94,0.12); color: var(--danger); }

.add-btn {
  width: 100%;
  font-family: var(--font-data); font-size: 0.85rem;
  padding: 10px; margin-top: 10px;
  background: transparent; border: 1px solid var(--amber); color: var(--amber);
  border-radius: 3px; cursor: pointer;
}
.add-btn:hover { background: var(--amber); color: var(--bg); }
.add-btn[disabled] { opacity: 0.4; cursor: not-allowed; border-color: var(--line); color: var(--text-dim); }

.product-media-link, .product-title-link { color: inherit; display: block; }
.product-title-link:hover { text-decoration: none; }
.product-title-link:hover h3 { color: var(--teal); }

/* ---- product detail page ---- */
.product-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}
.gallery-main {
  aspect-ratio: 4 / 3;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
  font-family: var(--font-data); font-size: 0.8rem; text-align: center; padding: 20px;
  overflow: hidden;
}
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs {
  display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap;
}
.thumb {
  width: 64px; height: 64px;
  border: 2px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
  opacity: 0.7;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb:hover { opacity: 1; }
.thumb.selected { border-color: var(--amber); opacity: 1; }

.product-info h1 { font-size: 1.8rem; margin-bottom: 4px; }
.product-info-foot {
  display: flex; align-items: center; gap: 14px; margin: 16px 0;
}
.product-info-foot .price { font-size: 1.4rem; }
.product-fulldesc p { color: var(--text-dim); }
.breadcrumb {
  font-family: var(--font-data); font-size: 0.8rem; color: var(--text-dim); margin-bottom: 8px;
}
.breadcrumb a { color: var(--text-dim); }
.breadcrumb a:hover { color: var(--teal); }

/* ---- cart drawer ---- */
.cart-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: none; z-index: 90;
}
.cart-overlay.open { display: block; }
.cart-drawer {
  position: fixed; top: 0; right: -420px; width: 400px; max-width: 92vw; height: 100%;
  background: var(--panel); border-left: 1px solid var(--line);
  z-index: 91; transition: right 0.25s ease;
  display: flex; flex-direction: column;
}
.cart-drawer.open { right: 0; }
.cart-head {
  padding: 20px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.cart-items { flex: 1; overflow-y: auto; padding: 16px 20px; }
.cart-item { display: flex; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px dashed var(--line); font-size: 0.9rem; }
.cart-item button { background: none; border: none; color: var(--danger); cursor: pointer; font-family: var(--font-data); font-size: 0.75rem; }
.cart-foot { padding: 20px; border-top: 1px solid var(--line); }
.cart-total { display: flex; justify-content: space-between; font-family: var(--font-data); font-size: 1.1rem; margin-bottom: 14px; }
.close-btn { background: none; border: none; color: var(--text-dim); font-size: 1.4rem; cursor: pointer; line-height: 1; }

/* ---- checkout panel ---- */
.checkout-panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px;
  padding: 28px; max-width: 640px;
}
.pay-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 20px 0; }
.pay-method {
  border: 1px solid var(--line); border-radius: 4px; padding: 16px; text-align: center;
  cursor: pointer;
}
.pay-method.selected { border-color: var(--amber); background: rgba(255,176,0,0.06); }
.qr-box {
  background: var(--panel-2); border: 1px dashed var(--line); border-radius: 4px;
  aspect-ratio: 1; max-width: 220px; margin: 16px auto; display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-family: var(--font-data); font-size: 0.75rem; text-align: center; padding: 12px;
}
.qr-box img { width: 100%; height: 100%; object-fit: contain; }
.bank-details { font-family: var(--font-data); font-size: 0.85rem; }
.bank-details .row { display: flex; justify-content: space-between; padding: 6px 0; border-top: 1px dashed var(--line); }
.order-ref {
  font-family: var(--font-data); background: var(--panel-2); border: 1px solid var(--line);
  padding: 10px 14px; border-radius: 3px; display: inline-block; color: var(--amber); font-size: 1rem;
}
textarea, input[type=text], input[type=email] {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: 10px; border-radius: 3px; font-family: var(--font-body); font-size: 0.92rem;
}
label.field { display: block; font-family: var(--font-data); font-size: 0.75rem; color: var(--text-dim); margin: 12px 0 6px; text-transform: uppercase; letter-spacing: 0.06em; }

/* ---- footer ---- */
footer { border-top: 1px solid var(--line); padding: 32px 0; margin-top: 40px; }
footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-family: var(--font-data); font-size: 0.78rem; color: var(--text-dim); }

/* ---- responsive ---- */
@media (max-width: 800px) {
  .hero-grid { grid-template-columns: 1fr; }
  .grid-3, .grid-2, .pay-methods { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .cart-drawer { width: 100%; }
  .product-detail-grid { grid-template-columns: 1fr; }
}
