/* BitsMag — storefront shell */
:root {
  --bg0: #e8eef2;
  --bg1: #f7fafb;
  --ink: #0b1320;
  --ink-soft: #3a4658;
  --line: rgba(11, 19, 32, 0.12);
  --accent: #0f8b7a;
  --accent-hot: #d97706;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 12px 40px rgba(11, 19, 32, 0.06);
  --radius: 14px;
  --font-display: "Syne", "Avenir Next", sans-serif;
  --font-body: "Manrope", "Segoe UI", sans-serif;
  --max: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(15, 139, 122, 0.18), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(217, 119, 6, 0.12), transparent 50%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
  background-attachment: fixed;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(11,19,32,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11,19,32,.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
  z-index: 0;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }

.bm-wrap { position: relative; z-index: 1; }

/* Top bar */
.bm-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem 1.25rem 0.5rem;
}
.bm-brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.55rem, 3.5vw, 2.15rem);
  letter-spacing: -0.04em;
  color: var(--ink);
  text-decoration: none;
  line-height: 1;
}
.bm-brand span { color: var(--accent); }
.bm-nav { display: flex; gap: 0.85rem; flex-wrap: wrap; align-items: center; }
.bm-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  position: relative;
}
.bm-nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 100%; bottom: -4px; height: 2px;
  background: var(--accent);
  transition: right .25s ease;
}
.bm-nav a:hover::after,
.bm-nav a.is-active::after { right: 0; }
.bm-nav a:hover { color: var(--ink); }

/* Hero band — brand first */
.bm-hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.25rem 1.25rem 1.5rem;
  animation: bm-rise .55s ease both;
}
.bm-hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  letter-spacing: -0.045em;
  line-height: 0.95;
  font-weight: 800;
}
.bm-hero h1 em {
  font-style: normal;
  color: var(--accent);
}
.bm-hero p {
  margin: 0.75rem 0 0;
  max-width: 36rem;
  color: var(--ink-soft);
  font-size: 1.05rem;
}
.bm-hero-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1.1rem;
}

.bm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}
.bm-btn:hover { background: #162033; color: #fff; transform: translateY(-1px); }
.bm-btn--ghost {
  background: transparent;
  color: var(--ink);
}
.bm-btn--ghost:hover { background: rgba(11,19,32,.05); color: var(--ink); }
.bm-btn--accent {
  background: var(--accent);
  border-color: var(--accent);
}
.bm-btn--accent:hover { background: #0c7466; border-color: #0c7466; color: #fff; }

/* Layout */
.bm-shell {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
  display: grid;
  gap: 1.25rem;
}
@media (min-width: 960px) {
  .bm-shell--shop { grid-template-columns: 280px minmax(0, 1fr); align-items: start; }
}

.bm-panel {
  background: var(--surface);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}
.bm-panel h2 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.bm-panel h3 {
  margin: 1.1rem 0 0.45rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  font-weight: 700;
}

.bm-field { display: grid; gap: 0.3rem; margin: 0.45rem 0; }
.bm-field > span { font-size: 0.82rem; font-weight: 650; color: var(--ink-soft); }
.bm-field input,
.bm-field select,
.bm-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface-solid);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  color: var(--ink);
}
.bm-field input:focus,
.bm-field select:focus,
.bm-field textarea:focus {
  outline: 2px solid rgba(15, 139, 122, 0.35);
  border-color: var(--accent);
}
.bm-hint { font-size: 0.82rem; color: var(--ink-soft); margin: 0.35rem 0 0.6rem; }
.bm-filters-actions { display: grid; gap: 0.45rem; margin-top: 0.75rem; }

/* Mobile filters */
.bm-filters-toggle {
  display: none;
  width: 100%;
  margin-bottom: 0.5rem;
}
@media (max-width: 959px) {
  .bm-filters-toggle { display: inline-flex; }
  .bm-filters { display: none; }
  .bm-filters.is-open { display: block; animation: bm-rise .3s ease both; }
}

/* Toolbar / chips */
.bm-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 0.85rem;
}
.bm-count { font-weight: 700; }
.bm-count strong { font-family: var(--font-display); font-size: 1.2rem; }
.bm-pager { display: flex; gap: 0.35rem; flex-wrap: wrap; align-items: center; }
.bm-pager a, .bm-pager strong {
  min-width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-solid);
  text-decoration: none;
  color: var(--ink);
  font-weight: 650;
  font-size: 0.9rem;
}
.bm-pager strong { background: var(--ink); color: #fff; border-color: var(--ink); }

.bm-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.85rem; }
.bm-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  padding: 0.25rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 650;
}
.bm-chip a { color: #9be7db; text-decoration: none; font-size: 1rem; line-height: 1; }

/* Product grid — interaction tiles */
.bm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.9rem;
}
.bm-product {
  display: flex;
  flex-direction: column;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
  animation: bm-rise .5s ease both;
}
.bm-product:nth-child(2) { animation-delay: .04s; }
.bm-product:nth-child(3) { animation-delay: .08s; }
.bm-product:nth-child(4) { animation-delay: .12s; }
.bm-product:hover {
  transform: translateY(-3px);
  border-color: rgba(15, 139, 122, 0.45);
  box-shadow: 0 16px 36px rgba(11, 19, 32, 0.08);
}
.bm-product__media {
  display: block;
  background:
    linear-gradient(160deg, #f4f7f8, #e7eef0);
  aspect-ratio: 4 / 3;
  padding: 0.85rem;
}
.bm-product__media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.bm-product__body { padding: 0.85rem 0.9rem 1rem; display: flex; flex-direction: column; gap: 0.35rem; flex: 1; }
.bm-product__meta { font-size: 0.75rem; color: var(--ink-soft); font-weight: 650; letter-spacing: 0.02em; }
.bm-product__title {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.3;
  font-weight: 700;
}
.bm-product__title a { color: var(--ink); text-decoration: none; }
.bm-product__title a:hover { color: var(--accent); }
.bm-product__price {
  margin-top: auto;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.bm-product__price small { font-family: var(--font-body); font-weight: 600; font-size: 0.72rem; color: var(--ink-soft); }
.bm-product__actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
  font-size: 0.85rem;
  font-weight: 700;
}
.bm-product__actions a { text-decoration: none; }
.bm-empty {
  grid-column: 1 / -1;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--ink-soft);
}

/* Product detail */
.bm-detail {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
  display: grid;
  gap: 1.25rem;
  animation: bm-rise .45s ease both;
}
@media (min-width: 860px) {
  .bm-detail { grid-template-columns: 1fr 1.15fr; }
}
.bm-detail__media {
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  min-height: 280px;
  display: grid;
  place-items: center;
}
.bm-detail__media img { max-height: 360px; object-fit: contain; }
.bm-detail h1 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.5vw, 2.3rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.bm-detail__price {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  margin: 0.75rem 0;
}
.bm-specs {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  background: var(--surface-solid);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
}
.bm-specs th, .bm-specs td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 0.92rem;
}
.bm-specs th {
  width: 38%;
  background: rgba(15, 139, 122, 0.06);
  font-weight: 700;
  color: var(--ink-soft);
}

/* Shop forms / cart */
.bm-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
  animation: bm-rise .4s ease both;
}
.bm-page h1 {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
}
.bm-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.bm-table th, .bm-table td {
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 0.92rem;
}
.bm-table th { background: rgba(11,19,32,.04); font-size: 0.78rem; text-transform: uppercase; letter-spacing: .06em; }

.bm-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--bm-st-c, #374151);
  background: var(--bm-st-bg, #f3f4f6);
  white-space: nowrap;
}
.bm-status strong {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  opacity: 0.9;
}
.bm-status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1rem;
  align-items: center;
}
.bm-status-filter {
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.1rem;
}
.bm-status-filter.is-active {
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}
.bm-status-form {
  margin: 0;
}
.bm-status-form select {
  font: inherit;
  font-size: 0.82rem;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  max-width: 11rem;
}
.bm-form { display: grid; gap: 0.65rem; max-width: 440px; }
.bm-form-section {
  font-family: var(--font-display);
  font-size: 1rem;
  margin: 0.85rem 0 0.15rem;
  color: var(--ink);
}
.bm-form fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  background: var(--surface-solid);
}
.bm-alert {
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  border: 1px solid #f1b0b0;
  background: #fff1f1;
  color: #7f1d1d;
  margin-bottom: 1rem;
}

.bm-impersonate {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  background: #fef3c7;
  color: #78350f;
  border-bottom: 1px solid #f59e0b;
  font-size: 0.9rem;
  font-weight: 600;
}
.bm-impersonate .bm-btn {
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  border-color: #b45309;
  color: #78350f;
  background: #fffbeb;
}

/* Admin tabs */
.bm-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 1rem 0 0;
}
.bm-tab {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  background: rgba(255,255,255,.45);
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.88rem;
}
.bm-tab:hover { color: var(--ink); background: #fff; }
.bm-tab.is-active {
  background: var(--surface-solid);
  color: var(--ink);
  border-color: var(--line);
  position: relative;
  z-index: 1;
}

/* Footer */
.bm-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2.5rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
  border-top: 1px solid var(--line);
}
.bm-footer strong { color: var(--ink); font-family: var(--font-display); }
.bm-footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.25rem 1.75rem;
}
.bm-footer-heading {
  font-family: var(--font-display);
  color: var(--ink);
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.bm-footer-tag { margin-top: 0.35rem; }
.bm-footer-company {
  list-style: none;
  margin: 0.65rem 0 0;
  padding: 0;
  line-height: 1.45;
}
.bm-footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.bm-footer-links a {
  color: var(--ink-soft);
  text-decoration: none;
}
.bm-footer-links a:hover { color: var(--accent); }
.bm-footer-badges {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.bm-footer-badge-link {
  display: inline-block;
  line-height: 0;
}
.bm-footer-badge-link:hover img {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.bm-footer-badges img {
  max-width: 140px;
  height: auto;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
  padding: 0.25rem;
}
.bm-cms-body {
  line-height: 1.55;
  max-width: 42rem;
}
.bm-cms-body p { margin: 0 0 0.85rem; }

/* Home modules */
.bm-home-block {
  max-width: var(--max);
  margin: 0 auto 1.25rem;
  padding: 0 1.25rem;
  animation: bm-rise .45s ease both;
}
.bm-home-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  align-items: baseline;
  margin-bottom: 0.75rem;
}
.bm-home-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}
.bm-home-head p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}
.bm-cat-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.65rem;
}
.bm-cat-tile {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.85rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  transition: border-color .15s ease, transform .15s ease;
}
.bm-cat-tile:hover {
  border-color: rgba(15, 139, 122, 0.5);
  transform: translateY(-2px);
  color: var(--ink);
}
.bm-cat-tile strong { font-family: var(--font-display); letter-spacing: -0.02em; }
.bm-cat-tile span { font-size: 0.78rem; color: var(--ink-soft); font-weight: 650; }

.bm-grid--home { margin-top: 0.25rem; }

.bm-slider {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.5rem;
  align-items: center;
}
.bm-slider__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(200px, 240px);
  gap: 0.75rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 0.25rem 0.15rem 0.6rem;
  -webkit-overflow-scrolling: touch;
}
.bm-slider__item { scroll-snap-align: start; }
.bm-slider__btn {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-solid);
  color: var(--ink);
  font-size: 1.35rem;
  cursor: pointer;
  line-height: 1;
}
.bm-slider__btn:hover { border-color: var(--accent); color: var(--accent); }
.bm-product--compact .bm-product__title { font-size: 0.9rem; }
@media (max-width: 700px) {
  .bm-slider__btn { display: none; }
  .bm-slider { grid-template-columns: 1fr; }
}

@keyframes bm-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

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