/* ============================================================
   search.css — 高级检索页：检索区 / 分区展示 / 瀑布流 / 模态框 / 分享面板
   ============================================================ */

/* ============ 检索区 ============ */
.search-hero {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 64px 0 48px;
}

.search-hero-inner { max-width: 920px; }

.search-hero .search-label {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-hero .search-label::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--ink-mute);
}

.search-hero h1 {
  font-size: 2.4rem;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin-bottom: 36px;
}

.search-form {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line-strong);
  padding: 10px 2px;
  transition: border-color .2s;
}

.search-field:focus-within { border-bottom-color: var(--ink); }

.search-field svg {
  width: 20px;
  height: 20px;
  stroke: var(--ink-mute);
  fill: none;
  stroke-width: 1.6;
  flex-shrink: 0;
}

.search-field input {
  flex: 1;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 1.15rem;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.search-field input:focus { outline: none; }

.search-field input::placeholder { color: var(--ink-mute); }

.search-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.filter-label {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
  white-space: nowrap;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 0.8rem;
  padding: 6px 14px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background-color .15s;
}

.filter-chip:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.filter-chip.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(26, 43, 60, 0.06);
  font-weight: 500;
}

.search-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 6px;
}

.search-submit {
  background: var(--ink);
  color: #fff;
  border: 1px solid var(--ink);
  height: 44px;
  padding: 0 28px;
  font-family: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}

.search-submit:hover { background: var(--accent); border-color: var(--accent); }

.search-clear {
  background: none;
  border: none;
  color: var(--ink-mute);
  font-family: inherit;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 8px 6px;
  transition: color .15s;
}

.search-clear:hover { color: var(--ink); }

/* ============ 分区展示 ============ */
.partitions-section {
  padding: 56px 0 40px;
  border-bottom: 1px solid var(--line);
}

.partitions-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.partitions-head h2 {
  font-size: 1.1rem;
  font-weight: 550;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.partitions-head p {
  font-size: 0.82rem;
  color: var(--ink-mute);
}

.partitions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.partition-card {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 22px 20px 20px;
  cursor: pointer;
  transition: border-color .2s, transform .2s;
}

.partition-card:hover {
  border-color: var(--ink-mute);
  transform: translateY(-2px);
}

.partition-card:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}

.partition-name {
  font-size: 0.9rem;
  font-weight: 550;
  color: var(--ink);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.partition-count {
  font-size: 0.7rem;
  color: var(--ink-mute);
  font-weight: 400;
}

.partition-meta {
  font-size: 0.72rem;
  color: var(--ink-mute);
  margin-bottom: 14px;
}

.partition-preview {
  font-size: 0.82rem;
  color: var(--ink-soft);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.partition-empty {
  font-size: 0.8rem;
  color: var(--ink-mute);
}

/* ============ 瀑布流 ============ */
.grid {
  padding: 40px 0 32px;
  column-count: 3;
  column-gap: 28px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  margin-bottom: 28px;
  break-inside: avoid;
  display: inline-block;
  width: 100%;
  transition: border-color .2s;
  cursor: pointer;
}

.card:hover { border-color: var(--ink-mute); }

.card:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}

.card-img {
  border-bottom: 1px solid var(--line);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #f0f0ec;
}

.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .5s cubic-bezier(.2,.8,.2,1);
}

.card:hover .card-img img { transform: scale(1.04); }

.card-inner { padding: 30px 28px 26px; }

.card-img + .card-inner { padding-top: 24px; }

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 18px;
}

.card-cat {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.card-num {
  font-size: 0.68rem;
  color: var(--ink-mute);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
}

.card h3 {
  font-size: 1.22rem;
  font-weight: 550;
  line-height: 1.35;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin-bottom: 14px;
}

.card p {
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.7;
  margin-bottom: 24px;
}

.card-summary {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.card-date {
  font-size: 0.72rem;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

.card-read {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--line-strong);
  padding: 8px 16px;
  transition: border-color .15s, background-color .15s, color .15s;
}

.card-read svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  transition: transform .2s;
}

.card-read:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.card-read:hover svg { transform: translateX(3px); }

.list-foot {
  padding: 8px 0 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.load-sentinel {
  width: 100%;
  height: 1px;
}

.load-status {
  font-size: 0.75rem;
  color: var(--ink-mute);
  letter-spacing: 0.1em;
  text-align: center;
  min-height: 1em;
}

.list-status {
  padding: 12px 0 0;
  font-size: 0.78rem;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  display: none;
}

.list-status.show { display: block; }

/* ============ 文章模态框 ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .22s ease, visibility .22s ease;
}

.modal-overlay.open { opacity: 1; visibility: visible; }

.modal {
  background: var(--surface);
  max-width: 720px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  transform: translateY(12px);
  transition: transform .28s cubic-bezier(.2,.8,.2,1);
  display: flex;
  flex-direction: column;
}

.modal-overlay.open .modal { transform: translateY(0); }

.modal-head {
  padding: 28px 36px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
}

.modal-head-text { flex: 1; min-width: 0; }

.modal-cat {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-cat::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
  max-width: 60px;
}

.modal h2 {
  font-size: 1.6rem;
  font-weight: 550;
  line-height: 1.3;
  letter-spacing: -0.018em;
  color: var(--ink);
}

.modal-close {
  background: none;
  border: 1px solid var(--line-strong);
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--ink-soft);
  flex-shrink: 0;
  transition: border-color .15s, color .15s, background-color .15s;
  font-family: inherit;
}

.modal-close:hover {
  border-color: var(--ink);
  color: var(--ink);
  background: #f5f5f2;
}

.modal-close svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
}

.modal-body { padding: 28px 36px 32px; flex: 1; }

.modal-meta {
  display: flex;
  gap: 24px;
  font-size: 0.75rem;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.modal-meta span { display: inline-flex; align-items: center; gap: 6px; }

.modal-content p {
  font-size: 0.94rem;
  color: var(--ink-soft);
  line-height: 1.85;
  margin-bottom: 16px;
}

.modal-content p:last-child { margin-bottom: 0; }

.modal-content h2,
.modal-content h3,
.modal-content h4 {
  color: var(--ink);
  font-weight: 550;
  letter-spacing: -0.015em;
  line-height: 1.35;
}

.modal-content h2 {
  font-size: 1.28rem;
  margin: 32px 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.modal-content h3 { font-size: 1.06rem; margin: 24px 0 10px; }
.modal-content h4 { font-size: 0.95rem; margin: 20px 0 8px; }

.modal-content ul,
.modal-content ol {
  margin: 0 0 16px;
  padding-left: 22px;
  color: var(--ink-soft);
  font-size: 0.94rem;
  line-height: 1.8;
}

.modal-content li { margin-bottom: 6px; }
.modal-content li::marker { color: var(--ink-mute); }

.modal-content blockquote {
  margin: 20px 0;
  padding: 2px 0 2px 18px;
  border-left: 2px solid var(--accent);
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.75;
}

.modal-content hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 28px 0;
}

.modal-content a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--ink-mute);
  word-break: break-all;
}

.modal-content a:hover { border-bottom-color: var(--ink); }

.modal-content strong { font-weight: 600; color: var(--ink); }

.modal-content code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.84em;
  background: #f0f0ec;
  border: 1px solid var(--line);
  color: var(--accent);
  padding: 1px 6px;
  white-space: nowrap;
}

.modal-content .code-wrap {
  margin: 20px 0;
  border: 1px solid var(--line-strong);
  background: #f7f7f4;
}

.modal-content .code-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 7px 12px 7px 14px;
  border-bottom: 1px solid var(--line);
  background: #f0f0ec;
}

.modal-content .code-lang {
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 600;
}

.modal-content .code-copy {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink-mute);
  font-family: inherit;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 10px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}

.modal-content .code-copy:hover { border-color: var(--ink); color: var(--ink); }
.modal-content .code-copy.done { border-color: var(--ink); color: var(--ink); }

.modal-content .code-wrap pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
}

.modal-content .code-wrap code {
  display: block;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--ink);
  background: none;
  border: none;
  padding: 0;
  white-space: pre;
}

.modal-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 4px 0 16px;
  border: 1px solid var(--line);
}

.modal-content .article-figure { margin: 24px 0; }
.modal-content .article-figure img { width: 100%; margin: 0; }

/* 文末「本文配图」图集：图片集中收尾，不错配到具体段落旁 */
.modal-content .article-gallery { margin-top: 24px; }
.modal-content .article-gallery-label {
  margin: 0 0 12px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--ink-mute);
}
.modal-content .article-gallery .article-figure { margin: 20px 0; }

.modal-content .modal-loading,
.modal-content .modal-error {
  font-size: 0.85rem;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
}

.modal-actions {
  display: flex;
  gap: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
  flex-wrap: wrap;
}

.action-btn {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: none;
  padding: 18px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  transition: background-color .15s, color .15s;
}

.action-btn:hover { background: #f5f5f2; color: var(--ink); }

.action-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  flex-shrink: 0;
}

.action-btn.active { color: var(--accent); }
.action-btn.active svg { fill: var(--accent); stroke: var(--accent); }
.action-btn.speaking { color: var(--accent); }

.comments-panel {
  border-top: 1px solid var(--line);
  background: #fafaf8;
  overflow: hidden;
  max-height: 0;
  flex-shrink: 0;
  transition: max-height .3s ease;
}

.comments-panel.open { max-height: 46vh; overflow-y: auto; }

.comments-inner {
  padding: 24px 36px 28px;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.comments-panel .comment-form {
  position: sticky;
  bottom: 0;
  background: #fafaf8;
  margin-top: auto;
}

.comments-title {
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 18px;
  font-weight: 600;
}

.comment-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 14px;
}

.comment-item:last-of-type { border-bottom: none; }

.comment-avatar {
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.comment-body { flex: 1; min-width: 0; }

.comment-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
  font-size: 0.78rem;
}

.comment-name { font-weight: 600; color: var(--ink); }
.comment-time { color: var(--ink-mute); font-size: 0.72rem; }

.comment-text {
  font-size: 0.85rem;
  color: var(--ink-soft);
  line-height: 1.6;
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 6px;
}

.comment-like {
  background: none;
  border: none;
  color: var(--ink-mute);
  font-family: inherit;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 0;
  transition: color .15s;
}

.comment-like:hover { color: var(--ink); }
.comment-like.liked { color: var(--accent); font-weight: 550; }

.comment-report {
  background: none;
  border: none;
  color: var(--ink-mute);
  font-family: inherit;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 0;
  transition: color .15s;
}

.comment-report:hover { color: #c0392b; }
.comment-report:disabled { color: var(--ink-mute); cursor: default; opacity: .75; }

.comments-empty {
  font-size: 0.82rem;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  padding: 8px 0 4px;
}

.comment-form {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.comment-form textarea {
  flex: 1;
  border: 1px solid var(--line-strong);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--ink);
  resize: vertical;
  min-height: 60px;
  background: #fff;
  line-height: 1.5;
}

.comment-form textarea:focus { outline: none; border-color: var(--ink); }

.comment-submit {
  background: var(--ink);
  color: #fff;
  border: none;
  padding: 0 22px;
  font-family: inherit;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color .15s;
  align-self: stretch;
}

.comment-submit:hover { background: var(--accent); }

/* ============ 分享面板 ============ */
.share-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s, visibility .2s;
}

.share-overlay.open { opacity: 1; visibility: visible; }

.share-panel {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  max-width: 440px;
  width: 100%;
  transform: translateY(8px);
  transition: transform .24s cubic-bezier(.2,.8,.2,1);
}

.share-overlay.open .share-panel { transform: translateY(0); }

.share-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}

.share-label {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 600;
}

.share-close {
  background: none;
  border: 1px solid var(--line-strong);
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}

.share-close:hover { border-color: var(--ink); color: var(--ink); }

.share-close svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
}

.share-title {
  padding: 20px 24px 18px;
  font-size: 0.95rem;
  font-weight: 550;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}

.share-actions { display: flex; flex-direction: column; }

.share-action {
  background: none;
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 16px 24px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background-color .15s;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.share-action:last-child { border-bottom: none; }
.share-action:hover { background: #f5f5f2; }

.share-action-label {
  font-size: 0.85rem;
  font-weight: 550;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.share-action-desc {
  font-size: 0.72rem;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
}

/* ============ 响应式 ============ */
@media (max-width: 1080px) {
  .grid { column-count: 2; }
  .partitions-grid { grid-template-columns: repeat(3, 1fr); }
  .search-hero h1 { font-size: 2rem; }
}

@media (max-width: 760px) {
  .search-hero { padding: 44px 0 36px; }
  .search-hero h1 { font-size: 1.7rem; margin-bottom: 26px; }
  .search-field input { font-size: 1rem; }

  .search-filters { flex-direction: column; gap: 16px; }
  .filter-group { align-items: flex-start; flex-direction: column; gap: 10px; }

  .partitions-section { padding: 40px 0 32px; }
  .partitions-grid { grid-template-columns: repeat(2, 1fr); }

  .grid { column-count: 1; padding: 28px 0 24px; }
  .card-inner { padding: 26px 22px 22px; }
  .card h3 { font-size: 1.15rem; }

  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    max-height: 92vh;
    border-left: none;
    border-right: none;
    border-bottom: none;
    transform: translateY(100%);
  }
  .modal-overlay.open .modal { transform: translateY(0); }
  .modal-head { padding: 22px 22px 18px; }
  .modal h2 { font-size: 1.3rem; }
  .modal-body { padding: 22px 22px 26px; }
  .comments-inner { padding: 20px 22px 24px; }

  .action-btn { padding: 16px 8px; font-size: 0.72rem; }
  .action-btn span { display: none; }

  .share-overlay { padding: 0; align-items: flex-end; }
  .share-panel {
    max-width: 100%;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }
}

@media (max-width: 520px) {
  .partitions-grid { grid-template-columns: 1fr; }
}
