/* =========================================================
HERO CONTAINER
========================================================= */

.qw-immersive-hero {
  position: relative;
  height: 240vh;
}

.qw-immersive-hero__viewport {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  background: transparent;
}

.qw-immersive-hero__stage {
  position: absolute;
  inset: 0;
}

.qw-immersive-hero__stage--primary {
  z-index: 1;
  color: #fff;
}

.qw-immersive-hero__stage--secondary {
  z-index: 4;
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qw-immersive-hero.is-transitioned
.qw-immersive-hero__stage--secondary {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.8s ease 1.05s;
}

/* =========================================================
WHITE TRANSITION LAYER
========================================================= */

.qw-immersive-hero__viewport::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0;

  background: radial-gradient(
    circle at var(--focus-x,50%) var(--focus-y,50%),
    rgba(255,255,255,0) 0,
    rgba(255,255,255,0) var(--focus-inner,120px),
    rgba(255,255,255,0.45) var(--focus-mid,220px),
    rgba(255,255,255,0.88) var(--focus-outer,420px),
    rgba(255,255,255,1) 100%
  );

  transition: opacity 1s ease 0.15s;
}

.qw-immersive-hero.is-fading-primary
.qw-immersive-hero__viewport::after {
  opacity: 0.55;
}

.qw-immersive-hero.is-transitioned
.qw-immersive-hero__viewport::after {
  opacity: 1;
}



/* =========================================================
BACKGROUND MEDIA
========================================================= */

.qw-immersive-hero__media,
.qw-immersive-hero__bg-image,
.qw-immersive-hero__overlay {
  position: absolute;
  inset: 0;
}

.qw-immersive-hero__media {
  z-index: 0;
  transition:
    opacity .9s ease .1s,
    transform 1.1s ease .05s,
    filter .9s ease .1s;
}

.qw-immersive-hero.is-fading-primary
.qw-immersive-hero__media {
  opacity: .45;
  filter: saturate(.7) brightness(1.05);
}

.qw-immersive-hero.is-transitioned
.qw-immersive-hero__media {
  opacity: 0;
  transform: scale(1.01);
  filter: saturate(.5) brightness(1.1);
}

.qw-immersive-hero__bg-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.qw-immersive-hero__overlay {
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,.16) 0%,
    rgba(0,0,0,.26) 36%,
    rgba(0,0,0,.44) 100%
  );
  transition: opacity .8s ease;
}

.qw-immersive-hero.is-fading-primary
.qw-immersive-hero__overlay {
  opacity: .2;
}

.qw-immersive-hero.is-transitioned
.qw-immersive-hero__overlay {
  opacity: 0;
}



/* =========================================================
PRIMARY HERO CONTENT
========================================================= */

.qw-immersive-hero__content-wrap {
  position: relative;
  z-index: 3;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.qw-immersive-hero__content {
  width: min(920px,100%);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.qw-immersive-hero__title {
  margin: 0;
  max-width: 12ch;
  font-size: clamp(2.8rem,7vw,6.5rem);
  line-height: .95;
  letter-spacing: -.04em;
  font-weight: 700;
}

.qw-immersive-hero__description {
  margin-top: 1.25rem;
  max-width: 42rem;
  font-size: clamp(1rem,1.4vw,1.2rem);
  line-height: 1.6;
  color: rgba(255,255,255,.92);
}



/* =========================================================
PORTRAIT FRAME ANIMATION
========================================================= */

.qw-immersive-hero__frame {
  position: relative;
  margin-top: 2rem;

  width: min(24vw,210px);
  aspect-ratio: 9/16;

  border-radius: 28px;
  border: 3px solid rgba(255,223,34);

  background: rgba(255,255,255,.94);
  box-shadow: inset 0 0 0 3px rgba(255,223,34);

  overflow: hidden;
  z-index: 6;

  will-change: left,top,width,height,transform;
}

.qw-immersive-hero__frame-inner {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 25px;
  overflow: hidden;
  background: #fff;
}

.qw-immersive-hero__frame-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 1.1s ease;
}

.qw-immersive-hero.is-frame-floating
.qw-immersive-hero__frame {
  position: fixed;
  margin-top: 0;
  z-index: 8;
}

.qw-immersive-hero.is-transitioned
.qw-immersive-hero__frame {
  width: 100vw;
  height: 100vh;
  padding: 0;
  background: #fff;
  box-shadow: none;

  transition:
    left 1.45s cubic-bezier(.22,1,.36,1),
    top 1.45s cubic-bezier(.22,1,.36,1),
    width 1.45s cubic-bezier(.22,1,.36,1),
    height 1.45s cubic-bezier(.22,1,.36,1);
}

.qw-immersive-hero.is-transitioned
.qw-immersive-hero__frame-image {
  transform: scale(1.04);
}

.qw-immersive-hero.is-transition-complete
.qw-immersive-hero__frame {
  opacity: 0;
  visibility: hidden;
}



/* =========================================================
SECONDARY CONTENT
========================================================= */

.qw-immersive-hero__secondary-inner {
  position: relative;
  z-index: 5;
  width: 100%;
  padding-top: 8vh;
  padding-bottom: 8vh;
}

/* Desktop: very subtle road network without hard edge cutoffs */
@media (min-width: 992px) {
  .qw-immersive-hero.is-transitioned .qw-immersive-hero__secondary-inner {
    position: relative;
    overflow: hidden;
  }

  .qw-immersive-hero.is-transitioned .qw-immersive-hero__secondary-inner::before {
    content: "";
    position: absolute;
    inset: -18%;                  /* larger than container so edges don't hard-cut */
    pointer-events: none;
    z-index: 0;
    opacity: 0.22;                /* weaker pattern */

    background:
      repeating-linear-gradient(31deg,
        transparent 0 108px,
        rgba(236, 241, 242, 0.55) 108px 112px,
        transparent 112px 238px),
      repeating-linear-gradient(-27deg,
        transparent 0 132px,
        rgba(200, 209, 211, 0.45) 132px 136px,
        transparent 136px 286px),
      repeating-linear-gradient(63deg,
        transparent 0 154px,
        rgba(161, 177, 181, 0.36) 154px 158px,
        transparent 158px 324px);

    transform: rotate(-6deg) scale(1.03);
    transform-origin: center;

    /* soft fade at edges = no obvious section endings */
    -webkit-mask-image: radial-gradient(120% 85% at 50% 50%, #000 58%, transparent 100%);
    mask-image: radial-gradient(120% 85% at 50% 50%, #000 58%, transparent 100%);
  }

  .qw-immersive-hero.is-transitioned .qw-immersive-hero__secondary-inner > * {
    position: relative;
    z-index: 1;                   /* content/cards above pattern */
  }
}

.qw-immersive-hero__secondary-head {
  max-width: 860px;
  margin: 0 auto 2.5rem;
  text-align: center;
}

.qw-immersive-hero__secondary-title {
  font-size: clamp(2rem,4.4vw,4.25rem);
  font-weight: 700;
}

.qw-immersive-hero__secondary-description {
  font-size: clamp(1rem,1.3vw,1.125rem);
  line-height: 1.65;
  opacity: .8;
}



/* =========================================================
PRODUCT CARDS
========================================================= */

/* Product cards: hidden by default, visible after transition */
.qw-immersive-hero__cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 210px));
  justify-content: center;
  gap: 1rem;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease 1.05s, transform 0.6s ease 1.05s;
}

.qw-immersive-hero.is-transitioned .qw-immersive-hero__cards {
  opacity: 1;
  transform: translateY(0);
}

/* Fade out trigger/icon when cards should take over */
.qw-immersive-hero.is-transitioned .qw-immersive-hero__trigger {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.qw-immersive-hero__card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: #fff;

  border-radius: 26px;
  overflow: hidden;

  box-shadow: 0 12px 30px rgba(0,0,0,.07);
  border: 1px solid rgba(0,0,0,.06);

  transition: all .35s ease;
}

.qw-immersive-hero__card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(0,0,0,.1);
}

.qw-immersive-hero__card-media {
  aspect-ratio: 9/16;
  max-height: 260px;
  overflow: hidden;
}

.qw-immersive-hero__card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.qw-immersive-hero__card-body {
  padding: .95rem;
}

.qw-immersive-hero__card-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.qw-immersive-hero__card-text {
  font-size: .92rem;
  opacity: .74;
}

.qw-immersive-hero__card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.qw-immersive-hero__card-cta-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.qw-immersive-hero__card-cta-icon-image {
  display: block;
  width: 18px;
  height: 18px;
  object-fit: contain;
}

/* =========================================================
HERO CTA ICON
========================================================= */

.qw-immersive-hero__trigger {
  margin-top: 1.35rem;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  box-shadow: 0;
  
  appearance: none;
  -webkit-appearance: none;
  
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .65rem;

  cursor: pointer;
}

/* =========================================================
HERO ICON
========================================================= */

.qw-immersive-hero__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  line-height: 0;
  background: transparent;

  transform: translateY(0);
  transition: transform 0.28s ease;
}

.qw-immersive-hero__trigger:hover
.qw-immersive-hero__icon {
  transform: translateY(4px);
}

.qw-immersive-hero__icon-image {
  display: block;

  width: 46px;
  height: auto;
  max-width: 46px;

  background: transparent;
  border: 0;
  box-shadow: none;
}

/* =========================================================
CTA LABEL ("BLI KUND")
========================================================= */

.qw-immersive-hero__icon-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 38px;
  padding: 0 16px;

  border: 1.5px solid rgba(255,255,255,0.85);
  border-radius: 999px;

  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(8px);

  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;

  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;

  color: #ffffff;
}



/* =========================================================
RESPONSIVE
========================================================= */

@media (max-width:991px){

.qw-immersive-hero {
  height:260vh;
}

.qw-immersive-hero__frame {
  width:min(42vw,220px);
}

.qw-immersive-hero__cards {
  grid-template-columns:repeat(2,minmax(0,210px));
}

}

@media (max-width:767px){

.qw-immersive-hero__title {
  font-size:clamp(2.2rem,11vw,4rem);
}

.qw-immersive-hero__frame {
  width:min(52vw,210px);
}

@media (max-width: 767px) {
  .qw-immersive-hero__cards {
    display: flex !important;
    grid-template-columns: none !important;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 0.9rem;
    padding-inline: 0.5rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }

  .qw-immersive-hero__card {
    flex: 0 0 68vw;      /* en tydlig "1 kort i taget" känsla */
    max-width: 68vw;
    min-width: 68vw;
    scroll-snap-align: center;
  }

  .qw-immersive-hero__card-media {
    aspect-ratio: 9 / 16;
    max-height: 260px;    /* viktigt: ta bort 260px-begränsningen på mobil */
    height: auto;
    width: 100%;
  }

  .qw-immersive-hero__card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
}

/* =========================================================
REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce){

.qw-immersive-hero *,
.qw-immersive-hero {
  animation:none!important;
  transition:none!important;
}

.qw-immersive-hero__viewport::after {
  display:none!important;
}

}