/* The library on a phone: a reel feed (mobile.js).
 *
 * Nine parts in a fixed order, bottom to top: the feed, the rail, the systems row, the hint, the
 * top strip, the scrim, the sheet, the full page, the toast. The reel is a picture: dark ground in
 * its system's colour, white words, the same in light and dark. Anything that is read at length
 * (About, a system's list, Try it) is an opaque panel in the page's own theme. */

.m{
  --top-h:52px; --nav-h:66px; --rail-w:72px;
  position:fixed; inset:0; z-index:100; overflow:hidden; background:#0b0d14; color:#fff;
  font:500 15px/21px var(--ui);
}
body.is-m .app,body.is-m .pop{ display:none }
:where(.m button){ font:inherit; color:inherit; background:none; border:0; padding:0; cursor:pointer; text-align:inherit }

/* the feed: one design per screen; a flick moves exactly one */
.mfeed{ position:absolute; inset:0; overflow-y:auto; scroll-snap-type:y mandatory; overscroll-behavior:contain;
  scrollbar-width:none }
.mfeed::-webkit-scrollbar{ display:none }
.reel{ position:relative; height:100%; scroll-snap-align:start; scroll-snap-stop:always; display:flex; flex-direction:column;
  padding:calc(var(--top-h) + 6px) 0 calc(var(--nav-h) + 14px);
  background:
    radial-gradient(90% 55% at 50% 28%,color-mix(in srgb,var(--h) 62%,#0b0d14) 0,transparent 72%),
    linear-gradient(180deg,color-mix(in srgb,var(--h) 34%,#0b0d14) 0%,#0b0d14 78%) }

/* the design itself, the picture of the reel */
.shot{ flex:1; min-height:0; display:grid; place-items:center; padding:6px var(--rail-w) 18px }
/* a desktop window is wide and short: it takes the full width, and sits above the rail */
.m.desk .shot{ padding:14px 14px 18px; place-items:start center }
.dev{ position:relative; overflow:hidden; border-radius:30px; background:#fff;
  box-shadow:0 0 0 6px #050608,0 0 0 7px rgba(255,255,255,.14),0 26px 50px -12px rgba(0,0,0,.7) }
.dev.desk{ border-radius:10px; box-shadow:0 0 0 1px rgba(255,255,255,.18),0 26px 50px -12px rgba(0,0,0,.7) }
.dev:empty{ background:color-mix(in srgb,var(--h) 30%,#1a1d27) }
.dev iframe{ position:absolute; top:0; left:0; border:0; display:block; transform-origin:0 0; pointer-events:none; background:#fff }
.dev.bare iframe,.dev.desk iframe{ background:transparent }

/* the words: bottom-anchored, clear of the rail by exactly its width */
.txt{ flex:none; padding:0 var(--rail-w) 0 20px }
.kick{ display:flex; align-items:center; gap:7px; margin:0 0 4px; font:600 13px/18px var(--ui); color:rgba(255,255,255,.86) }
.kick i{ width:9px; height:9px; border-radius:50%; background:color-mix(in srgb,var(--h) 55%,#fff);
  box-shadow:0 0 0 2px rgba(255,255,255,.18) }
.rt{ margin:0; font:800 28px/32px var(--ui); letter-spacing:-.02em; text-wrap:balance }
.rb{ margin:6px 0 0; font:400 16px/22px var(--ui); color:rgba(255,255,255,.84);
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden }

/* the rail: acts on the design on screen, in the thumb's reach */
.mrail{ position:absolute; z-index:5; right:6px; bottom:calc(var(--nav-h) + 14px); width:calc(var(--rail-w) - 12px);
  display:flex; flex-direction:column; align-items:center; gap:12px }
.rb2{ display:flex; flex-direction:column; align-items:center; gap:4px; width:60px; font:600 11.5px/14px var(--ui); color:#fff;
  text-shadow:0 1px 2px rgba(0,0,0,.5) }
.rb2 .c{ width:48px; height:48px; border-radius:50%; display:grid; place-items:center; background:rgba(20,24,36,.62);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.16),0 6px 16px -4px rgba(0,0,0,.6); transition:transform var(--t-fast) var(--ease) }
.rb2:active .c{ transform:scale(.92) }
.rb2.pri .c{ background:#fff; color:#141926; box-shadow:0 8px 20px -4px rgba(0,0,0,.6) }

/* the systems: a sideways row, the current one pressed */
.mnav{ position:absolute; z-index:20; left:0; right:0; bottom:0; height:var(--nav-h);
  padding:8px 0 calc(8px + env(safe-area-inset-bottom,0px)); background:linear-gradient(transparent,rgba(5,6,10,.86) 45%) }
.mrow{ display:flex; gap:8px; overflow-x:auto; padding:2px 12px 4px; scrollbar-width:none }
.mrow::-webkit-scrollbar{ display:none }
.mchip{ flex:none; display:inline-flex; align-items:center; gap:7px; height:44px; padding:0 14px 0 12px; border-radius:var(--r-full);
  background:rgba(255,255,255,.1); color:rgba(255,255,255,.82); font:600 14px/1 var(--ui); white-space:nowrap;
  transition:background var(--t-base) var(--ease),color var(--t-base) var(--ease) }
.mchip i{ width:10px; height:10px; border-radius:50%; background:color-mix(in srgb,var(--h) 60%,#fff) }
.mchip small{ font:600 12px/1 var(--ui); opacity:.7; font-variant-numeric:tabular-nums }
.mchip[aria-pressed="true"]{ background:#fff; color:#141926; box-shadow:0 6px 18px -4px rgba(0,0,0,.6) }
.mchip[aria-pressed="true"] i{ background:var(--h) }

/* the top strip: the library in numbers */
.mtop{ position:absolute; z-index:20; left:0; right:0; top:0; height:var(--top-h); display:flex; align-items:center; gap:10px;
  padding:0 14px 0 18px; padding-top:env(safe-area-inset-top,0px); background:linear-gradient(rgba(5,6,10,.7),transparent) }
.mbrand{ flex:1; margin:0; font:700 17px/22px var(--ui); letter-spacing:-.015em }
.mstat{ height:30px; display:inline-flex; align-items:center; padding:0 12px; border-radius:var(--r-full); background:rgba(255,255,255,.12);
  font:500 13px/1 var(--ui); color:rgba(255,255,255,.8); white-space:nowrap }
.mstat b{ color:#fff; font-weight:700; margin-right:3px }
.mstat b+b,.mstat b:not(:first-child){ margin-left:2px }

.mhint{ position:absolute; z-index:6; left:50%; top:calc(var(--top-h) + 14px); margin:0 0 0 -105px; width:210px; padding:9px 14px;
  border-radius:var(--r-full); text-align:center; pointer-events:none; background:rgba(12,14,22,.86); color:#fff;
  box-shadow:0 8px 20px -6px rgba(0,0,0,.6); font:600 13px/16px var(--ui); animation:nudge 1.6s var(--ease) infinite }
@keyframes nudge{ 50%{ transform:translateY(-6px) } }

/* ---------- what opens over the feed: opaque, in the page's theme ---------- */
.mscrim{ position:absolute; inset:0; z-index:35; background:rgba(5,6,10,.55); animation:fadein .18s ease }
@keyframes fadein{ from{ opacity:0 } }
.msheet{ position:absolute; z-index:50; left:0; right:0; bottom:0; max-height:80%; display:flex; flex-direction:column;
  border-radius:24px 24px 0 0; background:var(--s1); color:var(--ink); box-shadow:var(--e5); animation:up .26s var(--ease) }
@keyframes up{ from{ transform:translateY(30%); opacity:.5 } }
.grab{ width:40px; height:4px; border-radius:2px; background:var(--s4); margin:8px auto 2px; flex:none }
.sb{ overflow:auto; padding:8px 20px 16px }
.skick{ display:flex; align-items:center; gap:7px; margin:4px 0 2px; font:600 13px/18px var(--ui);
  color:color-mix(in srgb,var(--h) 80%,var(--ink)) }
.skick i{ width:9px; height:9px; border-radius:50%; background:var(--h) }
.sb h3{ margin:0 0 8px; font:800 26px/30px var(--ui); letter-spacing:-.02em }
.sb p{ margin:0 0 12px; font:400 16px/23px var(--ui); color:var(--ink2) }
.sb .best,.sb .fam{ padding:12px 14px; border-radius:var(--r-md); background:var(--rail); font-size:15px; line-height:21px }
.sb em{ font-style:normal; font-weight:700; color:var(--ink) }
.sf{ flex:none; display:flex; gap:10px; padding:10px 20px calc(16px + env(safe-area-inset-bottom,0px)); box-shadow:inset 0 1px 0 var(--s3) }
.cta{ flex:1; min-height:52px; border-radius:var(--r-full); display:inline-flex; align-items:center; justify-content:center; gap:8px;
  background:var(--pri); color:var(--on-pri); font:700 16px/1 var(--ui); box-shadow:var(--e2) }
.ghost{ width:52px; min-height:52px; border-radius:50%; display:grid; place-items:center; background:var(--s3); color:var(--ink) }
.mlist{ display:flex; flex-direction:column; gap:6px; margin-top:4px }
.mopt{ display:flex; align-items:center; gap:12px; width:100%; min-height:60px; padding:10px 12px 10px 14px; border-radius:var(--r-md);
  background:var(--rail); color:var(--ink) }
.mopt span{ flex:1; min-width:0 }
.mopt b{ display:block; font:700 15.5px/20px var(--ui) }
.mopt small{ display:block; font:400 13.5px/18px var(--ui); color:var(--ink3); white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
.mopt svg{ color:var(--ink3) }
.mopt[aria-current="true"]{ background:color-mix(in srgb,var(--h) 14%,var(--s1)); box-shadow:inset 0 0 0 2px var(--h) }

.mpage{ position:absolute; inset:0; z-index:60; display:flex; flex-direction:column; background:var(--canvas); color:var(--ink);
  animation:slide .24s var(--ease) }
@keyframes slide{ from{ transform:translateX(24%); opacity:.4 } }
.mph{ flex:none; display:flex; align-items:center; gap:6px; padding:calc(6px + env(safe-area-inset-top,0px)) 12px 6px 6px;
  background:var(--s1); box-shadow:var(--e1); position:relative; z-index:1 }
.ib{ width:44px; height:44px; border-radius:50%; display:grid; place-items:center }
.ib:active{ background:var(--s3) }
.pt{ margin:0; min-width:0; line-height:1.2 }
.pt b{ display:block; font:700 16px/20px var(--ui) }
.pt small{ font:500 12.5px/16px var(--ui); color:var(--ink3) }
.pv{ flex:1; min-height:0; position:relative; overflow:hidden }
.pv iframe{ position:absolute; top:0; left:0; border:0; transform-origin:0 0; background:#fff }

.mtoast{ position:absolute; z-index:70; left:16px; right:16px; bottom:calc(var(--nav-h) + 16px); padding:13px 16px; border-radius:var(--r-md);
  background:#fff; color:#141926; font:600 14.5px/20px var(--ui); box-shadow:var(--e4); animation:up .2s var(--ease) }

@media (prefers-reduced-motion:reduce){ .mhint{ animation:none } }

/* designs that draw their own phone frame stand on the reel as they are, without a second frame */
.m:not(.desk) .dev:not(.bare){ background:transparent; box-shadow:none; border-radius:0 }
.m:not(.desk) .dev:not(.bare) iframe{ background:transparent }

/* a phone held sideways: the design on the left, its words and the rail in a column on the right */
@media (orientation:landscape) and (max-height:520px){
  .m{ --top-h:40px; --nav-h:58px; --side:min(42%,320px) }
  .mtop{ padding-right:12px }
  .mbrand{ font-size:15px }
  .mstat{ height:26px; font-size:12px }
  .reel{ flex-direction:row; align-items:stretch; padding:var(--top-h) 0 var(--nav-h) }
  .shot{ padding:6px 12px 10px 16px }
  .m.desk .shot{ padding:6px 12px 10px 16px; place-items:center }
  .txt{ width:var(--side); align-self:flex-end; padding:0 16px 70px 4px }
  .rt{ font-size:22px; line-height:26px }
  .rb{ font-size:14px; line-height:19px }
  .mrail{ flex-direction:row; width:auto; right:16px; bottom:calc(var(--nav-h) + 8px); gap:8px }
  .rb2{ width:auto }
  .rb2 .c{ width:44px; height:44px }
  .rb2 .l{ position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap }
  .mchip{ height:44px }
  .mnav{ padding-top:6px }
  .mhint{ display:none }
}

/* ---------- the system's code, as a zip ---------- */

/* In the rail it is one more round action, in the system's own colour so it reads as the thing that
   leaves with you rather than one more thing to look at. */
a.rb2{ text-decoration:none }
.rb2.dlr .c{ color:#fff;
  background:linear-gradient(168deg,color-mix(in srgb,var(--h) 76%,#fff) 0%,var(--h) 48%,color-mix(in srgb,var(--h) 82%,#000) 100%);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.5),inset 0 -2px 4px rgba(0,0,0,.22),0 8px 20px -4px rgba(0,0,0,.55) }

/* In a sheet there is room to say what it is, so it says it: a lifted bar, lit from the top edge. */
.dlm{ display:grid; width:100%; grid-template-columns:44px minmax(0,1fr); align-items:center; column-gap:12px; margin:2px 0 14px;
  min-height:60px; padding:9px 16px 9px 10px; border-radius:var(--r-md); color:#fff; text-decoration:none;
  background:linear-gradient(168deg,color-mix(in srgb,var(--h) 74%,#fff) 0%,var(--h) 46%,color-mix(in srgb,var(--h) 78%,#000) 100%);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.5),inset 0 -2px 5px rgba(0,0,0,.2),
    0 10px 24px -8px color-mix(in srgb,var(--h) 62%,transparent) }
.dlm:active{ transform:translateY(1px); box-shadow:inset 0 2px 7px rgba(0,0,0,.3) }
.dlm .dlc{ width:44px; height:44px; border-radius:13px; display:grid; place-items:center;
  background:rgba(255,255,255,.24); box-shadow:inset 0 1px 0 rgba(255,255,255,.5),inset 0 -1px 2px rgba(0,0,0,.2) }
.dlm .dlt{ min-width:0; display:grid; gap:2px }
.dlm .dlt b{ font:700 15.5px/20px var(--ui); letter-spacing:-.01em }
.dlm .dlt small{ font:500 13px/17px var(--ui); color:rgba(255,255,255,.86) }
:root[data-theme="dark"] .dlm{ color:#0c0e13 }
:root[data-theme="dark"] .dlm .dlc{ background:rgba(12,14,19,.16); box-shadow:inset 0 1px 0 rgba(255,255,255,.3) }
:root[data-theme="dark"] .dlm .dlt small{ color:rgba(12,14,19,.76) }
@media (prefers-reduced-motion:reduce){ .dlm:active{ transform:none } }

/* the three sections, in the top strip */
.mtabs{ flex:none; display:flex; gap:2px; padding:3px; border-radius:var(--r-full); background:rgba(255,255,255,.14) }
.mtab{ position:relative; height:30px; padding:0 12px; border-radius:var(--r-full); font:600 13px/1 var(--ui); color:rgba(255,255,255,.82) }
.mtab::after{ content:""; position:absolute; left:0; right:0; top:50%; height:44px; transform:translateY(-50%) }
.mtab[aria-selected="true"]{ background:#fff; color:#0c0e13 }
@media (max-width:359px){ .mbrand{ visibility:hidden } }

/* ══ THE DOWNLOAD BUTTON, phone layout ═══════════════════════════════════
   The same one route as the desktop. It used to be an <a> pointing at a
   pre-built downloads/<family>.zip, which is why a single design could not be
   taken at all; it is a <button> now because the zip is built in the page.
   The label is the feedback, and only a failure gets a colour. */
.dlm.work{ opacity:.78 }
.dlm.bad{ background:var(--neg,#b3261e); color:#fff }
.dlm.bad .dlc{ background:rgba(255,255,255,.22) }
.dlm.bad .dlt small{ color:rgba(255,255,255,.9) }
:root[data-theme="dark"] .dlm.bad,
:root[data-theme="dark"] .dlm.bad .dlt small{ color:#fff }
.rb2.dlr.work{ opacity:.7 }
.rb2.dlr.bad .c{ background:var(--neg,#b3261e) }
