/* WikiLeaks-style: light, centered, text-first, minimal chrome */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  line-height: 1.5;
  color: #000;
  background: #fff;
}

.page {
  max-width: 680px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

/* Masthead: wordmark + tagline + nav — like WikiLeaks */
.masthead {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #ccc;
}

.wordmark {
  margin: 0 0 0.25rem;
  line-height: 0;
}

.wordmark a {
  display: inline-block;
  text-decoration: none;
}

.wordmark a:hover {
  opacity: 0.9;
}

.site-logo {
  display: block;
  max-width: 280px;
  width: 100%;
  height: auto;
  margin: 0 auto;
}

.tagline {
  font-size: 0.95rem;
  color: #444;
  margin: 0 0 1rem;
}

.top-links {
  font-size: 0.9rem;
}

.top-links a {
  color: #00f;
  text-decoration: none;
}

.top-links a:hover {
  text-decoration: underline;
}

.top-links a + a::before {
  content: " · ";
  color: #000;
  text-decoration: none;
}

/* Content */
.content {
  font-family: Georgia, "Times New Roman", serif;
}

.intro { margin: 0 0 1rem; color: #333; }
.content h2 { font-size: 1.35rem; margin: 0 0 0.75rem; }

.search-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  padding: 0.5rem 2rem 0.5rem 0.6rem;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid #999;
}

.search-clear {
  position: absolute;
  right: 0.35rem;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
  border: none;
  background: transparent;
  color: #666;
  cursor: pointer;
  border-radius: 0.15rem;
}

.search-clear:hover {
  color: #000;
  background: #eee;
}

.shortcut-hint {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  color: #777;
}

.shortcut-hint kbd {
  font-family: inherit;
  font-size: 0.85em;
  padding: 0.1rem 0.35rem;
  background: #f0f0f0;
  border: 1px solid #ccc;
  border-radius: 0.15rem;
}

.recent-searches {
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.recent-searches-label { color: #555; margin-right: 0.35rem; }
.recent-searches .recent-chip {
  padding: 0.2rem 0.5rem;
  margin-right: 0.35rem;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
  border: 1px solid #999;
  background: #fff;
  color: #00f;
  cursor: pointer;
  font-family: inherit;
  display: inline-block;
}

.recent-searches .recent-chip:hover { background: #f5f5f5; text-decoration: underline; }

.search-input:focus {
  outline: 1px solid #00f;
  outline-offset: 0;
}

.search-btn {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid #999;
  background: #f0f0f0;
  color: #000;
  cursor: pointer;
}

.search-btn:hover {
  background: #e0e0e0;
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.filters-row label { color: #555; }
.filters-row select,
.filters-row input[type="date"] {
  padding: 0.25rem 0.4rem;
  font-size: 0.9rem;
  border: 1px solid #999;
  font-family: inherit;
}

.loading {
  color: #666;
  margin-bottom: 0.5rem;
}

.error-box {
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  border: 1px solid #c00;
  background: #fff5f5;
}

.error-msg { margin: 0 0 0.5rem; color: #c00; }
.btn-retry {
  padding: 0.35rem 0.75rem;
  font-size: 0.9rem;
  border: 1px solid #999;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
}

.did-you-mean { margin-bottom: 0.5rem; font-size: 0.95rem; }
.did-you-mean a { color: #00f; }

.results-stats {
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 0.5rem;
}

.export-row { margin-bottom: 0.5rem; }
.btn-export {
  padding: 0.3rem 0.6rem;
  margin-right: 0.5rem;
  font-size: 0.85rem;
  border: 1px solid #999;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
}

.btn-export:hover { background: #f0f0f0; }

/* Suggested chips */
.suggested { margin-bottom: 0.75rem; font-size: 0.9rem; }
.suggested-label { color: #555; margin-right: 0.35rem; }
.suggested-chip {
  padding: 0.2rem 0.5rem;
  margin-right: 0.35rem;
  font-size: 0.9rem;
  border: 1px solid #999;
  background: #fff;
  color: #00f;
  cursor: pointer;
  font-family: inherit;
}

.suggested-chip:hover { background: #f5f5f5; text-decoration: underline; }

/* Results: simple list like WikiLeaks Featured */
.results-section { margin-top: 1rem; }
.results-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.results-list .result-card {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.6rem 0;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}

.results-list .result-card:hover {
  background: #fafafa;
}

.results-list .result-thumb {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  overflow: hidden;
  background: #eee;
  border: 1px solid #ddd;
}

.results-list .result-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.results-list .result-card-body { flex: 1; min-width: 0; }

.results-list .result-card h3 { margin: 0; font-size: 1rem; font-weight: bold; }
.results-list .result-card h3 a {
  color: #00f;
  text-decoration: none;
}

.results-list .result-card h3 a:hover {
  text-decoration: underline;
}

.result-meta {
  font-size: 0.85rem;
  color: #666;
  margin-top: 0.15rem;
}

.result-snippet {
  font-size: 0.9rem;
  color: #333;
  margin-top: 0.2rem;
  line-height: 1.4;
}

.result-snippet em { font-style: normal; background: #ff0; }
.result-type { margin-right: 0.35rem; }

/* Skeleton */
.result-card--skeleton .result-thumb.skeleton-pulse,
.skeleton-pulse {
  background: linear-gradient(90deg, #eee 25%, #e5e5e5 50%, #eee 75%);
  background-size: 200% 100%;
  animation: skeleton 1s ease-in-out infinite;
}

.result-card--skeleton .skeleton-title,
.result-card--skeleton .skeleton-meta,
.result-card--skeleton .skeleton-snippet {
  height: 1em;
  background: #eee;
  margin-bottom: 0.4rem;
}

@keyframes skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.pagination { margin-top: 1rem; font-size: 0.9rem; }
.pagination-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.pagination button {
  padding: 0.4rem 0.75rem;
  border: 1px solid #999;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
}

.pagination button:hover:not(:disabled) { background: #f0f0f0; }
.pagination button:disabled { opacity: 0.5; cursor: default; }
.pagination-info { color: #555; }
.load-more-btn {
  margin-left: 0.5rem;
  padding: 0.4rem 1rem;
  font-weight: bold;
}
.load-more-btn:disabled { cursor: wait; }

.tips {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
  font-size: 0.9rem;
  color: #555;
}

.tips code { background: #f0f0f0; padding: 0.1rem 0.3rem; }
.tips a { color: #00f; }

/* More resources */
.more-resources {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
  font-size: 0.9rem;
  color: #555;
}
.more-resources-title { font-size: 1.05rem; margin: 0 0 0.5rem; font-weight: bold; }
.more-resources-list { margin: 0; padding-left: 1.25rem; }
.more-resources-list li { margin-bottom: 0.35rem; }
.more-resources-list a { color: #00f; text-decoration: none; }
.more-resources-list a:hover { text-decoration: underline; }

/* OpenClaw quick start */
.openclaw-quickstart {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
  font-size: 0.9rem;
  color: #555;
}

.openclaw-quickstart-title {
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
  font-weight: bold;
}

.openclaw-quickstart-title a { color: #00f; text-decoration: none; }
.openclaw-quickstart-title a:hover { text-decoration: underline; }
.openclaw-quickstart-desc { margin: 0 0 0.5rem; }
.openclaw-quickstart-install { margin: 0.5rem 0 0.25rem; }
.openclaw-quickstart-code {
  margin: 0;
  padding: 0.6rem 0.75rem;
  background: #f5f5f5;
  border: 1px solid #ddd;
  font-size: 0.85rem;
  overflow-x: auto;
}

.openclaw-quickstart-code code { background: none; padding: 0; }
.openclaw-quickstart-more { margin: 0.5rem 0 0; }
.openclaw-quickstart-more a { color: #00f; text-decoration: none; }
.openclaw-quickstart-more a:hover { text-decoration: underline; }

.footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #ccc;
  text-align: center;
  font-size: 0.9rem;
  color: #555;
}

.footer a { color: #00f; text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.footer-meta { margin-top: 0.35rem; font-size: 0.8rem; }

/* Document panel */
.doc-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(520px, 100vw);
  height: 100vh;
  background: #fff;
  border-left: 1px solid #ccc;
  box-shadow: -2px 0 8px rgba(0,0,0,0.1);
  overflow: auto;
  z-index: 100;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.2s ease, visibility 0.2s ease;
}

.doc-panel.panel-visible {
  transform: translateX(0);
  visibility: visible;
}

@media (prefers-reduced-motion: reduce) {
  .doc-panel { transition: none; }
  .doc-panel.panel-visible { transform: none; }
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #eee;
}

.panel-doc-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-right: auto;
  font-size: 0.9rem;
}

.panel-doc-nav button {
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
  border: 1px solid #999;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
}

.panel-doc-nav button:hover:not(:disabled) { background: #f0f0f0; }
.panel-doc-nav button:disabled { opacity: 0.5; cursor: default; }
.panel-doc-position { color: #555; min-width: 4em; }

.panel-close, .panel-share {
  padding: 0.3rem 0.6rem;
  font-size: 0.9rem;
  border: 1px solid #999;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
}

.panel-close:hover, .panel-share:hover { background: #f0f0f0; }

.panel-body {
  padding: 1rem 1.25rem;
  font-family: Georgia, "Times New Roman", serif;
}

.panel-body h2 {
  font-size: 1.35rem;
  margin: 0 0 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid #eee;
}

.panel-meta { font-size: 0.9rem; color: #666; margin-bottom: 1rem; }
.panel-meta a { color: #00f; }
.panel-media { margin-bottom: 1rem; }
.panel-media img { max-width: 100%; height: auto; border: 1px solid #ddd; }
.panel-media video, .panel-media audio { max-width: 100%; display: block; margin-bottom: 0.5rem; }
.panel-body .panel-body { font-size: 0.95rem; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.panel-search-highlight { background: #ff9; padding: 0 0.1em; border-radius: 0.1em; }
.panel-search-highlight--current { background: #f90; font-weight: bold; }
#first-search-match { scroll-margin-top: 1rem; scroll-margin-bottom: 1rem; }
.panel-find-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid #eee;
  font-size: 0.9rem;
}
.panel-find-bar button {
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
  border: 1px solid #999;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
}
.panel-find-bar button:hover { background: #f0f0f0; }
.panel-find-bar #panelFindInfo { color: #555; min-width: 4em; }
.panel-loading { color: #666; margin: 0; }

/* Back to top — fixed corner, appears on scroll */
.back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 2.75rem;
  height: 2.75rem;
  min-height: 44px;
  min-width: 44px;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
  border: 1px solid #999;
  background: #fff;
  color: #000;
  cursor: pointer;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: opacity 0.2s, transform 0.2s;
}

.back-to-top:hover {
  background: #f0f0f0;
  transform: translateY(-2px);
}

.back-to-top:focus {
  outline: 2px solid #00f;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .back-to-top { transition: none; }
  .back-to-top:hover { transform: none; }
}

/* Result cards: content-visibility for long lists; staggered fade-in */
.results-list .result-card {
  content-visibility: auto;
  contain-intrinsic-size: 0 72px;
}

.results-list .result-card.result-card--animate {
  animation: resultFadeIn 0.25s ease-out forwards;
}

@keyframes resultFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .results-list .result-card.result-card--animate { animation: none; }
}

/* Min height for results area to reduce layout shift while loading */
.results-section {
  min-height: 120px;
}

/* Document panel: GPU-friendly slide */
.doc-panel {
  will-change: transform;
}

.doc-panel.panel-visible {
  will-change: auto;
}

/* Searching indicator pulse */
.loading--searching {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.loading-dots::after {
  content: "";
  animation: loadingDots 1s steps(4, end) infinite;
}

@keyframes loadingDots {
  0%, 100% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
}

@media (max-width: 640px) {
  .wordmark { font-size: 1.75rem; }
  .doc-panel { width: 100vw; }
}
