/*
 * zarolke.pl home page.
 * Phone first: the reel of example offers fills the screen and the text sits on it, each with its
 * own dark scrim so contrast does not depend on the photo (checked by tools/photo_contrast.py).
 * From 900 px: text on the left, the reel as a card on the right.
 */

body {
  background: var(--night);
  color: #fff;
}

.page {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  overflow-x: clip;
}

/* Reel ------------------------------------------------------------------ */

.reel {
  position: absolute;
  inset: 0;
  background: var(--night);
}

.reel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    rgb(0 0 0 / 72%),
    rgb(0 0 0 / 55%) 12%,
    transparent 22%,
    transparent 50%,
    rgb(0 0 0 / 50%)
  );
}

.reel__photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.08);
  transition: opacity 0.6s ease, transform 3.2s ease-out;
}

.reel__photo.is-active {
  opacity: 1;
  transform: scale(1);
}

.reel__progress {
  position: absolute;
  z-index: 2;
  top: calc(var(--space-3) + env(safe-area-inset-top));
  right: var(--space-3);
  left: var(--space-3);
  display: flex;
  gap: 3px;
}

.reel__bar {
  flex: 1;
  height: 2px;
  overflow: hidden;
  background: rgb(255 255 255 / 35%);
}

.reel__bar::after {
  content: "";
  display: block;
  width: 0;
  height: 100%;
  background: #fff;
}

.reel__bar.is-done::after {
  width: 100%;
}

.reel__bar.is-running::after {
  animation: reel-fill var(--reel-interval, 3s) linear forwards;
}

@keyframes reel-fill {
  to {
    width: 100%;
  }
}

.reel__caption {
  display: none;
}

/* Toggle button used in two places: on the photo (wide) and next to the example label (phone). */
.toggle {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-small);
  background: rgb(20 18 16 / 72%);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.toggle [hidden] {
  display: none;
}

/* On phones the toggle sits next to the example label; the one on the photo is for wide screens. */
.reel__toggle {
  display: none;
}

.toggle svg {
  width: 18px;
  height: 18px;
  fill: currentcolor;
}

/* Header ---------------------------------------------------------------- */

/* Above the intro, whose scrim reaches up over the header on short screens. */
.top {
  position: relative;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: var(--space-4);
  padding: calc(28px + env(safe-area-inset-top)) 20px var(--space-3);
}

.top .logo {
  font-size: 23px;
}

.top .logo__mark {
  width: 27px;
  height: 27px;
}

/* Main text block ------------------------------------------------------- */

.intro {
  position: relative;
  z-index: 2;
  margin-top: auto;
  padding: 0 20px var(--space-3);
}

.intro::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -96px 0 0;
  background: linear-gradient(rgb(0 0 0 / 0%), rgb(0 0 0 / 80%) 96px, rgb(0 0 0 / 88%));
  pointer-events: none;
}

.example {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.example__label {
  min-width: 0;
  margin: 0;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-small);
  background: rgb(20 18 16 / 72%);
  font-size: 14px;
  line-height: 1.3;
  backdrop-filter: blur(8px);
}

.status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-2);
  font-size: 15px;
  font-weight: 600;
}

.status::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff4a3d;
}

.headline {
  margin: 0 0 var(--space-3);
  font-size: clamp(40px, 12vw, 84px);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.headline__accent {
  color: var(--brand);
  white-space: nowrap;
}

.lead {
  max-width: 32em;
  margin: 0 0 var(--space-5);
  color: rgb(255 255 255 / 88%);
}

.lead strong {
  color: #fff;
}

/* Sign-up --------------------------------------------------------------- */

.audiences {
  display: grid;
  gap: var(--space-3);
}

/* On phones the audience headings and blurbs stay for screen readers but leave the screen to the photo. */
.audience__title,
.audience__text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.signup {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.signup:active {
  transform: scale(0.98);
}

@media (hover: hover) {
  .signup:hover {
    background: var(--brand-hover);
  }

  .signup--secondary:hover {
    background: rgb(255 255 255 / 24%);
  }
}

/* The ring sits outside the button, on the page background, so it takes the page's text colour, not the button's. */
.signup:focus-visible {
  outline-color: #fff;
}

.signup--secondary {
  background: rgb(255 255 255 / 14%);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 45%);
  color: #fff;
  backdrop-filter: blur(6px);
}

.signup__address {
  margin-top: 2px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0.75;
  user-select: all;
}

/* Footer ---------------------------------------------------------------- */

.footer {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-3) 20px calc(var(--space-4) + env(safe-area-inset-bottom));
  background: rgb(0 0 0 / 88%);
  color: rgb(255 255 255 / 75%);
  font-size: 14px;
}

.footer a {
  color: #fff;
}

/* Without script the reel shows its first photo and caption; the pause control has nothing to do. */
html:not(.js) .toggle {
  display: none;
}

/* Wide screens ---------------------------------------------------------- */

@media (width >= 900px) {
  body {
    background: var(--paper);
    color: var(--ink);
  }

  .page {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    grid-template-rows: auto 1fr auto;
    align-items: center;
    column-gap: 72px;
    max-width: 1180px;
    min-height: 100vh;
    margin: 0 auto;
    padding: 0 var(--space-6);
  }

  .top {
    grid-column: 1 / -1;
    align-self: start;
    padding: var(--space-6) 0 var(--space-4);
  }

  .top .logo {
    gap: var(--space-3);
    font-size: 32px;
  }

  .top .logo__mark {
    width: 38px;
    height: 38px;
  }

  .reel {
    position: relative;
    inset: auto;
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
    height: min(78vh, 720px);
    max-width: 100%;
    aspect-ratio: 9 / 16;
    overflow: hidden;
    border-radius: var(--radius);
    box-shadow: 0 40px 80px -40px rgb(0 0 0 / 50%);
  }

  .reel::after {
    background: linear-gradient(rgb(0 0 0 / 45%), transparent 22%, transparent 60%, rgb(0 0 0 / 80%));
  }

  .reel__caption {
    position: absolute;
    z-index: 2;
    right: var(--space-4);
    bottom: var(--space-4);
    left: var(--space-4);
    display: block;
    margin: 0;
    color: #fff;
    font-size: 15px;
  }

  .reel__item {
    display: block;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
  }

  .reel__toggle {
    position: absolute;
    z-index: 3;
    top: 28px;
    right: var(--space-3);
    display: grid;
  }

  .intro {
    grid-column: 1;
    grid-row: 2;
    margin-top: 0;
    padding: 0 0 var(--space-7);
  }

  .intro::before,
  .example {
    display: none;
  }

  .status {
    color: var(--ink-2);
  }

  .headline {
    margin-bottom: var(--space-6);
  }

  .headline__accent {
    padding: 0 2px;
    background: linear-gradient(transparent 60%, var(--brand) 60%);
    color: inherit;
  }

  .lead {
    margin-bottom: var(--space-6);
    color: var(--ink-2);
    font-size: 18px;
  }

  .lead strong {
    color: var(--ink);
  }

  .audiences {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-5);
    padding-top: var(--space-5);
    border-top: 1px solid var(--line);
  }

  .audience {
    display: flex;
    flex-direction: column;
  }

  .audience__title,
  .audience__text {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
    white-space: normal;
  }

  .audience__title {
    display: block;
    margin: 0 0 var(--space-1);
    font-size: 20px;
    letter-spacing: -0.02em;
  }

  .audience__text {
    display: block;
    flex: 1;
    margin: 0 0 var(--space-4);
    color: var(--ink-2);
    font-size: 15px;
  }

  .signup {
    background: var(--ink);
    color: var(--paper);
  }

  .signup:focus-visible {
    outline-color: var(--ink);
  }

  @media (hover: hover) {
    .signup:hover {
      background: var(--ink-2);
    }

    .signup--secondary:hover {
      background: var(--line);
    }
  }

  .signup--secondary {
    background: var(--sunk);
    box-shadow: none;
    color: var(--ink);
    backdrop-filter: none;
  }

  .footer {
    grid-column: 1 / -1;
    justify-content: space-between;
    margin-top: var(--space-6);
    padding: var(--space-4) 0 var(--space-6);
    border-top: 1px solid var(--line);
    background: none;
    color: var(--ink-3);
  }

  .footer a {
    color: var(--ink-2);
  }
}

@media (width >= 900px) and (prefers-color-scheme: dark) {
  .headline__accent {
    padding: 0;
    background: none;
    color: var(--brand);
  }
}
