/* ============================================================
 * 湾区芯城党群服务中心功能布局展示
 * Apple Design 风格：系统字体、毛玻璃材质、弹簧动效、空间锚定
 * ============================================================ */
:root {
  --red: #c0392f;
  --red-deep: #9c2b23;
  --gold: #c98f2d;
  --ink: #1d1d1f;          /* Apple 主文字色 */
  --ink-2: #6e6e73;        /* Apple 次级文字色 */
  --paper: #f5f5f7;        /* Apple 页面底色 */
  --card: #ffffff;
  --ios-blue: #007aff;
  --ease-sheet: cubic-bezier(0.32, 0.72, 0, 1);   /* iOS sheet 曲线 */
  --ease-out: cubic-bezier(0.25, 1, 0.3, 1);
  --shadow-card: 0 12px 40px rgba(0, 0, 0, .16), 0 2px 8px rgba(0, 0, 0, .08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  font: 100%/1.5 -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC",
        "Microsoft YaHei", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}
body {
  background: var(--paper);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

/* ---- 顶栏：大标题层级，字距随字号收紧 ---- */
.topbar {
  padding: 28px 20px 10px;
  max-width: 640px;
  margin: 0 auto;
}
.topbar h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;      /* 大字收紧 */
  line-height: 1.15;
  color: var(--red-deep);
}
.topbar .subtitle {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.01em;       /* 小字略放宽 */
  color: var(--ink-2);
}

/* ---- 分段控制器（iOS UISegmentedControl 风格） ---- */
.scheme-switch {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 16px auto 6px;
  padding: 3px;
  background: rgba(120, 120, 128, .14);   /* iOS 填充灰 */
  border-radius: 12px;
  max-width: 420px;
}
.scheme-switch .thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc(50% - 3px);
  background: var(--card);
  border-radius: 9.5px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 1px 1px rgba(0, 0, 0, .1);
  transition: transform .35s var(--ease-sheet);   /* 弹簧感滑动 */
  will-change: transform;
}
.scheme-switch.f2 .thumb { transform: translateX(100%); }
.scheme-btn {
  position: relative;
  z-index: 1;
  border: none;
  background: none;
  padding: 7px 4px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  cursor: pointer;
  border-radius: 9.5px;
  transition: transform .1s ease-out;
}
.scheme-btn:active { transform: scale(.96); }   /* 按下即时反馈 */
.scheme-btn .scheme-tag {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--ink);
  transition: color .2s;
}
.scheme-btn .scheme-name {
  font-size: 11px;
  letter-spacing: .02em;
  color: var(--ink-2);
}
.scheme-btn[aria-selected="true"] .scheme-tag { color: var(--red-deep); }

/* ---- 底图舞台 ---- */
.stage-wrap {
  padding: 14px 14px 6px;
  max-width: 640px;
  margin: 0 auto;
}
.stage {
  position: relative;
  border-radius: 18px;          /* Apple 连续圆角 */
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow-card);
}
.stage img#base-img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

/* ---- 热点圆点 ---- */
.hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  padding: 16px;                /* 扩大触摸热区 */
  background: none;
  border: none;
  outline: none;
  transition: transform .1s ease-out;
}
.hotspot:active { transform: translate(-50%, -50%) scale(.85); }  /* 按下即时反馈 */
.hotspot .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--red);
  border: 1.5px solid rgba(255, 255, 255, .95);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
  animation: pulse 2.4s var(--ease-out) infinite;
  pointer-events: none;
}
@keyframes pulse {
  0%   { box-shadow: 0 1px 4px rgba(0,0,0,.3), 0 0 0 0 rgba(192, 57, 47, .4); }
  60%  { box-shadow: 0 1px 4px rgba(0,0,0,.3), 0 0 0 5px rgba(192, 57, 47, 0); }
  100% { box-shadow: 0 1px 4px rgba(0,0,0,.3), 0 0 0 0 rgba(192, 57, 47, 0); }
}
/* 毛玻璃名称标签 */
.hotspot .label {
  margin-top: 2px;
  background: rgba(250, 250, 250, .72);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  color: var(--ink);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: .01em;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 100px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12), inset 0 0 0 .5px rgba(255, 255, 255, .5);
}
.hotspot.f2-only .dot { background: var(--gold); }
.hotspot.f2-only .label { color: #7a5210; }
.hotspot.dragging { z-index: 20; }
.hotspot.dragging .dot { animation: none; }
.hotspot.dragging:active { transform: translate(-50%, -50%); }

/* ---- 底部说明 ---- */
.footnote {
  max-width: 640px;
  margin: 0 auto;
  padding: 6px 24px 30px;
  text-align: center;
}
.footnote p {
  font-size: 13px;
  line-height: 1.65;
  letter-spacing: .01em;
  color: var(--ink-2);
}

/* ---- 弹层：iOS sheet 质感，从触发圆点放大 ---- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(20, 16, 14, .45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  opacity: 0;
  transition: opacity .3s var(--ease-out);
}
.overlay.show { opacity: 1; }
.overlay-inner {
  max-width: 620px;
  width: 100%;
  max-height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.img-card {
  background: var(--card);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .35);
  transform: scale(.88);
  opacity: 0;
  transition: transform .38s var(--ease-sheet), opacity .3s var(--ease-out);
  /* transform-origin 由 JS 设为触发圆点位置 */
}
.overlay.show .img-card {
  transform: scale(1);
  opacity: 1;
}
.img-card > img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 68vh;
  object-fit: contain;
  background: #111;
}
.img-caption {
  padding: 16px 20px 18px;
}
.img-caption h2 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.img-caption p {
  margin-top: 7px;
  font-size: 14px;
  line-height: 1.7;
  letter-spacing: .01em;
  color: var(--ink-2);
}

/* ---- 调试工具条 ---- */
.edit-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 200;
  background: rgba(28, 28, 30, .85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  font-size: 13px;
}
.edit-bar button {
  background: var(--ios-blue);
  color: #fff;
  border: none;
  border-radius: 100px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
body.edit-mode .stage { outline: 2px dashed var(--gold); outline-offset: 4px; }

/* ---- 尊重系统减弱动态/透明度设置 ---- */
@media (prefers-reduced-motion: reduce) {
  .hotspot .dot { animation: none; }
  .scheme-switch .thumb,
  .img-card,
  .overlay,
  .hotspot { transition: opacity .2s ease !important; }
  .img-card { transform: none !important; }
  .hotspot:active,
  .scheme-btn:active { transform: none !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .hotspot .label { background: #fff; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .overlay { background: rgba(20, 16, 14, .82); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .edit-bar { background: #1c1c1e; backdrop-filter: none; -webkit-backdrop-filter: none; }
}
