/* ══════════════════════════════════════════════════════════════════
   NUMA TRADE — "App-Feeling"-Schicht
   Macht die Web-App bedienbar wie eine native iPhone/Android-App:
   Übergänge, Druck-Feedback, Gesten, iOS-Kopfzeile, Bottom-Sheet.
   Rein additiv – ändert keine Funktion der App. Abschaltbar über
   <html data-nf="off">.
   ══════════════════════════════════════════════════════════════════ */

html:not([data-nf="off"]){
  --nf-ease:cubic-bezier(.32,.72,0,1);          /* iOS-Kurve (Sheets, Push) */
  --nf-spring:cubic-bezier(.34,1.56,.64,1);
  --nf-page-bg:var(--nd-bg,#000);
  -webkit-text-size-adjust:100%;
  touch-action:manipulation;                     /* kein Doppeltipp-Zoom, keine 300-ms-Verzögerung */
}
html:not([data-nf="off"]),html:not([data-nf="off"]) body{overscroll-behavior:none}
html:not([data-nf="off"]) body{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
html:not([data-nf="off"]) :is(input,textarea,select,[contenteditable="true"],.sig-row-val,.selectable,.chat-msg,.chat-msg *,.chat-messages *,#view-admin,#view-admin *,.academy-detail,.academy-detail *){-webkit-user-select:text;user-select:text;-webkit-touch-callout:default}
html:not([data-nf="off"]) img{-webkit-user-drag:none}

/* ── Scroll-Container der Seiten ── */
html:not([data-nf="off"]) .view{-webkit-overflow-scrolling:touch;overscroll-behavior-y:contain;scroll-behavior:auto}
html:not([data-nf="off"]) .view.nf-ptr{overscroll-behavior-y:none}
html:not([data-nf="off"]) .views{isolation:isolate}

/* Unterseiten (Journal, Academy, …) sind wie bei iOS undurchsichtige Seiten */
html:not([data-nf="off"]) .view.nf-sub{background:var(--nd-bg,#000)}
html:not([data-nf="off"]) body.mode-light .view.nf-sub{background:var(--nd-bg,#F2F2F7)}

/* ── Seitenübergänge ── */
.view.nf-anim{display:block !important;will-change:transform,opacity}
.view.nf-leaving{pointer-events:none}
.view.nf-top{z-index:3}
.view.nf-under{z-index:1}

@keyframes nfTabIn{from{opacity:0;translate:0 10px}to{opacity:1;translate:0 0}}
@keyframes nfTabOut{from{opacity:1}to{opacity:0}}
@keyframes nfPushIn{from{transform:translateX(100%)}to{transform:translateX(0)}}
@keyframes nfPushOut{from{transform:translateX(0);filter:brightness(1)}to{transform:translateX(-28%);filter:brightness(.62)}}
@keyframes nfPopOut{from{transform:translateX(0)}to{transform:translateX(100%)}}
@keyframes nfPopIn{from{transform:translateX(-28%);filter:brightness(.62)}to{transform:translateX(0);filter:brightness(1)}}
.view.nf-tab-in{animation:nfTabIn .26s cubic-bezier(.2,.8,.2,1) both}
.view.nf-tab-out{animation:nfTabOut .16s ease both}
.view.nf-push-in{animation:nfPushIn .42s var(--nf-ease) both;box-shadow:-10px 0 34px rgba(0,0,0,.38)}
.view.nf-push-out{animation:nfPushOut .42s var(--nf-ease) both}
.view.nf-pop-out{animation:nfPopOut .36s var(--nf-ease) both;box-shadow:-10px 0 34px rgba(0,0,0,.38)}
.view.nf-pop-in{animation:nfPopIn .36s var(--nf-ease) both}

/* Inhalte einer Seite erscheinen leicht gestaffelt */
@keyframes nfRise{from{opacity:0;translate:0 14px}to{opacity:1;translate:0 0}}
.view.nf-stagger > .nf-st{animation:nfRise .5s cubic-bezier(.2,.8,.2,1) both;animation-delay:calc(var(--nf-i,0) * 38ms)}

@media (prefers-reduced-motion:reduce){
  .view.nf-tab-in,.view.nf-tab-out,.view.nf-push-in,.view.nf-push-out,.view.nf-pop-out,.view.nf-pop-in,.view.nf-stagger > .nf-st{animation:none !important}
}

/* ── Kopfzeile: Seitentitel erscheint beim Scrollen (wie iOS) ── */
html:not([data-nf="off"]) .topbar{transition:box-shadow .25s ease,background-color .25s ease}
.nf-title{position:absolute;left:56px;top:50%;transform:translateY(-50%) translateY(6px);max-width:50%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  font-family:var(--nd-font-display,-apple-system,BlinkMacSystemFont,"SF Pro Display",sans-serif);font-weight:700;font-size:17px;letter-spacing:-.01em;
  color:var(--nd-text,#fff);opacity:0;pointer-events:none;transition:opacity .22s ease,transform .22s ease;z-index:2}
.topbar.nf-scrolled .nf-title{opacity:1;transform:translateY(-50%)}
.topbar .cyb-word{transition:opacity .22s ease}
.topbar.nf-scrolled .cyb-word{opacity:0}
html:not([data-nf="off"]) .topbar.nf-scrolled{box-shadow:0 1px 0 var(--nd-line,rgba(255,255,255,.08)),0 8px 24px rgba(0,0,0,.18)}

/* ── Wisch-zurück: Abdunkelung der darunterliegenden Seite ── */
.nf-dim{position:absolute;inset:0;background:#000;opacity:0;pointer-events:none;z-index:2}

/* ── Ziehen zum Aktualisieren ── */
.nf-ptr-ind{position:absolute;left:50%;top:10px;width:40px;height:40px;margin-left:-20px;border-radius:50%;z-index:30;pointer-events:none;
  display:grid;place-items:center;opacity:0;transform:translateY(-56px) scale(.6);
  background:var(--nd-surface,#1C1C1E);box-shadow:0 6px 20px rgba(0,0,0,.35),0 0 0 1px var(--nd-line,rgba(255,255,255,.08))}
.nf-ptr-ind svg{width:24px;height:24px;overflow:visible}
.nf-ptr-ind .trk{stroke:var(--nd-line,rgba(255,255,255,.14))}
.nf-ptr-ind .arc{stroke:var(--nd-accent,#E5B45C);transition:stroke-dashoffset .05s linear}
.nf-ptr-ind.ready{box-shadow:0 6px 20px rgba(0,0,0,.35),0 0 0 1px var(--nd-accent,#E5B45C),0 0 18px rgba(229,180,92,.35)}
.nf-ptr-ind.spin svg{animation:nfSpin .8s linear infinite}
@keyframes nfSpin{to{transform:rotate(360deg)}}

/* ── Bottom-Sheet (Signal-Details): iOS-Feder, Abdunkeln mit Überblendung, ziehen zum Schließen ── */
html:not([data-nf="off"]) .cyb-sheet-bg{display:block !important;opacity:0;pointer-events:none;transition:opacity .32s ease;backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px)}
html:not([data-nf="off"]) .cyb-sheet-bg.on{opacity:1;pointer-events:auto}
html:not([data-nf="off"]) .cyb-sheet{transition:transform .46s var(--nf-ease),visibility 0s .46s;overscroll-behavior:contain;box-shadow:0 -12px 40px rgba(0,0,0,.35)}
html:not([data-nf="off"]) .cyb-sheet.on{transition:transform .46s var(--nf-ease)}
html:not([data-nf="off"]) .cyb-sheet.nf-drag{transition:none !important}
html:not([data-nf="off"]) .cyb-sheet .grip{width:40px;height:5px;margin:2px auto 14px;opacity:.9}
html:not([data-nf="off"]) .cyb-sheet .grip::before{content:"";display:block;height:28px;margin-top:-12px}

/* ── Tastatur offen: Tab-Leiste weg (wie native Apps) ── */
html:not([data-nf="off"]) .bottom-nav{transition:transform .25s var(--nf-ease),opacity .2s ease}
html:not([data-nf="off"]) body.nf-kb .bottom-nav{transform:translateY(140%) !important;opacity:0}

/* ── Offline-Hinweis ── */
.nf-offline{position:fixed;left:50%;top:calc(env(safe-area-inset-top,0px) + 62px);z-index:9000;transform:translate(-50%,-20px);opacity:0;pointer-events:none;
  padding:8px 16px;border-radius:999px;font:600 13px/1.2 var(--nd-font,-apple-system,sans-serif);color:#fff;background:rgba(255,69,58,.92);
  box-shadow:0 8px 24px rgba(0,0,0,.35);transition:opacity .25s ease,transform .3s var(--nf-ease)}
.nf-offline.on{opacity:1;transform:translate(-50%,0)}
.nf-offline.back{background:rgba(52,199,89,.95)}

/* ── Haptik-Hilfselement (iOS 18) ── */
.nf-hap{position:fixed;left:-9999px;top:0;width:1px;height:1px;opacity:0;pointer-events:none}

/* ── Tab-Leiste: gleitende Kapsel hinter dem aktiven Tab (wie iOS 26) ── */
.nf-tabpill{position:absolute;left:0;top:0;width:0;height:0;border-radius:16px;pointer-events:none;z-index:0;opacity:0;
  background:var(--nd-accent-dim,rgba(229,180,92,.16));box-shadow:inset 0 0 0 1px rgba(229,180,92,.10);
  transition:transform .55s cubic-bezier(.34,1.32,.64,1),width .55s cubic-bezier(.34,1.32,.64,1),opacity .25s ease}
.nf-tabpill.on{opacity:1}
.nf-tabpill.nf-noanim{transition:none}
html:not([data-nf="off"]) .bottom-nav .nav-item{z-index:1}
body.theme-ceo .nf-tabpill{display:none}
