/* ==========================================================================
   KACÉR LAYOUT SYSTEM & BASE STYLES (layout.css)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS RESET & NORMALIZE
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family-body);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-normal);
  color: var(--color-text-main);
  background-color: var(--color-bg-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.has-modal-open {
  overflow: hidden;
}

img,
svg,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
}

button {
  cursor: pointer;
}

ul,
ol {
  list-style: none;
}

table {
  border-collapse: collapse;
  width: 100%;
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   2. TYPOGRAPHY DEFAULTS
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-display);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--color-secondary);
}

h1 {
  font-size: clamp(2rem, 4vw + 1rem, var(--font-size-4xl));
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.75rem, 3vw + 0.5rem, var(--font-size-3xl));
  letter-spacing: -0.01em;
}

h3 {
  font-size: clamp(1.25rem, 2vw + 0.5rem, var(--font-size-2xl));
}

h4 {
  font-family: var(--font-family-body);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
}

p {
  margin-bottom: var(--space-4);
}

p:last-child {
  margin-bottom: 0;
}

.text-muted {
  color: var(--color-text-muted);
}

.text-accent {
  color: var(--color-primary);
}

.text-italic {
  font-style: italic;
}

/* --------------------------------------------------------------------------
   3. CONTAINER & GRID SYSTEM
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

.container--narrow {
  max-width: 760px;
}

.container--wide {
  max-width: 1400px;
}

.site-main {
  flex: 1 0 auto;
}

/* Generic Flex & Grid Helpers */
.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-wrap {
  flex-wrap: wrap;
}

.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.grid {
  display: grid;
  gap: var(--space-4);
}

@media (min-width: 768px) {
  .grid {
    gap: var(--space-6);
  }
}

.grid-cols-2 {
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.grid-cols-3 {
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .grid-cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 992px) {
  .grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.grid-cols-4 {
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 768px) {
  .grid-cols-4 {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 992px) {
  .grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

.grid-12 {
  grid-template-columns: 1fr;
}
@media (min-width: 992px) {
  .grid-12 {
    grid-template-columns: repeat(12, 1fr);
    gap: var(--space-6);
  }
}

/* --------------------------------------------------------------------------
   4. SECTION WRAPPERS & HEADERS
   -------------------------------------------------------------------------- */
.section {
  padding-top: var(--space-12);
  padding-bottom: var(--space-12);
  position: relative;
}

@media (min-width: 992px) {
  .section {
    padding-top: var(--space-16);
    padding-bottom: var(--space-16);
  }
}

.section--sm {
  padding-top: var(--space-6);
  padding-bottom: var(--space-6);
}

@media (min-width: 992px) {
  .section--sm {
    padding-top: var(--space-8);
    padding-bottom: var(--space-8);
  }
}

.section--subtle {
  background-color: var(--color-bg-subtle);
}

.section--surface {
  background-color: var(--color-bg-surface);
}

.section-header {
  margin-bottom: var(--space-8);
}

.section-header--center {
  text-align: center;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

.section-header__tag {
  display: inline-block;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-primary);
  margin-bottom: var(--space-2);
}

.section-header__title {
  margin-bottom: var(--space-3);
}

.section-header__desc {
  font-size: var(--font-size-lg);
  color: var(--color-text-muted);
}

/* --------------------------------------------------------------------------
   5. SPECIFIC PAGE LAYOUTS
   -------------------------------------------------------------------------- */

/* Hero Section */
.hero {
  padding-top: var(--space-8);
  padding-bottom: var(--space-12);
  overflow: hidden;
}

@media (min-width: 992px) {
  .hero {
    padding-top: var(--space-12);
    padding-bottom: var(--space-16);
  }
}

.hero__inner {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: var(--space-8);
}

@media (min-width: 992px) {
  .hero__inner {
    grid-template-columns: 1.1fr 1fr;
    gap: var(--space-12);
  }
}

.hero__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.hero__badge {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background-color: var(--color-primary-soft);
  color: var(--color-primary);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
}

.hero__title {
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  line-height: 1.12;
  color: var(--color-secondary);
}

.hero__title span {
  color: var(--color-primary);
  font-style: italic;
}

.hero__desc {
  font-size: var(--font-size-lg);
  color: var(--color-text-muted);
  max-width: 540px;
  line-height: 1.6;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.hero__media {
  position: relative;
  width: 100%;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background-color: var(--color-bg-subtle);
  aspect-ratio: 4 / 3;
}

.hero__media img,
.hero__media .img-placeholder {
  display: block;
  width: 100%;
  min-width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Category Grid (Mozaik) */
.category-mosaic {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

@media (min-width: 768px) {
  .category-mosaic {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-6);
  }
}

@media (min-width: 992px) {
  .category-mosaic {
    grid-template-columns: repeat(6, 1fr);
  }
}

.category-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background-color: var(--color-bg-surface);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  aspect-ratio: 1 / 1;
}

.category-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.category-card__media {
  width: 100%;
  height: 100%;
  position: relative;
}

.category-card__media img,
.category-card__media .img-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.category-card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(61, 30, 53, 0.05) 40%, rgba(61, 30, 53, 0.8) 100%);
  display: flex;
  align-items: flex-end;
  padding: var(--space-4);
}

.category-card__title {
  color: #FFFFFF;
  font-family: var(--font-family-body);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  margin: 0;
}

/* Catalog (Katalógus) Layout */
.catalog-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
}

@media (min-width: 992px) {
  .catalog-layout {
    grid-template-columns: 280px 1fr;
    gap: var(--space-8);
  }
}

.catalog-sidebar {
  background-color: var(--color-bg-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  border: 1px solid var(--color-border);
  height: fit-content;
}

@media (min-width: 992px) {
  .catalog-sidebar {
    position: sticky;
    top: calc(70px + var(--space-4));
  }
}

.catalog-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.catalog-toolbar__count {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.catalog-toolbar__sort {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Product Detail Page (PDP) Layout */
.pdp-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
  align-items: start;
}

@media (min-width: 992px) {
  .pdp-layout {
    grid-template-columns: 1.1fr 1fr;
    gap: var(--space-12);
  }
}

.pdp-gallery {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.pdp-gallery__main {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background-color: var(--color-bg-surface);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border-subtle);
}

.pdp-gallery__main img,
.pdp-gallery__main .img-placeholder {
  display: block;
  width: 100%;
  min-width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.pdp-gallery__thumbs {
  display: flex;
  gap: var(--space-3);
  overflow-x: auto;
  padding-bottom: var(--space-2);
}

.pdp-gallery__thumb {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  background-color: var(--color-bg-surface);
  transition: border-color var(--transition-fast);
}

.pdp-gallery__thumb.is-active,
.pdp-gallery__thumb:hover {
  border-color: var(--color-primary);
}

.pdp-gallery__thumb img,
.pdp-gallery__thumb .img-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pdp-summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

@media (min-width: 992px) {
  .pdp-summary {
    position: sticky;
    top: calc(70px + var(--space-4));
  }
}

/* Cart & Checkout Layout */
.cart-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
  align-items: start;
}

@media (min-width: 992px) {
  .cart-layout {
    grid-template-columns: 1fr 380px;
  }
}

.cart-items-table {
  width: 100%;
  background-color: var(--color-bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.cart-summary-box {
  background-color: var(--color-bg-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

@media (min-width: 992px) {
  .cart-summary-box {
    position: sticky;
    top: calc(70px + var(--space-4));
  }
}

/* Legal & Documentation Layout */
.legal-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
}

@media (min-width: 992px) {
  .legal-layout {
    grid-template-columns: 260px 1fr;
  }
}

.legal-nav {
  background-color: var(--color-bg-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  border: 1px solid var(--color-border);
  height: fit-content;
}

@media (min-width: 992px) {
  .legal-nav {
    position: sticky;
    top: calc(70px + var(--space-4));
  }
}

.legal-content {
  background-color: var(--color-bg-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  border: 1px solid var(--color-border);
  line-height: var(--line-height-loose);
}

.legal-content h2 {
  margin-top: var(--space-8);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border-subtle);
}

.legal-content h3 {
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
}

.breadcrumbs a:hover {
  color: var(--color-primary);
}

.breadcrumbs__sep {
  opacity: 0.5;
}

/* --------------------------------------------------------------------------
   6. ACCESSIBILITY & UTILITIES
   -------------------------------------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: var(--space-2) !important; }
.mb-4 { margin-bottom: var(--space-4) !important; }
.mb-6 { margin-bottom: var(--space-6) !important; }
.mb-8 { margin-bottom: var(--space-8) !important; }

.mt-4 { margin-top: var(--space-4) !important; }
.mt-6 { margin-top: var(--space-6) !important; }
.mt-8 { margin-top: var(--space-8) !important; }

.w-full { width: 100%; }
