/* ============================================================
   DiagMyPCHub — tutorial: my hard drive isn't detected
   Scoped to .hd-* only. The existing design system
   (css/style.css) is reused; dark theme via
   [data-theme="dark"] overrides near the end of this file.
   ============================================================ */

html { scroll-behavior: smooth; }

/* ---------- Reading progress ---------- */
.hd-progress { position: fixed; top: 0; left: 0; z-index: 120; width: 100%; height: 3px; background: transparent; pointer-events: none; }
.hd-progress span { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--blue), var(--cyan)); transform-origin: 0 50%; transform: scaleX(0); }

/* ---------- Layout: TOC + article ---------- */
.hd-grid { display: grid; grid-template-columns: 1fr; gap: 36px; padding: 34px 0 20px; }
.hd-toc { display: none; }
.hd-toc-title { font: 500 0.7rem var(--font-mono); text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-3); margin: 0 0 12px; }
.hd-toc ul { border-left: 1px solid var(--line); }
.hd-toc a { display: block; padding: 6px 0 6px 16px; margin-left: -1px; border-left: 2px solid transparent; color: var(--ink-2); text-decoration: none; font-size: 0.85rem; transition: color 0.2s, border-color 0.2s; }
.hd-toc a:hover { color: var(--ink); }
.hd-toc a.is-active { color: var(--blue); border-left-color: var(--blue); font-weight: 600; }

/* ---------- Article head ---------- */
.hd-head h1 { font-size: clamp(1.9rem, 1.2rem + 2.6vw, 2.7rem); font-weight: 700; letter-spacing: -0.02em; margin: 0 0 16px; }
.hd-intro { color: var(--ink-2); font-size: 1.02rem; }

/* ---------- Data-safety warning ---------- */
.hd-warn {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin: 22px 0;
  padding: 18px 20px;
  background: #fdf6e9;
  border: 1px solid #ecd9ad;
  border-left: 4px solid var(--warn);
  border-radius: var(--radius);
}
.hd-warn-ico {
  flex: none;
  width: 26px; height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--warn);
  color: #3a2a00;
  font: 700 0.95rem/1 var(--font-display);
}
.hd-warn-title { font: 600 0.98rem var(--font-body); color: var(--ink); margin: 0 0 6px; }
.hd-warn-title a { color: var(--blue-deep); }
.hd-warn-text { margin: 0; font-size: 0.9rem; color: var(--ink-2); }

/* ---------- Hero image placeholder (auto-hides when empty) ---------- */
.hd-figure { margin: 26px 0 6px; border: 1px dashed var(--line-2); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.hd-figure[data-empty="true"] { display: none; }
.hd-figure img { display: block; width: 100%; height: auto; }
.hd-figure figcaption { padding: 10px 14px; font: 400 0.72rem/1.6 var(--font-mono); color: var(--ink-3); border-top: 1px dashed var(--line-2); }

/* ---------- Sections ---------- */
.hd-sec { margin-top: 46px; scroll-margin-top: 84px; }
.hd-sec-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 10px; }
.hd-sec-index { font: 600 0.95rem var(--font-mono); color: var(--line-2); letter-spacing: 0.06em; flex: none; }
.hd-sec-kicker { font: 500 0.7rem var(--font-mono); text-transform: uppercase; letter-spacing: 0.14em; color: var(--blue); margin: 0 0 4px; }
.hd-sec-head h2 { font-size: clamp(1.3rem, 1rem + 1.2vw, 1.7rem); font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.hd-sec-lede { color: var(--ink-2); font-size: 0.96rem; margin: 0 0 20px; max-width: 78ch; }
.hd-cat-lede { color: var(--ink-2); font-size: 0.96rem; margin: 0 0 14px; max-width: 80ch; }

/* ---------- Diagnostic selector ---------- */
.hd-diag { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.hd-diag-opts { display: grid; grid-template-columns: 1fr; gap: 8px; }
.hd-diag-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font: 600 0.88rem var(--font-body);
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--bg);
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s, transform 0.15s;
}
.hd-diag-btn:hover { border-color: var(--blue); color: var(--blue); transform: translateY(-1px); }
.hd-diag-btn[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }
.hd-diag-hint { margin: 14px 0 0; font: 500 0.78rem var(--font-mono); color: var(--ink-3); min-height: 1.2em; }
.hd-diag-result { margin-top: 14px; }
.hd-diag-path { border-top: 1px dashed var(--line-2); padding-top: 14px; }
.hd-diag-path p { font-size: 0.92rem; color: var(--ink-2); margin: 0 0 10px; }
.hd-diag-path p:last-child { margin-bottom: 0; }
.hd-diag-links { font-size: 0.88rem; }
.hd-diag-links a { color: var(--blue); text-decoration: none; }
.hd-diag-links a:hover { text-decoration: underline; }
.hd-diag-reset-wrap { margin-top: 14px; }
.hd-noscript { margin: 14px 0 0; font-size: 0.85rem; color: var(--ink-2); }

/* ---------- Did it show up? verdict ---------- */
.hd-verdict { margin: 18px 0 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; transition: border-color 0.25s, box-shadow 0.25s; }
.hd-verdict.is-fixed { border-color: var(--ok); box-shadow: 0 0 0 4px rgba(47, 191, 143, 0.15); }
.hd-verdict.is-notfix { border-color: var(--warn); box-shadow: 0 0 0 4px rgba(245, 180, 83, 0.15); }
.hd-verdict-label { font: 600 0.95rem var(--font-display); margin: 0 0 10px; }
.hd-verdict-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.hd-vbtn { font: 600 0.82rem var(--font-body); padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); cursor: pointer; transition: border-color 0.2s, color 0.2s, background 0.2s, transform 0.15s; }
.hd-vbtn:hover { border-color: var(--blue); color: var(--blue); transform: translateY(-1px); }
.hd-vbtn-yes { color: #06281c; background: var(--ok); border-color: var(--ok); }
.hd-vbtn-yes:hover { color: #06281c; background: var(--ok); border-color: var(--ok); }
.hd-verdict-msg { min-height: 1.4em; margin: 10px 0 0; font-size: 0.85rem; color: var(--ink-2); }

/* ---------- Detection path SVG ---------- */
.hd-diagram { margin: 26px 0 6px; background: var(--dark-2); border: 1px solid var(--dark-line); border-radius: 14px; padding: 10px; }
.hd-diagram svg { display: block; width: 100%; height: auto; }
.hd-diagram figcaption { padding: 12px 10px 6px; font-size: 0.8rem; color: var(--dark-muted); }
.hd-box { fill: #0e2038; stroke: #2e5f93; stroke-width: 2; }
.hd-chip { fill: #122a48; stroke: #2e5f93; stroke-width: 2; }
.hd-chip-line { stroke: #35619c; stroke-width: 2; stroke-linecap: round; }
.hd-trace { stroke: #24466f; stroke-width: 2; fill: none; }
.hd-flow { stroke: var(--cyan-bright); stroke-width: 2.4; fill: none; stroke-dasharray: 12 240; opacity: 0.9; animation: hdflow 3.6s linear infinite; }
.hd-flow-b { animation-duration: 4.6s; animation-direction: reverse; }
@keyframes hdflow { to { stroke-dashoffset: -252; } }
.hd-via { fill: #24466f; }
.hd-led { fill: var(--ok); animation: hdled 2.4s ease-in-out infinite; }
@keyframes hdled { 50% { opacity: 0.25; } }
.hd-glow { animation: hdglow 7s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
@keyframes hdglow { from { opacity: 0.6; } to { opacity: 1; transform: scale(1.04); } }
.hd-platter { fill: #122a48; stroke: #2e5f93; stroke-width: 2; }
.hd-platter-hub { fill: #0e2038; stroke: #35619c; stroke-width: 2; }
.hd-actuator { stroke: #35619c; stroke-width: 3; stroke-linecap: round; }
.hd-rotor { animation: hdspin 8s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes hdspin { to { transform: rotate(360deg); } }
.hd-svg-label { fill: #8aa3c4; font: 600 12px var(--font-mono); letter-spacing: 3px; }
.hd-svg-sub { fill: #5b7396; font: 500 10px var(--font-mono); letter-spacing: 1px; }
.hd-svg-status { fill: #5b7396; font: 500 12px var(--font-mono); letter-spacing: 1px; }

/* ---------- Tutorial accordions ---------- */
.hd-art { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin: 14px 0; overflow: hidden; transition: border-color 0.2s; }
.hd-art[open] { border-color: var(--line-2); }
.hd-art-sum { display: flex; align-items: center; gap: 14px; padding: 16px 18px; cursor: pointer; list-style: none; }
.hd-art-sum::-webkit-details-marker { display: none; }
.hd-art-num { flex: none; width: 34px; height: 34px; display: grid; place-items: center; font-size: 0.76rem; color: var(--ink-3); background: var(--bg); border: 1px solid var(--line-2); border-radius: 9px; transition: background 0.2s, color 0.2s, border-color 0.2s; }
.hd-art[open] .hd-art-num { background: var(--blue); border-color: var(--blue); color: #fff; }
.hd-art-body { display: grid; gap: 2px; min-width: 0; flex: 1; }
.hd-art-title { font: 600 1.02rem var(--font-display); color: var(--ink); }
.hd-art-meta { display: flex; align-items: center; gap: 8px; }
.hd-art-time { font-size: 0.7rem; color: var(--ink-3); }
.hd-art-ico { position: relative; width: 16px; height: 16px; flex: none; margin-left: auto; }
.hd-art-ico::before, .hd-art-ico::after { content: ""; position: absolute; left: 0; top: 7px; width: 16px; height: 2px; background: var(--ink-3); transition: transform 0.25s, background 0.25s; }
.hd-art-ico::after { transform: rotate(90deg); }
.hd-art[open] .hd-art-ico::after { transform: rotate(0); }
.hd-art[open] .hd-art-ico::before, .hd-art[open] .hd-art-ico::after { background: var(--blue); }
.hd-art-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.35s ease; }
.hd-art[open] .hd-art-panel { grid-template-rows: 1fr; }
.hd-art-inner { overflow: hidden; min-height: 0; visibility: hidden; transition: visibility 0s 0.35s; padding: 0 18px 20px; }
.hd-art[open] .hd-art-inner { visibility: visible; transition-delay: 0s; }
.hd-art-inner p { color: var(--ink-2); font-size: 0.95rem; }
.hd-art-inner p:last-child { margin-bottom: 0; }
.hd-art-inner a { color: var(--blue); text-decoration: none; }
.hd-art-inner a:hover { text-decoration: underline; }

/* ---------- Copyable command ---------- */
.hd-cmd { margin: 14px 0; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.hd-cmd code { display: block; font: 500 0.85rem var(--font-mono); padding: 12px 14px; background: var(--bg); color: var(--ink); }
.hd-cmd-copy { display: block; width: 100%; text-align: left; background: var(--tint); color: var(--blue-deep); border: 0; border-top: 1px solid var(--line-2); padding: 9px 14px; font: 600 0.76rem var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; cursor: pointer; }
.hd-cmd-copy:hover { color: var(--blue); }
.hd-cmd-note { display: block; padding: 9px 14px; font-size: 0.74rem; color: var(--ink-3); }

/* ---------- Risk table chips ---------- */
.hd-risk { display: inline-block; font: 600 0.7rem var(--font-mono); padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.hd-risk-safe { color: #0a5c42; background: rgba(47, 191, 143, 0.16); border: 1px solid rgba(47, 191, 143, 0.5); }
.hd-risk-low { color: #7a4b00; background: rgba(245, 180, 83, 0.16); border: 1px solid rgba(245, 180, 83, 0.55); }
.hd-risk-caution { color: #8a4a00; background: rgba(224, 142, 60, 0.16); border: 1px solid rgba(224, 142, 60, 0.55); }
.hd-risk-destructive { color: #8f1d1d; background: rgba(200, 60, 60, 0.14); border: 1px solid rgba(200, 60, 60, 0.5); }

/* ---------- Mistakes ---------- */
.hd-mistakes li { position: relative; padding: 12px 0 12px 26px; border-bottom: 1px solid var(--line); }
.hd-mistakes li:last-child { border-bottom: 0; }
.hd-mistakes li::before { content: "!"; position: absolute; left: 0; top: 12px; width: 17px; height: 17px; display: grid; place-items: center; border-radius: 50%; background: var(--warn); color: #3a2a00; font: 700 0.7rem/1 var(--font-display); }
.hd-mistakes li { color: var(--ink-2); font-size: 0.93rem; }
.hd-mistakes li strong { color: var(--ink); }

/* ---------- Checklist ---------- */
.hd-check { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.hd-check-file { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--ink-3); border-bottom: 1px dashed var(--line-2); padding-bottom: 12px; margin: 0 0 12px; }
.hd-check-list li label { display: flex; gap: 12px; padding: 10px 8px; border-radius: 8px; cursor: pointer; transition: background 0.15s; font-size: 0.93rem; color: var(--ink-2); }
.hd-check-list li label:hover { background: var(--tint); }
.hd-check-list li label strong { color: var(--ink); font-weight: 600; }
.hd-check-box { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--blue); cursor: pointer; }
.hd-check-box:checked + span { color: var(--ink); }
.hd-check-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.hd-check-hint { font-size: 0.7rem; color: var(--ink-3); margin: 0; }

/* ---------- FAQ ---------- */
.hd-faq-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin: 12px 0; overflow: hidden; transition: border-color 0.2s; }
.hd-faq-item[open] { border-color: var(--line-2); }
.hd-faq-sum { display: flex; align-items: center; gap: 12px; padding: 16px 18px; cursor: pointer; list-style: none; font: 600 0.98rem var(--font-display); color: var(--ink); }
.hd-faq-sum::-webkit-details-marker { display: none; }
.hd-faq-ico { margin-left: auto; position: relative; width: 16px; height: 16px; flex: none; }
.hd-faq-ico::before, .hd-faq-ico::after { content: ""; position: absolute; left: 0; top: 7px; width: 16px; height: 2px; background: var(--ink-3); transition: transform 0.25s, background 0.25s; }
.hd-faq-ico::after { transform: rotate(90deg); }
.hd-faq-item[open] .hd-faq-ico::after { transform: rotate(0); }
.hd-faq-item[open] .hd-faq-ico::before, .hd-faq-item[open] .hd-faq-ico::after { background: var(--blue); }
.hd-faq-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.35s ease; }
.hd-faq-item[open] .hd-faq-panel { grid-template-rows: 1fr; }
.hd-faq-inner { overflow: hidden; min-height: 0; visibility: hidden; transition: visibility 0s 0.35s; }
.hd-faq-item[open] .hd-faq-inner { visibility: visible; transition-delay: 0s; }
.hd-faq-inner p { margin: 0; padding: 0 18px 18px; color: var(--ink-2); font-size: 0.93rem; max-width: 80ch; }

/* ---------- Related ---------- */
.hd-related { display: grid; grid-template-columns: 1fr; gap: 12px; }
.hd-related-card { display: flex; flex-direction: column; gap: 3px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s; }
.hd-related-card:hover { border-color: var(--blue); transform: translateY(-2px); box-shadow: var(--shadow-1); }
.hd-related-title { font: 600 0.98rem var(--font-display); }
.hd-related-sub { font-size: 0.8rem; color: var(--ink-3); }

/* ---------- Footer actions + local footer ---------- */
.hd-foot { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line); }
.hd-localfoot { border-top: 1px solid var(--line); margin-top: 20px; padding: 26px 0 30px; }
.hd-localfoot .wrap, .hd-localfoot { color: var(--ink-3); font-size: 0.78rem; }
.hd-localfoot { display: flex; flex-wrap: wrap; gap: 10px 24px; justify-content: space-between; }

/* ---------- Responsive ---------- */
@media (min-width: 560px) {
  .hd-diag-opts { grid-template-columns: repeat(2, 1fr); }
  .hd-diag-btn:first-child { grid-column: 1 / -1; }
  .hd-related { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1000px) {
  .hd-grid { grid-template-columns: 236px 1fr; gap: 48px; align-items: start; }
  .hd-toc { display: block; position: sticky; top: calc(var(--header-h) + 24px); max-height: calc(100vh - var(--header-h) - 48px); overflow-y: auto; }
  .hd-related { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 559px) {
  .hd-art-sum { padding: 14px 14px; }
  .hd-art-inner { padding: 0 14px 16px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hd-progress span { transition: none !important; }
  .hd-diag-btn, .hd-vbtn, .hd-related-card, .hd-art-sum { transition: none; }
  .hd-flow { animation: none !important; stroke-dasharray: none; opacity: 0.35; }
  .hd-led, .hd-glow, .hd-rotor { animation: none !important; }
}

/* ---------- Print ---------- */
@media print {
  .topbar, .site-header, .hd-progress, .hd-toc, .hd-diag-opts, .hd-diag-reset-wrap,
  #hd-diag-reset, .hd-verdict-btns, .hd-check-actions, .hd-cmd-copy, .hd-foot,
  .hd-localfoot, .toast, .to-top, .consent, .ad-wrap { display: none !important; }
  .hd-grid { display: block; }
  .hd-article { max-width: 100%; }
  .hd-art, .hd-art-panel, .hd-art-inner, .hd-faq-item, .hd-faq-panel, .hd-faq-inner { display: block !important; height: auto !important; }
  .hd-art-panel, .hd-art-inner, .hd-faq-panel, .hd-faq-inner { grid-template-rows: auto !important; visibility: visible !important; overflow: visible !important; }
  .hd-diag-path { display: none; }
  .hd-diag-path:first-child { display: block; }
  a { text-decoration: none; color: var(--ink); }
}

/* ---------- Dark theme overrides ---------- */
[data-theme="dark"] .hd-warn { background: #241a09; border-color: #4a3a17; border-left-color: var(--warn); }
[data-theme="dark"] .hd-warn-title { color: #f3e2b8; }
[data-theme="dark"] .hd-warn-title a { color: #f5c97a; }
[data-theme="dark"] .hd-warn-text { color: #c9b587; }
[data-theme="dark"] .hd-diag { background: var(--surface); }
[data-theme="dark"] .hd-diag-btn { background: var(--bg); color: var(--ink-2); border-color: var(--line-2); }
[data-theme="dark"] .hd-diag-btn:hover { color: var(--blue); }
[data-theme="dark"] .hd-diag-btn[aria-pressed="true"] { background: var(--blue); color: #fff; }
[data-theme="dark"] .hd-verdict { background: var(--surface); }
[data-theme="dark"] .hd-vbtn { background: var(--surface); color: var(--ink-2); border-color: var(--line-2); }
[data-theme="dark"] .hd-diagram { background: var(--dark); border-color: var(--dark-line); }
[data-theme="dark"] .hd-diagram figcaption { color: var(--dark-muted); }
[data-theme="dark"] .hd-art, .hd-faq-item, .hd-check, .hd-related-card, .hd-cmd { background: var(--surface); border-color: var(--line); }
[data-theme="dark"] .hd-art-num, .hd-check-file { color: var(--ink-3); border-color: var(--line-2); }
[data-theme="dark"] .hd-cmd code { background: var(--bg); color: var(--ink); }
[data-theme="dark"] .hd-cmd-copy { background: var(--tint); color: var(--blue); }
[data-theme="dark"] .hd-check-list li label:hover { background: var(--tint); }
[data-theme="dark"] .hd-related-card:hover { border-color: var(--blue); }
[data-theme="dark"] .hd-risk-safe { color: #8fe6c4; background: rgba(47,191,143,.14); border-color: rgba(47,191,143,.5); }
[data-theme="dark"] .hd-risk-low { color: #f5c97a; background: rgba(245,180,83,.14); border-color: rgba(245,180,83,.5); }
[data-theme="dark"] .hd-risk-caution { color: #f0b078; background: rgba(224,142,60,.14); border-color: rgba(224,142,60,.5); }
[data-theme="dark"] .hd-risk-destructive { color: #f0a0a0; background: rgba(200,60,60,.16); border-color: rgba(200,60,60,.5); }
[data-theme="dark"] .hd-mistakes li::before { background: var(--warn); color: #2a1e00; }
[data-theme="dark"] .hd-localfoot { color: var(--ink-3); }
