/* ============================================================
   DiagMyPCHub — My Computer Keeps Restarting tutorial
   Reuses the site's design tokens + shared components
   (.table-wrap, .callout, .btn, .breadcrumbs, .topbar, footer).
   All local classes are mcr- prefixed to avoid collisions.
   Dark theme is inherited automatically via css/theme-dark.css.
   ============================================================ */

/* ---------- Reading progress ---------- */
.mcr-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, var(--blue), var(--cyan-bright));
  z-index: 70;
}

/* ---------- Layout grid ---------- */
.mcr-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  padding: clamp(28px, 5vw, 52px) 0 clamp(48px, 7vw, 80px);
}

/* ---------- Sticky TOC ---------- */
.mcr-toc { display: none; }

/* ---------- Main article typography ---------- */
.mcr-main { max-width: 820px; }
.mcr-head { margin-bottom: 22px; }
.mcr-main h1 { font-size: clamp(1.9rem, 1.2rem + 2.6vw, 2.7rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; margin: 0 0 10px; }
.mcr-sub { font: 500 0.78rem/1.5 var(--font-mono); color: var(--ink-3); margin: 0; }
.mcr-main .lead { font-size: 1.06rem; color: var(--ink-2); }
.mcr-main p { color: var(--ink-2); }
.mcr-main strong { color: var(--ink); font-weight: 600; }
.mcr-main a { text-decoration: underline; text-underline-offset: 2px; }
.mcr-main a:hover { text-decoration-thickness: 2px; }
.mcr-main code { font: 500 0.86em var(--font-mono); background: var(--tint); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; color: var(--ink); }
.mcr-main kbd { font: 600 0.82em var(--font-mono); background: var(--tint); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; color: var(--ink); }

/* ---------- Sections ---------- */
.mcr-sec { margin-top: clamp(34px, 5vw, 52px); scroll-margin-top: calc(var(--header-h) + 20px); }
.mcr-sec h2 { font-size: clamp(1.4rem, 1rem + 1.4vw, 1.85rem); font-weight: 600; letter-spacing: -0.01em; margin: 0 0 14px; }

/* ---------- Image placeholder (auto-hides when empty) ---------- */
.mcr-figure {
  position: relative;
  display: none;
  margin: 0 0 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--tint);
}
.mcr-figure.is-visible { display: block; }
.mcr-figure-img { display: block; width: 100%; height: auto; }
.mcr-figure figcaption {
  font-size: 0.8rem;
  color: var(--ink-3);
  padding: 10px 14px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

/* ---------- Decision helper ---------- */
.mcr-helper-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: clamp(16px, 3vw, 24px);
}
.mcr-helper-card fieldset { border: 0; margin: 0 0 16px; padding: 0; min-width: 0; }
.mcr-helper-card fieldset:last-of-type { margin-bottom: 0; }
.mcr-helper-card legend { font-weight: 600; color: var(--ink); font-size: 0.95rem; padding: 0 0 8px; }
.mcr-helper-card fieldset label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 14px 6px 0;
  padding: 6px 14px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--ink-2);
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.mcr-helper-card fieldset label:hover { border-color: var(--blue); }
.mcr-helper-card input[type="radio"] { width: 15px; height: 15px; accent-color: var(--blue); margin: 0; }
.mcr-helper-card input[type="radio"]:checked + span { color: var(--ink); }
.mcr-helper-card fieldset label:has(input:checked) { border-color: var(--blue); background: var(--tint); color: var(--ink); }
.mcr-helper-results { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.mcr-helper-hint { font-size: 0.85rem; color: var(--ink-3); margin: 0; }
.mcr-helper-recs { margin: 10px 0 0; display: grid; gap: 8px; }
.mcr-helper-recs a { display: inline-block; font-size: 0.9rem; text-decoration: none; color: var(--blue); padding: 4px 0; }
.mcr-helper-recs a:hover { text-decoration: underline; }

/* ---------- Interactive checklist ---------- */
.mcr-checklist { list-style: none; margin: 0 0 16px; padding: 0; counter-reset: mcrstep; display: grid; gap: 10px; }
.mcr-checklist li { counter-increment: mcrstep; }
.mcr-checklist label {
  position: relative;
  display: block;
  padding: 12px 14px 12px 52px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-2);
  font-size: 0.94rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.mcr-checklist label:hover { border-color: var(--blue); }
.mcr-checklist li::before {
  content: counter(mcrstep);
  position: absolute;
  left: 14px; top: 14px;
  width: 26px; height: 26px;
  display: grid;
  place-items: center;
  font: 600 0.8rem var(--font-mono);
  color: var(--blue-deep);
  background: var(--tint);
  border: 1px solid var(--blue-soft);
  border-radius: 8px;
}
.mcr-check { position: absolute; left: 14px; top: 14px; width: 26px; height: 26px; accent-color: var(--blue); margin: 0; cursor: pointer; }
.mcr-checklist li:has(.mcr-check:checked)::before { content: "✓"; background: #eafaf3; border-color: #9fe0c6; color: var(--ok); }
.mcr-checklist li:has(.mcr-check:checked) { border-color: #9fe0c6; }
.mcr-checklist li:has(.mcr-check:checked) span { color: var(--ink); }
.mcr-checklist span { position: relative; }
.mcr-checklist a { color: var(--blue); }
.mcr-check-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.mcr-check-progress { font: 500 0.76rem var(--font-mono); color: var(--ink-3); }

/* ---------- Callout variants (shared .callout provides base) ---------- */
.callout-warn { background: #fdf6e9; border-color: #e3c08a; }
.callout-warn .callout-ico { background: #c98a2b; }
.callout-warn p { color: #6b4e1e; }
.callout-tip { background: var(--tint); border-color: var(--blue-soft); }
.callout-tip .callout-ico { background: var(--blue); }

/* ---------- Severity badges ---------- */
.mcr-sev {
  display: inline-block;
  font: 500 0.68rem var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.mcr-sev-low { color: #14532d; background: #eafaf3; border: 1px solid #9fe0c6; }
.mcr-sev-med { color: #6b4e1e; background: #fdf6e9; border: 1px solid #e3c08a; }
.mcr-sev-high { color: #7f1d1d; background: #fdeaea; border: 1px solid #f2b8b8; }

/* ---------- Part (category) ---------- */
.mcr-part { margin-top: clamp(40px, 6vw, 60px); scroll-margin-top: calc(var(--header-h) + 20px); }
.mcr-part-title { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2rem); font-weight: 700; letter-spacing: -0.02em; margin: 0 0 8px; }
.mcr-part-intro { color: var(--ink-2); margin: 0 0 16px; max-width: 70ch; }
.mcr-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.mcr-chips a {
  font: 500 0.76rem var(--font-mono);
  color: var(--ink-2);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 5px 12px;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.mcr-chips a:hover { border-color: var(--blue); color: var(--blue); background: var(--tint); }

/* ---------- Article (details) ---------- */
.mcr-article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 12px;
  overflow: hidden;
  scroll-margin-top: calc(var(--header-h) + 20px);
  transition: border-color 0.2s;
}
.mcr-article[open] { border-color: var(--blue-soft); }
.mcr-article.mcr-hidden { display: none; }
.mcr-a-sum {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  transition: background 0.2s;
}
.mcr-a-sum::-webkit-details-marker { display: none; }
.mcr-a-sum:hover { background: var(--tint); }
.mcr-a-num {
  flex: none;
  font: 600 0.72rem var(--font-mono);
  color: var(--ink-3);
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: 7px;
  padding: 3px 6px;
}
.mcr-a-sum-title { font: 600 1.02rem var(--font-body); color: var(--ink); flex: 1; }
.mcr-article[open] .mcr-a-sum-title { display: none; }
.mcr-a-ico { position: relative; width: 16px; height: 16px; flex: none; }
.mcr-a-ico::before, .mcr-a-ico::after {
  content: "";
  position: absolute;
  left: 0; top: 7px;
  width: 16px; height: 2px;
  background: var(--ink-3);
  transition: transform 0.25s, background 0.25s;
}
.mcr-a-ico::after { transform: rotate(90deg); }
.mcr-article[open] .mcr-a-ico::after { transform: rotate(0deg); }
.mcr-article[open] .mcr-a-ico::before,
.mcr-article[open] .mcr-a-ico::after { background: var(--blue); }
.mcr-a-body { padding: 0 16px 20px; }
.mcr-a-title { font-size: 1.15rem; font-weight: 600; margin: 4px 0 12px; color: var(--ink); }
.mcr-a-body p { margin: 0 0 12px; font-size: 0.96rem; }
.mcr-a-body .table-wrap { margin: 4px 0 14px; }

/* numbered recovery ladder */
.mcr-steps { margin: 0 0 12px; padding-left: 0; list-style: none; counter-reset: mcrstep; display: grid; gap: 8px; }
.mcr-steps li { counter-increment: mcrstep; position: relative; padding: 10px 12px 10px 44px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink-2); font-size: 0.94rem; }
.mcr-steps li::before {
  content: counter(mcrstep);
  position: absolute; left: 12px; top: 10px;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  font: 600 0.76rem var(--font-mono);
  color: var(--blue-deep);
  background: var(--tint);
  border: 1px solid var(--blue-soft);
  border-radius: 7px;
}
.mcr-steps a { color: var(--blue); }

/* prev/next */
.mcr-a-nav { display: flex; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.mcr-nav { flex: 1; font-size: 0.82rem; color: var(--ink-3); text-decoration: none; display: flex; flex-direction: column; gap: 2px; }
.mcr-nav.next { text-align: right; align-items: flex-end; }
.mcr-nav span { font: 500 0.66rem var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; }
.mcr-nav:hover { color: var(--blue); }
.mcr-nav:hover span { color: var(--blue); }

/* ---------- Code block + copy ---------- */
.mcr-code { margin: 4px 0 14px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.mcr-code-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; background: #f8fafc; border-bottom: 1px solid var(--line); }
.mcr-code-head .mono { font-size: 0.7rem; color: var(--ink-3); letter-spacing: 0.05em; }
.mcr-code pre { margin: 0; padding: 12px 14px; overflow-x: auto; }
.mcr-code code { font: 400 0.84rem/1.6 var(--font-mono); background: none; border: 0; padding: 0; color: var(--ink); }
.mcr-copy {
  font: 500 0.72rem var(--font-mono);
  color: var(--ink-2);
  background: none;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  padding: 4px 10px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.mcr-copy:hover { border-color: var(--blue); color: var(--blue); }
.mcr-copy.is-done { color: var(--ok); border-color: var(--ok); background: #eafaf3; }

/* ---------- Search ---------- */
.mcr-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: clamp(34px, 5vw, 52px); padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.mcr-search { flex: 1; min-width: 240px; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1.5px solid var(--line-2); border-radius: 10px; padding: 8px 12px; transition: border-color 0.2s, box-shadow 0.2s; }
.mcr-search:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(15, 91, 215, 0.12); }
.mcr-search input { flex: 1; min-width: 0; border: 0; background: transparent; font: 400 0.95rem var(--font-body); color: var(--ink); }
.mcr-search input:focus { outline: none; }
.mcr-search input::placeholder { color: var(--ink-3); }
.mcr-search-count { font: 500 0.74rem var(--font-mono); color: var(--ink-3); margin: 0; }

/* ---------- Animated circuit SVG (restart loop) ---------- */
.mcr-pf-figure { margin: 0 0 8px; background: #081324; border: 1px solid #1d3a5f; border-radius: 14px; padding: clamp(8px, 2vw, 16px); }
.mcr-svg { width: 100%; height: auto; display: block; }
.mcr-gridline { stroke: #12263f; stroke-width: 1; }
.mcr-ring { fill: none; stroke: #24466f; stroke-width: 2; }
.mcr-pulse { stroke: #41e2f5; stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 24 855.6; opacity: 0.9; }
.mcr-p1 { animation: mcr-flow 4s linear infinite; }
.mcr-p2 { animation: mcr-flow 4s linear infinite; animation-delay: 2s; }
@keyframes mcr-flow { to { stroke-dashoffset: -880; } }
.mcr-node rect { fill: #0e2038; stroke: #2e5f93; stroke-width: 1.5; }
.mcr-label { fill: #dbe7f7; font: 600 15px var(--font-mono); letter-spacing: 1px; }
.mcr-sub { fill: #8aa3c4; font: 400 11px var(--font-mono); }
.mcr-hub-bg { fill: #2a2110; stroke: #e3c08a; stroke-width: 1.5; }
.mcr-hub-icon path, .mcr-hub-icon polyline { stroke: #f5b453; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.mcr-hub-label { fill: #f5b453; font: 600 12px var(--font-mono); letter-spacing: 2px; }
.mcr-hub { animation: mcr-hubpulse 4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes mcr-hubpulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
.mcr-pf-caption { font-size: 0.78rem; color: #8aa3c4; margin: 12px 4px 4px; }

/* ---------- FAQ ---------- */
.mcr-faq-item { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 10px; overflow: hidden; transition: border-color 0.2s; }
.mcr-faq-item[open] { border-color: var(--blue-soft); }
.mcr-faq-btn { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 15px 16px; font: 600 0.98rem var(--font-body); color: var(--ink); }
.mcr-faq-btn::-webkit-details-marker { display: none; }
.mcr-faq-ico { margin-left: auto; position: relative; width: 14px; height: 14px; flex: none; }
.mcr-faq-ico::before, .mcr-faq-ico::after { content: ""; position: absolute; left: 0; top: 6px; width: 14px; height: 2px; background: var(--ink-3); transition: transform 0.25s, background 0.25s; }
.mcr-faq-ico::after { transform: rotate(90deg); }
.mcr-faq-item[open] .mcr-faq-ico::after { transform: rotate(0deg); }
.mcr-faq-item[open] .mcr-faq-ico::before, .mcr-faq-item[open] .mcr-faq-ico::after { background: var(--blue); }
.mcr-faq-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.3s ease; }
.mcr-faq-item[open] .mcr-faq-panel { grid-template-rows: 1fr; }
.mcr-faq-in { overflow: hidden; min-height: 0; }
.mcr-faq-in p { margin: 0; padding: 0 16px 16px; font-size: 0.93rem; color: var(--ink-2); }

/* ---------- Related ---------- */
.mcr-related-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.mcr-related-card { display: flex; flex-direction: column; gap: 6px; padding: 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; }
.mcr-related-card:hover, .mcr-related-card:focus-visible { border-color: var(--blue); transform: translateY(-3px); box-shadow: var(--shadow-1); }
.mcr-related-tag { font: 500 0.66rem var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--blue-deep); background: var(--tint); border: 1px solid var(--blue-soft); border-radius: 999px; padding: 3px 9px; align-self: flex-start; }
.mcr-related-title { font: 600 1.05rem var(--font-display); }
.mcr-related-desc { font-size: 0.86rem; color: var(--ink-2); }

/* ---------- Responsive ---------- */

@media (min-width: 700px) {
  .mcr-related-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1000px) {
  .mcr-grid { grid-template-columns: 240px minmax(0, 1fr); gap: 52px; }
  .mcr-toc { display: block; position: sticky; top: calc(var(--header-h) + 24px); align-self: start; }
  .mcr-toc-title { font: 500 0.7rem var(--font-mono); text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-3); margin: 0 0 10px; }
  .mcr-toc-list { list-style: none; counter-reset: mcrtoc; display: grid; gap: 2px; }
  .mcr-toc-list a { position: relative; display: block; padding: 6px 0 6px 18px; font-size: 0.86rem; color: var(--ink-2); text-decoration: none; border-left: 2px solid var(--line); transition: color 0.2s, border-color 0.2s; }
  .mcr-toc-list a:hover { color: var(--ink); border-left-color: var(--blue); }
  .mcr-toc-list a.is-active { color: var(--blue); border-left-color: var(--blue); font-weight: 500; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .mcr-progress { display: none; }
  .mcr-p1, .mcr-p2 { animation: none; stroke-dasharray: none; opacity: 0.3; }
  .mcr-hub { animation: none; }
  .mcr-faq-panel { transition: none; }
  .mcr-article { transition: none; }
}
