/* FOLKNITY ORBIT · Build 05
 * Cohesive dark-theme presets, accessible mobile account actions and discover-as-you-type.
 * Loaded after V3/V4; no change to PHP forms, database schema or existing data. */
:root{
  --orbit-bg:#070c20;--orbit-bg2:#111739;--orbit-panel:#152044;
  --orbit-panel-deep:#0e1736;--orbit-line:rgba(155,164,255,.23);
  --orbit-accent:#8f75ff;--orbit-secondary:#5a99ff;
  --orbit-glow:rgba(130,90,248,.17);--orbit-placeholder:#a5b3d7;
}
html[data-theme="nebula"]{
  --orbit-bg:#0c0923;--orbit-bg2:#201441;--orbit-panel:#241c50;
  --orbit-panel-deep:#171337;--orbit-line:rgba(195,149,255,.26);
  --orbit-accent:#a48aff;--orbit-secondary:#8c75ff;
  --orbit-glow:rgba(158,91,251,.23);--orbit-placeholder:#bbb0e2;
}
html[data-theme="horizon"]{
  --orbit-bg:#041323;--orbit-bg2:#102b4d;--orbit-panel:#142f50;
  --orbit-panel-deep:#0d253d;--orbit-line:rgba(125,199,255,.24);
  --orbit-accent:#6ca8ff;--orbit-secondary:#6bd4f0;
  --orbit-glow:rgba(68,147,255,.21);--orbit-placeholder:#a8c9e5;
}
html[data-theme="dusk"]{
  --orbit-bg:#0b0e24;--orbit-bg2:#241c44;--orbit-panel:#292249;
  --orbit-panel-deep:#181a3b;--orbit-line:rgba(192,159,255,.24);
  --orbit-accent:#b18dff;--orbit-secondary:#8b9bff;
  --orbit-glow:rgba(164,121,255,.21);--orbit-placeholder:#c0b7e1;
}
/* Apply presets to real page surfaces, not merely an unused root variable. */
html[data-theme] body.folknity-v5{
  --bg:var(--orbit-bg);--panel:var(--orbit-panel-deep);
  --panel-2:var(--orbit-panel);--field:var(--orbit-panel);
  --accent:var(--orbit-accent);--line:var(--orbit-line);
  --v3-neon:var(--orbit-accent);--v3-electric:var(--orbit-secondary);
  --v3-border:var(--orbit-line);
  background:radial-gradient(ellipse 60% 36% at 72% -8%,var(--orbit-glow),transparent 82%),
    linear-gradient(146deg,var(--orbit-bg2),var(--orbit-bg) 40%,var(--orbit-bg) 80%,var(--orbit-bg2));
  background-attachment:fixed;
}
html[data-theme] body.folknity-v5 .v3-topbar{
  background:color-mix(in srgb,var(--orbit-bg) 90%,transparent)!important;
  border-bottom-color:var(--orbit-line)!important;
}
html[data-theme] body.folknity-v5 :is(.card,.post-card,.widget,.auth-card,.stat-card,.space-card,.settings-tile,.v4-discover-person,.v4-discover-space){
  background:linear-gradient(145deg,color-mix(in srgb,var(--orbit-panel) 86%,var(--orbit-bg)),var(--orbit-panel-deep));
  border-color:var(--orbit-line);
}
html[data-theme] body.folknity-v5 :is(.composer-prompt,.feed-welcome,.profile-shell.folknity-profile,.v4-explore-hero,.v4-media-preview){
  border-color:var(--orbit-line);
  box-shadow:0 13px 44px rgba(0,0,0,.12);
}
html[data-theme] body.folknity-v5 :is(.side-link.current,.feed-tabs a.selected,.v4-scope-tabs a.active,.profile-v4-tabs a.active){
  background:color-mix(in srgb,var(--orbit-accent) 23%,var(--orbit-panel-deep));
  border-color:var(--orbit-line);
  color:#fff;
}
html[data-theme] body.folknity-v5 :is(.feed-welcome,.v4-explore-hero,.page-hero){
  background:radial-gradient(circle at 86% 20%,var(--orbit-glow),transparent 44%),
    linear-gradient(112deg,var(--orbit-panel),var(--orbit-panel-deep) 78%);
  border-color:var(--orbit-line);
}
html[data-theme] body.folknity-v5 :is(.composer-prompt,.profile-shell.folknity-profile,.v4-media-preview){
  background:linear-gradient(128deg,var(--orbit-panel),var(--orbit-panel-deep));
}
html[data-theme] body.folknity-v5 :is(.side-link:hover,.widget-user:hover,.settings-tile:hover){
  background:color-mix(in srgb,var(--orbit-accent) 13%,var(--orbit-panel-deep));
}
html[data-theme] body.folknity-v5 .button:not(.secondary):not(.oauth){
  background:linear-gradient(110deg,var(--orbit-secondary),var(--orbit-accent) 68%,color-mix(in srgb,var(--orbit-accent) 82%,white));
  border-color:var(--orbit-line);
}
html[data-theme] body.folknity-v5 input:not([type=checkbox]):not([type=radio]):not([type=color]),
html[data-theme] body.folknity-v5 select,
html[data-theme] body.folknity-v5 textarea{
  background:color-mix(in srgb,var(--orbit-panel-deep) 94%,var(--orbit-bg));
  border-color:var(--orbit-line);
  color:#f7f8ff;
}
html[data-theme] body.folknity-v5 input::placeholder{color:var(--orbit-placeholder)}
html[data-theme] .ambient-orb{box-shadow:inset -18px -14px 28px rgba(2,5,40,.7),0 0 85px var(--orbit-glow)}
html[data-theme="nebula"] .ambient-orb{filter:hue-rotate(24deg)}
html[data-theme="horizon"] .ambient-orb{filter:hue-rotate(-33deg)}
html[data-theme="dusk"] .ambient-orb{filter:hue-rotate(18deg)}
/* Desktop search — ensure text, icon, cursor, input area and dropdown never overlap. */
body.folknity-v5 .v3-topbar .top-search{
  position:relative;display:flex;align-items:center;gap:10px;flex:1 1 270px;
  width:min(440px,36vw);min-width:180px;max-width:440px;height:44px;
  padding:0 12px;overflow:visible;border:1px solid var(--orbit-line);
  background:var(--orbit-panel-deep);border-radius:13px;isolation:isolate;
}
body.folknity-v5 .top-search-icon{display:grid;place-items:center;flex:0 0 20px;color:var(--orbit-accent);pointer-events:none}
body.folknity-v5 .top-search-icon .f-icon{width:19px;height:19px}
body.folknity-v5 .v3-topbar .top-search input[type="search"]{
  flex:1 1 auto;width:100%;min-width:0;max-width:none;height:100%;
  padding:0;margin:0;border:0!important;outline:0!important;
  box-shadow:none!important;background:transparent!important;color:#f6f6ff;
  font-size:13px;letter-spacing:0;line-height:1.35;text-overflow:ellipsis;
}
body.folknity-v5 .top-search:focus-within{border-color:var(--orbit-accent);box-shadow:0 0 0 3px var(--orbit-glow)}
/* Suggestions are an explicitly opened panel, with no personal-email disclosure. */
.folk-suggest-host{position:relative;isolation:isolate}
.folk-suggest-list{
  position:absolute;top:calc(100% + 8px);left:0;right:0;z-index:260;
  display:grid;gap:3px;padding:8px;max-height:360px;overflow-y:auto;
  background:color-mix(in srgb,var(--orbit-panel-deep) 98%,#fff);
  border:1px solid var(--orbit-line);border-radius:16px;
  box-shadow:0 24px 60px rgba(0,0,0,.48),0 0 35px var(--orbit-glow);
}
.folk-suggest-list[hidden]{display:none!important}
.folk-suggest-option{display:flex;align-items:center;gap:11px;min-width:0;padding:10px 12px;border-radius:11px;color:#eef1ff!important;text-decoration:none}
.folk-suggest-option:hover,.folk-suggest-option[aria-selected="true"]{background:color-mix(in srgb,var(--orbit-accent) 24%,var(--orbit-panel-deep))}
.folk-suggest-avatar{flex:0 0 38px;width:38px;height:38px;display:grid;place-items:center;border:1px solid var(--orbit-line);border-radius:50%;background:var(--orbit-panel);font-weight:850;color:white;overflow:hidden}
.folk-suggest-avatar img{display:block;width:100%;height:100%;object-fit:cover}
.folk-suggest-label{min-width:0;display:grid;gap:2px}
.folk-suggest-label strong,.folk-suggest-label small{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.folk-suggest-label strong{font-size:12px}.folk-suggest-label small{font-size:11px;color:#b4bfdd}
.folk-suggest-check{margin-left:auto;color:#77b6ff;font-size:12px}
.folk-suggest-empty{font-size:12px;color:#b8c4e0;padding:12px;text-align:center}
/* Explore: replace redundant format/date controls with a single search and scopes. */
body.folknity-v5 .v5-explore-form{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:center}
body.folknity-v5 .v5-explore-form .v4-explore-search{min-width:0;display:block}
body.folknity-v5 .v5-explore-form .v4-explore-search input{width:100%;height:46px}
body.folknity-v5 .v5-explore-form .folk-suggest-list{top:calc(100% + 5px);right:0}
/* Modern, functional ORBIT appearance picker (DB-persisted choice). */
.v5-appearance-card h2{margin:9px 0;font-size:24px}
.v5-theme-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:13px;margin:9px 0 4px}
.v5-theme-option{--sample-bg:#070c20;--sample-a:#8f75ff;--sample-b:#5a99ff;
  position:relative;display:grid;grid-template-columns:108px minmax(0,1fr) 20px;
  align-items:center;gap:13px;min-width:0;padding:12px;border-radius:17px;
  background:color-mix(in srgb,var(--orbit-panel-deep) 70%,var(--orbit-panel));
  border:1px solid var(--orbit-line);cursor:pointer;transition:transform .18s,border-color .18s,background .18s;
}
.v5-theme-option input{position:absolute;opacity:0;left:12px;top:12px;width:1px;height:1px}
.v5-theme-option:focus-within{outline:2px solid var(--orbit-accent);outline-offset:3px}
.v5-theme-option:has(input:checked){border-color:var(--orbit-accent);background:color-mix(in srgb,var(--orbit-accent) 13%,var(--orbit-panel-deep))}
.v5-theme-option:hover{transform:translateY(-2px);border-color:var(--orbit-accent)}
.v5-theme-option strong,.v5-theme-option small{display:block}
.v5-theme-option strong{font-size:13px;color:#fbfaff}.v5-theme-option small{font-size:10px;line-height:1.5;color:#adb9df;margin-top:5px}
.v5-theme-option .v5-theme-tick{color:var(--orbit-accent);font-size:17px;opacity:0}
.v5-theme-option:has(input:checked) .v5-theme-tick{opacity:1}
.v5-theme-preview{display:block;position:relative;height:78px;border-radius:11px;background:radial-gradient(circle at 77% 25%,color-mix(in srgb,var(--sample-a) 32%,transparent),transparent 55%),linear-gradient(140deg,var(--sample-bg),color-mix(in srgb,var(--sample-bg) 70%,var(--sample-b)));border:1px solid #ffffff29;overflow:hidden}
.v5-theme-preview i{position:absolute;display:block;border-radius:50%;box-shadow:inset -4px -5px 10px #0007,0 0 19px var(--sample-a)}
.v5-theme-preview i:first-child{width:39px;height:39px;top:18px;left:34px;background:radial-gradient(circle at 28% 23%,#d7d2ff,var(--sample-a) 40%,#291e5e)}
.v5-theme-preview i:nth-child(2){width:19px;height:19px;top:8px;right:12px;background:var(--sample-b)}
.v5-theme-preview i:nth-child(3){width:12px;height:12px;bottom:9px;left:15px;background:var(--sample-a)}
.v5-theme-nebula{--sample-bg:#0c0923;--sample-a:#a48aff;--sample-b:#8c75ff}
.v5-theme-horizon{--sample-bg:#041323;--sample-a:#6ca8ff;--sample-b:#6bd4f0}
.v5-theme-dusk{--sample-bg:#0b0e24;--sample-a:#b18dff;--sample-b:#8b9bff}
/* Mobile account menu: settings and logout can never disappear behind the desktop sidebar. */
.v5-account-menu{display:none;position:relative;z-index:230}
.v5-account-toggle{width:40px;height:40px;display:grid;place-items:center;cursor:pointer;
  background:color-mix(in srgb,var(--orbit-panel) 80%,var(--orbit-bg));border:1px solid var(--orbit-line);
  border-radius:12px;color:#f7f7ff}
.v5-account-toggle .f-icon{width:23px;height:23px}
.v5-account-toggle[aria-expanded="true"]{background:color-mix(in srgb,var(--orbit-accent) 25%,var(--orbit-panel-deep));border-color:var(--orbit-accent)}
.v5-account-panel{position:absolute;top:calc(100% + 11px);right:0;width:min(310px,calc(100vw - 24px));
  padding:9px;border:1px solid var(--orbit-line);border-radius:17px;background:var(--orbit-panel-deep);
  box-shadow:0 24px 65px #020518d9,0 0 30px var(--orbit-glow);max-height:calc(100dvh - 120px);overflow:auto}
.v5-account-panel[hidden]{display:none!important}
.v5-account-heading{display:flex;align-items:center;gap:11px;padding:11px 11px 15px;margin-bottom:6px;border-bottom:1px solid var(--orbit-line)}
.v5-account-heading strong,.v5-account-heading small{display:block;max-width:220px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.v5-account-heading strong{font-size:13px}.v5-account-heading small{font-size:11px;color:#afbbd6;margin-top:3px}
.v5-account-panel>a{display:flex;align-items:center;gap:11px;padding:13px 12px;border-radius:11px;color:#e7ebff!important;font-size:13px;font-weight:650}
.v5-account-panel>a:hover{background:color-mix(in srgb,var(--orbit-accent) 18%,var(--orbit-panel))}
.v5-account-panel>a .f-icon{width:20px;height:20px;color:var(--orbit-accent)}
.v5-account-panel .inline-form{display:block;width:100%;border-top:1px solid var(--orbit-line);padding-top:7px;margin-top:6px}
.v5-account-panel .v5-mobile-signout{display:block;width:100%;padding:13px;text-align:left;border:0;background:transparent;color:#f8c3d0;font:inherit;font-size:13px;font-weight:700;cursor:pointer;border-radius:11px}
.v5-account-panel .v5-mobile-signout:hover{background:rgba(220,87,129,.16)}
@media (max-width:1100px) and (min-width:801px){
  body.folknity-v5 .v3-topbar .top-search{flex-basis:165px;max-width:280px;min-width:150px}
  body.folknity-v5 .v3-topbar .top-create,body.folknity-v5 .v3-topbar .v5-desktop-profile{display:none}
  .v3-topbar .topbar-inner{gap:14px}
  .v3-topbar .top-actions{gap:7px}
}
@media(max-width:800px){
  body.folknity-v5 .v3-topbar .top-search{display:none}
  body.folknity-v5 .v3-topbar .top-create{display:none}
  body.folknity-v5 .v3-topbar .top-actions>.top-signout,
  body.folknity-v5 .v3-topbar .top-actions>.inline-form,
  body.folknity-v5 .v3-topbar .top-actions>.v5-desktop-profile,
  body.folknity-v5 .v3-topbar .top-actions>.v5-settings-link{display:none}
  body.folknity-v5 .v3-topbar .top-actions>a[title="Explore"],
  body.folknity-v5 .v3-topbar .top-actions>a[title="Messages"]{display:none}
  body.folknity-v5 .v3-topbar .top-actions{gap:9px}
  body.folknity-v5 .v5-account-menu{display:block}
  body.folknity-v5 .v3-topbar .topbar-inner{gap:9px}
  body.folknity-v5 .v3-topbar .top-actions>a[title="Notifications"]{width:39px;height:39px}
}
@media(max-width:560px){
  .v5-theme-grid{grid-template-columns:1fr}
  body.folknity-v5 .v5-explore-form{grid-template-columns:1fr}
  body.folknity-v5 .v5-explore-form .button{grid-column:auto}
  .v5-theme-option{grid-template-columns:104px minmax(0,1fr) 20px}
  .v3-topbar .brand{font-size:19px}
}
@media(prefers-reduced-motion:reduce){.v5-theme-option:hover{transform:none}}
