:root {
  --primary: #4f46e5;
  --primary-hover: #6d5efb;
  --text: #111827;
  --muted: #6b7280;
  --light: #f9fafb;
  --surface: #ffffff;
  --surface-muted: #f3f4f6;
  --border: #e5e7eb;
  --glass: rgba(255, 255, 255, 0.75);
  --radius: 14px;
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.12);
  --transition: 0.35s cubic-bezier(.22, 1, .36, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--light);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

body.menu-open,
body.modal-open {
  overflow: hidden;
}

body.catalog-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-content {
  flex: 1 0 auto;
}

body.catalog-page footer {
  margin-top: auto;
}

img {
  display: block;
  max-width: 100%;
}

a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 4px;
}

/* HEADER */

header {
  position: fixed;
  inset: 0 0 auto 0;
  backdrop-filter: blur(18px);
  background: var(--glass);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  z-index: 1000;
}

nav {
  max-width: 1200px;
  min-height: 72px;
  margin: auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.logo {
  font-weight: 700;
  font-size: 1.4rem;
  text-decoration: none;
  color: var(--primary);
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 2.5rem;
  list-style: none;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

.nav-links a {
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  position: relative;
  white-space: nowrap;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: width var(--transition);
}

.nav-links a:hover::after {
  width: 100%;
}

.nav-icons {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cta-button,
.nav-contact {
  padding: 0.75rem 1.1rem;
  border: none;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}

.cta-button:hover,
.nav-contact:hover {
  background: var(--primary-hover);
}

.cta-button.nav-contact,
.nav-contact {
  margin-top: 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* BURGER */

.hamburger {
  display: none;
  width: 42px;
  height: 42px;
  position: relative;
  border: none;
  background: transparent;
  cursor: pointer;
  margin: 0;
}

.hamburger span {
  position: absolute;
  left: 10px;
  right: 10px;
  height: 2px;
  background: var(--text);
  transition: var(--transition);
}

.hamburger span:nth-child(1) {
  top: 14px;
}

.hamburger span:nth-child(2) {
  top: 20px;
}

.hamburger span:nth-child(3) {
  top: 26px;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg);
  top: 20px;
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg);
  top: 20px;
}

/* MOBILE MENU */

.mobile-menu {
  position: fixed;
  inset: 0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-100%);
  transition: transform 0.6s cubic-bezier(.22, 1, .36, 1);
  z-index: 999;
}

.mobile-menu.active {
  transform: translateY(0);
}

.mobile-menu ul {
  list-style: none;
  text-align: center;
}

.mobile-menu li {
  margin: 1.5rem 0;
}

.mobile-menu a {
  font-size: 1.8rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
}

/* HERO */

.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 1.5rem;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  position: relative;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.hero-scroll {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: white;
  font-size: 1rem;
  opacity: 0.9;
}

.hero-scroll span {
  margin-bottom: 6px;
}

.arrow {
  width: 28px;
  height: 28px;
  border-left: 3px solid white;
  border-bottom: 3px solid white;
  transform: rotate(-45deg);
  animation: arrowMove 1.8s infinite;
}

@keyframes arrowMove {
  0% {
    transform: rotate(-45deg) translate(0, 0);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: rotate(-45deg) translate(-6px, 6px);
    opacity: 0;
  }
}

/* CONTENT */

.section {
  max-width: 1100px;
  margin: auto;
  padding: 6rem 1.5rem;
}

.section h2 {
  font-size: 2rem;
  margin-bottom: 2rem;
}

.page-title {
  text-align: center;
  margin-bottom: 2rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.indented_list {
  margin-left: 20px;
}

.spaced_text > * + * {
  margin-top: 20px;
}

.aligned_text {
  text-align: justify;
  text-align-last: left;
  hyphens: auto;
}

.about-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 3rem;
  align-items: start;
}

.about-images {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 1rem;
  height: 100%;
}

.about-images img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

footer {
  background: #111827;
  color: white;
  text-align: center;
  padding: 3rem 1rem;
}

/* TO TOP */

.to-top {
  position: fixed;
  right: 25px;
  bottom: 25px;
  width: 60px;
  height: 60px;
  border: none;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 1.4rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}

.to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

/* LOADING */

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.loading-overlay.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* CATALOG */

.catalog-container {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.catalog-sidebar {
  width: 250px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding-top: 2rem;
}

.sidebar-toggle {
  display: none;
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 1rem;
}

.catalog-content {
  flex: 1 1 auto;
  min-width: 0;
}

.catalog-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.page-size-control {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-left: auto;
  font-weight: 600;
}

.catalog-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.catalog-status-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.catalog-summary {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.catalog-error {
  color: #b91c1c;
  font-size: 0.95rem;
  font-weight: 600;
}

.page-size-select {
  min-width: 84px;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid #d1d5db;
  background: #fff;
  font-size: 1rem;
}

.search-input {
  flex: 1 1 220px;
  min-width: 220px;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid #d1d5db;
  font-size: 1rem;
  background: #fff;
}

.filter-btn,
.view-toggle-btn,
.apply-btn,
.reset-btn {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.filter-btn {
  border: none;
  background: var(--primary);
  color: #fff;
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--primary-hover);
}

.view-toggle-btn {
  border: none;
  background: #111827;
  color: #fff;
}

.view-toggle-btn:hover,
.view-toggle-btn:focus-visible {
  background: #1f2937;
}

.view-toggle-btn.active {
  background: var(--primary);
  color: #fff;
}

.filter-panel-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.apply-btn {
  border: none;
  background: var(--primary);
  color: #fff;
}

.apply-btn:hover {
  background: var(--primary-hover);
}

.reset-btn {
  border: 1px solid var(--primary);
  background: transparent;
  color: var(--primary);
}

.reset-btn:hover {
  background: rgba(79, 70, 229, 0.05);
}

#productList {
  width: 100%;
  margin-top: 2rem;
}

#productList.grid-view,
.product-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

#productList.list-view {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#productList.is-loading {
  pointer-events: none;
}

.product-card {
  width: 100%;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.product-card img {
  width: 100%;
  height: 160px;
  object-fit: contain;
  margin-bottom: 1rem;
}

.product-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text);
}

.product-meta {
  margin-bottom: 0.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.product-card .price {
  font-weight: 600;
  color: var(--primary);
}

.product-card-skeleton {
  pointer-events: none;
  align-items: stretch;
  gap: 0.9rem;
}

.skeleton-box {
  display: block;
  width: 100%;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(226, 232, 240, 0.9) 25%, rgba(241, 245, 249, 1) 50%, rgba(226, 232, 240, 0.9) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

.skeleton-image {
  aspect-ratio: 4 / 3;
  min-height: 160px;
}

.skeleton-title {
  height: 1.2rem;
  width: 78%;
}

.skeleton-meta {
  height: 1rem;
  width: 56%;
}

.skeleton-price {
  height: 1.1rem;
  width: 42%;
  margin-top: 0.2rem;
}

#productList.list-view .product-card {
  width: 100%;
  max-width: none;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  padding: 1rem 1.25rem;
  gap: 1rem;
}

#productList.list-view .product-card img {
  display: none;
}

#productList.list-view .product-card h3 {
  flex: 1 1 auto;
  margin: 0;
  font-size: 1rem;
}

#productList.list-view .product-card .price {
  margin: 0;
  flex: 0 0 auto;
  white-space: nowrap;
}

.catalog-empty {
  padding: 2rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #f9fafb;
  text-align: center;
}

.catalog-empty-error {
  border-color: rgba(185, 28, 28, 0.2);
  background: rgba(254, 242, 242, 0.9);
}

/* CATEGORY TREE */

.category-tree {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.category-item {
  margin-bottom: 0.25rem;
}

.category-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.5rem;
  border-radius: 10px;
  transition: background 0.2s ease, color 0.2s ease;
}

.category-row:hover {
  background: rgba(79, 70, 229, 0.08);
}

.category-toggle {
  width: 1.25rem;
  height: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  border-radius: 6px;
  flex: 0 0 1.25rem;
}

.category-toggle::before {
  content: "▸";
  font-size: 0.8rem;
  line-height: 1;
  transition: transform 0.2s ease;
}

.category-item.expanded > .category-row .category-toggle::before {
  transform: rotate(90deg);
}

.category-toggle.is-placeholder {
  visibility: hidden;
  pointer-events: none;
}

.category-name {
  cursor: pointer;
  display: block;
  flex: 1 1 auto;
  user-select: none;
  color: var(--text);
}

.subcategory-list {
  list-style: none;
  margin-left: 1rem;
  margin-top: 0.2rem;
  display: none;
}

.category-item.expanded > .subcategory-list,
.category-item.all-products.expanded > .subcategory-list {
  display: block;
}

.category-item.active > .category-row {
  background: rgba(79, 70, 229, 0.12);
}

.category-item.active > .category-row .category-name {
  font-weight: 700;
  color: var(--primary);
}

.category-item.all-products > .category-row {
  font-weight: 600;
}

/* FILTER PANEL */

.filter-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  max-width: 100%;
  height: 100%;
  background: white;
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 1500;
}

.filter-panel.active {
  transform: translateX(0);
}

.filter-panel-content {
  padding: 1.5rem;
  position: relative;
  height: 100%;
  overflow-y: auto;
}

.close-filter {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
}

.filter-field {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
}

.filter-field.is-hidden {
  display: none;
}

.filter-field label {
  margin-bottom: 0.25rem;
  font-weight: 500;
}

.filter-field select,
.filter-field input {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid #d1d5db;
  font-size: 1rem;
  background: #fff;
}

/* CONTACT MODAL */

.contact-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 3000;
}

.contact-overlay.active {
  visibility: visible;
  opacity: 1;
}

.overlay-content {
  background: white;
  border-radius: var(--radius);
  max-width: 90%;
  width: 380px;
  box-shadow: var(--shadow-md);
  position: relative;
}

.contact-modal {
  width: min(92vw, 460px);
  padding: 2rem 1.5rem 1.5rem;
}

.contact-modal-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.contact-modal-header h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.6rem;
  line-height: 1.2;
  color: var(--primary);
}

.contact-modal-subtitle {
  color: #4b5563;
  font-size: 0.95rem;
}

.contact-modal-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.contact-modal-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  background: #f9fafb;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.contact-modal-item:hover,
.contact-modal-item:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(79, 70, 229, 0.35);
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.08);
}

.contact-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.contact-value {
  font-size: 1rem;
  font-weight: 600;
}

.close-overlay {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
}

/* DEV BANNER */

.dev-banner {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  background: var(--primary);
  color: white;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-weight: 500;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.dev-banner.is-hiding {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

.dev-banner.is-hidden {
  display: none;
}

.dev-banner .close-banner {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  margin-top: -1.25rem;
  color: white;
}

.close-filter,
.close-overlay,
.close-banner {
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease;
}

.close-filter:hover,
.close-overlay:hover,
.close-banner:hover {
  animation: closeButtonShake 0.4s ease-in-out;
}

.close-filter:focus-visible,
.close-overlay:focus-visible,
.close-banner:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 4px;
}

.close-banner {
  color: #fff;
}

@keyframes closeButtonShake {
  0% { transform: translateX(0); }
  20% { transform: translateX(-1px) rotate(-4deg); }
  40% { transform: translateX(1px) rotate(4deg); }
  60% { transform: translateX(-1px) rotate(-3deg); }
  80% { transform: translateX(1px) rotate(3deg); }
  100% { transform: translateX(0); }
}

.pagination {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.pagination-top {
  margin: 0 0 0 auto;
  justify-content: flex-end;
}

.pagination-btn {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  font-weight: 600;
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-info {
  color: var(--muted);
  font-weight: 600;
}

/* RESPONSIVE */

@media (max-width: 1000px) {
  nav {
    min-height: 68px;
    padding: 0.65rem 1rem;
  }

  .nav-links {
    display: none;
  }

  .hamburger {
    display: block;
  }

  .nav-contact {
    order: -1;
    min-height: 40px;
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
  }
}

@media (max-width: 900px) {
  .about-grid {
    grid-template-columns: 1fr;
  }

  .catalog-container {
    flex-direction: column;
  }

  .catalog-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-top: 1rem;
  }

  .sidebar-toggle {
    display: block;
  }

  .catalog-sidebar .category-tree {
    display: none;
  }

  .catalog-sidebar.expanded .category-tree {
    display: block;
  }

  #productList.grid-view,
  .product-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  .page-size-control {
    margin-left: 0;
  }

  .catalog-status-row {
    align-items: stretch;
  }

  .catalog-summary {
    flex-basis: 100%;
  }

  .pagination-top {
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
  }
}

/* REDUCED MOTION */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0s !important;
    transition-duration: 0s !important;
    animation-iteration-count: 1 !important;
  }
}
