:root {
  --paper: #f6f4ef;
  --paper-deep: #ebe8e0;
  --ink: #1d2424;
  --muted: #747c79;
  --line: #d9d8d1;
  --accent: #e86645;
  --accent-soft: #f3c4b3;
  --blue: #3e6c70;
  --shadow: 0 18px 50px rgba(31, 38, 36, 0.08);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.shell {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
}

.site-header {
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border-radius: 12px 12px 12px 4px;
  background: var(--ink);
  color: var(--paper);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
  line-height: 1.1;
}

.brand small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  color: var(--muted);
  font-size: 13px;
}

.site-nav a,
.text-link,
.back-link,
.site-footer a {
  transition: color 180ms ease;
}

.site-nav a:hover,
.site-nav a.active,
.text-link:hover,
.back-link:hover,
.site-footer a:hover {
  color: var(--accent);
}

.intro {
  padding: 62px 0 86px;
  border-top: 1px solid var(--line);
}

.intro-label,
.eyebrow {
  color: var(--blue);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.16em;
}

.intro-label {
  display: flex;
  align-items: center;
  gap: 9px;
}

.intro-label span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.intro h1 {
  max-width: 900px;
  margin: 18px 0 16px;
  font-size: clamp(38px, 5vw, 64px);
  font-weight: 650;
  letter-spacing: -0.075em;
  line-height: 1.12;
}

h1 em,
.simple-page h1 em {
  color: var(--accent);
  font-family: Georgia, "Songti SC", serif;
  font-style: italic;
  font-weight: 400;
}

.intro-copy {
  max-width: 470px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.85;
}

.intro-meta {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 34px;
  color: var(--muted);
  font-size: 12px;
}

.meta-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-soft);
}

.notes-section {
  padding: 0 0 114px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 30px;
}

.section-heading h2 {
  margin: 9px 0 0;
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -0.05em;
}

.text-link {
  color: var(--muted);
  font-size: 12px;
}

.text-link span {
  display: inline-block;
  margin-left: 5px;
  color: var(--accent);
  font-size: 15px;
  transform: translateY(1px);
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.post-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.35);
  transition: box-shadow 220ms ease, transform 220ms ease, border-color 220ms ease;
}

.post-card:hover {
  border-color: #c5c7be;
  box-shadow: var(--shadow);
  transform: translateY(-4px);
}

.post-image {
  position: relative;
  display: block;
  height: 218px;
  overflow: hidden;
  background: var(--paper-deep);
}

.post-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 450ms ease;
}

.post-card:hover .post-image img {
  transform: scale(1.04);
}

.card-arrow {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  background: rgba(29, 36, 36, 0.62);
  color: white;
  font-size: 15px;
  opacity: 0;
  transition: opacity 220ms ease;
}

.post-card:hover .card-arrow {
  opacity: 1;
}

.card-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  background: linear-gradient(135deg, #d8e0db 0%, #f0d4c6 100%);
}

.card-placeholder span {
  display: grid;
  width: 60px;
  height: 60px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 20px 20px 20px 5px;
  color: rgba(29, 36, 36, 0.58);
  font-family: Georgia, serif;
  font-size: 28px;
}

.post-card-body {
  padding: 21px 22px 24px;
}

.post-meta,
.article-topline {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
}

.post-meta span,
.article-topline span {
  color: var(--accent);
  font-weight: 700;
}

.post-meta time {
  margin-left: auto;
}

.post-card h3 {
  margin: 17px 0 9px;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.045em;
  line-height: 1.3;
}

.post-card h3 a:hover {
  color: var(--accent);
}

.post-card p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.empty-state {
  grid-column: 1 / -1;
  min-height: 300px;
  padding: 60px;
  border: 1px dashed #c6c8bf;
  border-radius: 20px;
  text-align: center;
}

.empty-mark {
  display: block;
  color: var(--accent);
  font-family: Georgia, serif;
  font-size: 44px;
  font-style: italic;
}

.empty-state h2,
.not-found-page h1 {
  margin: 15px 0 9px;
  font-size: 24px;
  letter-spacing: -0.05em;
}

.empty-state p,
.not-found-page p {
  max-width: 390px;
  margin: 0 auto 24px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 19px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  transition: transform 180ms ease, background 180ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button-dark {
  background: var(--ink);
  color: var(--paper);
}

.button-dark:hover {
  background: var(--accent);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 0 32px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.site-footer span:last-child {
  display: flex;
  gap: 12px;
}

.site-footer i {
  width: 3px;
  height: 3px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--accent-soft);
}

.article-header {
  min-height: 86px;
}

.back-link {
  color: var(--muted);
  font-size: 12px;
}

.article-page {
  max-width: 840px;
  padding: 90px 0 100px;
}

.article-topline i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-soft);
}

.article-page h1 {
  max-width: 780px;
  margin: 21px 0 15px;
  font-size: clamp(38px, 6vw, 68px);
  font-weight: 650;
  letter-spacing: -0.07em;
  line-height: 1.1;
}

.article-summary {
  max-width: 620px;
  margin: 0 0 34px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.75;
}

.article-cover {
  display: block;
  width: 100%;
  max-height: 540px;
  margin: 38px 0 52px;
  border-radius: 20px;
  object-fit: cover;
}

.article-content {
  color: #303836;
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: 18px;
  line-height: 2;
}

.article-content h1,
.article-content h2,
.article-content h3 {
  margin: 2.1em 0 0.7em;
  color: var(--ink);
  font-family: Inter, "Noto Sans SC", sans-serif;
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.35;
}

.article-content h1 {
  font-size: 34px;
}

.article-content h2 {
  font-size: 28px;
}

.article-content h3 {
  font-size: 22px;
}

.article-content p {
  margin: 0 0 1.25em;
}

.article-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.article-content strong {
  color: var(--ink);
}

.article-content blockquote {
  margin: 1.5em 0;
  padding: 2px 0 2px 24px;
  border-left: 3px solid var(--accent-soft);
  color: var(--muted);
}

.article-content blockquote p {
  margin-bottom: 0;
}

.article-content ul,
.article-content ol {
  margin: 0 0 1.25em;
  padding-left: 1.4em;
}

.article-content li {
  padding-left: 5px;
}

.article-content hr {
  width: 52px;
  margin: 2.5em 0;
  border: 0;
  border-top: 2px solid var(--accent-soft);
}

.article-content code {
  padding: 3px 6px;
  border-radius: 6px;
  background: var(--paper-deep);
  color: var(--blue);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.82em;
}

.article-content pre {
  overflow: auto;
  margin: 1.5em 0;
  padding: 18px;
  border-radius: 12px;
  background: #202827;
  color: #f7f4ea;
  line-height: 1.55;
}

.article-content pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.inline-image {
  display: block;
  width: 100%;
  max-height: 640px;
  margin: 1.6em 0;
  border-radius: 14px;
  object-fit: contain;
  background: var(--paper-deep);
}

.article-end {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 70px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.article-end a {
  color: var(--accent);
}

.simple-page {
  min-height: calc(100vh - 190px);
  padding: 108px 0 120px;
}

.simple-page h1 {
  max-width: 700px;
  margin: 20px 0 34px;
  font-size: clamp(44px, 7vw, 76px);
  font-weight: 650;
  letter-spacing: -0.075em;
  line-height: 1.08;
}

.about-page h1 {
  font-size: clamp(38px, 5vw, 64px);
  line-height: 1.12;
}

.simple-copy {
  max-width: 590px;
  margin-bottom: 30px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.95;
}

.simple-copy p {
  margin: 0 0 18px;
}

.legal-page h1 {
  font-size: clamp(42px, 6vw, 64px);
}

.not-found-page {
  text-align: center;
}

.not-found-page .simple-copy {
  margin-right: auto;
  margin-left: auto;
}

/* Writing studio */
.admin-body {
  min-height: 100vh;
  background: #eeece6;
}

.admin-shell {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
}

.admin-topbar {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.admin-topbar .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px 10px 10px 3px;
  font-size: 14px;
}

.admin-topbar .brand strong {
  font-size: 14px;
}

.admin-topbar .brand small {
  font-size: 10px;
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-actions a,
.admin-actions button,
.secondary-button,
.danger-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}

.admin-actions button:hover,
.secondary-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.admin-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 22px;
  padding: 28px 0 50px;
}

.admin-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.46);
}

.post-list-panel {
  min-height: 580px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h1,
.panel-heading h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.panel-heading small {
  color: var(--muted);
  font-size: 11px;
}

.new-post-button,
.save-button,
.login-button {
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  background: var(--ink);
  color: white;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.new-post-button {
  padding: 0 12px;
}

.new-post-button:hover,
.save-button:hover,
.login-button:hover {
  background: var(--accent);
}

.post-list {
  padding: 8px;
}

.post-list-item {
  display: block;
  width: 100%;
  padding: 13px 11px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.post-list-item:hover,
.post-list-item.selected {
  background: #e6e3da;
}

.post-list-item strong,
.post-list-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-list-item strong {
  font-size: 13px;
  font-weight: 700;
}

.post-list-item small {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

.list-empty {
  padding: 28px 11px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.editor-panel {
  padding-bottom: 24px;
}

.editor-form {
  padding: 22px 24px 0;
}

.form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
}

.field label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.field input,
.field textarea,
.field select,
.login-card input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

.field input,
.field select,
.login-card input {
  min-height: 42px;
  padding: 0 12px;
}

.field textarea {
  min-height: 290px;
  padding: 14px;
  resize: vertical;
  line-height: 1.7;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.login-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 102, 69, 0.1);
}

.field-hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -7px 0 9px;
}

.editor-toolbar button,
.upload-label {
  min-height: 29px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}

.editor-toolbar button:hover,
.upload-label:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.upload-label input {
  display: none;
}

.cover-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cover-preview {
  display: none;
  width: 88px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
}

.cover-preview.visible {
  display: block;
}

.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 5px;
}

.editor-footer-left {
  display: flex;
  gap: 9px;
}

.save-button {
  padding: 0 18px;
}

.danger-button:hover {
  border-color: #bb5148;
  color: #bb5148;
}

.status-message {
  min-height: 20px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12px;
}

.status-message.error {
  color: #b14f47;
}

.status-message.success {
  color: var(--blue);
}

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  padding: 37px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow);
}

.login-card .brand {
  margin-bottom: 39px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 28px;
  letter-spacing: -0.06em;
}

.login-card p {
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.login-button {
  width: 100%;
  margin-top: 7px;
}

.hidden {
  display: none !important;
}

@media (max-width: 820px) {
  .post-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .post-list-panel {
    min-height: auto;
  }

  .post-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 32px, 1120px);
  }

  .site-header {
    min-height: 79px;
  }

  .site-nav {
    gap: 15px;
  }

  .intro {
    padding: 52px 0 64px;
  }

  .intro h1 {
    font-size: 38px;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
    gap: 13px;
  }

  .post-grid {
    grid-template-columns: 1fr;
  }

  .post-image {
    height: 210px;
  }

  .empty-state {
    padding: 43px 22px;
  }

  .site-footer {
    align-items: start;
    flex-direction: column;
    gap: 11px;
  }

  .article-page,
  .simple-page {
    padding-top: 70px;
    padding-bottom: 80px;
  }

  .article-page h1,
  .simple-page h1 {
    font-size: 45px;
  }

  .about-page h1 {
    font-size: 38px;
  }

  .article-content {
    font-size: 17px;
  }

  .article-end {
    align-items: start;
    flex-direction: column;
    gap: 11px;
  }

  .admin-shell {
    width: min(100% - 24px, 1240px);
  }

  .admin-topbar {
    min-height: 70px;
  }

  .admin-actions a {
    display: none;
  }

  .admin-layout {
    gap: 14px;
    padding-top: 14px;
  }

  .editor-form {
    padding: 18px 15px 0;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .post-list {
    grid-template-columns: 1fr;
  }

  .editor-footer {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .editor-footer-left {
    justify-content: space-between;
  }

  .save-button {
    width: 100%;
  }
}
