/* ==========================================================================
   ePower-House on phones — an app shell for the public pages (2026-10-29).
   Loaded LAST by index.php (home), register.php (group sign-up) and
   ph-admin/index.php (staff sign-in). Classes prefixed ap-. Behaviour in
   assets/js/app-mobile.js.
   Up to 767px wide the pages read like an app: a navy app bar (brand, or a
   back button and a title that fades in), the home page's floating tab bar
   (Vote · Elections · Demo · Groups · More) with a "More" sheet, shortcut
   tiles under the code card, rounded cards instead of full-width bands, a
   swipe rail for the group features, press feedback on everything tappable.
   The classical look stays: ivory paper, serif headings, navy, blue, gold.
   From 768px nothing here applies and the ap- elements are not shown, so
   tablets and computers see the pages exactly as before.
   ========================================================================== */
.ap-bar,.ap-tabs,.ap-sheet,.ap-quick,.ap-dots{display:none}

@media (max-width:767px){
  :root{--ap-bar-h:56px;--ap-tabs-h:64px;--ap-r:18px;
    --ap-safe-t:env(safe-area-inset-top,0px);--ap-safe-b:env(safe-area-inset-bottom,0px);
    --ap-safe-l:env(safe-area-inset-left,0px);--ap-safe-r:env(safe-area-inset-right,0px);
    --ap-lift:0 16px 32px -24px rgba(40,30,8,.5),0 1px 2px rgba(40,30,8,.04)}
  html{-webkit-tap-highlight-color:transparent}
  /* lock on body, not html: html{overflow:hidden} makes body (overflow-x:hidden) its own scroll
     box, and the sticky app bar then scrolls away under the sheet */
  html.ap-sheet-open body{overflow:hidden}
  body.hc{-webkit-font-smoothing:antialiased}
  .hc a,.hc button,.hc summary,.hc label,.hc input{touch-action:manipulation}
  :target,.hc main [id]{scroll-margin-top:calc(var(--ap-bar-h) + var(--ap-safe-t) + 8px)}

  /* ---- app bar ---------------------------------------------------------- */
  .hc-util,.hc-nav,.si-bar{display:none}
  .ap-bar{display:flex;align-items:center;gap:10px;position:sticky;top:0;z-index:60;
    height:calc(var(--ap-bar-h) + var(--ap-safe-t));padding:var(--ap-safe-t) calc(12px + var(--ap-safe-r)) 0 calc(12px + var(--ap-safe-l));
    background:rgba(4,22,49,.95);color:#f6f1e4;-webkit-backdrop-filter:saturate(1.4) blur(14px);backdrop-filter:saturate(1.4) blur(14px);
    box-shadow:0 1px 0 rgba(226,199,127,0);transition:box-shadow .2s}
  .ap-bar.is-scrolled{box-shadow:0 1px 0 rgba(226,199,127,.26),0 12px 26px -18px rgba(0,0,0,.8)}
  .ap-bar .hc-brand{gap:9px;min-width:0}
  .ap-bar .hc-brand img{width:34px}
  .ap-bar .hc-brand__name{font-size:21px}
  .ap-bar .hc-brand small{font-size:8.5px;margin-top:4px}
  .ap-bar__btn{display:inline-flex;align-items:center;gap:7px;flex:none;margin-left:auto;height:38px;padding:0 13px 0 11px;border-radius:999px;
    border:1px solid rgba(233,217,168,.38);background:rgba(255,255,255,.06);color:var(--hc-gold-3);
    font:600 13px/1 var(--hc-sans);text-decoration:none;transition:background .15s,transform .15s}
  .ap-bar__btn svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
  .ap-bar__btn:active{background:rgba(255,255,255,.16);transform:scale(.95)}
  /* pushed pages (sign-up, staff sign-in): back · title · action */
  .ap-bar--push{display:grid;grid-template-columns:minmax(76px,1fr) auto minmax(76px,1fr)}
  .ap-bar__back{justify-self:start;display:inline-flex;align-items:center;gap:2px;height:40px;padding:0 10px 0 2px;margin-left:-4px;border-radius:12px;
    color:var(--hc-gold-3);font:600 15px/1 var(--hc-sans);text-decoration:none;transition:background .15s}
  .ap-bar__back svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
  .ap-bar__back:active{background:rgba(255,255,255,.1)}
  .ap-bar__title{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font:600 19px/1 var(--hc-serif);color:#fbf6e9;
    opacity:0;transform:translateY(6px);transition:opacity .2s,transform .2s}
  .ap-bar.is-titled .ap-bar__title{opacity:1;transform:none}
  .ap-bar--push .ap-bar__btn{justify-self:end;margin-left:0}

  /* ---- buttons: rounder, and they give under the thumb -------------------- */
  .hc-btn{border-radius:14px;min-height:48px;transition:background .15s,border-color .15s,color .15s,box-shadow .15s,transform .12s}
  .hc-btn--lg{min-height:52px}
  .hc-btn:active{transform:scale(.97)}
  .hc-btn:hover svg{transform:none}

  /* ---- home: hero = the app's first screen ------------------------------- */
  .hc-hero:after{display:none}
  .hc-hero__in{grid-template-areas:"title" "card" "quick" "copy";gap:18px;padding-top:16px;padding-bottom:58px}
  .hc-hero .hc-eyebrow{font-size:10.5px;letter-spacing:.18em;margin-bottom:12px}
  .hc-hero .hc-eyebrow:before{width:22px}
  .hc-hero h1{font-size:clamp(32px,9.2vw,38px);line-height:1.05}
  .hc-ballot{margin-top:40px;border-radius:24px;padding:48px 18px 18px}
  .hc-ballot:before{inset:8px;border-radius:17px}
  .hc-ballot:after{inset:12px;border-radius:14px}
  .hc-seal{width:76px;height:76px;top:-38px;margin-left:-38px}
  .hc-ballot h2{font-size:30px;margin-top:6px}
  .hc-ballot__intro{font-size:14.5px;margin:6px auto 14px}
  .hc-code{gap:10px}
  .hc-code input{height:56px;border-radius:14px;font-size:26px}
  .hc-where{margin-top:12px;padding-top:10px}
  .hc-where p,.hc-alert{border-radius:12px}
  .hc-hero__actions{display:none}
  .hc-lead{font-size:15px}
  .hc-trust{margin-top:16px;padding-top:16px;gap:8px}
  .hc-trust li{padding:5px 11px 5px 5px;border-radius:999px;background:rgba(255,255,255,.06);border:1px solid rgba(226,199,127,.22);font-size:12.5px}
  .hc-trust svg{width:20px;height:20px;padding:3px}

  /* shortcut tiles under the code card */
  .ap-quick{grid-area:quick;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;animation:hc-rise .8s .16s cubic-bezier(.2,.7,.2,1) both}
  .ap-quick a{display:flex;flex-direction:column;align-items:center;gap:8px;text-align:center;text-decoration:none;color:rgba(246,241,228,.92);font:600 12px/1.25 var(--hc-sans)}
  .ap-quick__ico{width:58px;height:58px;border-radius:19px;display:grid;place-items:center;background:rgba(255,255,255,.07);
    border:1px solid rgba(226,199,127,.4);box-shadow:inset 0 1px 0 rgba(255,255,255,.08);transition:transform .12s,background .15s}
  .ap-quick svg{width:25px;height:25px;fill:none;stroke:var(--hc-gold-3);stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
  .ap-quick a:active .ap-quick__ico{transform:scale(.9);background:rgba(255,255,255,.16)}

  /* ---- sections: left-aligned titles, cards with rounded corners ---------- */
  .hc-section{padding:34px 0 38px}
  /* the first section rises over the hero like a sheet */
  .ap-home #elections{position:relative;z-index:1;margin-top:-26px;border-radius:26px 26px 0 0;background:var(--hc-paper);padding-top:30px}
  .hc-head,.hc-head--left{text-align:left;margin:0 0 20px;max-width:none}
  .hc-head p,.hc-groups__intro p{margin:8px 0 0;font-size:15px}
  .hc-demo__copy > p{margin-top:8px}
  .hc-head h2,.hc-groups__intro h2,.hc-demo h2{font-size:30px;line-height:1.08}
  .hc-kicker{font-size:10.5px;margin-bottom:8px}
  .hc-head .hc-orn,.hc-groups__intro .hc-orn,.hc-demo .hc-orn{display:none}

  /* elections */
  .hc-elist{gap:14px}
  .hc-ecard{border-radius:var(--ap-r);border-top:1px solid var(--hc-line);padding:18px 16px 16px;box-shadow:var(--ap-lift)}
  .hc-ecard h3{font-size:24px}
  .hc-ecard__foot{padding-top:16px}
  .hc-soon{border-radius:12px}
  .hc-empty{border-radius:var(--ap-r);padding:28px 18px 20px;box-shadow:var(--ap-lift)}
  .hc-empty:before{inset:7px;border-radius:13px}
  .hc-empty svg{width:46px;height:46px;margin-bottom:8px}
  .hc-empty h3{font-size:24px}
  .hc-empty p{font-size:14.5px}
  .hc-empty__btns{margin-top:18px;gap:10px}

  /* how voting works: the four steps on one card */
  .hc-steps{background:var(--hc-card);border:1px solid var(--hc-line);border-radius:var(--ap-r);padding:18px 16px;box-shadow:var(--ap-lift)}
  .hc-steps li{grid-template-columns:44px minmax(0,1fr);gap:14px;padding-bottom:20px}
  .hc-steps__n{width:44px;height:44px;font-size:18px;box-shadow:inset 0 0 0 3px var(--hc-card),inset 0 0 0 4px var(--hc-gold-3)}
  .hc-steps li:not(:last-child):after{left:21.5px;top:50px}
  .hc-steps h3{font-size:21px;padding-top:2px}
  .hc-steps p{font-size:14.5px;margin-top:4px}
  .hc-ready{margin-top:14px;border-radius:var(--ap-r);padding:20px 16px 16px;box-shadow:var(--ap-lift)}
  .hc-ready:before{display:none}
  .hc-ready__title{font-size:22px;text-align:left}
  .hc-ready ul{margin-top:14px;gap:14px}
  .hc-ready li b{font-size:18px}
  .hc-ready__note{text-align:left;font-size:14px;margin-top:16px;padding-top:14px}
  .hc-ico{width:42px;height:42px}
  .hc-ico svg{width:20px;height:20px}

  /* dark bands become inset cards */
  .hc-demo,.hc-start{margin:14px 10px;border-radius:26px;padding:32px 0 34px}
  .hc-demo .hc-wrap,.hc-start .hc-wrap{padding:0 18px}
  .hc-demo__in{gap:30px}
  .hc-demo__copy > p{font-size:15px}
  .hc-demo__list{margin-top:18px;gap:10px}
  .hc-demo__list li{font-size:14px}
  .hc-demo__btns{margin-top:22px}
  .hc-demo__paper{width:min(80%,300px)}
  .hc-chapters li{padding:16px 0 18px}
  .hc-chapters__n{margin-bottom:8px}
  .hc-chapters h3{font-size:22px}
  .hc-chapters p{font-size:14px;margin-top:6px}
  .hc-start__cta{margin-top:18px}
  .hc-start__cta .hc-btn{width:100%}

  /* for groups: the features on a swipe rail, the next card peeking in */
  .hc-groups{gap:22px}
  .hc-groups__btns{margin-top:18px;gap:10px}
  .hc-features{display:flex;gap:12px;overflow-x:auto;overscroll-behavior-x:contain;scroll-snap-type:x mandatory;scroll-padding:0 16px;
    margin:0 -16px;padding:4px 16px 18px;border:0;scrollbar-width:none;-webkit-overflow-scrolling:touch}
  .hc-features::-webkit-scrollbar{display:none}
  .hc-feature{flex:0 0 76%;scroll-snap-align:start;display:block;padding:18px 16px 16px;border:1px solid var(--hc-line);border-radius:var(--ap-r);
    background:var(--hc-card);box-shadow:var(--ap-lift)}
  .hc-feature .hc-ico{margin-bottom:12px}
  .hc-feature h3{font-size:21px;padding-top:0}
  .hc-feature p{font-size:14px}
  .ap-dots{display:flex;justify-content:center;gap:6px;margin-top:-4px}
  .ap-dots i{width:6px;height:6px;border-radius:999px;background:var(--hc-line-2);transition:width .25s,background .25s}
  .ap-dots i.is-on{width:18px;background:var(--hc-gold)}

  /* help: questions on one grouped card */
  .hc-help{gap:18px}
  .hc-faq{background:var(--hc-card);border:1px solid var(--hc-line);border-radius:var(--ap-r);overflow:hidden;box-shadow:var(--ap-lift)}
  .hc-faq details{border-bottom:1px solid var(--hc-line)}
  .hc-faq details:last-child{border-bottom:0}
  .hc-faq summary{padding:16px;font-size:18.5px;transition:background .15s}
  .hc-faq summary:active{background:var(--hc-parch)}
  .hc-faq summary:after{width:26px;height:26px}
  .hc-faq details p{padding:0 16px 16px;margin-top:-2px;font-size:14.5px}

  /* closing invitation */
  .hc-invite{padding:26px 0 34px}
  .hc-invite__card{border-radius:24px;padding:30px 18px 22px}
  .hc-invite__card:before{inset:8px;border-radius:17px}
  .hc-invite__card:after{inset:12px;border-radius:14px}
  .hc-invite h2{font-size:28px}
  .hc-invite p{font-size:15px}
  .hc-invite__btns{margin-top:20px;gap:10px}

  /* footer: two short columns; clears the tab bar on the home page */
  .hc-foot{padding:32px 0 calc(28px + var(--ap-safe-b));font-size:13.5px}
  .ap-home .hc-foot{padding-bottom:calc(var(--ap-tabs-h) + 40px + var(--ap-safe-b))}
  .hc-foot__grid{grid-template-columns:1fr 1fr;gap:26px 16px}
  .hc-foot__brand{grid-column:1/-1}
  .hc-foot__brand p{margin-top:12px}
  .hc-foot nav{gap:9px}
  .hc-foot__legal{margin-top:26px;padding-top:16px}

  /* ---- tab bar (home) ----------------------------------------------------- */
  .ap-tabs{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));position:fixed;z-index:70;
    left:calc(10px + var(--ap-safe-l));right:calc(10px + var(--ap-safe-r));bottom:calc(8px + var(--ap-safe-b));
    height:var(--ap-tabs-h);padding:6px;border-radius:24px;background:rgba(255,253,248,.9);
    -webkit-backdrop-filter:saturate(1.6) blur(18px);backdrop-filter:saturate(1.6) blur(18px);
    border:1px solid rgba(176,138,60,.3);box-shadow:0 18px 40px -16px rgba(4,22,49,.5),0 2px 6px rgba(4,22,49,.08);
    transition:transform .3s cubic-bezier(.2,.7,.2,1),opacity .2s}
  .ap-tabs__pill{position:absolute;top:6px;bottom:6px;left:6px;width:calc((100% - 12px) / 5);border-radius:18px;
    background:var(--hc-b100);box-shadow:inset 0 0 0 1px #c8dbf6;transform:translateX(calc(var(--ap-i,0) * 100%));
    transition:transform .38s cubic-bezier(.3,.8,.25,1),opacity .2s}
  .ap-tabs[data-none] .ap-tabs__pill{opacity:0}
  .ap-tab{position:relative;z-index:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;min-width:0;
    border:0;background:none;padding:0;color:var(--hc-muted);font:600 10.5px/1 var(--hc-sans);letter-spacing:.02em;text-decoration:none;
    cursor:pointer;-webkit-user-select:none;user-select:none}
  .ap-tab svg{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;transition:transform .15s}
  .ap-tab span{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .ap-tab.is-on{color:var(--hc-b700)}
  .ap-tab.is-on svg{stroke-width:2.1}
  .ap-tab:active svg{transform:scale(.86)}
  .ap-tab:focus-visible{outline:2px solid var(--hc-gold);outline-offset:-2px;border-radius:18px}
  /* step aside while the keyboard is up or the sheet is open */
  html.ap-typing .ap-tabs,html.ap-sheet-open .ap-tabs{transform:translateY(calc(100% + 30px));opacity:0;pointer-events:none}

  /* ---- More sheet ------------------------------------------------------------ */
  .ap-sheet{display:block;position:fixed;inset:0;z-index:90;visibility:hidden;pointer-events:none;transition:visibility 0s .32s}
  .ap-sheet.is-open{visibility:visible;pointer-events:auto;transition:none}
  .ap-sheet__scrim{position:absolute;inset:0;background:rgba(4,22,49,.5);opacity:0;transition:opacity .28s}
  .ap-sheet.is-open .ap-sheet__scrim{opacity:1}
  .ap-sheet__panel{position:absolute;left:0;right:0;bottom:0;max-height:88vh;max-height:88dvh;overflow-y:auto;overscroll-behavior:contain;outline:0;
    background:var(--hc-paper);border-radius:26px 26px 0 0;padding:8px calc(16px + var(--ap-safe-r)) calc(22px + var(--ap-safe-b)) calc(16px + var(--ap-safe-l));
    box-shadow:0 -24px 60px -24px rgba(4,22,49,.6);transform:translateY(105%);transition:transform .32s cubic-bezier(.2,.8,.2,1)}
  .ap-sheet.is-open .ap-sheet__panel{transform:translateY(var(--ap-drag,0px))}
  .ap-sheet.is-dragging .ap-sheet__panel{transition:none}
  .ap-sheet__grab{width:40px;height:5px;margin:2px auto 12px;border-radius:999px;background:var(--hc-line-2)}
  .ap-sheet__head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}
  .ap-sheet__head h2{font-size:28px;line-height:1.1;color:var(--hc-b900)}
  .ap-sheet__x{flex:none;display:grid;place-items:center;width:36px;height:36px;border-radius:50%;border:0;background:var(--hc-parch);color:var(--hc-ink-2);cursor:pointer}
  .ap-sheet__x svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round}
  .ap-sheet__x:active{background:var(--hc-line)}
  .ap-list{display:block;background:var(--hc-card);border:1px solid var(--hc-line);border-radius:var(--ap-r);overflow:hidden}
  .ap-list a,.ap-install{display:grid;grid-template-columns:40px minmax(0,1fr) 18px;align-items:center;gap:12px;width:100%;padding:12px 14px;
    border:0;border-top:1px solid var(--hc-line);background:none;text-align:left;text-decoration:none;color:var(--hc-ink);font:inherit;cursor:pointer;transition:background .15s}
  .ap-list a:first-child{border-top:0}
  .ap-list a:active,.ap-install:active{background:var(--hc-parch)}
  .ap-list b,.ap-install b{display:block;font:600 18px/1.2 var(--hc-serif);color:var(--hc-b900)}
  .ap-list small,.ap-install small{display:block;margin-top:2px;font-size:13px;line-height:1.35;color:var(--hc-muted)}
  .ap-list__ico{width:40px;height:40px;border-radius:12px;display:grid;place-items:center;background:var(--hc-b100);color:var(--hc-b700)}
  .ap-list__ico svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
  .ap-chev{width:18px;height:18px;fill:none;stroke:var(--hc-line-2);stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
  .ap-sheet__cta{display:grid;gap:10px;margin-top:16px}
  .ap-install{margin-top:16px;border:1px dashed var(--hc-gold);border-radius:var(--ap-r);background:var(--hc-gold-soft)}
  .ap-install .ap-list__ico{background:var(--hc-card);color:var(--hc-gold-ink);box-shadow:inset 0 0 0 1px var(--hc-gold-3)}
  .ap-install[aria-expanded="true"] .ap-chev{transform:rotate(90deg)}
  .ap-install__how{margin-top:10px;padding:12px 14px;border-radius:14px;background:var(--hc-card);border:1px solid var(--hc-line);font-size:14px;line-height:1.55;color:var(--hc-ink-2)}
  .ap-install__how b{color:var(--hc-b900)}
  .ap-sheet__legal{margin-top:18px;text-align:center;font-size:12px;color:var(--hc-muted)}

  /* ---- group sign-up (register.php) ----------------------------------------- */
  .su-intro{padding:22px 16px 98px}
  .su-intro h1{font-size:clamp(32px,9.2vw,38px)}
  .su-lead{margin-top:12px;font-size:15px}
  .su-card{border-radius:24px;padding:30px 18px 22px}
  .su-card:before{inset:8px;border-radius:17px}
  .su-input input,.su-eye,.su-err,.su-kind__box,.su-demo__code > span{border-radius:12px}
  .su-demo{border-radius:20px}
  .su-demo:before{border-radius:14px}
  .su-perks li{border-radius:16px}
  .su-more{padding:36px 16px calc(40px + var(--ap-safe-b))}

  /* ---- staff sign-in (ph-admin/index.php) ----------------------------------- */
  .si{min-height:calc(100vh - var(--ap-bar-h) - var(--ap-safe-t));min-height:calc(100dvh - var(--ap-bar-h) - var(--ap-safe-t))}
  .si-intro{padding:22px 16px 100px}
  .si-intro h1{font-size:clamp(32px,9.2vw,38px)}
  .si-card{border-radius:24px;margin-top:40px;padding:50px 18px 20px}
  .si-card:before{inset:8px;border-radius:17px}
  .si-card:after{inset:12px;border-radius:14px}
  .si-input input,.si-err,.si-in{border-radius:12px}
  .si-foot{padding-bottom:calc(28px + var(--ap-safe-b))}

  @media (prefers-reduced-motion:reduce){
    .ap-quick{animation:none}
    .ap-tabs,.ap-tabs__pill,.ap-sheet__panel,.ap-sheet__scrim,.ap-bar__title{transition:none}
    .hc-btn:active,.ap-bar__btn:active,.ap-quick a:active .ap-quick__ico{transform:none}
  }
}
