/* Nestmie motion: the scroll film, heading masks.
 * Ported from Mintproof's landing/motion/motion.css (same grid, pin sizing,
 * beat list, callout placement and breakpoints), re-skinned for Nestmie.
 *
 * Without script (or under reduced motion) the film reads as a numbered list
 * beside the pet and its care card. `html.is-live` is added by script only
 * after load and idle, to enhance the below-the-fold film and reveals.
 */

/* Rule: never smooth-scroll while a pin is measured. */
html.film-scroll-instant { scroll-behavior: auto !important; }

/* Reveals that slide in from the side start past the edge; clip them. */
html.is-live main { overflow-x: clip; }

/* Heading word masks. The padding keeps descenders out of the clip. */
.nm-w { display: inline-block; overflow: hidden; vertical-align: top; padding: 0 .04em .14em; margin: 0 -.04em -.14em; }
.nm-w > span { display: inline-block; will-change: transform; }

/* ------------------------------------------------------------- the film */
.nm-film {
  --line: rgba(253,246,227,.14); --soft: rgba(253,246,227,.72); --faint: rgba(253,246,227,.5);
  position: relative; color: var(--paper); margin-top: 48px;
  background:
    radial-gradient(760px 520px at 66% 52%, rgba(147,220,182,.16), transparent 62%),
    radial-gradient(620px 460px at 22% 90%, rgba(232,134,100,.16), transparent 60%),
    radial-gradient(1000px 640px at 60% 50%, #4a2a1c, #2E1A11 72%);
}
.nm-film-stage {
  position: relative; min-height: 100vh; min-height: 100svh; overflow: hidden; box-sizing: border-box;
  display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 40px; align-items: center;
  padding: 92px max(20px, calc(50vw - 580px)) 40px;
}
html.is-live .nm-film.is-mounted .nm-film-stage { height: 100vh; height: 100svh; }
.nm-film-copy { position: relative; z-index: 3; }
.nm-eyebrow { font-size: 12px; font-weight: 800; color: var(--mint); letter-spacing: .08em; }
.nm-film-copy h2 { font-weight: 900; font-size: clamp(30px, 3.6vw, 46px); line-height: 1; letter-spacing: -.03em; margin: 10px 0 20px; text-wrap: balance; }
.nm-beats { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nm-beat { position: relative; padding: 12px 0 12px 50px; border-top: .5px solid var(--line); }
.nm-beat:last-child { border-bottom: .5px solid var(--line); }
.nm-beat::before {
  content: attr(data-n); position: absolute; left: 0; top: 11px; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 800; border: 1px solid rgba(253,246,227,.3);
  transition: background .3s, color .3s, border-color .3s;
}
.nm-beat b { display: block; font-size: clamp(18px, 1.7vw, 22px); font-weight: 800; letter-spacing: -.015em; line-height: 1.25; }
.nm-beat-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .45s cubic-bezier(.2,.8,.3,1); }
.nm-beat-body > p { overflow: hidden; margin: 0; padding-top: 6px; color: var(--soft); font-size: 15px; line-height: 1.55; max-width: 38ch; }
html.is-live .nm-film.is-mounted .nm-beat { opacity: .4; transition: opacity .4s; }
html.is-live .nm-film.is-mounted .nm-beat-body { grid-template-rows: 0fr; }
html.is-live .nm-film.is-mounted .nm-beat-body > p { padding-top: 0; }
html.is-live .nm-film.is-mounted .nm-beat.is-on { opacity: 1; }
html.is-live .nm-film.is-mounted .nm-beat.is-on .nm-beat-body { grid-template-rows: 1fr; }
html.is-live .nm-film.is-mounted .nm-beat.is-on .nm-beat-body > p { padding-top: 6px; }
html.is-live .nm-film.is-mounted .nm-beat.is-on::before { background: var(--holo); color: var(--ink); border-color: transparent; }
html.is-live .nm-film.is-mounted .nm-beat.is-past::before { content: '\2713'; color: var(--mint); border-color: rgba(147,220,182,.55); }
.nm-rail { display: none; height: 3px; margin-top: 18px; background: rgba(253,246,227,.12); border-radius: 3px; overflow: hidden; }
.nm-rail i { display: block; height: 100%; background: var(--holo); }
html.is-live .nm-film.is-mounted .nm-rail { display: block; }
.nm-film-note { display: block; margin-top: 16px; font-size: 12px; line-height: 1.5; color: var(--faint); max-width: 40ch; }

.nm-film-scene { position: relative; height: 100%; min-height: 560px; }
.nm-rig {
  --ch: min(52vh, 460px); --cw: var(--ch);
  position: absolute; left: 30%; top: 54%; height: var(--ch); width: var(--cw); translate: -50% -50%;
}
.nm-pet-hold { position: absolute; inset: 0; z-index: 2; }
.nm-aura { --o: .3; position: absolute; inset: -12%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 50% 55%, rgba(255,214,190,calc(var(--o) * .9)), rgba(147,220,182,calc(var(--o) * .45)) 45%, transparent 68%); filter: blur(10px); }
.nm-pet-hold img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.nm-walk { position: absolute; left: 12%; top: 6%; width: 76%; aspect-ratio: 1; background: url(/img/pets/bramble-walk.webp) 0 0 / 400% 100% no-repeat; animation: walkCycle .7s steps(4) infinite, walkBob .35s ease-in-out infinite alternate; }

/* the nest ring */
.nm-nest { position: absolute; inset: -6%; pointer-events: none; z-index: 1; border-radius: 50%; border: 2px dashed rgba(253,246,227,.35); }
.nm-nest::after { content: ''; position: absolute; inset: 7%; border-radius: 50%; border: 1px solid rgba(147,220,182,.35); }
.nm-sparkles { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 4; pointer-events: none; overflow: visible; }
.nm-sparkles path { fill: #FFE7A8; filter: drop-shadow(0 0 6px rgba(255,231,168,.8)); }
.nm-sparkles circle { fill: var(--mint); }
.nm-idtag { position: absolute; left: 50%; top: -12%; translate: -50% 0; z-index: 6; white-space: nowrap;
  display: inline-flex; gap: 6px; align-items: center; padding: 7px 14px; border-radius: 999px; background: var(--paper); color: var(--ink);
  font-size: 13px; font-weight: 700; box-shadow: 0 14px 34px rgba(0,0,0,.35); }
.nm-idtag b { color: var(--mint-text); }
.nm-mood { position: absolute; right: -4%; top: 2%; z-index: 6; width: 26%; aspect-ratio: 1; border-radius: 22px; overflow: hidden;
  box-shadow: 0 0 0 4px var(--paper), 0 18px 36px rgba(0,0,0,.4); }
.nm-mood img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nm-mood span { position: absolute; left: 50%; bottom: -30px; translate: -50% 0; font-size: 12px; font-weight: 800; color: var(--paper); white-space: nowrap; }
.nm-heart { position: absolute; z-index: 5; font-size: 30px; color: var(--peach); text-shadow: 0 4px 14px rgba(232,134,100,.6); pointer-events: none; }

/* the feed that scrolls past on a loud day */
.nm-feed { position: absolute; inset: 4% 6%; z-index: 5; overflow: hidden; border-radius: 28px; pointer-events: none;
  mask: linear-gradient(transparent, #000 18%, #000 82%, transparent); -webkit-mask: linear-gradient(transparent, #000 18%, #000 82%, transparent); }
.nm-feed-rows { display: grid; gap: 12px; padding: 20px; }
.nm-feed-rows i { display: block; height: 64px; border-radius: 16px; background: rgba(253,246,227,.16); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.nm-feed-rows i:nth-child(3n) { height: 110px; }
.nm-feed-rows i:nth-child(4n+1) { width: 78%; }

/* callouts beside the pet */
.nm-co { position: absolute; box-sizing: border-box; left: calc(100% + 44px); width: min(330px, 27vw); z-index: 6; }
.nm-co-id { top: 8%; display: grid; gap: 12px; }
.nm-co-loud, .nm-co-care, .nm-co-better, .nm-co-grow { top: 4%; }
.nm-co-grow { margin-left: 30px; }
.nm-id { position: relative; display: flex; gap: 14px; align-items: baseline; padding: 12px 16px; border-radius: 16px; background: rgba(253,246,227,.08); border: .5px solid rgba(253,246,227,.2); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.nm-id::before { content: ''; position: absolute; right: 100%; top: 50%; width: 52px; height: 1.5px; background: linear-gradient(90deg, transparent, rgba(253,246,227,.7)); }
.nm-id span { min-width: 76px; font-size: 11px; font-weight: 800; letter-spacing: .08em; color: var(--faint); text-transform: uppercase; }
.nm-id b { font-size: 18px; font-weight: 800; letter-spacing: -.01em; }

.nm-panel { background: var(--paper); color: var(--ink); border-radius: 22px; padding: 18px 20px; box-shadow: 0 40px 80px rgba(0,0,0,.45), 0 0 0 .5px rgba(0,0,0,.06); }
.nm-panel.is-dark { background: rgba(253,246,227,.08); color: var(--paper); border: .5px solid rgba(253,246,227,.2); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.nm-k { display: block; font-size: 11px; font-weight: 800; letter-spacing: .08em; color: var(--dim); text-transform: uppercase; }
.nm-panel.is-dark .nm-k { color: var(--mint); }
.nm-q { font-size: 19px; font-weight: 800; letter-spacing: -.01em; margin-top: 6px; }
.nm-big { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; }
.nm-odo { display: inline-flex; font-weight: 900; line-height: 1.1; height: 1.1em; overflow: hidden; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.nm-odo-col { display: inline-flex; flex-direction: column; will-change: transform; }
.nm-odo-col i { font-style: normal; height: 1.1em; display: block; text-align: center; }
.nm-odo .nm-dim { display: none; }
.nm-co-loud .nm-odo, .nm-co-better .nm-odo, .nm-co-grow .nm-odo { font-size: clamp(40px, 4vw, 54px); }
.nm-unit { font-size: 13px; font-weight: 700; color: var(--faint); }
.nm-meter { height: 10px; margin-top: 12px; border-radius: 6px; background: rgba(253,246,227,.12); overflow: hidden; }
.nm-meter i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--peach), #F3B58F); transform-origin: 0 50%; transform: scaleX(.51); }
.nm-note { margin: 12px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--soft); }

.nm-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.nm-tile { position: relative; background: #fff; border-radius: 14px; padding: 10px 12px; box-shadow: 0 0 0 .5px rgba(58,36,24,.1); }
.nm-tile span { display: block; font-size: 10.5px; font-weight: 800; letter-spacing: .07em; color: var(--dim); }
.nm-tile b { display: block; font-size: 16px; letter-spacing: -.01em; margin-top: 2px; }
.nm-tile em { font-style: normal; font-size: 12px; font-weight: 800; color: var(--mint-text); }
[data-part="care-pick"] { --on: 1; background: rgba(147,220,182, calc(.25 + var(--on) * .75)); box-shadow: 0 0 0 calc(var(--on) * 2px) var(--mint-text); }
[data-part="care-pick"]::after { content: '\2713'; position: absolute; right: 10px; top: 8px; font-weight: 900; color: var(--mint-text); opacity: var(--on); }
.nm-timer { display: flex; align-items: center; gap: 12px; margin-top: 12px; font-size: 13px; color: var(--dim); }
.nm-ring { width: 40px; height: 40px; flex: none; transform: rotate(-90deg); }
.nm-ring circle { fill: none; stroke-width: 6; }
.nm-ring .t { stroke: rgba(58,36,24,.1); }
.nm-ring .f { stroke: var(--mint-text); stroke-linecap: round; }

.nm-verdict { border-radius: 22px; background: var(--mint); color: var(--ink); padding: 18px 20px; box-shadow: 0 40px 80px rgba(0,0,0,.45); }
.nm-verdict .nm-k { color: rgba(46,26,17,.7); }
.nm-verdict .nm-unit { color: rgba(46,26,17,.7); }
.nm-chip { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 999px; background: var(--paper); font-size: 12px; font-weight: 800; color: var(--mint-text); }
.nm-better-line { font-size: 13.5px; margin-top: 8px; color: rgba(46,26,17,.8); }

.nm-steps { margin-top: 10px; }
.nm-steps > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: .5px solid rgba(58,36,24,.12); font-size: 14px; color: var(--dim); }
.nm-steps > div b { color: var(--ink); }
.nm-steps > div.is-here b { color: var(--mint-text); }
.nm-bar { height: 8px; border-radius: 4px; background: rgba(58,36,24,.08); overflow: hidden; margin-top: 10px; }
.nm-bar i { display: block; height: 100%; border-radius: 4px; background: var(--mint-text); transform-origin: 0 50%; transform: scaleX(.233); }

/* Static composition (no script, reduced motion): the pet beside its care card. */
.nm-film:not(.is-mounted) .nm-nest, .nm-film:not(.is-mounted) .nm-feed, .nm-film:not(.is-mounted) .nm-sparkles,
.nm-film:not(.is-mounted) .nm-idtag, .nm-film:not(.is-mounted) .nm-co-id, .nm-film:not(.is-mounted) .nm-co-loud,
.nm-film:not(.is-mounted) .nm-co-better, .nm-film:not(.is-mounted) .nm-co-grow, .nm-film:not(.is-mounted) .nm-mood,
.nm-film:not(.is-mounted) .nm-heart, .nm-film:not(.is-mounted) .nm-walk { display: none; }

/* mid widths: narrower copy column so the callouts stay on screen */
@media (min-width: 901px) and (max-width: 1240px) {
  .nm-film-stage { grid-template-columns: minmax(250px, 300px) minmax(0, 1fr); gap: 28px; }
  .nm-rig { --ch: min(44vh, 360px); left: 30%; }
  .nm-co { left: calc(100% + 36px); width: min(290px, 28vw); }
  .nm-co-grow { width: min(260px, 26vw); }
}

/* narrow screens: copy on top, pet in the middle, callout underneath */
@media (max-width: 900px) {
  .nm-film { margin-top: 32px; }
  .nm-film-stage { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 72px 16px 24px; align-content: start; }
  .nm-film:not(.is-mounted) .nm-film-stage { padding-bottom: 330px; }
  .nm-film-scene { min-height: 0; height: auto; position: static; }
  .nm-rig { --ch: min(26svh, 220px); left: 50%; top: auto; bottom: calc(30px + min(36svh, 300px)); translate: -50% 0; }
  .nm-co { left: 50%; top: calc(100% + 22px); translate: -50% 0; width: min(350px, calc(100vw - 32px)); }
  .nm-film:not(.is-mounted) .nm-rig { position: relative; left: auto; bottom: auto; translate: none; margin: 28px auto 0; }
  .nm-co-id, .nm-co-loud, .nm-co-care, .nm-co-better, .nm-co-grow { top: calc(100% + 22px); }
  .nm-co-grow { margin-left: 0; }
  .nm-co-id { grid-template-columns: 1fr 1fr; gap: 8px; }
  .nm-id { flex-direction: column; gap: 2px; padding: 9px 12px; }
  .nm-id::before { display: none; }
  .nm-id b { font-size: 15px; }
  .nm-panel, .nm-verdict { padding: 14px 16px; border-radius: 18px; }
  .nm-co-loud .nm-odo, .nm-co-better .nm-odo, .nm-co-grow .nm-odo { font-size: 36px; }
  .nm-tiles { gap: 6px; margin-top: 8px; }
  .nm-tile { padding: 7px 10px; }
  .nm-tile b { font-size: 14px; }
  .nm-q { font-size: 17px; }
  .nm-note { font-size: 12.5px; margin-top: 8px; }
  .nm-steps > div { padding: 6px 0; font-size: 13px; }
  .nm-idtag { font-size: 12px; top: -6%; }
  .nm-mood { width: 30%; right: -14%; }
  html.is-live .nm-film.is-mounted .nm-eyebrow, html.is-live .nm-film.is-mounted .nm-film-note { display: none; }
  html.is-live .nm-film.is-mounted .nm-film-copy h2 { font-size: 20px; margin: 0 0 6px; }
  html.is-live .nm-film.is-mounted .nm-beat { padding-top: 6px; padding-bottom: 6px; }
  html.is-live .nm-film.is-mounted .nm-beat::before { top: 5px; }
  html.is-live .nm-film.is-mounted .nm-beat-body > p { font-size: 14px; line-height: 1.45; }
  html.is-live .nm-film.is-mounted .nm-beat { display: none; border: 0; }
  html.is-live .nm-film.is-mounted .nm-beat.is-on { display: block; opacity: 1; }
  html.is-live .nm-film.is-mounted .nm-rail { margin-top: 10px; }
}
/* Landscape phones (short and wide). */
@media (max-width: 900px) and (max-height: 520px) and (orientation: landscape) {
  .nm-film-stage { padding: 68px 16px 8px; }
  .nm-rig { --ch: 40svh; left: 26%; top: 66%; bottom: auto; translate: -50% -50%; }
  html.is-live .nm-film.is-mounted .nm-film-copy h2 { display: none; }
  html.is-live .nm-film.is-mounted .nm-beat-body { display: none; }
  .nm-co { left: calc(100% + 28px); top: calc(50% - 30svh); translate: none; width: min(320px, 46vw); }
  .nm-co-id, .nm-co-loud, .nm-co-care, .nm-co-better, .nm-co-grow { top: calc(50% - 30svh); }
  .nm-co-grow { margin-left: 26px; }
  .nm-co-id { grid-template-columns: 1fr 1fr; }
  .nm-panel, .nm-verdict { padding: 12px 14px; }
  .nm-film:not(.is-mounted) .nm-rig { margin-left: 16px; }
}
