:root {
  color-scheme: light;
  --bg: #fff;
  --text: #0f1419;
  --muted: #536471;
  --line: #eff3f4;
  --line-strong: #cfd9de;
  --soft: #f7f9f9;
  --hover: #f7f7f7;
  --black: #0f1419;
  --white: #fff;
  --danger: #f4212e;
  --max-feed: 920px;
  --side-width: 360px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: 0;
}

body.is-modal-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: var(--side-width) minmax(0, var(--max-feed));
  justify-content: center;
  min-height: 100vh;
}

.side {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 24px 28px 34px;
  border-right: 1px solid var(--line);
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand,
.mobile-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  font-weight: 800;
}

.brand {
  min-width: 0;
  padding: 4px 18px;
  border-radius: 8px;
  font-size: 20px;
  font-weight: 760;
}

.brand span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand:hover {
  background: var(--hover);
}

.brand img,
.mobile-brand img,
.profile img,
.avatar,
.login-card img {
  border-radius: 50%;
  flex: 0 0 auto;
}

.nav {
  display: grid;
  gap: 10px;
  margin-top: 30px;
}

.nav a,
.compose-toggle,
.tab,
.post-button,
.search-row button,
.icon-button,
.mobile-admin,
.login-submit,
.search-toggle {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
}

.nav a {
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 48px;
  padding: 0 18px;
  font-size: 20px;
  font-weight: 760;
}

.nav a:hover,
.nav a.is-active,
.compose-toggle:hover,
.mobile-admin:hover,
.icon-button:hover,
.search-toggle:hover {
  background: var(--hover);
}

.nav a.is-active {
  background: var(--soft);
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--black);
}

.nav-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.compose-toggle {
  display: block;
  width: min(236px, 82%);
  min-height: 56px;
  margin: 26px auto 0;
  border-color: var(--black);
  border-radius: 999px;
  background: #0f1419;
  color: var(--white);
  font-size: 16px;
  font-weight: 850;
}

.compose-toggle.is-on,
.mobile-admin.is-on {
  background: var(--black);
  color: var(--white);
}

.profile,
.search-box,
.tags {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.search-box {
  padding: 22px 0 0;
  border-bottom: 0;
}

.tags {
  padding: 28px 0 0;
  border-bottom: 0;
}

.profile {
  margin-top: 20px;
  padding-top: 20px;
}

.profile h2 {
  margin: 12px 0 4px;
  font-size: 20px;
  line-height: 1.25;
}

.profile p,
.search-box label {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.search-toggle {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  color: var(--black);
}

.search-toggle svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-box[hidden] {
  display: none;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 62px;
  gap: 8px;
  margin-top: 0;
}

.search-row input {
  min-width: 0;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: 0;
  background: var(--soft);
  color: var(--text);
}

.search-row input:focus {
  border-color: var(--black);
  background: var(--white);
}

.search-row button,
.post-button,
.login-submit {
  border-color: var(--black);
  background: var(--black);
  color: var(--white);
  font-weight: 850;
}

.tag-heading {
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 48px;
  margin: 0 0 14px;
  padding: 0 18px;
  font-size: 20px;
  font-weight: 760;
}

.tag-heading-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--black);
}

.tag-heading-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 18px;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  font-size: 15px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.feed {
  min-width: 0;
  border-right: 1px solid var(--line);
}

.topbar {
  display: none;
}

.mobile-admin {
  min-height: 34px;
  padding: 0 12px;
  border-color: var(--black);
  font-weight: 850;
}

.feed-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.tab {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 58px;
  border-radius: 0;
  color: var(--muted);
  font-weight: 850;
}

.tab:hover {
  background: var(--hover);
}

.tab.is-active {
  color: var(--text);
}

.tab.is-active::after {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 56px;
  height: 4px;
  border-radius: 4px;
  background: var(--black);
  content: "";
  transform: translateX(-50%);
}

.feed-title {
  display: flex;
  align-items: center;
  min-height: 64px;
  padding: 0 24px;
}

.feed-title h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.3;
}

.cover-profile {
  border-bottom: 0;
}

.cover-image {
  display: block;
  width: 100%;
  height: clamp(180px, 28vw, 294px);
  object-fit: cover;
  background: var(--soft);
}

.composer {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 18px;
  padding: 22px 24px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--white);
}

.composer-fields {
  min-width: 0;
}

.composer-title,
.composer textarea {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.composer-title {
  display: none;
  min-height: 38px;
  margin-bottom: 6px;
  font-size: 20px;
  font-weight: 800;
}

.composer.is-article .composer-title {
  display: block;
  min-height: 44px;
  margin-bottom: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.composer textarea {
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
  font-size: 20px;
}

.composer textarea:focus {
  border-color: var(--line-strong);
}

.composer.is-article textarea {
  min-height: 220px;
}

.composer-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.composer-toolbar button {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.composer-toolbar button:hover,
.composer-toolbar button:focus-visible {
  border-color: var(--line-strong);
  background: var(--soft);
  color: var(--text);
  outline: 0;
}

.composer-tags {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px 16px;
  padding: 8px 0 0;
}

.composer-tag-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 112px;
  overflow-y: auto;
  padding-right: 4px;
}

.composer-tag-option {
  position: relative;
  display: inline-flex;
}

.composer-tag-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.composer-tag-option span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
}

.composer-tag-option input:checked + span {
  border-color: var(--black);
  background: var(--black);
  color: var(--white);
}

.composer-tag-option input:focus-visible + span {
  border-color: var(--black);
  outline: 0;
}

.composer-submit-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  grid-column: 2;
  grid-row: 1;
  white-space: nowrap;
}

.post-button {
  min-width: 88px;
  padding: 0 18px;
}

.composer-error,
.login-error {
  min-height: 24px;
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 14px;
}

.composer-error:empty {
  min-height: 0;
  margin: 0;
}

.timeline {
  min-height: 360px;
}

.post {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 18px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}

.post:hover {
  background: #fbfbfb;
}

.post[data-post-link] {
  cursor: pointer;
}

.post[data-post-link]:focus-visible {
  outline: 2px solid var(--black);
  outline-offset: -2px;
}

.post-main {
  min-width: 0;
}

.post-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 14px;
}

.post-author {
  color: var(--text);
  font-weight: 850;
}

.post-title {
  margin: 2px 0 12px;
  font-size: 22px;
  line-height: 1.28;
}

.post-title a:hover,
.post-body a:hover,
.post-actions a:hover {
  text-decoration: underline;
}

.post-body {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 17px;
  line-height: 1.68;
}

.post-body p {
  margin: 0 0 0.8em;
}

.post-body p:last-child {
  margin-bottom: 0;
}

.post-body h2,
.post-body h3,
.post-body h4 {
  margin: 1.1em 0 0.45em;
  line-height: 1.32;
}

.post-body h2 {
  font-size: 24px;
}

.post-body h3 {
  font-size: 21px;
}

.post-body h4 {
  font-size: 19px;
}

.post-body blockquote {
  margin: 0.9em 0;
  padding: 0 0 0 14px;
  border-left: 3px solid var(--line-strong);
  color: var(--muted);
}

.post-body ul,
.post-body ol {
  margin: 0.8em 0;
  padding-left: 1.35em;
}

.post-body li + li {
  margin-top: 0.25em;
}

.post-body code {
  padding: 0.15em 0.35em;
  border-radius: 6px;
  background: var(--soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.post-body hr {
  height: 1px;
  margin: 1.2em 0;
  border: 0;
  background: var(--line);
}

.post-body a {
  color: var(--black);
  text-decoration: underline;
  text-decoration-color: var(--muted);
  text-underline-offset: 3px;
}

.post-body a.inline-tag {
  font-weight: 760;
  text-decoration: none;
}

.post-body a.inline-tag:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin-top: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}

.post-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
}

.post-actions a,
.post-actions button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.detail {
  padding-bottom: 40px;
}

.detail .post {
  border-bottom: 0;
}

.detail .post:hover {
  background: transparent;
}

.detail .post-body {
  font-size: 19px;
  line-height: 1.72;
}

.detail-nav {
  display: flex;
  gap: 12px;
  padding: 0 18px 20px 74px;
  border-bottom: 1px solid var(--line);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-color: var(--line-strong);
}

.empty,
.loading,
.error {
  padding: 36px 18px;
  color: var(--muted);
}

.error {
  color: var(--danger);
}

.load-more-trigger {
  width: 100%;
  height: 1px;
}

.about {
  padding: 22px 18px 48px;
}

.about h1 {
  margin: 0 0 18px;
  font-size: 28px;
}

.about-content {
  max-width: 68ch;
  font-size: 18px;
  line-height: 1.72;
}

.login-modal[hidden] {
  display: none;
}

.login-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 20, 25, 0.42);
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 18px 60px rgba(15, 20, 25, 0.18);
}

.login-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--black);
  font-size: 26px;
}

.login-close:hover {
  background: var(--hover);
}

.login-card h2 {
  margin: 14px 0 4px;
  font-size: 24px;
}

.login-card p {
  margin: 0 0 16px;
  color: var(--muted);
}

.login-card label {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  font-weight: 750;
}

.login-card input {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: 0;
}

.login-card input:focus {
  border-color: var(--black);
}

.login-submit {
  width: 100%;
  margin-top: 12px;
}

@media (max-width: 920px) {
  .shell {
    display: block;
  }

  .side {
    display: none;
  }

  .feed {
    min-height: 100vh;
    border-right: 0;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
    padding: 0 14px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
  }

  .feed-header {
    top: 52px;
  }
}

@media (max-width: 680px) {
  body {
    font-size: 15px;
  }

  .cover-image {
    height: 132px;
  }

  .composer,
  .post {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 12px;
    padding: 16px 14px;
  }

  .composer textarea {
    min-height: 78px;
    font-size: 18px;
  }

  .composer.is-article textarea {
    min-height: 160px;
  }

  .composer-tags {
    grid-template-columns: 1fr;
  }

  .composer-submit-row {
    grid-column: 1;
    grid-row: auto;
  }

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

  .post-body {
    font-size: 16px;
  }

  .feed-title {
    min-height: 58px;
    padding: 0 14px;
  }

  .feed-title h1 {
    font-size: 20px;
  }

  .detail .post-body {
    font-size: 17px;
  }

  .detail-nav {
    padding-left: 62px;
  }

  .about {
    padding: 20px 14px 40px;
  }
}
