/* Phone layout, from the Marketing Figma mobile frame (29276:26463, 390 wide).
   Every rule sits under one width query, loaded last, so desktop never sees it. */
@media (width <= 820px) {

  /* ---- nav: logo + a black Explore pill, like the frame ---- */
  .topbar .topbar-right .button-dark { display: inline-flex; }
  .topbar .topbar-right .nav-toggle { display: none; }

  /* ---- hero: left-aligned headline, a row of product pills that scrolls sideways, the Ducky group at the bottom ---- */
  html[data-intro] body .hero-fold { display: flex; flex-direction: column; align-items: stretch; padding-inline: 32px; }
  html[data-intro] body .hero-inner { padding-top: clamp(24px, 7svh - 4px, 56px);   /* tighter on short screens, so the Duckies keep their size */ text-align: left; width: 100%; }
  html[data-intro] body .hero-title { max-width: none; width: calc(100% + 32px); margin: 0; text-align: left; font-size: min(15.6vw, 90px); line-height: .86; letter-spacing: -.055em; }
  /* the struck word keeps the line's height, so the last line sits on the same rhythm as the others */
  html[data-intro] body .hero-title .hero-word-struck { line-height: inherit; vertical-align: top; }
  /* strike as thick as desktop (.082em) */
  html[data-intro] body .hero-title .hero-strike { height: .082em; border-radius: 99px; }
  html[data-intro] body .hero-title .hero-line { display: block; text-align: left; }
  html[data-intro] body .hero-title .hero-line-muted { margin-top: .1em; }   /* clear space between the g of "good" and the N of "None" */
  html[data-intro] body .hero-cards {
    flex-direction: row; align-items: center; justify-content: flex-start; gap: 22px;
    margin: 30px -32px -40px; padding: 28px 120px 64px 18px;   /* room for the whole card shadow: a scroller clips what is outside it */ width: auto;
    overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 18px; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 140px), transparent calc(100% - 20px));
            mask-image: linear-gradient(to right, #000 calc(100% - 140px), transparent calc(100% - 20px));
  }
  html[data-intro] body .hero-cards::-webkit-scrollbar { display: none; }
  html[data-intro] body .hero-card-slot { flex: none; scroll-snap-align: start; zoom: .956; }   /* 232 x 104, as the frame */
  html[data-intro] body .hero-card-slot:has(.hero-card-photos) { order: 1; }
  html[data-intro] body .hero-card-slot:has(.hero-card-locker) { order: 2; }
  html[data-intro] body .hero-card-slot:has(.hero-card-auth) { order: 3; }

  /* the Ducky group (placeholder art until the animated one lands) replaces the scooter ride on phone */
  .hero-mduck { display: block; width: calc(100% + 64px); max-width: 520px; margin: auto -32px 0; align-self: center; height: auto; pointer-events: none; user-select: none; }
  html[data-intro] body .hero-pills, html[data-intro] body .duck-band { display: none; }
  /* the live Rive Duckies (hero-mduck.js) take the picture's place; the picture is the fallback */
  .hero-mduck-rive { display: block; flex: none; width: calc(100% + 64px); max-width: 560px; margin: auto -32px 0; align-self: center; aspect-ratio: 447 / 367; pointer-events: none; }
  .hero-mduck-rive canvas { display: block; width: 100%; height: 100%; transform: scale(1.12); transform-origin: 50% 100%; translate: -3% 0; }   /* a little bigger, grown up from the bottom edge, nudged left so the party hat clears the right edge */
  html.mduck-rive .hero-mduck { display: none; }
}
@media (width > 820px) { .hero-mduck, .hero-mduck-rive { display: none; } }

/* ---- product cards: logo, headline, the art, then both buttons along the bottom (frame: Products 29276:26593) ---- */
@media (width <= 820px) {
  body .products { gap: 22px; }
  body .products .product-row { gap: 22px; }
  body .products .card { display: flex; flex-direction: column; align-items: flex-start; padding: 22px 26px 32px; overflow: visible; }
  body .products .card .card-content { display: contents; }
  body .products .card .product-card-logo { order: 1; position: relative; inset: 0 auto auto 0; z-index: 2; }
  body .products .card h2, body .products .card h3 { order: 2; position: relative; z-index: 2; margin: 12px 0 0; letter-spacing: -.05em; line-height: .98; }
  body .products .card .card-actions { order: 4; position: relative; z-index: 2; margin-top: auto; padding-top: 24px; gap: 16px; flex-wrap: nowrap; }
  body .products .card .card-actions .button { min-height: 50px; padding: 0 22px; font-size: 1.05rem; white-space: nowrap; }

  /* Photos: everything in a left column (buttons stacked, as the frame), the phone stands on the card's bottom edge on the right */
  body .products .card-photos { margin-top: 48px; padding-bottom: 26px; }
  body .products .card-photos h2 { width: 50%; font-size: 28px; }
  body .products .card-photos .plan-pill { position: relative; inset: auto; display: table; margin-top: 10px; font-size: 15px; }
  body .products .card-photos .card-actions { flex-direction: column; align-items: stretch; gap: 12px; width: 140px; }
  body .products .card-photos .photo-clip { clip-path: inset(-100px 0 0 0 round 0 0 var(--radius-xl, 32px) var(--radius-xl, 32px)); }
  body .products .card-photos .photo-device { position: absolute; top: auto; bottom: -14px; right: -10px; width: 56%; height: auto; margin: 0; }
  body .products .card-photos .photo-device img { width: 100%; height: auto; display: block; }

  /* Locker: headline left, the phone (with its e block) on the right */
  body .products .card-locker { min-height: 431px; }
  body .products .card-locker h3 { width: 44%; font-size: 26px; }
  body .products .card-locker .locker-device { position: absolute; top: 40px; right: 22px; width: 70%; margin: 0; z-index: 1; }

  /* Auth: short headline across, the tilted phone between it and the buttons */
  body .products .card-auth { min-height: 428px; }
  body .products .card-auth h3 { width: 72%; font-size: 26px; }
  body .products .card-auth .auth-device { order: 3; position: relative; inset: auto; width: 100%; margin: 18px 0 0; align-self: center; }
}

/* ---- Switch: bigger headline, 50px buttons, the whole upload card (frame: Switch 29276:26730) ---- */
@media (width <= 820px) {
  body .switch h2 { font-size: min(12.3vw, 64px); line-height: 1.02; letter-spacing: -.055em; height: auto; }
  body .switch .card-actions { height: auto; gap: 18px; margin-top: 32px; }
  body .switch .card-actions .button { min-height: 50px; padding: 0 24px; font-size: 1.05rem; }
  /* the card on its own, no green frame: the desktop panel is locked to 1029:291, which is 92px tall here and cut the card off */
  body .switch .import-panel { aspect-ratio: auto; overflow: visible; padding: 0; margin-top: 56px; background: none; }
  body .switch .import-panel::before { display: none; }
  body .switch .import-panel .upload-demo { border-radius: 24px; border: 1px solid #e8e8e8; box-shadow: 0 4px 40px -14px rgba(0,0,0,.25); padding: 20px 20px 18px; }
  body .switch .upload-demo-header h3 { font-size: 17px; }
  body .switch .upload-demo-summary { grid-template-columns: minmax(0, 1fr) 76px; gap: 12px; padding-top: 14px; align-items: end; }
  body .switch .upload-demo-summary > div:first-child { padding-bottom: 0; }
  body .switch .upload-demo-mascot { display: block; width: 76px; height: 94px; top: 0; }
  body .switch .upload-demo-mascot img { width: 76px; }
  body .switch .upload-demo-mascot .duck-sleep { height: 94px; }
  body .switch .upload-demo-mascot .duck-done { height: 78px; }
}

/* ---- footer: links in two columns read down (Products..Shops, FAQ..Blog), Discord button at its own width, the crowd along the bottom (frame: Footer 29276:26815) ---- */
@media (width <= 820px) {
  body .footer .footer-inner { height: auto; min-height: 0; padding: 142px 32px 0; row-gap: 0; }
  body .footer .footer-headline { max-width: none; font-size: 30px; line-height: 1.1; }
  body .footer .footer-nav { margin-top: 34px; grid-template-columns: 133px auto; grid-template-rows: repeat(6, auto); grid-auto-flow: column; gap: 15px 0; font-size: 20px; line-height: 21px; }
  body .footer .footer-nav a { color: #fff; }
  body .footer .footer-community { margin-top: 62px; }
  body .footer .footer-community h2 { font-size: 48px; }
  body .footer .footer-community p, body .footer .footer-community strong { font-size: 19px; }
  body .footer .footer-community .button { width: 205px; min-height: 50px; margin-top: 22px; }
  body .footer .footer-art { width: calc(100% + 24px); max-width: none; height: auto; margin: 108px -12px 0; justify-self: center; }
}

/* ---- Toys: the round arrows sit over the carousel's edges, 34px, as the frame (Toys 29276:26802) ---- */
@media (width <= 820px) {
  body .toys .toys-carousel { position: relative; }
  body .toys .toys-arrow { display: grid; position: absolute; top: 50%; translate: 0 -50%; width: 34px; height: 34px; z-index: 6; }
  body .toys .toys-arrow img { width: 100%; height: 100%; }
  body .toys .toys-arrow-prev { left: 20px; right: auto; }
  body .toys .toys-arrow-next { right: 20px; left: auto; }
}
