/* 博客与 GEO 文章的公开页面（ADR 0025，apps/web/src/cms/views.tsx）。
   颜色、字体全部用 tokens.css 的设计变量，深浅色跟系统；只作用在 .cms-site 里，不影响产品界面。 */

.cms-site {
  --cms-width: 1120px;
  --cms-read: 720px;
  --cms-radius: 14px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.cms-site a {
  color: inherit;
}

.cms-container {
  width: 100%;
  max-width: var(--cms-width);
  margin: 0 auto;
  padding: 0 24px;
  box-sizing: border-box;
}

.cms-skip {
  position: absolute;
  left: 16px;
  top: -48px;
  padding: 8px 12px;
  background: var(--panel);
  border-radius: 8px;
  z-index: 10;
}
.cms-skip:focus {
  top: 12px;
}

/* 页头 */
.cms-header {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.cms-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}
.cms-brand {
  display: inline-flex;
  align-items: center;
}
.cms-brand img {
  height: 25px;
  width: auto;
}
.cms-nav {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 15px;
}
.cms-nav a {
  text-decoration: none;
  color: var(--ink2);
}
.cms-nav a:hover,
.cms-nav a[aria-current='page'] {
  color: var(--ink);
}
.cms-nav a[aria-current='page'] {
  font-weight: 600;
}

.cms-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg) !important;
  font-weight: 600;
  text-decoration: none;
  transition: opacity var(--t-fast);
}
.cms-button:hover {
  opacity: 0.86;
}
.cms-button-small {
  min-height: 36px;
  padding: 0 16px;
  font-size: 14px;
}

.cms-main {
  flex: 1;
  padding: 48px 0 72px;
}

/* 列表页 */
.cms-list-header {
  max-width: var(--cms-read);
  margin-bottom: 40px;
}
.cms-list-header h1,
.cms-article-header h1 {
  font-family: var(--ui-d);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.12;
  margin: 0 0 12px;
}
.cms-list-header h1 {
  font-size: clamp(36px, 5vw, 56px);
}
.cms-list-header p {
  margin: 0;
  font-size: 18px;
  color: var(--ink2);
}

.cms-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}
.cms-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--cms-radius);
  overflow: hidden;
  text-decoration: none;
  transition:
    border-color var(--t-fast),
    box-shadow var(--t-base);
}
.cms-card-link:hover {
  border-color: var(--line2);
  box-shadow: var(--shadow);
}
.cms-card-cover {
  aspect-ratio: 16 / 9;
  background: var(--card);
}
.cms-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cms-card-placeholder {
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 30% 30%, var(--sel-soft), transparent 60%),
    radial-gradient(circle at 75% 70%, var(--agent-soft), transparent 55%), var(--card);
}
.cms-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  flex: 1;
}
.cms-card-title {
  font-family: var(--ui-d);
  font-size: 21px;
  line-height: 1.25;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cms-card-excerpt {
  margin: 0;
  color: var(--ink2);
  font-size: 15px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cms-card-body .cms-meta {
  margin-top: auto;
}

.cms-meta {
  margin: 0;
  font-size: 14px;
  color: var(--ink3);
}

.cms-empty {
  padding: 48px 0;
  color: var(--ink2);
}

.cms-pagination {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-top: 40px;
  font-size: 15px;
  color: var(--ink2);
}
.cms-pagination a:last-child {
  justify-self: end;
}

/* 文章页 */
.cms-article {
  max-width: var(--cms-read);
  margin: 0 auto;
}
.cms-back {
  margin-bottom: 24px;
  font-size: 15px;
}
.cms-back a {
  color: var(--ink2);
  text-decoration: none;
}
.cms-back a:hover {
  color: var(--ink);
}
.cms-article-header h1 {
  font-size: clamp(32px, 4.4vw, 48px);
}
.cms-article-header .cms-meta {
  margin-bottom: 28px;
}
.cms-article-cover {
  margin: 0 0 36px;
  border-radius: var(--cms-radius);
  overflow: hidden;
  background: var(--card);
}
.cms-article-cover img {
  display: block;
  width: 100%;
  height: auto;
}

.cms-body {
  font-size: 18px;
  line-height: 1.75;
  overflow-wrap: break-word;
}
.cms-body > :first-child {
  margin-top: 0;
}
.cms-body h2,
.cms-body h3,
.cms-body h4 {
  font-family: var(--ui-d);
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 2em 0 0.6em;
}
.cms-body h2 {
  font-size: 28px;
}
.cms-body h3 {
  font-size: 22px;
}
.cms-body h4 {
  font-size: 19px;
}
.cms-body p,
.cms-body ul,
.cms-body ol,
.cms-body blockquote,
.cms-body figure,
.cms-body pre,
.cms-body .cms-table-wrap {
  margin: 0 0 1.25em;
}
.cms-body ul,
.cms-body ol {
  padding-left: 1.4em;
}
.cms-body li + li {
  margin-top: 0.35em;
}
.cms-body a {
  color: var(--sel);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}
.cms-body strong {
  font-weight: 650;
}
.cms-body blockquote {
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--line2);
  color: var(--ink2);
}
.cms-body code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--well);
  padding: 0.12em 0.36em;
  border-radius: 6px;
}
.cms-body pre {
  background: var(--well);
  padding: 16px 18px;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 15px;
  line-height: 1.55;
}
.cms-body pre code {
  background: none;
  padding: 0;
}
.cms-body figure img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}
.cms-body figcaption {
  margin-top: 8px;
  font-size: 14px;
  color: var(--ink3);
  text-align: center;
}
.cms-body hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.5em 0;
}
.cms-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.cms-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
  line-height: 1.5;
}
.cms-body th,
.cms-body td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.cms-body th {
  background: var(--card);
  font-weight: 600;
}
.cms-body tr:last-child td {
  border-bottom: 0;
}

/* 产品入口与延伸阅读 */
.cms-cta {
  max-width: var(--cms-read);
  margin: 56px auto 0;
  padding: 32px;
  border-radius: var(--cms-radius);
  background: var(--panel);
  border: 1px solid var(--line);
  text-align: center;
}
.cms-cta h2 {
  font-family: var(--ui-d);
  font-size: 26px;
  margin: 0 0 8px;
}
.cms-cta p {
  margin: 0 auto 20px;
  max-width: 520px;
  color: var(--ink2);
}
.cms-related {
  margin-top: 64px;
}
.cms-related > h2 {
  font-family: var(--ui-d);
  font-size: 24px;
  margin: 0 0 20px;
}

/* 页脚 */
.cms-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0;
  font-size: 14px;
  color: var(--ink3);
}
.cms-footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
}
.cms-footer p {
  margin: 0;
}
.cms-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.cms-footer a {
  color: var(--ink2);
  text-decoration: none;
}
.cms-footer a:hover {
  color: var(--ink);
}

@media (max-width: 640px) {
  .cms-container {
    padding: 0 16px;
  }
  .cms-nav {
    gap: 14px;
    font-size: 14px;
  }
  .cms-nav .cms-button-small {
    display: none;
  }
  .cms-main {
    padding: 32px 0 56px;
  }
  .cms-grid {
    grid-template-columns: 1fr;
  }
  .cms-body {
    font-size: 17px;
  }
  .cms-cta {
    padding: 24px 20px;
  }
}

/* 文章后台（/cms，内部工具） */
.cms-admin .cms-list-header {
  max-width: none;
  margin-bottom: 24px;
}
.cms-admin .cms-list-header h1 {
  font-size: 32px;
}
.cms-admin .cms-list-header p {
  font-size: 15px;
}
.cms-admin-new {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 24px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.cms-admin label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--ink2);
}
.cms-admin input,
.cms-admin select,
.cms-admin textarea {
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line2);
  border-radius: 8px;
  padding: 8px 10px;
}
.cms-admin input[type='file'] {
  border: 0;
  padding: 4px 0;
  background: none;
}
.cms-admin-new input {
  min-width: 320px;
}
.cms-admin-table table {
  font-size: 14px;
}
.cms-admin-table th,
.cms-admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.cms-admin-actions {
  white-space: nowrap;
  display: flex;
  gap: 12px;
}
.cms-admin-actions a {
  color: var(--sel);
}
.cms-admin-fields {
  display: grid;
  gap: 16px;
  max-width: 900px;
}
.cms-admin-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.cms-admin-inline input:first-child {
  flex: 1;
  min-width: 260px;
}
.cms-admin-body {
  font-family: var(--mono) !important;
  font-size: 14px !important;
  line-height: 1.6;
}
.cms-admin-count {
  color: var(--ink3);
  font-size: 12px;
}
.cms-admin-over {
  color: var(--bad);
  font-size: 12px;
  font-weight: 600;
}
.cms-admin-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 24px 0 12px;
}
.cms-admin-buttons button:not(.cms-button) {
  font: inherit;
  font-size: 15px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line2);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}
.cms-admin-buttons button.cms-button {
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}
.cms-admin-buttons button:disabled {
  opacity: 0.5;
  cursor: default;
}
.cms-admin-message {
  font-size: 15px;
}
.cms-admin-issues {
  color: var(--bad);
  font-size: 14px;
}
.cms-admin-preview {
  margin-top: 32px;
  padding: 32px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.cms-admin-preview > h2 {
  font-size: 14px;
  color: var(--ink3);
  margin: 0 0 16px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.cms-admin-preview .cms-article h1 {
  font-family: var(--ui-d);
  font-size: 36px;
  line-height: 1.15;
  margin: 0 0 24px;
}
