/*
  Tablet and desktop layouts.
  Mobile-first: everything in this file sits inside a min-width media query, so phones (under 768px)
  never use any of it and look exactly as designed in Figma.

    Tablet   768px and up   (iPad portrait)
    Desktop  1024px and up  (iPad landscape, laptops, monitors); content stops at 1200px and centers
    Wide     1280px and up  (the full-size hero card, four tips across)
*/

/* ==================================================================================================
   TABLET (768px and up)
   ================================================================================================== */
@media (min-width: 768px) {
  .logo--lg { width: 123px; height: 48px; }
  .logo--xl { width: 164px; height: 64px; }

  :root {
    --page-gutter: 48px;
    --section-space: 112px;
  }

  /* Type: section titles 32 → 40, hero headline 36 → 48 (Serif XL). */
  .t-serif-large { font-size: 40px; }
  .hero__heading h1 {
    max-width: 560px; /* two balanced lines instead of one very long one */
    margin-inline: auto;
    font: var(--type-serif-xl);
    letter-spacing: var(--tracking-tight);
    text-wrap: balance;
  }
  .section-title > .section-title__sub,
  .section-title > p { max-width: 560px; }
  .section-title__sub { text-wrap: balance; } /* no lone last word */
  .section-title h2,
  .section-title h2 > span { text-wrap: balance; } /* no lone last word, like "night." */

  /* Light sections: the hero's warm gradient. Each run of light sections between dark ones shares one
     gradient (index.html wraps them in .light-run), and the footer carries on in its bottom color. */
  .light-run { background: linear-gradient(to bottom, #fefbf7, #f5eee0); }
  .site-footer { background: #f5eee0; }

  /* ---------- 1. Hero: the video becomes a 3:4 card on a warm gradient; the bubbles sit on the video ---------- */
  .hero {
    min-height: 0;
    padding-bottom: var(--space-16);
    background: linear-gradient(to bottom, #fefbf7, #f5eee0);
  }
  .hero__content { order: 1; gap: var(--space-8); }
  .daily { padding-top: var(--section-space); background: var(--bg-dark-warm); }
  .nudge { padding-top: var(--section-space); background: none; }
  .hero__heading > .store-badges,
  .hero__heading > .notify-button { margin-top: var(--space-2); } /* 32px below the copy, as before */
  /* The media box is the 3:4 card itself; the bubbles sit on the video in the same arrangement as on
     mobile (scaled to the card), so they read as the phone's conversation. */
  .hero__media {
    order: 2;
    position: relative;
    left: auto; right: auto; bottom: auto;
    width: 420px;
    height: 560px;
    margin-top: var(--space-6);
  }
  .hero__slides { border-radius: var(--radius-xl); box-shadow: var(--shadow-photo-card); } /* like the other photo cards */
  .hero__slides { overflow: hidden; } /* the card clips its slides, bubbles included, as a change slides them past */
  .hero { overflow-x: clip; } /* the slides waiting off to the right of the card don't widen the page */
  .hero-slide { background: none; } /* no page-colored box sliding past the card (the blend is invisible here) */
  .hero-slide__video { clip-path: inset(0 round var(--radius-xl)); }
  .js .hero-slide:not(.is-shown) .hero-slide__video { clip-path: inset(0 100% 0 0); }
  .hero__fade { display: none; }
  .hero__toggle {
    right: calc(var(--space-4) - 10px);
    bottom: calc(var(--space-4) - 10px);
  }
  /* The bubbles sit inside the card, inset from its own edge (left, or right on mirrored slides) like on desktop;
     the height keeps them by the phone. */
  .chat-thread { left: var(--space-6); top: 199px; }
  .hero-slide--mirrored .chat-thread { left: auto; right: var(--space-6); }

  /* ---------- 2. Every day a new…: bigger phones; the row fades out toward the screen edges ---------- */
  .phone-track { --phone-h: 560px; --shadow-device: var(--shadow-device-dark); }
  /* The mask only paints inside the track, so it gets room above and below for the phones' shadows. */
  .phone-track {
    --phone-fade: 160px;
    padding-block: 40px;
    margin-block: -40px;
    -webkit-mask-image: linear-gradient(to right,
      transparent, #000 var(--phone-fade), #000 calc(100% - var(--phone-fade)), transparent);
    mask-image: linear-gradient(to right,
      transparent, #000 var(--phone-fade), #000 calc(100% - var(--phone-fade)), transparent);
  }

  /* ---------- 3. A daily nudge: copy beside the notifications ---------- */
  .nudge {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    column-gap: var(--space-12);
  }
  .nudge .section-title { align-items: flex-start; text-align: left; }

  /* ---------- 4 & 9. Photo cards: wide banners with the landscape videos, copy over a sideways fade ----------
     The card keeps the desktop banner's shape (1200 × 560) at every width, so the whole video shows. The copy
     sits in a column 40% of the card wide (at most 380px), inset from the edge by the side margin; the rest of
     the card is left to the couple. The second card is mirrored: couple on the left, copy on the right.
     (Paddings in % are of the card's width.) */
  .photo-cta { padding-inline: var(--page-gutter); }
  .photo-card {
    --card-margin: clamp(32px, 6.67%, 80px);
    --card-column: min(380px, 40%);
    aspect-ratio: 1200 / 560;
    align-items: flex-start;
    justify-content: center;
    padding: 0 calc(100% - var(--card-column) - var(--card-margin)) 0 var(--card-margin);
  }
  .photo-cta--mirrored .photo-card { padding: 0 var(--card-margin) 0 calc(100% - var(--card-column) - var(--card-margin)); }
  .photo-card .section-title {
    width: 100%;
    align-items: flex-start;
    text-align: left;
  }
  .photo-card__scrim {
    top: 0;
    width: 75%;
    height: 100%;
    background: linear-gradient(to right, var(--neutral-900), rgba(59, 56, 51, 0));
  }
  .photo-card .store-badges { flex-wrap: wrap; justify-content: flex-start; gap: var(--space-3); }
  .photo-card .store-badge { height: 40px; } /* both fit on one row in the narrower column (full size from 1024px) */
  .photo-card__video { object-position: right center; } /* landscape videos from 768px (js/main.js) */
  .photo-cta--mirrored .photo-card__video { object-position: left center; }
  .photo-cta--mirrored .photo-card__scrim {
    left: auto;
    right: 0;
    background: linear-gradient(to left, var(--neutral-900), rgba(59, 56, 51, 0));
  }

  /* ---------- 5. Weekly tips: the phone slider, swiped through (a grid from 1024px) ---------- */
  /* The tips either side of the one in view fade back. A faded tip is its own layer, so it gets a background
     of the gradient's color behind it (sampled by js/main.js) for its video's multiply to blend with. */
  .tip-slide {
    background: var(--tips-bg, var(--bg-page));
    transition: opacity 0.35s ease;
  }
  .tip-slide:not(.is-current) { opacity: 0.3; }

  /* ---------- 6. Date night: a bigger deck ---------- */
  .q-stack { zoom: 1.2; }

  /* ---------- 7. Science: a 480px video ---------- */
  .science .video { align-self: center; width: 480px; }
  .science .section-title__sub { max-width: 480px; } /* as wide as the video below it */
  /* The dusk-to-night-to-day sky runs through Date night and Small Moments as on phones (same gradients, stars
     and soft video shadow), with the padding either side of the seam tightened so the sky reads as one. */
  .date-night { padding-bottom: 80px; }
  .science { padding-block: 56px var(--section-space); }
  .invite { padding-top: var(--section-space); }

  /* ---------- 10. Footer: brand left, links right, copyright under a rule ---------- */
  .site-footer {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "brand links" "imi imi" "copy copy";
    align-items: start;
    row-gap: var(--space-10);
    text-align: left;
  }
  /* The IMI credit (when shown) sits in its own row under the brand: logo, then the sentence beside it. */
  .imi-credit {
    grid-area: imi;
    flex-direction: row;
    gap: var(--space-6);
    width: auto;
  }
  /* The tagline's last line sits on the logo's baseline: the logo box has no text baseline, so it lines
     up with the box's bottom edge, and the wordmark's baseline is 2px above that. */
  .site-footer__brand {
    grid-area: brand;
    flex-direction: row;
    align-items: last baseline;
    gap: var(--space-6);
    width: auto;
  }
  .site-footer__brand p { position: relative; top: -2px; }
  .site-footer__links { grid-area: links; align-items: flex-end; }
  .site-footer__copyright {
    grid-area: copy;
    padding-top: var(--space-6);
    border-top: 1px solid var(--stroke);
  }
}

/* ==================================================================================================
   DESKTOP (1024px and up)
   ================================================================================================== */
@media (min-width: 1024px) {
  :root {
    --page-gutter: max(64px, calc((100vw - 1200px) / 2)); /* content stops at 1200px and centers */
    --section-space: 144px;
  }

  /* Type: section titles 48 (Serif XL); intro paragraphs 18. The hero headline stays 48 here, 64 from 1280px. */
  .t-serif-large { font-size: 48px; }
  .section-title__sub { font-size: 18px; }

  /* ---------- Header bar: logo left, store badges right; slides down after the hero ---------- */
  .site-bar {
    display: block;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 50;
    background: rgba(255, 251, 246, 0.88);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--stroke);
    transform: translateY(-100%);
    visibility: hidden; /* so Safari's rubber-band scroll at the top can't reveal it */
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.25, 1), visibility 0s linear 0.35s;
  }
  .site-bar.is-shown {
    transform: none;
    visibility: visible;
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.25, 1);
  }
  .site-bar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-6);
    height: 72px;
    padding-inline: var(--page-gutter);
  }
  .site-bar__logo { width: 103px; height: 40px; }
  .site-bar__badges .store-badge { height: 40px; }
  .site-bar__badges { gap: var(--space-3); }

  /* ---------- 1. Hero: copy on the left, the video card on the right ---------- */
  .hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 400px;
    grid-template-areas: "content media";
    align-items: center;
    gap: var(--space-16);
    padding: var(--space-10) var(--page-gutter) var(--space-16);
  }
  .hero__content {
    grid-area: content;
    align-items: flex-start;
    gap: var(--space-10);
    padding: 0;
  }
  .hero__heading { text-align: left; }
  .hero__heading h1 { margin-inline: 0; }
  .hero__heading > .store-badges,
  .hero__heading > .notify-button { margin-top: var(--space-4); } /* 40px below the copy, as before */
  .hero__heading > .notify-button { align-self: flex-start; }
  .hero__phrase { white-space: nowrap; } /* "Grow closer in / just a minute / a day." */
  /* Stills for the larger desktop videos (index.html picks those from 1024px). */
  .hero-slide__video--woman-walking { background-image: url(../assets/video/hero-woman-walking-desktop-poster.jpg); }
  .hero-slide__video--man-office    { background-image: url(../assets/video/hero-man-office-desktop-poster.jpg); }
  .hero-slide__video--woman-garden  { background-image: url(../assets/video/hero-woman-garden-desktop-poster.jpg); }
  .hero-slide__video--man-couch     { background-image: url(../assets/video/hero-man-couch-desktop-poster.jpg); }
  .hero .store-badges { justify-content: flex-start; }
  .hero__media {
    grid-area: media;
    width: 400px;
    height: 533px;
    margin: 0;
  }
  /* The card clips its slides again (beside the headline, bubbles sliding past its edge would cross the
     copy). The pair's outer edge sits 224px from the middle, so a full-width message would end right at it. */
  .hero__slides { overflow: hidden; }
  .hero-slide__video,
  .js .hero-slide:not(.is-shown) .hero-slide__video { clip-path: none; }
  /* Desktop: the tagline under the headline is a step larger (Sans Medium, 20px). */
  .hero__sub { font: 400 20px/1.4 var(--font-sans); }
  .hero__sub strong { font: var(--type-sans-medium-bold); }
  .chat-thread { left: var(--space-6); top: 190px; }
  .hero-slide--mirrored .chat-thread { left: auto; right: var(--space-6); }

  /* ---------- 2. Every day a new…: five phones; the current theme's is bigger and brighter ---------- */
  .phone-track { --phone-h: 600px; }
  .phone-row .phone {
    transform: scale(0.867);
    opacity: 0.5;
    transition: transform 0.9s cubic-bezier(0.65, 0, 0.25, 1), opacity 0.9s ease;
  }
  .phone-row .phone.is-current { transform: none; opacity: 1; }
  .phone-track { --phone-fade: max(240px, var(--page-gutter)); } /* fully clear by the content area */

  /* ---------- 5. Weekly tips: a 2 × 2 grid instead of a slider (four across from 1280px) ---------- */
  .tips__carousel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-12) var(--space-6);
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: visible;
  }
  .tip-slide { justify-self: center; } /* keeps its 304px mobile width, so every bubble wraps and sizes alike */
  .tips .dots { display: none; }
  .tips__toggle { right: -10px; bottom: -10px; }

  /* ---------- 3. A daily nudge: larger notifications ---------- */
  .notif-stack { zoom: 1.35; }

  /* ---------- 4 & 9. Photo cards: full-size store badges ---------- */
  .photo-card .store-badges { gap: var(--space-4); }
  .photo-card .store-badge { height: 48px; }

  /* ---------- 6. Date night: copy on the left, the deck on the right ---------- */
  .date-night {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    column-gap: var(--space-16);
  }
  .date-night .section-title { align-items: flex-start; text-align: left; }
  .date-night .section-title__heading { align-items: flex-start; }
  .q-stack { zoom: 1.35; }
  /* Desktop keeps each section's own background (the combined night sky is for phones and tablets). */
  .date-night { padding-bottom: var(--section-space); background: var(--bg-dark-warm); }
  .stars { display: none; }

  /* ---------- 7. Science: the video on the left, the copy block centered in the right column (under the card deck
     in Date night above, so the two sections alternate); its own dark background ---------- */
  .science {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); /* the same split as Date night, so the columns line up */
    grid-template-rows: 1fr auto 1fr; /* the title block, centered beside the video */
    column-gap: var(--space-16);
    row-gap: var(--space-8);
    padding-block: var(--section-space);
    background:
      linear-gradient(to bottom, rgba(59, 56, 51, 0), var(--neutral-800)),
      linear-gradient(to bottom, var(--neutral-900), var(--neutral-800));
  }
  .science .section-title {
    grid-column: 2;
    grid-row: 2;
    justify-self: center; /* the block sits centered under the card deck; its text reads left-aligned */
    width: fit-content;
    max-width: 480px;
    align-items: flex-start;
    text-align: left;
  }
  .science__video-group { display: contents; }
  .science .video { grid-column: 1; grid-row: 1 / -1; justify-self: start; width: 100%; max-width: 520px; box-shadow: var(--shadow-video); }

  /* ---------- 10. Footer: the links in a row; more room under the last photo card ---------- */
  .site-footer { padding-top: 112px; }
  .site-footer__links { flex-direction: row; gap: var(--space-10); align-self: center; }
}

/* ==================================================================================================
   WIDE DESKTOP (1280px and up): the full-size hero and four tips across
   ================================================================================================== */
@media (min-width: 1280px) {
  .hero { grid-template-columns: minmax(0, 1fr) 520px; }
  .hero__heading h1 { font-size: 64px; line-height: 1.1; }
  .hero__media {
    width: 520px;
    height: 693px;
  }
  .chat-thread { left: 36px; top: 247px; }
  .hero-slide--mirrored .chat-thread { right: 36px; }

  /* Tips four across: each keeps its mobile layout, scaled to fit, so all four bubbles match. */
  .tips__carousel { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tip-slide { zoom: 0.88; }

  /* Invites three across, at their mobile width so each wraps to three lines. */
  .invite__carousel {
    display: grid;
    grid-template-columns: repeat(3, 334px);
    justify-content: center;
    gap: var(--space-6);
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: visible;
  }
  .invite .dots { display: none; }
}

/* Tips four across, with a mouse: hovering one brings it forward, the others step back. */
@media (min-width: 1280px) and (hover: hover) and (pointer: fine) {
  .tip-slide {
    /* A scaled or faded tip is its own layer: give the video's multiply something to blend with, matching
       the gradient behind the tips (sampled by js/main.js). */
    background: var(--tips-bg, var(--bg-page));
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.25, 1), opacity 0.35s ease;
  }
  .tips__carousel:hover .tip-slide { transform: scale(0.94); opacity: 0.55; }
  .tips__carousel .tip-slide:hover { transform: scale(1.1); opacity: 1; }
}

/* Desktop with a mouse: the deck hint says "Drag" instead of "Swipe". */
@media (min-width: 1024px) and (hover: hover) and (pointer: fine) {
  .swipe-hint__touch { display: none; }
  .swipe-hint__mouse { display: inline; }
}
