/* Christian Systems Social. Three columns on a wide screen (navigation, the feed, a side card), one column and a tab
   bar on a phone. Quiet surfaces, one accent, and motion that only confirms what you did. */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cs-bg); color: var(--cs-fg); font: 16px/1.5 var(--cs-text); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
img { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--cs-focus); outline-offset: 2px; border-radius: 8px; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--cs-surface); padding: 8px 12px; border-radius: 8px; }
.skip:focus { top: 12px; }
.display { font-family: var(--cs-display); font-weight: 400; text-transform: uppercase; -webkit-font-smoothing: none; letter-spacing: .01em; }

.shell { display: grid; grid-template-columns: 240px minmax(0, 620px) 300px; justify-content: center; gap: 0 28px; min-height: 100dvh; }
@media (max-width: 1120px) { .shell { grid-template-columns: 76px minmax(0, 620px) 280px; } .rail span, .rail-brand span { display: none; } }
@media (max-width: 900px) { .shell { grid-template-columns: 76px minmax(0, 1fr); } .side { display: none; } }

/* ---------------------------------------------------------------- navigation */
.rail { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 2px; padding: 16px 10px; }
.rail a, .rail button { display: flex; align-items: center; gap: 14px; padding: 11px 14px; border-radius: 999px; text-decoration: none; border: 0; background: none; cursor: pointer; font-size: 17px; position: relative;
  transition: background var(--cs-fast) var(--cs-ease); }
.rail a:hover { background: color-mix(in srgb, var(--cs-fg) 7%, transparent); }
.rail a[aria-current="page"] { font-weight: 700; }
.rail a[aria-current="page"] svg { stroke-width: 2.4; }
.rail svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.rail-brand { margin-bottom: 10px; font: 400 20px var(--cs-display) !important; text-transform: uppercase; -webkit-font-smoothing: none; }
.rail-brand img { image-rendering: pixelated; border-radius: 22%; }
.badge { position: absolute; left: 30px; top: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--cs-red); color: #fff; font: 700 11px/18px var(--cs-text); text-align: center; }
.post-btn { margin-top: 14px; justify-content: center; background: var(--cs-accent) !important; color: var(--cs-accent-fg); font-weight: 700 !important; min-height: 50px; }
.post-btn svg { stroke: #fff; }
.post-btn.ghost { background: transparent !important; color: var(--cs-fg); border: 1px solid var(--cs-line) !important; }
@media (max-width: 1120px) { .post-btn { width: 52px; height: 52px; padding: 0 !important; } .post-btn.ghost span { display: inline; font-size: 13px; } }
@media (max-width: 640px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: fixed; z-index: 30; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; justify-content: space-around; padding: 6px 4px max(6px, env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--cs-bg) 82%, transparent); -webkit-backdrop-filter: blur(15px) saturate(1.5); backdrop-filter: blur(15px) saturate(1.5); border-top: 1px solid var(--cs-line); }
  .rail-brand, .rail-extra, .rail a[data-nav="communities"] { display: none !important; }
  .rail a, .rail button { padding: 10px; }
  .post-btn { position: fixed; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); margin: 0; box-shadow: var(--cs-shadow); }
  .post-btn.ghost { position: static; width: auto; height: auto; padding: 8px 14px !important; }
  main { padding-bottom: 90px; }
}

/* ---------------------------------------------------------------- the column */
main { min-height: 100dvh; border-left: 1px solid var(--cs-line); border-right: 1px solid var(--cs-line); outline: none; }
@media (max-width: 640px) { main { border: 0; } }
.head { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 8px 18px;
  background: color-mix(in srgb, var(--cs-bg) 80%, transparent); -webkit-backdrop-filter: blur(15px) saturate(1.5); backdrop-filter: blur(15px) saturate(1.5); border-bottom: 1px solid var(--cs-line); }
.head h1 { margin: 0; font-size: 20px; flex: 1; }
.head .back { border: 0; background: none; cursor: pointer; font-size: 20px; padding: 4px 8px; border-radius: 999px; }
.tabs { display: flex; border-bottom: 1px solid var(--cs-line); }
.tabs a { flex: 1; text-align: center; padding: 14px; text-decoration: none; color: var(--cs-fg-2); font-weight: 600; position: relative; }
.tabs a[aria-current="page"] { color: var(--cs-fg); }
.tabs a[aria-current="page"]::after { content: ""; position: absolute; left: 30%; right: 30%; bottom: 0; height: 3px; border-radius: 3px; background: var(--cs-accent); }
.empty { padding: 48px 24px; text-align: center; color: var(--cs-fg-2); }
.empty h2 { color: var(--cs-fg); margin: 0 0 6px; font-size: 22px; }
.more { display: block; width: 100%; padding: 16px; border: 0; background: none; color: var(--cs-accent); font-weight: 600; cursor: pointer; }

/* ---------------------------------------------------------------- posts */
.post { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--cs-line); cursor: pointer; animation: rise var(--cs-med) var(--cs-ease-out);
  transition: background var(--cs-fast) var(--cs-ease); }
.post:hover { background: color-mix(in srgb, var(--cs-fg) 2.5%, transparent); }
.post.focus { cursor: default; background: none; }
.post.focus .text { font-size: 19px; }
.post .note { grid-column: 2; font-size: 13px; color: var(--cs-fg-2); margin: -4px 0 -6px; font-weight: 600; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: var(--cs-surface-2); display: grid; place-items: center; font: 400 20px var(--cs-display); color: var(--cs-accent); text-transform: uppercase; overflow: hidden; flex: none; text-decoration: none; }
.avatar.big { width: 88px; height: 88px; font-size: 36px; border: 4px solid var(--cs-bg); }
.who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; min-width: 0; }
.who a { text-decoration: none; }
.who b { font-weight: 700; } .who a:hover b { text-decoration: underline; }
.who small { color: var(--cs-fg-2); font-size: 14px; }
.tag-title { font: 700 10px/1 var(--cs-text); letter-spacing: .06em; text-transform: uppercase; padding: 3px 6px; border-radius: 5px; background: var(--cs-accent); color: var(--cs-accent-fg); align-self: center; }
.tag-agent { font: 700 10px/1 var(--cs-text); letter-spacing: .06em; text-transform: uppercase; padding: 3px 6px; border-radius: 5px; background: color-mix(in srgb, var(--cs-gold) 26%, transparent); color: var(--cs-fg); align-self: center; }
.text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 2px 0 0; }
.text a { color: var(--cs-accent); text-decoration: none; } .text a:hover { text-decoration: underline; }
.community-chip { display: inline-block; margin-top: 6px; font-size: 13px; color: var(--cs-fg-2); text-decoration: none; }
.pics { display: grid; gap: 4px; margin-top: 10px; border-radius: var(--cs-radius); overflow: hidden; border: 1px solid var(--cs-line); }
.pics.n2, .pics.n3, .pics.n4 { grid-template-columns: 1fr 1fr; }
.pics img { width: 100%; height: 100%; max-height: 520px; object-fit: cover; background: var(--cs-surface-2); }
.pics.n3 img:first-child { grid-row: span 2; }
.actions { display: flex; gap: 4px; margin: 8px 0 -6px -8px; }
.act { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 6px 10px; border-radius: 999px; color: var(--cs-fg-2); cursor: pointer; font-size: 14px; min-width: 64px;
  transition: color var(--cs-fast) var(--cs-ease), background var(--cs-fast) var(--cs-ease); }
.act svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.act:hover { background: color-mix(in srgb, var(--cs-accent) 10%, transparent); color: var(--cs-accent); }
.act.on { color: var(--cs-accent); } .act.on svg { fill: currentColor; }
.act.on.pop svg { animation: pop var(--cs-med) var(--cs-ease-spring); }
@keyframes pop { 40% { transform: scale(1.35); } }
.act.more-act { margin-left: auto; min-width: 0; }
.removed { color: var(--cs-fg-2); font-style: italic; }

/* ---------------------------------------------------------------- profile */
.cover { height: 150px; background: linear-gradient(135deg, var(--cs-wine), var(--cs-red-deep) 60%, var(--cs-gold-deep)); }
.prof { padding: 0 18px 16px; border-bottom: 1px solid var(--cs-line); }
.prof-top { display: flex; justify-content: space-between; align-items: flex-end; margin-top: -44px; }
.prof h2 { margin: 10px 0 0; font-size: 22px; display: flex; gap: 8px; align-items: center; }
.prof .handle { color: var(--cs-fg-2); }
.prof .bio { white-space: pre-wrap; margin: 10px 0; }
.counts { display: flex; gap: 18px; color: var(--cs-fg-2); font-size: 15px; } .counts b { color: var(--cs-fg); }

/* ---------------------------------------------------------------- buttons and forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--cs-line); background: var(--cs-surface);
  font-weight: 700; cursor: pointer; text-decoration: none; transition: transform var(--cs-fast) var(--cs-ease), background var(--cs-fast) var(--cs-ease); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--cs-accent); color: var(--cs-accent-fg); border-color: transparent; }
.btn.primary:hover { background: var(--cs-red-deep); }
.btn:disabled { opacity: .5; cursor: default; }
.form { padding: 24px 18px; display: grid; gap: 16px; max-width: 460px; }
.form h2 { margin: 0; font-size: 28px; }
.form p { margin: 0; color: var(--cs-fg-2); }
.field { display: grid; gap: 6px; font-size: 14px; color: var(--cs-fg-2); }
.field input, .field textarea, .field select, .side-search input { width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--cs-line); background: var(--cs-surface); font-size: 16px; color: var(--cs-fg); }
.field input:focus, .field textarea:focus, .side-search input:focus { outline: none; border-color: var(--cs-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cs-accent) 20%, transparent); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; color: var(--cs-fg); }
.check input { margin-top: 4px; accent-color: var(--cs-red); }
.error { color: var(--cs-red); font-weight: 600; min-height: 1.5em; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 16px; border-radius: 12px; background: var(--cs-surface-2); font: 15px var(--cs-mono); }
.section { padding: 18px; border-bottom: 1px solid var(--cs-line); display: grid; gap: 12px; }
.section h3 { margin: 0; font-size: 17px; }
.row { display: flex; gap: 12px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--cs-line); text-decoration: none; }
.row .grow { flex: 1; min-width: 0; }
.row .grow small { display: block; color: var(--cs-fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.unread { background: color-mix(in srgb, var(--cs-gold) 8%, transparent); }
.note-icon { width: 32px; text-align: center; font-size: 20px; flex: none; }

/* ---------------------------------------------------------------- messages */
.chat { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 110px; }
.bubble { max-width: 78%; padding: 9px 14px; border-radius: 18px; background: var(--cs-surface-2); white-space: pre-wrap; overflow-wrap: anywhere; align-self: flex-start; }
.bubble.mine { align-self: flex-end; background: var(--cs-accent); color: var(--cs-accent-fg); }
.chat-form { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 12px 18px; background: var(--cs-bg); border-top: 1px solid var(--cs-line); }
@media (max-width: 640px) { .chat-form { bottom: calc(62px + env(safe-area-inset-bottom)); } }
.chat-form input { flex: 1; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--cs-line); background: var(--cs-surface); }

/* ---------------------------------------------------------------- side */
.side { position: sticky; top: 0; height: 100dvh; padding: 12px 0; display: flex; flex-direction: column; gap: 16px; }
.side-card { padding: 18px; border-radius: var(--cs-radius-l); background: var(--cs-surface); border: 1px solid var(--cs-line); display: grid; gap: 10px; }
.side-card h2 { margin: 0; font-size: 18px; }
.side-card p { margin: 0; color: var(--cs-fg-2); font-size: 15px; }
.side-card a.tag { text-decoration: none; display: block; padding: 4px 0; }
.side-foot { font-size: 13px; color: var(--cs-fg-2); padding: 0 6px; } .side-foot a { color: inherit; }

/* ---------------------------------------------------------------- composer */
.sheet { width: min(600px, 94vw); border: 0; border-radius: var(--cs-radius-l); padding: 0; background: var(--cs-bg); color: var(--cs-fg); box-shadow: 0 30px 80px rgb(0 0 0 / .35); }
.sheet::backdrop { background: rgb(20 7 8 / .45); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.sheet[open] { animation: sheet var(--cs-med) var(--cs-ease-out); }
@keyframes sheet { from { opacity: 0; transform: translateY(16px) scale(.98); } }
@media (max-width: 640px) { .sheet { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; } }
.compose { display: grid; grid-template-columns: 48px 1fr; gap: 12px; padding: 18px; }
.compose textarea { width: 100%; min-height: 120px; border: 0; background: none; resize: none; font-size: 19px; outline: none; color: var(--cs-fg); }
.compose .replying { grid-column: 1 / -1; font-size: 14px; color: var(--cs-fg-2); }
.compose-bar { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--cs-line); padding-top: 12px; }
.compose-bar .count { margin-left: auto; font-size: 14px; color: var(--cs-fg-2); font-variant-numeric: tabular-nums; }
.compose-bar .count.over { color: var(--cs-red); font-weight: 700; }
.thumbs { grid-column: 2; display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs figure { margin: 0; position: relative; } .thumbs img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; }
.thumbs button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgb(0 0 0 / .7); color: #fff; cursor: pointer; }
.thumbs input { width: 96px; font-size: 12px; margin-top: 4px; border: 1px solid var(--cs-line); border-radius: 6px; padding: 3px 5px; background: var(--cs-surface); }
.icon-btn { border: 0; background: none; color: var(--cs-accent); cursor: pointer; padding: 6px; border-radius: 999px; }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 60; transform: translate(-50%, 20px); opacity: 0; visibility: hidden; padding: 12px 18px; border-radius: 999px;
  background: var(--cs-fg); color: var(--cs-bg); font-weight: 600; transition: opacity var(--cs-med) var(--cs-ease), transform var(--cs-med) var(--cs-ease-out), visibility 0s linear var(--cs-med); }
.toast.on { opacity: 1; transform: translate(-50%, 0); visibility: visible; transition-delay: 0s; }
@media (max-width: 640px) { .toast { bottom: calc(84px + env(safe-area-inset-bottom)); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.person-tools { display: grid; grid-template-columns: 140px 1fr auto auto; gap: 8px; }
.person-tools select, .person-tools input { padding: 9px 12px; border-radius: 10px; border: 1px solid var(--cs-line); background: var(--cs-surface); color: var(--cs-fg); }
@media (max-width: 640px) { .person-tools { grid-template-columns: 1fr 1fr; } }
