:root {
  font-family: Arial, Helvetica, sans-serif;
  color: #1a1a1b;
  background: #dae0e6;
  line-height: 1.45;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: #2767b2;
}

.hidden {
  display: none !important;
}

/* Top navigation */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 56px;
  padding: 8px 16px;
  display: grid;
  grid-template-columns: 180px minmax(200px, 680px) auto;
  align-items: center;
  gap: 14px;
  background: #ffffff;
  border-bottom: 1px solid #d2d5d8;
}

.brand {
  color: #1a1a1b;
  font-size: 21px;
  font-weight: 700;
  text-decoration: none;
}

.search-wrap input {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid #d5d8dc;
  border-radius: 20px;
  background: #f6f7f8;
}

.search-wrap input:focus {
  border-color: #2767b2;
  outline: 2px solid rgba(39, 103, 178, 0.18);
}

.account {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* Public homepage explanation */

.app-home-intro {
  width: min(1240px, calc(100% - 24px));
  margin: 20px auto 0;
  padding: 26px;
  background: #ffffff;
  border: 1px solid #c8ccd0;
  border-radius: 4px;
}

.app-home-intro-content {
  max-width: 780px;
}

.app-label {
  margin: 0 0 6px;
  color: #2767b2;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-home-intro h1 {
  margin: 0 0 10px;
  font-size: 34px;
  line-height: 1.15;
}

.app-description,
.app-auth-description {
  margin: 8px 0;
  color: #3d4146;
  line-height: 1.6;
}

.app-home-links {
  margin-top: 18px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 18px;
}

.app-home-links > a:not(.button) {
  color: #2767b2;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.app-home-links > a:not(.button):hover {
  text-decoration: underline;
}

/* Main forum layout */

.layout {
  width: min(1240px, calc(100% - 24px));
  margin: 20px auto 60px;
  display: grid;
  grid-template-columns: 210px minmax(0, 680px) 280px;
  gap: 20px;
  align-items: start;
  scroll-margin-top: 76px;
}

.left-sidebar,
.right-sidebar {
  position: sticky;
  top: 76px;
}

.card {
  background: #ffffff;
  border: 1px solid #c8ccd0;
  border-radius: 4px;
}

/* Buttons */

.button {
  min-height: 36px;
  padding: 8px 14px;
  border: 1px solid #2767b2;
  border-radius: 20px;
  background: #2767b2;
  color: #ffffff;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.button:hover {
  background: #1d518f;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.secondary {
  border-color: #8b939c;
  background: #ffffff;
  color: #1a1a1b;
}

.secondary:hover {
  background: #eef0f2;
}

/* Sidebar navigation */

.nav-item {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  text-align: left;
  font-weight: 700;
}

.nav-item:hover,
.nav-item.active {
  background: #ffffff;
}

.sidebar-heading {
  margin: 18px 0 8px;
  padding: 0 10px;
  display: flex;
  justify-content: space-between;
  color: #666666;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.small-link,
.link-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #2767b2;
  font-weight: 700;
}

.community-list {
  display: grid;
  gap: 2px;
}

.community-button {
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  text-align: left;
}

.community-button:hover,
.community-button.active {
  background: #ffffff;
}

.community-button strong,
.community-button span {
  display: block;
}

.community-button span {
  margin-top: 2px;
  color: #72777d;
  font-size: 12px;
}

/* Post composer and feed controls */

.composer,
.login-notice,
.sort-bar {
  padding: 14px;
  margin-bottom: 12px;
}

.composer h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.login-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.sort-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sort-bar > span {
  margin-left: auto;
  color: #666666;
  font-size: 13px;
}

.sort-button {
  padding: 8px 13px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: #59636e;
  font-weight: 700;
}

.sort-button:hover,
.sort-button.active {
  background: #eef0f2;
  color: #2767b2;
}

/* Forms */

label {
  display: block;
  margin: 12px 0 5px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #b8bdc3;
  border-radius: 4px;
  background: #ffffff;
  color: #1a1a1b;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #2767b2;
  outline: 2px solid rgba(39, 103, 178, 0.18);
}

textarea {
  resize: vertical;
}

.form-actions {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

/* Posts */

.posts-list {
  display: grid;
  gap: 10px;
}

.post-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  overflow: hidden;
}

.vote-column {
  padding: 9px 5px;
  background: #f8f9fa;
  text-align: center;
}

.vote-button {
  width: 30px;
  height: 28px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #6a7178;
  font-size: 18px;
  font-weight: 700;
}

.vote-button:hover {
  background: #e6e8ea;
}

.vote-button.up.active {
  color: #d84b20;
}

.vote-button.down.active {
  color: #3b63ce;
}

.vote-score {
  display: block;
  padding: 2px 0;
  font-size: 13px;
  font-weight: 700;
}

.post-content {
  min-width: 0;
  padding: 11px 14px 13px;
}

.post-meta {
  margin: 0;
  color: #787c7e;
  font-size: 12px;
}

.post-title {
  margin: 7px 0;
  font-size: 19px;
  overflow-wrap: anywhere;
}

.post-body {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.post-actions {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.action-button {
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: #666666;
  font-size: 13px;
  font-weight: 700;
}

.action-button:hover {
  color: #1a1a1b;
}

.danger {
  color: #a52a2a;
}

/* Comments */

.comments-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e1e4e7;
}

.comment-form {
  margin-bottom: 14px;
}

.comment {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid #eceeef;
}

.comment:first-child {
  border-top: 0;
}

.comment-votes {
  text-align: center;
}

.comment-votes .vote-button {
  width: 26px;
  height: 23px;
  font-size: 15px;
}

.comment-meta {
  margin: 0;
  color: #787c7e;
  font-size: 12px;
}

.comment-body {
  margin: 5px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comment-actions {
  margin-top: 6px;
}

/* Right sidebar */

.about-card,
#selectedCommunityCard {
  padding: 16px;
  margin-bottom: 12px;
}

.about-card h2,
#selectedCommunityCard h2 {
  margin: 0 0 9px;
  font-size: 17px;
}

.about-card p,
#selectedCommunityCard p {
  margin: 0;
  color: #4d5156;
}

/* Status text */

.empty {
  padding: 32px 16px;
  color: #666666;
  text-align: center;
}

.muted,
.message {
  color: #666666;
  font-size: 13px;
}

.error {
  color: #a52a2a;
}

/* Dialogs */

dialog {
  width: min(430px, calc(100% - 24px));
  padding: 22px;
  border: 1px solid #b8bdc3;
  border-radius: 6px;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.48);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.dialog-header h2 {
  margin: 0;
}

.close-button {
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 27px;
}

.full-width {
  width: 100%;
  display: block;
}

.divider {
  margin: 18px 0 4px;
  color: #777777;
  text-align: center;
}

.switch-line {
  margin-bottom: 0;
  text-align: center;
}

/* Footer */

.site-footer {
  width: min(1240px, calc(100% - 24px));
  margin: 0 auto 28px;
  padding: 18px 12px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 18px;
  color: #60656b;
  font-size: 13px;
  text-align: center;
}

.site-footer a {
  color: #60656b;
  text-decoration: none;
}

.site-footer a:hover {
  color: #2767b2;
  text-decoration: underline;
}

/* Tablet */

@media (max-width: 1020px) {
  .layout {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .right-sidebar {
    display: none;
  }
}

/* Mobile */

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .search-wrap {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .app-home-intro {
    margin-top: 10px;
    padding: 20px;
  }

  .app-home-intro h1 {
    font-size: 28px;
  }

  .app-home-links {
    align-items: flex-start;
  }

  .layout {
    width: min(100% - 16px, 680px);
    grid-template-columns: 1fr;
    margin-top: 10px;
  }

  .left-sidebar {
    position: static;
    display: flex;
    gap: 6px;
    overflow-x: auto;
  }

  .sidebar-heading {
    display: none;
  }

  .community-list {
    display: flex;
    gap: 4px;
  }

  .community-button,
  .nav-item {
    width: auto;
    white-space: nowrap;
    background: #ffffff;
  }

  .community-button span {
    display: none;
  }

  .login-notice {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Small phones */

@media (max-width: 480px) {
  .topbar {
    padding: 8px 10px;
  }

  .brand {
    font-size: 19px;
  }

  .app-home-intro {
    width: calc(100% - 16px);
    padding: 17px;
  }

  .app-home-intro h1 {
    font-size: 25px;
  }

  .app-home-links {
    flex-direction: column;
    align-items: stretch;
  }

  .app-home-links .button {
    width: 100%;
  }

  .sort-bar {
    flex-wrap: wrap;
  }

  .sort-bar > span {
    width: 100%;
    margin: 4px 0 0;
  }

  .post-card {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .post-content {
    padding: 10px 11px 12px;
  }

  .post-title {
    font-size: 17px;
  }

  .form-actions {
    align-items: flex-start;
    flex-direction: column;
  }
}