/* ==========================================================================
   Heirloom Social — social.css
   Load AFTER app.css. Pure CSS: no fonts, images, URLs or external assets.
   Scope:
     - New components: .social-* (new names, no legacy collisions)
     - Overrides of existing shell: body.has-social (feature flag) / #socialViews
     - Social dialog: #socialDialog only (legacy dialogs untouched)
   Decorative elements (.social-orbit, .social-story-art, .social-person-cover,
   .social-profile-cover) are procedural gradients, never user photos.
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. [hidden] always wins. Nothing in this file may reveal hidden content.
   -------------------------------------------------------------------------- */
body.has-social [hidden],
#socialViews [hidden],
#socialDialog [hidden] {
  display: none !important;
}

/* --------------------------------------------------------------------------
   1. Tokens + surface contexts
   Components read context variables (--s-fg, --s-muted, --s-link …), so the
   same element renders correctly on the dark shell or on ivory paper.
   -------------------------------------------------------------------------- */
#socialViews,
#socialDialog {
  --s-forest-950: #0b130f;
  --s-forest-900: #0e1712;
  --s-forest-800: #14201a;
  --s-forest-700: #1c2e24;
  --s-forest-600: #24513c;
  --s-forest-500: #2f5a45;

  --s-paper: #f7f2e7;
  --s-paper-hi: #fbf7ee;
  --s-paper-2: #efe6d3;
  --s-paper-3: #e6dac2;
  --s-paper-line: rgba(74, 58, 28, 0.14);
  --s-field-line: #958567;          /* >= 3:1 against field background */

  --s-ink: #221f1a;
  --s-ink-2: #3b352c;
  --s-ink-muted: #6b6152;           /* ~5.4:1 on --s-paper */

  --s-gold: #c9a85a;
  --s-gold-soft: #e6d29c;
  --s-gold-deep: #7a5c1e;           /* ~5.5:1 on --s-paper */
  --s-starlight: #f6ecd0;

  --s-on-dark: #f3ecdc;
  --s-on-dark-strong: #f8f1e1;
  --s-on-dark-muted: #c4bba8;
  --s-on-dark-line: rgba(230, 210, 156, 0.16);

  --s-danger: #9b3b2e;
  --s-danger-soft: #f6e3dd;

  --s-serif: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
  --s-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --s-radius-lg: 20px;
  --s-radius: 16px;
  --s-radius-sm: 12px;
  --s-ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  --s-shadow-card:
    0 1px 0 rgba(255, 255, 255, 0.65) inset,
    0 1px 2px rgba(6, 10, 8, 0.25),
    0 22px 40px -26px rgba(0, 0, 0, 0.7);
  --s-shadow-lift:
    0 1px 0 rgba(255, 255, 255, 0.65) inset,
    0 2px 4px rgba(6, 10, 8, 0.25),
    0 28px 48px -22px rgba(0, 0, 0, 0.75);
  --s-shadow-soft:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 10px 26px -20px rgba(0, 0, 0, 0.65);
}

/* Dark (shell) context — default inside #socialViews */
#socialViews {
  --s-fg: var(--s-on-dark);
  --s-fg-strong: var(--s-on-dark-strong);
  --s-muted: var(--s-on-dark-muted);
  --s-line: var(--s-on-dark-line);
  --s-link: var(--s-gold-soft);
  --s-focus: #f0dca4;
  --s-tint: rgba(243, 236, 220, 0.08);
  --s-avatar-ring: var(--s-forest-800);

  --s-btn-bg: rgba(243, 236, 220, 0.06);
  --s-btn-fg: var(--s-on-dark);
  --s-btn-line: rgba(230, 210, 156, 0.3);
  --s-primary-bg: var(--s-gold-soft);
  --s-primary-fg: #1a1712;
  --s-primary-hover: #f0dfae;
  --s-outline-fg: var(--s-on-dark);
  --s-outline-line: rgba(230, 210, 156, 0.45);

  position: relative;
  color: var(--s-fg);
  font-family: var(--s-sans);
}

/* Paper context — ivory cards and the social dialog */
.social-post,
.social-composer,
.social-person,
.social-profile-hero,
.social-request-row,
#socialDialog {
  --s-fg: var(--s-ink);
  --s-fg-strong: var(--s-ink);
  --s-muted: var(--s-ink-muted);
  --s-line: var(--s-paper-line);
  --s-link: var(--s-forest-600);
  --s-focus: #1f5a40;
  --s-tint: rgba(36, 81, 60, 0.08);
  --s-avatar-ring: var(--s-paper);

  --s-btn-bg: var(--s-paper-2);
  --s-btn-fg: var(--s-ink);
  --s-btn-line: rgba(74, 58, 28, 0.22);
  --s-primary-bg: #1f3a2d;
  --s-primary-fg: var(--s-paper);
  --s-primary-hover: #284a39;
  --s-outline-fg: var(--s-ink);
  --s-outline-line: rgba(34, 31, 26, 0.32);

  color: var(--s-fg);
}

#socialViews *,
#socialViews *::before,
#socialViews *::after,
#socialDialog *,
#socialDialog *::before,
#socialDialog *::after {
  box-sizing: border-box;
}

/* Focus: one consistent, context-aware ring */
#socialViews :focus-visible,
#socialDialog :focus-visible {
  outline: 3px solid var(--s-focus);
  outline-offset: 2px;
}

#socialViews a:not(.btn),
#socialDialog a:not(.btn) {
  color: var(--s-link);
  text-underline-offset: 0.18em;
}

/* --------------------------------------------------------------------------
   2. Buttons inside social surfaces (scoped; legacy .btn elsewhere untouched)
   -------------------------------------------------------------------------- */
#socialViews .btn,
#socialDialog .btn {
  --s-b-bg: var(--s-btn-bg);
  --s-b-fg: var(--s-btn-fg);
  --s-b-line: var(--s-btn-line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  min-width: 44px;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--s-b-line);
  border-radius: 999px;
  background: var(--s-b-bg);
  color: var(--s-b-fg);
  font: 600 0.92rem/1.2 var(--s-sans);
  text-align: center;
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition:
    background-color 0.18s var(--s-ease),
    border-color 0.18s var(--s-ease),
    color 0.18s var(--s-ease),
    box-shadow 0.18s var(--s-ease);
}

#socialViews .btn:hover,
#socialDialog .btn:hover {
  border-color: var(--s-outline-line);
  box-shadow: 0 0 0 4px var(--s-tint);
}

#socialViews .btn-primary,
#socialDialog .btn-primary {
  --s-b-bg: var(--s-primary-bg);
  --s-b-fg: var(--s-primary-fg);
  --s-b-line: var(--s-primary-bg);
}

#socialViews .btn-primary:hover,
#socialDialog .btn-primary:hover {
  --s-b-bg: var(--s-primary-hover);
  border-color: var(--s-primary-hover);
}

#socialViews .btn-outline,
#socialDialog .btn-outline {
  --s-b-bg: transparent;
  --s-b-fg: var(--s-outline-fg);
  --s-b-line: var(--s-outline-line);
}

#socialViews .btn:disabled,
#socialViews .btn[aria-disabled="true"],
#socialDialog .btn:disabled,
#socialDialog .btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

/* Shared reset for social-only button types */
.social-author,
.social-menu,
.social-text-btn,
.social-compose-trigger,
.social-person-open,
.social-feed-tabs button,
.social-friends-tabs button {
  margin: 0;
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* --------------------------------------------------------------------------
   3. View shell + header
   -------------------------------------------------------------------------- */
/* NOTE: display is never set on .social-view; visibility stays with app/[hidden]. */
.social-view {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding: clamp(1.25rem, 3vw, 2.5rem) clamp(1rem, 3.2vw, 2.75rem) 4.5rem;
  color: var(--s-fg);
  font-family: var(--s-sans);
  /* sparse starlight in the top band only */
  background-image:
    radial-gradient(circle at 84% 16%, rgba(246, 236, 208, 0.7) 0 1px, transparent 1.8px),
    radial-gradient(circle at 92% 42%, rgba(246, 236, 208, 0.45) 0 0.8px, transparent 1.5px),
    radial-gradient(circle at 71% 8%, rgba(246, 236, 208, 0.5) 0 0.8px, transparent 1.5px),
    radial-gradient(circle at 63% 30%, rgba(246, 236, 208, 0.35) 0 0.8px, transparent 1.5px),
    radial-gradient(60% 100% at 90% 0%, rgba(201, 168, 90, 0.08), transparent 70%);
  background-repeat: no-repeat;
  background-size: 100% 360px;
  background-position: top center;
}

.social-view-header {
  position: relative;
  display: grid;
  gap: 0.5rem;
  margin: 0 0 1.75rem;
  padding-bottom: 1.25rem;
  min-width: 0;
}

.social-view-header > * {
  min-width: 0;
}

.social-view-header::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 7px;
  height: 7px;
  background: var(--s-gold-soft);
  transform: rotate(45deg);
  box-shadow: 0 0 10px rgba(230, 210, 156, 0.55);
  pointer-events: none;
}

.social-view-header::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(230, 210, 156, 0.5), rgba(230, 210, 156, 0.12) 45%, transparent);
  pointer-events: none;
}

.social-view-header .eyebrow {
  margin: 0;
  color: var(--s-gold-soft);
  font: 700 0.74rem/1.4 var(--s-sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.social-view-header h1 {
  margin: 0;
  color: var(--s-on-dark-strong);
  font: 400 clamp(1.75rem, 1.2rem + 2vw, 2.6rem)/1.12 var(--s-serif);
  letter-spacing: -0.01em;
  overflow-wrap: break-word;
  hyphens: auto;
}

.social-view-header .lede {
  margin: 0;
  max-width: 62ch;
  color: var(--s-on-dark-muted);
  font-size: 1rem;
  line-height: 1.6;
}

.social-context-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.social-context-row > * {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 32px;
  max-width: 100%;
  margin: 0;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--s-on-dark-line);
  border-radius: 999px;
  background: rgba(243, 236, 220, 0.04);
  color: var(--s-on-dark-muted);
  font: 500 0.8rem/1.3 var(--s-sans);
  overflow-wrap: anywhere;
}

.social-context-row > button {
  min-height: 44px;
  cursor: pointer;
}

.social-context-row > button[aria-pressed="true"] {
  border-color: rgba(230, 210, 156, 0.55);
  background: rgba(230, 210, 156, 0.12);
  color: var(--s-on-dark-strong);
}

/* --------------------------------------------------------------------------
   4. Layout: center column + 260px rail
   -------------------------------------------------------------------------- */
.social-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: clamp(1.5rem, 3vw, 2.5rem);
  align-items: start;
}

.social-main-column {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
  max-width: 680px;
  min-width: 0;
}

.social-rail {
  position: sticky;
  top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

/* --------------------------------------------------------------------------
   5. Feed: welcome, composer, tabs, list
   -------------------------------------------------------------------------- */
.social-welcome {
  position: relative;
  min-height: 7.25rem;
  padding: 1.2rem 8.75rem 1.25rem 1.35rem;
  border: 1px solid var(--s-on-dark-line);
  border-radius: var(--s-radius);
  background:
    radial-gradient(90% 140% at 100% 50%, rgba(201, 168, 90, 0.1), transparent 60%),
    linear-gradient(135deg, rgba(36, 58, 46, 0.6), rgba(14, 23, 18, 0.78));
  color: var(--s-on-dark);
  overflow: hidden;
}

.social-welcome h2 {
  margin: 0 0 0.35rem;
  color: var(--s-on-dark-strong);
  font: 400 1.35rem/1.25 var(--s-serif);
  overflow-wrap: break-word;
  hyphens: auto;
}

.social-welcome p {
  margin: 0;
  max-width: 52ch;
  color: var(--s-on-dark-muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

/* Orbit: one ring, one tilted orbit, a slow satellite, five fixed stars */
.social-orbit {
  position: absolute;
  top: 50%;
  right: 1.35rem;
  width: 104px;
  height: 104px;
  border: 1px solid rgba(230, 210, 156, 0.26);
  border-radius: 50%;
  transform: translateY(-50%);
  background:
    radial-gradient(circle at 50% 50%, #f3e2ad 0 3px, rgba(243, 226, 173, 0.25) 4px, transparent 15px),
    radial-gradient(circle at 16% 28%, rgba(255, 248, 226, 0.85) 0 1px, transparent 1.8px),
    radial-gradient(circle at 82% 20%, rgba(255, 248, 226, 0.6) 0 0.8px, transparent 1.5px),
    radial-gradient(circle at 74% 84%, rgba(255, 248, 226, 0.7) 0 1px, transparent 1.8px),
    radial-gradient(circle at 28% 78%, rgba(255, 248, 226, 0.45) 0 0.8px, transparent 1.5px);
  pointer-events: none;
}

.social-orbit::before {
  content: "";
  position: absolute;
  inset: 32% -14%;
  border: 1px solid rgba(230, 210, 156, 0.38);
  border-radius: 50%;
  transform: rotate(-22deg);
}

.social-orbit::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 0%, #e6d29c 0 3px, rgba(230, 210, 156, 0.35) 4px, transparent 7px);
  animation: social-orbit-spin 48s linear infinite;
}

.social-composer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.4rem 0.85rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(255, 250, 235, 0.55);
  border-radius: var(--s-radius);
  background: var(--s-paper);
  box-shadow: var(--s-shadow-soft);
}

.social-composer > .social-avatar {
  grid-row: 1;
}

.social-compose-trigger {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 0.7rem 1.1rem;
  border: 1px solid var(--s-paper-line);
  border-radius: 999px;
  background: var(--s-paper-2);
  color: var(--s-ink-muted);
  font: 400 1rem/1.35 var(--s-sans);
  text-align: left;
  overflow-wrap: anywhere;
  transition: background-color 0.18s var(--s-ease), color 0.18s var(--s-ease), border-color 0.18s var(--s-ease);
}

.social-compose-trigger:hover {
  border-color: rgba(74, 58, 28, 0.28);
  background: var(--s-paper-3);
  color: var(--s-ink);
}

.social-audience-note {
  grid-column: 2;
  display: block;
  padding-left: 1.1rem;
  color: var(--s-ink-muted);
  font: 400 0.8rem/1.4 var(--s-sans);
  overflow-wrap: anywhere;
}

/* Segmented tabs — feed + friends (aria-pressed or aria-selected) */
.social-feed-tabs,
.social-friends-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 0.3rem;
  border: 1px solid var(--s-on-dark-line);
  border-radius: 16px;
  background: rgba(10, 16, 13, 0.45);
}

.social-feed-tabs button,
.social-friends-tabs button {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.5rem 1rem;
  border-radius: 12px;
  color: var(--s-on-dark-muted);
  font: 600 0.9rem/1.2 var(--s-sans);
  text-align: center;
  overflow-wrap: anywhere;
  transition: background-color 0.18s var(--s-ease), color 0.18s var(--s-ease);
}

.social-feed-tabs button:hover,
.social-friends-tabs button:hover {
  background: rgba(243, 236, 220, 0.07);
  color: var(--s-on-dark-strong);
}

.social-feed-tabs button[aria-pressed="true"],
.social-feed-tabs button[aria-selected="true"],
.social-friends-tabs button[aria-pressed="true"],
.social-friends-tabs button[aria-selected="true"] {
  background: var(--s-paper);
  color: var(--s-ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 4px 12px -6px rgba(0, 0, 0, 0.6);
}

.social-feed-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.social-feed-list > li {
  margin: 0;
}

/* --------------------------------------------------------------------------
   6. Post card (ivory paper)
   -------------------------------------------------------------------------- */
.social-post {
  --s-post-pad-y: clamp(1rem, 2.4vw, 1.5rem);
  --s-post-pad-x: clamp(1rem, 2.6vw, 1.65rem);
  position: relative;
  min-width: 0;
  padding: var(--s-post-pad-y) var(--s-post-pad-x);
  border: 1px solid rgba(255, 250, 235, 0.55);
  border-radius: var(--s-radius-lg);
  background: linear-gradient(180deg, var(--s-paper-hi), var(--s-paper) 45%);
  box-shadow: var(--s-shadow-card);
  font-family: var(--s-sans);
}

.social-post-header {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.9rem;
  min-width: 0;
}

.social-author {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  margin: -0.25rem;
  padding: 0.25rem;
  border-radius: 14px;
  color: var(--s-fg);
  text-align: left;
}

.social-author:hover .social-author-copy strong {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.social-author-copy {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  text-align: left;
}

.social-author-copy strong {
  display: block;
  color: var(--s-fg);
  font: 600 0.98rem/1.3 var(--s-sans);
  overflow-wrap: anywhere;
}

.social-author-copy small {
  display: block;
  color: var(--s-muted);
  font: 400 0.82rem/1.35 var(--s-sans);
  overflow-wrap: anywhere;
}

.social-time {
  flex: none;
  margin-top: 0.7rem;
  color: var(--s-muted);
  font: 400 0.8rem/1.3 var(--s-sans);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.social-menu {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: -0.15rem -0.5rem 0 0;
  border-radius: 50%;
  color: var(--s-muted);
  font: 700 1.15rem/1 var(--s-sans);
  letter-spacing: 0.04em;
  transition: background-color 0.18s var(--s-ease), color 0.18s var(--s-ease);
}

.social-menu:hover,
.social-menu[aria-expanded="true"] {
  background: var(--s-tint);
  color: var(--s-fg);
}

.social-post-kicker {
  margin: 0 0 0.5rem;
  color: var(--s-gold-deep);
  font: 700 0.72rem/1.4 var(--s-sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.social-post-body {
  margin: 0;
  max-width: 64ch;
  color: var(--s-ink);
  font: 400 1.075rem/1.72 var(--s-serif);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.social-post-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-top: 1.1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--s-paper-line);
}

.social-audience-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 28px;
  max-width: 100%;
  margin-right: auto;
  padding: 0.2rem 0.75rem;
  border-radius: 999px;
  background: var(--s-paper-2);
  color: var(--s-ink-2);
  font: 600 0.76rem/1.3 var(--s-sans);
  overflow-wrap: anywhere;
}

.social-audience-tag::before {
  content: "";
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--s-forest-500);
}

.social-audience-tag[data-audience="public"] {
  background: #f2e6c8;
  color: #4a3a17;
}

.social-audience-tag[data-audience="public"]::before {
  background: var(--s-gold);
  box-shadow: 0 0 0 2px rgba(201, 168, 90, 0.3);
}

.social-audience-tag[data-audience="private"]::before {
  background: var(--s-ink-muted);
}

.social-text-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 44px;
  max-width: 100%;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  color: var(--s-link);
  font: 600 0.88rem/1.25 var(--s-sans);
  text-align: left;
  overflow-wrap: anywhere;
  transition: background-color 0.18s var(--s-ease);
}

.social-text-btn:hover {
  background: var(--s-tint);
}

.social-text-btn[aria-pressed="true"] {
  background: var(--s-tint);
  color: var(--s-fg);
}

/* Decorative procedural art (never a user photo) */
.social-story-art,
.social-person-cover,
.social-profile-cover {
  --s-art-stars:
    radial-gradient(circle at 12% 22%, rgba(255, 248, 226, 0.85) 0 1px, transparent 1.8px),
    radial-gradient(circle at 27% 9%, rgba(255, 248, 226, 0.6) 0 0.8px, transparent 1.5px),
    radial-gradient(circle at 41% 30%, rgba(255, 248, 226, 0.7) 0 1px, transparent 1.8px),
    radial-gradient(circle at 60% 12%, rgba(255, 248, 226, 0.55) 0 0.8px, transparent 1.5px),
    radial-gradient(circle at 90% 40%, rgba(255, 248, 226, 0.65) 0 1px, transparent 1.8px);
  /* forest (default) */
  --s-art-moon: radial-gradient(circle at 78% 32%, #f6e8bd 0 7px, rgba(246, 232, 189, 0.28) 8px, rgba(246, 232, 189, 0) 30px);
  --s-art-sky: linear-gradient(180deg, #0d1813 0%, #183126 52%, #2a4d3b 80%, #8c7a45 100%);
  --s-art-hill-a: #0b1511;
  --s-art-hill-b: #11211a;
  --s-art-ring: rgba(230, 210, 156, 0.32);
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  isolation: isolate;
  background-color: #14271e;
  background-image: var(--s-art-moon), var(--s-art-stars), var(--s-art-sky);
  pointer-events: none;
  user-select: none;
}

.social-story-art::before,
.social-person-cover::before,
.social-profile-cover::before {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 46%;
  background:
    radial-gradient(70% 120% at 18% 100%, var(--s-art-hill-a) 0 60%, transparent 60.5%),
    radial-gradient(85% 100% at 78% 100%, var(--s-art-hill-b) 0 60%, transparent 60.5%);
}

.social-story-art::after,
.social-person-cover::after,
.social-profile-cover::after {
  content: "";
  position: absolute;
  top: 16%;
  left: 30%;
  right: -18%;
  height: 150%;
  border: 1px solid var(--s-art-ring);
  border-radius: 50%;
  transform: rotate(-8deg);
}

:is(.social-story-art, .social-person-cover, .social-profile-cover)[data-theme="dawn"] {
  --s-art-moon: radial-gradient(circle at 70% 82%, #fff1cf 0 10px, rgba(255, 228, 170, 0.45) 11px, rgba(255, 228, 170, 0) 46px);
  --s-art-sky: linear-gradient(180deg, #2c2238 0%, #6e3f55 38%, #c77a6b 68%, #efc28e 100%);
  --s-art-hill-a: #3a2433;
  --s-art-hill-b: #533042;
  --s-art-ring: rgba(255, 226, 190, 0.38);
  background-color: #6e3f55;
}

:is(.social-story-art, .social-person-cover, .social-profile-cover)[data-theme="ocean"] {
  --s-art-moon: radial-gradient(circle at 24% 30%, #e7f1ea 0 7px, rgba(231, 241, 234, 0.25) 8px, rgba(231, 241, 234, 0) 30px);
  --s-art-sky: linear-gradient(180deg, #08131f 0%, #0f2b3d 50%, #1b4f5e 78%, #5f9a98 100%);
  --s-art-ring: rgba(190, 225, 220, 0.3);
  background-color: #0f2b3d;
}

:is(.social-story-art, .social-person-cover, .social-profile-cover)[data-theme="ocean"]::before {
  height: 34%;
  background:
    repeating-linear-gradient(180deg, rgba(190, 225, 220, 0.1) 0 1px, transparent 1px 9px),
    linear-gradient(180deg, #0d2534, #081620);
}

.social-story-art {
  aspect-ratio: 16 / 6;
  min-height: 112px;
  max-height: 220px;
  border-radius: 14px;
}

.social-post > .social-story-art {
  margin: 1rem 0;
}

.social-post > .social-story-art:first-child {
  width: calc(100% + 2 * var(--s-post-pad-x));
  max-height: 200px;
  margin: calc(var(--s-post-pad-y) * -1) calc(var(--s-post-pad-x) * -1) 1.1rem;
  border-radius: calc(var(--s-radius-lg) - 1px) calc(var(--s-radius-lg) - 1px) 0 0;
}

/* --------------------------------------------------------------------------
   7. Avatars (initials)
   -------------------------------------------------------------------------- */
.social-avatar {
  --s-avatar-size: 44px;
  --s-avatar-ring-w: 2px;
  flex: none;
  display: inline-grid;
  place-items: center;
  width: var(--s-avatar-size);
  height: var(--s-avatar-size);
  border-radius: 50%;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 25%, rgba(246, 236, 208, 0.28), transparent 55%),
    linear-gradient(145deg, #2c5a45, #13251c);
  color: var(--s-starlight);
  font: 600 calc(var(--s-avatar-size) * 0.36)/1 var(--s-serif);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  user-select: none;
  box-shadow:
    0 0 0 var(--s-avatar-ring-w) var(--s-avatar-ring),
    0 0 0 calc(var(--s-avatar-ring-w) + 1px) rgba(201, 168, 90, 0.55);
}

.social-avatar[data-theme="dawn"] {
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 236, 210, 0.3), transparent 55%),
    linear-gradient(145deg, #9a5a5e, #4a2f3c);
}

.social-avatar[data-theme="ocean"] {
  background:
    radial-gradient(circle at 30% 25%, rgba(220, 240, 236, 0.28), transparent 55%),
    linear-gradient(145deg, #2a6378, #0f2636);
}

.social-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.social-suggestion .social-avatar { --s-avatar-size: 40px; }
.social-request-row .social-avatar { --s-avatar-size: 48px; }
.social-person .social-avatar { --s-avatar-size: 64px; --s-avatar-ring-w: 4px; }
.social-profile-identity .social-avatar { --s-avatar-size: 112px; --s-avatar-ring-w: 5px; }

/* --------------------------------------------------------------------------
   8. States: empty / error / loading
   -------------------------------------------------------------------------- */
.social-empty,
.social-error,
.social-loading {
  display: grid;
  justify-items: center;
  gap: 0.6rem;
  padding: clamp(1.5rem, 4vw, 2.5rem) 1.25rem;
  border: 1px dashed rgba(230, 210, 156, 0.3);
  border-radius: var(--s-radius);
  background: rgba(14, 23, 18, 0.5);
  color: var(--s-on-dark);
  text-align: center;
}

.social-empty :is(h2, h3),
.social-error :is(h2, h3),
.social-loading :is(h2, h3) {
  margin: 0;
  color: var(--s-on-dark-strong);
  font: 400 1.25rem/1.3 var(--s-serif);
  overflow-wrap: break-word;
  hyphens: auto;
}

.social-empty p,
.social-error p,
.social-loading p {
  margin: 0;
  max-width: 46ch;
  color: var(--s-on-dark-muted);
  font-size: 0.94rem;
  line-height: 1.55;
}

.social-empty .btn,
.social-error .btn {
  margin-top: 0.4rem;
}

.social-error {
  border-style: solid;
  border-color: rgba(226, 140, 118, 0.5);
  background: rgba(70, 24, 18, 0.35);
}

.social-error :is(h2, h3) {
  color: #f6cfc3;
}

.social-loading::before {
  content: "";
  width: 28px;
  height: 28px;
  border: 2px solid rgba(230, 210, 156, 0.2);
  border-top-color: var(--s-gold-soft);
  border-radius: 50%;
  animation: social-orbit-spin 1.1s linear infinite;
}

/* --------------------------------------------------------------------------
   9. Explore: search, discovery, people cards
   -------------------------------------------------------------------------- */
.social-search {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
}

.social-search label {
  color: var(--s-gold-soft);
  font: 700 0.74rem/1.3 var(--s-sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.social-search input {
  width: 100%;
  min-height: 52px;
  padding: 0.8rem 1.1rem;
  border: 1px solid rgba(230, 210, 156, 0.4);
  border-radius: 14px;
  background: var(--s-paper-hi);
  color: var(--s-ink);
  font: 400 1rem/1.4 var(--s-sans);
  box-shadow: inset 0 1px 2px rgba(34, 31, 26, 0.08);
}

.social-search input::placeholder {
  color: #776c5c;
  opacity: 1;
}

.social-search input:focus-visible {
  border-color: var(--s-gold);
}

.social-discovery-header {
  display: grid;
  gap: 0.3rem;
  margin-top: 0.5rem;
  min-width: 0;
}

.social-discovery-header h2 {
  margin: 0;
  color: var(--s-on-dark-strong);
  font: 400 1.3rem/1.25 var(--s-serif);
  overflow-wrap: break-word;
  hyphens: auto;
}

.social-discovery-header p {
  margin: 0;
  max-width: 60ch;
  color: var(--s-on-dark-muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.social-people-grid,
.social-connection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 13.5rem), 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.social-people-grid > li,
.social-connection-grid > li {
  display: flex;
  min-width: 0;
  margin: 0;
}

.social-people-grid > li > .social-person,
.social-connection-grid > li > .social-person {
  flex: 1 1 auto;
}

.social-person {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid rgba(255, 250, 235, 0.55);
  border-radius: var(--s-radius-lg);
  background: var(--s-paper);
  box-shadow: var(--s-shadow-card);
  transition: transform 0.2s var(--s-ease), box-shadow 0.2s var(--s-ease);
}

@media (hover: hover) {
  .social-person:hover {
    transform: translateY(-2px);
    box-shadow: var(--s-shadow-lift);
  }
}

.social-person-cover {
  height: 76px;
}

.social-person > .social-person-cover {
  flex: none;
  border-radius: calc(var(--s-radius-lg) - 1px) calc(var(--s-radius-lg) - 1px) 0 0;
}

.social-person-open {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  width: 100%;
  min-width: 0;
  padding: 1.1rem 1.1rem 0.85rem;
  border-radius: 14px;
  color: var(--s-fg);
  text-align: left;
}

.social-person-cover + .social-person-open {
  padding-top: 0;
}

.social-person-open > .social-avatar {
  position: relative;
  margin-bottom: 0.55rem;
}

.social-person-cover + .social-person-open > .social-avatar {
  margin-top: -32px;
}

.social-person-name,
.social-person-open strong {
  display: block;
  max-width: 100%;
  color: var(--s-fg);
  font: 400 1.14rem/1.25 var(--s-serif);
  overflow-wrap: anywhere;
}

.social-person-handle,
.social-person-open small {
  display: block;
  max-width: 100%;
  color: var(--s-muted);
  font: 400 0.82rem/1.35 var(--s-sans);
  overflow-wrap: anywhere;
}

.social-person-bio {
  display: -webkit-box;
  max-width: 100%;
  margin-top: 0.45rem;
  overflow: hidden;
  color: var(--s-ink-2);
  font: 400 0.9rem/1.5 var(--s-sans);
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.social-person-open:hover .social-person-name,
.social-person-open:hover strong {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.social-person-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
  padding: 0 1.1rem 1.1rem;
}

.social-person-actions > * {
  flex: 1 1 auto;
}

/* --------------------------------------------------------------------------
   10. Rail
   -------------------------------------------------------------------------- */
.social-rail-panel {
  padding: 1.1rem 1.1rem 1.15rem;
  border: 1px solid var(--s-on-dark-line);
  border-radius: var(--s-radius);
  background: linear-gradient(180deg, rgba(28, 46, 36, 0.72), rgba(14, 23, 18, 0.78));
  color: var(--s-on-dark);
  min-width: 0;
}

.social-rail-panel h2 {
  margin: 0 0 0.3rem;
  color: var(--s-on-dark-strong);
  font: 400 1.08rem/1.3 var(--s-serif);
  overflow-wrap: break-word;
  hyphens: auto;
}

.social-rail-panel > p {
  margin: 0 0 0.75rem;
  color: var(--s-on-dark-muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.social-suggestions-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.social-suggestion {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.6rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--s-line);
  min-width: 0;
}

.social-suggestion:first-child {
  padding-top: 0.2rem;
  border-top: 0;
}

.social-suggestion > .social-author {
  flex: 1 1 9rem;
  margin: 0;
}

.social-suggestion > .social-author .social-author-copy strong {
  font-size: 0.9rem;
}

.social-suggestion strong {
  color: var(--s-fg);
  overflow-wrap: anywhere;
}

.social-suggestion small {
  color: var(--s-muted);
  overflow-wrap: anywhere;
}

#socialViews .social-suggestion > .btn {
  flex: none;
  padding-inline: 0.9rem;
  font-size: 0.82rem;
}

.social-weekly-prompt {
  position: relative;
  overflow: hidden;
  padding: 1.15rem;
  border: 1px solid rgba(230, 210, 156, 0.32);
  border-radius: var(--s-radius);
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(201, 168, 90, 0.22), transparent 60%),
    linear-gradient(160deg, #1f3529, #101a15);
  color: var(--s-on-dark);
}

.social-weekly-prompt::before {
  content: "";
  position: absolute;
  top: -62px;
  right: -44px;
  width: 124px;
  height: 124px;
  border: 1px solid rgba(230, 210, 156, 0.3);
  border-radius: 50%;
  pointer-events: none;
}

.social-weekly-prompt::after {
  content: "";
  position: absolute;
  top: 18px;
  right: 24px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--s-gold-soft);
  box-shadow: 0 0 10px 2px rgba(230, 210, 156, 0.45);
  pointer-events: none;
}

.social-weekly-prompt > * {
  position: relative;
  z-index: 1;
}

.social-weekly-prompt :is(h2, h3) {
  margin: 0 0 0.45rem;
  padding-right: 1.75rem;
  color: var(--s-gold-soft);
  font: 700 0.74rem/1.4 var(--s-sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.social-weekly-prompt p {
  margin: 0 0 0.9rem;
  color: var(--s-starlight);
  font: italic 400 1.04rem/1.5 var(--s-serif);
  overflow-wrap: break-word;
}

/* --------------------------------------------------------------------------
   11. Profile
   -------------------------------------------------------------------------- */
.social-profile-hero {
  --s-hero-pad: clamp(1rem, 3vw, 1.75rem);
  position: relative;
  min-width: 0;
  border: 1px solid rgba(255, 250, 235, 0.55);
  border-radius: 24px;
  background: linear-gradient(180deg, var(--s-paper-hi), var(--s-paper) 60%);
  box-shadow: var(--s-shadow-card);
}

.social-profile-cover {
  height: clamp(112px, 20vw, 188px);
  border-radius: 23px 23px 0 0;
}

.social-profile-identity {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: end;
  gap: 0.35rem 1.25rem;
  padding: var(--s-hero-pad);
  min-width: 0;
}

.social-profile-cover + .social-profile-identity {
  padding-top: 0;
}

.social-profile-identity > .social-avatar {
  grid-column: 1;
  grid-row: 1;
  position: relative;
}

.social-profile-cover + .social-profile-identity > .social-avatar {
  margin-top: calc(var(--s-avatar-size) / -2);
}

.social-profile-identity > :not(.social-avatar):not(.social-profile-actions) {
  grid-column: 1 / -1;
  min-width: 0;
}

.social-profile-identity h1 {
  margin: 0.85rem 0 0;
  color: var(--s-ink);
  font: 400 clamp(1.6rem, 1.2rem + 1.6vw, 2.25rem)/1.15 var(--s-serif);
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.social-handle {
  margin: 0;
  color: var(--s-ink-muted);
  font: 400 0.92rem/1.4 var(--s-sans);
  overflow-wrap: anywhere;
}

.social-bio {
  margin: 0.55rem 0 0;
  max-width: 60ch;
  color: var(--s-ink-2);
  font: 400 1rem/1.6 var(--s-serif);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.social-profile-actions {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-self: end;
  gap: 0.5rem;
  min-width: 0;
  padding-top: 0.9rem;
}

.social-profile-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.9rem 0 0;
  padding: 0;
  list-style: none;
}

.social-profile-labels > * {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  max-width: 100%;
  margin: 0;
  padding: 0.2rem 0.75rem;
  border: 1px solid rgba(122, 92, 30, 0.28);
  border-radius: 999px;
  background: #f2e8d2;
  color: #4a3d22;
  font: 600 0.76rem/1.3 var(--s-sans);
  overflow-wrap: anywhere;
}

.social-profile-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 0.85rem 0 0;
  padding: 0;
  list-style: none;
}

.social-profile-stats > * {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin: 0;
  color: var(--s-muted);
  font: 400 0.86rem/1.4 var(--s-sans);
}

.social-profile-stats :is(strong, dd) {
  margin: 0;
  color: var(--s-fg);
  font: 600 1.15rem/1 var(--s-serif);
  font-variant-numeric: tabular-nums;
}

.social-profile-stats button {
  min-height: 44px;
  margin: 0;
  padding: 0 0.25rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.social-profile-stats button:hover {
  background: var(--s-tint);
}

.social-profile-feed {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  margin-top: 2rem;
  min-width: 0;
}

.social-profile-feed > h2 {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 0;
  color: var(--s-on-dark-strong);
  font: 400 1.3rem/1.25 var(--s-serif);
  overflow-wrap: break-word;
}

.social-profile-feed > h2::after {
  content: "";
  flex: 1 1 2rem;
  min-width: 2rem;
  height: 1px;
  background: linear-gradient(90deg, rgba(230, 210, 156, 0.45), transparent);
}

/* --------------------------------------------------------------------------
   12. Friends: requests
   -------------------------------------------------------------------------- */
.social-requests-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.social-request-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  min-width: 0;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(255, 250, 235, 0.55);
  border-radius: var(--s-radius);
  background: var(--s-paper);
  box-shadow: var(--s-shadow-soft);
}

.social-request-row > .social-avatar {
  flex: none;
}

.social-request-row > :not(.social-avatar):not(.social-request-actions) {
  flex: 1 1 10rem;
  min-width: 0;
}

.social-request-row > .social-author {
  margin: 0;
}

.social-request-row strong {
  display: block;
  color: var(--s-fg);
  font: 600 0.98rem/1.3 var(--s-sans);
  overflow-wrap: anywhere;
}

.social-request-row small {
  display: block;
  color: var(--s-muted);
  font: 400 0.82rem/1.35 var(--s-sans);
  overflow-wrap: anywhere;
}

.social-request-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-left: auto;
}

/* --------------------------------------------------------------------------
   13. Social dialog (native <dialog>): scrollable body, stable footer
   Never sets display on the <dialog> itself (closed state stays UA-hidden).
   -------------------------------------------------------------------------- */
#socialDialog {
  width: min(36rem, calc(100vw - 1.5rem));
  max-width: calc(100vw - 1.5rem);
  max-height: calc(100vh - 1.5rem);
  max-height: calc(100dvh - 1.5rem);
  padding: 0;
  border: 1px solid rgba(122, 92, 30, 0.22);
  border-radius: 22px;
  background: var(--s-paper);
  color: var(--s-ink);
  font-family: var(--s-sans);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.65);
  overflow: hidden;
}

#socialDialog[open] {
  animation: social-rise 0.22s var(--s-ease);
}

#socialDialog::backdrop {
  background: rgba(6, 10, 8, 0.62);
  backdrop-filter: blur(2px);
}

#socialDialog .dialog-inner {
  display: flex;
  flex-direction: column;
  max-height: inherit;
  min-height: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  color: var(--s-ink);
}

/* If a <form> wraps header/body/footer, keep the flex chain intact */
#socialDialog .dialog-inner > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 0;
  margin: 0;
}

#socialDialog .dialog-header {
  flex: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.35rem 0.9rem;
  border-bottom: 1px solid var(--s-paper-line);
  background: linear-gradient(180deg, var(--s-paper-hi), var(--s-paper));
}

#socialDialog .dialog-header :is(h1, h2, h3) {
  margin: 0;
  min-width: 0;
  color: var(--s-ink);
  font: 400 1.35rem/1.25 var(--s-serif);
  overflow-wrap: break-word;
  hyphens: auto;
}

#socialDialog .dialog-header button {
  flex: none;
  min-width: 44px;
  min-height: 44px;
  color: var(--s-ink-2);
}

#socialDialog .dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.2rem 1.35rem 1.35rem;
  color: var(--s-ink);
}

#socialDialog .dialog-footer {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 0.9rem 1.35rem calc(0.9rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--s-paper-line);
  background: #f3ecdd;
}

/* --------------------------------------------------------------------------
   14. Forms
   -------------------------------------------------------------------------- */
.social-form {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  margin: 0;
  min-width: 0;
  color: var(--s-ink);
}

.social-form .social-field,
.social-form > label:not(.social-privacy-choice) {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
}

.social-form label {
  color: var(--s-ink);
  font: 600 0.9rem/1.35 var(--s-sans);
}

.social-form :is(input:not([type]), input[type="text"], input[type="search"], input[type="email"], input[type="url"], select, textarea) {
  display: block;
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--s-field-line);
  border-radius: var(--s-radius-sm);
  background-color: #fffdf8;
  color: var(--s-ink);
  font: 400 1rem/1.45 var(--s-sans);
  box-shadow: inset 0 1px 2px rgba(34, 31, 26, 0.06);
  transition: border-color 0.15s var(--s-ease), box-shadow 0.15s var(--s-ease);
}

.social-form :is(input, select, textarea):hover {
  border-color: #7d6e52;
}

.social-form :is(input, select, textarea):focus-visible {
  border-color: var(--s-forest-600);
  outline-offset: 1px;
}

.social-form :is(input, select, textarea)::placeholder {
  color: #7a6f5f;
  opacity: 1;
}

.social-form :is(input, select, textarea)[aria-invalid="true"] {
  border-color: var(--s-danger);
  box-shadow: 0 0 0 3px rgba(155, 59, 46, 0.14);
}

.social-form textarea {
  min-height: 9rem;
  resize: vertical;
  font: 400 1.05rem/1.6 var(--s-serif);
  overflow-wrap: anywhere;
}

.social-form select {
  appearance: none;
  padding-right: 2.6rem;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--s-ink-2) 50%),
    linear-gradient(135deg, var(--s-ink-2) 50%, transparent 50%);
  background-position:
    calc(100% - 1.2rem) 50%,
    calc(100% - 0.85rem) 50%;
  background-size: 0.36rem 0.36rem;
  background-repeat: no-repeat;
  cursor: pointer;
}

.social-form :is(input[type="checkbox"], input[type="radio"]) {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0.1rem 0 0;
  accent-color: var(--s-forest-600);
  cursor: pointer;
}

.social-counter {
  justify-self: end;
  color: var(--s-ink-muted);
  font: 500 0.78rem/1.3 var(--s-sans);
  font-variant-numeric: tabular-nums;
}

.social-counter[data-state="near"] {
  color: var(--s-gold-deep);
}

.social-counter[data-state="over"] {
  color: var(--s-danger);
  font-weight: 700;
}

.social-form-help {
  margin: 0;
  color: #5f5648;
  font: 400 0.85rem/1.5 var(--s-sans);
  overflow-wrap: break-word;
}

/* Explicit public reminder */
.social-form-help.is-public,
.social-form-help[data-tone="public"] {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(122, 92, 30, 0.32);
  border-radius: var(--s-radius-sm);
  background: #f6ead0;
  color: #4a3a17;
}

.social-form-help.is-public::before,
.social-form-help[data-tone="public"]::before {
  content: "";
  flex: none;
  width: 0.6rem;
  height: 0.6rem;
  margin-top: 0.38rem;
  border-radius: 50%;
  background: var(--s-gold);
  box-shadow: 0 0 0 3px rgba(201, 168, 90, 0.28);
}

.social-audience-choice {
  display: grid;
  gap: 0.55rem;
  min-width: 0;
  margin: 0;
  padding: 0.9rem 1rem 1rem;
  border: 1px solid var(--s-paper-line);
  border-radius: 14px;
  background: var(--s-paper-2);
}

.social-audience-choice > legend {
  float: left;
  width: 100%;
  margin: 0 0 0.15rem;
  padding: 0;
  color: var(--s-ink);
  font: 600 0.9rem/1.35 var(--s-sans);
}

.social-audience-choice > legend + * {
  clear: both;
}

.social-audience-choice label:has(> input[type="radio"]) {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  min-height: 44px;
  padding: 0.65rem 0.8rem;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--s-paper-hi);
  font-weight: 500;
  cursor: pointer;
}

.social-audience-choice label:has(> input[type="radio"]:checked) {
  border-color: var(--s-forest-600);
  background: #eef3ec;
}

.social-privacy-choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 0.35rem 0.75rem;
  min-height: 44px;
  padding: 0.95rem 1rem;
  border: 1px solid var(--s-field-line);
  border-radius: 14px;
  background: var(--s-paper-hi);
  color: var(--s-ink);
  font-weight: 400;
}

label.social-privacy-choice,
.social-privacy-choice label {
  cursor: pointer;
}

.social-privacy-choice > input[type="checkbox"] {
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 1.3rem;
  height: 1.3rem;
}

.social-privacy-choice > :not(input) {
  grid-column: 2;
  min-width: 0;
}

.social-privacy-choice strong {
  display: block;
  color: var(--s-ink);
  font: 600 0.95rem/1.35 var(--s-sans);
  overflow-wrap: break-word;
}

.social-privacy-choice > :not(input):not(strong) {
  color: #5f5648;
  font: 400 0.86rem/1.5 var(--s-sans);
  overflow-wrap: break-word;
}

.social-privacy-choice:has(input[type="checkbox"]:checked) {
  border-color: var(--s-forest-600);
  background: #eef3ec;
  box-shadow: inset 3px 0 0 var(--s-forest-600);
}

/* --------------------------------------------------------------------------
   15. Shell navigation (feature-flagged; meaning of controls unchanged)
   -------------------------------------------------------------------------- */
body.has-social .nav :is(a, button) {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 44px;
  border-radius: 10px;
  color: #d9d1bf;
  text-align: left;
  text-decoration: none;
  transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

body.has-social .nav :is(a, button):hover {
  background: rgba(230, 210, 156, 0.08);
  color: #f3ecdc;
}

body.has-social .nav :is(a, button):focus-visible {
  outline: 3px solid #f0dca4;
  outline-offset: 1px;
}

body.has-social .nav .social-nav-link {
  color: #efe6d2;
  font-weight: 600;
}

body.has-social .nav :is(a, button):is([aria-current="page"], [aria-current="true"], .active, .is-active) {
  background: rgba(230, 210, 156, 0.12);
  color: #f8f1e1;
  box-shadow: inset 3px 0 0 #c9a85a;
}

/* Breathing room between the social group and the memory workspace group */
body.has-social .nav .social-nav-link + :not(.social-nav-link),
body.has-social .nav li:has(> .social-nav-link) + li:not(:has(> .social-nav-link)) {
  margin-top: 0.75rem;
}

/* --------------------------------------------------------------------------
   16. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .social-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .social-rail {
    display: none;
  }

  .social-main-column {
    margin-inline: auto;
  }
}

@media (max-width: 640px) {
  .social-view {
    padding: 1.1rem 1rem 3.5rem;
  }

  .social-view-header {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
  }

  .social-view-header .lede {
    font-size: 0.95rem;
  }

  .social-welcome {
    min-height: 0;
    padding: 1rem 5.25rem 1.05rem 1.05rem;
  }

  .social-welcome h2 {
    font-size: 1.18rem;
  }

  .social-orbit {
    top: 1rem;
    right: 0.9rem;
    width: 64px;
    height: 64px;
    transform: none;
  }

  .social-composer {
    padding: 0.8rem;
  }

  .social-audience-note {
    padding-left: 0.25rem;
  }

  .social-feed-tabs,
  .social-friends-tabs {
    width: 100%;
  }

  .social-post {
    --s-post-pad-y: 1rem;
    --s-post-pad-x: 1rem;
    border-radius: 18px;
  }

  .social-post-body {
    font-size: 1.03rem;
    line-height: 1.68;
  }

  .social-story-art {
    aspect-ratio: 16 / 8;
    min-height: 96px;
  }

  .social-profile-identity {
    grid-template-columns: minmax(0, 1fr);
  }

  .social-profile-identity .social-avatar {
    --s-avatar-size: 88px;
    --s-avatar-ring-w: 4px;
  }

  .social-profile-actions {
    grid-column: 1 / -1;
    grid-row: auto;
    justify-content: flex-start;
    padding-top: 0.6rem;
  }

  .social-profile-actions > * {
    flex: 1 1 auto;
  }

  .social-request-actions {
    flex: 1 1 100%;
    margin-left: 0;
  }

  .social-request-actions > * {
    flex: 1 1 auto;
  }

  /* Dialog becomes a bottom sheet */
  #socialDialog {
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 0.75rem);
    max-height: calc(100dvh - 0.75rem);
    margin: auto 0 0;
    border-bottom: 0;
    border-radius: 22px 22px 0 0;
  }

  #socialDialog .dialog-header,
  #socialDialog .dialog-body {
    padding-inline: 1.05rem;
  }

  #socialDialog .dialog-footer {
    padding-inline: 1.05rem;
  }

  #socialDialog .dialog-footer > .btn {
    flex: 1 1 8rem;
  }

  /* Compact sidebar nav: wrapping pills, all items visible, DOM order kept.
     Only touches .nav; identity, sign-out and language controls are untouched. */
  body.has-social .nav:not(:has(> ul)),
  body.has-social .nav > ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  body.has-social .nav li {
    margin: 0;
  }

  body.has-social .nav :is(a, button) {
    width: auto;
    padding: 0.45rem 0.85rem;
    border: 1px solid rgba(230, 210, 156, 0.16);
    border-radius: 999px;
    font-size: 0.88rem;
    white-space: normal;
  }

  body.has-social .nav :is(a, button):is([aria-current="page"], [aria-current="true"], .active, .is-active) {
    border-color: rgba(230, 210, 156, 0.55);
    box-shadow: none;
  }

  body.has-social .nav .social-nav-link + :not(.social-nav-link),
  body.has-social .nav li:has(> .social-nav-link) + li:not(:has(> .social-nav-link)) {
    margin-top: 0;
  }
}

@media (max-width: 400px) {
  .social-view-header h1 {
    font-size: 1.6rem;
  }

  .social-post-header {
    gap: 0.4rem 0.5rem;
  }

  .social-author {
    gap: 0.6rem;
  }

  .social-time {
    font-size: 0.76rem;
  }

  .social-feed-tabs button,
  .social-friends-tabs button {
    padding-inline: 0.7rem;
    font-size: 0.86rem;
  }
}

/* --------------------------------------------------------------------------
   17. Motion, contrast modes
   -------------------------------------------------------------------------- */
@keyframes social-orbit-spin {
  to { transform: rotate(360deg); }
}

@keyframes social-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  #socialViews *,
  #socialViews *::before,
  #socialViews *::after,
  #socialDialog,
  #socialDialog *,
  #socialDialog *::before,
  #socialDialog *::after,
  body.has-social .nav * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .social-person:hover {
    transform: none;
  }
}

@media (forced-colors: active) {
  .social-post,
  .social-composer,
  .social-person,
  .social-profile-hero,
  .social-request-row,
  .social-rail-panel,
  .social-weekly-prompt,
  .social-welcome,
  .social-empty,
  .social-error,
  .social-loading,
  .social-audience-tag,
  .social-profile-labels > * {
    border: 1px solid CanvasText;
  }

  .social-feed-tabs button[aria-pressed="true"],
  .social-feed-tabs button[aria-selected="true"],
  .social-friends-tabs button[aria-pressed="true"],
  .social-friends-tabs button[aria-selected="true"],
  body.has-social .nav :is(a, button):is([aria-current="page"], .active, .is-active) {
    outline: 2px solid Highlight;
    outline-offset: -2px;
  }

  #socialViews :focus-visible,
  #socialDialog :focus-visible,
  body.has-social .nav :focus-visible {
    outline-color: Highlight;
  }
}

/* Astra integration: semantic h2 beneath the view's h1; existing memory tools. */
.social-profile-identity h2 { margin: .85rem 0 0; color: var(--s-ink); font: 400 clamp(1.6rem, 1.2rem + 1.6vw, 2.25rem)/1.15 var(--s-serif); }
.social-view-header h1:focus { outline: none; box-shadow: none; }
body.has-social .memory-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
body.has-social .memory-tools .btn { color: #e9debf; background: #172b2d; border-color: #526355; }
.social-request-row > .social-person-actions { flex: 0 1 auto; margin-left: auto; }
#socialViews .social-view { padding: 0 0 2rem; }
#socialViews .social-view-header h1:focus { outline: none; box-shadow: none; }
.social-signin-callout { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 18px; margin-bottom: 22px; border: 1px solid var(--s-on-dark-line); border-radius: 14px; }
.social-signin-callout p { flex: 1 1 240px; color: var(--s-on-dark-muted); font-size: .9rem; }
.social-search > div { display: flex; gap: 10px; align-items: center; min-width: 0; }
.social-search > div > input { flex: 1 1 auto; min-width: 0; width: 100%; }
.social-search > div > button { flex: 0 0 auto; }
.social-main-column { gap: 1rem; }
/* Focused story reading and deliberate, keyboard-friendly invitation to write. */
.social-post-preview { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; overflow: hidden; }
.social-read-story { appearance: none; border: 0; border-bottom: 1px solid currentColor; padding: .4rem 0; background: transparent; color: #365849; font: 600 .78rem/1.4 var(--font-body, sans-serif); cursor: pointer; min-height: 40px; }
.social-read-story:hover { color: #153d2a; }
.social-read-story:focus-visible { outline: 2px solid #8a6836; outline-offset: 5px; border-radius: 2px; }
.social-story-reader { position: relative; padding: .6rem .35rem 1.2rem; }
.social-reader-author { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.social-reader-author > div { display: grid; gap: .25rem; min-width: 0; overflow-wrap: anywhere; }
.social-reader-author strong { font-size: 1.1rem; color: var(--ink, #213a31); }
.social-reader-body { white-space: pre-wrap; overflow-wrap: anywhere; font: 400 clamp(1.15rem, 3vw, 1.5rem)/1.9 Georgia, serif; color: var(--ink, #213a31); margin-top: 1.4rem; }
.social-prompt-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.social-prompt-position { font: 400 .65rem/1.5 sans-serif; color: #c8bd99; font-variant-numeric: tabular-nums; white-space: nowrap; }
.social-weekly-prompt > [aria-live] h2 { margin: .9rem 0 .65rem; }
.social-weekly-prompt > [aria-live] h2 { text-transform: none; letter-spacing: -.02em; font-size: 1.35rem; line-height: 1.35; }
.social-weekly-prompt > [aria-live] p { color: var(--s-on-dark-muted); font-size: .85rem; line-height: 1.7; margin-bottom: 1.3rem; }
.social-weekly-prompt > .social-text-btn { margin-top: .6rem; min-height: 40px; }
.social-compose-prompt { border-left: 2px solid #b59658; padding: .8rem 1rem; margin-bottom: 1rem; background: #ebe8df; color: #284033; }
.social-compose-prompt p { font-size: .8rem; margin: .5rem 0 0; line-height: 1.6; }
.social-refresh { align-self: flex-end; min-height: 40px; }
.social-refresh[aria-disabled="true"] { opacity: .65; cursor: wait; }
.social-refresh-row { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; }
.social-refresh-status { color: var(--s-on-dark-muted); font-size: .78rem; }
.social-mobile-prompt { display: none; }
@media (max-width: 1024px) {
  .social-mobile-prompt { display: block; border-block: 1px solid var(--s-on-dark-line); padding-block: .5rem; }
  .social-mobile-prompt > summary { cursor: pointer; padding: .55rem .25rem; color: var(--s-on-dark); font-size: .85rem; }
  .social-mobile-prompt > .social-weekly-prompt { margin-top: .65rem; }
}
@media (max-width: 640px) { body.has-social .toast { bottom: calc(94px + env(safe-area-inset-bottom)); } }
.social-welcome { min-height: 0; padding: .9rem 7.8rem .9rem 1.2rem; }
@media (max-width: 640px) {
  .social-welcome { display: none; }
  body.has-social .nav:not(:has(> ul)) { position: fixed; inset: auto 0 0; z-index: 50; display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 0; width: 100%; padding: 7px 3px calc(7px + env(safe-area-inset-bottom)); background: #10231f; border-top: 1px solid #526355; box-shadow: 0 -10px 30px #07161133; overflow: visible; }
  body.has-social:not(.social-signed-in) .nav:not(:has(> ul)) { grid-template-columns: 1fr; }
  body.has-social .nav .nav-link { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; width: 100%; min-height: 52px; padding: 5px 2px; border: 0; border-radius: 10px; font-size: .68rem; white-space: nowrap; }
  body.has-social .nav .nav-icon { display: block; width: 19px; height: 19px; }
  body.has-social .nav .nav-icon svg { width: 19px; height: 19px; }
  body.has-social .main { padding-bottom: calc(102px + env(safe-area-inset-bottom)); }
}
