/* Swahili Social 0.17.6 — post box and story box.
 * Loaded after every older patch layer. Uses the site's --sts-* colours, so light and dark both work.
 * Tune: the three variables on .sts-cx and .sts-sc below. */

/* =========================================================
   POST BOX
   Closed: avatar + one rounded field. Open: the field grows, a toolbar appears.
   ========================================================= */
html:root body .sts-cx{
  --cx-field:var(--sts-panel2,#1c2025);
  --cx-ink:var(--sts-text,#f3f1ec);
  --cx-muted:var(--sts-muted,#99a0aa);
  --cx-brand:var(--sts-brand,#2dd4bf);
  --cx-brand-ink:var(--sts-brand-ink,#04211d);
  --cx-brand-soft:var(--sts-brand-soft,rgba(45,212,191,.13));
  display:block!important;position:relative;
  margin:0!important;padding:12px 16px 12px!important;min-height:0!important;
  border:0!important;border-bottom:1px solid var(--sts-line,#272b32)!important;border-radius:0!important;
  background:var(--sts-bg,#0e1013)!important;box-shadow:none!important;color:var(--cx-ink);
}
html:root body .sts-cx .sts-cx-row{display:grid!important;grid-template-columns:40px minmax(0,1fr) auto;column-gap:12px;align-items:start;margin:0!important;padding:0!important}
html:root body .sts-cx .sts-cx-avatar{display:block;width:40px!important;height:40px!important;flex:none!important;border-radius:50%!important;object-fit:cover;background:var(--cx-field);margin:2px 0 0!important}
html:root body .sts-cx .sts-cx-field{min-width:0;display:block;padding:0 14px;border-radius:22px;background:var(--cx-field);transition:background-color .15s}
html:root body .sts-cx textarea[name="sts_content"]{
  display:block;box-sizing:border-box;width:100%!important;min-height:0!important;max-height:420px;margin:0!important;
  padding:11px 0!important;border:0!important;outline:0!important;border-radius:0!important;background:transparent!important;box-shadow:none!important;
  color:var(--cx-ink)!important;font:inherit!important;font-size:16px!important;line-height:22px!important;resize:none!important;overflow:hidden;
}
html:root body .sts-cx textarea[name="sts_content"]::placeholder{color:var(--cx-muted);opacity:1}
html:root body .sts-cx .sts-cx-peek{display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;margin:0 -8px 0 -4px;border-radius:50%;color:var(--cx-brand);cursor:pointer;-webkit-tap-highlight-color:transparent}
html:root body .sts-cx .sts-cx-peek svg{width:22px;height:22px}

/* toolbar: only when open */
html:root body .sts-cx .sts-cx-bar{position:relative;display:none!important;align-items:center;gap:6px;margin:8px 0 0 52px!important;padding:0!important;min-height:0!important}
html:root body .sts-cx .sts-cx-tools{display:flex!important;align-items:center;gap:2px;margin:0!important;padding:0!important;flex:1;min-width:0}
html:root body .sts-cx .sts-cx-btn{
  position:relative;display:inline-flex!important;align-items:center;justify-content:center;
  width:40px!important;height:40px!important;min-width:0!important;margin:0!important;padding:0!important;
  border:0!important;border-radius:50%!important;background:transparent!important;color:var(--cx-brand)!important;
  font-size:0!important;line-height:1;cursor:pointer;list-style:none;-webkit-tap-highlight-color:transparent;
}
html:root body .sts-cx .sts-cx-btn::-webkit-details-marker{display:none}
html:root body .sts-cx .sts-cx-btn:hover,
html:root body .sts-cx .sts-cx-more[open]>summary{background:var(--cx-brand-soft)!important}
html:root body .sts-cx .sts-cx-btn svg{width:22px!important;height:22px!important;display:block}
html:root body .sts-cx .sts-image-label input{display:none!important}
html:root body .sts-cx .sts-cx-btn:focus-visible,
html:root body .sts-cx .sts-cx-post:focus-visible,
html:root body .sts-cx .sts-cx-remove:focus-visible{outline:2px solid var(--cx-brand);outline-offset:2px}

html:root body .sts-cx .sts-cx-more{position:static;display:block;margin:0!important;padding:0!important}
html:root body .sts-cx .sts-compose-options-menu{
  position:absolute!important;left:0!important;right:0!important;top:calc(100% + 8px)!important;bottom:auto!important;z-index:30;width:auto!important;max-width:420px;
  display:grid;gap:12px;margin:0!important;padding:14px!important;border:1px solid var(--sts-line,#272b32)!important;border-radius:18px!important;
  background:var(--sts-panel,#15181c)!important;box-shadow:0 18px 48px rgba(0,0,0,.34)!important;
}
html:root body .sts-cx .sts-compose-options-menu label{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:6px!important;margin:0!important;max-width:none!important}
html:root body .sts-cx .sts-compose-options-menu label>span{color:var(--cx-muted);font-size:13px;font-weight:700}
html:root body .sts-cx .sts-compose-options-menu select,
html:root body .sts-cx .sts-compose-options-menu input{width:100%!important;max-width:none!important;box-sizing:border-box;min-height:44px;border:1px solid var(--sts-line,#272b32);border-radius:12px;background:var(--cx-field);color:var(--cx-ink);font:inherit;font-size:15px;padding:0 10px}

/* character ring */
html:root body .sts-cx .sts-cx-count{position:relative;display:inline-grid;place-items:center;width:26px;height:26px;margin:0 2px 0 0;flex:none}
html:root body .sts-cx .sts-cx-count[hidden]{display:none!important}
html:root body .sts-cx .sts-cx-count svg{position:absolute;inset:0;width:100%;height:100%;transform:rotate(-90deg)}
html:root body .sts-cx .sts-cx-count circle{fill:none;stroke-width:2.6}
html:root body .sts-cx .sts-cx-count .bg{stroke:var(--sts-line,#272b32)}
html:root body .sts-cx .sts-cx-count .fg{stroke:var(--cx-brand);stroke-linecap:round}
html:root body .sts-cx .sts-cx-count.is-near .fg{stroke:#e6a23c}
html:root body .sts-cx .sts-cx-count.is-over .fg{stroke:var(--sts-heart,#f04858)}
html:root body .sts-cx .sts-cx-count b{position:relative;font-size:10.5px;font-weight:700;color:var(--cx-muted);font-variant-numeric:tabular-nums}
html:root body .sts-cx .sts-cx-count.is-over b{color:var(--sts-heart,#f04858)}

/* Post button */
html:root body .sts-cx .sts-cx-post{
  flex:none;min-height:38px;padding:0 22px!important;border:0!important;border-radius:999px!important;
  background:var(--cx-brand)!important;color:var(--cx-brand-ink)!important;font:inherit;font-size:15px!important;font-weight:800!important;letter-spacing:0;cursor:pointer;
}
html:root body .sts-cx .sts-cx-post:disabled{opacity:.38;cursor:not-allowed}
html:root body .sts-cx .sts-cx-post:not(:disabled):active{transform:scale(.97)}

/* photo thumbnails */
html:root body .sts-cx .sts-attach-preview{display:none!important;margin:0!important;padding:0 0 12px!important}
html:root body .sts-cx .sts-attach-preview[data-count="1"],
html:root body .sts-cx .sts-attach-preview[data-count="2"],
html:root body .sts-cx .sts-attach-preview[data-count="3"],
html:root body .sts-cx .sts-attach-preview[data-count="4"]{display:grid!important;gap:6px;grid-template-columns:repeat(2,minmax(0,1fr))}
html:root body .sts-cx .sts-attach-preview[data-count="1"]{grid-template-columns:1fr}
html:root body .sts-cx .sts-cx-thumb{position:relative;margin:0;overflow:hidden;border-radius:14px;background:var(--sts-bg,#0e1013);aspect-ratio:1/1}
html:root body .sts-cx .sts-attach-preview[data-count="1"] .sts-cx-thumb{aspect-ratio:16/10;max-height:360px}
html:root body .sts-cx .sts-attach-preview[data-count="3"] .sts-cx-thumb:first-child{grid-row:span 2;aspect-ratio:auto}
html:root body .sts-cx .sts-cx-thumb img{position:absolute;inset:0;width:100%!important;height:100%!important;max-width:none;object-fit:cover;border-radius:0!important}
html:root body .sts-cx .sts-cx-remove{position:absolute;top:8px;right:8px;display:grid;place-items:center;width:32px;height:32px;padding:0;border:0;border-radius:50%;background:rgba(10,12,14,.66);color:#fff;cursor:pointer}
html:root body .sts-cx .sts-cx-remove svg{width:16px;height:16px}
html:root body .sts-cx .sts-upload-progress{margin:0 0 0 52px}

/* poll */
html:root body .sts-cx .sts-poll-builder{display:block;margin:0 0 12px!important;padding:12px!important;border:1px solid var(--sts-line,#272b32)!important;border-radius:16px!important;background:var(--sts-bg,#0e1013)!important}
html:root body .sts-cx .sts-poll-builder[hidden]{display:none!important}
html:root body .sts-cx .sts-poll-builder-head{display:flex!important;justify-content:space-between;align-items:center;margin:0 0 6px!important;color:var(--cx-ink)!important;font-size:14px!important;font-weight:700!important}
html:root body .sts-cx .sts-poll-remove{border:0!important;background:transparent!important;color:var(--sts-heart,#f04858)!important;font:inherit;font-size:13px!important;font-weight:700;cursor:pointer;padding:4px 0}
html:root body .sts-cx .sts-poll-builder input{display:block!important;box-sizing:border-box;width:100%!important;min-height:42px;margin:6px 0 0!important;padding:0 12px!important;border:1px solid var(--sts-line,#272b32)!important;border-radius:12px!important;background:var(--cx-field)!important;color:var(--cx-ink)!important;font:inherit!important;font-size:15px!important;outline:0}
html:root body .sts-cx .sts-poll-builder input:focus{border-color:var(--cx-brand)!important}

/* extras that only matter once you are writing */
html:root body .sts-cx .sts-draft-state{display:none!important;align-items:center;justify-content:space-between;margin:8px 0 0 52px!important;color:var(--cx-muted)!important;font-size:12px!important}
html:root body .sts-cx .sts-draft-state a{color:var(--cx-brand)!important;font-weight:700;text-decoration:none}
html:root body .sts-cx .sts-admin-broadcast-tools{display:none!important;margin:10px 0 0 52px!important}
html:root body .sts-cx .sts-news-discussion-context{margin:0 0 10px 52px!important}

/* ---- open ---- */
html:root body .sts-cx.is-open .sts-cx-field{padding:2px 0 0;background:transparent}
html:root body .sts-cx.is-open textarea[name="sts_content"]{padding:9px 0 4px!important;font-size:18px!important;line-height:26px!important}
html:root body .sts-cx.is-open .sts-cx-peek{display:none}
html:root body .sts-cx.is-open .sts-cx-row{grid-template-columns:40px minmax(0,1fr)}
html:root body .sts-cx.is-open .sts-cx-bar{display:flex!important}
html:root body .sts-cx.is-open .sts-attach-preview[data-count]{margin-top:4px!important}
html:root body .sts-cx.is-open .sts-draft-state,
html:root body .sts-cx.is-open .sts-admin-broadcast-tools{display:flex!important}

/* full-page composer: always open, fills the screen */
html:root body .sts-compose-page .sts-cx{min-height:calc(100dvh - 78px)!important;padding:14px 16px 96px!important;border-bottom:0!important}
html:root body .sts-compose-page .sts-cx textarea[name="sts_content"]{font-size:19px!important}

@media (max-width:520px){
  html:root body .sts-cx{padding:10px 12px 10px!important}
  html:root body .sts-cx .sts-cx-bar,
  html:root body .sts-cx .sts-draft-state,
  html:root body .sts-cx .sts-admin-broadcast-tools,
  html:root body .sts-cx .sts-news-discussion-context{margin-left:0!important}
  html:root body .sts-cx .sts-upload-progress{margin-left:0}
}
@media (prefers-reduced-motion:reduce){html:root body .sts-cx *{transition:none!important}}


/* =========================================================
   STORY BOX
   A sheet on phones, a centred card on larger screens. The caption sits where viewers will see it.
   ========================================================= */
html:root body .sts-story-compose{display:grid;align-items:end;justify-items:center;padding:0!important;background:rgba(6,8,10,.74)}
html:root body .sts-story-compose[hidden]{display:none!important}
html:root body .sts-story-compose .sts-sc{
  --sc-brand:var(--sts-brand,#2dd4bf);--sc-brand-ink:var(--sts-brand-ink,#04211d);--sc-soft:var(--sts-brand-soft,rgba(45,212,191,.13));
  display:flex!important;flex-direction:column;gap:14px!important;box-sizing:border-box;
  width:min(100%,440px)!important;max-height:100dvh!important;overflow:auto;
  padding:16px 16px calc(16px + env(safe-area-inset-bottom))!important;
  border:0!important;border-radius:26px 26px 0 0!important;background:var(--sts-panel,#15181c)!important;color:var(--sts-text,#f3f1ec)!important;box-shadow:0 -12px 48px rgba(0,0,0,.4)!important;
  animation:sts-sc-up .22s ease-out;
}
@keyframes sts-sc-up{from{transform:translateY(24px);opacity:0}to{transform:none;opacity:1}}
@media (min-width:600px){
  html:root body .sts-story-compose{align-items:center;padding:24px!important}
  html:root body .sts-story-compose .sts-sc{border-radius:26px!important;max-height:calc(100dvh - 48px)!important}
}
@media (prefers-reduced-motion:reduce){html:root body .sts-story-compose .sts-sc{animation:none}}

html:root body .sts-sc .sts-sc-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
html:root body .sts-sc .sts-sc-head strong{display:block;font-size:18px;font-weight:800;letter-spacing:-.01em}
html:root body .sts-sc .sts-sc-head small{display:block;margin-top:2px;color:var(--sts-muted,#99a0aa);font-size:13px;font-weight:500}
html:root body .sts-sc .sts-sc-head button{display:grid;place-items:center;width:38px;height:38px;padding:0;border:0;border-radius:50%;background:var(--sts-panel2,#1c2025);color:inherit;cursor:pointer}
html:root body .sts-sc .sts-sc-head button svg{width:18px;height:18px}

html:root body .sts-sc .sts-sc-stage{position:relative;width:100%;aspect-ratio:4/5;max-height:min(56dvh,540px);margin:0 auto;overflow:hidden;border-radius:20px;background:var(--sts-panel2,#1c2025)}
html:root body .sts-sc .sts-sc-pick{position:absolute;inset:0;display:grid;place-items:center;width:auto;height:auto;max-height:none;aspect-ratio:auto;margin:0;border:1.5px dashed var(--sts-line,#2f343c);border-radius:20px;background:transparent;cursor:pointer;overflow:hidden}
html:root body .sts-sc .sts-sc-pick.has-image{border-color:transparent}
html:root body .sts-sc .sts-sc-pick input{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer}
html:root body .sts-sc .sts-sc-hint{display:flex;flex-direction:column;align-items:center;gap:4px;color:var(--sts-muted,#99a0aa)}
html:root body .sts-sc .sts-sc-hint b{display:grid;place-items:center;width:60px;height:60px;margin-bottom:10px;border-radius:50%;background:var(--sc-brand);color:var(--sc-brand-ink)}
html:root body .sts-sc .sts-sc-hint b svg{width:26px;height:26px}
html:root body .sts-sc .sts-sc-hint strong{color:var(--sts-text,#f3f1ec);font-size:17px;font-weight:700}
html:root body .sts-sc .sts-sc-hint small{font-size:13px}
html:root body .sts-sc .sts-sc-pick img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
html:root body .sts-sc .sts-sc-pick img[hidden]{display:none}
html:root body .sts-sc .sts-sc-pick.has-image .sts-sc-hint{display:none}
html:root body .sts-sc .sts-sc-change{display:none;position:absolute;top:12px;right:12px;padding:7px 13px;border-radius:999px;background:rgba(10,12,14,.62);color:#fff;font-size:13px;font-weight:700}
html:root body .sts-sc .sts-sc-pick.has-image .sts-sc-change{display:block}
html:root body .sts-sc .sts-sc-stage.has-image::after{content:"";position:absolute;left:0;right:0;bottom:0;height:38%;background:linear-gradient(to top,rgba(0,0,0,.62),transparent);pointer-events:none;z-index:1}
html:root body .sts-sc .sts-sc-caption{
  display:none;position:absolute;left:12px;right:12px;bottom:12px;z-index:2;box-sizing:border-box;width:auto;
  min-height:46px;padding:0 14px;border:0;border-radius:15px;background:rgba(10,12,14,.42);color:#fff;
  font:inherit;font-size:17px;font-weight:600;text-align:center;outline:0;
}
html:root body .sts-sc .sts-sc-stage.has-image .sts-sc-caption{display:block}
html:root body .sts-sc .sts-sc-caption::placeholder{color:rgba(255,255,255,.78)}
html:root body .sts-sc .sts-sc-caption:focus{background:rgba(10,12,14,.62);box-shadow:0 0 0 2px var(--sc-brand)}

html:root body .sts-sc .sts-sc-audience{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;margin:0;padding:4px;border:0;border-radius:16px;background:var(--sts-panel2,#1c2025);min-width:0}
html:root body .sts-sc .sts-sc-audience legend{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
html:root body .sts-sc .sts-sc-audience label{position:relative;display:block;margin:0}
html:root body .sts-sc .sts-sc-audience input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}
html:root body .sts-sc .sts-sc-audience span{display:grid;place-items:center;min-height:42px;padding:0 6px;border-radius:12px;color:var(--sts-muted,#99a0aa);font-size:14px;font-weight:700;text-align:center;line-height:1.15}
html:root body .sts-sc .sts-sc-audience input:checked+span{background:var(--sc-soft);color:var(--sc-brand);box-shadow:inset 0 0 0 1.5px var(--sc-brand)}
html:root body .sts-sc .sts-sc-audience input:focus-visible+span{outline:2px solid var(--sc-brand);outline-offset:2px}

html:root body .sts-sc .sts-story-compose-actions{display:grid!important;grid-template-columns:auto minmax(0,1fr);gap:10px;margin:0!important}
html:root body .sts-sc .sts-story-compose-actions button{min-height:50px;border-radius:16px;font:inherit;font-size:16px;font-weight:800;cursor:pointer}
html:root body .sts-sc .sts-story-compose-actions button[type="button"]{padding:0 20px;border:0;background:transparent;color:var(--sts-muted,#99a0aa)}
html:root body .sts-sc .sts-story-compose-actions .primary{border:0;background:var(--sc-brand);color:var(--sc-brand-ink)}
html:root body .sts-sc .sts-story-compose-actions .primary:disabled{opacity:.38;cursor:not-allowed}
html:root body .sts-sc .sts-story-compose-actions button:focus-visible,
html:root body .sts-sc .sts-sc-head button:focus-visible{outline:2px solid var(--sc-brand);outline-offset:2px}

@media (max-height:640px){html:root body .sts-sc .sts-sc-stage{aspect-ratio:1/1;max-height:42dvh}}
