/* /iphone: the TruTag for iPhone preview. Flat phone mockups of the app's screens (iphone.html); each plays when it
   scrolls into view (reveal.js adds .armed, then .play). Without the script, or with reduced motion, each shows its
   finished screen. */

.iphone-hero { max-width: 720px; margin: 0 auto; padding: 64px 0 24px; text-align: center; }
.iphone-hero h1 { font-size: clamp(48px, 9vw, 96px); }
.iphone-hero .lede { margin: 18px auto 0; max-width: 600px; font-size: 18.5px; color: var(--on-fabric-soft); }
.iphone-hero .soon { margin-top: 0; }
.iphone-hero .notify, .iphone-end .notify { margin: 26px auto 0; justify-content: center; }
.iphone-hero .notify-note { text-align: center; }
/* Three screens fanned out, Search in front: the first thing you see. Still copies (the ones below animate). */
.phone-fan { position: relative; height: 430px; margin: 28px auto 0; max-width: 560px; }
.phone-fan .fan { position: absolute; top: 0; left: 50%; width: 320px; margin-left: -160px; transform-origin: 50% 100%; }
.phone-fan .phone { transform: scale(0.66); transform-origin: 50% 0; }
.phone-fan .fan-c { z-index: 2; }
.phone-fan .fan-l { transform: translateX(-118px) rotate(-9deg); opacity: 0.96; }
.phone-fan .fan-r { transform: translateX(118px) rotate(9deg); opacity: 0.96; }
.phone-fan .fan-c .phone { box-shadow: 0 28px 60px rgba(30, 38, 32, 0.35), inset 0 0 0 2px #3a443d; }
.iphone-steps .step { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); }
.iphone-steps .step.flip > div:first-child { order: 2; }
.step-phone { display: flex; justify-content: center; }
/* A slight tilt, alternating, like the home page's mockups. */
.iphone-steps .step .phone { transform: rotate(2deg); }
.iphone-steps .step.flip .phone { transform: rotate(-2deg); }
.iphone-end { max-width: 640px; margin: 24px auto 72px; text-align: center; }
.iphone-end h2 { font-size: clamp(32px, 4.5vw, 44px); }

/* ---------- The phone ---------- */
.phone { --w: 300px; margin: 0; width: var(--w); flex: none; padding: 10px; border-radius: 48px; background: #1e2620;
  box-shadow: 0 24px 50px rgba(30, 38, 32, 0.28), inset 0 0 0 2px #3a443d; font-family: var(--sans); text-align: left; }
.ph-screen { position: relative; height: 620px; overflow: hidden; border-radius: 38px; background: #e7e0d0; color: #1e2620; }
.ph-dark { background: #2b2f2c; }
.ph-status { position: relative; z-index: 5; display: flex; justify-content: space-between; align-items: center; height: 44px; padding: 0 26px; font: 600 13px/1 var(--sans); }
.ph-dark .ph-status { color: #fff; }
.ph-island { position: absolute; left: 50%; top: 11px; width: 92px; height: 26px; margin-left: -46px; border-radius: 14px; background: #000; }
.ph-icons { font-size: 9px; letter-spacing: 1px; }

/* The tab bar: Search, Scan, Shop, You, in a frosted capsule. */
.ph-tabbar { position: absolute; z-index: 6; left: 12px; right: 12px; bottom: 12px; display: flex; justify-content: space-around; padding: 7px 4px 6px;
  border-radius: 26px; background: rgba(251, 249, 243, 0.92); box-shadow: 0 4px 18px rgba(0, 0, 0, 0.16); }
.ph-tab { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 25%; padding: 4px 0; border-radius: 18px; font: 600 9.5px/1 var(--sans); color: #3a4038; }
.ph-tab svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ph-tab.on { background: rgba(40, 101, 71, 0.12); color: var(--green); }

/* Pieces many screens share. */
.ph-glass { display: inline-flex; align-items: center; justify-content: center; height: 34px; border-radius: 17px; background: rgba(251, 249, 243, 0.94);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12); font: 600 12px/1 var(--sans); color: #1e2620; }
.ph-round { width: 34px; flex: none; }
.ph-grabber { display: block; width: 36px; height: 4px; margin: 0 auto 10px; border-radius: 2px; background: #cfc8b8; }
.ph-card-store { margin: 0 0 6px; font: 700 10px/1 var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: #6b716d; }
.ph-verdict { margin: 8px 0 10px; padding: 8px 10px; border-radius: 8px; font-size: 10.5px; line-height: 1.3; }
.ph-verdict b { display: block; font: 700 15px/1.1 var(--display); letter-spacing: 0.04em; text-transform: uppercase; }
.ph-verdict.pass { background: #dcebe1; color: #1e6b35; }
.ph-verdict.fail { background: #fbe6e4; color: #a12a1e; }
.ph-fibers { padding: 10px 12px 4px; border-radius: 10px; background: #fbf9f3; box-shadow: 0 1px 0 #e2dccf; }
.ph-head { margin: 0 0 6px; font: 700 13px/1 var(--display); letter-spacing: 0.04em; text-transform: uppercase; color: var(--green); }
.ph-head.syn { color: #a12a1e; }
.ph-bar { display: flex; gap: 2px; height: 6px; margin: 0 0 4px; border-radius: 3px; overflow: hidden; }
.ph-bar b { display: block; }
.ph-bar .nat { background: #3e8f5c; }
.ph-bar .syn { background: #c94f42; }
.ph-fiber { display: flex; align-items: baseline; gap: 8px; margin: 0; padding: 5px 0; font: 600 11px/1.2 var(--sans); }
.ph-fiber + .ph-fiber { border-top: 1px solid #ece7db; }
.ph-fiber b { min-width: 34px; font: 700 17px/1 var(--display); }
.ph-fiber span { margin-left: auto; color: #6b716d; font-weight: 400; font-size: 9.5px; }
.ph-label-sm { margin: 12px 2px 5px; font: 700 9.5px/1 var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: #6b716d; }
.ph-small { margin: 8px 2px 0; font-size: 10px; color: #6b716d; }
.ph-badge { display: inline-block; padding: 2px 6px; border-radius: 8px; font: 600 9px/1.4 var(--sans); }
.ph-badge[data-status="pass"] { background: #e3f4e8; color: #1e6b35; }
.ph-badge[data-status="fail"] { background: #fbe6e4; color: #a12a1e; }

/* A result card from the bottom, over the camera. */
.ph-card, .ph-drawer { position: absolute; z-index: 7; left: 0; right: 0; bottom: 0; padding: 8px 14px 16px; border-radius: 22px 22px 0 0;
  background: #e7e0d0; box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.25); }
/* As tall as what's in them, the scene above still showing. */
.ph-card, .ph-drawer { padding-bottom: 22px; }
.ph-card-product { display: flex; gap: 10px; align-items: center; }
.ph-card-product svg { width: 52px; height: 52px; flex: none; }
.ph-card-product p { margin: 0; font: 600 12px/1.3 var(--sans); }
.ph-offers { border-radius: 10px; background: #fbf9f3; }
.ph-offers p { display: flex; justify-content: space-between; margin: 0; padding: 8px 10px; font-size: 11px; }
.ph-offers p + p { border-top: 1px solid #ece7db; }
.ph-offers p span b { color: var(--green); font-size: 9px; }
.ph-offers .best { color: var(--green); }

/* ---------- Scan: the camera on a price tag ---------- */
.ph-camera { position: absolute; inset: 0; background: radial-gradient(circle at 50% 40%, #4a4f4b, #232624 70%); }
.ph-tag { position: absolute; left: 50%; top: 110px; width: 150px; margin-left: -75px; padding: 14px 12px 10px; border-radius: 6px; background: #fbf9f3;
  transform: rotate(-4deg); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4); text-align: center; }
.ph-tag-hole { display: block; width: 8px; height: 8px; margin: -6px auto 6px; border-radius: 50%; background: #3a3e3b; }
.ph-tag-name { margin: 0; font: 700 11px/1 var(--display); letter-spacing: 0.08em; }
.ph-tag-price { margin: 4px 0 8px; font: 700 22px/1 var(--display); color: #a12a1e; }
.ph-barcode { display: block; width: 100%; }
.ph-scanline { position: absolute; left: 6px; right: 6px; top: 60%; height: 2px; background: #5fd38a; box-shadow: 0 0 10px 2px rgba(95, 211, 138, 0.7); opacity: 0; }
.ph-hint { position: absolute; left: 20px; right: 20px; bottom: 140px; margin: 0; color: #fff; font: 600 12px/1.3 var(--sans); text-align: center; text-shadow: 0 1px 4px #000; }
.ph-scanrow { position: absolute; left: 14px; right: 14px; bottom: 82px; display: flex; gap: 6px; }
.ph-pill-loc { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 20px; background: rgba(255, 255, 255, 0.16); color: #5fd38a; transform: rotate(-45deg); }
.ph-pill-store { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 40px; border-radius: 20px;
  background: var(--green); color: #fff; font: 600 13px/1.1 var(--sans); }
.ph-pill-store small { font-size: 9px; font-weight: 500; opacity: 0.85; }

/* ---------- Care label ---------- */
.ph-carelabel { position: absolute; left: 50%; top: 100px; width: 170px; margin-left: -85px; padding: 16px 14px; border-radius: 3px; background: #fbf9f3;
  transform: rotate(3deg); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4); font-family: ui-monospace, 'SF Mono', Menlo, monospace; text-align: center; }
.ph-ocr { position: relative; margin: 0 0 6px; padding: 2px 0; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; }
.ph-ocr::after { content: ""; position: absolute; inset: -2px -6px; border: 2px solid #f2c94c; border-radius: 4px; opacity: 1; }
.ph-ocr.o1::after { opacity: 0; }
.ph-care-icons { margin: 8px 0 0; font-size: 13px; letter-spacing: 6px; color: #3a4038; }

/* ---------- Search ---------- */
.ph-page { position: absolute; inset: 44px 0 0; padding: 4px 14px 0; overflow: hidden; }
.ph-count { margin: 6px 0 0; font: 700 26px/1 var(--display); text-transform: uppercase; }
.ph-sub { margin: 4px 0 8px; font-size: 10px; color: #6b716d; }
.ph-chips { display: flex; gap: 5px; margin-bottom: 10px; overflow: hidden; }
.ph-chips span { flex: none; padding: 5px 9px; border-radius: 12px; background: #fbf9f3; font: 600 9.5px/1 var(--sans); }
.ph-chips .on { background: var(--green); color: #fff; }
.ph-grid { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
/* The scan line that reads the labels, top to bottom (only while it plays). */
.ph-gridscan { position: absolute; z-index: 2; left: -6px; right: -6px; top: 0; height: 3px; border-radius: 2px; background: #3e8f5c;
  box-shadow: 0 0 12px 3px rgba(62, 143, 92, 0.55); opacity: 0; pointer-events: none; }
.ph-result { padding: 6px; border-radius: 10px; background: #fbf9f3; }
.ph-result svg { display: block; width: 100%; height: auto; }
.ph-result.dim { opacity: 0.35; filter: grayscale(0.8); }
.ph-r-title { margin: 5px 0 4px; font: 600 9.5px/1.25 var(--sans); }
.ph-r-meta { margin: 4px 0 0; font-size: 9px; color: #6b716d; }
.ph-r-meta b { color: #1e2620; }
.ph-dock { position: absolute; z-index: 6; left: 12px; right: 12px; bottom: 74px; display: flex; flex-wrap: wrap; gap: 6px; }
.ph-fabricpill { flex: 1; }
.ph-field { flex: 1 1 100%; justify-content: flex-start; padding: 0 14px; font-weight: 500; color: #3a4038; }
.ph-shop .ph-field { flex: 1 1 auto; }
.ph-field.center { justify-content: center; }

/* ---------- Shop ---------- */
.ph-store { position: absolute; inset: 0; padding: 44px 0 0; background: #fff; }
.ph-store-top { display: flex; justify-content: space-between; padding: 10px 16px; background: #2d3a4f; color: #fff; font: 700 13px/1 var(--display); letter-spacing: 0.2em; }
.ph-store-photo { margin: 14px 16px 0; }
.ph-store-photo svg { display: block; width: 100%; height: 190px; }
.ph-store-title { margin: 12px 16px 4px; font: 600 15px/1.25 var(--sans); }
.ph-store-price { margin: 0 16px; font: 700 16px/1 var(--sans); }
.ph-store-btn { display: block; margin: 12px 16px 0; padding: 10px; border-radius: 20px; background: #2d3a4f; color: #fff; text-align: center; font: 600 12px/1 var(--sans); }
.ph-fabricbar { position: absolute; z-index: 6; left: 12px; right: 12px; bottom: 116px; height: auto; justify-content: flex-start; gap: 8px; padding: 8px 12px; border-radius: 16px; }
.ph-fabricbar > span { font-size: 18px; }
.ph-fabricbar p { flex: 1; margin: 0; font: 500 9.5px/1.3 var(--sans); color: #a12a1e; }
.ph-fabricbar p b { display: block; color: #1e2620; font-size: 11px; }
.ph-fabricbar i { font-style: normal; color: #6b716d; }
.ph-drawer { z-index: 8; }
.ph-drawer-title { margin: 0; font: 600 14px/1.25 var(--sans); }

/* ---------- Filters ---------- */
.ph-sheet { position: absolute; inset: 44px 0 0; padding: 6px 14px 0; background: #f2f0ea; }
.ph-sheet-bar { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 6px; font: 500 12px/1 var(--sans); color: var(--green); }
.ph-sheet-bar b { color: #1e2620; font-weight: 600; }
.ph-sheet-bar .g { font-weight: 700; }
.ph-summary { margin: 0; padding: 10px 12px; border-radius: 12px; background: #fff; font: 700 12px/1.35 var(--sans); }
.ph-group { margin-top: 8px; border-radius: 12px; background: #fff; }
.ph-group p { display: flex; justify-content: space-between; align-items: center; margin: 0; padding: 9px 12px; font-size: 11px; }
.ph-group p + p { border-top: 1px solid #ece9e1; }
.ph-group b { color: var(--green); font-weight: 600; }
.ph-stepper { padding: 3px 8px; border-radius: 8px; background: #ece9e1; color: #1e2620 !important; }
.ph-toggle { position: relative; width: 34px; height: 20px; border-radius: 10px; background: var(--green); }
.ph-toggle::after { content: ""; position: absolute; top: 2px; right: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; }
.ph-seg { display: flex; margin-top: 8px; padding: 2px; border-radius: 9px; background: #e3e0d8; }
.ph-seg span { flex: 1; padding: 6px 0; border-radius: 7px; text-align: center; font: 600 10px/1 var(--sans); }
.ph-seg .on { background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.ph-typed { font-weight: 600; }
.ph-emoji { display: flex; justify-content: space-between; padding: 6px 10px 10px; border-top: 1px solid #ece9e1; font-size: 17px; }
.ph-emoji span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; }
.ph-emoji .ring { background: rgba(40, 101, 71, 0.16); box-shadow: inset 0 0 0 2px var(--green); }
.ph-save { margin: 10px 0 0; padding: 10px; border-radius: 12px; background: #fff; text-align: center; font: 700 12px/1 var(--sans); color: var(--green); }

/* ---------- Animations (played by reveal.js) ---------- */
@keyframes ph-up { from { transform: translateY(105%); } to { transform: none; } }
@keyframes ph-pop { 0% { opacity: 0; transform: scale(0.6); } 70% { opacity: 1; transform: scale(1.08); } 100% { opacity: 1; transform: none; } }
@keyframes ph-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes ph-sweep { 0% { top: 15%; opacity: 0; } 8% { opacity: 1; } 45% { top: 85%; } 85% { top: 15%; opacity: 1; } 100% { top: 15%; opacity: 0; } }
@keyframes ph-flash { 0%, 100% { box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4); } 40% { box-shadow: 0 0 0 4px #5fd38a, 0 10px 24px rgba(0, 0, 0, 0.4); } }
@keyframes ph-ocr { from { opacity: 0; transform: scale(1.15); } to { opacity: 1; transform: none; } }
@keyframes ph-type { from { max-width: 0; } to { max-width: 140px; } }
@keyframes ph-dim { from { opacity: 1; filter: none; } to { opacity: 0.35; filter: grayscale(0.8); } }

.phone.armed .ph-card, .phone.armed .ph-drawer { transform: translateY(105%); }
.phone.armed.play .ph-card { animation: ph-up 0.6s cubic-bezier(.2, .8, .2, 1) 1.9s both; }
.phone.armed.play .ph-drawer { animation: ph-up 0.6s cubic-bezier(.2, .8, .2, 1) 2.6s both; }

/* Scan: the line sweeps, the tag flashes as it's read, then the card. */
.phone.armed.play .ph-scanline { animation: ph-sweep 1.2s ease-in-out 0.3s 1; }
.phone.armed.play .ph-tag { animation: ph-flash 0.6s ease 1.4s both; }
.phone.armed .ph-card .ph-verdict, .phone.armed .ph-offers p { opacity: 0; }
.phone.armed.play .ph-card .ph-verdict { animation: ph-pop 0.45s ease 2.6s both; }
.phone.armed.play .ph-offers p { animation: ph-in 0.35s ease both; }
.phone.armed.play .ph-offers p:nth-child(1) { animation-delay: 2.9s; }
.phone.armed.play .ph-offers p:nth-child(2) { animation-delay: 3.05s; }
.phone.armed.play .ph-offers p:nth-child(3) { animation-delay: 3.2s; }

/* Care label: each line found, then the card. */
.phone.armed .ph-ocr::after { opacity: 0; }
.phone.armed.play .ph-ocr.o2::after { animation: ph-ocr 0.3s ease 0.6s both; }
.phone.armed.play .ph-ocr.o3::after { animation: ph-ocr 0.3s ease 0.9s both; }
.phone.armed.play .ph-ocr.o4::after { animation: ph-ocr 0.3s ease 1.2s both; }
.phone.armed.play .ph-ocr.o1::after { animation: none; }

/* Search: the results land one by one, a scan line reads down them and each label pops as it passes, then the
   one that isn't really linen fades back and the count comes in. */
@keyframes ph-gridscan { 0% { top: 0; opacity: 1; } 92% { top: 100%; opacity: 1; } 100% { top: 100%; opacity: 0; } }
@keyframes ph-land { from { opacity: 0; transform: translateY(14px) scale(0.96); } to { opacity: 1; transform: none; } }
.phone.armed .ph-result, .phone.armed .ph-result .ph-badge, .phone.armed .ph-count, .phone.armed .ph-sub { opacity: 0; }
.phone.armed .ph-result.dim { filter: none; }
.phone.armed.play .ph-result { animation: ph-land 0.4s ease both; }
.phone.armed.play .ph-result:nth-of-type(1) { animation-delay: 0.2s; }
.phone.armed.play .ph-result:nth-of-type(2) { animation-delay: 0.35s; }
.phone.armed.play .ph-result:nth-of-type(3) { animation-delay: 0.5s; }
.phone.armed.play .ph-result:nth-of-type(4) { animation-delay: 0.65s; }
.phone.armed.play .ph-gridscan { animation: ph-gridscan 1.8s linear 1.1s both; }
.phone.armed.play .ph-result .ph-badge { animation: ph-pop 0.4s ease both; }
.phone.armed.play .ph-result:nth-of-type(1) .ph-badge, .phone.armed.play .ph-result:nth-of-type(2) .ph-badge { animation-delay: 1.5s; }
.phone.armed.play .ph-result:nth-of-type(3) .ph-badge, .phone.armed.play .ph-result:nth-of-type(4) .ph-badge { animation-delay: 2.3s; }
.phone.armed.play .ph-result.dim { animation: ph-land 0.4s ease 0.5s both, ph-dim 0.5s ease 3.1s forwards; }
.phone.armed.play .ph-count, .phone.armed.play .ph-sub { animation: ph-in 0.4s ease 3.2s both; }

/* Shop: the fabric bar slides in, then the drawer. */
.phone.armed .ph-fabricbar { opacity: 0; }
.phone.armed.play .ph-fabricbar { animation: ph-in 0.4s ease 1s both; }

/* Filters: the name types itself ("Mostly cotton"), the emoji gets ringed. */
.ph-typed { display: inline-block; overflow: hidden; white-space: nowrap; }
.phone.armed .ph-typed { max-width: 0; }
.phone.armed.play .ph-typed { animation: ph-type 1.1s steps(13) 0.8s both; }
.phone.armed .ph-emoji .ring { background: none; box-shadow: none; }
.phone.armed.play .ph-emoji .ring { animation: ph-pop 0.4s ease 1.9s both; background: rgba(40, 101, 71, 0.16); box-shadow: inset 0 0 0 2px var(--green); }

/* ---------- Narrow screens ---------- */
@media (max-width: 860px) {
  .iphone-steps .step { grid-template-columns: 1fr; gap: 28px; }
  .iphone-steps .step.flip > div:first-child { order: 0; }
}
@media (max-width: 560px) {
  .iphone-hero .lede-long { display: none; }
  .iphone-hero .lede-short { display: block; }
  .phone-fan { height: 360px; margin-top: 22px; }
  .phone-fan .phone { transform: scale(0.56); }
  .phone-fan .fan-l { transform: translateX(-88px) rotate(-9deg); }
  .phone-fan .fan-r { transform: translateX(88px) rotate(9deg); }
  .iphone-steps .step .phone { transform: rotate(1deg); }
  .iphone-steps .step.flip .phone { transform: rotate(-1deg); }
  .iphone-hero { padding: 36px 0 8px; }
  .iphone-hero .lede { font-size: 17px; }
  .phone { transform-origin: top center; }
}
@media (max-width: 340px) {
  .iphone-steps .step .phone { transform: rotate(1deg) scale(0.9); margin-bottom: -62px; }
  .iphone-steps .step.flip .phone { transform: rotate(-1deg) scale(0.9); }
}
