/* The pinned phone, the sample site inside it, and the cursor that fixes it.
   Everything inside .phone is laid out at a fixed 380 x 760 and scaled as one piece (--s). */

.story-phone {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: start;
  position: sticky;
  top: 18px;
  margin-top: clamp(0.25rem, 1.5vw, 1.25rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  --s: 1;
}

.device-fit {
  position: relative;
  width: calc(380px * var(--s));
  height: calc(760px * var(--s));
}

.phone {
  position: absolute;
  left: 0;
  top: 0;
  width: 380px;
  height: 760px;
  transform: scale(var(--s));
  transform-origin: 0 0;
  border-radius: 60px;
  padding: 11px;
  background: linear-gradient(150deg, #46526f 0%, #1a2238 28%, #0b101e 60%, #2c3750 100%);
  box-shadow:
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.22),
    inset 0 0 0 5px #070b16,
    0 46px 50px -34px rgba(18, 26, 43, 0.65);
  animation: rise 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
}
@keyframes rise { from { opacity: 0; translate: 0 28px; } }

/* hardware buttons */
.sb { position: absolute; width: 4px; border-radius: 2px; background: linear-gradient(90deg, #5a6685, #232c44); }
.sb-action { left: -3px; top: 122px; height: 30px; }
.sb-up { left: -3px; top: 176px; height: 58px; }
.sb-down { left: -3px; top: 246px; height: 58px; }
.sb-power { right: -3px; top: 204px; height: 96px; background: linear-gradient(270deg, #5a6685, #232c44); }

.bezel { position: relative; width: 100%; height: 100%; border-radius: 49px; overflow: hidden; background: #000; }
.screen {
  position: absolute;
  inset: 0;
  background: #fff;
  border-radius: 49px;
  overflow: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #1c2230;
}

.island { position: absolute; top: 11px; left: 50%; width: 112px; height: 32px; margin-left: -56px; border-radius: 20px; background: #000; z-index: 9; }
.island::after { content: ""; position: absolute; right: 14px; top: 10px; width: 11px; height: 11px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #2b3a63, #0a0e1c 70%); }

.statusbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 28px 7px 34px;
  background: #E9EDF2;
  color: #121A2B;
  font-weight: 600;
  font-size: 15px;
  z-index: 6;
}
.sys { display: flex; align-items: center; gap: 6px; }
.sys svg { fill: currentColor; }

/* browser bar */
.chrome {
  position: absolute;
  top: 50px; left: 0; right: 0;
  background: #E9EDF2;
  padding: 0 12px 10px;
  border-bottom: 1px solid #cdd4de;
  z-index: 6;
  font-size: 12px;
}
.crow { display: flex; align-items: center; gap: 8px; }
.crow + .crow { margin-top: 6px; }
.crow > .swap { flex: 1; min-width: 0; position: relative; }
.tab { background: #fff; border-radius: 9px 9px 0 0; height: 32px; padding: 0 11px; font-weight: 600; }
.url { background: #fff; border-radius: 18px; height: 36px; padding: 0 14px; }
.swap { display: grid; }
.swap > span { grid-area: 1 / 1; display: flex; align-items: center; gap: 7px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity 0.4s, transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
.swap > .a { opacity: 0; transform: translateY(6px); }
.swap.fixed > .b, .swap.typing > .b { opacity: 0; }
.swap.fixed > .a, .swap.typing > .a { opacity: 1; transform: none; }
.fav { flex: none; width: 15px; height: 15px; border-radius: 50%; background: #9aa5b5; }
.fav-s { border-radius: 4px; background: var(--tape); color: var(--ink); font: 800 10px/15px var(--display); text-align: center; }
.lock { flex: none; width: 11px; height: 11px; border-radius: 3px; background: #6b778a; }
.url .a.caret::after { content: ""; width: 1.5px; height: 15px; background: var(--ink); margin-left: -4px; animation: blink 0.8s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* the page inside the browser */
.viewport { position: absolute; top: 144px; left: 0; right: 0; bottom: 0; overflow: hidden; background: #fff; }
.page { position: absolute; top: 0; left: 0; right: 0; transform: translateY(var(--py, 0px)); transition: transform 3.2s cubic-bezier(0.45, 0, 0.2, 1); }

.page.fast { transition-duration: 0.6s; }
.rg-header > .b i { font-style: normal; }
.rg {
  position: relative;
  overflow: hidden;
  height: var(--hb);
  transition: height 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.rg.fixed { height: var(--ha); }
.rg > .face {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 100%;
  transition: opacity 0.45s, transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.rg > .a { opacity: 0; transform: translateY(14px); }
.rg.fixed > .a { opacity: 1; transform: none; }
.rg.fixed > .b { opacity: 0; }

/* --- before: a typical free-builder page --- */
.rg-banner > .b { background: #3b3b3b; color: #fff; font-size: 11.5px; padding: 0 46px 0 12px; display: flex; align-items: center; line-height: 1.3; }
.rg-header > .b { background: #fff; border-bottom: 1px solid #d9d9d9; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; font-family: Georgia, "Times New Roman", serif; }
.rg-header > .b strong { font-size: 15px; }
.rg-header > .b span { display: flex; gap: 9px; font: 11.5px system-ui, sans-serif; color: #555; padding-right: 30px; }
.rg-hero > .b { background: linear-gradient(135deg, #b9c2cc, #8d98a5); display: grid; place-items: center; }
.rg-hero > .b span { font: 700 26px Georgia, serif; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.rg-contact > .b { padding: 16px 16px 0; font-size: 14px; }
.rg-contact > .b p { margin: 0 0 8px; max-width: none; }
.rg-social > .b { padding: 22px 16px 0; display: flex; gap: 9px; }
.rg-social > .b i { width: 24px; height: 24px; border-radius: 50%; background: #6b7686; display: block; }
.rg-foot > .b { padding: 22px 16px 0; font-size: 11.5px; color: #6c7482; }

/* --- after: a proper mobile site for the sample business --- */
.rg-header > .a { background: #fff; border-bottom: 2px solid var(--ink); padding: 0 14px; display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 9px; font: 800 15.5px/1 var(--display); color: var(--ink); letter-spacing: -0.01em; }
.logo i { width: 28px; height: 28px; border-radius: 7px; background: var(--tape); display: grid; place-items: center; font: 850 15px var(--display); font-style: normal; }
.burger { width: 40px; height: 40px; border-radius: 9px; border: 2px solid var(--ink); display: grid; place-content: center; gap: 4px; }
.burger i { display: block; width: 18px; height: 2.5px; background: var(--ink); border-radius: 2px; }

.rg-hero > .a { background: var(--denim); color: #fff; padding: 24px 18px 0; overflow: hidden; }
.rg-hero > .a h3 { font: 850 29px/1.04 var(--display); font-stretch: 108%; letter-spacing: -0.02em; max-width: 12em; }
.rg-hero > .a p { font-size: 14.5px; line-height: 1.45; margin: 12px 0 16px; max-width: 26em; color: #E3E9F3; }
.hbtns { display: flex; gap: 10px; }
.hb { display: inline-block; font: 800 14px var(--display); padding: 12px 16px; border-radius: 8px; }
.hb-y { background: var(--tape); color: var(--ink); }
.hb-g { border: 2px solid rgba(255,255,255,.7); color: #fff; padding: 10px 16px; }
.swatches { position: absolute; right: -6px; bottom: -14px; display: flex; transform: rotate(-8deg); }
.swatches i { width: 54px; height: 108px; border-radius: 9px; margin-left: -16px; border: 3px solid #fff; display: block; box-shadow: 0 3px 0 rgba(0,0,0,.12); }
.swatches i:nth-child(1) { background: #FFC61A; transform: rotate(-10deg); }
.swatches i:nth-child(2) { background: #F2EFE9; transform: rotate(-4deg); }
.swatches i:nth-child(3) { background: #C8321F; transform: rotate(2deg); }
.swatches i:nth-child(4) { background: #5C7FB5; transform: rotate(8deg); }
.swatches i:nth-child(5) { background: #121A2B; transform: rotate(14deg); }

.rg-contact > .a { padding: 14px 16px; background: #fff; }
.callcard { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 2px solid var(--ink); border-radius: 12px; padding: 14px; }
.callcard b { display: block; font: 800 16px var(--display); color: var(--ink); }
.callcard small { color: #5a6577; font-size: 12.5px; }
.callbtn { display: inline-block; background: var(--ink); color: #fff; font: 800 13.5px var(--display); padding: 11px 15px; border-radius: 8px; white-space: nowrap; }

.rg-services > .a, .rg-areas > .a { padding: 8px 16px 0; background: #fff; }
.rg h4 { margin: 0 0 8px; font: 850 19px/1.1 var(--display); color: var(--ink); letter-spacing: -0.01em; }
.svc { list-style: none; margin: 0; padding: 0; }
.svc li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 13px 0; border-top: 1px solid #d5dbe4; font-size: 14px; }
.svc b { font: 800 15.5px var(--display); color: var(--ink); }
.svc span { color: #5a6577; text-align: right; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 4px 0 12px; }
.chips span { background: #E9EDF2; border-radius: 16px; padding: 6px 12px; font: 700 12.5px var(--display); color: var(--ink); }
.map {
  height: 104px; border-radius: 12px; position: relative; overflow: hidden;
  background:
    linear-gradient(90deg, transparent 49%, #fff 49% 51%, transparent 51%) 0 0 / 60px 60px,
    linear-gradient(0deg, transparent 47%, #fff 47% 53%, transparent 53%) 0 0 / 60px 52px,
    #d6e1ec;
}
.map::after { content: ""; position: absolute; left: 50%; top: 42%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--red); border: 3px solid #fff; box-shadow: 0 2px 0 rgba(0,0,0,.15); }

.rg-social > .a { padding: 20px 16px 0; display: flex; gap: 10px; background: #fff; }
.soc { display: inline-flex; align-items: center; gap: 8px; border: 2px solid var(--ink); border-radius: 22px; padding: 7px 14px 7px 8px; font: 800 13px var(--display); color: var(--ink); }
.soc i { width: 22px; height: 22px; border-radius: 50%; background: var(--denim); display: block; }
.soc:nth-child(2) i { background: var(--red); }

.rg-foot > .a { background: var(--ink); color: #D5DBE5; padding: 20px 16px 0; font-size: 12.5px; line-height: 1.5; }
.rg-foot > .a .logo { color: #fff; margin-bottom: 10px; }
.rg-foot > .a p { margin: 0 0 4px; max-width: none; }

.callbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4;
  height: 84px; padding: 11px 14px 30px; display: flex; gap: 10px;
  background: #fff; border-top: 1px solid #d3dae3;
  transform: translateY(100%);
  transition: transform 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
.callbar.fixed { transform: none; }
.callbar span { flex: 1; text-align: center; font: 800 14px var(--display); padding: 11px 0; border-radius: 9px; }
.callbar .cb-a { background: var(--ink); color: #fff; }
.callbar .cb-b { background: var(--tape); color: var(--ink); }

.menu-sheet {
  position: absolute; left: 0; right: 0; top: 64px; z-index: 5;
  background: #fff; border-bottom: 2px solid var(--ink);
  padding: 0 16px;
  max-height: 0;
  overflow: hidden;
  border-bottom-width: 0;
  transition: max-height 0.55s cubic-bezier(0.2, 0.9, 0.3, 1), border-bottom-width 0.1s 0.45s;
}
.menu-sheet.open { max-height: 330px; border-bottom-width: 2px; box-shadow: 0 24px 30px -18px rgba(18, 26, 43, 0.45); }
.menu-sheet div { display: flex; justify-content: space-between; align-items: baseline; padding: 11px 0; border-top: 1px solid #d5dbe4; }
.menu-sheet div:first-child { border-top: 0; }
.menu-sheet b { font: 800 16px var(--display); color: var(--ink); }
.menu-sheet small { color: #5a6577; font-size: 12px; }

.homebar { position: absolute; left: 50%; bottom: 7px; width: 130px; height: 5px; margin-left: -65px; border-radius: 3px; background: rgba(18, 26, 43, 0.85); z-index: 12; }
.glass { position: absolute; inset: 0; border-radius: 49px; z-index: 15; pointer-events: none; background: linear-gradient(118deg, rgba(255,255,255,.17) 0%, rgba(255,255,255,0) 26%, rgba(255,255,255,0) 72%, rgba(255,255,255,.07) 100%); }

/* ---------- red markers ---------- */
.mk {
  position: absolute;
  z-index: 3;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font: 700 12.5px/24px var(--display);
  text-align: center;
  transition: background-color 0.3s, box-shadow 0.3s, opacity 0.5s;
}
.rg > .mk { right: 12px; top: 50%; margin-top: -12px; }
.rg-social > .mk { top: 22px; margin-top: 0; }
.rg-foot > .mk { top: 20px; margin-top: 0; }
.crow > .mk { position: static; flex: none; }
.phone:not(.ready) .mk { animation: pop 0.4s cubic-bezier(0.3, 1.5, 0.5, 1) backwards; animation-delay: calc(var(--i, 0) * 150ms + 800ms); }
@keyframes pop { from { transform: scale(0); } }
.mk[data-mk="1"] { --i: 0; } .mk[data-mk="2"] { --i: 1; } .mk[data-mk="3"] { --i: 2; } .mk[data-mk="4"] { --i: 3; }
.mk[data-mk="5"] { --i: 4; } .mk[data-mk="6"] { --i: 5; } .mk[data-mk="7"] { --i: 6; }
.mk.active { box-shadow: 0 0 0 5px rgba(200, 50, 31, 0.28); }
.mk.fixed { background: var(--ink); font-size: 0; box-shadow: 0 0 0 5px rgba(18, 26, 43, 0.15); }
.mk.fixed::before { content: "\2713"; font-size: 13px; }
.phone.ready .mk.fixed { animation: stamp 0.6s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
@keyframes stamp { 0% { transform: scale(1); } 30% { transform: scale(1.7) rotate(-14deg); } 100% { transform: scale(1) rotate(0); } }
.mk.gone { opacity: 0; pointer-events: none; }

/* highlighter sweep over whatever just got fixed */
.flash::after {
  content: "";
  position: absolute; inset: 0;
  z-index: 2;
  background: var(--tape);
  pointer-events: none;
  border-radius: inherit;
  transform-origin: left center;
  animation: sweep 1s cubic-bezier(0.3, 0.7, 0.2, 1) both;
}
@keyframes sweep {
  0% { transform: scaleX(0); opacity: 0.55; }
  45% { transform: scaleX(1); opacity: 0.55; }
  100% { transform: scaleX(1); opacity: 0; }
}

/* ---------- the magic cursor and its fanfare ---------- */
.cursor {
  position: absolute; left: 0; top: 0; z-index: 30;
  width: 26px; height: 26px;
  pointer-events: none;
  transform: translate(var(--cx, 290px), var(--cy, 560px));
  transition: transform 0.95s cubic-bezier(0.3, 0.8, 0.2, 1), opacity 0.3s;
  opacity: 0;
}
.cursor.on { opacity: 1; }
.cursor svg { position: relative; z-index: 2; filter: drop-shadow(0 3px 3px rgba(0,0,0,.28)); transition: transform 0.12s; transform-origin: 3px 2px; }
.cursor.press svg { transform: scale(0.78); }
.cursor .halo { position: absolute; left: -22px; top: -22px; width: 48px; height: 48px; border-radius: 50%; background: radial-gradient(circle, rgba(255,198,26,.65), rgba(255,198,26,0) 68%); animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.25); opacity: .7; } }
.cursor .spark { position: absolute; left: 20px; top: -8px; width: 12px; height: 12px; background: var(--tape); clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); animation: twinkle 1.1s ease-in-out infinite; }
@keyframes twinkle { 50% { transform: scale(0.45) rotate(45deg); opacity: .6; } }

.fx { position: absolute; inset: 0; z-index: 29; pointer-events: none; overflow: hidden; }
.ring { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; border: 3px solid var(--tape); animation: ring 0.75s cubic-bezier(0.2, 0.7, 0.3, 1) forwards; }
.ring.r2 { border-color: var(--ink); border-width: 2px; animation-delay: 0.12s; }
@keyframes ring { from { transform: scale(0.4); opacity: 1; } to { transform: scale(7); opacity: 0; } }
.pt { position: absolute; width: 9px; height: 9px; margin: -4px 0 0 -4px; background: var(--c); animation: fly 0.95s cubic-bezier(0.1, 0.7, 0.3, 1) forwards; }
.pt.round { border-radius: 50%; }
.pt.bar { width: 4px; height: 12px; }
@keyframes fly { from { transform: translate(0, 0) rotate(0) scale(1); opacity: 1; } to { transform: translate(var(--dx), var(--dy)) rotate(var(--r)) scale(0.3); opacity: 0; } }
.tip {
  position: absolute; z-index: 31;
  background: var(--ink); color: #fff;
  font: 800 12.5px var(--display);
  padding: 7px 12px 7px 9px; border-radius: 16px;
  white-space: nowrap;
  display: flex; align-items: center; gap: 7px;
  transform: translate(-50%, -165%);
  animation: tip 2.1s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}
.tip::before { content: "\2713"; display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--tape); color: var(--ink); font-size: 10px; }
@keyframes tip { 0% { opacity: 0; transform: translate(-50%, -110%) scale(0.8); } 10% { opacity: 1; transform: translate(-50%, -165%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -190%); } }

/* ---------- below the phone ---------- */
.progress { display: flex; gap: 4px; width: calc(380px * var(--s)); margin-top: 1rem; }
.progress i {
  flex: 1; height: 8px; background: var(--rule); border-radius: 1px;
  transition: background-color 0.3s, transform 0.4s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.progress i.on { background: var(--ink); }
.progress i.latest { transform: scaleY(1.9); background: var(--tape); box-shadow: inset 0 0 0 1.5px var(--ink); }
.demo-note { margin: 0.9rem 0 0; font-size: 0.95rem; color: var(--muted); width: calc(380px * var(--s)); min-height: 3em; }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .story-phone {
    grid-column: auto; grid-row: auto;
    top: 0;
    z-index: 20;
    margin: 0 calc(var(--gutter) * -1);
    padding: 0.5rem var(--gutter) 0.4rem;
    background: var(--sheet);
    border-bottom: 1px solid var(--rule);
  }
  .progress { margin-top: 0.5rem; }
  .demo-note { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .phone, .phone .mk, .phone.ready .mk.fixed, .flash::after, .cursor .halo, .cursor .spark, .url .a.caret::after { animation: none !important; }
  .page, .rg, .rg > .face, .swap > span, .callbar, .menu-sheet, .mk, .progress i, .cursor { transition: none !important; }
}
