:root {
  --bg: #f0f2f5;
  --card: #ffffff;
  --text: #050505;
  --muted: #65676b;
  --divider: #ced0d4;
  --hover: #f2f2f2;
  --blue: #1877f2;
  --chip: #e4e6eb;
  --shadow: 0 1px 2px rgba(0, 0, 0, .2);
  --bar: #ffffff;
}
[data-theme="dark"] {
  --bg: #18191a;
  --card: #242526;
  --text: #e4e6eb;
  --muted: #b0b3b8;
  --divider: #3e4042;
  --hover: #3a3b3c;
  --blue: #2d88ff;
  --chip: #3a3b3c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5);
  --bar: #242526;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.34;
}

/* ---------- preview chrome (not part of the mock) ---------- */

.bar {
  background: var(--bar);
  border-bottom: 1px solid var(--divider);
  position: sticky;
  top: 0;
  z-index: 5;
}
.bar-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.bar-label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.bar-label strong { font-size: 13px; letter-spacing: .02em; text-transform: uppercase; }
.bar-note { color: var(--muted); font-size: 13px; }
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #f0284a; flex: none;
}
.bar-actions { margin-left: auto; display: flex; gap: 8px; }
.btn {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--chip);
  border: 0;
  border-radius: 6px;
  padding: 7px 12px;
  cursor: pointer;
}
.btn:hover { filter: brightness(.94); }
.btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

main { max-width: 680px; margin: 0 auto; padding: 16px; }

.footnote {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin: 16px 4px 40px;
}

/* ---------- the post card ---------- */

.post {
  background: var(--card);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.post-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 0;
}
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #2f6b3f, #16351f);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .02em;
}
.who { min-width: 0; }
.who .name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  display: block;
}
.who .sub {
  color: var(--muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.globe { width: 12px; height: 12px; fill: var(--muted); }
.kebab {
  margin-left: auto;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 50%;
  align-self: flex-start;
}

.body {
  padding: 10px 16px 12px;
  font-size: 15px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}
.body.clamped .rest { display: none; }
.tags { color: var(--blue); }
.more {
  font: inherit;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-weight: 600;
}
.more:hover { text-decoration: underline; }

/* ---------- photo collage ---------- */

.collage { display: grid; gap: 2px; background: var(--divider); }
.collage .row { display: grid; gap: 2px; }
.collage .row.two   { grid-template-columns: 1fr 1fr; }
.collage .row.three { grid-template-columns: repeat(3, 1fr); }

.tile {
  position: relative;
  display: block;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  background: var(--card);
  overflow: hidden;
}
.tile img {
  display: block;
  width: 100%;
  height: auto;          /* keeps aspect-ratio live; an HTML height attr would kill it */
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center 35%;
}
.row.two .tile img { aspect-ratio: 1 / 1; }
.tile:hover img { filter: brightness(.92); }
.tile:focus-visible { outline: 3px solid var(--blue); outline-offset: -3px; }

.tile .plus {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .48);
  color: #fff;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -.01em;
}

/* ---------- counts + actions ---------- */

.counts {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  color: var(--muted);
  font-size: 15px;
}
.pills { display: flex; align-items: center; }
.pill {
  width: 18px; height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10px;
  line-height: 1;
  border: 2px solid var(--card);
  margin-left: -5px;
}
.pill:first-child { margin-left: 0; }
.pill.like { background: #1877f2; }
.pill.love { background: #f3425f; }
.pill.wow  { background: #f7b125; }
.counts .who-liked { margin-left: 3px; }
.counts .right { margin-left: auto; display: flex; gap: 10px; }

.actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--divider);
  margin: 0 12px;
  padding: 4px 0;
}
.action {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 6px;
  padding: 8px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.action:hover { background: var(--hover); }
.action:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.action svg { width: 17px; height: 17px; fill: currentColor; }

/* ---------- comments ---------- */

.comments { padding: 6px 16px 14px; border-top: 1px solid var(--divider); }
.comment { display: flex; gap: 8px; padding: 7px 0; }
.comment .avatar { width: 32px; height: 32px; font-size: 12px; background: linear-gradient(145deg, #6b6f76, #3a3d42); }
.bubble {
  background: var(--chip);
  border-radius: 16px;
  padding: 8px 12px;
  min-width: 0;
}
.bubble .cname { font-weight: 600; font-size: 13px; display: block; }
.bubble p { margin: 2px 0 0; font-size: 15px; line-height: 1.35; }
.cmeta {
  display: flex;
  gap: 12px;
  padding: 3px 0 0 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

/* ---------- lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, .92);
  display: grid;
  place-items: center;
  padding: 16px;
}
.lightbox[hidden] { display: none; }
.lb-figure { margin: 0; display: grid; gap: 12px; justify-items: center; max-height: 100%; }
.lb-figure img {
  max-width: min(92vw, 760px);
  max-height: 78dvh;
  border-radius: 4px;
  display: block;
}
.lb-figure figcaption {
  color: #d8dade;
  font-size: 13px;
  text-align: center;
  max-width: 640px;
  line-height: 1.5;
}
#lbCount { display: block; color: #9aa0a6; font-weight: 600; margin-bottom: 4px; }
.lb-close, .lb-nav {
  position: absolute;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border: 0;
  cursor: pointer;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.lb-close { top: 14px; right: 14px; width: 40px; height: 40px; font-size: 26px; line-height: 1; }
.lb-nav { top: 50%; transform: translateY(-50%); width: 46px; height: 46px; font-size: 30px; line-height: 1; padding-bottom: 4px; }
.lb-prev { left: 14px; }
.lb-next { right: 14px; }
.lb-close:hover, .lb-nav:hover { background: rgba(255, 255, 255, .24); }
.lb-close:focus-visible, .lb-nav:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

@media (max-width: 520px) {
  main { padding: 10px 0 0; }
  .post { border-radius: 0; }
  .bar-note { flex-basis: 100%; }
  .footnote { padding: 0 12px; }
  .action { font-size: 13px; gap: 5px; }
  .lb-nav { width: 40px; height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
