/* Blue Magpie site styles (moved out of index.html 2026-11-17).
   Phone rules target elements by their data-m tag (e.g. data-m="menu-row"),
   NOT by their inline style text — editing an element's style can no longer
   silently break its phone layout. A tag must stay on its element. */
/* ---- mobile-friendliness overrides (added July 2026) ----
   Inline styles can't carry media queries, so these tag-based rules
   re-flow the exact desktop layouts on screens under 700px. Desktop is
   untouched. */
@media (max-width: 700px) {
  html,
  body { overflow-x: hidden; }
  img { max-width: 100%; height: auto; }
  [data-m~="grid-14-1"] {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
  }
  /* ---- order menu: compact scroll-friendly item cards ---- */
  /* the menu section wrapper has 110px side padding on desktop */
  [data-m~="menu-section"] {
    padding: 24px 18px !important;
  }
  /* each item row: 3-col grid — row 1: image | text, row 2: price | stepper */
  [data-m~="menu-row"] {
    grid-template-columns: 56px 1fr auto !important;
    gap: 2px 12px !important;
    align-items: start !important;
    padding: 16px 0 !important;
  }
  /* 1: cookie image, small */
  [data-m~="menu-row"] > div:nth-child(1) {
    height: 56px !important;
    width: 56px !important;
  }
  [data-m~="menu-row"] > div:nth-child(1) img {
    max-height: 52px !important;
    max-width: 52px !important;
  }
  /* 2: text block — tighter type */
  [data-m~="menu-row"] > div:nth-child(2) {
    grid-column: 2 / -1 !important;
  }
  [data-m~="menu-row"] > div:nth-child(2) > div:nth-child(1) {
    gap: 8px !important;
  }
  [data-m~="menu-row"] h3 {
    font-size: 15px !important;
  }
  [data-m~="menu-row"] > div:nth-child(2) span[data-m~="upper"] {
    font-size: 9px !important;
    padding: 3px 6px !important;
    letter-spacing: .08em !important;
  }
  [data-m~="menu-row"] > div:nth-child(2) > div:nth-child(2) {
    font-size: 12px !important;
    margin-top: 2px !important;
  }
  [data-m~="menu-row"] > div:nth-child(2) > div:nth-child(3) {
    font-size: 11.5px !important;
    line-height: 1.5 !important;
    margin-top: 4px !important;
    color: #8FA3BC !important;
  }
  /* 3: price + "per pack" on one compact line, aligned with the cookie name
     (column 2); net weight wraps to its own line below */
  [data-m~="menu-row"] > div:nth-child(3) {
    grid-column: 2 / 3 !important;
    grid-row: 2 !important;
    align-self: center !important;
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: baseline !important;
    gap: 2px 8px !important;
    text-align: left !important;
    margin-top: 8px !important;
  }
  [data-m~="menu-row"] > div:nth-child(3) > div:nth-child(1) {
    font-size: 17px !important;
  }
  [data-m~="menu-row"] > div:nth-child(3) > div:nth-child(2) {
    font-size: 10px !important;
    margin-top: 0 !important;
    letter-spacing: .12em !important;
  }
  [data-m~="menu-row"] > div:nth-child(3) > div:nth-child(3) {
    font-size: 9.5px !important;
    margin-top: 0 !important;
    letter-spacing: .1em !important;
    flex-basis: 100% !important;
  }
  /* 4: quantity stepper, right side of row 2 */
  [data-m~="menu-row"] > div:nth-child(4) {
    grid-column: 3 !important;
    grid-row: 2 !important;
    justify-self: end !important;
    align-self: center !important;
    gap: 10px !important;
    margin-top: 8px !important;
  }
  [data-m~="menu-row"] > div:nth-child(4) button {
    width: 40px !important;
    height: 40px !important;
  }
  /* Kind words (reviews): tighter gutters on phones; 16px textarea
     stops iOS Safari auto-zoom like the inputs below */
  [data-m~="pad-40"] {
    padding: 32px 18px 4px !important;
  }
  [data-m~="review-box"] {
    padding: 18px 16px !important;
  }
  textarea { font-size: 16px !important; }
  /* expanded reviews (4+): masonry → single column on phones */
  [data-m~="reviews-masonry"] {
    columns: 1 !important;
    margin-top: 24px !important;
  }
  [data-m~="review-tile"] {
    margin-bottom: 24px !important;
  }
  /* 16px inputs stop iOS Safari from auto-zooming the viewport on focus */
  input[type="text"],
  input[type="email"],
  input[type="tel"] {
    font-size: 16px !important;
  }
  [data-m~="grid-3"] {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }
  [data-m~="two-col"] {
    grid-template-columns: 1fr !important;
  }
  [data-m~="header-nav"] {
    gap: 14px !important;
    flex-wrap: wrap !important;
    row-gap: 6px !important;
  }
  /* hero: compact on phones — no full-screen height, smaller wordmark */
  [data-m~="hero"] {
    min-height: auto !important;
  }
  [data-m~="mh280"] {
    min-height: 210px !important;
  }
  img[alt="Blue Magpie logo with feather"][data-m~="w270"] {
    width: 190px !important;
  }
  /* hero: on phones, show a balanced six-cookie rain — sesame/fruity/ginger
     down the left edge, sesame/ginger/fruity down the right — repositioned
     into the side gutters so nothing touches the 190px wordmark.
     Hidden on mobile: bottom-left sesame (7%), bottom-mid ginger (66%),
     mid-right fruity (76%/50%). */
  img[data-m~="x7"],
  img[data-m~="x66"],
  img[data-m~="x76"][data-m~="y50"] {
    display: none !important;
  }
  /* top-left sesame: shrink so it clears the wordmark */
  img[data-m~="x5"] { width: 32px !important; }
  /* mid-left fruity (desktop 25%/20%): hug the left gutter */
  img[data-m~="x25"] {
    left: 1% !important;
    top: 52% !important;
    width: 26px !important;
  }
  /* bottom-left ginger (desktop 21%/52%) */
  img[data-m~="x21"] {
    left: 6% !important;
    top: 76% !important;
    width: 30px !important;
  }
  /* top-right sesame: nudge clear of the feather tip */
  img[data-m~="x89"] {
    left: 91% !important;
    top: 6% !important;
    width: 20px !important;
  }
  /* mid-right ginger (desktop 76%/14%) */
  img[data-m~="x76"][data-m~="y14"] {
    left: 88% !important;
    top: 38% !important;
    width: 26px !important;
  }
  /* bottom-right fruity (92%/66%) stays as-is */
  /* order total row: let the button wrap under the total */
  [data-m~="pt22"] {
    flex-wrap: wrap !important;
    row-gap: 14px !important;
  }
  button[data-m~="cta-button"] {
    padding: 13px 20px !important;
    font-size: 14px !important;
  }
  [data-m~="heading-rule"] {
    flex-wrap: wrap !important;
    justify-content: center !important;
    row-gap: 4px !important;
  }
  /* footer badge: break onto two clean lines */
  [data-m~="label-14"] > span { display: block; }
  [data-m~="label-14"] > span:nth-child(2) { display: none; }
  /* mobile: no floating hero cookies at all — logo only */
  img[data-m~="hero-cookie"] {
    display: none !important;
  }
  /* header: force 手工餅乾 + nav + top-right seal onto one line */
  [data-m~="header-bar"] {
    padding: 8px 14px !important;
    gap: 10px !important;
  }
  img[alt="Blue Magpie 藍鵲"][data-m~="header-seal"] {
    height: 46px !important;
  }
  span[data-m~="ls22"] {
    font-size: 11px !important;
    letter-spacing: .1em !important;
    white-space: nowrap !important;
  }
  [data-m~="upper"][data-m~="header-nav"] {
    flex-wrap: nowrap !important;
    gap: 12px !important;
    font-size: 11px !important;
    letter-spacing: .05em !important;
    white-space: nowrap !important;
  }
  /* gift box rows: the photo fills its 56px tile (pack images are capped at
     52px above), and the flavor-mix line reads like the ingredient line */
  [data-giftbox="row"] > div:nth-child(1) img {
    max-width: none !important;
    max-height: none !important;
    width: 100% !important;
    height: 100% !important;
  }
  [data-giftbox="row"] > div:nth-child(2) > div:nth-child(2) {
    font-size: 11.5px !important;
    line-height: 1.5 !important;
    margin-top: 4px !important;
    color: #8FA3BC !important;
  }
  /* ingredient flip face: span the whole item card, compact type
     (10.5px is the legibility floor — don't go smaller) */
  [data-cookie-info="panel"] {
    top: 50% !important;
    width: 100% !important;
    min-width: 0 !important;
    font-size: 10.5px !important;
    line-height: 1.5 !important;
    padding: 10px 12px !important;
  }
}
/* flip panels: ginger & dates center in their rows; sesame stays raised (longer list) */
[data-cookie-info="panel"][data-flavor="ginger"],
[data-cookie-info="panel"][data-flavor="dates"] { top: 50% !important; }
/* device-true hint verb: hover-capable devices see "Hover", touch sees "Click" */
@media (max-width: 700px) { [data-weekend-picker] { grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; } }
@media (hover: hover) and (pointer: fine) { [data-hint="tap"] { display: none; } }
@media not ((hover: hover) and (pointer: fine)) { [data-hint="hover"] { display: none; } }
/* hero cookies: slow wander around their own side of the hero (desktop only —
   mobile hides all hero cookies via the hero-cookie rule above). Horizontal
   motion is OUTWARD-ONLY (--bm-x negative = left group, positive = right group;
   every keyframe multiplier is positive), so the authored position is each
   cookie's innermost point and the wordmark can never be touched at any
   viewport. --bm-r re-declares the inline rotate(), which animating transform
   would otherwise drop. Each cookie is picked by its x/y tags (data-m="x5 y28"
   = the cookie authored at left 5%, top 28%); keep the tags if one moves. */
@keyframes bm-cookie-wander {
  0%,
  100% { transform: translate(0, 0) rotate(var(--bm-r)); }
  25% { transform: translate(calc(var(--bm-x) * 1px), calc(var(--bm-y) * -0.6px)) rotate(calc(var(--bm-r) + 3deg)); }
  50% { transform: translate(calc(var(--bm-x) * 0.45px), calc(var(--bm-y) * 1px)) rotate(calc(var(--bm-r) - 2deg)); }
  75% { transform: translate(calc(var(--bm-x) * 0.75px), calc(var(--bm-y) * 0.25px)) rotate(calc(var(--bm-r) + 2deg)); }
}
img[data-m~="x5"][data-m~="y28"] {
  --bm-r: -13deg; --bm-x: -24; --bm-y: 18;
  animation: bm-cookie-wander 12s ease-in-out -3s infinite;
}
img[data-m~="x21"][data-m~="y52"] {
  --bm-r: 19deg; --bm-x: -20; --bm-y: -16;
  animation: bm-cookie-wander 10s ease-in-out -6s infinite;
}
img[data-m~="x25"][data-m~="y20"] {
  --bm-r: 7deg; --bm-x: -26; --bm-y: 16;
  animation: bm-cookie-wander 13.5s ease-in-out -9s infinite;
}
img[data-m~="x7"][data-m~="y72"] {
  --bm-r: -22deg; --bm-x: -18; --bm-y: -20;
  animation: bm-cookie-wander 11s ease-in-out -1.5s infinite;
}
img[data-m~="x76"][data-m~="y14"] {
  --bm-r: 12deg; --bm-x: 22; --bm-y: 16;
  animation: bm-cookie-wander 12.5s ease-in-out -7s infinite;
}
img[data-m~="x76"][data-m~="y50"] {
  --bm-r: -9deg; --bm-x: 24; --bm-y: -14;
  animation: bm-cookie-wander 10.5s ease-in-out -4.5s infinite;
}
img[data-m~="x89"][data-m~="y18"] {
  --bm-r: 23deg; --bm-x: 14; --bm-y: 18;
  animation: bm-cookie-wander 9.5s ease-in-out -8s infinite;
}
img[data-m~="x66"][data-m~="y72"] {
  --bm-r: 284deg; --bm-x: 22; --bm-y: -20;
  animation: bm-cookie-wander 13s ease-in-out -5s infinite;
}
img[data-m~="x92"][data-m~="y66"] {
  --bm-r: 11deg; --bm-x: 14; --bm-y: -18;
  animation: bm-cookie-wander 11.5s ease-in-out -2s infinite;
}
@media (prefers-reduced-motion: reduce) {
  img[data-m~="x5"][data-m~="y28"],
  img[data-m~="x21"][data-m~="y52"],
  img[data-m~="x25"][data-m~="y20"],
  img[data-m~="x7"][data-m~="y72"],
  img[data-m~="x76"][data-m~="y14"],
  img[data-m~="x76"][data-m~="y50"],
  img[data-m~="x89"][data-m~="y18"],
  img[data-m~="x66"][data-m~="y72"],
  img[data-m~="x92"][data-m~="y66"] {
    animation: none !important;
  }
}
