/* xmarks · Vendo design system — editorial shared-border grid, flat teal accent */
:root {
  --teal: #004746;
  --ink: #0D0D0D;
  --muted: rgba(13, 13, 13, 0.60);
  --line: #E5E7EB;
  --pill-line: #D1D5DB;
  --pill-text: #374151;
  --font: "Barlow", -apple-system, "Segoe UI", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: #FFFFFF;
  color: var(--ink);
  font: 15px/1.6 var(--font);
}
.hidden { display: none !important; }

#app {
  max-width: 680px;
  margin: 0 auto;
  padding: 48px 16px 96px;
}

/* ---- Split header: teal wordmark left, muted lede right ---- */
.head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 32px;
}
.head h1 {
  margin: 0;
  font-size: 48px;
  line-height: 58px;
  font-weight: 500;
  letter-spacing: -1.92px;
  color: var(--teal);
}
.lede {
  margin: 0;
  font-size: 18px;
  line-height: 28.8px;
  font-weight: 400;
  color: var(--muted);
  max-width: 420px;
}

/* ---- Search: flat bordered input, sticky ---- */
.searchrow {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #FFFFFF;
  padding: 12px 0;
}
#q {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #FFFFFF;
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s ease;
  appearance: none;
  -webkit-appearance: none;
}
#q::placeholder { color: var(--muted); }
#q:focus { border-color: var(--teal); }

/* ---- Search loading: indeterminate bar under input + dimmed results ---- */
.search-progress {
  position: relative;
  height: 2px;
  margin-top: -2px;
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}
.search-progress i {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40%;
  background: var(--teal);
  animation: search-slide 1s ease-in-out infinite;
}
@keyframes search-slide {
  0% { left: -40%; }
  100% { left: 100%; }
}
#results { transition: opacity 0.2s ease; }
#results.loading {
  opacity: 0.45;
  pointer-events: none;
  transition-delay: 0.15s; /* 快查询几乎不闪一下 */
}

/* ---- Meta line: author filter left, stats right ---- */
.metaline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 24px;
  min-height: 24px;
}
.chip {
  display: inline-block;
  padding: 4px 12px;
  border: 1.5px solid var(--pill-line);
  border-radius: 6px;
  background: #FFFFFF;
  color: var(--pill-text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.chip::after { content: " ✕"; color: var(--muted); }
.stats {
  margin-left: auto;
  font-size: 14px;
  line-height: 16.8px;
  font-weight: 500;
  color: var(--muted);
}

/* ---- Single-column X-style feed: avatar rail left, body indented ---- */
#results {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.card {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 20px;
  background: #FFFFFF;
  border: 1px solid var(--line);
}
.body { display: flex; flex-direction: column; min-width: 0; }

.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--line);
}
.topline {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  margin-bottom: 4px;
}
.name {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.25px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.handle {
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.handle:hover { color: var(--teal); }
.date { font-size: 13px; color: var(--muted); white-space: nowrap; }
.date::before { content: "·"; margin-right: 8px; }

.legs { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.leg {
  padding: 2px 10px;
  border: 1.5px solid var(--pill-line);
  border-radius: 6px;
  background: #FFFFFF;
  color: var(--pill-text);
  font-size: 12px;
  font-weight: 500;
}

.text {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 24px;
  color: var(--ink);
}
.text a { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; transition: color 0.15s ease; }
.text a:hover { color: var(--teal); }
mark { background: rgba(13, 13, 13, 0.08); color: inherit; border-radius: 2px; padding: 0 1px; }

.quoted {
  margin-top: 12px;
  padding: 2px 0 2px 14px;
  border-left: 2px solid var(--line);
  font-size: 14px;
  line-height: 22px;
  color: var(--muted);
}
.quoted b { color: var(--ink); font-weight: 500; }

/* ---- Media below text: one row, columns follow count, height by tier ---- */
.imgs {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
}
.imgs a {
  display: block;
  overflow: hidden;
  border-radius: 8px;
}
.imgs img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease-in-out;
}
.imgs-1 img { height: 280px; }
.imgs-2 img { height: 200px; }
.imgs-3 img, .imgs-4 img { height: 140px; }
.card:hover .imgs img { transform: scale(1.02); }
.vid { position: relative; }
.vid::after {
  content: "▶"; position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; color: #fff; font-size: 28px; text-shadow: 0 1px 6px rgba(0,0,0,.6);
}

/* ---- Footer: expand left, leg pills right; X link lives in the topline ---- */
.card-foot {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.open-x {
  margin-left: auto;
  flex: none;
  font-size: 13px;
  line-height: 16px;
  font-weight: 500;
  letter-spacing: -0.25px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 4px;
  transition: color 0.15s ease;
}
.open-x:hover { color: var(--teal); }

.more { text-align: center; padding: 32px 0 0; }
.more button {
  border: none;
  background: none;
  padding: 0;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.25px;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
  transition: color 0.15s ease;
}
.more button:hover { color: var(--teal); }

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 64px 0;
  color: var(--muted);
}

/* ---- Long-text clamp (仿 X「显示更多」) ---- */
.clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--clamp, 8);
  overflow: hidden;
}
.expand {
  padding: 0;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: 14px;
  line-height: 16px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
  transition: color 0.15s ease;
}
.expand:hover { color: var(--teal); }

/* ---- Lightbox ---- */
.no-scroll { overflow: hidden; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 13, 13, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: lb-fade 0.25s ease;
}
@keyframes lb-fade { from { opacity: 0; } }
.lb-stage { display: flex; }
.lb-stage img,
.lb-stage video {
  max-width: min(1100px, 92vw);
  max-height: 86vh;
  border-radius: 8px;
  object-fit: contain;
}
.lb-close, .lb-prev, .lb-next {
  position: absolute;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover { background: rgba(255, 255, 255, 0.25); }
.lb-close { top: 20px; right: 20px; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); font-size: 28px; padding-bottom: 4px; }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
.lb-count {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  letter-spacing: 0.08em;
}

@media (min-width: 768px) {
  .head {
    flex-direction: row;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 40px;
  }
  .lede { text-align: right; }
  .card { padding: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .imgs img, .open-x, .handle, .text a, .more button, #q { transition: none; }
  .card:hover .imgs img { transform: none; }
  .lightbox { animation: none; }
  .search-progress i { animation: none; width: 100%; left: 0; }
}
