/* ==========================================================================
   CASEKING — BRAND PAGES (/marki and /marka/<slug>)
   --------------------------------------------------------------------------
   One shareable address per brand. The page reuses the approved category-page
   furniture (.ck-cat-body, .ck-cat-toolbar, .product-grid) and only adds the
   pieces it needs: the brand hero, its category chips and the brand index grid.

   Colours come from the approved "Дълбок петрол" palette only (the --ma-*
   tokens in modern-atelier-v2.css). No new colour is introduced here.
   ========================================================================== */

/* --- 1. THE TWO SECTIONS ------------------------------------------------ */

#brand-page-view {
  color: var(--ma-ink);
  background:
    linear-gradient(115deg, rgba(255, 255, 255, .42), transparent 34%),
    linear-gradient(180deg, var(--ma-sage), var(--ma-sage-deep));
}

#brands-page-view {
  color: var(--ma-ink);
  background:
    radial-gradient(circle at 92% 4%, rgba(184, 149, 90, .10), transparent 26%),
    var(--ma-page-bg);
}

/* --- 2. HERO (same light champagne band as a category page) ------------- */

.ck-brand-hero {
  position: relative;
  padding: clamp(22px, 3vw, 34px) 0 clamp(22px, 3vw, 32px);
  border-bottom: 1px solid rgba(18, 62, 68, .12);
  background:
    radial-gradient(circle at 86% -25%, rgba(184, 149, 90, .20), transparent 42%),
    linear-gradient(145deg, #ffffff, var(--ma-porcelain));
}

.ck-brand-hero-row {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 22px);
  min-width: 0;
}

.ck-brand-logo {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: clamp(64px, 8vw, 92px);
  height: clamp(64px, 8vw, 92px);
  padding: clamp(8px, 1.4vw, 14px);
  border: 1px solid rgba(18, 62, 68, .14);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(11, 43, 48, .08);
}

.ck-brand-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ck-brand-title {
  margin: 0 !important;
  color: var(--ma-petrol-deep) !important;
  font-family: 'Manrope', 'Inter', system-ui, sans-serif;
  font-size: clamp(26px, 3.4vw, 40px) !important;
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -.03em;
}

.ck-brand-sub {
  max-width: 70ch;
  margin: 8px 0 0 !important;
  color: var(--ma-muted) !important;
  font-size: 13.5px !important;
  line-height: 1.6 !important;
}

/* --- 3. BREADCRUMBS ----------------------------------------------------- */

.ck-brand-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--ma-muted);
}

.ck-brand-crumbs a {
  color: var(--ma-petrol);
  font-weight: 600;
  text-decoration: none;
}

.ck-brand-crumbs a:hover {
  color: var(--ma-gold);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ck-brand-crumbs a:focus-visible {
  outline: 2px solid var(--ma-gold);
  outline-offset: 2px;
  border-radius: 4px;
}

.ck-brand-crumbs [aria-hidden="true"] {
  color: var(--ma-champagne);
}

.ck-brand-crumbs [aria-current="page"] {
  color: var(--ma-petrol-deep);
  font-weight: 700;
}

/* --- 4. CATEGORY CHIPS -------------------------------------------------- */

.ck-brand-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.ck-brand-chip {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid rgba(18, 62, 68, .18);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ma-petrol);
  font: inherit;
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.2;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.ck-brand-chip:hover {
  border-color: var(--ma-champagne);
  background: var(--ma-sage);
}

.ck-brand-chip[aria-pressed="true"] {
  border-color: var(--ma-petrol);
  background: var(--ma-petrol);
  color: #ffffff;
}

/* The chosen phone's chip reads as a removable filter, not as a choice. */
.ck-brand-chip.is-device {
  border-style: dashed;
  border-color: rgba(134, 105, 47, .45);
  color: var(--ma-gold);
  background: rgba(255, 255, 255, .7);
}

.ck-brand-chip.is-device:hover {
  border-color: var(--ma-gold);
  background: var(--ma-porcelain);
}

.ck-brand-chip:focus-visible {
  outline: 2px solid var(--ma-gold);
  outline-offset: 3px;
}

/* --- 5. THE BRAND INDEX (/marki) ---------------------------------------- */

.ck-brandx-body {
  padding-top: clamp(28px, 3vw, 44px) !important;
  padding-bottom: clamp(48px, 6vw, 88px) !important;
}

.ck-brandx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

.ck-brandx-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 14px 16px;
  border: 1px solid rgba(18, 62, 68, .12);
  border-radius: 16px;
  background: #ffffff;
  text-decoration: none;
  box-shadow: 0 10px 26px rgba(11, 43, 48, .06);
  transition: transform .25s var(--ma-ease, ease), box-shadow .25s ease, border-color .25s ease;
}

.ck-brandx-card:hover {
  transform: translateY(-3px);
  border-color: rgba(184, 149, 90, .55);
  box-shadow: 0 18px 40px rgba(11, 43, 48, .12);
}

.ck-brandx-card:focus-visible {
  outline: 3px solid var(--ma-gold);
  outline-offset: 3px;
}

.ck-brandx-media {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 116px;
  aspect-ratio: 1 / 1;
  padding: 8px;
}

.ck-brandx-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ck-brandx-name {
  color: var(--ma-petrol-deep);
  font-family: 'Manrope', 'Inter', system-ui, sans-serif;
  font-size: 14.5px;
  font-weight: 750;
  line-height: 1.25;
  text-align: center;
}

/* --- 6. THE MAKER NAME ON A PRODUCT PAGE --------------------------------
   Only the text becomes a link: same size, same weight, same place. */

.ck-brand-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(134, 105, 47, .45);
  text-underline-offset: 3px;
}

.ck-brand-link:hover {
  color: inherit;
  text-decoration-color: var(--ma-gold);
}

.ck-brand-link:focus-visible {
  outline: 2px solid var(--ma-gold);
  outline-offset: 2px;
  border-radius: 3px;
}

/* --- 7. RESPONSIVE ------------------------------------------------------ */

@media (max-width: 760px) {
  .ck-brand-hero-row {
    align-items: flex-start;
  }

  .ck-brand-logo {
    border-radius: 14px;
  }

  .ck-brand-chip {
    min-height: 36px;
    padding: 0 12px;
    font-size: 13px;
  }
}

@media (max-width: 600px) {
  .ck-brandx-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .ck-brandx-card {
    padding: 14px 10px 12px;
  }

  .ck-brandx-name {
    font-size: 13.5px;
  }
}

/* --- 8. A BRAND WITHOUT A LOGO (pkg-brand-logos) -------------------------
   The name itself is the mark: uppercase Manrope 800 in petrol, with a thin
   champagne rule under it. No new colour - both tokens are already in
   modern-atelier-v2.css. */

.ck-brandx-media.is-wordmark {
  max-width: none;
  aspect-ratio: auto;
  height: 116px;
  padding: 8px 0;
}

.ck-brandx-media img {
  max-height: 100px;
}

.ck-brandx-wordmark {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  height: 100%;
  color: var(--ma-petrol-deep);
  font-family: 'Manrope', 'Inter', system-ui, sans-serif;
  font-size: var(--wm-size, 22px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: .06em;
  text-align: center;
  text-transform: uppercase;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

.ck-brandx-wordmark::after {
  content: '';
  display: block;
  width: 26px;
  height: 2px;
  border-radius: 2px;
  background: var(--ma-champagne);
}

/* The hero box on /marka/<slug> leaves the row when the brand has no logo of
   its own: the h1 beside it already says the name. The `display: grid` above
   would otherwise beat the [hidden] attribute. */

.ck-brand-logo[hidden] {
  display: none;
}
