/* ============================================================
   我的歷代筆電 — 樣式表 (style.css)
   深色/淺色主題、響應式、可離線 file:// 開啟
   ============================================================ */

:root {
  color-scheme: dark;
  --bg:        #0e1116;
  --bg-soft:   #161b22;
  --bg-card:   #1b222c;
  --bg-card-h: #232c38;
  --border:    #2a3340;
  --text:      #e6edf3;
  --text-dim:  #9aa7b4;
  --text-mut:  #6b7785;
  --accent:    #38d9a9;  /* 筆電主題採用電競/科技綠翠色 */
  --accent-2:  #4dabf7;  /* 藍色輔助 */
  --accent-3:  #ff8787;  /* 警示/折數 */
  --radius:    14px;
  --shadow:    0 8px 30px rgba(0,0,0,.35);
  --maxw:      1200px;
  --stripe:    rgba(255,255,255,.018);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg:        #f3f5f9;
  --bg-soft:   #ffffff;
  --bg-card:   #ffffff;
  --bg-card-h: #eaeff5;
  --border:    #d7dee8;
  --text:      #1a2230;
  --text-dim:  #46546a;
  --text-mut:  #7a8798;
  --accent:    #0ca678;
  --accent-2:  #1971c2;
  --accent-3:  #e8590c;
  --shadow:    0 8px 30px rgba(20,30,50,.12);
  --stripe:    rgba(0,0,0,.025);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- Header / Banner ---------- */
.site-header {
  padding: 32px 0 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.brand-title {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-title h1 {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.brand-title .accent { color: var(--accent); }
.header-stats {
  display: flex;
  gap: 16px;
  font-size: 0.9rem;
  color: var(--text-dim);
}
.header-stats b { color: var(--text); font-weight: 700; }

/* ---------- Toolbar (Search & Filters) ---------- */
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.search-box {
  position: relative;
  flex: 1;
  min-width: 240px;
}
.search-box input {
  width: 100%;
  padding: 10px 36px 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color .2s;
}
.search-box input:focus {
  border-color: var(--accent);
}
.search-box .clear-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-mut);
  cursor: pointer;
  display: none;
  font-size: 1.1rem;
}
.search-box input:not(:placeholder-shown) ~ .clear-btn {
  display: block;
}

.view-toggle {
  display: flex;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}
.toggle-btn {
  border: none;
  background: transparent;
  color: var(--text-dim);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all .2s;
}
.toggle-btn.active {
  background: var(--bg-card-h);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

/* ---------- Spec Table ---------- */
.table-wrap {
  overflow-x: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.nb-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.92rem;
}
.nb-table th {
  background: var(--bg-soft);
  color: var(--text-dim);
  padding: 14px 12px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.nb-table th:hover {
  color: var(--text);
  background: var(--bg-card-h);
}
.nb-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.nb-table tr:last-child td { border-bottom: none; }
.nb-table tr:nth-child(even) { background: var(--stripe); }
.nb-table tr:hover { background: var(--bg-card-h); cursor: pointer; }
.nb-table td:first-child,
.nb-table th:first-child {
  min-width: 130px;
  white-space: nowrap;
}

/* Table Thumbnail */
.tb-thumb {
  width: 48px;
  height: 34px;
  background: var(--bg-soft);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  border: 1px solid var(--border);
  margin: 0 auto;
}
.tb-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Badges & Chips */
.stage-chip {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.tag {
  display: inline-block;
  padding: 2px 7px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-right: 4px;
  margin-bottom: 4px;
}
.cpu-mark-badge {
  display: inline-block;
  background: rgba(56,217,169,0.15);
  color: var(--accent);
  border: 1px solid rgba(56,217,169,0.3);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  margin-left: 4px;
}

/* ---------- Timeline View ---------- */
.timeline {
  position: relative;
  padding: 20px 0;
  margin-left: 20px;
  border-left: 2px solid var(--border);
}
.timeline-item {
  position: relative;
  margin-bottom: 30px;
  padding-left: 30px;
}
.timeline-dot {
  position: absolute;
  left: -9px;
  top: 16px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg);
}
.timeline-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
}
.timeline-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

/* ---------- Detail View / Modal ---------- */
.detail-view {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 30px;
  box-shadow: var(--shadow);
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 20px;
  font-size: 0.9rem;
}
.back-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

.detail-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 30px;
}
@media (max-width: 768px) {
  .detail-grid { grid-template-columns: 1fr; }
}

.detail-image {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  overflow: hidden;
}
.detail-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.spec-box {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}
.spec-box label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.spec-box .val {
  font-size: 0.95rem;
  font-weight: 600;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 24px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.feature-list {
  list-style: none;
}
.feature-list li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 8px;
  font-size: 0.93rem;
}
.feature-list.pros li::before { content: "✔"; position: absolute; left: 0; color: #2fb344; font-weight: bold; }
.feature-list.cons li::before { content: "✖"; position: absolute; left: 0; color: #fa5252; font-weight: bold; }
.feature-list.notes li::before { content: "💡"; position: absolute; left: 0; font-size: 0.85rem; }

/* Floating Controls */
.btn-theme, .btn-totop {
  position: fixed;
  bottom: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 100;
  transition: transform .2s;
}
.btn-theme { right: 24px; }
.btn-totop { right: 78px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.btn-totop.show { opacity: 1; pointer-events: auto; }
.btn-theme:hover, .btn-totop:hover { transform: scale(1.1); }

/* Footer */
.site-footer {
  text-align: center;
  padding: 30px 0;
  color: var(--text-mut);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
