/* Homepage CRO, CSS pass. Existing component files remain intact for rollback.
 * Primary: brand yellow + black border. Secondary: white + black border.
 * Inverse: the existing dark hero CTA, used on the yellow hero only.
 * !important is needed to override the site's existing component !important rules.
 * Section backgrounds deliberately inherit the existing staging design.
 */
:root {
  --brand-yellow: #F4BA2B;
  --hero-yellow: #F8D535;
  /* Measured pre-change staging background; preserve until colour is confirmed. */
  --hero-existing-background: #FED421;
}
body.home {
  --gnostis-accent: var(--brand-yellow);
}
body.home .gnostis-sponsor-products {
  --gnostis-accent: var(--brand-yellow) !important;
}

/* Shared primary CTA treatment, including hover without a black fill. */
body.home .gnostis-butikker-block .gnostis-butikker-button,
body.home .gnostis-all-sponsor-categories .gnostis-category-sponsor-button,
body.home .gnostis-product a.gnostis-product-cta,
body.home .gnostis-products-sponsor-cta {
  box-sizing: border-box !important;
  background: var(--brand-yellow) !important;
  color: #000 !important;
  border: 2px solid #000 !important;
  min-height: 44px !important;
  text-decoration: none !important;
  transition: box-shadow .15s ease, text-decoration-color .15s ease !important;
}
body.home .gnostis-butikker-block .gnostis-butikker-button:hover,
body.home .gnostis-all-sponsor-categories .gnostis-category-sponsor-button:hover,
body.home .gnostis-product a.gnostis-product-cta:hover,
body.home .gnostis-products-sponsor-cta:hover {
  background: var(--brand-yellow) !important;
  color: #000 !important;
  box-shadow: inset 0 0 0 1px #000 !important;
  text-decoration: underline !important;
  text-underline-offset: 3px;
}
body.home .bfdk-hero .hero-buttons .has-white-background-color {
  background: #fff !important;
  color: #000 !important;
  border: 2px solid #000 !important;
}
body.home .bfdk-hero .hero-buttons .has-white-background-color:hover {
  box-shadow: inset 0 0 0 1px #000;
  text-decoration: underline !important;
}
/* Inverse variant: keep the existing dark hero fill. */
body.home .bfdk-hero .hero-buttons .has-black-background-color:hover {
  text-decoration: underline !important;
  text-underline-offset: 3px;
}
/* Two-tone focus ring remains visible on light and dark sections. */
body.home .page-wrapper a:focus-visible,
body.home .page-wrapper button:focus-visible {
  outline: 3px solid #000 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 6px #fff !important;
}
body.home .gnostis-all-sponsor-categories .store-label,
body.home .gnostis-all-sponsor-categories .store-label strong {
  color: var(--brand-yellow) !important;
}
body.home .has-luminous-vivid-amber-color {
  color: var(--brand-yellow) !important;
}

/* Product hierarchy. No generated price/savings text: values remain real data. */
body.home .gnostis-product .gnostis-product-price {
  flex-direction: column !important;
  align-items: center !important;
  gap: 4px !important;
  color: #000 !important;
  font-size: 26px !important;
  font-weight: 800 !important;
  line-height: 1.25 !important;
  margin: auto 0 18px !important;
}
body.home .gnostis-product .gnostis-product-price del,
body.home .gnostis-product .gnostis-product-price del * {
  color: #666 !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  opacity: 1 !important;
}
body.home .gnostis-product .gnostis-product-price ins,
body.home .gnostis-product .gnostis-product-price ins * {
  color: #000 !important;
  font-size: inherit !important;
  font-weight: 800 !important;
}
body.home .gnostis-product .gnostis-product-discount {
  left: 12px !important;
  right: auto !important;
}

/* Compact hero, without changing its background colour or artwork. */
body.home .bfdk-hero.front_top {
  background-color: var(--hero-existing-background) !important;
  padding: 24px 0 !important;
  background-size: auto 100%;
  background-position: right max(20px, calc((100vw - 1300px) / 2)) center;
}
body.home .bfdk-hero.front_top::before,
body.home .bfdk-hero.front_top::after {
  content: none !important;
  display: none !important;
}
body.home .bfdk-hero .hero-main-text-wrapper {
  padding-top: 0 !important;
  text-shadow: none !important;
}
body.home .bfdk-hero .hero-content {
  width: 58%;
  max-width: 58%;
  padding-inline: 0;
}
body.home .bfdk-hero .hero-row {
  margin: 0 !important;
}
body.home .bfdk-hero h1 {
  font-size: clamp(32px, 3.2vw, 44px) !important;
  line-height: 1.08 !important;
  margin: 0 0 8px !important;
}
body.home .bfdk-hero .desk-show,
body.home .bfdk-hero .hero-text-info {
  font-size: 16px !important;
  line-height: 1.4 !important;
  margin-top: 0 !important;
  margin-bottom: 8px !important;
}
body.home .bfdk-hero .hero-dynamic-numbers {
  display: none !important; /* Current block is empty; real stats are below. */
}
body.home .bfdk-hero .mobile-hero-lines {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px !important;
  margin: 12px 0 !important;
}
body.home .bfdk-hero .mobile-hero-lines > .wp-block-column {
  min-width: 0;
  margin: 0 !important;
}
body.home .bfdk-hero .mobile-hero-lines .hero-list {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 8px !important;
  height: 100%;
  min-height: 62px;
  padding: 8px !important;
  margin: 0 !important;
}
body.home .bfdk-hero .hero-list .mobile-hero-icon {
  flex: 0 0 26px !important;
  min-width: 0;
}
body.home .bfdk-hero .hero-list .mobile-hero-icon figure,
body.home .bfdk-hero .hero-list .mobile-hero-icon img {
  width: 26px !important;
  height: 26px !important;
  margin: 0 !important;
  object-fit: contain;
}
body.home .bfdk-hero .hero-list .wp-block-column:not(.mobile-hero-icon) {
  flex: 1 1 0 !important;
  min-width: 0;
}
body.home .bfdk-hero .hero-list p {
  margin: 0 !important;
  font-size: 13px !important;
  line-height: 1.3 !important;
}
body.home .bfdk-hero .hero-buttons {
  margin-top: 12px !important;
  margin-bottom: 0 !important;
}
body.home .bfdk-hero .hero-buttons .wp-block-button__link {
  min-height: 44px;
  height: auto;
}

/* Keep five equal merchant slots on desktop, with existing slot order. */
@media (min-width: 1024px) {
  body.home .gnostis-butikker-block .gnostis-butikker-grid,
  body.home .gnostis-all-sponsor-categories .gnostis-category-sponsor-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  }
}
@media (max-width: 767px) {
  body.home .bfdk-hero.front_top {
    padding: 20px 0 !important;
  }
  body.home .bfdk-hero > .container {
    width: calc(100% - 32px) !important;
    padding: 0 !important;
  }
  body.home .bfdk-hero .hero-content {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
  }
  body.home .bfdk-hero .hero-mobile-background-image {
    width: 160px !important;
    right: -28px !important;
    top: 10px !important;
    z-index: 0 !important;
  }
  body.home .bfdk-hero h1 {
    font-size: 32px !important;
    max-width: 70%;
  }
  body.home .bfdk-hero .desk-show,
  body.home .bfdk-hero .hero-text-info {
    max-width: 70%;
    font-size: 15px !important;
  }
  /* Preserve the existing line-break's word boundary, avoiding "tilbudfra". */
  body.home .bfdk-hero .hero-text-info br {
    display: initial !important;
  }
  body.home .bfdk-hero .hero-list {
    flex-direction: column !important;
    justify-content: center;
    text-align: center;
    gap: 4px !important;
    border-radius: 7px;
  }
  body.home .bfdk-hero .hero-list .mobile-hero-icon {
    flex: 0 0 22px !important;
  }
  body.home .bfdk-hero .hero-list .mobile-hero-icon figure,
  body.home .bfdk-hero .hero-list .mobile-hero-icon img {
    width: 22px !important;
    height: 22px !important;
  }
  body.home .bfdk-hero .hero-list p {
    font-size: 12px !important;
  }
  body.home .bfdk-hero .hero-buttons {
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
  }
  body.home .bfdk-hero .hero-buttons .wp-block-button {
    flex: 1 1 0;
    min-width: 0;
    width: auto !important;
  }
  body.home .bfdk-hero .hero-buttons .wp-block-button__link {
    width: 100% !important;
    padding: 12px 8px !important;
    font-size: 14px !important;
  }
  body.home .gnostis-butikker-block {
    padding: 24px 12px !important;
  }
  body.home .gnostis-butikker-block .gnostis-butikker-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }
  body.home .gnostis-butikker-block .gnostis-butikker-logo {
    padding: 16px 10px !important;
    min-height: 156px !important;
    gap: 12px !important;
  }
  body.home .gnostis-butikker-block .gnostis-butikker-logo-media {
    height: 76px !important;
  }
  body.home .gnostis-butikker-block .gnostis-butikker-logo-media img {
    max-height: 64px !important;
  }
  body.home .gnostis-butikker-block .gnostis-butikker-button,
  body.home .gnostis-all-sponsor-categories .gnostis-category-sponsor-button {
    width: 100% !important;
    font-size: 12px !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
    line-height: 1.3 !important;
    padding: 8px 6px !important;
  }
  body.home .gnostis-category-strip .gnostis-category-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px 8px;
  }
  body.home .gnostis-category-strip .gnostis-category-tile {
    min-height: 150px;
    padding: 12px 6px;
    gap: 10px;
    border-radius: 12px;
  }
  body.home .gnostis-category-strip .gnostis-category-icon {
    width: 52px;
    height: 52px;
  }
  body.home .gnostis-category-strip .gnostis-category-icon img {
    max-width: 34px;
    max-height: 34px;
  }
  body.home .gnostis-category-strip .gnostis-category-name {
    font-size: 14px;
    line-height: 1.3;
  }
  body.home .gnostis-category-saving,
  body.home .gnostis-category-flames {
    max-width: 100%;
    padding: 5px 6px;
    font-size: 12px;
    flex-wrap: wrap;
  }
  /* Native swipe rows do not need a carousel library. */
  body.home .gnostis-all-sponsor-categories .gnostis-category-sponsor-grid {
    display: grid !important;
    grid-template-columns: none !important;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - 24px) / 2.5);
    gap: 12px !important;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 12px;
    padding: 6px 12px 16px;
    scrollbar-width: thin;
  }
  body.home .gnostis-all-sponsor-categories .gnostis-category-sponsor-card {
    scroll-snap-align: start;
    padding: 12px 8px !important;
    gap: 10px !important;
    min-height: 148px !important;
  }
  body.home .gnostis-all-sponsor-categories .gnostis-category-sponsor-logo {
    height: 70px !important;
  }
  body.home .gnostis-all-sponsor-categories .gnostis-category-sponsor-logo img {
    height: 64px !important;
    max-height: 64px !important;
  }
  body.home .gnostis-all-sponsor-categories .gnostis-sponsor-category-row {
    padding: 28px 0 !important;
  }
  /* Retain existing JS controls/swipe until the behaviour pass; show a preview. */
  body.home .wp-block-gnostis-sponsor-products {
    padding-inline: 12px !important;
  }
  body.home .gnostis-sponsor-products {
    padding-inline: 0 !important;
  }
  body.home .gnostis-products-track {
    gap: 12px !important;
  }
  body.home .gnostis-product {
    flex-basis: 85% !important;
    padding: 18px !important;
  }
  body.home .gnostis-products-controls [data-direction=previous] {
    left: 0 !important;
  }
  body.home .gnostis-products-controls [data-direction=next] {
    right: 0 !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  body.home .page-wrapper a,
  body.home .page-wrapper button {
    transition: none !important;
  }
}

/* Existing Gutenberg heading/line accents have inline legacy yellow values. */
body.home .page-wrapper [style*="color:#ffa500"],
body.home .page-wrapper [style*="color:#ffb700"],
body.home .page-wrapper [style*="color: #ffa500"],
body.home .page-wrapper [style*="color: #ffb700"] {
  color: var(--brand-yellow) !important;
}
body.home .page-wrapper hr[style*="#ffa500"] {
  border-color: var(--brand-yellow) !important;
  background-color: var(--brand-yellow) !important;
}
@media (min-width: 1024px) and (max-height: 850px) {
  body.home .bfdk-hero.front_top { padding-block: 12px !important; }
  body.home .bfdk-hero h1 { font-size: 36px !important; }
  body.home .bfdk-hero .mobile-hero-lines .hero-list { min-height: 54px; }
}
@media (max-width: 767px) {
  body.home .bfdk-hero .mobile-hero-lines .hero-list {
    gap: 4px !important;
    align-items: center !important;
  }
  body.home .bfdk-hero .hero-list .wp-block-column {
    align-self: center;
    width: auto !important;
  }
}

/* Fixed-deadline countdown uses the hero's existing top space, not an extra row. */
body.home .bfdk-hero .hero-content { position: relative; }
body.home .bfdk-hero .gnostis-bf-countdown {
  position: absolute;
  top: -28px;
  left: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
  max-width: 100%;
  color: #000;
  font-size: 13px;
  line-height: 22px;
  white-space: nowrap;
}
body.home .bfdk-hero .gnostis-bf-countdown[hidden] { display: none !important; }
body.home .bfdk-hero .gnostis-countdown-unit strong {
  font-size: 17px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 767px) {
  body.home .bfdk-hero .gnostis-bf-countdown { gap: 7px; font-size: 11px; }
  body.home .bfdk-hero .gnostis-countdown-unit strong { font-size: 14px; }
  body.home .bfdk-hero .gnostis-countdown-desktop-label { display: none; }
}

/* Clock styling: centre across the hero container, not just its text column. */
body.home .bfdk-hero .hero-content .gnostis-countdown-unit strong {
  display: inline-block;
  min-width: 2.3em;
  padding: 2px 7px;
  border: 1px solid rgba(0, 0, 0, .10);
  border-radius: 6px;
  background: rgba(255, 255, 255, .70);
  box-shadow: 0 2px 3px rgba(0, 0, 0, .04);
  text-align: center;
  line-height: 24px;
}
@media (min-width: 768px) {
  body.home .bfdk-hero .hero-content .gnostis-bf-countdown {
    /* .hero-content occupies 58% of the centred hero container. */
    width: 172.413793%;
    max-width: none;
    justify-content: center;
    align-items: center;
    top: -32px;
  }
}
@media (max-width: 767px) {
  body.home .bfdk-hero .hero-content .gnostis-bf-countdown {
    top: -30px;
    gap: 5px;
    font-size: 10px;
    align-items: center;
  }
  body.home .bfdk-hero .hero-content .gnostis-countdown-unit strong {
    min-width: 2em;
    padding: 1px 4px;
    font-size: 13px;
    line-height: 20px;
    border-radius: 4px;
  }
}

/* Homepage deals: one price source, honest savings, native scrolling at all sizes. */
body.home .gnostis-products-native .gnostis-products-viewport {
  overflow-x: auto !important;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 8px;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}
body.home .gnostis-products-native .gnostis-products-track {
  touch-action: auto !important;
  transform: none !important;
  transition: none !important;
}
body.home .gnostis-products-native .gnostis-product { scroll-snap-align: start; }
body.home .gnostis-products-native .gnostis-product-price { margin-bottom: 10px !important; }
body.home .gnostis-products-native .gnostis-product-saving {
  align-self: center;
  width: auto;
  margin: 0 0 16px;
  padding: 5px 11px;
  border-radius: 999px;
  background: #EDF5EB;
  color: #28532C;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}
body.home .gnostis-products-native .screen-reader-text {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}
body.home .gnostis-products-native .gnostis-products-controls button:disabled {
  opacity: .4;
  cursor: default !important;
}
body.home :is(.gnostis-products-native, .gnostis-sponsor-category-row) .gnostis-products-dots { display: none; }
body.home :is(.gnostis-products-native, .gnostis-sponsor-category-row) .gnostis-products-dots[hidden] { display: none !important; }
body.home .gnostis-products-native .gnostis-products-viewport:focus-visible {
  outline: 3px solid #000 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 6px #fff !important;
}
@media (max-width: 767px) {
  body.home .gnostis-products-native .gnostis-products-controls button { display: none !important; }
  body.home :is(.gnostis-products-native, .gnostis-sponsor-category-row) .gnostis-products-dots {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2px;
    margin: 4px 0 12px;
  }
  body.home :is(.gnostis-products-native, .gnostis-sponsor-category-row) .gnostis-products-dots button {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
  }
  body.home :is(.gnostis-products-native, .gnostis-sponsor-category-row) .gnostis-products-dots button::before {
    content: '';
    width: 9px;
    height: 9px;
    border: 1px solid #000;
    border-radius: 50%;
    background: #fff;
  }
  body.home :is(.gnostis-products-native, .gnostis-sponsor-category-row) .gnostis-products-dots button[aria-current="true"]::before {
    background: var(--brand-yellow);
    border-width: 2px;
    transform: scale(1.3);
  }
}
/* Let the price block absorb title-height differences; keep its CTA directly below. */
body.home .gnostis-products-native .gnostis-product a.gnostis-product-cta {
  margin-top: 0 !important;
}

/* Keep tablet cards readable instead of squeezing all five into one viewport. */
body.home .gnostis-products-native .gnostis-product {
  min-width: 230px !important;
}
body.home .gnostis-products-native .gnostis-product h3 {
  word-break: normal !important;
  overflow-wrap: break-word !important;
}
body.home .gnostis-products-native .gnostis-product-price .amount,
body.home .gnostis-products-native .gnostis-product-saving,
body.home .gnostis-products-native .gnostis-product-cta {
  white-space: nowrap !important;
}
@media (min-width: 768px) and (max-width: 999px) {
  body.home .gnostis-products-native .gnostis-product {
    flex-basis: 40% !important;
    padding: 18px !important;
  }
}
@media (min-width: 1000px) and (max-width: 1199px) {
  body.home .gnostis-products-native .gnostis-product {
    flex-basis: calc((100% - 40px) / 3) !important;
  }
}
/* Two visible cards plus a preview on larger phones / small tablets. */
@media (min-width: 600px) and (max-width: 767px) {
  body.home .gnostis-products-native .gnostis-product {
    flex-basis: 44% !important;
  }
}

/* Requested hero typography, across desktop and mobile. */
body.home .bfdk-hero h1 { font-size: 56px !important; }
body.home .bfdk-hero .desk-show,
body.home .bfdk-hero .hero-text-info { font-size: 20px !important; }

/* Keep category offer labels on one line with room for their text. */
body.home .gnostis-all-sponsor-categories .gnostis-category-sponsor-button {
  white-space: nowrap !important;
  overflow-wrap: normal !important;
  word-break: normal !important;
}
@media (max-width: 767px) {
  body.home .gnostis-all-sponsor-categories .gnostis-category-sponsor-grid {
    grid-auto-columns: max(216px, calc((100% - 24px) / 2.083333));
  }
}

@media (max-width: 767px) {
  body.home .gnostis-all-sponsor-categories .gnostis-category-sponsor-button {
    min-height: 33px !important;
  }
}

@media (min-width: 768px) {
  body.home .bfdk-hero.front_top {
    background-image: url('/wp-content/mu-plugins/gnostis-homepage/assets/hero-bags-clean.png');
  }
}

body.home .gnostis-all-sponsor-categories { padding: 0 10px !important; }

@media (min-width: 768px) {
  body.home .gnostis-category-strip .gnostis-category-tiles {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  }
}

/* Readable mobile countdown beneath the heading; shared carousel dots for categories. */
body.home .gnostis-category-carousel-ui .gnostis-products-controls { display: none !important; }
@media (max-width: 767px) {
  body.home .bfdk-hero .hero-content .gnostis-bf-countdown {
    position: static;
    width: 100%;
    max-width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px 10px;
    margin: 14px 0 18px;
    font-size: 14px;
    line-height: 1.4;
    white-space: normal;
  }
  body.home .bfdk-hero .gnostis-countdown-label { flex-basis: 100%; font-weight: 600; }
  body.home .bfdk-hero .gnostis-countdown-desktop-label { display: inline; }
  body.home .bfdk-hero .hero-content .gnostis-countdown-unit strong {
    font-size: 18px;
    line-height: 28px;
    padding: 3px 6px;
  }
  body.home .gnostis-category-carousel-ready .gnostis-category-sponsor-grid { scrollbar-width: none; }
  body.home .gnostis-category-carousel-ready .gnostis-category-sponsor-grid::-webkit-scrollbar { display: none; }
}

/* Hide carousel tracks without disabling scrolling or navigation. */
body.home .gnostis-products-viewport,
body.home .gnostis-products-track,
body.home .gnostis-category-sponsor-grid,
body.home .gnostis-category-tiles { scrollbar-width: none !important; -ms-overflow-style: none; }
body.home .gnostis-products-viewport::-webkit-scrollbar,
body.home .gnostis-products-track::-webkit-scrollbar,
body.home .gnostis-category-sponsor-grid::-webkit-scrollbar,
body.home .gnostis-category-tiles::-webkit-scrollbar { display: none !important; width: 0; height: 0; }

@media (min-width: 768px) {
  body.home .bfdk-hero .hero-content .gnostis-bf-countdown { font-size: 15px; }
}
