/* =====================================================================
   Clickable prototype chrome.

   Loaded on top of design.css. design.css owns how a screen LOOKS; this
   file owns how the prototype BEHAVES around it — the device shell, the
   screen transitions and the index drawer.

   The governing rule: on a phone there is no shell at all. The app fills
   the viewport, because the client opening this on their handset should
   be looking at the product, not at a picture of the product on a page.
   The device frame only appears on screens wide enough to need one.
   ===================================================================== */

html,
body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
body.proto {
  background: var(--p-bg);
  display: grid;
  place-items: center;
}

/* ---------------------------------------------------- device shell --- */
.device {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: none;
  background: var(--a-bg);
  color: var(--a-ink);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Desktop: put it back in a phone. */
@media (min-width: 720px) {
  body.proto {
    padding: 22px;
  }
  .device {
    width: 390px;
    height: min(844px, calc(100vh - 44px));
    border-radius: 42px;
    border: 10px solid #080b09;
    box-shadow:
      0 2px 4px rgba(0, 0, 0, 0.5),
      0 26px 60px rgba(0, 0, 0, 0.55);
  }
  .device .notch {
    display: block;
  }
}
.device .notch {
  display: none;
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 104px;
  height: 23px;
  background: #080b09;
  border-radius: 999px;
  z-index: 40;
}

/* status bar sits above the screen and never moves */
.proto-status {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  padding: 11px 22px 5px;
  font-size: 11.5px;
  font-weight: 600;
  font-family: "IBM Plex Mono", monospace;
  background: var(--a-card);
  color: var(--a-ink);
  padding-top: max(11px, env(safe-area-inset-top));
  z-index: 20;
}
.proto-status.dark {
  background: var(--a-ussd);
  color: var(--a-ussd-ink);
}

/* ------------------------------------------------------- viewport --- */
.viewport {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.page {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--a-bg);
  overflow: hidden;
}
.page .scr {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overflow: auto;
}
.page .scr::-webkit-scrollbar {
  width: 0;
}
.page .tabbar {
  padding-bottom: max(13px, env(safe-area-inset-bottom));
}

/* slide transitions — the single strongest cue that this is an app */
.page.in-r {
  animation: inR 0.26s cubic-bezier(0.32, 0.72, 0, 1) both;
}
.page.out-l {
  animation: outL 0.26s cubic-bezier(0.32, 0.72, 0, 1) both;
}
.page.in-l {
  animation: inL 0.26s cubic-bezier(0.32, 0.72, 0, 1) both;
}
.page.out-r {
  animation: outR 0.26s cubic-bezier(0.32, 0.72, 0, 1) both;
}
@keyframes inR {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}
@keyframes outL {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-26%);
    opacity: 0.55;
  }
}
@keyframes inL {
  from {
    transform: translateX(-26%);
    opacity: 0.55;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
@keyframes outR {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(100%);
  }
}
@media (prefers-reduced-motion: reduce) {
  .page.in-r,
  .page.out-l,
  .page.in-l,
  .page.out-r {
    animation: none;
  }
}

/* -------------------------------------------------- tap affordance --- */
[data-go] {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
[data-go]:active {
  filter: brightness(0.94);
}
.abtn[data-go]:active {
  transform: scale(0.985);
}
.li[data-go]:active,
.arow[data-go]:active {
  background: rgba(11, 107, 79, 0.06);
}
.tabbar div[data-go]:active {
  opacity: 0.6;
}

/* ------------------------------------------------------ USSD page --- */
.page.ussd-page {
  background: var(--a-ussd);
}
.page.ussd-page .ussd {
  overflow-y: auto;
}

/* --------------------------------------------------- index drawer --- */
.proto-fab {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 60;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--p-line-2);
  background: rgba(13, 19, 16, 0.9);
  color: var(--p-ink);
  font-size: 17px;
  display: grid;
  place-items: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
@media (min-width: 720px) {
  .proto-fab {
    right: 20px;
    bottom: 20px;
  }
}
.drawer {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(8, 11, 9, 0.82);
  backdrop-filter: blur(6px);
  display: none;
  overflow-y: auto;
  padding: 22px 18px 40px;
}
.drawer[open] {
  display: block;
}
.drawer-in {
  max-width: 720px;
  margin: 0 auto;
  background: var(--p-bg-2);
  border: 1px solid var(--p-line);
  border-radius: 16px;
  padding: 22px;
  color: var(--p-ink);
}
.drawer h2 {
  font-family: Fraunces, Georgia, serif;
  font-weight: 600;
  font-size: 1.2rem;
  margin: 0 0 4px;
}
.drawer .sub {
  font-size: 12.6px;
  color: var(--p-mut);
  margin: 0 0 18px;
}
.drawer .grp {
  font-size: 10.4px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--p-mut);
  font-weight: 600;
  margin: 18px 0 8px;
}
.drawer ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
  gap: 4px;
}
.drawer li a {
  display: flex;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--p-ink-2);
  font-size: 13px;
}
.drawer li a:hover {
  background: var(--p-panel);
  color: var(--p-ink);
}
.drawer li a.on {
  background: rgba(79, 190, 147, 0.14);
  color: var(--p-ink);
  font-weight: 600;
}
.drawer li a .n {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.6px;
  color: var(--p-mut);
  flex: 0 0 auto;
}
.drawer .close {
  float: right;
  border: 1px solid var(--p-line-2);
  background: transparent;
  color: var(--p-ink-2);
  border-radius: 8px;
  padding: 5px 11px;
  font-size: 12.4px;
  cursor: pointer;
}
.drawer .foot-links {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--p-line);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
}
.drawer .foot-links a {
  color: var(--p-green);
  text-decoration: none;
  font-weight: 600;
}

/* the note that keeps this honest — shown once, on the first screen */
.proto-hint {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 30;
  background: rgba(13, 19, 16, 0.92);
  border: 1px solid var(--p-line-2);
  border-radius: 12px;
  padding: 11px 13px;
  color: var(--p-ink-2);
  font-size: 11.8px;
  line-height: 1.5;
  backdrop-filter: blur(8px);
}
.proto-hint b {
  color: var(--p-gold);
}
.proto-hint.gone {
  display: none;
}

/* ------------------------------------------------- desktop prototype --- */
/* The portals are desktop software. Framing them in a phone would be a lie,
   so on a wide screen they fill a browser-shaped shell instead. */
body.proto-desk .device {
  /* must set width, not just max-width: the phone rule above sets an explicit
     390px and a max-width alone can never beat it. */
  width: min(1180px, 100%);
  max-width: 1180px;
  height: min(760px, calc(100vh - 44px));
  border-radius: 12px;
  border: 9px solid #080b09;
  background: var(--a-bg);
}
body.proto-desk .device .notch {
  display: none;
}
body.proto-desk .proto-status {
  background: #080b09;
  color: #7e8d84;
  font-size: 10.6px;
  padding: 6px 14px;
  border-bottom: 1px solid #1b241e;
}
body.proto-desk .page .sb-body {
  overflow-y: auto;
}
body.proto-desk .page .laptop-in {
  border-radius: 0;
}
@media (max-width: 719px) {
  body.proto-desk .device {
    border: none;
    border-radius: 0;
    height: 100%;
  }
  body.proto-desk .page .laptop-in {
    flex-direction: column;
  }
  body.proto-desk .page .sb-nav {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    padding: 8px;
    gap: 4px;
  }
  body.proto-desk .page .sb-nav .bd {
    display: none;
  }
  body.proto-desk .page .sb-nav a {
    white-space: nowrap;
    border-radius: 7px;
  }
}

/* table rows are navigation targets in the admin console */
table.at tbody tr[data-go]:hover {
  background: rgba(11, 107, 79, 0.05);
}
table.at tbody tr[data-go]:active {
  background: rgba(11, 107, 79, 0.09);
}
