/* 现代扁平博客：克制配色、清晰层级 */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

@import url("/static/scroll.css");

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.site-header-inner,
.site-main {
  max-width: 48rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.site-title {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.site-title:hover {
  color: var(--accent);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.site-nav a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--accent);
}

.doc-page {
  padding: 1.25rem 1.5rem;
}

.doc-title {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.doc-md {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
}

.site-main {
  margin: 2rem auto 3rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.search-panel {
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.search-form {
  display: grid;
  gap: 0.75rem 1rem;
  grid-template-columns: auto 1fr;
  align-items: center;
}

.search-form label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

.search-form input {
  font: inherit;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.btn-primary {
  grid-column: 2;
  justify-self: start;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 1.25rem;
  cursor: pointer;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  transition: background 0.15s;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-link {
  grid-column: 2;
  justify-self: start;
  margin-left: 5.5rem;
  font-size: 0.875rem;
  color: var(--accent);
  text-decoration: none;
}

.btn-link:hover {
  text-decoration: underline;
}

.page-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

a.page-card {
  display: block;
  padding: 1.25rem;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

a.page-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

a.page-card:hover .page-card-title {
  color: var(--accent);
}

.page-card-title {
  display: block;
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text);
}

.page-card-summary {
  margin: 0.5rem 0 0.75rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.page-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-muted);
}

.chip.muted {
  background: transparent;
}

.chip.status-draft {
  background: #fef3c7;
  color: #92400e;
}

.chip.status-published {
  background: #dbeafe;
  color: #1e40af;
}

.empty {
  padding: 2rem 1.5rem;
  text-align: center;
}

.muted {
  color: var(--text-muted);
}

code {
  font-size: 0.85em;
  padding: 0.15em 0.4em;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}

.crumb {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.crumb a {
  color: var(--accent);
  text-decoration: none;
}

.crumb a:hover {
  text-decoration: underline;
}

.crumb-id {
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-family: ui-monospace, Consolas, monospace;
}

.page-header {
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.page-header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.page-header-summary {
  margin: 0.5rem 0 0.75rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* 阅读页：全屏 iframe + 悬浮返回 */
html.page-reader,
body.page-reader {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #fff;
}

body.page-reader .page-frame {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

.reader-fab {
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2147483646;
  width: 2.125rem;
  height: 2.125rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  line-height: 1;
  color: rgba(15, 23, 42, 0.72);
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(15, 23, 42, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
  text-decoration: none;
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: background 0.15s, box-shadow 0.15s;
}

.reader-fab:hover {
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 3px 14px rgba(15, 23, 42, 0.12);
}

.reader-fab:active {
  cursor: grabbing;
}

.login-back {
  max-width: 22rem;
  margin: 0 auto 0.75rem;
  font-size: 0.875rem;
}

.login-back a {
  color: var(--accent);
  text-decoration: none;
}

.login-back a:hover {
  text-decoration: underline;
}

.login-panel {
  max-width: 22rem;
  margin: 0 auto;
  padding: 1.5rem;
}

.login-title {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.login-form label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

.login-form input {
  font: inherit;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.login-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.login-form .btn-primary {
  margin-top: 0.25rem;
  width: 100%;
}

.login-error {
  color: #b91c1c;
  font-size: 0.875rem;
}

@media (max-width: 520px) {
  .search-form {
    grid-template-columns: 1fr;
  }

  .search-form label {
    margin-top: 0.25rem;
  }

  .btn-link {
    margin-left: 0;
  }
}