* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f5f3ee;
  color: #191919;
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.site-header {
  max-width: 900px;
  margin: 0 auto;
  padding: 60px 24px 28px;

  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;

  border-bottom: 1px solid #222;
}

.brand-block {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 1.5px;
  color: #777;
}

h1 {
  margin: 0;
  font-size: 42px;
  font-weight: 700;
  cursor: pointer;
}

.main-nav {
  display: flex;
  gap: 20px;
  margin-top: 18px;
}

.nav-button {
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  padding: 0 0 3px;

  font-size: 12px;
  letter-spacing: 1.2px;
  cursor: pointer;
}

.nav-button:hover,
.nav-button.active {
  border-bottom-color: #191919;
}

.new-post-button {
  flex: 0 0 auto;
  border: 1px solid #222;
  background: transparent;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
}

.new-post-button:hover {
  background: #222;
  color: white;
}

.feed-header {
  max-width: 900px;
  margin: 0 auto;
  padding: 28px 24px 0;

  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
}

.feed-header h2 {
  margin: 4px 0 0;
  font-size: 19px;
}

.feed-kicker {
  margin: 0;
  font-size: 10px;
  letter-spacing: 1.4px;
  color: #888;
}

.clear-filter {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 12px;
  color: #777;
  cursor: pointer;
}

.clear-filter:hover {
  color: #191919;
}

.feed {
  max-width: 900px;
  margin: 0 auto;
  padding: 28px 24px 50px;
}

.empty-state {
  padding: 70px 0;
  text-align: center;
  color: #777;
}

.empty-state p {
  margin: 0 0 8px;
  color: #333;
}

.empty-state span {
  font-size: 13px;
}

.post-card {
  border-top: 1px solid #bbb;
  padding: 30px 0 38px;
}

.post-card:first-child {
  border-top: 0;
  padding-top: 0;
}

.post-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 11px;
  letter-spacing: 1px;
  color: #777;
}

.post-card h2 {
  margin: 12px 0 10px;
  font-size: 28px;
}

.tags,
.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 20px;
}

.tag-button {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 12px;
  color: #9d1c1c;
  cursor: pointer;
}

.tag-button:hover {
  text-decoration: underline;
}

.post-image-frame {
  width: 100%;
  height: 320px;
  overflow: hidden;

  background: #e5e2db;
  border: 1px solid #ccc;

  cursor: pointer;
}

.post-image {
  display: block;
  width: 100%;
  height: 100%;

  object-fit: cover;
  object-position: top;
}

.excerpt {
  margin: 20px 0;
  font-family: Georgia, serif;
  font-size: 17px;
  line-height: 1.7;
}

.post-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  font-size: 13px;
}

.post-footer > div {
  display: flex;
  gap: 16px;
  align-items: center;
}

.post-footer a,
.detail-source a {
  color: inherit;
  text-decoration: none;
}

.post-footer a:hover,
.detail-source a:hover {
  text-decoration: underline;
}

.view-post-button {
  border: none;
  background: none;
  padding: 0;
  color: inherit;
  cursor: pointer;
}

.view-post-button:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;

  background: rgba(0, 0, 0, 0.48);

  display: flex;
  justify-content: center;
  align-items: center;

  padding: 24px;
}

.modal-panel {
  width: min(600px, 100%);
  max-height: 90vh;
  overflow: hidden;

  background: #f5f3ee;
  padding: 28px;
  border: 1px solid #222;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.2);
}

.detail-panel {
  width: min(760px, 100%);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;

  margin-bottom: 24px;
}

.modal-header h2 {
  margin: 0;
}

.detail-archive-number {
  margin: 0 0 5px;
  font-size: 10px;
  letter-spacing: 1.2px;
  color: #888;
}

.modal-header > button {
  border: none;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.modal-panel label {
  display: block;
  margin-bottom: 20px;
  font-size: 13px;
  font-weight: 600;
}

.modal-panel input,
.modal-panel textarea {
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;

  border: 1px solid #aaa;
  background: white;
}

.modal-panel textarea {
  resize: vertical;
}

.image-preview {
  margin-bottom: 20px;
}

.image-preview img {
  display: block;
  max-width: 100%;
  max-height: 400px;
  margin: 0 auto;
  border: 1px solid #bbb;
}

.publish-button,
.comment-submit-button {
  width: 100%;
  padding: 12px 16px;

  border: 1px solid #222;
  background: #222;
  color: white;

  cursor: pointer;
}

.publish-button:hover,
.comment-submit-button:hover {
  opacity: 0.88;
}

.detail-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;

  background: #e5e2db;
  border: 1px solid #ccc;
}

.detail-source {
  margin-top: 16px;
  font-size: 13px;
}

.comment-divider {
  margin: 30px 0 24px;
  border: none;
  border-top: 1px solid #bbb;
}

.comment-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 12px;
}

.comment-heading h3 {
  margin: 0;
}

.guest-label {
  margin: 0;
  font-size: 13px;
  color: #666;
}

#guestName {
  color: #9d1c1c;
}

.comment-section textarea {
  width: 100%;
  min-height: 90px;
  margin: 0 0 12px;
  padding: 10px 12px;

  border: 1px solid #aaa;
  background: white;
}

.comment-list {
  margin-top: 28px;
}

.comment-empty {
  padding: 18px 0;
  border-top: 1px solid #ccc;
  color: #888;
  font-size: 13px;
}

.comment {
  padding: 16px 0;
  border-top: 1px solid #ccc;
}

.comment-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.comment-name {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: #9d1c1c;
}

.comment-time {
  font-size: 11px;
  color: #888;
}

.comment-content {
  margin: 0;
  line-height: 1.6;
  white-space: pre-line;
}


.modal-panel {
  display: flex;
  flex-direction: column;
}

.modal-scroll-area {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.modal-action-bar {
  flex: 0 0 auto;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #c8c4bb;
  background: #f5f3ee;
}

.comment-action-bar {
  flex: 0 0 auto;
}

@media (max-width: 640px) {
  html,
  body {
    min-height: 100%;
  }

  .site-header {
    padding-top: 30px;
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: 34px;
  }

  .new-post-button {
    width: 100%;
    min-height: 46px;
  }

  .feed-header,
  .post-footer,
  .comment-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .post-image-frame {
    height: 240px;
  }

  .modal {
    padding: 0;
    align-items: stretch;
    background: #f5f3ee;
  }

  .modal-panel {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    min-height: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .modal-header {
    position: relative;
    flex: 0 0 auto;
    margin: 0;
    padding: calc(16px + env(safe-area-inset-top)) 18px 14px;
    border-bottom: 1px solid #c8c4bb;
    background: #f5f3ee;
    z-index: 5;
  }

  .modal-header > button {
    min-width: 44px;
    min-height: 44px;
    margin: -8px -8px -8px 0;
  }

  .modal-scroll-area {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 18px 18px 24px;
    scroll-padding-bottom: 120px;
  }

  .detail-panel {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 18px calc(24px + env(safe-area-inset-bottom));
  }

  .detail-panel > .modal-header {
    margin-left: -18px;
    margin-right: -18px;
    margin-bottom: 18px;
    position: sticky;
    top: 0;
  }

  .modal-panel label {
    margin-bottom: 18px;
  }

  .modal-panel input,
  .modal-panel textarea {
    min-height: 46px;
    font-size: 16px;
  }

  .modal-panel textarea {
    min-height: 104px;
  }

  .image-preview img {
    max-height: 240px;
  }

  .modal-action-bar {
    flex: 0 0 auto;
    margin-top: 0;
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid #c8c4bb;
    background: #f5f3ee;
  }

  .publish-button,
  .comment-submit-button {
    min-height: 48px;
    border-radius: 0;
  }

  .comment-section textarea {
    font-size: 16px;
    min-height: 104px;
  }

  .comment-action-bar {
    margin-bottom: 8px;
  }

  body.modal-open {
    overflow: hidden;
  }

  /* 键盘弹出时，底部按钮不强行 fixed。
     浏览器会缩小 100dvh，可滚动内容区仍保持可用。 */
  body.keyboard-open .modal-action-bar {
    padding-bottom: 10px;
  }
}


/* v6 fix: 详情页需要自己滚动，否则长截图会把吐槽区裁掉 */
@media (min-width: 641px) {
  .detail-panel {
    max-height: 90vh;
    overflow-y: auto;
  }
}
