/* 地图广场页样式（spec 20260804-plaza-ui-restructure T-PZ-02）。

 自 templates/site/plaza.html 的内联 <style> 原样抽出，对齐 site 模块既有约定
 （landing.css / help.css）。本文件同时承载列表页与站内查看层（.mv-*）的样式；
 查看层的 DOM 与 JS 仍内联在模板里——tests/app/test_plaza_viewer.py:148-164
 直接读模板源码做字符串断言，抽走即红。 */

* { box-sizing: border-box; margin: 0; padding: 0; }

/* 壳层（design.md D-1，2026-08-04 裁定）：顶导与正文共用同一个 shell——
   同宽、同内边距，两者左右边界逐像素对齐。此前顶栏全宽、正文 1120，
   1920 屏上错开 284px 且屏幕越宽错得越多，读起来像两个系统拼在一起。
   变量必须挂在 body：.dtb-nav 是 <main> 的兄弟节点，挂在 .plaza-shell 上够不着。 */
body.plaza-page {
  --shell-max: 1760px;
  --gutter: clamp(20px, 3.25vw, 56px);
  --nav-shell-max: var(--shell-max);
  --nav-shell-pad: var(--gutter);
}
.plaza-shell {
  width: min(100%, var(--shell-max));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--layout-bg);
  line-height: 1.75;
}
a { text-decoration: none; color: inherit; }
main.plaza { padding-block: var(--space-5) 72px; }
main.plaza h1 { font-size: var(--fs-h1); font-weight: 600; }
main.plaza p.lede { margin-top: 6px; color: var(--muted); font-size: var(--fs-body-sm); }
.plaza-head { margin-bottom: var(--space-4); }
.plaza-head h1 {
  display: flex; align-items: baseline; gap: var(--space-3); flex-wrap: wrap;
}
.plaza-head h1 .count {
  font-size: var(--fs-body-sm); font-weight: 400; color: var(--muted);
}
.plaza-tools {
  padding-block: var(--space-3);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

/* 工具行：搜索 + 排序同排，全部收敛到 --control-h 32px。
   此前搜索框 720px 宽、52px 高、16px 圆角外加一层投影，是全页最重的元素，
   而它下面的筛选控件只有 38px 高——两级控件不在一个尺寸体系里（诊断 §5.2）。 */
.plaza-toolbar {
  display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap;
}
.plaza-search { position: relative; flex: 0 1 320px; min-width: 200px; }
.plaza-search input[type="search"] {
  width: 100%; height: var(--control-h);
  padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: var(--fs-body); outline: 0;
}
.plaza-search input[type="search"]::placeholder { color: var(--ink-disabled); }
.plaza-search input[type="search"]:focus {
  border-color: var(--brand); box-shadow: var(--focus-ring);
}
.plaza-search-go {
  flex: none; height: var(--control-h); padding: 0 16px;
  border: 1px solid var(--brand); border-radius: var(--radius-sm);
  background: var(--brand); color: #fff;
  font: inherit; font-size: var(--fs-body); font-weight: 500; cursor: pointer;
}
.plaza-search-go:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.plaza-sort {
  margin-left: auto; display: inline-flex; align-items: center; gap: var(--space-2); flex: none;
}
.plaza-sort .lbl { font-size: var(--fs-body-sm); color: var(--muted); }
.plaza-sort select {
  height: var(--control-h); padding: 0 28px 0 11px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: var(--fs-body); cursor: pointer;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(0, 0, 0, .45) 50%),
    linear-gradient(135deg, rgba(0, 0, 0, .45) 50%, transparent 50%);
  background-size: 5px 5px, 5px 5px;
  background-position: right 13px center, right 9px center;
  background-repeat: no-repeat;
}
.plaza-sort select:focus { border-color: var(--brand); box-shadow: var(--focus-ring); outline: 0; }

/* 时间范围：一个条件一个控件，恰好一个 .is-active */
.plaza-filter-row {
  margin-top: 10px;
  display: flex; align-items: center; gap: var(--space-2);
}
.plaza-filter-label { flex: none; font-size: var(--fs-body-sm); color: var(--muted); }
/* 浮层锚点放在滚动容器之外，否则被 .plaza-chips 的 overflow-x 裁掉 */
.plaza-daterange {
  position: relative; display: flex; align-items: center; gap: var(--space-2);
  min-width: 0; flex: 1 1 auto;
}
.plaza-chips {
  display: flex; align-items: center; gap: var(--space-2);
  min-width: 0; overflow-x: auto; scrollbar-width: none;
}
.plaza-chips::-webkit-scrollbar { display: none; }
.plaza-chip {
  flex: none;
  display: inline-flex; align-items: center; gap: 5px;
  height: var(--control-h-sm); padding: 0 13px;
  border: 1px solid var(--line); border-radius: var(--radius-pill);
  background: var(--surface); color: var(--ink-secondary);
  font-size: var(--fs-body-sm); white-space: nowrap;
}
.plaza-chip:hover { border-color: var(--border); color: var(--ink); }
.plaza-chip.is-active {
  background: var(--brand-soft); border-color: var(--brand-line);
  color: var(--brand-heavy); font-weight: 600;
}
.plaza-chip .caret { font-size: 9px; color: var(--muted); }
.plaza-chip.is-active .caret { color: var(--brand-heavy); }
.plaza-custom { position: static; }
summary.plaza-chip { list-style: none; cursor: pointer; user-select: none; }
summary.plaza-chip::-webkit-details-marker { display: none; }
.plaza-date-panel {
  position: absolute; z-index: calc(var(--z-topbar) - 1); top: calc(100% + 8px); left: 0;
  width: 420px; max-width: calc(100vw - 48px);
  padding: var(--space-4);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-pop);
}
.plaza-date-fields {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: end;
}
.plaza-date-fields label {
  display: grid; gap: 5px;
  color: var(--muted); font-size: var(--fs-caption); font-weight: 500;
}
.plaza-date-fields .to {
  padding-bottom: 8px; color: var(--ink-disabled); font-size: var(--fs-body-sm);
}
.plaza-date-fields input {
  width: 100%; min-width: 0; height: var(--control-h); padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: inherit; font-size: var(--fs-body);
}
.plaza-date-actions {
  margin-top: var(--space-3);
  display: flex; align-items: center; justify-content: flex-end; gap: var(--space-3);
  font-size: var(--fs-body-sm);
}
.plaza-date-actions a { color: var(--ink-secondary); }
.plaza-date-actions button {
  height: var(--control-h); padding: 0 16px;
  border: 1px solid var(--brand); border-radius: var(--radius-sm);
  background: var(--brand); color: #fff;
  font: inherit; font-weight: 500; cursor: pointer;
}
.plaza-results {
  margin-top: 18px;
  display: flex; align-items: center; gap: 12px;
  color: var(--ink-secondary); font-size: 13px;
}
.plaza-results a { color: var(--brand-dark); font-weight: 600; }
/* 网格：列数按断点显式声明。此前 repeat(auto-fill, minmax(250px,1fr)) 让列数由
   容器宽被动推导，无法表达"大屏五列、桌面四列、平板两列、移动单列"（诊断 §6.1）。
   1600 是密度阈值不是布局断点——只决定一行摆几张、不改变页面结构，
   因此不与 SSOT 的 768/992/1200/1440 四档冲突。宽壳下 4 列会撑到 400px 卡片过大，
   5 列落在 286~317px，正好是地图缩略图上的标注还能看清的下限。 */
.plaza-grid {
  margin-top: var(--space-4);
  display: grid; gap: var(--space-4);
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
@media (max-width: 1599.98px) { .plaza-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1199.98px) { .plaza-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width:  991.98px) { .plaza-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width:  767.98px) { .plaza-grid { grid-template-columns: 1fr; } }

.plaza-card {
  position: relative; display: block;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
/* hover 只做中性变化（tokens.css §5：品牌色只出现在主按钮与选中态）。
   原先 hover 是 border-color:#ffd591 orange-3，而默认态描边又是自建的暖米 #f0e8dd，
   两态区分度接近零——用户会误读成"当前选中项/推荐作品"（诊断 §1）。 */
.plaza-card:hover { border-color: var(--border); box-shadow: var(--shadow-card-hover); }
.plaza-card:focus-visible {
  outline: 0; border-color: var(--brand); box-shadow: var(--focus-ring);
}
/* 封面：改的是底色，不是裁切方式。

   "卡片发橙"的成因是容器底色用了 --brand-soft(#fff7e6)：封面出图实际 750×600(5:4)
   而容器写 4/3，比例差 6.2%，两侧各漏约 9px 橙边，地图内容越浅漏得越明显——
   这才是"第二张卡看着像被选中"的真相（诊断 §3）。底色换中性即消解。

   object-fit 保持 contain：tests/contracts/test_public_map_presentation.py
   ::test_plaza_cover_preserves_non_four_three_map_extent 用它守"不裁切地图范围"。
   改 cover 会把现存 5:4 封面上下各裁 11%——用户可能正是为了框住城市边缘才那样出图的，
   这是破坏性的，不能顺手改掉别的 spec 记下的决定。

   容器取 16:10 与出图侧的目标比例一致（decisions D-4）。在出图仍是 5:4 期间，
   两侧会有约 11% 的中性留白；等 COVER_* 改成 960×600 后留白自然归零，CSS 无需再动。 */
.plaza-card img.cover {
  display: block; width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
}
.plaza-card .body { padding: 10px 12px 12px; }
.plaza-card .title {
  font-size: var(--fs-body); font-weight: 600; line-height: 1.45;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* 作者独占一行：作者是内容可信度来源，与统计数字不同层。
   浏览量与更新时间都是弱信息，合并到 .stats 一行——此前浏览量被
   margin-left:auto 顶到最右，与作者相隔上百像素，更新时间又独占第三行。 */
.plaza-card .author {
  margin-top: 7px; min-width: 0;
  display: flex; align-items: center; gap: 6px;
  font-size: var(--fs-caption); color: var(--ink-secondary);
}
.plaza-card .author .ava {
  flex: none; width: 18px; height: 18px; border-radius: 50%;
  object-fit: cover; background: var(--surface-soft);
  border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--muted);
}
.plaza-card .author .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plaza-card .stats {
  margin-top: 4px;
  font-size: var(--fs-caption); color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* 运营精选区（D1 FR-4.3）：第 1 页顶部，与主列表同卡片组件 + 角标 */
.plaza-featured { margin-top: var(--space-6); }
.plaza-featured h2.sec {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: var(--fs-h2); font-weight: 600;
}
.plaza-featured h2.sec .flag {
  font-size: var(--fs-caption); font-weight: 500; color: var(--brand-heavy);
  background: var(--brand-soft); border: 1px solid var(--brand-line);
  padding: 1px 8px; border-radius: var(--radius-pill);
}
.plaza-featured .plaza-grid { margin-top: var(--space-3); }
/* 卡片上唯一允许出现品牌橙的位置：推荐是「标签」，不是「容器颜色」 */
.plaza-card .badge-featured {
  position: absolute; top: var(--space-2); left: var(--space-2); z-index: 1;
  font-size: 11px; font-weight: 600; line-height: 18px; color: #fff;
  background: var(--brand);
  padding: 0 9px; border-radius: var(--radius-pill);
}
.plaza-list-title {
  margin-top: var(--space-6);
  display: flex; align-items: center; gap: var(--space-2);
  font-size: var(--fs-h2); font-weight: 600;
}
.plaza-list-title .why {
  margin-left: auto; font-size: var(--fs-caption); font-weight: 400; color: var(--muted);
}
.plaza-empty {
  margin-top: 60px; text-align: center; color: var(--ink-secondary); font-size: 16px;
}
.pager {
  margin-top: 40px; display: flex; justify-content: center; gap: 10px;
  font-size: 14px;
}
.pager a, .pager span {
  padding: 8px 18px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink-secondary);
}
.pager a:hover { color: var(--brand); border-color: var(--brand-line); }
.pager .current { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
footer.site {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding-block: 20px;
}
footer.site .footer-inner {
  display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: center;
  font-size: var(--fs-body-sm); color: var(--ink-secondary);
}
footer.site a { color: var(--ink-secondary); }
footer.site a:hover { color: var(--brand); }
/* 断点归位到 SSOT 四档（04_布局与页面范式.md §5）；原值 680 不在允许集内，
   680–768 那段既不吃桌面布局也不吃移动布局，是一段没人管的区间。 */
@media (max-width: 767.98px) {
  main.plaza { padding-block: var(--space-4) 56px; }
  .plaza-search { flex: 1 1 100%; }
  .plaza-sort { margin-left: 0; }
  .plaza-filter-row { align-items: flex-start; }
  .plaza-filter-label { padding-top: 5px; }
  /* 窄屏浮层改静态流内展开，避免 420px 宽的绝对定位面板溢出视口 */
  .plaza-daterange { flex-wrap: wrap; }
  .plaza-date-panel {
    position: static; width: 100%; max-width: none; margin-top: 8px;
  }
  .plaza-date-fields { grid-template-columns: 1fr; }
  .plaza-date-fields .to { display: none; }
}

/* ---- 站内查看层（spec 20260720-plaza-inpage-viewer FR-1，rev2 页级样式） ----
   整页占满视口：无边距/圆角/暗色遮罩，观感是"切到详情页"而非弹出浮窗；
   返回语义不变（返回按钮 / Esc / 浏览器后退，列表状态原样保留）。 */
body.mv-lock { overflow: hidden; }
.mv {
  position: fixed; inset: 0; z-index: var(--z-modal, 80); display: none;
  background: var(--surface);
}
.mv.open { display: block; }
.mv-win {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  animation: mv-in .16s ease-out;
}
@keyframes mv-in {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .mv-win { animation: none; }
}
.mv button { font: inherit; cursor: pointer; }
.mv-top {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.mv-back {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 14px; font-weight: 600; color: var(--ink-secondary);
}
.mv-back:hover {
  color: var(--brand-dark); border-color: var(--brand-line); background: var(--brand-soft);
}
.mv-back .arr { font-size: 16px; line-height: 1; }
.mv-icobtn {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 16px; color: var(--ink-secondary);
  display: inline-flex; align-items: center; justify-content: center;
}
.mv-icobtn:hover {
  color: var(--brand-dark); border-color: var(--brand-line); background: var(--brand-soft);
}
.mv-title { min-width: 0; }
.mv-title h2 {
  font-size: 16px; font-weight: 800; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mv-meta {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--ink-secondary); line-height: 1.5;
  overflow: hidden; white-space: nowrap;
}
.mv-meta img.avatar { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; }
.mv-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.mv-qbtn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 9px;
  padding: 6px 12px; font-size: 13px; color: var(--ink-secondary); font-weight: 500;
}
.mv-qbtn:hover {
  color: var(--brand-dark); border-color: var(--brand-line); background: var(--brand-soft);
}
.mv-cta {
  display: inline-block; background: var(--brand); color: #fff;
  font-weight: 700; border-radius: 10px; padding: 7px 16px; font-size: 14px;
}
.mv-cta:hover { background: var(--brand-dark); }
.mv-body { flex: 1; display: flex; min-height: 0; position: relative; }
.mv-map { flex: 1; position: relative; background: var(--surface-soft); min-width: 0; }
.mv-map iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
  background: transparent;
}
.mv-loading {
  position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center;
  color: var(--ink-secondary); font-size: 14px; pointer-events: none;
}
.mv-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .94);
  font-size: 20px; color: var(--ink-secondary);
  box-shadow: var(--shadow-pop); z-index: 3;
}
.mv-nav:hover { color: var(--brand-dark); border-color: var(--brand-line); }
.mv-nav.prev { left: 14px; }
.mv-nav.next { right: 14px; }
.mv-khint {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  font-size: 12px; color: var(--ink-secondary);
  background: rgba(255, 255, 255, .88); border: 1px solid var(--line);
  border-radius: 999px; padding: 2px 12px; pointer-events: none; z-index: 3;
}
.mv-side {
  width: 300px; flex: 0 0 auto; border-left: 1px solid var(--line);
  background: var(--surface); padding: 14px; overflow: auto;
  display: flex; flex-direction: column; gap: 12px;
}
.mv-card {
  border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; background: var(--surface);
}
.mv-card h3 {
  font-size: 12px; font-weight: 700; color: var(--muted);
  letter-spacing: .04em; margin-bottom: 8px;
}
.mv-author { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.mv-author img.avatar {
  width: 38px; height: 38px; border-radius: 12px; object-fit: cover; flex: 0 0 auto;
}
.mv-author .dot {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 12px;
  background: var(--brand); color: #fff; font-size: 16px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.mv-author .nm { font-size: 14px; font-weight: 700; line-height: 1.4; }
.mv-author .sub { font-size: 12px; color: var(--ink-secondary); }
.mv-row {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 13px; color: var(--ink-secondary); padding: 3px 0;
}
.mv-row b { color: var(--ink); font-weight: 600; text-align: right; }
.mv-mini {
  width: 100%; display: flex; gap: 10px; align-items: center; text-align: left;
  padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
.mv-mini + .mv-mini { margin-top: 8px; }
.mv-mini:hover { border-color: var(--brand-line); background: var(--brand-soft); }
.mv-mini img {
  width: 56px; height: 42px; border-radius: 8px; object-fit: cover;
  flex: 0 0 auto; background: var(--brand-soft);
}
.mv-mini .lbl { display: block; font-size: 12px; color: var(--muted); }
.mv-mini .mt {
  font-size: 13px; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.mv-bottom {
  display: none; position: absolute; bottom: 0; left: 0; right: 0; height: 52px;
  background: var(--surface); border-top: 1px solid var(--line);
  align-items: center; justify-content: space-around; z-index: 4;
}
.mv-bottom button {
  border: 0; background: none; font-size: 14px;
  color: var(--ink-secondary); font-weight: 600; padding: 10px 16px;
}
/* 断点归位到 SSOT 四档；原值 760 不在允许集内 */
@media (max-width: 767.98px) {
  .mv-top { padding: 10px 12px; gap: 9px; }
  .mv-back { padding: 7px 10px; }
  .mv-back .txt { display: none; }
  .mv-actions .mv-qbtn { display: none; }
  .mv-nav, .mv-khint { display: none; }
  .mv-side {
    display: none; position: absolute; left: 0; right: 0; bottom: 52px; top: auto;
    width: auto; max-height: 55%; border-left: 0; border-top: 1px solid var(--line);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -18px 40px rgba(43, 26, 7, .22); z-index: 5;
  }
  .mv.sheet .mv-side { display: flex; }
  .mv-bottom { display: flex; }
}
