/* ============================================================ tokens */
:root {
  --bg: #f6f5f2;
  --bg-alt: #ecebe6;
  --surface: #ffffff;
  --text: #121212;
  --muted: #5f5d58;
  --line: #dddbd4;
  --accent: #ff5a1f;
  --accent-ink: #ffffff;
  --accent-soft: #ffe6dc;
  --danger: #c62828;
  --ok: #1f7a3a;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 8px 24px rgb(0 0 0 / 0.06);
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #111110;
    --bg-alt: #181816;
    --surface: #1d1d1b;
    --text: #f1efe9;
    --muted: #a19e96;
    --line: #2f2e2b;
    --accent-soft: #3a1e12;
    --danger: #ef6b6b;
    --ok: #5cc27e;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.35);
    color-scheme: dark;
  }
}

/* ============================================================ base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 0.5em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); font-weight: 700; }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 600; }
h3 { font-size: 1.15rem; font-weight: 600; }
p { margin: 0 0 1em; }
a { color: inherit; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ============================================================ buttons & forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 999px; border: 1.5px solid transparent;
  font-weight: 600; font-size: 0.95rem; text-decoration: none; cursor: pointer;
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-ghost:hover { border-color: var(--text); }
.btn-danger { background: transparent; border-color: color-mix(in srgb, var(--danger) 40%, transparent); color: var(--danger); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.btn-sm { padding: 7px 14px; font-size: 0.85rem; }

label { display: grid; gap: 6px; font-size: 0.85rem; font-weight: 500; color: var(--muted); }
input:not([type='checkbox']):not([type='radio']):not([type='file']), textarea, select {
  width: 100%; padding: 11px 13px; border-radius: 10px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--text);
  font-size: 0.95rem;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; }

/* ============================================================ header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 700 1.05rem var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; }
.brand-mark { width: 28px; height: 28px; }
.nav { display: flex; gap: 22px; }
.nav a { text-decoration: none; font-size: 0.93rem; color: var(--muted); font-weight: 500; }
.nav a:hover { color: var(--text); }
@media (max-width: 560px) { .nav { gap: 14px; } .nav a { font-size: 0.85rem; } .brand span { display: none; } }

/* ============================================================ hero */
.hero { padding: clamp(48px, 9vw, 110px) 0 clamp(40px, 6vw, 80px); overflow: hidden; }
.hero-inner { display: grid; grid-template-columns: 1.2fr 1fr; align-items: center; gap: 40px; }
.eyebrow { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.lead { font-size: 1.12rem; color: var(--muted); max-width: 52ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero-art { display: grid; place-items: center; }
.cube { width: min(360px, 80vw); overflow: visible; }
.cube-outline { fill: var(--surface); stroke: var(--text); stroke-width: 2.5; stroke-linejoin: round; }
.cube-edge { fill: none; stroke: var(--text); stroke-width: 2.5; stroke-linejoin: round; }
.layers polyline { fill: none; stroke: var(--accent); stroke-width: 1.5; opacity: 0; animation: layer 4.8s infinite; }
.layers polyline:nth-child(2) { animation-delay: 0.6s; }
.layers polyline:nth-child(3) { animation-delay: 1.2s; }
.layers polyline:nth-child(4) { animation-delay: 1.8s; }
.nozzle { fill: var(--accent); animation: nozzle 2.4s ease-in-out infinite; }
.cube-spin { animation: float 6s ease-in-out infinite; }
@keyframes layer { 0% { opacity: 0; } 10%, 70% { opacity: 1; } 90%, 100% { opacity: 0; } }
@keyframes nozzle { 0%, 100% { transform: translateX(-60px); } 50% { transform: translateX(60px); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { .layers polyline, .nozzle, .cube-spin { animation: none; opacity: 1; } }
@media (max-width: 820px) { .hero-inner { grid-template-columns: 1fr; } .hero-art { order: -1; } .cube { width: 200px; } }

/* ============================================================ sections */
.section { padding: clamp(56px, 8vw, 96px) 0; }
.section-alt { background: var(--bg-alt); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head h2 { margin: 0; }
.search { position: relative; display: block; width: min(320px, 100%); }
.search svg { position: absolute; left: 13px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input { padding-left: 40px !important; border-radius: 999px !important; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 26px; }
.chip {
  padding: 7px 15px; border-radius: 999px; border: 1.5px solid var(--line);
  background: transparent; cursor: pointer; font-size: 0.88rem; font-weight: 500;
}
.chip:hover { border-color: var(--text); }
.chip[aria-selected='true'] { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ============================================================ product grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 22px; }
.card {
  display: flex; flex-direction: column; text-align: left; padding: 0; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  cursor: pointer; transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: transparent; }
.card-media { position: relative; aspect-ratio: 1; background: var(--bg-alt); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.card:hover .card-media img { transform: scale(1.04); }
.card-placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); }
.card-placeholder svg { width: 64px; height: 64px; opacity: 0.5; }
.badges { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.badge { padding: 3px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); }
.badge-accent { background: var(--accent); color: var(--accent-ink); }
.badge-muted { background: var(--text); color: var(--bg); }
.card-body { padding: 14px 16px 18px; display: grid; gap: 4px; }
.card-cat { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 600; }
.card-title { font: 600 1.08rem/1.25 var(--font-display); }
.card-price { font-weight: 600; color: var(--accent); }
.skeleton { aspect-ratio: 0.8; border-radius: var(--radius); background: linear-gradient(90deg, var(--bg-alt), var(--surface), var(--bg-alt)); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ============================================================ about & contacts */
.about { max-width: 820px; }
.about > p { font-size: 1.1rem; color: var(--muted); white-space: pre-line; }
.steps { list-style: none; padding: 0; margin: 32px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 4px; }
.steps strong { font-family: var(--font-display); }
.steps span { color: var(--muted); font-size: 0.93rem; }
.contacts > p { color: var(--muted); }
.contact-list { list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-wrap: wrap; gap: 12px; }
.contact-list a, .contact-list span {
  display: inline-flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 999px;
  border: 1.5px solid var(--line); text-decoration: none; font-weight: 500; background: var(--surface);
}
.contact-list a:hover { border-color: var(--accent); }
.contact-list svg { width: 18px; height: 18px; fill: currentColor; }

/* ============================================================ footer */
.site-footer { border-top: 1px solid var(--line); padding: 26px 0; color: var(--muted); font-size: 0.88rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer-admin { text-decoration: none; opacity: 0.7; }
.footer-admin:hover { opacity: 1; }

/* ============================================================ product dialog */
dialog { color: var(--text); }
.product-dialog {
  width: min(1040px, 100% - 24px); max-height: calc(100dvh - 24px); padding: 0;
  border: none; border-radius: 20px; background: var(--surface); box-shadow: 0 30px 80px rgb(0 0 0 / 0.35);
}
.product-dialog::backdrop, .admin-dialog::backdrop { background: rgb(10 10 10 / 0.55); backdrop-filter: blur(3px); }
.dialog-close {
  position: absolute; top: 12px; right: 12px; z-index: 2; width: 38px; height: 38px; border-radius: 50%;
  border: none; background: var(--bg-alt); font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.dialog-close:hover { background: var(--line); }
.pd-layout { display: grid; grid-template-columns: 1.1fr 1fr; }
.pd-media { padding: 20px; background: var(--bg-alt); display: grid; gap: 12px; align-content: start; }
.pd-stage { aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface); display: grid; place-items: center; }
.pd-stage img { width: 100%; height: 100%; object-fit: contain; }
.pd-stage model-viewer { width: 100%; height: 100%; --poster-color: transparent; }
.pd-thumbs { display: flex; gap: 8px; overflow-x: auto; }
.pd-thumbs button { flex: 0 0 64px; height: 64px; padding: 0; border-radius: 8px; overflow: hidden; border: 2px solid transparent; cursor: pointer; background: var(--surface); }
.pd-thumbs button[aria-current='true'] { border-color: var(--accent); }
.pd-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.pd-info { padding: 28px 28px 24px; overflow-y: auto; max-height: calc(100dvh - 24px); }
.pd-category { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.pd-price { font: 600 1.4rem var(--font-display); color: var(--accent); }
.pd-desc { color: var(--muted); white-space: pre-line; }
.pd-specs { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 18px 0; font-size: 0.92rem; }
.pd-specs dt { color: var(--muted); }
.pd-specs dd { margin: 0; font-weight: 500; }
.order-form { display: grid; gap: 12px; margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); }
.order-form h3 { margin: 0; }
.order-form .row { display: grid; grid-template-columns: 1fr 100px; gap: 12px; }
.note { font-size: 0.83rem; color: var(--muted); margin: 0; }
.form-status { margin: 0; font-size: 0.9rem; font-weight: 500; min-height: 1.4em; }
.form-status.ok { color: var(--ok); }
.form-status.err { color: var(--danger); }
.unavailable { margin-top: 20px; padding: 12px 16px; border-radius: 10px; background: var(--bg-alt); color: var(--muted); font-weight: 500; }
@media (max-width: 760px) {
  .pd-layout { grid-template-columns: 1fr; }
  .product-dialog { overflow-y: auto; }
  .pd-info { max-height: none; overflow: visible; padding: 22px 18px; }
  .pd-media { padding: 14px; }
}
