/* ElectroArt Trade — вітрина у фірмовому стилі (як креативи навички «Дизайнер ElectroArt»):
   лише графіт, білий і сірі, Roboto Condensed, технічна сітка, біла рамка з кутовими
   мітками, характеристики в рамках-виносках, останній рядок заголовка — на білій плашці.
   Кольорових акцентів немає: стан (немає, помилка) — текстом, знаком і рамкою. */
@font-face {
  font-family: "Roboto Condensed"; src: url("/static/fonts/RobotoCondensed.ttf") format("truetype");
  font-weight: 100 900; font-display: swap;
}
:root {
  --bg: #111;            /* графіт */
  --grid: #1b1b1b;       /* лінії технічної сітки */
  --surface: #161616;    /* картки, форми */
  --well: #0c0c0c;       /* поля вводу */
  --line: #333;          /* тонкі лінії */
  --line-strong: #5a5a5a;
  --ink: #fff;
  --muted: #bbb;         /* підписи-мітки */
  --dim: #8a8a8a;        /* другорядне */
  --font: "Roboto Condensed", "Arial Narrow", "Liberation Sans Narrow", sans-serif;
  --tick: 14px;          /* кутова мітка */
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; color: var(--ink); font: 400 17px/1.5 var(--font);
  background-color: var(--bg);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; z-index: 10; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; }

/* ---------- Фірмові елементи ---------- */
.label { font-size: 13px; font-weight: 500; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); }
.inv {
  background: var(--ink); color: var(--bg); padding: 0 .18em; line-height: 1.12;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
/* Рамка з кутовими мітками: .framed + <i class="tk tl"></i>… (ticks() в app.js) */
.framed { position: relative; border: 2px solid var(--ink); }
.tk { position: absolute; width: var(--tick); height: var(--tick); border: 0 solid var(--ink); pointer-events: none; }
.tk.tl { top: -8px; left: -8px; border-top-width: 4px; border-left-width: 4px; }
.tk.tr { top: -8px; right: -8px; border-top-width: 4px; border-right-width: 4px; }
.tk.bl { bottom: -8px; left: -8px; border-bottom-width: 4px; border-left-width: 4px; }
.tk.br { bottom: -8px; right: -8px; border-bottom-width: 4px; border-right-width: 4px; }
/* Виноска з характеристикою: назва — значення */
.spec { border: 2px solid var(--ink); padding: 10px 14px; background: rgba(17, 17, 17, .88); }
.spec .k { font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.spec .v { font-size: 19px; font-weight: 700; line-height: 1.2; margin-top: 2px; }

/* ---------- Шапка ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px max(16px, env(safe-area-inset-left));
  background: rgba(17, 17, 17, .92);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { text-decoration: none; display: flex; align-items: center; gap: 10px; }
.brand-bulb { height: 40px; width: auto; display: block; }
.brand-word { display: grid; line-height: 1; }
.brand-name { font-size: 22px; font-weight: 400; letter-spacing: .01em; }
.brand-sub {
  justify-self: stretch; text-align: center; margin-top: 3px; padding: 1px 6px 2px;
  background: var(--ink); color: var(--bg); font-size: 14px; font-style: italic; font-weight: 500;
}
.top-nav { display: flex; align-items: center; gap: 6px; }
.nav-link {
  text-decoration: none; font-size: 14px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase;
  padding: 10px 12px; color: var(--muted);
}
.nav-link:hover { color: var(--ink); }
@media (max-width: 420px) { .nav-link { display: none; } }
.cart-link {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none;
  font-size: 14px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase;
  padding: 9px 14px; border: 2px solid var(--ink); min-height: 44px;
}
.cart-link:hover { background: var(--ink); color: var(--bg); }
.cart-count {
  min-width: 24px; height: 24px; padding: 0 6px; display: inline-grid; place-items: center;
  background: var(--ink); color: var(--bg); font-size: 15px; letter-spacing: 0; font-variant-numeric: tabular-nums;
}
.cart-link:hover .cart-count { background: var(--bg); color: var(--ink); }
.cart-count.bump { animation: bump .35s ease; }
@keyframes bump { 40% { transform: scale(1.3); } }

main { max-width: 1160px; margin: 0 auto; padding: 24px 16px; }
main:focus, main:focus-visible { outline: none; } /* фокус після переходу — лише для екранних читачів */
.foot {
  max-width: 1160px; margin: 40px auto 0; padding: 24px 16px 48px; color: var(--dim); font-size: 15px;
  border-top: 1px solid var(--line); display: flex; gap: 20px; align-items: center;
}
.foot img { height: 72px; width: auto; flex: none; opacity: .9; }
.foot p { margin: 0; max-width: 60ch; }
.foot-text { display: grid; gap: 10px; }
.foot-nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.foot-nav a {
  color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 500;
  letter-spacing: .16em; text-transform: uppercase; padding: 4px 0;
}
.foot-nav a:hover { color: var(--ink); text-decoration: underline; }

/* ---------- Інформаційні сторінки ---------- */
.doc { max-width: 800px; background: rgba(17, 17, 17, .92); padding: clamp(20px, 4vw, 40px); border: 1px solid var(--line); }
.doc h2 {
  display: flex; align-items: center; gap: 12px; margin: 32px 0 12px;
  font-size: 22px; font-weight: 800; line-height: 1.1; text-transform: uppercase;
}
.doc h2::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }
.doc p, .doc li { color: #ddd; }
.doc p { margin: 0 0 12px; }
.doc ul, .doc ol { margin: 0 0 12px; padding-left: 22px; display: grid; gap: 6px; }
.doc a { color: var(--ink); }
.doc .kv { margin: 8px 0 16px; }
.contact-big { font-size: clamp(26px, 5vw, 34px); font-weight: 800; line-height: 1.25; }
.contact-big a { text-decoration: none; }
/* Дані, яких ще бракує (видно лише до заповнення) */
mark.todo { background: transparent; color: var(--ink); border: 1px dashed var(--ink); padding: 0 4px; }

.page-title {
  font-size: clamp(30px, 6vw, 46px); font-weight: 800; line-height: 1; text-transform: uppercase;
  letter-spacing: -.005em; margin: 8px 0 20px;
}
.muted { color: var(--dim); }

/* ---------- Вступний блок ---------- */
.hero {
  background: rgba(17, 17, 17, .9); margin: 12px 0 40px;
  padding: clamp(28px, 5vw, 56px); display: grid; grid-template-columns: 1.05fr .95fr;
  gap: clamp(24px, 4vw, 56px); align-items: center;
}
.hero .label { margin-bottom: 18px; }
.hero h1 {
  font-size: clamp(40px, 7.4vw, 84px); font-weight: 800; line-height: .98; text-transform: uppercase;
  letter-spacing: -.005em; margin: 0 0 22px;
}
.hero h1 .inv { display: inline; }
.hero-lead { font-size: clamp(17px, 1.9vw, 20px); line-height: 1.5; color: #d8d8d8; max-width: 46ch; margin: 0 0 26px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .btn { min-height: 52px; padding: 14px 24px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 28px 0 0; padding: 0; list-style: none; }

.hero-art { display: grid; gap: 16px; }
.drawing { width: 100%; height: auto; display: block; }
.featured {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; align-items: center;
  border: 2px solid var(--ink); padding: 14px 16px; background: var(--bg);
}
.featured-name { font-size: 30px; font-weight: 800; line-height: 1; text-transform: uppercase; }
.featured .price-tag { justify-self: start; }
.featured .btn { grid-row: 1 / span 3; grid-column: 2; }

/* Вступний блок: постріл (цвях із майданчиком у стелю) → кабель → хомут.
   Без анімацій (reduced motion) одразу видно кінцевий кадр. */
.mount { animation: shoot 0.7s cubic-bezier(.55, 0, .85, .3) 0.35s both; }
.burst { opacity: 0; transform-origin: 200px 104px; animation: burst 0.7s ease-out 1.0s both; }
.crack { stroke-dasharray: 60; animation: draw60 0.5s ease-out 1.0s both; }
.cables { animation: slide-in 0.8s cubic-bezier(.2, .7, .2, 1) 1.35s both; }
.tie { stroke-dasharray: 100; animation: draw100 0.6s ease-in-out 2.1s both; }
.dim { animation: fadein 0.6s ease 2.6s both; }
@keyframes shoot { from { transform: translateY(78px); } }
@keyframes burst { 0% { opacity: 0; transform: scale(.4); } 30% { opacity: 1; } 100% { opacity: 0; transform: scale(1.5); } }
@keyframes draw60 { from { stroke-dashoffset: 60; } }
@keyframes draw100 { from { stroke-dashoffset: 100; } }
@keyframes slide-in { from { transform: translateX(-440px); } }
@keyframes fadein { from { opacity: 0; } }

/* Плашка «Алмазне буріння»: запускається, коли з'являється на екрані */
.scene {
  background: rgba(17, 17, 17, .9); padding: clamp(20px, 3vw, 32px); margin: 8px 0 24px;
  display: grid; grid-template-columns: .8fr 1.2fr; gap: clamp(16px, 3vw, 32px); align-items: center;
}
.scene h3 { font-size: clamp(24px, 3vw, 32px); font-weight: 800; line-height: 1; text-transform: uppercase; margin: 0 0 12px; }
.scene p { color: #d8d8d8; margin: 0; max-width: 44ch; }
.drill-art { width: 100%; height: auto; display: block; }
.scene.play .d-drill { animation: drill-in 2.6s cubic-bezier(.4, 0, .2, 1) both; }
.scene.play .d-spin { animation: spin 0.18s linear 12 0.1s; }
.scene.play .d-flow { animation: flow 0.45s linear 5 0.5s; }
.scene.play .d-hole { animation: fadein 0.4s ease 1.9s both; }
.scene.play .d-dim { animation: fadein 0.5s ease 2.5s both; }
@keyframes drill-in {
  0% { transform: translateX(0); } 12% { transform: translateX(8px); }
  68%, 80% { transform: translateX(54px); } 100% { transform: translateX(0); }
}
@keyframes spin { to { transform: translateX(-12px); } }
@keyframes flow { to { stroke-dashoffset: -32; } }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; padding: 28px 20px; }
  .hero-actions .btn { flex: 1 1 100%; }
  .facts { grid-template-columns: 1fr; }
  .scene { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .featured { grid-template-columns: 1fr; }
  .featured .btn { grid-row: auto; grid-column: 1; margin-top: 8px; }
}

/* ---------- Каталог ---------- */
#catalog { scroll-margin-top: 76px; }
.tools {
  position: sticky; top: 65px; z-index: 4; padding: 10px 0 12px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.search {
  width: 100%; padding: 13px 14px; border: 2px solid var(--line-strong); border-radius: 0;
  background: var(--well); font-size: 18px;
}
.search:focus { border-color: var(--ink); outline: none; }
.search::placeholder { color: var(--dim); }
.cats { display: flex; gap: 8px; overflow-x: auto; padding-top: 10px; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cat {
  flex: none; padding: 7px 12px; border: 1px solid var(--line-strong); background: transparent; cursor: pointer;
  white-space: nowrap; font-size: 13px; font-weight: 500; letter-spacing: .18em; text-transform: uppercase; color: var(--muted);
}
.cat:hover { border-color: var(--ink); color: var(--ink); }
.cat[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.section { margin-top: 44px; }
.section-title {
  display: flex; align-items: center; gap: 14px; margin-bottom: 18px;
  font-size: clamp(24px, 3vw, 32px); font-weight: 800; line-height: 1; text-transform: uppercase;
}
.section-title::after { content: ""; flex: 1; height: 2px; background: var(--ink); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }

/* Картка товару — як картка `product` у креативах: квадратне фото зверху, смуга внизу */
.item {
  background: var(--surface); border: 1px solid var(--line); padding: 16px;
  display: grid; gap: 14px; align-content: start; transition: border-color .15s;
}
.item:hover { border-color: var(--line-strong); }
.shot { position: relative; margin: 2px 2px 4px; border: 2px solid var(--ink); background: var(--well); }
/* Фото в наявності — кольорове, як є; немає в наявності — сіре й притишене */
.photo { width: 100%; aspect-ratio: 1; object-fit: cover; object-position: center 75%; display: block; }
.item:has(.stock.none) .photo { filter: grayscale(1) brightness(.7); }
.item:has(.stock.none) .shot { border-color: var(--line-strong); }
.item:has(.stock.none) .tk { border-color: var(--line-strong); }
.item:has(.stock.none) .model { color: var(--dim); }
.item.family { grid-column: 1 / -1; }
.type { margin-bottom: 6px; }
/* Модель — так, як її називають монтажники: GSN45P, DCCN27 */
.model { font-size: clamp(28px, 4vw, 34px); font-weight: 800; line-height: 1; text-transform: uppercase; word-break: break-word; }
.model-rest { font-size: 15px; color: var(--muted); margin-top: 4px; }
.family-title { font-size: 21px; font-weight: 700; line-height: 1.2; }
.hint { font-size: 14px; color: var(--dim); }

/* Сітка розмірів — як таблиця в паперовому каталозі */
.sizes { display: flex; flex-wrap: wrap; gap: 6px; }
.size {
  min-width: 68px; padding: 9px 10px; border: 1px solid var(--line-strong); background: var(--well); cursor: pointer;
  font-size: 16px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
}
.size:hover { border-color: var(--ink); }
.size[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.size.out { color: var(--dim); text-decoration: line-through; }

.buy { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
/* Ціна — на білій плашці, як у креативах */
.price-tag {
  display: inline-block; background: var(--ink); color: var(--bg); font-weight: 900; font-size: 24px; line-height: 1;
  padding: 7px 12px; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.price-tag small { font-size: 15px; font-weight: 700; }
.stock { font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-top: 8px; }
.stock.none { color: var(--dim); }
.stock.none::before { content: "✕ "; }
.item:has(.stock.none) .price-tag { background: transparent; color: var(--dim); box-shadow: inset 0 0 0 1px var(--line-strong); }

.btn {
  border: 2px solid var(--ink); border-radius: 0; padding: 11px 18px; cursor: pointer;
  background: var(--ink); color: var(--bg); text-decoration: none;
  font-size: 15px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px;
}
.btn:hover { background: #ddd; border-color: #ddd; }
.btn:disabled { background: transparent; border-color: var(--line-strong); color: var(--dim); cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.wide { width: 100%; }
.link-btn { background: none; border: 0; padding: 4px; color: var(--muted); cursor: pointer; text-decoration: underline; font-size: 15px; }
.link-btn:hover { color: var(--ink); }

.stepper { display: inline-flex; align-items: center; border: 2px solid var(--ink); }
.stepper button { width: 42px; height: 42px; border: 0; background: none; cursor: pointer; font-size: 22px; font-weight: 700; }
.stepper button:hover { background: var(--ink); color: var(--bg); }
.stepper input {
  width: 60px; height: 42px; border: 0; border-left: 1px solid var(--line-strong); border-right: 1px solid var(--line-strong);
  text-align: center; background: transparent; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.line-ctrl { display: flex; align-items: center; gap: 12px; }
.in-cart { font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }

.empty { padding: 32px 0; }
.empty p { margin: 0 0 12px; }

/* ---------- Кошик ---------- */
.lines { display: grid; border-top: 2px solid var(--ink); }
.line {
  display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; padding: 16px 0;
  border-bottom: 1px solid var(--line); align-items: center;
}
.line-name { font-size: 18px; font-weight: 700; }
.line-meta { font-size: 14px; color: var(--dim); }
.line-sum { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.total { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px 0; }
.total > span { font-size: 13px; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); }
.total strong { background: var(--ink); color: var(--bg); font-size: 30px; font-weight: 900; padding: 6px 14px; font-variant-numeric: tabular-nums; }

/* ---------- Оформлення ---------- */
.checkout { display: grid; gap: 28px; max-width: 700px; }
.step { background: var(--surface); border: 1px solid var(--line); padding: 20px; display: grid; gap: 16px; }
.step-title { display: flex; gap: 14px; align-items: center; font-size: 22px; font-weight: 800; text-transform: uppercase; line-height: 1; }
.step-num {
  flex: none; width: 40px; height: 40px; border: 2px solid var(--ink); display: grid; place-items: center;
  font-size: 20px; font-weight: 800;
}
.field { display: grid; gap: 6px; }
.field label, .legend { font-size: 13px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.field input, .field textarea {
  padding: 12px; border: 2px solid var(--line-strong); border-radius: 0; background: var(--well); font-size: 18px; width: 100%;
}
.field input:focus, .field textarea:focus { border-color: var(--ink); outline: none; }
.field input::placeholder, .field textarea::placeholder { color: #666; }
.field textarea { min-height: 96px; resize: vertical; }
/* Помилка — без кольору: знак, жирний текст і біла смуга зліва */
.err { font-size: 15px; font-weight: 700; }
.err:not(:empty)::before { content: "⚠ "; }
.field.invalid input, .field.invalid textarea { border-color: var(--ink); border-style: dashed; }
.choices { display: grid; gap: 8px; }
.choice {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: start; cursor: pointer;
  padding: 14px; border: 1px solid var(--line-strong); background: var(--well); font-size: 18px; font-weight: 700;
}
.choice:hover { border-color: var(--ink); }
.choice input { margin-top: 4px; accent-color: #fff; width: 18px; height: 18px; }
.choice:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.choice.disabled { opacity: .5; cursor: not-allowed; }
.choice-sub { grid-column: 2; font-size: 15px; font-weight: 400; color: var(--dim); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.suggest { position: relative; }
.options {
  list-style: none; margin: 4px 0 0; padding: 0; border: 2px solid var(--ink);
  background: var(--surface); max-height: 300px; overflow-y: auto;
}
.options li button {
  width: 100%; text-align: left; padding: 11px 12px; border: 0; background: none; cursor: pointer;
  border-bottom: 1px solid var(--line); display: grid; gap: 2px; font-size: 17px;
}
.options li:last-child button { border-bottom: 0; }
.options li button:hover { background: var(--ink); color: var(--bg); }
.options li button:hover .opt-sub { color: #444; }
.options li button[aria-disabled="true"] { color: var(--dim); cursor: not-allowed; background: none; }
.opt-sub { font-size: 14px; color: var(--dim); }
.chosen {
  display: flex; justify-content: space-between; gap: 12px; align-items: start;
  padding: 12px 14px; border: 2px solid var(--ink); background: var(--well);
}
.summary { display: grid; gap: 6px; }
.form-error { padding: 12px 14px; border: 2px solid var(--ink); border-left-width: 8px; font-weight: 700; }
.form-error::before { content: "⚠ "; }
.trap { position: absolute; left: -5000px; }

/* ---------- Сторінка замовлення ---------- */
.status-card { background: var(--surface); padding: 22px; display: grid; gap: 16px; max-width: 700px; }
.status-big { font-size: clamp(26px, 5vw, 36px); font-weight: 800; line-height: 1.05; text-transform: uppercase; }
.ttn { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .04em; margin: 4px 0 10px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
.kv dt { font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); padding-top: 3px; }
.kv dd { margin: 0; }

@media (max-width: 520px) {
  .row2 { grid-template-columns: 1fr; }
  .line { grid-template-columns: 1fr; }
  .line-sum { text-align: left; }
  .foot { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
