/* ==========================================================================
   SOCIAL — the page (social.html) and TikTok's way back
   (social/tiktok/callback.html), 2026-10-21.

   Additions only, on the Office's own system: every colour, size and radius
   is office.css's token (--o-*), every button the Office's (.ofc-primary,
   .ofc-ghost), every field .ofc-fields. Colour only for state (green done,
   amber waiting on you, red refused); white the one emphasis. Each section
   is a plane on the stage, as the Office's views are. No :root, no focus
   ring of its own: focus is the Office's lit edge.

   The CSP refuses style="" attributes: everything is here, by class.
   ========================================================================== */

/* ---------- the page -------------------------------------------------------- */
#office .so-boot { margin: 0 0 1.25rem; color: var(--o-dim); font-size: var(--o-t-md); font-weight: 550; line-height: 1.5; }
#office .so-boot .ofc-ghost { margin-left: 0.5rem; }
#office .so-grid { gap: 1rem; }
#office .so-grid > .so-card {
  padding: 20px var(--o-pad-x, 24px) 24px;
  background: var(--o-plane, var(--tk-grey-14));
  border: 1px solid var(--o-plane-edge, var(--tk-grey-23));
  border-radius: var(--o-r-lg);
  box-shadow: var(--o-depth, none);
  --o-bg: var(--o-plane, var(--tk-grey-14));
  --o-panel: var(--o-plane, var(--tk-grey-14));
}
#office .so-card .ofc-sub { margin-bottom: 1rem; }
#office .so-card > h2 + .ofc-sub { margin-top: 0.25rem; }

/* A STATE IS A DOT AND A WORD (the Office's tables, KERNEL §5). */
:is(#office, #portal) .so-st { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--o-dim); font: 600 var(--o-t-sm)/1.3 var(--body); }
:is(#office, #portal) .so-st::before { content: ''; flex: none; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--o-neutral); }
:is(#office, #portal) .so-st[data-tone="ok"] { color: var(--o-ok); }
:is(#office, #portal) .so-st[data-tone="ok"]::before { background: var(--o-ok-mark); }
:is(#office, #portal) .so-st[data-tone="attn"] { color: var(--o-warn-ink); }
:is(#office, #portal) .so-st[data-tone="attn"]::before { background: var(--o-warn); }
:is(#office, #portal) .so-st[data-tone="bad"] { color: var(--o-bad); }
:is(#office, #portal) .so-st[data-tone="bad"]::before { background: var(--o-bad-mark); }
/* Waiting is a ring: nothing has happened yet. */
:is(#office, #portal) .so-st[data-tone="wait"]::before { box-sizing: border-box; background: transparent; border: 1.5px solid var(--o-faint); }
:is(#office, #portal) .so-st[data-tone="run"] { color: var(--o-text); }
:is(#office, #portal) .so-st[data-tone="run"]::before { background: var(--o-text); animation: so-beat 1.6s var(--o-ease, ease) infinite; }
@keyframes so-beat { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { :is(#office, #portal) .so-st[data-tone="run"]::before { animation: none; } }

/* The master switch, said in one line over the list. */
#office .so-master { margin: 0 0 1rem; padding: 0.5rem 0.75rem; border: 1px solid var(--o-line-2); border-radius: var(--o-r-sm);
  background: var(--o-inset); color: var(--o-dim); font-size: var(--o-t-sm); font-weight: 550; line-height: 1.5; }
#office .so-master:empty { display: none; }
#office .so-master[data-tone="attn"] { border-color: var(--o-line-2); }
#office .so-master[data-tone="attn"]::before,
#office .so-master[data-tone="ok"]::before { content: ''; display: inline-block; width: 0.45rem; height: 0.45rem; margin: 0 0.5rem 1px 0; border-radius: 50%; background: var(--o-warn); }
#office .so-master[data-tone="ok"]::before { background: var(--o-ok-mark); }

/* ---------- the networks ------------------------------------------------------ */
#office .so-nets { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--o-line-2); }
/* Nothing listed (Social not reached): no rule under the sentence that says so (23 Oct). */
#office .so-nets:empty, #office .so-recent:empty { display: none; }
#office .so-net {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem 1.25rem;
  min-height: var(--o-row, 44px);
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--o-line-2);
}
/* The last row ends on the card's own edge, not a rule just above it (the wall, 23 Oct). */
#office .so-net:last-child, #office .so-post-row:last-child { border-bottom: 0; }
#office .so-net--tiktok { padding: 1rem 0; }
#office .so-net__main { display: grid; gap: 0.25rem; min-width: 0; }
#office .so-net__top { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; }
#office .so-net__name { color: var(--o-text); font: 650 var(--o-t-md)/1.3 var(--body); }
#office .so-net--tiktok .so-net__name { color: var(--tk-white); font-size: var(--o-t-lg); }
#office .so-app { padding: 2px 0.5rem; border-radius: var(--o-r-sm); background: var(--o-inset); color: var(--o-dim); font: 600 var(--o-t-xs)/1.3 var(--body); }
#office .so-net__as { display: flex; align-items: center; gap: 0.5rem; margin: 0.25rem 0 0; color: var(--o-dim); font-size: var(--o-t-sm); font-weight: 500; }
#office .so-net__k { color: var(--o-faint); }
#office .so-net__who { color: var(--tk-white); font-weight: 650; overflow-wrap: anywhere; }
:is(#office, #portal) .so-av { flex: none; width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--o-inset); box-shadow: 0 0 0 1px var(--o-line-2); }
#office .so-net__meta { margin: 0; color: var(--o-dim); font-size: var(--o-t-sm); font-weight: 500; line-height: 1.5; }
#office .so-net__meta:empty { display: none; }
#office .so-net__err { margin: 0; color: var(--o-bad); font-size: var(--o-t-sm); font-weight: 500; line-height: 1.45; overflow-wrap: anywhere; }
#office .so-net__acts { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.5rem; max-width: 26rem; }
#office .so-ro { color: var(--o-faint); font-size: var(--o-t-xs); font-weight: 550; }
#office .so-confirm { flex: 1 1 100%; margin: 0; color: var(--o-text); font-size: var(--o-t-sm); font-weight: 550; line-height: 1.4; text-align: right; }
:is(#office) .ofc-ghost.so-danger { color: var(--o-bad); }
:is(#office) .ofc-ghost.so-danger:hover:not(:disabled) { border-color: var(--o-bad-mark); color: var(--o-bad); }
#office .so-note { margin: 0.25rem 0 0; color: var(--o-dim); font-size: var(--o-t-sm); font-weight: 550; line-height: 1.5; }
#office .so-note.is-ok { color: var(--o-ok); }
#office .so-note.is-bad { color: var(--o-bad); }
#office .so-note:focus { outline: none; }

/* ---------- the composer -------------------------------------------------------- */
#office .so-compose { display: grid; gap: 1.25rem; }
#office .so-as { display: flex; align-items: center; gap: 0.75rem; }
#office .so-as:empty { display: none; }
#office .so-as__av { flex: none; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--o-inset); box-shadow: 0 0 0 1px var(--o-line-3); }
#office .so-as__t { margin: 0; color: var(--o-dim); font-size: var(--o-t-sm); font-weight: 500; line-height: 1.4; }
#office .so-as__k { color: var(--o-faint); }
#office .so-as__name { color: var(--tk-white); font: 650 var(--o-t-lg)/1.3 var(--body); }
#office .so-as__user { color: var(--o-faint); }
#office .so-cannot { margin: 0; }

#office .so-legend { padding: 0; margin: 0 0 0.5rem; color: var(--o-faint); font-size: var(--o-t-label, 0.78rem); font-weight: 600; }
#office :is(.so-films, .so-allow) { min-width: 0; margin: 0; padding: 0; border: 0; }

/* THE FILMS: a row of posters, each a whole target, the chosen one lit. */
#office .so-films__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr)); gap: 0.5rem; }
#office .so-film {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
  min-height: 72px;
  padding: 0.5rem 0.75rem 0.5rem 0.5rem;
  border: 1px solid var(--o-line-2);
  border-radius: var(--o-r-sm);
  background: var(--o-inset);
  cursor: pointer;
  transition: border-color 140ms var(--o-ease, ease), background-color 140ms var(--o-ease, ease);
}
#office .so-film:hover { border-color: var(--o-line-3); }
#office .so-film:has(input:checked) { border-color: var(--tk-white); background: var(--o-raised); }
/* A film that cannot go stays solid (rule 5: nothing faded; at 0.6 its length read at 2.84:1): its title steps
   down to the quiet ink, and its reason, in the attention ink, says why. */
#office .so-film:has(input:disabled) { cursor: default; }
#office .so-film:has(input:disabled) .so-film__t { color: var(--o-dim); }
#office .so-film:has(input:disabled):hover { border-color: var(--o-line-2); }
#office .so-film:has(input:focus-visible) { outline: 1px solid var(--focus-edge); outline-offset: 2px; box-shadow: 0 0 0 1px var(--focus-halo); }
/* The radio is the label's own: read by a screen reader and the keyboard, drawn by the card. */
#office .so-film input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: inherit; }
#office .so-film__img { display: block; width: 36px; height: 64px; border-radius: var(--tk-r-xs); object-fit: cover; background: var(--o-frame, var(--tk-grey-07)); box-shadow: 0 0 0 1px var(--o-line-2); }
#office .so-film__w { display: grid; gap: 2px; min-width: 0; }
#office .so-film__t { color: var(--o-text); font: 650 var(--o-t-sm)/1.3 var(--body); overflow-wrap: anywhere; }
#office .so-film__len { color: var(--o-faint); font-size: var(--o-t-xs); font-weight: 550; font-variant-numeric: tabular-nums; }
#office .so-film__why { color: var(--o-warn-ink); font-size: var(--o-t-xs); font-weight: 550; line-height: 1.35; }

/* THE STAGE: the preview beside the choices. */
#office .so-stage { display: grid; grid-template-columns: minmax(12rem, 15.5rem) minmax(0, 1fr); align-items: start; gap: 1.5rem 2rem; }
#office .so-preview { position: sticky; top: 0.5rem; margin: 0; display: grid; gap: 0.5rem; }
#office .so-video { display: block; width: 100%; aspect-ratio: 9 / 16; border-radius: var(--o-r); background: var(--o-frame, var(--tk-grey-07)); box-shadow: 0 0 0 1px var(--o-line-2), 0 24px 48px -32px var(--tk-black); object-fit: contain; }
#office .so-preview__cap { color: var(--o-faint); font-size: var(--o-t-xs); font-weight: 500; line-height: 1.45; }

#office .so-form.ofc-fields { grid-template-columns: minmax(0, 1fr); gap: 1rem; max-width: 40rem; }
#office .so-form .ofc-field--wide { max-width: none; }
#office .so-caption textarea { min-height: 8.5rem; font: 500 var(--o-t-sm)/1.55 var(--body); }
#office .so-count { justify-self: end; color: var(--o-faint); font-size: var(--o-t-xs); font-weight: 550; font-variant-numeric: tabular-nums; }
#office .so-count.is-over { color: var(--o-bad); }
#office .so-privacy select { max-width: 22rem; min-height: 38px; }
#office .so-hint { margin: -0.5rem 0 0; color: var(--o-faint); font-size: var(--o-t-xs); font-weight: 500; line-height: 1.5; }
#office .so-hint--attn { color: var(--o-warn-ink); }
#office .so-hint[hidden] { display: none; }

#office .so-allow__row { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
#office .ofc-fields label.so-check { align-self: start; min-height: 2rem; }
#office .ofc-fields label.so-check.is-off { color: var(--o-faint); }
#office .so-check__why { color: var(--o-faint); font-size: var(--o-t-xs); font-weight: 500; }
#office .ofc-fields label.so-check--block { align-items: flex-start; }
#office .ofc-fields label.so-check--block input { margin-top: 2px; }
#office .so-check__w { display: grid; gap: 2px; }
#office .so-check__t { color: var(--o-text); font-weight: 600; }
#office .so-check__h { color: var(--o-faint); font-size: var(--o-t-xs); font-weight: 500; line-height: 1.45; }
#office label.so-check.is-off .so-check__t { color: var(--o-faint); }

/* COMMERCIAL CONTENT: a switch, and what it opens. */
#office .so-disclose { display: grid; gap: 0.5rem; padding: 0.75rem 1rem; border: 1px solid var(--o-line-2); border-radius: var(--o-r-sm); background: var(--o-inset); }
#office .so-disclose .so-hint { margin: -0.25rem 0 0; }
#office .so-disclose__row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
#office .so-disclose__t { color: var(--o-text); font: 600 var(--o-t-sm)/1.3 var(--body); }
#office .so-disclose__opts { display: grid; gap: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--o-line-2); }
#office .so-disclose__opts[hidden] { display: none; }
:is(#office) .so-switch {
  position: relative;
  flex: none;
  width: 44px;
  height: 26px;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--o-line-3);
  border-radius: 13px;
  background: var(--o-frame, var(--tk-grey-07));
  box-shadow: none;
  cursor: pointer;
  transition: background-color var(--tk-dur-fast) var(--o-ease, ease), border-color var(--tk-dur-fast) var(--o-ease, ease);
}
:is(#office) .so-switch:hover { border-color: var(--o-line-4); }
:is(#office) .so-switch:active { transform: none; }
:is(#office) .so-switch__knob { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--o-dim); transition: transform var(--tk-dur-fast) var(--o-ease, ease), background-color var(--tk-dur-fast) var(--o-ease, ease); }
:is(#office) .so-switch[aria-checked="true"] { border-color: var(--tk-white); background: var(--tk-white); }
:is(#office) .so-switch[aria-checked="true"] .so-switch__knob { transform: translateX(18px); background: var(--o-on-accent, var(--tk-grey-0a)); }
@media (prefers-reduced-motion: reduce) { :is(#office) :is(.so-switch, .so-switch__knob) { transition: none; } }
#office .so-label { margin: 0; color: var(--tk-white); font-size: var(--o-t-sm); font-weight: 600; line-height: 1.45; }
#office .so-label[hidden] { display: none; }

/* THE DECLARATION, then the buttons. */
#office .so-declare { margin: 0.25rem 0 0; color: var(--o-dim); font-size: var(--o-t-sm); font-weight: 500; line-height: 1.5; }
#office .so-declare a { color: var(--o-text); text-decoration: underline; text-underline-offset: 3px; }
#office .so-declare a:hover { color: var(--tk-white); }
#office .so-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
#office .so-postwrap { display: inline-flex; }
#office .so-post { min-height: 40px; padding: 0 1rem; }
#office .so-acts .ofc-ghost { min-height: 40px; }
#office .so-why { margin: -0.5rem 0 0; color: var(--o-warn-ink); font-size: var(--o-t-sm); font-weight: 550; line-height: 1.45; }
#office .so-why[hidden] { display: none; }
#office .so-manual { margin: -0.5rem 0 0; color: var(--o-faint); font-size: var(--o-t-xs); font-weight: 500; line-height: 1.5; }
#office .so-progress { display: grid; gap: 0.25rem; padding: 0.75rem 0.75rem; border: 1px solid var(--o-line-2); border-radius: var(--o-r-sm); background: var(--o-inset); }
#office .so-progress[hidden] { display: none; }
#office .so-progress__t { margin: 0; font-size: var(--o-t-md); }
#office .so-progress .so-hint { margin: 0; }

/* ---------- posted from here ------------------------------------------------------ */
#office .so-recent { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--o-line-2); }
#office .so-post-row { display: grid; gap: 0.25rem; padding: 0.75rem 0; border-bottom: 1px solid var(--o-line-2); }
#office .so-post-row__top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; }
#office .so-post-row__t { color: var(--o-text); font: 650 var(--o-t-md)/1.35 var(--body); }
#office .so-post-row__when { color: var(--o-faint); font-size: var(--o-t-xs); font-weight: 500; }
#office .so-post-row__how { margin: 0; color: var(--o-dim); font-size: var(--o-t-sm); font-weight: 500; }
#office .so-none { padding: 1rem 0; color: var(--o-faint); font-size: var(--o-t-sm); font-weight: 500; }

/* ---------- a phone ------------------------------------------------------------------- */
@media (max-width: 47.9375rem) {
  #office .so-stage { grid-template-columns: minmax(0, 1fr); }
  #office .so-preview { position: static; max-width: 15rem; justify-self: center; }
  #office .so-films__list { display: flex; gap: 0.5rem; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; padding-bottom: 0.25rem; }
  #office .so-film { flex: 0 0 13.5rem; scroll-snap-align: start; }
}
@media (max-width: 40rem) {
  #office .so-grid > .so-card { padding: 16px 16px 20px; }
  #office .so-net { grid-template-columns: minmax(0, 1fr); }
  #office .so-net__acts { justify-content: flex-start; max-width: none; }
  #office .so-confirm { text-align: left; }
  #office .so-acts > * { flex: 1 1 100%; }
  #office .so-postwrap .so-post,
  #office .so-acts .ofc-ghost { width: 100%; justify-content: center; }
}

/* ==========================================================================
   TIKTOK'S WAY BACK (social/tiktok/callback.html): one plane on the black,
   one line, and the way back to Social.
   ========================================================================== */
#portal.so-cb { display: grid; min-height: 100dvh; max-width: none; margin: 0; padding: 0 16px; place-items: center; background: var(--o-frame, var(--tk-grey-07)); }
#portal .so-cb__plane {
  display: grid;
  gap: 1rem;
  width: min(100%, 28rem);
  padding: 28px 28px 32px;
  border: 1px solid var(--o-plane-edge, var(--tk-grey-23));
  border-radius: var(--tk-r-xl);
  background: var(--o-plane, var(--tk-grey-14));
  box-shadow: inset 0 1px 0 var(--tk-white-a040), 0 30px 60px -40px var(--tk-black);
}
#portal .so-cb__brand { display: flex; align-items: center; gap: 0.5rem; color: var(--o-dim); font: 600 var(--o-t-sm)/1.2 var(--body); }
#portal .so-cb__brand img { width: 26px; height: 26px; }
#portal.so-cb .so-cb__plane h1 { margin: 0.5rem 0 0; color: var(--tk-white); font: 300 1.6rem/1.15 var(--display); letter-spacing: -0.02em; }
#portal .so-cb__say { margin: 0; color: var(--o-text); font-size: var(--o-t-md); font-weight: 600; line-height: 1.5; }
#portal .so-cb__say[data-tone="ok"] { color: var(--o-ok); }
#portal .so-cb__say[data-tone="bad"] { color: var(--o-bad); }
#portal .so-cb__more { margin: -0.5rem 0 0; color: var(--o-dim); font-size: var(--o-t-sm); font-weight: 500; line-height: 1.5; overflow-wrap: anywhere; }
#portal .so-cb__more[hidden], #portal .so-cb__back[hidden] { display: none; }
#portal .so-cb__back { justify-self: start; }
