/*
 * Homepage cinematic layer
 * Scoped to .home-page so the catalogue and editorial pages keep their
 * established presentation. Motion is progressively enhanced by
 * assets/js/home-cinematic.js and fully respects reduced-motion settings.
 */

.home-page {
  --hero-px: 0;
  --hero-py: 0;
  --hero-scroll: 0;
}

.home-page .site-header {
  box-shadow: 0 20px 70px rgba(0, 0, 0, .12);
}

.home-reading-progress {
  position: fixed;
  z-index: 130;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  pointer-events: none;
  transform: scaleX(0);
  transform-origin: left center;
  background: linear-gradient(90deg, #7b241f, var(--gold-2), #f2ddaf);
  box-shadow: 0 0 18px rgba(225, 182, 107, .38);
  will-change: transform;
}

.home-cinematic-hero {
  min-height: min(860px, calc(100svh - 78px));
  isolation: isolate;
  perspective: 1200px;
}

.home-cinematic-hero::before,
.home-cinematic-hero::after {
  content: "";
  position: absolute;
  z-index: 3;
  pointer-events: none;
}

.home-cinematic-hero::before {
  inset: 19px;
  border: 1px solid rgba(225, 182, 107, .1);
  border-bottom-color: rgba(225, 182, 107, .18);
  opacity: .78;
}

.home-cinematic-hero::after {
  right: 42px;
  bottom: 42px;
  width: 84px;
  height: 84px;
  border-right: 1px solid rgba(225, 182, 107, .34);
  border-bottom: 1px solid rgba(225, 182, 107, .34);
}

.home-cinematic-hero .hero-media {
  inset: -4%;
  transform:
    translate3d(
      calc(var(--hero-px) * 14px),
      calc(var(--hero-py) * 9px + var(--hero-scroll) * -34px),
      0
    )
    scale(calc(1.055 + var(--hero-scroll) * .035));
  transition: transform .8s cubic-bezier(.2, .65, .25, 1);
  will-change: transform;
}

.home-cinematic-hero .hero-media img {
  filter: saturate(1.04) contrast(1.025);
}

.home-cinematic-hero .hero-atmosphere {
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  opacity: calc(.28 + var(--hero-scroll) * .12);
  background:
    radial-gradient(
      circle at calc(69% + var(--hero-px) * 7%) calc(39% + var(--hero-py) * 5%),
      rgba(255, 190, 93, .23),
      rgba(165, 89, 27, .08) 17%,
      transparent 39%
    ),
    linear-gradient(115deg, transparent 48%, rgba(235, 184, 103, .06) 59%, transparent 70%);
  mix-blend-mode: screen;
  transition: background-position .6s ease, opacity .6s ease;
}

.home-cinematic-hero .hero-shade {
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(5, 6, 5, .995) 0%, rgba(5, 6, 5, .89) 29%, rgba(5, 6, 5, .28) 61%, rgba(5, 6, 5, .1) 100%),
    linear-gradient(0deg, rgba(5, 6, 5, .57), transparent 48%),
    radial-gradient(circle at 48% 55%, transparent 25%, rgba(4, 5, 4, .3) 100%);
}

.home-cinematic-hero .hero-inner {
  z-index: 4;
}

.home-cinematic-hero .hero-copy {
  transform: translate3d(0, calc(var(--hero-scroll) * 22px), 0);
  opacity: calc(1 - var(--hero-scroll) * .28);
  will-change: transform, opacity;
}

.home-cinematic-hero h1 {
  max-width: 830px;
  text-wrap: balance;
}

.home-cinematic-hero .hero-title-line {
  display: block;
  width: max-content;
  max-width: 100%;
}

.home-cinematic-hero .hero-title-sheen {
  color: var(--cream-2);
  background: linear-gradient(
    105deg,
    var(--cream-2) 0%,
    var(--cream-2) 42%,
    #f7d99a 49%,
    #fff4db 52%,
    var(--cream-2) 59%,
    var(--cream-2) 100%
  );
  background-size: 260% 100%;
  background-position: 110% 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.home-page.cinematic-ready .hero-title-sheen {
  animation: title-sheen 8.5s 2.1s ease-in-out infinite;
}

.home-page.cinematic-ready .home-cinematic-hero .hero-copy > * {
  opacity: 0;
  transform: translate3d(0, 25px, 0);
  animation: hero-enter .9s cubic-bezier(.16, 1, .3, 1) forwards;
}

.home-page.cinematic-ready .home-cinematic-hero .hero-copy > :nth-child(1) { animation-delay: .08s; }
.home-page.cinematic-ready .home-cinematic-hero .hero-copy > :nth-child(2) { animation-delay: .16s; }
.home-page.cinematic-ready .home-cinematic-hero .hero-copy > :nth-child(3) { animation-delay: .28s; }
.home-page.cinematic-ready .home-cinematic-hero .hero-copy > :nth-child(4) { animation-delay: .36s; }
.home-page.cinematic-ready .home-cinematic-hero .hero-copy > :nth-child(5) { animation-delay: .44s; }
.home-page.cinematic-ready .home-cinematic-hero .hero-copy > :nth-child(6) { animation-delay: .52s; }
.home-page.cinematic-ready .home-cinematic-hero .hero-copy > :nth-child(7) { animation-delay: .62s; }

.hero-scroll-cue {
  position: absolute;
  z-index: 5;
  right: 48px;
  bottom: 49px;
  display: flex;
  align-items: center;
  gap: 13px;
  color: rgba(238, 227, 204, .72);
  text-decoration: none;
  text-transform: uppercase;
  font: 700 8px/1 var(--mono);
  letter-spacing: .16em;
}

.hero-scroll-cue i {
  position: relative;
  display: block;
  width: 1px;
  height: 52px;
  overflow: hidden;
  background: rgba(225, 182, 107, .23);
}

.hero-scroll-cue i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--gold-2);
  transform: translateY(-100%);
  animation: scroll-pulse 2.3s .8s cubic-bezier(.76, 0, .24, 1) infinite;
}

.signal-strip {
  position: relative;
  z-index: 5;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(142, 45, 39, .09), transparent 23%, transparent 77%, rgba(189, 150, 88, .08)),
    #080907;
}

.signal-strip::before,
.signal-strip::after {
  content: "";
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  width: min(14vw, 150px);
  pointer-events: none;
}

.signal-strip::before {
  left: 0;
  background: linear-gradient(90deg, #080907, transparent);
}

.signal-strip::after {
  right: 0;
  background: linear-gradient(270deg, #080907, transparent);
}

.signal-track {
  display: flex;
  width: max-content;
  padding: 12px 0 11px;
  color: rgba(225, 182, 107, .78);
  font: 700 9px/1 var(--mono);
  letter-spacing: .2em;
  white-space: nowrap;
  animation: signal-march 36s linear infinite;
  will-change: transform;
}

.signal-track span {
  padding-right: 46px;
}

.home-page.cinematic-ready .reveal-item {
  transition:
    opacity .85s cubic-bezier(.16, 1, .3, 1),
    transform 1s cubic-bezier(.16, 1, .3, 1),
    filter .9s ease;
  transition-delay: var(--reveal-delay, 0ms);
}

.home-page.cinematic-ready .reveal-item:not(.is-visible) {
  opacity: 0;
  filter: blur(7px);
  transform: translate3d(0, 42px, 0);
}

.home-page.cinematic-ready .reveal-item.is-visible {
  opacity: 1;
  filter: none;
  transform: translate3d(0, 0, 0);
}

.home-page .cinematic-card {
  position: relative;
  transform:
    perspective(1000px)
    rotateX(var(--tilt-y, 0deg))
    rotateY(var(--tilt-x, 0deg))
    translate3d(0, var(--card-lift, 0), 0);
  transform-style: preserve-3d;
  transition: transform .45s cubic-bezier(.16, 1, .3, 1), border-color .25s ease, box-shadow .35s ease;
  will-change: transform;
}

.home-page .cinematic-card::after {
  content: "";
  position: absolute;
  z-index: 4;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    circle at var(--card-light-x, 50%) var(--card-light-y, 50%),
    rgba(255, 226, 169, .14),
    transparent 36%
  );
  transition: opacity .35s ease;
}

.home-page .cinematic-card:hover {
  --card-lift: -4px;
  border-color: rgba(225, 182, 107, .56);
  box-shadow: 0 28px 60px rgba(0, 0, 0, .26);
}

.home-page .cinematic-card:hover::after {
  opacity: 1;
}

.home-page .cinematic-card > * {
  position: relative;
  z-index: 2;
}

.home-page .category-card {
  transition: transform .55s cubic-bezier(.16, 1, .3, 1), border-color .3s ease, box-shadow .4s ease;
}

.home-page .category-card:hover {
  transform: translateY(-6px);
  border-color: rgba(225, 182, 107, .52);
  box-shadow: 0 26px 55px rgba(0, 0, 0, .34);
}

.home-page .category-card img {
  transform: scale(1.015);
  transition: transform 1.1s cubic-bezier(.16, 1, .3, 1), filter .65s ease;
}

.home-page .category-card:hover img {
  transform: scale(1.085);
}

.home-page .book-cover img {
  transition: transform .85s cubic-bezier(.16, 1, .3, 1), filter .45s ease;
}

.home-page .cover-link:hover .book-cover img {
  transform: scale(1.035);
  filter: saturate(1.08) contrast(1.025);
}

.home-page .imprint-feature {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(circle at 79% 48%, rgba(142, 45, 39, .14), transparent 29%),
    #080907;
}

.home-page .imprint-feature::before {
  content: "STOKKNES PUBLISHING HOUSE";
  position: absolute;
  z-index: 0;
  left: 31%;
  bottom: -0.16em;
  color: rgba(238, 227, 204, .035);
  font: 500 clamp(70px, 10vw, 178px)/.8 var(--serif);
  letter-spacing: -.045em;
  white-space: nowrap;
  transform: translate3d(calc(var(--imprint-shift, 0) * -90px), 0, 0);
  will-change: transform;
}

.home-page .imprint-feature::after {
  content: "";
  position: absolute;
  z-index: 1;
  top: -25%;
  bottom: -25%;
  left: 50%;
  width: 1px;
  opacity: .32;
  background: linear-gradient(transparent, var(--gold-2), transparent);
  transform: rotate(11deg) translateX(calc(var(--imprint-shift, 0) * 110px));
}

.home-page .imprint-banner,
.home-page .imprint-feature-copy {
  position: relative;
  z-index: 2;
}

.home-page .imprint-banner {
  overflow: hidden;
}

.home-page .imprint-banner img {
  transform: scale(calc(1.035 + var(--imprint-shift, 0) * .035));
  transition: transform 1.2s cubic-bezier(.16, 1, .3, 1), filter .6s ease;
  filter: saturate(.92) contrast(1.04);
  will-change: transform;
}

.home-page .imprint-feature:hover .imprint-banner img {
  filter: saturate(1.04) contrast(1.06);
}

.home-page .editorial-card {
  transition: transform .45s cubic-bezier(.16, 1, .3, 1), border-color .3s ease, box-shadow .35s ease;
}

.home-page .editorial-card img {
  transform: scale(1.015);
  transition: transform 1s cubic-bezier(.16, 1, .3, 1), filter .5s ease;
}

.home-page .editorial-card:hover img {
  transform: scale(1.065);
  filter: saturate(1.05) contrast(1.06);
}

.home-page .policy-home-grid {
  position: relative;
  overflow: hidden;
}

.home-page .policy-home-grid::after {
  content: "";
  position: absolute;
  right: -12%;
  bottom: -70%;
  width: 44%;
  aspect-ratio: 1;
  border: 1px solid rgba(225, 182, 107, .12);
  border-radius: 50%;
  box-shadow:
    0 0 0 28px rgba(225, 182, 107, .025),
    0 0 0 68px rgba(225, 182, 107, .018);
  pointer-events: none;
}

@keyframes hero-enter {
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes title-sheen {
  0%, 58% { background-position: 110% 0; }
  76%, 100% { background-position: -110% 0; }
}

@keyframes scroll-pulse {
  0% { transform: translateY(-100%); }
  48%, 52% { transform: translateY(0); }
  100% { transform: translateY(100%); }
}

@keyframes signal-march {
  to { transform: translate3d(-50%, 0, 0); }
}

@media (max-width: 900px) {
  .home-cinematic-hero {
    min-height: min(790px, calc(100svh - 78px));
  }

  .home-cinematic-hero::before {
    inset: 12px;
  }

  .home-cinematic-hero::after {
    right: 27px;
    bottom: 28px;
    width: 54px;
    height: 54px;
  }

  .hero-scroll-cue {
    right: 29px;
    bottom: 31px;
  }

  .home-page .imprint-feature::before {
    left: 8%;
    bottom: -.08em;
  }

  .home-page .imprint-feature::after {
    left: 64%;
  }
}

@media (max-width: 620px) {
  .home-cinematic-hero {
    min-height: max(690px, calc(100svh - 68px));
  }

  .home-cinematic-hero::before {
    inset: 8px;
  }

  .home-cinematic-hero::after,
  .hero-scroll-cue {
    display: none;
  }

  .home-cinematic-hero .hero-media {
    inset: -2%;
    transform:
      translate3d(0, calc(var(--hero-scroll) * -18px), 0)
      scale(calc(1.025 + var(--hero-scroll) * .025));
  }

  .home-cinematic-hero .hero-atmosphere {
    opacity: .2;
    background: radial-gradient(circle at 69% 34%, rgba(255, 190, 93, .18), transparent 35%);
  }

  .home-cinematic-hero .hero-copy {
    transform: translate3d(0, calc(var(--hero-scroll) * 10px), 0);
    opacity: calc(1 - var(--hero-scroll) * .18);
  }

  .signal-track {
    padding: 10px 0 9px;
    font-size: 8px;
  }

  .home-page .imprint-feature::before {
    font-size: 64px;
  }
}

@media (hover: none), (pointer: coarse) {
  .home-page .cinematic-card,
  .home-page .cinematic-card:hover {
    --card-lift: 0;
    --tilt-x: 0deg;
    --tilt-y: 0deg;
    box-shadow: none;
  }

  .home-page .cinematic-card::after {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-page .home-cinematic-hero .hero-media,
  .home-page .home-cinematic-hero .hero-copy,
  .home-page .imprint-feature::before,
  .home-page .imprint-feature::after,
  .home-page .imprint-banner img {
    transform: none !important;
  }

  .home-page *,
  .home-page *::before,
  .home-page *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }

  .home-reading-progress {
    display: none;
  }

  .home-page .signal-track {
    animation: none !important;
    transform: none !important;
  }

  .home-page.cinematic-ready .home-cinematic-hero .hero-copy > *,
  .home-page.cinematic-ready .reveal-item {
    opacity: 1 !important;
    filter: none !important;
    transform: none !important;
  }

  .home-cinematic-hero .hero-title-sheen {
    color: var(--cream-2);
    background: none;
    -webkit-text-fill-color: currentColor;
  }
}
