:root {
  color-scheme: light;
  --bg: #f4f4f1;
  --paper: #fbfaf6;
  --panel: rgba(255, 255, 252, 0.9);
  --text: #191918;
  --muted: #686862;
  --soft: #8b8b84;
  --line: rgba(25, 25, 24, 0.16);
  --ink: #111111;
  --wash: #d9d9d2;
  --seal: #a83224;
  --shadow: 0 24px 70px rgba(18, 18, 16, 0.12);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151514;
  --paper: #20201e;
  --panel: rgba(33, 33, 30, 0.92);
  --text: #f3f1e8;
  --muted: #b0aea4;
  --soft: #8d8b84;
  --line: rgba(243, 241, 232, 0.16);
  --ink: #f3f1e8;
  --wash: #33332f;
  --seal: #d85c48;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 20% 10%, rgba(0, 0, 0, 0.06), transparent 28%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.025) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 42px 42px, auto;
  color: var(--text);
  font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0)),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.025) 0 1px, transparent 1px 7px);
  opacity: 0.55;
  mix-blend-mode: multiply;
}

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

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

button,
.text-link,
.chips a,
.import-label {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel);
  color: var(--text);
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

button:hover,
.text-link:hover,
.chips a:hover,
.import-label:hover {
  border-color: var(--seal);
  color: var(--seal);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 72px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 24px;
  align-items: center;
  padding: 0 clamp(18px, 5vw, 64px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(16px);
}

.brand {
  font-family: "KaiTi", "STKaiti", "Noto Serif SC", serif;
  font-size: 24px;
  font-weight: 700;
}

.brand span {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand span::before {
  content: "";
  width: 22px;
  height: 22px;
  background: var(--seal);
  clip-path: polygon(8% 7%, 92% 4%, 96% 86%, 14% 94%);
}

nav {
  display: flex;
  gap: 20px;
  align-items: center;
  color: var(--muted);
  font-size: 15px;
}

nav a:hover,
.admin-link {
  color: var(--text);
}

.icon-button {
  width: 42px;
  padding: 0;
}

.hero {
  padding: 22px 0 0;
  background: transparent;
}

.hero-frame {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 18px;
  align-items: start;
}

.hero-visual {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 92%, var(--bg));
  padding: 18px;
}

.hero-visual img {
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: contain;
  display: block;
  filter: saturate(0.92) contrast(1.05);
}

:root[data-theme="dark"] .hero {
  background: transparent;
}

:root[data-theme="dark"] .hero-visual {
  background: color-mix(in srgb, var(--paper) 86%, var(--bg));
}

.hero-copy {
  display: grid;
  align-content: space-between;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  color: var(--text);
}

.hero-copy::before {
  content: "";
  width: 44px;
  height: 44px;
  display: grid;
  background: var(--seal);
}

.hero-copy h1 {
  width: auto;
  margin: 0;
  font-family: "KaiTi", "STKaiti", "Noto Serif SC", serif;
  font-size: clamp(50px, 7vw, 92px);
  line-height: 1;
  letter-spacing: 0;
}

.hero-copy p,
.eyebrow,
.meta {
  color: var(--muted);
  font-size: 14px;
}

.hero-note {
  max-width: 30rem;
  line-height: 1.85;
}

.search {
  display: flex;
  width: min(480px, 100%);
  gap: 8px;
}

.search input,
input,
textarea,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel);
  color: var(--text);
  padding: 10px 12px;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.section,
.post-grid,
.article-shell,
.about {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
}

.section {
  padding: 76px 0;
}

.intro {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: end;
  border-bottom: 1px solid var(--line);
  padding-top: 14px;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

.intro h2,
.page-heading h1,
.about h1,
.article h1,
.admin h1 {
  margin: 8px 0 12px;
  font-family: "KaiTi", "STKaiti", "Noto Serif SC", serif;
  font-size: clamp(34px, 5vw, 60px);
  line-height: 1.08;
  letter-spacing: 0;
}

.intro p,
.about p,
.lead {
  color: var(--muted);
  line-height: 1.9;
}

.post-grid {
  padding: 38px 0 80px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.post-card {
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.post-card img {
  width: 100%;
  aspect-ratio: 1.16;
  object-fit: cover;
  display: block;
  filter: grayscale(0.85) contrast(1.08);
}

.post-card-body {
  padding: 18px;
}

.post-card h3 {
  min-height: 0;
  margin: 8px 0;
  font-family: "KaiTi", "STKaiti", serif;
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: 0;
}

.post-card p {
  color: var(--muted);
  line-height: 1.75;
}

.post-link {
  display: inline-flex;
  margin-top: 10px;
  color: var(--seal);
  font-size: 13px;
}

.tags,
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tags span,
.timeline em {
  min-height: 28px;
  border: 1px solid color-mix(in srgb, var(--seal) 30%, transparent);
  border-radius: 2px;
  padding: 3px 10px;
  color: var(--seal);
  font-size: 13px;
  font-style: normal;
}

.chips {
  margin-bottom: 28px;
}

.chips .active {
  background: var(--ink);
  color: var(--paper);
}

.timeline {
  border-top: 1px solid var(--line);
}

.timeline a {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 18px;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.timeline time {
  color: var(--muted);
}

.article-cover {
  width: 100%;
  max-height: 520px;
  object-fit: cover;
  display: block;
  filter: grayscale(0.75) contrast(1.08);
}

.article-shell {
  max-width: 820px;
  padding: 58px 0 84px;
}

.article-body {
  margin-top: 34px;
  font-size: 18px;
  line-height: 2;
}

.article-body p::first-letter {
  color: var(--seal);
  font-size: 1.35em;
}

.content-image {
  margin: 28px 0;
}

.content-image img {
  width: 100%;
  max-height: 760px;
  object-fit: contain;
  display: block;
  border: 1px solid var(--line);
  background: var(--paper);
}

.about {
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: 1fr 0.9fr;
  gap: 48px;
  align-items: center;
  padding: 64px 0;
}

.about img {
  width: 100%;
  aspect-ratio: 0.95;
  object-fit: cover;
  border-radius: 4px;
  filter: grayscale(0.75) contrast(1.08);
}

footer {
  display: flex;
  justify-content: space-between;
  padding: 34px clamp(18px, 5vw, 64px);
  border-top: 1px solid var(--line);
  color: var(--muted);
}

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

.admin-login form {
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.admin {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
}

.admin-side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: var(--paper);
}

.admin-side .brand {
  margin-bottom: 18px;
}

.admin-side button,
.import-label {
  justify-content: flex-start;
  width: 100%;
}

.admin-side .active {
  background: var(--ink);
  color: var(--paper);
}

.admin-main {
  padding: 32px;
}

.hidden {
  display: none !important;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stats div {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 20px;
}

.stats strong {
  display: block;
  font-size: 38px;
  font-family: "KaiTi", "STKaiti", serif;
}

.stats span {
  color: var(--muted);
}

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

.editor-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
}

.post-list {
  display: grid;
  gap: 8px;
  align-content: start;
}

.post-list button {
  min-height: 64px;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
}

.post-list em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.editor,
.settings {
  display: grid;
  gap: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 18px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.upload-control {
  border: 1px dashed var(--line);
  background: color-mix(in srgb, var(--paper) 72%, transparent);
  padding: 12px;
}

.upload-control input {
  min-height: auto;
  padding: 8px;
  cursor: pointer;
}

.image-preview {
  width: min(320px, 100%);
  aspect-ratio: 1.6;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 4px;
  filter: grayscale(0.65) contrast(1.05);
}

.content-image-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.content-image-list figure {
  margin: 0;
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 8px;
}

.content-image-list img {
  width: 100%;
  aspect-ratio: 1.2;
  object-fit: cover;
  display: block;
}

.content-image-list button {
  min-height: 34px;
  padding: 0 10px;
}

.image-empty {
  margin: 0;
  color: var(--muted);
}

.content-image-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.content-image-list figure {
  margin: 0;
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 8px;
}

.content-image-list img {
  width: 100%;
  aspect-ratio: 1.2;
  object-fit: cover;
  display: block;
}

.content-image-list button {
  min-height: 34px;
  font-size: 13px;
}

.image-empty {
  margin: 0;
  color: var(--muted);
}

.content-input {
  min-height: 240px;
}

.editor-actions {
  display: flex;
  gap: 10px;
}

@media (max-width: 820px) {
  .topbar {
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  nav {
    grid-column: 1 / -1;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .hero {
    padding-top: 14px;
  }

  .hero-visual img {
    max-height: none;
  }

  .intro,
  .about,
  .admin,
  .editor-layout,
  .hero-frame,
  .timeline a {
    grid-template-columns: 1fr;
  }

  .post-grid,
  .stats,
  .content-image-list {
    grid-template-columns: 1fr;
  }

  .timeline a {
    gap: 6px;
  }

  .admin-side {
    position: static;
    height: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-side .brand {
    grid-column: 1 / -1;
  }

  .admin-main {
    padding: 18px;
  }

  .two-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .search {
    flex-direction: column;
  }

  .hero-copy h1 {
    font-size: 58px;
  }

  .panel-head,
  footer {
    align-items: flex-start;
    flex-direction: column;
  }
}
