/* =========================================================
   StabHub — Extra CSS Layer
   v3.0 | 2024
   Covers:
     • Mobile-first responsive breakpoints
     • WCAG 2.1 AA accessibility (focus rings, contrast)
     • CSS reveal animations (Intersection Observer hooks)
     • Sticky header transitions
     • Back-to-top button
     • Toast notifications
     • Burger menu
     • Trust badges / USP strip
     • Skeleton loading states
     • Print styles
   ========================================================= */

/* ─────────────────────────────────────────────────────────
   RESPONSIVE UTILITIES
───────────────────────────────────────────────────────── */
/* Fluid wrapper override for smaller screens */
@media (max-width: 1020px) {
  .wrapper {
    width: 100%;
    padding-left: 16px;
    padding-right: 16px;
    min-width: 0;
  }
  body { min-width: 0; }
}

/* ─────────────────────────────────────────────────────────
   BREAKPOINT: TABLET  (≤ 768px)
───────────────────────────────────────────────────────── */
@media (max-width: 768px) {

  /* Header layout stack */
  .header-top {
    padding: 12px 16px;
    position: relative;
  }

  .logo { margin: 0; }
  .logo img { height: 46px; }

  .site-title, .site-name { display: none; }

  .header-wrapper {
    float: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
    height: auto;
    margin-top: 8px;
  }

  .header-item {
    height: auto;
    padding: 8px 10px;
    border-right: none;
    border-top: 1px solid var(--color-border-light);
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .header-item.topmenu { display: none; } /* moved to mobile nav */

  .topcontacts { font-size: 13px; }
  .topcontacts .tel { font-size: 16px; margin-top: 4px; }

  .topworktime { display: none; }

  .topcart {
    width: auto;
    padding: 8px 12px;
    border: none;
  }

  .topcart .cart-button a {
    width: auto;
    padding: 7px 14px;
    font-size: 12px;
  }

  /* Burger nav */
  #nav-burger {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    width: 40px;
    height: 40px;
    padding: 9px 8px;
    background: transparent;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
  }

  #nav-burger:hover {
    border-color: var(--color-accent);
    background: rgba(255,200,0,0.08);
  }

  .burger-bar {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--color-text-muted);
    border-radius: 2px;
    transition: var(--transition);
    transform-origin: center;
  }

  #nav-burger.burger--open .burger-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
    background: var(--color-accent);
  }
  #nav-burger.burger--open .burger-bar:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
  }
  #nav-burger.burger--open .burger-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
    background: var(--color-accent);
  }

  /* Nav — full-width mobile overlay */
  .header-nav {
    position: relative;
  }

  #nav {
    display: none; /* hidden by default on mobile */
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-top: 2px solid var(--color-accent);
    border-bottom: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-lg);
    z-index: 500;
    padding: 8px 0 16px;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
  }

  #nav.nav--open { display: flex; }

  .nav-item {
    display: block;
    width: 100%;
  }

  .nav-item > a {
    height: auto;
    line-height: 1.4;
    padding: 12px 20px;
    text-align: left;
    font-size: 13px;
    border-bottom: 1px solid var(--color-border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .nav-item > a::after { display: none; }

  .nav-item > a[aria-haspopup="true"]::after {
    content: '›';
    display: inline-block;
    font-size: 18px;
    color: var(--color-accent);
    margin-left: 8px;
    transition: var(--transition);
  }

  .nav-item > a[aria-expanded="true"]::after {
    transform: rotate(90deg);
  }

  .nav-item .nav-drop {
    position: static;
    width: 100% !important;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: var(--color-bg-2);
    padding: 4px 0;
    margin: 0;
    display: none;
  }

  .nav-item ul.nav-drop > li > a {
    padding: 9px 20px 9px 36px;
    font-size: 12px;
    border-left: none;
  }

  /* Media columns: stack on mobile */
  .media-columns { flex-direction: column; }
  .media-columns .col { float: none; width: 100%; }
  .media-columns .col + .col { margin-left: 0; margin-top: 12px; }

  /* Products grid: 2 columns */
  ul.products-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  ul.products-list > li.product-item { width: 100%; margin: 0; }

  /* Cart: full width */
  .client-info { width: 100%; float: none; }
  .order-info  { width: 100%; float: none; }

  .cart-body { display: flex; flex-direction: column; gap: 16px; }

  /* Product page */
  .prod-media  { float: none; width: 100%; }
  .prod-aside  { float: none; width: 100%; border-left: none; border-top: 1px solid var(--color-border-light); }
  .prod-cart   { padding: 16px; }

  .prod-description .justify-block { display: block; }
  .prod-description .justify-block .col { display: block; width: 100%; }
  .prod-description .justify-block .col.characteristics {
    border-right: none;
    border-bottom: 1px solid var(--color-border-light);
    padding: 16px;
  }
  .prod-description .justify-block .col.description { padding: 16px; }
}

/* ─────────────────────────────────────────────────────────
   BREAKPOINT: PHONE  (≤ 480px)
───────────────────────────────────────────────────────── */
@media (max-width: 480px) {

  ul.products-list {
    grid-template-columns: 1fr;
  }

  .prod-info-content h1.title { font-size: 20px; }
  .prod-price { font-size: 28px; padding: 14px 16px 0; }
  .prod-buttons { padding: 12px 16px; }
  .prod-buttons a { height: 44px; font-size: 13px; }

  .cart-title { font-size: 20px; padding: 14px 18px; }

  .input-holder input,
  .triple-input-holder input { width: 100% !important; }

  .triple-input-holder { display: flex; flex-direction: column; gap: 8px; }

  .client-info .row .col { float: none; width: 100%; }
  .client-info .row .col + .col { margin-left: 0; margin-top: 10px; }

  .col .input-holder input { width: 100% !important; }

  .comments-input { width: 100% !important; }

  .header-item {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ─────────────────────────────────────────────────────────
   BURGER BUTTON – hidden on desktop
───────────────────────────────────────────────────────── */
@media (min-width: 769px) {
  #nav-burger { display: none !important; }
  #nav { display: table !important; }
}

/* ─────────────────────────────────────────────────────────
   STICKY HEADER TRANSITIONS
───────────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1),
              box-shadow 0.25s ease,
              background 0.25s ease;
  will-change: transform;
}

.header--scrolled {
  box-shadow: 0 2px 20px rgba(0,0,0,0.6);
}

.header--hidden {
  transform: translateY(-100%);
}

/* ─────────────────────────────────────────────────────────
   BACK-TO-TOP BUTTON
───────────────────────────────────────────────────────── */
#back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 999;
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 50%;
  background: var(--gradient-accent);
  color: var(--color-black);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.85);
  transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 16px rgba(255,200,0,0.3);
}

#back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

#back-to-top:hover {
  box-shadow: 0 6px 24px rgba(255,200,0,0.5);
  transform: translateY(-2px) scale(1.08);
}

#back-to-top:active { transform: scale(0.96); }

/* ─────────────────────────────────────────────────────────
   REVEAL-ON-SCROLL ANIMATIONS (Intersection Observer)
───────────────────────────────────────────────────────── */
.nv-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.55s cubic-bezier(0.4,0,0.2,1),
              transform 0.55s cubic-bezier(0.4,0,0.2,1);
}

.nv-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger for product grid items */
.products-list .product-item.nv-reveal:nth-child(2) { transition-delay: 0.06s; }
.products-list .product-item.nv-reveal:nth-child(3) { transition-delay: 0.12s; }
.products-list .product-item.nv-reveal:nth-child(4) { transition-delay: 0.18s; }
.products-list .product-item.nv-reveal:nth-child(5) { transition-delay: 0.24s; }
.products-list .product-item.nv-reveal:nth-child(6) { transition-delay: 0.30s; }
.products-list .product-item.nv-reveal:nth-child(7) { transition-delay: 0.36s; }
.products-list .product-item.nv-reveal:nth-child(8) { transition-delay: 0.42s; }

@media (prefers-reduced-motion: reduce) {
  .nv-reveal, .nv-revealed {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ─────────────────────────────────────────────────────────
   WCAG 2.1 AA — FOCUS INDICATORS
   All interactive elements must have a visible focus ring
───────────────────────────────────────────────────────── */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible,
[data-focus-visible] {
  outline: 2px solid var(--color-accent) !important;
  outline-offset: 3px !important;
  border-radius: 4px;
}

/* Remove outline for mouse users, keep for keyboard */
:focus:not(:focus-visible) { outline: none; }

/* ─────────────────────────────────────────────────────────
   TOAST NOTIFICATIONS
───────────────────────────────────────────────────────── */
#nv-toast-container {
  position: fixed;
  bottom: 88px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 340px;
  width: calc(100% - 48px);
}

.nv-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 12px 16px;
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-lg);
  font-family: var(--font-main);
  font-size: 13px;
  color: var(--color-text);
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.4,0,0.2,1);
  line-height: 1.4;
}

.nv-toast--visible {
  opacity: 1;
  transform: translateX(0);
}

.nv-toast__icon {
  font-size: 16px;
  flex-shrink: 0;
  line-height: 1;
}

.nv-toast__close {
  margin-left: auto;
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--color-text-dim);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 0 0 6px;
  transition: color 0.2s;
}

.nv-toast__close:hover { color: var(--color-text); }

.nv-toast--success { border-left: 3px solid var(--color-success); }
.nv-toast--success .nv-toast__icon { color: var(--color-success); }

.nv-toast--error { border-left: 3px solid var(--color-danger); }
.nv-toast--error .nv-toast__icon { color: var(--color-danger); }

.nv-toast--info { border-left: 3px solid var(--color-info); }
.nv-toast--info .nv-toast__icon { color: var(--color-info); }

.nv-toast--warning { border-left: 3px solid var(--color-accent); }
.nv-toast--warning .nv-toast__icon { color: var(--color-accent); }

/* ─────────────────────────────────────────────────────────
   TRUST BADGES / USP STRIP
───────────────────────────────────────────────────────── */
.usp-strip {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border-light);
  border-bottom: 1px solid var(--color-border-light);
  padding: 0;
}

.usp-strip__inner {
  display: flex;
  align-items: stretch;
  max-width: 982px;
  margin: 0 auto;
}

.usp-strip__item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-right: 1px solid var(--color-border-light);
  font-size: 12px;
  color: var(--color-text-muted);
  font-family: var(--font-main);
  transition: var(--transition);
}

.usp-strip__item:last-child { border-right: none; }

.usp-strip__item:hover {
  background: rgba(255,200,0,0.04);
  color: var(--color-text);
}

.usp-strip__icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,200,0,0.1);
  border-radius: 8px;
  color: var(--color-accent);
  font-size: 16px;
}

.usp-strip__text strong {
  display: block;
  color: var(--color-text);
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 1px;
}

@media (max-width: 768px) {
  .usp-strip__inner {
    flex-direction: column;
  }
  .usp-strip__item {
    border-right: none;
    border-bottom: 1px solid var(--color-border-light);
    padding: 12px 16px;
  }
  .usp-strip__item:last-child { border-bottom: none; }
}

/* ─────────────────────────────────────────────────────────
   SKELETON LOADING STATES
───────────────────────────────────────────────────────── */
@keyframes skeleton-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-surface)  25%,
    var(--color-surface-2) 50%,
    var(--color-surface)  75%
  );
  background-size: 800px 100%;
  animation: skeleton-shimmer 1.6s infinite linear;
  border-radius: var(--radius-sm);
}

/* ─────────────────────────────────────────────────────────
   ENHANCED PRODUCT CARD HOVER STATES
───────────────────────────────────────────────────────── */

/* Accent bar on top of card on hover */
ul.products-list > li.product-item::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gradient-accent);
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

ul.products-list > li.product-item:hover::after {
  opacity: 1;
}

/* Price pulse on card hover */
ul.products-list > li.product-item:hover .price {
  animation: price-pop 0.3s cubic-bezier(0.4,0,0.2,1);
}

@keyframes price-pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* ─────────────────────────────────────────────────────────
   ACCESSIBILITY — SKIP LINK
───────────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 9999;
  padding: 10px 20px;
  background: var(--color-accent);
  color: var(--color-black);
  font-weight: 700;
  font-size: 13px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  text-decoration: none;
  transition: top 0.2s;
  font-family: var(--font-heading);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.skip-link:focus {
  top: 0;
  outline: none;
}

/* ─────────────────────────────────────────────────────────
   ENHANCED CTA BUTTON ANIMATION
───────────────────────────────────────────────────────── */

/* Ripple effect on CTA buttons */
.prod-buttons a,
li.product-item .buttons a:not(.notavalible),
#submit_button,
.contacts_btns a {
  position: relative;
  overflow: hidden;
}

.prod-buttons a::before,
li.product-item .buttons a:not(.notavalible)::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 0; height: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  transform: translate(-50%, -50%);
  transition: width 0.5s ease, height 0.5s ease, opacity 0.5s ease;
  opacity: 0;
  pointer-events: none;
}

.prod-buttons a:active::before,
li.product-item .buttons a:not(.notavalible):active::before {
  width: 300px; height: 300px;
  opacity: 1;
  transition: 0s;
}

/* ─────────────────────────────────────────────────────────
   BREADCRUMB (for cat & product pages)
───────────────────────────────────────────────────────── */
.nv-breadcrumb {
  padding: 10px 0 4px;
  font-size: 12px;
  color: var(--color-text-dim);
  font-family: var(--font-main);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.nv-breadcrumb a {
  color: var(--color-text-dim);
  text-decoration: none;
  transition: color 0.2s;
}

.nv-breadcrumb a:hover { color: var(--color-accent); }

.nv-breadcrumb__sep {
  color: var(--color-text-dim);
  font-size: 10px;
}

.nv-breadcrumb__current {
  color: var(--color-text-muted);
  font-weight: 500;
}

/* ─────────────────────────────────────────────────────────
   INPUT ENHANCEMENTS (form fields)
───────────────────────────────────────────────────────── */
.input-holder input::placeholder,
.comments-input::placeholder {
  color: var(--color-text-dim);
  font-size: 12px;
}

/* Floating label pattern (progressive enhancement) */
.form-group {
  position: relative;
  margin-bottom: 18px;
}

/* ─────────────────────────────────────────────────────────
   HIGHLIGHTED PRICES (used in price-list)
───────────────────────────────────────────────────────── */
.price-highlight {
  background: linear-gradient(135deg, rgba(255,200,0,0.12) 0%, rgba(255,200,0,0.05) 100%);
  border: 1px solid rgba(255,200,0,0.2);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  color: var(--color-accent);
  font-weight: 700;
}

/* ─────────────────────────────────────────────────────────
   AVAILABILITY BADGE (product page)
───────────────────────────────────────────────────────── */
.availability-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 20px;
}

.availability-badge--in-stock {
  background: rgba(34,197,94,0.12);
  color: var(--color-success);
  border: 1px solid rgba(34,197,94,0.25);
}

.availability-badge--out-of-stock {
  background: rgba(239,68,68,0.1);
  color: var(--color-danger);
  border: 1px solid rgba(239,68,68,0.2);
}

.availability-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse-dot 1.8s infinite;
}

.availability-badge--out-of-stock::before { animation: none; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.7); }
}

/* ─────────────────────────────────────────────────────────
   PRINT STYLES
───────────────────────────────────────────────────────── */
@media print {
  .header-nav,
  #back-to-top,
  #nv-toast-container,
  .usp-strip,
  .cart-button,
  .buttons,
  #nav-burger {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 12pt;
  }

  a { color: #000; text-decoration: underline; }

  .wrapper { width: 100%; }

  .prod-info-content,
  .cart-content,
  .content-page {
    background: #fff;
    border: none;
    box-shadow: none;
  }
}

/* ─────────────────────────────────────────────────────────
   DARK MODE META (already dark, but ensure system pref)
───────────────────────────────────────────────────────── */
@media (prefers-color-scheme: light) {
  /* Site is intentionally dark — no light-mode override */
  /* If you ever want to add light mode, put overrides here */
}

/* ─────────────────────────────────────────────────────────
   HIGH-CONTRAST MODE (Windows)
───────────────────────────────────────────────────────── */
@media (forced-colors: active) {
  :root {
    --color-accent: Highlight;
    --color-text: ButtonText;
    --color-surface: Canvas;
    --color-border-light: ButtonBorder;
  }

  .nav-item > a,
  li.product-item .buttons a {
    forced-color-adjust: none;
  }
}

/* ─────────────────────────────────────────────────────────
   SUPPLEMENTARY LAYOUT FIXES
───────────────────────────────────────────────────────── */

/* Prevent horizontal overflow on mobile */
html, body { overflow-x: hidden; }

/* Ensure images don't overflow their containers */
img { max-width: 100%; height: auto; }

/* Consistent link colour throughout content pages */
.content-page a,
.prod-description a {
  color: var(--color-accent);
  transition: color 0.2s;
}

.content-page a:hover,
.prod-description a:hover {
  color: var(--color-accent-hover);
}

/* Remove margin from last element in containers */
.content-page > *:last-child,
.prod-description > *:last-child {
  margin-bottom: 0;
}

/* ─────────────────────────────────────────────────────────
   USP STRIP — ANIMATION
───────────────────────────────────────────────────────── */
.usp-strip__item .usp-strip__icon {
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1),
              box-shadow 0.3s ease;
}

.usp-strip__item:hover .usp-strip__icon {
  transform: scale(1.15) rotate(-5deg);
  box-shadow: 0 0 14px rgba(255,200,0,0.3);
}
