/* The first screen: a centred serif headline, a big MacBook with the wallpapers
   (the product). Floating screens at the sides are possible (FLOATING_SCREENS in js/data.js)
   but off for the premium look. */

/* ---------- Hero ---------- */

.hero {
  /* The floating screens are sized in cqw, a share of the hero's width. */
  container-type: inline-size;
  position: relative;
  min-height: max(100dvh, 720px); /* dvh: the real visible height, also in Safari on iPhone */
  overflow: hidden;
}

.hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: max(100dvh, 720px);
  padding: 104px var(--gutter) 40px;
  text-align: center;
}

/* Opening sequence: each element rises in and fades in at its own moment.
   --intro-delay is set by hero-intro.js from js/lib/intro-timeline.js. */
[data-intro] {
  animation: rise-in 700ms var(--ease-out) var(--intro-delay, 0ms) both;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
}

.hero-line {
  display: block;
}

/* The headline in the serif, light and large, like a magazine cover. */
.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(38px, 4.8vw, 64px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.01em;
}

/* The second line in italic, in the text colour: the italic alone is the emphasis (the accent
   colour is kept for the button). */
.hero-highlight {
  font-style: italic;
}

/* The parts of the headline that change with the wallpapers (HERO_TEXTS in js/data.js):
   they fade out, get their new words and fade back in. 300ms: CAPTION_FADE_MS in
   hero-showcase.js. */
.hero-swap {
  transition: opacity 300ms var(--ease-in-out);
}

.hero-swap.is-changing {
  opacity: 0;
}

.hero-text {
  max-width: 440px;
  margin-top: 18px;
  color: var(--color-text-muted);
  font-size: 15px;
  line-height: 1.5;
}

/* Ivory, crisp corners, small spaced capitals. */
.hero-button {
  margin-top: 30px;
  padding: 13px 26px;
  border-radius: var(--radius-pill);
  background: var(--color-button);
  color: var(--color-button-text);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: opacity 200ms var(--ease-in-out);
}

.hero-button:hover {
  opacity: 0.85;
}

/* ---------- The big MacBook ---------- */

/* As big as fits: the whole MacBook is in view on the first screen, together with the
   headline, the button and the pack name. 100svh minus that space (about 450 px), times 1.65
   (a MacBook is about 1.65 times as wide as it is high); never under 300 or over 620 px. */
.hero-device {
  width: clamp(300px, (100svh - 450px) * 1.65, 540px); /* 450: the space above it and the pack name under it */
  max-width: 100%;
  margin-top: 36px;
}

/* The MacBook turns a little towards the mouse (js/features/hero-tilt.js); the transition
   makes every movement soft. */
.hero-device .device.is-tilting {
  transition: transform 600ms var(--ease-out);
  will-change: transform;
}

/* A click on the MacBook opens the pack on its screen. */
.hero-device.is-clickable {
  cursor: pointer;
}

/* "From ALPINE LUXE" under the MacBook: the pack of the wallpaper on the screen. */
.hero-caption {
  margin-top: 18px;
  color: var(--color-text-muted);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero-caption[hidden] {
  display: none;
}

.hero-caption-name {
  padding: 2px 0;
  border: 0;
  border-bottom: 1px solid transparent;
  background: none;
  color: var(--color-accent);
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  transition:
    opacity 300ms var(--ease-in-out),
    border-color 200ms var(--ease-in-out); /* 300ms: CAPTION_FADE_MS in hero-showcase.js */
}

.hero-caption-name:hover {
  border-bottom-color: var(--color-accent);
}

.hero-caption-name.is-changing {
  opacity: 0;
}

/* ---------- Floating screens ---------- */

.floating-screens {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.45; /* faint, so the big MacBook stays the thing you look at */
  pointer-events: none;
  /* The screens fade into the background towards the bottom of the hero,
     so the page continues calmly below it. */
  mask-image: linear-gradient(to bottom, #000 62%, transparent 96%);
}

/* Position and size come from data.js as CSS variables (see floating-screens.js). */
.floating-screen {
  position: absolute;
  top: var(--y);
  left: var(--x);
  width: var(--size);
  transform: translate(-50%, -50%);
}

/* Appears slowly from behind (small and faded), then drifts gently on its own. */
.floating-screen-motion {
  animation:
    appear-from-behind 1100ms var(--ease-out) var(--delay) both,
    drift var(--drift-duration) ease-in-out calc(var(--delay) + 1100ms) infinite alternate;
}

@keyframes appear-from-behind {
  from {
    opacity: 0;
    transform: scale(0.82);
  }
}

@keyframes drift {
  to {
    transform: translate(var(--drift-x), var(--drift-y));
  }
}

/* A frame with rounded corners around each wallpaper, like a small tablet. */
.floating-screen-frame {
  padding: 4.5%;
  border-radius: var(--radius-frame);
  background: var(--color-frame);
  box-shadow: inset 0 0 0 1px var(--color-frame-edge), var(--shadow-frame);
}

.floating-screen-image {
  aspect-ratio: 1;
  border-radius: 8px;
}

.floating-screen-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Phones: only the MacBook, no floating screens. */
@media (max-width: 760px) {
  .floating-screens {
    display: none;
  }

  .hero-content {
    padding-top: 112px;
  }

  .hero-device {
    width: 100%;
    margin-top: 32px;
  }
}


/* On a phone a changing sentence can need one or two lines: keep room for two, so the page
   does not jump when the text changes. */
@media (max-width: 480px) {
  .hero-text {
    min-height: 3em;
  }
}
