/* ============================================================
   themes.css · 六套彩色模式主题
   Project: The Puppy Gear Lab (puppy-search.com)
   Load Order: 2
   ============================================================ */

/* ---------- M1 晨光 Dawn ---------- */
[data-theme="dawn"] {
  --color-bg:              hsl(35, 30%, 98%);
  --color-surface:         hsl(35, 25%, 96%);
  --color-surface-hover:   hsl(35, 25%, 93%);
  --color-text-primary:    hsl(30, 15%, 15%);
  --color-text-secondary:  hsl(30, 10%, 45%);
  --color-text-tertiary:   hsl(30, 10%, 65%);
  --color-accent:          hsl(15, 65%, 45%);
  --color-border:          hsl(35, 20%, 88%);
  --color-border-strong:   hsl(35, 20%, 80%);
}

/* ---------- M2 正午 Noon ---------- */
[data-theme="noon"] {
  --color-bg:              hsl(0, 0%, 100%);
  --color-surface:         hsl(0, 0%, 97%);
  --color-surface-hover:   hsl(0, 0%, 94%);
  --color-text-primary:    hsl(220, 15%, 12%);
  --color-text-secondary:  hsl(220, 10%, 45%);
  --color-text-tertiary:   hsl(220, 10%, 65%);
  --color-accent:          hsl(220, 65%, 45%);
  --color-border:          hsl(220, 15%, 90%);
  --color-border-strong:   hsl(220, 15%, 82%);
}

/* ---------- M3 黄昏 Dusk ---------- */
[data-theme="dusk"] {
  --color-bg:              hsl(38, 25%, 94%);
  --color-surface:         hsl(38, 20%, 90%);
  --color-surface-hover:   hsl(38, 20%, 87%);
  --color-text-primary:    hsl(30, 20%, 18%);
  --color-text-secondary:  hsl(30, 15%, 45%);
  --color-text-tertiary:   hsl(30, 15%, 65%);
  --color-accent:          hsl(35, 65%, 50%);
  --color-border:          hsl(38, 18%, 84%);
  --color-border-strong:   hsl(38, 18%, 76%);
}

/* ---------- M4 夜读 Night ---------- */
[data-theme="night"] {
  --color-bg:              hsl(220, 15%, 10%);
  --color-surface:         hsl(220, 12%, 14%);
  --color-surface-hover:   hsl(220, 12%, 18%);
  --color-text-primary:    hsl(35, 15%, 85%);
  --color-text-secondary:  hsl(35, 10%, 60%);
  --color-text-tertiary:   hsl(35, 10%, 45%);
  --color-accent:          hsl(35, 70%, 60%);
  --color-border:          hsl(220, 12%, 22%);
  --color-border-strong:   hsl(220, 12%, 30%);
}

/* ---------- M5 静默 Silent ---------- */
[data-theme="silent"] {
  --color-bg:              hsl(0, 0%, 96%);
  --color-surface:         hsl(0, 0%, 93%);
  --color-surface-hover:   hsl(0, 0%, 90%);
  --color-text-primary:    hsl(0, 0%, 15%);
  --color-text-secondary:  hsl(0, 0%, 45%);
  --color-text-tertiary:   hsl(0, 0%, 65%);
  --color-accent:          hsl(0, 0%, 35%);
  --color-border:          hsl(0, 0%, 88%);
  --color-border-strong:   hsl(0, 0%, 80%);
}

/* ---------- M6 活力 Vivid ---------- */
[data-theme="vivid"] {
  --color-bg:              hsl(0, 0%, 100%);
  --color-surface:         hsl(280, 20%, 97%);
  --color-surface-hover:   hsl(280, 20%, 94%);
  --color-text-primary:    hsl(260, 20%, 12%);
  --color-text-secondary:  hsl(260, 15%, 45%);
  --color-text-tertiary:   hsl(260, 15%, 65%);
  --color-accent:          hsl(320, 80%, 50%);
  --color-border:          hsl(280, 15%, 90%);
  --color-border-strong:   hsl(280, 15%, 82%);
}

/* ============================================================
   移动端 OLED 夜读优化
   ============================================================ */
@media (max-width: 768px) {
  [data-theme="night"] {
    --color-bg:             hsl(0, 0%, 0%);
    --color-surface:        hsl(220, 10%, 8%);
    --color-text-primary:   hsl(35, 12%, 80%);
    --color-accent:         hsl(35, 60%, 55%);
  }
}

/* ============================================================
   户外高对比度模式
   ============================================================ */
[data-theme="dawn"][data-outdoor="true"],
[data-theme="noon"][data-outdoor="true"] {
  --color-text-primary: hsl(30, 20%, 5%);
  --color-bg:           hsl(0, 0%, 100%);
  --color-accent:       hsl(25, 85%, 45%);
}

/* ============================================================
   P3 广色域适配
   ============================================================ */
@media (color-gamut: p3) {
  :root {
    --color-accent: color(display-p3 0.95 0.45 0.15);
  }
}

/* ============================================================
   主题切换器基础样式（供 theme-manager.js 使用）
   ============================================================ */
.theme-switcher {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.theme-option {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color var(--duration-normal) var(--ease-out);
  position: relative;
}

.theme-option[aria-selected="true"] {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(15, 65, 45, 0.15);
}

.theme-option[data-theme="dawn"]   { background: hsl(35, 30%, 90%); }
.theme-option[data-theme="noon"]   { background: hsl(220, 15%, 92%); }
.theme-option[data-theme="dusk"]   { background: hsl(38, 25%, 88%); }
.theme-option[data-theme="night"]  { background: hsl(220, 15%, 15%); }
.theme-option[data-theme="silent"] { background: hsl(0, 0%, 88%); }
.theme-option[data-theme="vivid"]  { background: hsl(280, 20%, 90%); }

@media (max-width: 768px) {
  .theme-switcher {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 12px 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .theme-switcher::-webkit-scrollbar { display: none; }
  .theme-option {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
  }
}
