/* =========================================================================
   Pulse — a near-future zh social app, dark and disciplined. Matte ink-navy,
   a single desaturated teal accent, mono metadata, no gradients or glows.
   Spacing rides a 4px scale; every icon is stroke 1.75 on a 24 grid.
   ========================================================================= */

:root {
  --bg: #0f1115;
  --bg-2: #14171c;
  --bg-3: #1a1e24;
  --line: #232830;
  --line-soft: #1c2127;
  --ink: #e7ebf0;
  --ink-2: #9aa4b1;
  --ink-3: #5d6774;
  --teal: #4fb8c4;
  --teal-ink: #08252a;
  --teal-tint: rgba(79, 184, 196, 0.12);
  --nav-w: 216px;
  --col-w: 600px;
  --font: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'SFMono-Regular', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ---- app shell ---- */
.app { width: 100%; min-height: 100vh; }
.app-grid {
  max-width: calc(var(--nav-w) + var(--col-w));
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--nav-w) minmax(0, 1fr);
  align-items: start;
}

/* ---- left nav ---- */
.sidenav {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-right: 1px solid var(--line-soft);
}
.sidenav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  margin-bottom: 18px;
  color: var(--teal);
}
.sidenav-brand svg { display: block; }
.brand-word {
  color: var(--ink);
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 0.04em;
}
.sidenav-list { display: flex; flex-direction: column; gap: 2px; }
.navlink {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 15.5px;
  color: var(--ink-2);
  transition: background 0.12s, color 0.12s;
}
.navlink svg { display: block; width: 20px; height: 20px; flex: none; }
.navlink:hover { background: var(--bg-2); color: var(--ink); }
.navlink.is-active { background: var(--bg-2); color: var(--ink); font-weight: 700; }
.navlink.is-active svg { color: var(--teal); }
.sidenav-post {
  margin-top: 16px;
  padding: 11px 0;
  text-align: center;
  background: var(--teal);
  color: var(--teal-ink);
  font-weight: 700;
  font-size: 14.5px;
  border-radius: 10px;
}
.sidenav-post[aria-disabled="true"] { opacity: 0.6; cursor: not-allowed; }
.sidenav-guest {
  margin-top: auto;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink-3);
}

/* ---- center column ---- */
.column {
  border-right: 1px solid var(--line-soft);
  min-height: 100vh;
}
.col-head {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 16px 20px 12px;
  background: rgba(15, 17, 21, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.col-title { font-size: 18px; font-weight: 900; letter-spacing: 0.02em; }
.col-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

/* ---- compose strip (in-lore disabled) ---- */
.compose {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-3);
}
.compose[aria-disabled="true"] { cursor: not-allowed; }
.compose-av {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-3);
  color: var(--ink-2);
  display: grid;
  place-items: center;
  font-size: 13px;
  flex: none;
}
.compose-hint { flex: 1; font-size: 14.5px; }
.compose-btn {
  padding: 7px 18px;
  border-radius: 8px;
  background: var(--bg-3);
  color: var(--ink-3);
  font-weight: 500;
  font-size: 13px;
}

/* ---- post card ---- */
.feed { display: block; }
.post {
  padding: 16px 20px 8px;
  border-bottom: 1px solid var(--line);
  transition: background 0.12s;
}
.post:hover { background: var(--bg-2); }
/* a card carrying a permalink navigates on click, like the timestamp */
.post[data-nav-href] { cursor: pointer; }
.repost-by {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px 30px;
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 500;
}
.repost-by svg { display: block; width: 14px; height: 14px; }

.post-grid { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 12px; }
.post-rail { padding-top: 2px; }

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: block;
  overflow: hidden;
  flex: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-mono {
  display: grid;
  place-items: center;
  color: var(--ink);
  font-weight: 700;
  font-size: 16px;
}

.post-main { min-width: 0; }
.post-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 15px;
}
.ph-name { font-weight: 700; color: var(--ink); }
a.ph-name:hover { text-decoration: underline; }
.ph-name-flat, .tok-mention-flat { cursor: default; }
.tok-mention-flat { color: var(--teal); }
.ph-handle, .ph-ts { color: var(--ink-3); font-family: var(--mono); font-size: 12px; }
.ph-ts { margin-left: auto; }
.pin-chip {
  font-size: 11px;
  font-weight: 500;
  color: var(--teal);
  background: var(--teal-tint);
  border-radius: 6px;
  padding: 2px 8px;
  align-self: center;
}
.vchip { display: inline-flex; align-self: center; }
.vchip svg { display: block; }
.badge-verified { color: var(--teal); }

/* ---- anonymous comments (guest-mode veil) ---- */
.anon-name { color: var(--ink-2); cursor: default; }
.anon { position: relative; display: inline-block; }
.anon .anon-tip {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 30;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.12s ease 0.05s;
  pointer-events: none;
  white-space: nowrap;
  padding: 7px 11px;
  border-radius: 8px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 400;
  font-family: var(--font);
  line-height: 1.4;
}
.anon:hover .anon-tip { visibility: visible; opacity: 1; }

.post-edited {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--ink-3);
}
.post-edited svg { display: block; width: 13px; height: 13px; }

.post-body {
  margin: 4px 0 0;
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
}
.tok-tag, .tok-mention, .tok-link { color: var(--teal); }
.tok-tag:hover, .tok-mention:hover, .tok-link:hover { text-decoration: underline; }
.tok-tag-flat { color: var(--teal); cursor: default; }

/* photo */
.post-photo {
  margin: 12px 0 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.post-photo img { width: 100%; display: block; max-height: 460px; object-fit: cover; cursor: zoom-in; }
/* link-preview card (url image): clickable image, title pill overlaid bottom-left */
.post-card {
  position: relative;
  display: block;
  margin: 12px 0 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.post-card img { width: 100%; display: block; max-height: 460px; object-fit: cover; }
.post-card-title {
  position: absolute;
  left: 10px;
  bottom: 10px;
  max-width: calc(100% - 20px);
  padding: 3px 9px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 12.5px;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.post-card-domain {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--ink-2);
}

/* quote card */
.quote {
  display: block;
  margin: 12px 0 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bg-2);
  transition: border-color 0.12s;
}
.quote:hover { border-color: #2e3540; }
.quote[data-nav-href] { cursor: pointer; }
.quote-head { display: flex; align-items: baseline; gap: 7px; font-size: 13.5px; }
.quote-av { width: 20px; height: 20px; border-radius: 50%; overflow: hidden; flex: none; align-self: center; }
.quote-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.quote-av-mono { display: grid; place-items: center; color: var(--ink); font-size: 11px; font-weight: 700; }
.quote-head b { font-weight: 700; }
.quote-head .vchip svg { width: 13px; height: 13px; }
.quote-handle { color: var(--ink-3); font-family: var(--mono); font-size: 11.5px; }
.quote-ts { color: var(--ink-3); font-family: var(--mono); font-size: 11.5px; margin-left: auto; }
.quote-body { margin-top: 4px; font-size: 14px; color: var(--ink-2); line-height: 1.6; }

.post-via { margin-top: 8px; font-size: 11.5px; color: var(--ink-3); font-family: var(--mono); }

/* engagement row */
.engage {
  display: flex;
  align-items: center;
  gap: 32px;
  margin-top: 10px;
  padding: 6px 0;
}
.engage-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transition: color 0.12s;
}
.engage-item svg { display: block; width: 16px; height: 16px; }
.engage-item b { font-weight: 400; }
.engage-item:hover { color: var(--teal); }

.feed-end {
  text-align: center;
  color: var(--ink-3);
  font-size: 12.5px;
  padding: 28px 0 44px;
}

/* ---- new-posts strip (phase-escalated timelines; dismiss emits the seen fact)
   Sticks flush under the sticky column header (top set by its inline script). ---- */
.update-strip {
  position: sticky;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: #12181b;
  border-bottom: 1px solid var(--line);
  box-shadow: inset 2px 0 0 var(--teal);
  overflow: hidden;
  max-height: 64px;
  transition: max-height 0.35s ease, padding 0.35s ease, opacity 0.25s ease;
}
.update-strip[hidden] { display: none; }
.update-strip.gone {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  border-bottom-width: 0;
}
.update-strip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
  flex: none;
}
.update-strip-text { min-width: 0; font-size: 13.5px; color: var(--ink-2); }
.update-strip-text b {
  color: var(--ink);
  font-weight: 700;
  font-family: var(--mono);
  font-size: 13.5px;
}
.update-strip-btn {
  margin-left: auto;
  flex: none;
  cursor: pointer;
  padding: 6px 16px;
  border: none;
  border-radius: 8px;
  background: var(--teal);
  color: var(--teal-ink);
  font: 700 12.5px var(--font);
}
.update-strip-btn:hover { background: #5fc4cf; }

/* ---- profile ---- */
.profile { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.profile-colsub { font-family: var(--mono); }
.profile-banner { height: 168px; width: 100%; }
.profile-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 20px;
  margin-top: -40px;
}
.profile-av {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  border: 4px solid var(--bg);
  overflow: hidden;
  background: var(--bg);
}
.profile-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-av-mono { display: grid; place-items: center; color: var(--ink); font-size: 40px; font-weight: 700; }
.profile-follow {
  margin-bottom: 10px;
  padding: 8px 20px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 700;
  font-size: 13.5px;
}
.profile-id { padding: 10px 20px 0; }
.profile-name {
  font-size: 20px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.profile-handle { display: block; color: var(--ink-3); font-family: var(--mono); font-size: 13px; margin-top: 1px; }
.profile-bio { padding: 0 20px; margin: 10px 0 0; font-size: 14.5px; line-height: 1.7; }
.profile-meta { padding: 8px 20px 0; color: var(--ink-3); font-size: 13px; }
.profile-link { padding: 4px 20px 0; font-size: 13px; }
.profile-link a { color: var(--teal); }
.profile-link a:hover { text-decoration: underline; }
.profile-stats {
  display: flex;
  gap: 20px;
  padding: 10px 20px 0;
  font-size: 13.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.profile-stats b { color: var(--ink); font-weight: 700; }

/* ---- profile tabs (Posts / Replies) ---- */
.ptabs { display: flex; border-bottom: 1px solid var(--line); }
.ptab {
  flex: 1;
  appearance: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 14px 0;
  color: var(--ink-3);
  font-family: var(--font);
  font-size: 14.5px;
  font-weight: 700;
  position: relative;
  transition: background 0.12s, color 0.12s;
}
.ptab:hover { background: var(--bg-2); color: var(--ink); }
.ptab.is-active { color: var(--ink); }
.ptab.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: -1px;
  width: 48px;
  height: 2px;
  background: var(--teal);
}
.tab-empty { padding: 40px 20px; text-align: center; color: var(--ink-3); font-size: 13.5px; }

/* ---- thread / status page ---- */
.thread-back { color: var(--teal); }
.thread-back:hover { text-decoration: underline; }
.thread-replies-head {
  padding: 14px 20px 6px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
}
/* the login wall under a big post's visible replies (in-lore disabled) */
.reply-wall {
  margin: 8px 20px 24px;
  padding: 14px 16px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-2);
  cursor: not-allowed;
  font-variant-numeric: tabular-nums;
}
.post-focus { background: var(--bg-2); }
.post-focus:hover { background: var(--bg-2); }
.post-body-big { font-size: 18px; line-height: 1.7; margin-top: 8px; }

/* a reply shown directly beneath the post it answers — drop the divider between
   and join the avatars with a rail connector (Twitter conversation module) */
.thread-pair > .post:first-child { border-bottom: none; padding-bottom: 0; }
.thread-pair > .post:nth-child(2) { padding-top: 4px; }
.thread-pair > .post:first-child .post-rail { position: relative; }
.thread-pair > .post:first-child .post-rail::after {
  content: '';
  position: absolute;
  left: 20px;
  top: 50px; /* rail pad (2) + avatar (42) + 6px breathing room */
  bottom: -6px; /* through the reply card's top padding, to its avatar */
  width: 2px;
  border-radius: 1px;
  background: var(--line);
}

/* ---- deleted / unavailable ---- */
.post-gone { margin: 4px 0 8px; color: var(--ink-3); font-size: 13.5px; }
.post-gone-row {
  margin: 8px 20px;
  padding: 14px 16px;
  color: var(--ink-3);
  font-size: 13.5px;
  border: 1px dashed var(--line);
  border-radius: 10px;
}
.quote.quote-gone { color: var(--ink-3); }
.quote-body.quote-gone { color: var(--ink-3); }

/* ---- photo lightbox ---- */
.lightbox-lock { overflow: hidden; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  background: rgba(15, 17, 21, 0.95);
}
.lightbox.is-open { display: block; animation: lightbox-in 0.14s ease-out; }
@keyframes lightbox-in { from { opacity: 0; } }
.lightbox-stage {
  position: absolute;
  inset: 0;
  display: flex;
  overflow: auto;
  padding: 44px;
}
.lightbox-img {
  margin: auto;
  max-width: 100%;
  max-height: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  animation: lightbox-img-in 0.14s ease-out;
}
@keyframes lightbox-img-in { from { opacity: 0; transform: scale(0.985); } }
.lightbox.is-zoomable .lightbox-img { cursor: zoom-in; }
.lightbox.is-zoomed .lightbox-img {
  max-width: none;
  max-height: none;
  cursor: zoom-out;
  animation: none;
}
.lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 8px;
  appearance: none;
  cursor: pointer;
  background: none;
  border: none;
  outline: none;
  color: var(--ink-2);
  transition: color 0.12s;
}
.lightbox-close:hover { color: var(--ink); }
.lightbox-close:focus-visible { outline: 1.5px solid var(--teal); outline-offset: 2px; border-radius: 8px; }
.lightbox-close svg { width: 22px; height: 22px; display: block; }

/* ---- responsive: collapse the nav into a top strip ---- */
@media (max-width: 760px) {
  .app-grid { grid-template-columns: 1fr; }
  .sidenav {
    position: sticky;
    top: 0;
    z-index: 6;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: var(--bg);
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .sidenav-brand { margin: 0 8px 0 0; padding: 4px; }
  .brand-word { display: none; }
  .sidenav-list { flex-direction: row; overflow-x: auto; }
  .navlink { font-size: 14px; padding: 8px 12px; white-space: nowrap; }
  .sidenav-post { display: none; }
  .sidenav-guest { display: none; }
  .column { border-right: none; }
}
