/* Interactive demos, modelled on the PDF Scanner app (Dashboard, VisionKit scanner, Preview, Signature, Page Editor).
   Colours mirror Colors.swift; the app uses Urbanist. */

/* ---------- iPhone ---------- */
.iphone {
  --frame: 12px;
  position: relative; width: 340px; max-width: calc(100vw - 56px); aspect-ratio: 340 / 720;
  padding: var(--frame); border-radius: 60px;
  background: linear-gradient(145deg, #5b5d63 0%, #2b2c30 18%, #1a1b1e 50%, #2e2f33 82%, #6a6c72 100%);
  box-shadow:
    inset 0 0 0 1.5px rgba(255,255,255,.18),
    inset 0 0 0 4px #0b0b0c,
    0 50px 90px -30px rgba(15, 30, 80, .55),
    0 18px 36px -18px rgba(0, 0, 0, .45);
  font-family: "Urbanist", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  -webkit-user-select: none; user-select: none; color-scheme: light; text-align: left;
  -webkit-tap-highlight-color: transparent;
}
/* side buttons: action + volume on the left, power on the right */
.iphone .btn-side { position: absolute; width: 4px; border-radius: 2px; background: linear-gradient(90deg, #45464b, #1c1d20); }
.iphone .btn-side.action { left: -3px; top: 15%; height: 4.5%; }
.iphone .btn-side.vol-up { left: -3px; top: 23%; height: 8%; }
.iphone .btn-side.vol-down { left: -3px; top: 33%; height: 8%; }
.iphone .btn-side.power { right: -3px; top: 27%; height: 13%; background: linear-gradient(270deg, #45464b, #1c1d20); }

.iscreen {
  position: absolute; inset: var(--frame); border-radius: 48px; overflow: hidden;
  -webkit-mask-image: -webkit-radial-gradient(white, black); /* clip rounded corners in Safari during transforms */
  background: #F7F7F7; color: #101010; isolation: isolate;
}
.island { position: absolute; z-index: 30; top: 11px; left: 50%; transform: translateX(-50%); width: 34%; height: 32px; border-radius: 20px; background: #000; pointer-events: none; }

.sb {
  position: absolute; z-index: 25; top: 0; left: 0; right: 0; height: 54px; display: flex; align-items: center; justify-content: space-between;
  padding: 4px 28px 0 40px; font-size: 16px; font-weight: 600; letter-spacing: -.01em; pointer-events: none; color: #000;
}
.sb.light { color: #fff; }
.sb .right { display: flex; gap: 6px; align-items: center; }
.sb svg { display: block; fill: currentColor; }

.app { position: absolute; inset: 0; display: flex; flex-direction: column; padding-top: 54px; }
.app.dark { background: #0F0F0F; color: #fff; }
.scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.scroll::-webkit-scrollbar { display: none; }
.home-ind { position: absolute; z-index: 45; bottom: 7px; left: 50%; transform: translateX(-50%); width: 36%; height: 5px; border-radius: 3px; background: #000; opacity: .85; pointer-events: none; }
.home-ind.light { background: #fff; }

.tap { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.tap:focus-visible { outline: 2px solid #FE0719; outline-offset: 2px; border-radius: 10px; }

/* nav pieces */
.circle-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.06); flex: none; }
.dark .circle-btn, .arch-view .circle-btn { background: rgba(255,255,255,.1); box-shadow: none; color: #fff; }
.chev { width: 10px; height: 10px; border-left: 2.4px solid currentColor; border-bottom: 2.4px solid currentColor; transform: translateX(2px) rotate(45deg); border-radius: 1px; }
.pill { background: #fff; border-radius: 999px; box-shadow: 0 2px 10px rgba(0,0,0,.06); padding: 9px 14px; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; }

/* iOS alert */
.ios-dim { position: absolute; inset: 0; z-index: 40; background: rgba(0,0,0,.35); display: grid; place-items: center; animation: fadeIn .18s ease; }
.ios-alert { width: 76%; border-radius: 16px; overflow: hidden; background: rgba(242,242,247,.97); color: #000; text-align: center; animation: pop .22s cubic-bezier(.2,.9,.3,1.2); }
.ios-alert .body { padding: 18px 16px 16px; }
.ios-alert h5 { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.25; }
.ios-alert p { margin: 4px 0 0; font-size: 13px; line-height: 1.3; }
.ios-alert .btns { display: flex; border-top: .5px solid rgba(60,60,67,.3); }
.ios-alert .btns button { flex: 1; padding: 12px 6px; font-size: 16px; color: #007AFF; font-family: inherit; background: none; border: 0; cursor: pointer; }
.ios-alert .btns button + button { border-left: .5px solid rgba(60,60,67,.3); }
.ios-alert .btns .bold { font-weight: 600; }
.ios-alert .btns .destructive { color: #FF3B30; }
.ios-alert .btns button:active { background: rgba(0,0,0,.06); }
.ios-alert .thumbs { display: flex; justify-content: center; gap: 4px; margin-top: 12px; }
.ios-alert .thumbs i { width: 34px; height: 34px; border-radius: 6px; background: #ccc center / cover; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes pop { from { transform: scale(1.12); opacity: 0; } }
@keyframes slideUp { from { transform: translateY(100%); } }

/* toast */
.toast { position: absolute; z-index: 60; pointer-events: none; left: 50%; bottom: 100px; transform: translateX(-50%); width: 84%; background: rgba(28,28,30,.94); color: #fff; border-radius: 16px; padding: 12px 14px; font-size: 13px; line-height: 1.35; text-align: center; animation: toastIn .3s ease; }
.toast b { display: block; font-size: 15px; margin-bottom: 2px; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } }

/* ---------- Demo switch (iOS segmented control above the phone) ---------- */
.demo-seg {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; width: 340px; max-width: calc(100vw - 56px);
  padding: 3px; border-radius: 14px; background: color-mix(in srgb, var(--text) 8%, transparent);
}
.demo-seg button {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); background: none; border: 0;
  padding: 8px 6px; border-radius: 11px; cursor: pointer; white-space: nowrap; transition: background .2s, color .2s, box-shadow .2s;
}
.demo-seg button svg { width: 16px; height: 16px; flex: none; }
.demo-seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.12), 0 0 0 .5px rgba(0,0,0,.04); }
.demo-seg button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
@media (max-width: 380px) { .demo-seg button svg { display: none; } }


/* ---------- PDF app screens ---------- */
.app { background: #F7F7F7; color: #373334; }
.red { color: #FE0719; }
.rbtn { display: flex; align-items: center; justify-content: center; width: 100%; height: 52px; border-radius: 13px; background: #FE0719; color: #fff; font-weight: 700; font-size: 14px; transition: transform .12s, opacity .2s; }
.rbtn:active { transform: scale(.96); }
.rbtn:disabled { opacity: .2; cursor: default; transform: none; }
.wbtn { display: flex; align-items: center; justify-content: center; width: 100%; height: 52px; border-radius: 13px; background: #fff; color: #373334; font-weight: 700; font-size: 14px; }
.foot { padding: 10px 13px 28px; flex: none; }

/* nav bars */
.dnav { display: flex; align-items: center; justify-content: space-between; padding: 4px 14px 10px; }
.dnav .t b { display: block; font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.dnav .t small { display: block; font-size: 10px; font-weight: 700; color: #969495; margin-top: 1px; }
.gear { width: 34px; height: 34px; display: grid; place-items: center; color: #373334; }
.gear svg { width: 22px; height: 22px; }
.pnav { display: grid; grid-template-columns: 70px 1fr 70px; align-items: center; padding: 4px 12px 10px; }
.pnav .back { width: 30px; height: 30px; display: grid; place-items: center; color: #373334; }
.pnav .back svg { width: 20px; height: 20px; }
.pnav .t { text-align: center; min-width: 0; }
.pnav .t b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pnav .t small { display: block; font-size: 10px; font-weight: 500; color: #969495; }
.pnav .acts { display: flex; gap: 6px; justify-content: flex-end; }
.sq { width: 30px; height: 30px; border-radius: 8px; background: #FE0719; color: #fff; display: grid; place-items: center; }
.sq svg { width: 17px; height: 17px; }

/* dashboard */
.search { margin: 0 13px 10px; height: 43px; border-radius: 13px; background: #fff; display: flex; align-items: center; gap: 8px; padding: 0 12px; color: #969495; font-size: 13px; font-weight: 500; }
.search svg { width: 15px; height: 15px; }
.search.off { opacity: .5; }
.dhead { display: flex; justify-content: space-between; align-items: center; padding: 2px 15px 8px; }
.dhead b { font-size: 15px; font-weight: 700; }
.dhead .sortb { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: #373334; }
.dhead svg { width: 13px; height: 13px; }
.dlist { padding: 0 13px; display: grid; gap: 9px; }
.dcell { display: flex; align-items: center; gap: 11px; background: #fff; border-radius: 13px; padding: 8px 10px; animation: cellIn .45s cubic-bezier(.2,.9,.3,1.2); }
@keyframes cellIn { from { transform: translateY(18px); opacity: 0; } }
.dcell .th { width: 48px; height: 62px; border-radius: 4px; background: #fff center / contain no-repeat; box-shadow: 0 0 0 1px #E7E6E6; flex: none; }
.dcell .nm { flex: 1; min-width: 0; }
.dcell .nm b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dcell .nm small { display: block; font-size: 11px; font-weight: 500; margin-top: 3px; }
.dcell .nm small + small { color: #969495; margin-top: 1px; }
.more { width: 28px; height: 28px; display: grid; place-items: center; color: #FE0719; }
.more svg { width: 18px; height: 18px; }
.dempty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 30px 30px; color: #969495; }
.dempty img { width: 150px; height: auto; margin-bottom: 8px; }
.dempty b { font-size: 16px; font-weight: 700; }
.dempty p { margin: 6px 0 0; font-size: 14px; font-weight: 500; line-height: 1.35; }

/* bottom sheet card (BottomViewCard) */
.bsheet { position: absolute; inset: 0; z-index: 38; background: rgba(0,0,0,.5); display: flex; align-items: flex-end; animation: fadeIn .2s; }
.bsheet .card { width: 100%; background: #fff; border-radius: 16px 16px 0 0; padding: 8px 13px 30px; display: grid; gap: 12px; animation: slideUp .28s cubic-bezier(.2,.8,.2,1); }
.bsheet .grab { width: 32px; height: 4px; border-radius: 2px; background: #D1D1D6; margin: 0 auto 6px; }
.bsheet .rbtn { border-radius: 14px; }

/* VisionKit-style document camera */
.cam { position: absolute; inset: 0; z-index: 20; background: #000; color: #fff; display: flex; flex-direction: column; padding-top: 54px; }
.cam .top { display: flex; justify-content: space-between; align-items: center; padding: 6px 16px 10px; font-size: 14px; }
.cam .top .pill { background: rgba(255,255,255,.18); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; }
.cam .view { position: relative; flex: 1; min-height: 0; overflow: hidden; display: grid; place-items: center; }
.cam .shot { position: relative; height: 100%; max-width: 100%; aspect-ratio: 9 / 16; background: #222 center / cover no-repeat; transition: background-image .2s; }
.cam .shot svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.cam .shot polygon { fill: rgba(10,132,255,.25); stroke: #0A84FF; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; transition: opacity .35s; }
.cam .flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.cam .flash.go { animation: camFlash .35s ease-out; }
@keyframes camFlash { 0% { opacity: .9; } 100% { opacity: 0; } }
.cam .hintc { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); background: rgba(0,0,0,.55); border-radius: 8px; padding: 5px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.cam .bar { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 14px 18px 30px; }
.shutter { width: 64px; height: 64px; border-radius: 50%; border: 4px solid #fff; display: grid; place-items: center; }
.shutter i { width: 50px; height: 50px; border-radius: 50%; background: #fff; transition: transform .1s; }
.shutter:active i { transform: scale(.88); }
.cam .thumbs { justify-self: start; position: relative; width: 40px; height: 52px; }
.cam .thumbs i { position: absolute; inset: 0; background: #fff center / cover; border-radius: 3px; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.cam .thumbs span { position: absolute; right: -8px; top: -8px; min-width: 18px; height: 18px; border-radius: 9px; background: #0A84FF; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.cam .save { justify-self: end; font-size: 15px; font-weight: 600; color: #fff; }
.cam .save:disabled { opacity: .35; cursor: default; }
.flyin { position: absolute; z-index: 5; background: #fff center / cover; transition: all .45s cubic-bezier(.4,0,.2,1); box-shadow: 0 4px 14px rgba(0,0,0,.5); }

/* preview */
.pv { position: relative; flex: 1; min-height: 0; margin: 0 0 10px; overflow: hidden; }
.pv .blur { position: absolute; inset: -30px; background: center / cover; filter: blur(16px) saturate(1.1); opacity: .9; }
.pv .pages { position: absolute; inset: 0; overflow-y: auto; scroll-snap-type: y mandatory; scrollbar-width: none; }
.pv .pages::-webkit-scrollbar { display: none; }
.pv .pg { height: 100%; scroll-snap-align: start; display: grid; place-items: center; container-type: size; }
.pv .pg .sheet { position: relative; width: min(100cqw - 56px, (100cqh - 40px) * .7576); aspect-ratio: 750 / 990; background: #fff center / contain no-repeat; box-shadow: 0 6px 18px rgba(0,0,0,.25); transition: transform .35s ease; }
.pv .pg .sheet .sig { position: absolute; pointer-events: none; }
.pv .chip { position: absolute; left: 12px; bottom: 12px; min-width: 32px; height: 32px; padding: 0 6px; border-radius: 10px; background: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.pv .side { position: absolute; right: 12px; bottom: 12px; display: grid; gap: 7px; }
.pv .side button { width: 40px; height: 40px; border-radius: 10px; background: #fff; display: grid; place-items: center; color: #373334; }
.pv .side button.del { color: #FE0719; }
.pv .side svg { width: 19px; height: 19px; }
.tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; padding: 0 13px; flex: none; }
.tool { height: 58px; border-radius: 13px; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 9px; font-weight: 700; color: #373334; }
.tool svg { width: 20px; height: 20px; }
.tool.hl { box-shadow: 0 0 0 2px #FE0719; animation: hlPulse 1.4s ease-in-out infinite; }
@keyframes hlPulse { 50% { box-shadow: 0 0 0 4px rgba(254,7,25,.35); } }
.fill { flex: 1; }

/* signature sheet */
.ssheet { position: absolute; inset: 0; z-index: 30; background: rgba(0,0,0,.3); display: flex; align-items: flex-end; animation: fadeIn .2s; }
.ssheet .card { width: 100%; height: calc(100% - 46px); background: #F7F7F7; border-radius: 13px 13px 0 0; display: flex; flex-direction: column; animation: slideUp .3s cubic-bezier(.2,.8,.2,1); }
.ssheet .grab { width: 32px; height: 4px; border-radius: 2px; background: #C7C7CC; margin: 6px auto 8px; flex: none; }
.ssheet h5 { margin: 0 0 10px; text-align: center; font-size: 14px; font-weight: 700; }
.canvas-wrap { position: relative; margin: 0 13px; height: 260px; background: #fff; border-radius: 10px; flex: none; touch-action: none; }
.canvas-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 10px; cursor: crosshair; touch-action: none; }
.canvas-wrap .line { position: absolute; left: 22px; right: 22px; bottom: 62px; border-top: 2px dashed #D9D7D8; pointer-events: none; }
.canvas-wrap .ph { position: absolute; left: 0; right: 0; top: 42%; text-align: center; font-size: 13px; font-weight: 600; color: #B9B7B8; pointer-events: none; }
.canvas-wrap .undo { position: absolute; right: 8px; top: 8px; width: 30px; height: 30px; border-radius: 8px; background: #F7F7F7; display: grid; place-items: center; color: #373334; }
.canvas-wrap .undo svg { width: 16px; height: 16px; }
.srow { display: flex; align-items: center; gap: 10px; padding: 14px 18px 0; }
.srow > svg { width: 20px; height: 20px; color: #373334; flex: none; }
.dot { width: 24px; height: 24px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.dot.on { box-shadow: 0 0 0 2.5px #F7F7F7, 0 0 0 4.5px #373334; }
.wheel { background: conic-gradient(red, yellow, lime, aqua, blue, magenta, red); }
.srow input[type=range] { flex: 1; accent-color: #373334; }

/* signature preview */
.sp { position: relative; flex: 1; min-height: 0; margin: 0 0 10px; overflow: hidden; display: grid; place-items: center; touch-action: none; container-type: size; }
.sp .sheet { position: relative; width: min(100cqw - 32px, (100cqh - 20px) * .7576); aspect-ratio: 750 / 990; background: #fff center / contain no-repeat; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.sp .sigbox { position: absolute; cursor: grab; touch-action: none; outline: 1.5px dashed #FE0719; outline-offset: 3px; border-radius: 2px; }
.sp .sigbox img { width: 100%; height: 100%; display: block; pointer-events: none; }
.sp .sigbox .rs { position: absolute; right: -9px; bottom: -9px; width: 16px; height: 16px; border-radius: 50%; background: #FE0719; border: 2px solid #fff; cursor: nwse-resize; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* page editor */
.ed { position: relative; flex: 1; min-height: 0; overflow: hidden; display: grid; place-items: center; container-type: size; }
.ed .sheet { width: min(100cqw - 40px, (100cqh - 20px) * .7576); aspect-ratio: 750 / 990; background: #fff center / contain no-repeat; box-shadow: 0 6px 18px rgba(0,0,0,.18); transition: filter .25s; }
/* all five filters fit side by side; long (translated) names wrap onto two lines instead of being cut off */
.chips { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; padding: 0 13px 10px; flex: none; }
.chip2 { min-width: 0; height: 44px; padding: 0 3px; border-radius: 11px; background: #fff; font-size: 9.5px; font-weight: 700; line-height: 1.15; color: #373334; display: grid; place-items: center; text-align: center; overflow-wrap: anywhere; hyphens: auto; }
.chip2.on { box-shadow: inset 0 0 0 2px #373334; }
.eslider { height: 44px; margin: 0 13px 10px; padding: 0 14px; border-radius: 11px; background: #fff; display: flex; align-items: center; gap: 10px; font-size: 11px; font-weight: 700; flex: none; }
.eslider input { flex: 1; accent-color: #373334; }
.etools { display: grid; grid-template-columns: 1fr 1fr 1fr 1.3fr; gap: 7px; padding: 0 13px 28px; flex: none; }
.etool { height: 54px; border-radius: 12px; background: #fff; color: #373334; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 9px; font-weight: 700; }
.etool svg { width: 19px; height: 19px; }
.etool.on { background: #373334; color: #fff; }
.etools .rbtn { height: 54px; border-radius: 14px; }

@media (prefers-reduced-motion: reduce) {
  .dcell, .bsheet, .bsheet .card, .ssheet .card, .cam .flash.go, .tool.hl, .flyin { animation: none !important; transition: none !important; }
}
/* rename field inside the iOS alert */
.ios-input { display: block; width: 100%; margin-top: 10px; height: 28px; border-radius: 6px; border: .5px solid rgba(0,0,0,.25); background: #fff; padding: 0 6px; font: inherit; font-size: 13px; color: #000; }
.bsheet .wbtn { background: #F7F7F7; }
.bsheet .wbtn.danger { color: #FE0719; }
.tap.hl, .rbtn.hl { animation: hlPulseBtn 1.4s ease-in-out infinite; }
@keyframes hlPulseBtn { 50% { box-shadow: 0 0 0 6px rgba(254,7,25,.25); } }
/* browsers without container query units (before Safari 16) */
@supports not (width: 1cqw) {
  .pv .pg .sheet, .sp .sheet, .ed .sheet { width: auto; height: 86%; }
}
/* idle tour cursor */
.tcursor { position: absolute; z-index: 100; left: 0; top: 0; width: 22px; height: 26px; margin: -2px 0 0 -3px; pointer-events: none; opacity: 0; filter: drop-shadow(0 3px 4px rgba(0,0,0,.35)); transition-property: left, top; transition-timing-function: cubic-bezier(.45,.05,.25,1); }
.tcursor.show { opacity: 1; transition-property: left, top, opacity; }
.tcursor svg { display: block; width: 100%; height: 100%; transform-origin: 4px 3px; transition: transform .12s; }
.tcursor.down svg { transform: scale(.88); }
.tcursor.press svg { animation: tPress .3s ease; }
.tcursor i { position: absolute; left: 4px; top: 3px; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; border: 2px solid rgba(254, 7, 25, .75); opacity: 0; }
.tcursor.press i { animation: tRing .45s ease-out; }
@keyframes tPress { 40% { transform: scale(.8); } }
@keyframes tRing { from { opacity: 1; transform: scale(.3); } to { opacity: 0; transform: scale(1.3); } }
@media (prefers-reduced-motion: reduce) { .tcursor { display: none; } }
[hidden] { display: none !important; }
