/*
 * The Wave 1 Giveaway on the home page (F-045): the teaser strip in the
 * product hero, the giveaway section (option B) with the page's one signup
 * form, its entrance, the end-of-page CTA and the post-close page. Home page
 * only, after styles.css. The site-wide giveaway bar stays in styles.css.
 */

/* ---- entry-only and post-close lines ------------------------------------ */

/* html.giveaway-closed comes from js/early.js (before first paint) and
   js/banner.js (live, at the close). Without JavaScript the page stays as it
   is while entries are open. */
.giveaway-closed .while-open {
  display: none;
}

.after-close {
  display: none;
}

.giveaway-closed .after-close {
  display: block;
}

/* ---- the teaser strip (product hero, under "Free to start.") ------------ */

/* A raised strip: the whole card scaled down, then one line that wraps. The
   thumbnail is never cropped or rounded. */
.giveaway-teaser {
  margin-top: var(--space-4);
}

.teaser-strip {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: 34rem;
  padding: var(--space-2) var(--space-3);
  background: var(--gk-raised);
  border: 1px solid var(--gk-border-strong);
  border-radius: var(--radius-md);
  font-size: var(--font-small);
  color: var(--gk-muted);
}

/* The whole card, scaled down: never cropped. */
.teaser-strip-card {
  flex: none;
  display: block;
  width: 2.5rem;
  height: auto;
  aspect-ratio: 488 / 680;
  object-fit: contain;
}

/* The title on its own line; the time and the link wrap under it with a gap,
   no separator dots. */
.teaser-strip-title {
  display: block;
  font-weight: 650;
  color: var(--gk-text);
}

.teaser-strip-meta {
  display: flex;
  flex-wrap: wrap;
  column-gap: var(--space-3);
}

.teaser-strip-time {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Padded toward a 44px tap target without moving the line. */
.teaser-strip-link {
  display: inline-block;
  padding-block: 0.6875rem;
  margin-block: -0.6875rem;
  font-weight: 600;
  color: var(--gk-text);
  white-space: nowrap;
}

/* ---- the giveaway section ------------------------------------------------ */

/* Phones (and up to 1024px): headline and countdown, the card, the form, the
   prize list, in DOM order. From 1024px two columns: headline and form on
   the left; on the right a raised panel with the card and, under it, the
   prizes as three count tiles. */
.giveaway-hero {
  padding-top: var(--section-gap);
  scroll-margin-block: var(--space-5);
}

.giveaway-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "head"
    "card"
    "signup"
    "prizes";
  row-gap: var(--space-5);
  padding-top: var(--section-inner);
  /* The hairline over the section, as wide as the content (not the gutters). */
  background: linear-gradient(var(--gk-border-strong), var(--gk-border-strong)) center top / calc(100% - 2 * var(--gutter)) 1px no-repeat;
}

.giveaway-head {
  grid-area: head;
}

.giveaway-title {
  max-width: 18ch;
  font-size: clamp(2rem, 1.6rem + 2vw, 3rem);
  font-weight: 650;
  line-height: 1.05;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

/* "Entries close in" small, the time large. */
.giveaway-time {
  margin-top: var(--space-3);
  font-size: 1.125rem;
  font-variant-numeric: tabular-nums;
}

.giveaway-time-label {
  display: block;
  font-size: var(--font-small);
  color: var(--gk-muted);
}

.giveaway-time-value {
  display: block;
  font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.5rem);
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.giveaway-close-line {
  margin-top: var(--space-1);
  font-size: var(--font-small);
  color: var(--gk-muted);
}

.giveaway-lastcall {
  display: inline-block;
  margin-bottom: var(--space-1);
  margin-right: var(--space-2);
  padding: 0.0625rem var(--space-2);
  border: 1px solid var(--gk-outline);
  border-radius: 999px;
  color: var(--gk-text);
  font-size: var(--font-small);
  font-weight: 600;
}

/* Nothing touches the card image: no radius, no effect, no overlay; its
   credit sits below it. The entrance only moves and fades it as a whole. */
.giveaway-card {
  grid-area: card;
  justify-self: center;
  width: min(17rem, 66%);
  margin: 0;
  text-align: center;
}

.prize-card {
  display: block;
  width: 100%;
  height: auto;
}

.prize-credit {
  margin-top: var(--space-2);
  font-size: var(--font-xsmall);
  color: var(--gk-muted);
}

.giveaway-join {
  font-size: 1.125rem;
  font-weight: 600;
}

/* "No purchase necessary.", the eligibility sentence and the rules link. */
.giveaway-terms {
  grid-area: terms;
  font-size: var(--font-small);
  color: var(--gk-muted);
}

.giveaway-npn {
  color: var(--gk-text);
}

/* 14px, a step lighter than the muted text and still AA (5.8:1 on ink). */
.giveaway-eligibility {
  margin-top: var(--space-1);
  max-width: 60ch;
  font-size: var(--font-small);
  color: var(--color-outline-hover);
}

.giveaway-rules-link-unused {
  display: inline-block;
  padding-block: 0.6875rem;
  margin-bottom: -0.6875rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--gk-text);
}

/* Phones: one row per prize under a hairline, the count beside the name;
   the Pro months, which come with prizes, in a line under it. */
.giveaway-prizes {
  grid-area: prizes;
}

.prize-list {
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--gk-border);
}

.prize {
  display: grid;
  padding-block: var(--space-2);
  border-bottom: 1px solid var(--gk-border);
}

.prize-name {
  font-weight: 650;
  letter-spacing: -0.01em;
}

.prize-count {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.prize-note {
  font-size: var(--font-small);
  color: var(--gk-muted);
}

.prize-pro {
  margin-top: var(--space-3);
  font-size: var(--font-small);
  color: var(--gk-muted);
}

.prize-fine {
  margin-top: var(--space-2);
  font-size: var(--font-xsmall);
  color: var(--gk-muted);
}

/* ---- CTA 3, the end of the page ------------------------------------------ */

/* Under a hairline like the questions'; the Founding Member line, the badge
   line and the button. Centred from 640px. */
.cta-final {
  padding-bottom: var(--section-gap);
}

.cta-final-inner {
  max-width: 36rem;
  margin-inline: auto;
  padding-top: var(--section-inner);
  border-top: 1px solid var(--gk-border-strong);
}

.cta-final-title {
  max-width: 40ch;
  font-size: clamp(1.375rem, 1.1rem + 1vw, 1.75rem);
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.cta-final-badge {
  margin-top: var(--space-3);
  color: var(--gk-muted);
  text-wrap: balance;
}

.cta-final-button {
  margin-top: var(--space-5);
}

.cta-final-button + .cta-note {
  margin-top: var(--space-2);
}

/* ---- after the close: the product page ----------------------------------- */

/* The teaser strip and the giveaway go; the form section moves to the end of
   the page as the plain signup section, under a hairline, and CTA 3 (above,
   .while-open) goes. */
.giveaway-closed main {
  display: flex;
  flex-direction: column;
}

.giveaway-closed .giveaway-hero {
  order: 1;
  padding-block: 0 var(--section-gap);
}

.giveaway-closed :is(.giveaway-head, .giveaway-card, .giveaway-prizes, .giveaway-terms) {
  display: none;
}

.giveaway-closed .signup {
  justify-self: center;
  width: 100%;
}

/* ---- the scroll reveal (js/giveaway-hero.js) ----------------------------- */

/* Until the section scrolls into view, the pieces the reveal fades in are
   transparent (the script adds the class only with motion allowed and removes
   it as it starts). The form's controls are never hidden. */
.giveaway-entrance :is(.giveaway-card, .giveaway-head, .giveaway-join, .giveaway-terms, .prize) {
  opacity: 0;
}

/* ---- wider screens ------------------------------------------------------- */

@media (min-width: 40rem) {
  /* About 2rem from the last checkbox to "No purchase necessary.": the three
     rows between them (the post-close note, Turnstile and the form error) are
     empty while entries are open, and each still adds a row gap. */
  .giveaway-terms {
    margin-top: calc(var(--space-6) - 4 * var(--space-3));
  }

  .cta-final-title {
    margin-inline: auto;
    text-align: center;
  }

  .cta-final-badge,
  .cta-final-inner {
    text-align: center;
  }
}

/* The compact landing on short laptop windows (styles.css): a tighter gap above the strip. */
@media (min-width: 64rem) and (max-height: 50rem) {
  .giveaway-teaser {
    margin-top: var(--space-3);
  }
}

@media (min-width: 64rem) {
  .giveaway-grid {
    position: relative;
    isolation: isolate;
    grid-template-columns: minmax(0, 1fr) minmax(0, 28rem);
    grid-template-rows: auto auto 1fr;
    grid-template-areas:
      "head card"
      "signup card"
      "signup prizes";
    column-gap: var(--space-7);
    row-gap: var(--space-4);
    align-items: start;
  }

  /* The panel behind the card and the tiles. */
  .giveaway-grid::before {
    content: "";
    grid-column: 2;
    grid-row: 1 / 4;
    z-index: -1;
    align-self: stretch;
    background: var(--gk-surface);
    border: 1px solid var(--gk-border-strong);
    border-radius: var(--radius-lg);
  }

  .giveaway-card {
    width: 15rem;
    margin-top: var(--space-5);
  }

  .giveaway-prizes {
    padding: 0 var(--space-5) var(--space-5);
  }

  .prize-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-3);
    border-top: 0;
  }

  .prize {
    align-content: start;
    padding: var(--space-3);
    background: var(--gk-raised);
    border: 1px solid var(--gk-border-strong);
    border-radius: var(--radius-md);
  }

  /* Titles on one line, so the tiles line up. */
  .prize-name {
    display: flex;
    flex-direction: column-reverse;
    font-size: var(--font-xsmall);
    line-height: 1.3;
    white-space: nowrap;
  }

  .prize-name .prize-count {
    font-size: 1.5rem;
    line-height: 1.2;
  }

  .prize .prize-note {
    margin-top: var(--space-1);
    font-size: var(--font-xsmall);
  }

  .giveaway-closed .giveaway-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "signup";
  }

  .giveaway-closed .giveaway-grid::before {
    content: none;
  }
}
