:root {
  color-scheme: light;
  --bg: #f7f3eb;
  --surface: #fffaf2;
  --surface-strong: #ffffff;
  --ink: #1d2428;
  --muted: #697177;
  --line: #ddd2c1;
  --teal: #135d62;
  --teal-dark: #0c3f43;
  --gold: #b98228;
  --rose: #9f4c5f;
  --shadow: 0 18px 50px rgba(29, 36, 40, 0.12);
  font-family:
    Inter, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui,
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

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

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(18px, 4vw, 48px);
  background: rgba(255, 250, 242, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

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

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  background: var(--teal-dark);
  color: #f8df9c;
  font-weight: 800;
  letter-spacing: 0;
}

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

.brand small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.top-nav a {
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--muted);
}

.top-nav a:hover,
.top-nav a:focus-visible {
  background: #efe6d8;
  color: var(--ink);
}

main {
  min-height: calc(100vh - 150px);
}

.hero {
  position: relative;
  min-height: min(640px, calc(100vh - 90px));
  overflow: hidden;
  background: var(--teal-dark);
}

.hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(10, 32, 35, 0.82), rgba(10, 32, 35, 0.38) 52%, rgba(10, 32, 35, 0.12)),
    linear-gradient(0deg, rgba(10, 32, 35, 0.56), transparent 44%);
}

.hero-overlay {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: inherit;
  max-width: 760px;
  flex-direction: column;
  justify-content: center;
  padding: clamp(64px, 10vw, 120px) clamp(22px, 5vw, 72px);
  color: #fffaf2;
}

.hero h1 {
  max-width: 680px;
  margin: 10px 0 18px;
  font-size: clamp(42px, 7vw, 86px);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero p {
  max-width: 660px;
  margin: 0;
  color: rgba(255, 250, 242, 0.86);
  font-size: clamp(16px, 2vw, 20px);
  line-height: 1.8;
}

.hero-actions,
.button-row,
.editor-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-actions {
  margin-top: 30px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.button,
.icon-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  transition:
    transform 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.button {
  padding: 10px 16px;
}

.button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.button.primary {
  background: var(--teal);
  color: #fff;
}

.button.secondary {
  background: rgba(255, 250, 242, 0.16);
  border-color: rgba(255, 250, 242, 0.42);
  color: #fffaf2;
}

.button.danger,
.icon-button.danger {
  background: #fff2ee;
  color: #9c2f1a;
  border-color: #ecc4b7;
}

.button.compact {
  min-height: 34px;
  padding: 7px 12px;
}

.icon-button {
  min-width: 72px;
  padding: 9px 12px;
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.toolbar,
.page-shell,
.admin-shell,
.content-grid {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 16px;
  align-items: end;
  padding: 32px 0 20px;
}

.search-box,
.editor-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input,
select {
  height: 44px;
  padding: 0 12px;
}

textarea {
  padding: 12px;
  line-height: 1.6;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(19, 93, 98, 0.14);
}

.segmented {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.segmented button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  padding: 10px 12px;
  font-weight: 700;
}

.segmented button.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.content-grid {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  padding: 8px 0 52px;
}

.side-panel,
.admin-list-panel,
.editor-panel,
.preview-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.side-panel {
  position: sticky;
  top: 92px;
  align-self: start;
  padding: 20px;
}

.side-panel h2,
.panel-heading h2 {
  margin: 0;
  font-size: 18px;
}

.category-summary {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.category-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.category-row:last-child {
  border-bottom: 0;
}

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

.section-heading h1,
.section-heading h2 {
  margin: 0;
}

.section-heading h1 {
  font-size: clamp(32px, 5vw, 56px);
}

.section-heading h2 {
  font-size: 30px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

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

.article-card {
  display: grid;
  gap: 12px;
  min-height: 210px;
  padding: 20px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 34px rgba(29, 36, 40, 0.08);
}

.article-card:hover {
  border-color: rgba(19, 93, 98, 0.42);
  transform: translateY(-1px);
}

.article-card h3 {
  margin: 0;
  font-size: 22px;
}

.article-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-self: end;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #efe6d8;
  color: #4d5559;
  font-size: 12px;
  font-weight: 700;
}

.article-view,
.page-shell {
  padding: 42px 0 64px;
}

.article-view {
  width: min(860px, calc(100% - 36px));
  margin: 0 auto;
}

.back-link {
  display: inline-flex;
  margin-bottom: 20px;
  color: var(--teal);
  font-weight: 800;
}

.article-content {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(22px, 4vw, 42px);
  box-shadow: var(--shadow);
}

.article-content h1,
.article-content h2,
.article-content h3 {
  margin: 0 0 14px;
  line-height: 1.25;
}

.article-content h1 {
  font-size: clamp(34px, 5vw, 56px);
}

.article-content h2 {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.article-content p,
.article-content li {
  color: #384146;
  line-height: 1.82;
}

.article-content blockquote {
  margin: 24px 0;
  padding: 16px 18px;
  border-left: 4px solid var(--gold);
  background: #fbf0dd;
  color: #4d3f2f;
}

.article-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 18px 0 26px;
}

.timeline-list {
  display: grid;
  gap: 16px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 18px;
  padding: 20px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.timeline-year {
  color: var(--teal);
  font-weight: 900;
}

.admin-shell {
  padding: 34px 0 56px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr) minmax(320px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.admin-list-panel,
.editor-panel,
.preview-panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.admin-list {
  display: grid;
  gap: 8px;
}

.admin-list button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  padding: 11px 12px;
  text-align: left;
}

.admin-list button.active {
  border-color: var(--teal);
  background: #e9f3f1;
}

.admin-list strong,
.admin-list span {
  display: block;
}

.admin-list span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.editor-panel {
  display: grid;
  gap: 14px;
}

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

.content-editor {
  min-height: 360px;
}

.preview-panel {
  position: sticky;
  top: 92px;
}

.preview {
  max-height: calc(100vh - 180px);
  overflow: auto;
}

.preview h1 {
  font-size: 32px;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 24px clamp(18px, 4vw, 48px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.empty-state {
  padding: 28px;
  background: var(--surface-strong);
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1020px) {
  .admin-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .side-panel,
  .preview-panel {
    position: static;
  }

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

@media (max-width: 720px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-nav {
    justify-content: flex-start;
  }

  .hero {
    min-height: 620px;
  }

  .toolbar,
  .form-grid,
  .timeline-item {
    grid-template-columns: 1fr;
  }

  .segmented {
    justify-content: flex-start;
  }

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