/* Oakrule · installable app (#44). Uses the tokens from app.css (--navy, --ink-*, --ease-*, --shadow-*). */

/* ---------------------------------------------------------------- entry points */
.pwa-nav { display: none !important; } /* redesign: no header install button; footer link + one card on phones */
.pwa-nav { padding: 0; width: 38px; height: 38px; justify-content: center; position: relative; flex: none; }
.pwa-nav .ico { width: 19px; height: 19px; }
.pwa-nav-l { display: none; }
.pwa-nav.ready::after { content: ""; position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--navy); box-shadow: 0 0 0 2px #fff; animation: pwa-dot .5s var(--ease-pop) both; }
@keyframes pwa-dot { from { transform: scale(0); } }
/* the desktop nav row is full (and Chrome shows its own install icon there): footer link + nudge only */
@media (min-width: 981px) and (pointer: fine) { .pwa-nav { display: none; } }
@media (max-width: 640px), (pointer: coarse) and (max-height: 500px) { .pwa-nav { width: 44px; height: 44px; } }
@media (max-width: 374px) { .pwa-nav { display: none; } }
.pwa-nav.pwa-nofit { display: none; }
.pwa-hero { display: flex; align-items: center; gap: 7px; margin: 18px auto 0; border: 0; background: transparent; color: var(--ink-2); font: 560 13.5px var(--sans); padding: 8px 14px; border-radius: 999px; cursor: pointer; transition: background var(--t) var(--ease-std), color var(--t) var(--ease-std), transform .12s var(--ease-std); }
.pwa-hero:hover { background: var(--tint); color: var(--ink); }
.pwa-hero:active { transform: scale(var(--press)); }
.pwa-hero .ico { width: 17px; height: 17px; color: var(--navy); }
.pwa-hero small { font-size: 12.5px; font-weight: 450; color: var(--ink-3); }
.pwa-hero small::before { content: "·"; margin-right: 7px; }
.pwa-nav[hidden], .pwa-foot-link[hidden], .pwa-menu-link[hidden], .pwa-hero[hidden] { display: none !important; }
html.pwa-lock { overflow: hidden; }

/* ---------------------------------------------------------------- sheet */
.pwa-sheet { position: fixed; inset: 0; z-index: 130; display: grid; place-items: center; padding: 24px; background: rgb(0 0 0 / 0); transition: background .25s ease; }
.pwa-sheet.open { background: rgb(0 0 0 / .32); }
.pwa-card { position: relative; width: min(420px, 100%); background: #fff; border-radius: 14px; padding: 22px 22px 18px; box-shadow: 0 24px 64px rgb(0 0 0 / .2); outline: none;
  opacity: 0; transform: translateY(24px) scale(.97); transition: opacity .45s var(--ease-drawer), transform .5s var(--ease-drawer); }
.pwa-sheet.open .pwa-card { opacity: 1; transform: none; }
.pwa-sheet.closing .pwa-card { opacity: 0; transform: translateY(16px) scale(.98); transition-duration: .25s; }
.pwa-grab { display: none; }
.pwa-x { position: absolute; top: 14px; right: 14px; }
.pwa-head { display: flex; align-items: center; gap: 12px; padding-right: 40px; }
.pwa-head h2 { font: 600 20px/1.2 var(--font); letter-spacing: -.02em; margin: 0; }
.pwa-head p { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-3); }
.pwa-app { width: 40px; height: 40px; border-radius: 11px; flex: none; display: block; box-shadow: 0 4px 12px rgb(10 107 68 / .22); }
.pwa-app.lg { width: 56px; height: 56px; border-radius: 15px; }
.pwa-app.xl { width: 84px; height: 84px; border-radius: 22px; box-shadow: 0 14px 34px rgb(10 107 68 / .3); }
.pwa-app.ghost { opacity: .9; box-shadow: none; }

.pwa-bars { display: flex; gap: 5px; margin: 18px 0 14px; }
.pwa-bars i { flex: 1; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.pwa-bars b { display: block; height: 100%; width: 0; background: var(--navy); border-radius: inherit; }
.pwa-bars .full b { width: 100%; transition: width .3s var(--ease-out); }
.pwa-bars .run b { animation: pwa-fill var(--step-ms, 3.8s) linear both; }
@keyframes pwa-fill { to { width: 100%; } }
.pwa-sheet.success .pwa-bars b { width: 100%; background: var(--ok); transition: width .3s, background .3s; }

.pwa-stage { position: relative; height: 372px; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.pwa-slide, .pwa-done { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; text-align: center;
  opacity: 0; transform: translateX(28px); pointer-events: none; transition: opacity .4s var(--ease-out), transform .55s var(--ease-out); }
.pwa-slide.past { transform: translateX(-28px); }
.pwa-slide.on { opacity: 1; transform: none; pointer-events: auto; }
.pwa-slide h3, .pwa-done h3 { display: flex; align-items: center; gap: 10px; margin: 18px 0 4px; font: 600 18px/1.25 var(--sans); letter-spacing: -.01em; }
.pwa-slide p, .pwa-done p { margin: 0; font-size: 13.5px; color: var(--ink-3); max-width: 30ch; }
.pwa-n { width: 24px; height: 24px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 13px; display: grid; place-items: center; flex: none; }
.pwa-copy { margin: 10px auto 0; padding: 7px 14px; font-size: 13px; }
.pwa-copy .ico { width: 15px; height: 15px; }
.pwa-art { height: 278px; width: 100%; display: grid; place-items: center; border-radius: 22px; background: var(--fill); overflow: hidden; }

.pwa-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }
.pwa-foot .pill { padding: 11px 18px; }
.pwa-foot .pill .ico { width: 16px; height: 16px; }
.pwa-foot [data-pwa-back] { padding-left: 12px; }
.pwa-foot [data-pwa-next] { padding-right: 14px; min-width: 116px; justify-content: center; }

/* success */
.pwa-sheet.success .pwa-slide { opacity: 0; transform: scale(.96); pointer-events: none; }
.pwa-sheet.success .pwa-done { opacity: 1; transform: none; justify-content: center; }
.pwa-done-ico { position: relative; }
.pwa-done-ico::before { content: ""; position: absolute; inset: -14px; border-radius: 34px; border: 2px solid var(--ok-ln); opacity: 0; }
.pwa-done-ico > b { position: absolute; right: -10px; bottom: -10px; width: 34px; height: 34px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; box-shadow: 0 0 0 4px #fff; transform: scale(0); }
.pwa-done-ico > b .ico { width: 18px; height: 18px; stroke-width: 2.6; }
.pwa-sheet.success .pwa-done-ico .pwa-app { animation: pwa-pop .7s var(--ease-pop) both; }
.pwa-sheet.success .pwa-done-ico > b { animation: pwa-pop-s .5s .35s var(--ease-pop) both; }
.pwa-sheet.success .pwa-done-ico::before { animation: pwa-burst .9s .3s var(--ease-out) both; }
.pwa-done h3 { font: 600 28px/1.1 var(--font); letter-spacing: -.03em; margin-top: 26px; }
@keyframes pwa-pop { from { transform: scale(.4) rotate(-10deg); opacity: 0; } }
@keyframes pwa-pop-s { to { transform: scale(1); } }
@keyframes pwa-burst { 0% { opacity: .9; transform: scale(.8); } 100% { opacity: 0; transform: scale(1.35); } }

/* mobile: bottom sheet */
@media (max-width: 640px) {
  .pwa-sheet { place-items: end stretch; padding: 0; }
  .pwa-card { width: 100%; border-radius: 14px 14px 0 0; padding: 12px 18px calc(16px + env(safe-area-inset-bottom)); transform: translateY(100%); opacity: 1; transition: transform .5s var(--ease-drawer); }
  .pwa-sheet.closing .pwa-card { transform: translateY(100%); opacity: 1; }
  .pwa-grab { display: block; width: 38px; height: 5px; border-radius: 5px; background: var(--ink-4); margin: 0 auto 12px; opacity: .6; }
  .pwa-x { top: 22px; }
  .pwa-stage { height: min(356px, 52svh); }
  .pwa-art { height: calc(100% - 82px); }
  .pwa-foot .pill { flex: 1; justify-content: center; }
  .pwa-foot [data-pwa-back] { flex: 0 0 auto; }
}

/* ---------------------------------------------------------------- browser mocks (pm-*) */
.pm { position: relative; color: var(--ink); font-size: 11px; }
.pm .ico { width: 18px; height: 18px; }
.pm-phone { width: 190px; height: 236px; border-radius: 30px; background: #fff; box-shadow: 0 0 0 7px #0b1424, 0 0 0 8px #2b3445, 0 24px 50px rgb(1 14 36 / .28); overflow: hidden; display: flex; flex-direction: column; }
.pm-desk { width: 300px; height: 196px; border-radius: 14px; background: #fff; box-shadow: 0 0 0 1px rgb(17 22 20 / .14), 0 24px 50px rgb(1 14 36 / .2); overflow: hidden; display: flex; flex-direction: column; }
.pm-page { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: linear-gradient(180deg, var(--hero), #fff); }
.pm-page.wide { flex-direction: row; justify-content: flex-start; padding: 0 22px; }
.pm-lines { display: grid; gap: 6px; width: 60%; }
.pm-page.wide .pm-lines { width: 50%; }
.pm-lines i { height: 7px; border-radius: 6px; background: rgb(17 22 20 / .09); }
.pm-lines i:nth-child(2) { width: 80%; } .pm-lines i:nth-child(3) { width: 55%; }
.pm-url { display: flex; align-items: center; justify-content: center; gap: 4px; margin: 0 10px 6px; padding: 7px 10px; border-radius: 12px; background: rgb(17 22 20 / .06); font-weight: 560; white-space: nowrap; overflow: hidden; }
.pm-url .ico, .pm-omni .ico { width: 11px; height: 11px; flex: none; }
.pm-url span { overflow: hidden; text-overflow: ellipsis; }
.pm-bar { display: flex; justify-content: space-around; align-items: center; padding: 6px 8px 14px; color: #0a84ff; }
.pm-top { display: flex; align-items: center; gap: 4px; padding: 14px 6px 8px 0; border-bottom: 1px solid var(--line-2); }
.pm-top .pm-url { flex: 1; margin: 0 0 0 10px; }
.pm-top > b, .pm-top > .ico { display: grid; place-items: center; width: 28px; height: 28px; flex: none; }
.pm-hit { position: relative; display: grid; place-items: center; border-radius: 10px; }
b.pm-hit { width: 34px; height: 34px; }
.pwa-tap { position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; background: rgb(10 107 68 / .22); box-shadow: 0 0 0 2px rgb(10 107 68 / .55); pointer-events: none; opacity: 0; }
.pwa-slide.on .pwa-tap { animation: pwa-tap 1.7s .5s var(--ease-out) infinite; }
@keyframes pwa-tap { 0% { transform: scale(.35); opacity: 0; } 18% { opacity: 1; transform: scale(.8); } 30% { transform: scale(.7); } 100% { transform: scale(1.9); opacity: 0; } }

/* lists: iOS share sheet, Chrome menu */
.pm-dim { position: absolute; inset: 0; background: rgb(17 22 20 / .25); }
.pm-sheet { position: absolute; left: 0; right: 0; bottom: 0; top: 26px; background: #f2f2f7; border-radius: 16px 16px 0 0; padding: 10px 8px; overflow: hidden; }
.pm-sheet-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 10px; }
.pm-sheet-head .pwa-app, .pm-dlg-row .pwa-app { width: 30px; height: 30px; border-radius: 8px; box-shadow: none; }
.pm-sheet-head b, .pm-dlg-row b { display: block; font-size: 11.5px; }
.pm-sheet-head span, .pm-dlg-row span { display: block; font-size: 10px; color: var(--ink-3); }
.pm-list { display: grid; gap: 1px; border-radius: 12px; overflow: hidden; background: rgb(17 22 20 / .08); }
.pm-list > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 11px; background: #fff; font-weight: 520; flex-direction: row-reverse; border-radius: 0; }
.pm-list > div .ico { width: 15px; height: 15px; color: var(--ink-2); }
.pm-list > .pm-hit { place-items: initial; display: flex; color: var(--navy); font-weight: 650; }
.pm-list > .pm-hit .ico { color: var(--navy); }
.pm-list > .pm-hit .pwa-tap { left: 78%; }
.pwa-slide.on .pm-list > .pm-hit { animation: pwa-row 1.7s .5s var(--ease-std) infinite; }
@keyframes pwa-row { 0%, 100% { background: #fff; } 22%, 45% { background: #e7edf8; } }
.pwa-slide.on .pm-scroll { animation: pwa-scroll 1.1s .15s var(--ease-out) both; }
@keyframes pwa-scroll { from { transform: translateY(46px); } }
.pm-menu { position: absolute; top: 46px; right: 8px; width: 150px; box-shadow: 0 10px 30px rgb(1 14 36 / .22); }
.pm-menu > div { flex-direction: row; justify-content: flex-start; }
.pm-menu.right { top: 36px; }
.pwa-slide.on .pm-menu { animation: pwa-menu .5s var(--ease-drawer) both; transform-origin: top right; }
@keyframes pwa-menu { from { transform: scale(.85); opacity: 0; } }

/* dialogs */
.pm-dialog { margin: 22px 8px 0; background: #f2f2f7; border-radius: 14px; padding: 8px; box-shadow: 0 8px 24px rgb(1 14 36 / .15); }
.pm-dlg-bar { display: flex; justify-content: space-between; align-items: center; gap: 4px; padding: 4px 4px 10px; font-size: 10px; }
.pm-dlg-bar b { text-align: center; line-height: 1.2; }
.pm-dlg-bar span { color: #0a84ff; }
.pm-dlg-bar em { font-style: normal; color: #0a84ff; font-weight: 700; padding: 4px 6px; }
.pm-dlg-bar em .pwa-tap { width: 28px; height: 28px; margin: -14px 0 0 -14px; }
.pm-dlg-row { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 10px; padding: 8px; text-align: left; }
.pm-home { position: absolute; inset: 0; background: linear-gradient(160deg, #3d5a99, #1a2b52 60%, #0d1730); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-content: start; gap: 14px 10px; padding: 30px 14px; opacity: 0; }
.pm-home > i { aspect-ratio: 1; border-radius: 10px; background: rgb(255 255 255 / .16); }
.pm-new { display: grid; justify-items: center; gap: 3px; }
.pm-new .pwa-app { width: 100%; height: auto; aspect-ratio: 1; border-radius: 10px; box-shadow: 0 4px 10px rgb(0 0 0 / .3); }
.pm-new { min-width: 0; }
.pm-new small { color: #fff; font-size: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pwa-slide.on .pm-dialog { animation: pwa-dlg 4s var(--ease-drawer) both; }
.pwa-slide.on .pm-home { animation: pwa-home 4s var(--ease-out) both; }
.pwa-slide.on .pm-new { animation: pwa-newapp 4s var(--ease-pop) both; }
@keyframes pwa-dlg { 0% { transform: translateY(40px); opacity: 0; } 12%, 52% { transform: none; opacity: 1; } 62%, 100% { transform: translateY(-20px); opacity: 0; } }
@keyframes pwa-home { 0%, 55% { opacity: 0; } 66%, 100% { opacity: 1; } }
@keyframes pwa-newapp { 0%, 64% { transform: scale(0); } 80%, 100% { transform: scale(1); } }
.pm-modal { position: absolute; left: 12px; right: 12px; top: 50%; transform: translateY(-50%); background: #fff; border-radius: 18px; padding: 18px 12px 12px; display: grid; justify-items: center; gap: 3px; box-shadow: 0 16px 40px rgb(1 14 36 / .3); }
.pm-modal b { font-size: 12.5px; margin-top: 6px; }
.pm-modal > span { font-size: 10px; color: var(--ink-3); }
.pm-modal-btns { display: flex; justify-content: flex-end; align-items: center; gap: 14px; width: 100%; margin-top: 12px; font-weight: 600; color: var(--navy); }
.pm-modal-btns em { position: relative; font-style: normal; background: var(--navy); color: #fff; border-radius: 999px; padding: 6px 12px; }
.pwa-slide.on .pm-modal { animation: pwa-modal .55s var(--ease-drawer) both; }
@keyframes pwa-modal { from { transform: translateY(-40%) scale(.9); opacity: 0; } }

/* desktop browser chrome */
.pm-chrome { display: flex; align-items: center; gap: 5px; padding: 9px 10px; background: #f1f3f6; border-bottom: 1px solid var(--line); }
.pm-chrome > i { width: 8px; height: 8px; border-radius: 50%; background: #d4d8df; flex: none; }
.pm-chrome > i:nth-child(1) { background: #ff5f57; } .pm-chrome > i:nth-child(2) { background: #febc2e; } .pm-chrome > i:nth-child(3) { background: #28c840; }
.pm-omni { flex: 1; display: flex; align-items: center; gap: 5px; margin-left: 8px; padding: 5px 4px 5px 10px; background: #fff; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); font-size: 10.5px; min-width: 0; }
.pm-omni span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-omni > .ico:last-child { width: 15px; height: 15px; margin-right: 6px; }
.pm-omni b.pm-hit { width: 24px; height: 24px; }
.pm-omni b.pm-hit .ico { width: 15px; height: 15px; }
.pm-chrome.mac > b.pm-hit { width: 26px; height: 26px; }
.pm-chrome.mac > .ico, .pm-chrome.mac > b .ico { width: 15px; height: 15px; }
.pm-pop { position: absolute; top: 38px; right: 10px; width: 210px; background: #fff; border-radius: 12px; padding: 10px; box-shadow: 0 12px 34px rgb(1 14 36 / .25); }
.pm-pop .pm-dlg-row { padding: 2px; }
.pm-pop .pm-modal-btns { margin-top: 10px; font-size: 10.5px; }
.pwa-slide.on .pm-pop { animation: pwa-menu .5s var(--ease-drawer) both; }
.pm-pill { display: flex; gap: 6px; align-items: center; background: var(--navy); color: #fff; border-radius: 999px; padding: 8px 14px; font-weight: 600; }
.pm-pill .ico { width: 15px; height: 15px; }

/* ---------------------------------------------------------------- nudge (after the first answer) */
.pwa-nudge { position: fixed; z-index: 115; left: 50%; bottom: calc(var(--tabbar-h, 0px) + 14px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(440px, calc(100% - 24px));
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px; background: #fff;
  border-radius: 14px; box-shadow: 0 0 0 1px var(--sep-2), 0 12px 32px rgb(0 0 0 / .14); animation: pwa-nudge-in .25s ease-out both; }
.pwa-nudge.out { animation: pwa-nudge-out .28s cubic-bezier(.4, 0, 1, 1) both; }
.pwa-nudge-t { flex: 1; min-width: 0; display: grid; }
.pwa-nudge-t b { font-size: 14.5px; font-weight: 640; letter-spacing: -.01em; }
.pwa-nudge-t span { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pwa-nudge .pill { padding: 9px 16px; }
.pwa-nudge .icon-btn { width: 32px; height: 32px; background: transparent; }
.pwa-nudge .icon-btn .ico { width: 16px; height: 16px; }
@keyframes pwa-nudge-in { from { opacity: 0; transform: translate(-50%, 30px) scale(.94); } }
@keyframes pwa-nudge-out { to { opacity: 0; transform: translate(-50%, 20px) scale(.96); } }
@media (min-width: 981px) { .pwa-nudge { left: auto; right: 24px; transform: none; width: 380px; } @keyframes pwa-nudge-in { from { opacity: 0; transform: translateY(30px) scale(.94); } } }

/* ---------------------------------------------------------------- offline banner */
.pwa-net { display: flex; justify-content: center; padding: 10px var(--inset) 0; animation: pwa-net-in .45s var(--ease-out) both; }
.pwa-net-pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 560; background: var(--unk-bg); color: var(--unk); box-shadow: inset 0 0 0 1px var(--unk-ln); }
.pwa-net-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pwa-net[data-kind="online"] .pwa-net-pill { background: var(--ok-bg); color: var(--ok); box-shadow: inset 0 0 0 1px var(--ok-ln); }
@keyframes pwa-net-in { from { opacity: 0; } }

/* ---------------------------------------------------------------- toasts */
.pwa-update { padding-right: 6px; }
.pwa-update > .ico { color: #93c5fd; }
.pwa-refresh { border: 0; border-radius: 999px; background: #fff; color: var(--ink); font: 600 13.5px var(--sans); padding: 7px 14px; cursor: pointer; margin-left: 4px; }
.pwa-refresh:active { transform: scale(var(--press)); }
.pwa-tx { border: 0; background: transparent; color: rgb(255 255 255 / .6); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.pwa-tx .ico { width: 15px; height: 15px; color: inherit; }
.pwa-welcome { padding-left: 8px; }
.pwa-welcome .pwa-app { width: 28px; height: 28px; border-radius: 8px; box-shadow: none; }

@media (prefers-reduced-motion: reduce) {
  .pwa-slide.on .pwa-tap { animation: none; opacity: 1; transform: scale(.9); }
  .pwa-slide.on .pm-dialog, .pwa-slide.on .pm-home, .pwa-slide.on .pm-new { animation: none; }
  .pwa-slide.on .pm-home { opacity: 0; }
}

/* never over the Listen captions or the Ask dock (iPhone QA) */
.pwa-nudge { bottom: calc(var(--tabbar-h, 0px) + var(--dock-h, 0px) + 14px + env(safe-area-inset-bottom)) !important; }
html:has(.ce-cap-open) .pwa-nudge { display: none; }
.pwa-nudge .icon-btn { width: 44px; height: 44px; }
