:root {
  --paper: #fffdf7;
  --ink: #202124;
  --red: #8e1717;
  --line: #d8d1c5;
  --muted: #6b655e;
  --blue: #174f86;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #e8e4dc;
  color: var(--ink);
  font: 16px/1.45 Georgia, serif;
}

/* Keeps the site logo from filling the page. */
.rt-topbar .install-app img {
  display: block;
  width: 110px;
  height: 110px;
  max-width: 110px;
  object-fit: contain;
}

.site-shell {
  max-width: 1500px;
  margin: auto;
  padding: 16px;
}

.three-column {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(390px, 1.55fr) minmax(250px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.column {
  min-width: 0;
}

.panel,
.community-post {
  margin-bottom: 16px;
  padding: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 2px 8px #00000010;
}

.column-title {
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 3px solid var(--red);
  font: 700 1.25rem Arial, sans-serif;
}

.article-card h2 {
  margin: 0.2em 0;
}

.article-card img,
.post-media {
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: contain;
  background: #111;
  border-radius: 7px;
}

.article-meta,
time {
  color: var(--muted);
  font: 12px Arial, sans-serif;
}

.article-authorline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.article-authorline a {
  color: inherit;
  font-weight: bold;
  text-decoration: none;
}

.article-authorline a:hover {
  text-decoration: underline;
}

.community-post header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

/* Article comment avatars must override the general article-image rule. */
.article-card .rt-avatar,
.rt-comments .rt-avatar {
  display: block;
  width: 32px;
  min-width: 32px;
  max-width: 32px;
  height: 32px;
  max-height: 32px;
  object-fit: cover;
  border-radius: 50%;
}

.community-author,
.community-post header.community-author {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
}

.community-author > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.community-author a {
  color: inherit;
  text-decoration: none;
}

.community-author a:hover {
  text-decoration: underline;
}

.community-avatar {
  display: block;
  width: 42px;
  min-width: 42px;
  max-width: 42px;
  height: 42px;
  max-height: 42px;
  object-fit: cover;
  background: #eee;
  border: 2px solid var(--line);
  border-radius: 50%;
}

.reply .community-avatar {
  width: 32px;
  min-width: 32px;
  max-width: 32px;
  height: 32px;
  max-height: 32px;
}

.composer textarea,
.composer input,
.composer select,
.reply-form input,
.reply-form textarea {
  width: 100%;
  margin: 5px 0;
  padding: 10px;
  border: 1px solid #aaa;
  border-radius: 6px;
}

.reply-form textarea {
  min-height: 96px;
  resize: vertical;
  font: inherit;
}

.reply-form button {
  align-self: flex-end;
}

.composer-row,
.reply-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.composer button,
.reply-form button,
#load-more,
.weather-box button {
  padding: 9px 14px;
  color: #fff;
  background: var(--red);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.post-body {
  margin: 10px 0;
  overflow-wrap: anywhere;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

.rt-footer {
  text-align: center;
}

.rt-footer nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 7px;
}

.rt-footer a { color: inherit; }

.composer-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.privacy-control {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  white-space: nowrap;
}

.privacy-control select,
.selected-friends-wrap select,
.edit-privacy select {
  width: 100%;
  padding: 7px;
  border: 1px solid #aaa;
  border-radius: 6px;
  background: #fff;
}

.selected-friends-wrap {
  margin: 8px 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #faf8f3;
}

.selected-friends-wrap[hidden] { display: none; }
.selected-friends-wrap label { display: grid; gap: 5px; }
.selected-friends-wrap small { display: block; margin-top: 5px; color: #555; }

.post-visibility {
  margin-left: auto;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f6f1e7;
  color: #51483c;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.edit-privacy { margin: 5px 0 12px; }
.edit-privacy > label { display: grid; gap: 5px; }

body.community-edit-open {
  overflow: hidden;
}

.community-edit-overlay {
  position: fixed;
  z-index: 10000;
  inset: 0;
  overflow-y: auto;
  padding: 24px 12px;
  background: rgba(0, 0, 0, 0.72);
}

.community-edit-dialog {
  width: min(820px, 100%);
  margin: 0 auto;
  padding: 20px;
  color: var(--ink);
  background: var(--paper);
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.community-edit-heading,
.community-edit-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.community-edit-heading h2 {
  margin: 0 0 12px;
}

.community-edit-dialog textarea,
.community-edit-dialog input[type="url"],
.community-edit-dialog input[type="file"] {
  display: block;
  width: 100%;
  margin: 6px 0 16px;
  padding: 10px;
  font: inherit;
  border: 1px solid #999;
  border-radius: 6px;
}

.community-edit-dialog textarea {
  min-height: 240px;
  overflow: hidden;
  resize: vertical;
  text-align: left;
}

.community-edit-media {
  margin: 4px 0 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.edit-media-preview {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 440px;
  margin: 0 auto 14px;
  object-fit: contain;
}

.edit-media-audio {
  width: 100%;
  margin-bottom: 14px;
}

.edit-media-empty,
.community-edit-status {
  color: var(--muted);
}

.edit-remove-media {
  display: block;
  margin: 8px 0;
}

.community-edit-dialog button {
  padding: 9px 14px;
  border: 1px solid #999;
  border-radius: 6px;
  cursor: pointer;
}

.community-edit-dialog .edit-save {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.community-edit-dialog .edit-close {
  padding: 0 8px;
  font-size: 28px;
  line-height: 1.1;
  background: transparent;
  border: 0;
}

.community-edit-dialog button:disabled {
  cursor: wait;
  opacity: 0.65;
}

@media (max-width: 700px) {
  .community-edit-overlay {
    padding: 0;
  }

  .community-edit-dialog {
    min-height: 100vh;
    border-radius: 0;
  }
}

.article-card > div:not(.article-meta):not(.reaction-row):not(.rt-comments):not(.rt-media-block),
.rt-comments .rt-body,
.rt-comment .rt-body,
.rt-reply-preview .rt-body {
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

/* Uniform eight-line preview for articles and main community posts. */
.read-more-content {
  position: relative;
  max-height: 11.6em;
  overflow: hidden;
}

.read-more-content.is-expanded {
  max-height: none;
  overflow: visible;
}

.read-more-content.is-collapsed::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2.8em;
  content: "";
  pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--paper));
}

.read-more-button {
  display: inline-block;
  margin: 8px 0 4px;
  padding: 7px 12px;
  color: var(--red);
  font-weight: bold;
  background: #fff;
  border: 1px solid var(--red);
  border-radius: 18px;
  cursor: pointer;
}

.community-embed {
  aspect-ratio: 16 / 9;
}

.community-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.link-card {
  display: flex;
  flex-direction: column;
  padding: 12px;
  overflow-wrap: anywhere;
  background: #f0eee8;
  border-left: 4px solid var(--blue);
}

.reaction-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
}

.reaction-row button,
.post-tools button {
  padding: 5px 9px;
  background: #fff;
  border: 1px solid #bbb;
  border-radius: 18px;
  cursor: pointer;
}

.reaction-row .reaction-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 5px 9px 5px 6px;
  color: var(--ink);
  font: 600 12px Arial, sans-serif;
}

.article-card .reaction-row .reaction-button img,
.reaction-row .reaction-button img {
  display: block;
  width: 22px;
  min-width: 22px;
  max-width: 22px;
  height: 22px;
  max-height: 22px;
  object-fit: contain;
  background: transparent;
  border: 0;
  border-radius: 50%;
}

.reaction-row .reaction-button b {
  min-width: 1em;
  color: var(--muted);
  text-align: center;
}

.reaction-row details {
  position: relative;
}

.reaction-row details ul {
  position: absolute;
  z-index: 4;
  width: 210px;
  max-height: 220px;
  padding: 10px 24px;
  overflow: auto;
  background: #fff;
  border: 1px solid #bbb;
}

.post-tools {
  display: flex;
  gap: 7px;
  margin: 8px 0;
}

.user-tag {
  color: var(--blue);
  font-weight: bold;
  text-decoration: none;
}

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

.multi-share-menu {
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.65);
}

.multi-share-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  width: min(430px, 100%);
  padding: 18px;
  gap: 10px;
  background: var(--paper);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.multi-share-card h3 {
  grid-column: 1 / -1;
  margin: 0 0 8px;
}

.multi-share-card button {
  padding: 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
}

.multi-share-card button:hover {
  border-color: var(--red);
}

.reply {
  margin: 8px 0;
  padding: 8px 10px;
  background: #f7f4ed;
  border-left: 3px solid #c9c2b6;
}

.community-post.notification-target,
.reply.notification-target {
  outline: 4px solid #d49a16;
  outline-offset: 3px;
  box-shadow: 0 0 0 7px rgba(212, 154, 22, 0.22), 0 8px 24px rgba(0, 0, 0, 0.18);
  scroll-margin-block: 120px;
}

.ad-slot img,
.countdown-slot img {
  max-width: 100%;
  height: auto;
}

/* Public right-column advertisement copy. */
.ad-slot > div {
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

.install-app {
  cursor: pointer;
}

.notification-link {
  white-space: nowrap;
}

.notification-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  color: #fff;
  background: #d6294f;
  border-radius: 999px;
  font: bold 11px Arial, sans-serif;
}

.notification-badge[hidden] {
  display: none;
}

.weather-box a {
  display: inline-block;
  margin-top: 10px;
  font-weight: bold;
}

.sticky-side {
  position: sticky;
  top: 10px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

@media (max-width: 1024px) {
  .three-column {
    grid-template-columns: 1fr;
  }

  .column-center {
    order: 1;
  }

  .column-left {
    order: 2;
  }

  .column-right {
    order: 3;
  }

  .sticky-side {
    position: static;
  }

  .site-shell {
    padding: 10px;
  }

  .community-post,
  .panel {
    border-radius: 6px;
  }
}

@media (max-width: 520px) {
  .site-shell {
    padding: 5px;
  }

  .panel,
  .community-post {
    padding: 11px;
  }

  .composer-row {
    flex-direction: column;
    align-items: stretch;
  }

  .composer-heading,
  .privacy-control {
    align-items: stretch;
    flex-direction: column;
  }

  .community-post header {
    flex-direction: column;
  }

  .reaction-row button {
    font-size: 12px;
  }

  .post-tools {
    flex-wrap: wrap;
  }
}
