/* ============================================================
   DiagMyPCHub — Storage troubleshooting series
   Tutorial-specific styles only. Tokens, buttons, callouts,
   tables, breadcrumbs, header/footer/nav, consent, toast and the
   dark theme come from the shared stylesheets loaded before this.
   ============================================================ */

/* ---------- Reading progress ---------- */
.progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--cyan); z-index: 60; transition: width 80ms linear; }

/* ---------- Layout: sticky TOC + article ---------- */
.article-grid { display: block; padding: clamp(28px, 5vw, 56px) 0 64px; }
.toc { margin-bottom: 32px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.toc-title { font: 500 0.7rem var(--font-mono); text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-3); margin: 0 0 12px; }
.toc-list { list-style: none; column-count: 2; column-gap: 20px; }
.toc-list li { break-inside: avoid; margin-bottom: 7px; }
.toc-list a { font-size: 0.82rem; color: var(--ink-2); text-decoration: none; border-left: 2px solid transparent; padding-left: 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); }

/* ---------- Article head / intro ---------- */
.article-main { max-width: 780px; }
.article-head { margin-bottom: 24px; }
.article-head h1 { font-size: clamp(1.9rem, 1.1rem + 3vw, 2.8rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1.08; margin: 0 0 12px; }
.article-sub { color: var(--ink-3); margin: 0; }
.article-intro { display: grid; gap: 12px; margin-bottom: 8px; }
.lead { font-size: 1.06rem; color: var(--ink-2); line-height: 1.7; margin: 0; }

/* ---------- Start here ---------- */
.start-here { background: var(--tint); border: 1px solid var(--blue-soft); border-radius: var(--radius); padding: 20px; margin: 20px 0 8px; }
.start-here h2 { font-size: 1.25rem; font-weight: 700; margin: 0 0 8px; }
.start-here p { color: var(--ink-2); margin: 0 0 12px; }
.start-here ol { margin: 0; padding-left: 20px; color: var(--ink-2); }
.start-here li { margin-bottom: 8px; line-height: 1.6; }
.start-here a { color: var(--blue); }

/* ---------- Finder: search + filters ---------- */
.finder { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 20px 0; }
.search-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.search-input { flex: 1 1 240px; font: 400 0.95rem var(--font-body); padding: 10px 14px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg); color: var(--ink); }
.search-input::placeholder { color: var(--ink-3); }
.search-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(15, 91, 215, 0.12); }
.search-count { font: 500 0.78rem var(--font-mono); color: var(--ink-3); white-space: nowrap; }
.filter-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.filter-label { font: 500 0.72rem var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); margin-right: 4px; }
.filter-btn { font: 500 0.82rem var(--font-body); padding: 6px 13px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); color: var(--ink-2); cursor: pointer; transition: border-color 0.15s, color 0.15s, background 0.15s; }
.filter-btn:hover { border-color: var(--blue); color: var(--blue); }
.filter-btn.is-on { background: var(--blue); border-color: var(--blue); color: #fff; }
.finder-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.no-results { margin: 16px 0; padding: 20px; border: 1px dashed var(--line-2); border-radius: var(--radius); text-align: center; color: var(--ink-2); }
.no-results p { margin: 0; }
.no-results .filter-btn { margin-left: 6px; }

/* ---------- Category ---------- */
.cat { margin-top: clamp(40px, 6vw, 56px); scroll-margin-top: calc(var(--header-h) + 16px); }
.cat[hidden] { display: none; }
.cat-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 6px; flex-wrap: wrap; }
.cat-num { font: 600 1rem var(--font-mono); color: var(--line-2); flex: none; }
.cat-title { font-size: clamp(1.4rem, 1rem + 1.4vw, 1.9rem); font-weight: 700; letter-spacing: -0.01em; margin: 0; flex: 1 1 240px; }
.cat-count { font: 500 0.78rem var(--font-mono); color: var(--ink-3); }
.cat-intro { color: var(--ink-2); max-width: 72ch; margin-bottom: 18px; }
.cat-intro p { margin: 0 0 12px; line-height: 1.65; }

/* ---------- Tutorial (details) ---------- */
.tut { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.tut[hidden] { display: none; }
.tut > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 14px 16px; flex-wrap: wrap; }
.tut > summary::-webkit-details-marker { display: none; }
.tut > summary:hover { background: var(--tint); }
.tut > summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.tut-num { font: 600 0.8rem var(--font-mono); color: var(--line-2); flex: none; }
.tut-title { font-weight: 600; font-size: 1rem; color: var(--ink); flex: 1 1 240px; line-height: 1.35; }
.tut-meta { display: flex; gap: 6px; flex: none; flex-wrap: wrap; }
.tut-chevron { flex: none; width: 22px; height: 22px; display: grid; place-items: center; color: var(--blue); }
.tut-chevron::before { content: "+"; font: 600 1.15rem var(--font-mono); transition: transform 0.2s; }
.tut[open] .tut-chevron::before { transform: rotate(45deg); }
.tut-body { padding: 0 16px 18px; border-top: 1px solid var(--line); }
.tut-body > p { color: var(--ink-2); line-height: 1.65; margin: 14px 0; }
.tut-body p strong { color: var(--ink); }
.tut-body h4 { font-size: 0.95rem; font-weight: 600; color: var(--ink); margin: 18px 0 8px; }
.tut-body ol, .tut-body ul { margin: 12px 0; padding-left: 20px; color: var(--ink-2); }
.tut-body li { margin-bottom: 8px; line-height: 1.55; }
.tut-body code { font: 500 0.85em var(--font-mono); background: var(--tint); border-radius: 5px; padding: 1px 6px; color: var(--ink); }
.tut-body a { color: var(--blue); text-decoration: underline; }
.tut-related { font-size: 0.88rem; color: var(--ink-3); margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line); }

/* ---------- Difficulty + platform pills (text + colour) ---------- */
.diff, .plat { font: 500 0.66rem var(--font-mono); text-transform: uppercase; letter-spacing: 0.04em; border-radius: 999px; padding: 2px 9px; border: 1px solid transparent; white-space: nowrap; }
.diff-beginner { color: #1f8a63; background: #e6f6ef; border-color: #bfe6d6; }
.diff-intermediate { color: #8a6a1f; background: #fdf3dd; border-color: #eeddb0; }
.diff-advanced { color: #b23b3b; background: #fbe9e9; border-color: #f0c6c6; }
.plat { border-color: var(--line-2); color: var(--ink-2); background: var(--surface); }
.plat-linux, .plat-windows { color: var(--blue-deep); background: var(--tint); border-color: var(--blue-soft); }
.plat-mac { color: #4a5568; }
.plat-any { color: var(--ink-3); }
[data-theme="dark"] .diff-beginner { color: #7fe0bd; background: #0f2c22; border-color: #2f6b52; }
[data-theme="dark"] .diff-intermediate { color: #f2cf8b; background: #2c2410; border-color: #6b5426; }
[data-theme="dark"] .diff-advanced { color: #f3a3a3; background: #331616; border-color: #7a2f2f; }
[data-theme="dark"] .plat-mac { color: var(--ink-2); }

/* ---------- Code blocks + copy ---------- */
.code-block { background: var(--dark-2); border: 1px solid var(--dark-line); border-radius: var(--radius); 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); background: rgba(0, 0, 0, 0.15); }
.code-lang { font: 500 0.68rem var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--dark-muted); }
.copy-btn { font: 500 0.72rem var(--font-mono); color: var(--dark-ink); background: none; border: 1px solid var(--dark-line); border-radius: 7px; padding: 5px 12px; cursor: pointer; transition: border-color 0.2s, color 0.2s; }
.copy-btn:hover { border-color: var(--cyan-bright); color: var(--cyan-bright); }
.copy-btn.is-done { border-color: var(--ok); color: var(--ok); }
.code-block pre { margin: 0; padding: 14px 16px; overflow-x: auto; font: 400 0.82rem/1.7 var(--font-mono); color: #d7e6fb; }
.code-block code { background: none; padding: 0; color: inherit; }

/* ---------- Callout variants (base .callout is shared) ---------- */
.callout-warn { background: #fdf6e9; border-color: #e3c08a; }
.callout-warn p { color: #6b5322; }
.callout-tip { background: #e9f7f2; border-color: #9adcc4; }
.callout-tip p { color: #1c6b52; }
[data-theme="dark"] .callout-warn { background: #2a2110; border-color: #6b5426; }
[data-theme="dark"] .callout-warn p { color: #f0d9a8; }
[data-theme="dark"] .callout-tip { background: #0f2c22; border-color: #2f6b52; }
[data-theme="dark"] .callout-tip p { color: #a7e6cf; }

/* ---------- Image placeholder (auto-hidden) ---------- */
.article-figure { display: none; margin: 20px 0 8px; }
.article-figure.is-visible { display: block; }
.article-figure-img { width: 100%; height: auto; display: block; border-radius: var(--radius); border: 1px solid var(--line); }
.article-figure figcaption { font-size: 0.82rem; color: var(--ink-3); margin-top: 10px; }

/* ---------- Animated storage SVG ---------- */
.storage-fig { margin: 24px 0; }
.st-svg { width: 100%; height: auto; display: block; max-width: 720px; }
.st-cap { font-size: 0.82rem; color: var(--ink-3); margin: 12px 0 0; max-width: 60ch; }
.st-grid { stroke: var(--line); }
.st-box { fill: var(--surface); stroke: var(--line-2); stroke-width: 2; }
.st-label { fill: var(--ink); font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.st-sub { fill: var(--ink-3); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.5px; }
.st-trace { stroke: var(--line-2); stroke-width: 2; fill: none; }
.st-flow { stroke: var(--cyan-bright); stroke-width: 2.4; fill: none; stroke-dasharray: 10 200; opacity: 0.85; animation: stflow 3.4s linear infinite; }
.st-f2 { animation-delay: 0.5s; }
@keyframes stflow { to { stroke-dashoffset: -210; } }
.st-platter { fill: var(--surface); stroke: var(--line-2); stroke-width: 2; }
.st-ring { fill: none; stroke: var(--line-2); stroke-width: 1.5; opacity: 0.7; }
.st-hub { fill: var(--tint); stroke: var(--line-2); }
.st-head { fill: var(--cyan-bright); }
.st-scan { stroke: var(--cyan-bright); stroke-width: 2; opacity: 0.5; animation: stscan 4s ease-in-out infinite alternate; }
@keyframes stscan { from { transform: translateX(0); } to { transform: translateX(168px); } }
.st-sector { fill: var(--tint); stroke: var(--line-2); stroke-width: 1.5; }
.st-on { animation: stsec 2.6s ease-in-out infinite; }
.st-on.s2 { animation-delay: 0.2s; } .st-on.s3 { animation-delay: 0.4s; }
.st-on.s4 { animation-delay: 0.6s; } .st-on.s5 { animation-delay: 0.8s; }
.st-on.s6 { animation-delay: 1s; } .st-on.s7 { animation-delay: 1.2s; }
.st-on.s8 { animation-delay: 1.4s; }
@keyframes stsec { 0%, 100% { fill: var(--tint); opacity: 1; } 50% { fill: var(--cyan); opacity: 0.9; } }
.st-pulse { fill: none; stroke: var(--cyan-bright); stroke-width: 2; opacity: 0; transform-box: fill-box; transform-origin: center; animation: stpulse 3s ease-out infinite; }
@keyframes stpulse { 0% { transform: scale(0.4); opacity: 0.6; } 70% { transform: scale(2); opacity: 0; } 100% { opacity: 0; } }

/* ---------- Related ---------- */
.related-links { list-style: none; padding: 0; display: grid; gap: 10px; }
.related-links a { display: inline-flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; font-weight: 500; transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s; }
.related-links a::before { content: "→"; color: var(--blue); }
.related-links a:hover { border-color: var(--blue); transform: translateY(-2px); box-shadow: var(--shadow-1); }

/* ---------- Ad spacing (shared ad slot) ---------- */
.article-main .ad-wrap { margin: 32px 0; }

/* ---------- Responsive ---------- */
@media (min-width: 560px) { .cat-intro { max-width: 78ch; } }
@media (min-width: 1024px) {
  .article-grid { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 48px; align-items: start; }
  .toc { position: sticky; top: calc(var(--header-h) + 20px); margin-bottom: 0; max-height: calc(100vh - var(--header-h) - 40px); overflow-y: auto; }
  .toc-list { column-count: 1; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .progress { transition: none; }
  .st-flow { animation: none; stroke-dasharray: none; opacity: 0.35; }
  .st-scan { animation: none; opacity: 0.25; }
  .st-on { animation: none; }
  .st-pulse { animation: none; opacity: 0; }
  .tut-chevron::before { transition: none; }
}
