/* ============================================================
   DiagMyPCHub — software tutorial (local)
   /software/software-installs-crashes-and-programs-that-suddenly-misbehave/css/style.css
   Page-specific styles only. Design tokens, shared components
   (.table-wrap, .callout, .check-item, .btn, footer, …) and the
   theme come from the root stylesheets. Everything here is
   scoped to the classes used on this page.
   ============================================================ */

/* ---------- Reading progress ---------- */
.progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0;
  background: var(--blue);
  z-index: 70;
  transition: width 0.1s linear;
}

/* ---------- Article layout ---------- */
.article-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  padding: clamp(32px, 5vw, 56px) 0 64px;
}

.toc { order: -1; }
.toc-title {
  font: 600 0.72rem var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  margin: 0 0 10px;
}
.toc-filter { margin-bottom: 12px; }
.toc-filter input {
  width: 100%;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
  border-radius: 8px;
  padding: 7px 10px;
  font: 400 0.82rem var(--font-body);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.toc-filter input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(15, 91, 215, 0.12); }
.toc-filter input::placeholder { color: var(--ink-3); }

.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-item { margin-bottom: 4px; }
.toc-item.is-hidden { display: none; }
.toc-list a {
  display: block;
  font-size: 0.8rem;
  color: var(--ink-2);
  text-decoration: none;
  border-left: 2px solid transparent;
  padding: 3px 0 3px 10px;
  transition: color 0.2s, border-color 0.2s;
}
.toc-list a:hover { color: var(--blue); }
.toc-list a.is-active { color: var(--blue); font-weight: 600; border-left-color: var(--blue); }
.toc-cat-link { font-weight: 600; color: var(--ink); margin-top: 6px; }
.toc-topics { list-style: none; margin: 2px 0 6px; padding: 0; }
.toc-topics li.is-hidden { display: none; }
.toc-topics a { font-size: 0.76rem; padding-left: 20px; color: var(--ink-3); }
.toc-topics a.is-active { color: var(--blue); border-left-color: var(--blue); }

@media (min-width: 560px) and (max-width: 1023px) {
  .toc-topics { display: none; }
  .toc-list { column-count: 2; column-gap: 18px; }
}
@media (min-width: 1024px) {
  .article-grid { grid-template-columns: 260px minmax(0, 1fr); gap: 48px; }
  .toc { order: 0; position: sticky; top: calc(var(--header-h) + 20px); align-self: start; max-height: calc(100vh - var(--header-h) - 40px); overflow-y: auto; padding-right: 8px; }
}

/* ---------- Article typography ---------- */
.article-main { min-width: 0; }
.article-head { margin-bottom: 24px; }
.article-head h1 {
  font-size: clamp(1.8rem, 1.2rem + 2.4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.12;
  margin: 8px 0 10px;
}
.article-sub { color: var(--ink-3); font-size: 0.9rem; margin: 0; }
.article-main > .lead { font-size: 1.08rem; color: var(--ink-2); }
.article-main p { margin: 0 0 14px; color: var(--ink-2); }
.article-main strong { color: var(--ink); }
.article-main a { text-decoration: underline; text-underline-offset: 2px; }
.article-main a:hover { text-decoration-thickness: 2px; }
.article-main code {
  font: 500 0.85em var(--font-mono);
  background: var(--tint);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  color: var(--ink);
  word-break: break-word;
}

.tut-section { margin-top: 52px; }
.tut-category { margin-top: 60px; }
.tut-category:first-of-type { margin-top: 52px; }
.tut-h2 {
  font-size: clamp(1.3rem, 1rem + 1.2vw, 1.65rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
}
.tut-num {
  flex: none;
  width: 30px; height: 30px;
  display: grid;
  place-items: center;
  font: 600 0.78rem var(--font-mono);
  color: var(--blue-deep);
  background: var(--tint);
  border: 1px solid var(--blue-soft);
  border-radius: 8px;
}
.cat-intro { color: var(--ink-2); max-width: 75ch; }
.cat-note { font-size: 0.82rem; color: var(--ink-3); margin-top: -6px; }

.tut-topic { margin-top: 34px; }
.topic-h {
  font-size: 1.12rem;
  font-weight: 600;
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 10px;
}
.topic-num { font: 600 0.74rem var(--font-mono); color: var(--ink-3); flex: none; }

.steps, .tut-list { margin: 0 0 14px; padding-left: 20px; list-style: decimal; color: var(--ink-2); }
.tut-list { list-style: disc; }
.steps li, .tut-list li { margin-bottom: 10px; }

[data-toc-target] { scroll-margin-top: calc(var(--header-h) + 16px); }

/* ---------- Image placeholder (hidden until data-src is valid) ---------- */
.article-figure { margin: 0 0 28px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.article-figure:has(.article-figure-img:not([src])) { display: none; }
.article-figure-img { width: 100%; height: auto; display: block; aspect-ratio: 16 / 8; object-fit: cover; }
.article-figure figcaption { padding: 10px 14px; font: 400 0.78rem var(--font-mono); color: var(--ink-3); border-top: 1px solid var(--line); }

/* ---------- Callouts (warn variant; .callout base is shared) ---------- */
.callout-warn { background: #fdf6e9; border-color: #e3c08a; }
.callout-warn p { color: #5c4a1e; }
.callout-warn .callout-ico { background: #c07f10; }
[data-theme="dark"] .callout-warn { background: #2a2110; border-color: #6b5426; }
[data-theme="dark"] .callout-warn p { color: #e8d5a8; }

/* ---------- Platform pills ---------- */
.plat {
  display: inline-block;
  font: 500 0.64rem var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--tint);
  color: var(--blue-deep);
  border: 1px solid var(--blue-soft);
  margin-right: 6px;
}
[data-theme="dark"] .plat { background: #16263f; color: #a9c9f8; border-color: #27466f; }

/* ---------- Risk badges (safety tables) ---------- */
.risk { font: 600 0.72rem var(--font-body); white-space: nowrap; }
.risk--safe { color: var(--ok); }
.risk--caution { color: var(--warn); }
.risk--no { color: #e2604f; }
[data-theme="dark"] .risk--no { color: #ff8a76; }

/* ---------- Expandable details ---------- */
.tut-details {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 14px 0;
}
.tut-details summary {
  cursor: pointer;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.tut-details summary::-webkit-details-marker { display: none; }
.tut-details summary::before {
  content: "+";
  flex: none;
  width: 20px; height: 20px;
  display: grid;
  place-items: center;
  font: 600 0.9rem var(--font-mono);
  color: var(--blue-deep);
  background: var(--tint);
  border-radius: 6px;
  transition: transform 0.2s;
}
.tut-details[open] summary::before { content: "–"; }
.tut-details-body { padding: 2px 16px 14px; }
.tut-details-body p { font-size: 0.92rem; }

/* ---------- Code blocks ---------- */
.code-block { background: var(--dark-2); border: 1px solid var(--dark-line); border-radius: 10px; margin: 14px 0; overflow: hidden; }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--dark-line); }
.code-lang { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--dark-muted); }
.copy-btn {
  font: 500 0.72rem var(--font-mono);
  color: var(--dark-muted);
  background: none;
  border: 1px solid var(--dark-line);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.copy-btn:hover, .copy-btn.is-done { color: var(--cyan-bright); border-color: var(--cyan-bright); }
.code-block pre { margin: 0; padding: 12px 14px; overflow-x: auto; }
.code-block code {
  font: 400 0.85rem/1.6 var(--font-mono);
  color: #cfe0f5;
  background: none;
  border: 0;
  padding: 0;
}

/* ---------- Interactive diagnostic checklist ---------- */
.check-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 20px;
  margin: 14px 0;
}
.check-set { border: 0; padding: 0; margin: 0 0 6px; display: grid; gap: 4px; }
.check-set .check-item label { font-size: 0.92rem; }
.check-results { border-top: 1px dashed var(--line-2); padding-top: 14px; margin-top: 10px; }
.check-results .check-hint { color: var(--ink-3); font-size: 0.86rem; margin: 0 0 10px; }
.check-suggests { display: grid; grid-template-columns: 1fr; gap: 8px; }
.check-suggests h3 { font: 600 0.72rem var(--font-mono); text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-3); margin: 8px 0 0; }
@media (min-width: 560px) { .check-suggests { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .check-suggests { grid-template-columns: repeat(3, 1fr); } }
.check-suggest {
  display: block;
  text-decoration: none;
  font-size: 0.85rem;
  color: var(--ink);
  background: var(--tint);
  border: 1px solid var(--blue-soft);
  border-radius: 8px;
  padding: 8px 10px;
  transition: border-color 0.2s, transform 0.2s;
}
.check-suggest:hover { border-color: var(--blue); transform: translateY(-2px); }
.check-suggest strong { display: block; font: 600 0.68rem var(--font-mono); color: var(--blue-deep); margin-bottom: 2px; }

/* ---------- SVG failure map ---------- */
.sf-figure { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(10px, 2vw, 20px); }
.sf-svg { width: 100%; height: auto; display: block; }
.sf-caption { font: 400 0.78rem var(--font-mono); color: var(--ink-3); margin: 12px 4px 0; }

.sf-gridline { stroke: var(--line); }
.sf-trace { stroke: var(--line-2); stroke-width: 2; }
.sf-flow { stroke: var(--cyan-bright); stroke-width: 2.4; opacity: 0.8; stroke-dasharray: 10 240; animation: sfflow 3.8s linear infinite; }
.sf-f1 { animation-delay: 0s; }
.sf-f2 { animation-delay: 0.6s; }
.sf-f3 { animation-delay: 1.2s; }
.sf-f4 { animation-delay: 1.8s; }
.sf-f5 { animation-delay: 2.4s; }
.sf-f6 { animation-delay: 3s; }
@keyframes sfflow { to { stroke-dashoffset: -250; } }

.sf-node rect { fill: var(--surface); stroke: var(--line-2); stroke-width: 2; transition: stroke 0.2s; }
.sf-label { font-family: var(--font-display); font-size: 16px; font-weight: 600; fill: var(--ink); }
.sf-sub { font-family: var(--font-mono); font-size: 9.5px; fill: var(--ink-3); }
.sf-dot { fill: var(--cyan-bright); }
.sf-pulse { fill: none; stroke: var(--cyan-bright); stroke-width: 1.5; opacity: 0; transform-box: fill-box; transform-origin: center; animation: sfpulse 3.2s ease-out infinite; }
@keyframes sfpulse {
  0% { transform: scale(0.5); opacity: 0.7; }
  70% { transform: scale(2); opacity: 0; }
  100% { opacity: 0; }
}
.sf-center rect { fill: var(--tint); stroke: var(--blue); stroke-width: 2.5; }
.sf-center .sf-label { fill: var(--blue-deep); }

/* ---------- Related links ---------- */
.related-links { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 560px) { .related-links { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .related-links { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Ad slot (shared #ad-slot pattern; wrapper spacing only) ---------- */
#ad-wrap { margin: 8px 0 4px; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .progress { transition: none; }
  .sf-flow { animation: none; stroke-dasharray: none; opacity: 0.35; }
  .sf-pulse { animation: none; opacity: 0; }
  .tut-details summary::before { transition: none; }
  .check-suggest { transition: none; }
}

/* ---------- Print ---------- */
@media print {
  .topbar, .site-header, .site-footer, .toc, .progress, .to-top, .toast, .consent, #ad-wrap, .breadcrumbs, .article-figure, .sf-figure, .check-filter, .toc-filter { display: none !important; }
  .article-grid { display: block; padding: 0; }
  body { background: #fff; }
}
