/* =====================
   GLOBAL
===================== */

body {
  margin: 0;
  background: #e6e6e6;
  font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif;
  color: #222;
  overflow-x: hidden;
}

/* =====================
   TOP BAR (POST PAGES)
===================== */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 44px;

  background: #f2f2f2;
  border-bottom: 1px solid #ddd;

  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;

  padding: 0 16px;
  font-size: 13px;
  color: #555;
}

/* LEFT (nav) */
.topbar a {
  justify-self: start;
  color: #555;
  text-decoration: none;
}

.topbar a:hover {
  color: #000;
}

/* CENTER (title) */
.topbar-title {
  justify-self: center;
  font-weight: 500;
  color: #333;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60vw;
}

/* RIGHT (date) */
.topbar-date {
  justify-self: end;
  font-size: 12px;
  color: #888;
  white-space: nowrap;
}

/* =====================
   MOBILE TOPBAR TWEAK (light only)
===================== */

@media (max-width: 600px) {
  .topbar {
    font-size: 12px;
    padding: 0 10px;
  }

  .topbar-title {
    max-width: 45vw;
  }

  .topbar-date {
    font-size: 11px;
  }
}

/* =====================
   POST VIEWER
===================== */

.viewer {
  max-width: 1000px;
  margin: 80px auto 40px auto;
  padding: 0 20px;
}

.document {
  display: flex;
  flex-direction: column;
  gap: 28px;
  align-items: center;
}

.page {
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.page img {
  display: block;
  width: 100%;
  max-width: 820px;
  height: auto;
}

/* =====================
   INDEX PAGE LAYOUT
===================== */

.wrap {
  max-width: 900px;
  margin: 60px auto;
  padding: 20px;
}

h1 {
  font-size: 18px;
  font-weight: 500;
  color: #333;
  margin-bottom: 24px;
}

/* =====================
   FEED CONTAINER
===================== */

.feed {
  max-width: 720px;
  margin: 60px auto;
  padding: 0 20px;
}

/* =====================
   FEED ITEMS
===================== */

.feed-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;

  padding: 14px 12px;
  margin: 6px 0;

  text-decoration: none;
  color: inherit;

  background: #ededed;
  border-radius: 10px;

  transition: background 0.15s ease, transform 0.1s ease;
}

.feed-item:last-child {
  margin-bottom: 0;
}

.feed-item:hover {
  background: #fff;
}

/* =====================
   TEXT HIERARCHY
===================== */

.feed-title {
  font-size: 16px;
  font-weight: 500;
  color: #222;

  max-width: 70%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-date {
  font-size: 12px;
  font-weight: 400;
  color: #999;
  white-space: nowrap;
}

/* =====================
   REPLY NOTE
===================== */

.reply-note {
  margin: 60px 0 30px 0;

  text-align: center;

  font-size: 14px;
  opacity: 0.65;
}

.reply-note a {
  color: inherit;
  text-decoration: none;
}

/* =====================
   MOBILE OPTIMIZATION
===================== */

@media (max-width: 600px) {

  /* viewer spacing fix (key change) */
  .viewer {
    padding: 0;
    margin: 64px 0 40px 0; /* ensures space under fixed topbar */
  }

  .document {
    gap: 14px;
  }

  .page {
    box-shadow: none;
    border-radius: 0;
    width: 100%;
  }

  .page img {
    width: 100%;
    max-width: 100%;
    display: block;
  }

  /* feed remains your existing mobile behavior */
  .feed {
    padding: 0 14px;
  }

  .feed-item {
    flex-direction: column;
    align-items: flex-start;

    padding: 18px 14px;
    margin-bottom: 10px;

    background: #f7f7f7;
    border-radius: 10px;
  }

  .feed-item:active {
    background: #eeeeee;
  }

  .feed-title {
    font-size: 18px;
    line-height: 1.3;
    max-width: 100%;
    white-space: normal;
  }

  .feed-date {
    font-size: 13px;
    color: #888;
    margin-top: 4px;
  }
}