/* FAI Media inside the app ("One app"): public/next/media.js adds html.fm once the owner's session is known, so for
   everyone else none of this applies. Port of media-demos/connect/app.html?way=one onto the real app's tokens. */
html.fm { --fm-tab: calc(54px + env(safe-area-inset-bottom, 0px)); --fm-ease: cubic-bezier(.2, .7, .2, 1);
  --fm-lift: 0 1px 2px rgb(15 23 42 / .05), 0 12px 32px -18px rgb(15 23 42 / .35), 0 0 0 1px rgb(var(--c-hair)); }

/* ---------- the sidebar: FAI Media, with its four places under it while it is open ---------- */
.fm-new { margin-left: auto; padding: 3px 6px; border-radius: 6px; background: rgb(var(--c-brass) / .16); color: rgb(var(--c-brassdk)); font: 700 9.5px/1 Inter, system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase; }
html.fm-on .fm-new { display: none; }
.fm-sub { display: none; margin: 2px 0 4px 22px; padding-left: 10px; border-left: 1.5px solid rgb(var(--c-hair)); }
html.fm-on .fm-sub { display: block; animation: fm-in .22s var(--fm-ease); }
html.fai-next .fm-sub .navlink { min-height: 30px; padding-block: 5px; font-size: 12.5px; }
html.fai-next .fm-sub .navlink.nav-active { box-shadow: none !important; background: rgb(var(--c-brass) / .13) !important; }
html.fai-next .fm-sub .navlink::before { display: none !important; }
@keyframes fm-in { from { opacity: 0; transform: translateY(-4px); } }

/* ---------- the layer: beside the sidebar, under its own page header (desktop); the whole screen over the bar (phone) ---------- */
#fm-layer { position: fixed; top: 0; right: 0; bottom: 0; left: var(--fm-left, 0px); z-index: 32; display: flex; flex-direction: column; background: var(--n-bg, rgb(var(--c-cream)));
  visibility: hidden; opacity: 0; transition: opacity .12s, visibility 0s .12s; contain: layout paint; }
#fm-layer.on { visibility: visible; opacity: 1; transition: opacity .12s; }
#fm-layer iframe { display: block; flex: 1; min-height: 0; width: 100%; border: 0; background: transparent; }
.fm-head { flex: none; padding: 14px 28px 4px; }
.fm-head small { display: block; margin-bottom: 5px; font: 600 10px/1 system-ui, sans-serif; letter-spacing: .14em; text-transform: uppercase; color: rgb(var(--c-brass)); }
.fm-head b { display: block; font-size: 22px; line-height: 1.05; letter-spacing: -.015em; font-weight: 400; color: rgb(var(--c-heading)); }

/* ---------- phones: one bottom bar for all of FAI ---------- */
#fm-bar { display: none; position: fixed; z-index: 44; left: 0; right: 0; bottom: 0; height: var(--fm-tab); padding-bottom: env(safe-area-inset-bottom, 0px);
  grid-template-columns: repeat(5, 1fr); background: rgb(var(--c-paper) / .94); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid rgb(var(--c-hair)); }
#fm-bar button { position: relative; display: grid; justify-items: center; align-content: center; gap: 4px; min-width: 0; border: 0; background: none; color: rgb(var(--c-muted));
  font: 600 10.5px/1 Inter, system-ui, sans-serif; -webkit-tap-highlight-color: transparent; touch-action: manipulation; transition: color .15s; }
#fm-bar svg { width: 24px; height: 24px; stroke-width: 1.8; transition: transform .18s var(--fm-ease); }
#fm-bar button:active svg { transform: scale(.88); }
#fm-bar button[aria-current] { color: rgb(var(--c-heading)); }
#fm-bar button[aria-current] svg { stroke-width: 2.3; }
/* P422 (owner, 7 Nov 2026): the place you are in sits on a soft brass pill (was a 3px bar on the top edge), the bar is 54px,
   and on Reels the bar goes dark with the reel, as Instagram's does. */
#fm-bar button { isolation: isolate; }
#fm-bar button[aria-current]::before { content: ""; position: absolute; z-index: -1; top: 3px; left: 50%; width: 56px; height: 30px; margin-left: -28px; border-radius: 999px; background: rgb(var(--c-brass) / .17); }
html.fm:has(#fm-bar button[data-fm-tab="reels"][aria-current]) #fm-bar { background: #0c0c0d; border-top-color: rgb(255 255 255 / .08); }
html.fm:has(#fm-bar button[data-fm-tab="reels"][aria-current]) #fm-bar button { color: rgb(255 255 255 / .62); }
html.fm:has(#fm-bar button[data-fm-tab="reels"][aria-current]) #fm-bar button[aria-current] { color: #fff; }
html.fm:has(#fm-bar button[data-fm-tab="reels"][aria-current]) #fm-bar button[aria-current]::before { background: rgb(255 255 255 / .14); }
@media (max-width: 767px) {
  html.fm #fm-bar { display: grid; }
  html.fm body .chat-vh { padding-bottom: var(--fm-tab); }          /* every screen, and its composer, ends above the bar */
  html.fm #fm-layer { inset: 0 0 var(--fm-tab) 0; z-index: 45; }
  html.fm .fm-head { display: none; }
  html.fm #mobile-overlay { z-index: 46; }                           /* the drawer's shade covers the bar and Media too */
  html.fm.fm-kb #fm-bar { display: none; }                           /* the keyboard is up: the box you type in keeps the room */
  html.fm.fm-kb body .chat-vh { padding-bottom: 0; }
}

/* ---------- the dashboard row ---------- */
.fm-row { margin: 22px 0 6px; }
.fm-row-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.fm-row-h h2 { margin: 0; font-size: 18px; line-height: 1.2; font-weight: 600; color: rgb(var(--c-heading)); font-family: var(--font-serif, "Source Serif 4", Georgia, serif); }
.fm-row-h a { padding: 4px 0; font-size: 13px; font-weight: 600; color: rgb(var(--c-heading)); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgb(var(--c-hair)); }
.fm-cards { display: flex; gap: 10px; padding: 2px 2px 8px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.fm-cards::-webkit-scrollbar { display: none; }
.fm-card { flex: none; width: 112px; scroll-snap-align: start; text-decoration: none; color: rgb(var(--c-charcoal)); -webkit-tap-highlight-color: transparent; }
.fm-rt { position: relative; display: block; overflow: hidden; border-radius: 12px; background: rgb(var(--c-navy)); box-shadow: 0 0 0 1px rgb(var(--c-hair)); transition: transform .18s var(--fm-ease), box-shadow .18s; }
.fm-rt img { display: block; width: 100%; aspect-ratio: 9 / 16; object-fit: cover; }
.fm-mk { position: absolute; left: 7px; bottom: 7px; padding: 3px 6px; border-radius: 6px; background: rgb(0 0 0 / .55); color: #fff; font: 700 9.5px/1 Inter, system-ui, sans-serif; letter-spacing: .05em; text-transform: uppercase; }
.fm-rm { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 7px; font-size: 12px; line-height: 1.35; }
.fm-card:active .fm-rt { transform: scale(.97); }
@media (hover: hover) { .fm-card:hover .fm-rt { transform: translateY(-3px); box-shadow: 0 0 0 1px rgb(var(--c-hair)), 0 12px 24px -10px rgb(0 0 0 / .35); } }
@media (min-width: 768px) { .fm-card { width: 124px; } }

/* ---------- the reel under an answer that cites its judgment ---------- */
.fm-wreel { display: flex; align-items: center; gap: 14px; max-width: 560px; margin-top: 16px; padding: 10px 14px 10px 10px; border-radius: 16px; text-decoration: none;
  color: rgb(var(--c-charcoal)); background: rgb(var(--c-paper)); box-shadow: var(--fm-lift); transition: transform .15s var(--fm-ease); -webkit-tap-highlight-color: transparent; }
.fm-wreel:active { transform: scale(.985); }
.fm-wreel .fm-rt { width: 58px; flex: none; border-radius: 10px; }
.fm-wreel .fm-rt svg { position: absolute; inset: 0; margin: auto; width: 22px; height: 22px; color: #fff; filter: drop-shadow(0 1px 3px rgb(0 0 0 / .6)); }
.fm-wreel b { display: block; margin-bottom: 2px; font-size: 14px; line-height: 1.3; color: rgb(var(--c-brassdk)); }
.fm-wreel .fm-t { font-size: 13px; line-height: 1.4; }
.fm-wreel small { display: block; margin-top: 3px; font-size: 11.5px; color: rgb(var(--c-muted)); }

.fm-nav:focus-visible, .fm-sub a:focus-visible, .fm-card:focus-visible, .fm-wreel:focus-visible, #fm-bar button:focus-visible { outline: 2px solid rgb(var(--c-brass)); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { #fm-layer, #fm-layer.on, .fm-rt, .fm-wreel, #fm-bar svg { transition: none !important; } html.fm-on .fm-sub { animation: none; } }
