/* ==========================================================================
   槿海云 · iOS 主题层（保守版）
   只调整排版、圆角、阴影与开关配色；不改任何组件的背景色与文字色，
   避免主题与组件自带配色冲突导致「白底白字」看不见。
   ========================================================================== */

/* ---------- 1. 设计 token ---------- */
html.jh-ios {
  --radius: 0.65rem;
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

html.dark.jh-ios {
  color-scheme: dark;
}

/* ---------- 2. 排版 ---------- */
html.jh-ios body {
  letter-spacing: -0.006em;
}

html.jh-ios h1,
html.jh-ios h2 {
  letter-spacing: -0.022em;
  line-height: 1.18;
}

html.jh-ios h3,
html.jh-ios h4 {
  letter-spacing: -0.014em;
  line-height: 1.3;
}

html.jh-ios [class*="text-xs"] {
  letter-spacing: 0.012em;
}

/* ---------- 3. 圆角与阴影（仅视觉，不动背景） ---------- */
html.jh-ios [class*="bg-card"][class*="rounded"] {
  border-radius: 1rem;
}

html.jh-ios [data-slot="dialog-content"],
html.jh-ios [data-slot="sheet-content"],
html.jh-ios [role="dialog"] {
  border-radius: 1.25rem !important;
}

html.jh-ios [data-slot="dropdown-menu-content"],
html.jh-ios [data-slot="popover-content"],
html.jh-ios [data-slot="select-content"] {
  border-radius: 0.9rem !important;
}

html.jh-ios input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
html.jh-ios textarea,
html.jh-ios select {
  border-radius: 0.6rem;
}

/* ---------- 4. 按压反馈 ---------- */
html.jh-ios button,
html.jh-ios [role="button"] {
  -webkit-tap-highlight-color: transparent;
}

html.jh-ios button:not(:disabled):not([aria-disabled="true"]):active,
html.jh-ios [role="button"]:not([aria-disabled="true"]):active {
  transform: scale(0.98);
}

/* ---------- 5. 开关：只上色，不碰尺寸与位移 ---------- */
/* 位移由组件用独立的 translate 属性完成，这里再写 transform 会叠加错位。
   注意关闭态可能写成 data-checked="false"，必须排除，否则永远显示为开启。 */
html.jh-ios [role="switch"] {
  border-radius: 999px !important;
  background-color: rgba(120, 120, 128, 0.32) !important;
  transition: background-color 220ms cubic-bezier(0.2, 0.8, 0.2, 1) !important;
}

html.jh-ios [role="switch"][data-checked]:not([data-checked="false"]),
html.jh-ios [role="switch"][data-state="checked"],
html.jh-ios [role="switch"][aria-checked="true"] {
  background-color: #34c759 !important;
}

html.jh-ios [role="switch"] > span {
  background-color: #ffffff !important;
  border-radius: 999px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18) !important;
}

/* ---------- 6. 复选框 ---------- */
html.jh-ios input[type="checkbox"]:not([class*="sr-only"]),
html.jh-ios input[type="radio"]:not([class*="sr-only"]) {
  border-radius: 6px;
}

html.jh-ios input[type="range"],
html.jh-ios input[type="checkbox"],
html.jh-ios input[type="radio"] {
  accent-color: #007aff;
}

/* ---------- 7. 焦点环 ---------- */
html.jh-ios button:focus-visible {
  outline: none !important;
}

html.jh-ios a:focus-visible,
html.jh-ios input:focus-visible,
html.jh-ios textarea:focus-visible,
html.jh-ios select:focus-visible,
html.jh-ios [tabindex]:not(button):not([role="button"]):focus-visible {
  outline: 2px solid rgba(0, 122, 255, 0.55);
  outline-offset: 2px;
}

/* ---------- 8. 滚动条 ---------- */
html.jh-ios ::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

html.jh-ios ::-webkit-scrollbar-thumb {
  background: rgba(120, 120, 128, 0.32);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}

html.jh-ios ::-webkit-scrollbar-thumb:hover {
  background: rgba(120, 120, 128, 0.5);
  background-clip: content-box;
}

/* ---------- 9. 移动端标题密度 ---------- */
@media (max-width: 640px) {
  html.jh-ios h2[class*="font-bold"] {
    font-size: 2.125rem !important;
  }
}

/* ---------- 10. 减少动态 ---------- */
@media (prefers-reduced-motion: reduce) {
  html.jh-ios [role="switch"],
  html.jh-ios button,
  html.jh-ios [role="button"] {
    transition: none !important;
  }
  html.jh-ios button:active,
  html.jh-ios [role="button"]:active {
    transform: none !important;
  }
}
