/* ============================================================
   DiagMyPCHub — Audio troubleshooting tutorial
   Local stylesheet. Depends on the site design tokens from
   ../../../css/style.css (loaded first in <head>). All tutorial
   styles are namespaced with the "aud-" prefix to avoid leaking
   into the rest of the site.
   ============================================================ */

/* ---------- Reading progress ---------- */
.aud-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 120; background: transparent; pointer-events: none; }
.aud-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--cyan-bright)); }

/* ---------- Grid: TOC + article ---------- */
.aud-grid { display: grid; grid-template-columns: 1fr; gap: 40px; padding-top: clamp(32px, 5vw, 56px); padding-bottom: clamp(56px, 8vw, 96px); }
.aud-toc { display: none; }
.aud-toc-title { font: 500 .7rem var(--font-mono); text-transform: uppercase; letter-spacing: .14em; color: var(--ink-3); margin: 0 0 12px; }
.aud-toc ul { display: grid; gap: 1px; border-left: 1px solid var(--line); }
.aud-toc a { display: block; padding: 6px 14px; margin-left: -1px; border-left: 2px solid transparent; color: var(--ink-2); text-decoration: none; font-size: .85rem; transition: color .2s, border-color .2s; }
.aud-toc a:hover { color: var(--ink); }
.aud-toc a[aria-current="true"] { color: var(--blue); border-left-color: var(--blue); font-weight: 500; }

/* ---------- Article head ---------- */
.aud-article { max-width: 820px; }
.aud-head h1 { font-size: clamp(1.8rem, 1.2rem + 2.4vw, 2.7rem); font-weight: 700; letter-spacing: -.02em; line-height: 1.12; margin: 0 0 20px; }
.aud-intro { font-size: 1.05rem; color: var(--ink-2); line-height: 1.7; margin: 0 0 16px; }

/* ---------- Warning / callouts ---------- */
.aud-warn { display: flex; gap: 14px; align-items: flex-start; background: #fdf3e6; border: 1px solid #f0d6a8; border-radius: var(--radius); padding: 16px 18px; margin: 28px 0; }
.aud-warn-ico { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--warn); color: #3a2a00; font: 700 .95rem/1 var(--font-display); }
.aud-warn-title { margin: 0 0 6px; font-weight: 600; font-size: .98rem; }
.aud-warn-text { margin: 0; font-size: .92rem; color: #6b5320; }
.aud-callout { border-left: 3px solid var(--blue); background: var(--tint); border-radius: 0 var(--radius) var(--radius) 0; padding: 14px 18px; margin: 24px 0; font-size: .95rem; color: var(--ink-2); }
.aud-callout p { margin: 0; }
.aud-callout strong { color: var(--ink); }
.aud-callout.aud-tip { border-left-color: var(--ok); background: #eafaf3; }
.aud-callout.aud-note { border-left-color: var(--cyan); background: #eafaf7; }

/* ---------- Static image placeholder (hidden until an image exists) ---------- */
.aud-figure { margin: 0 0 8px; }
.aud-figure img { width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); display: block; }
.aud-figure figcaption { margin-top: 10px; font: 400 .78rem var(--font-mono); color: var(--ink-3); }
.aud-figure[data-empty="true"] { display: none; }

/* ---------- Sections ---------- */
.aud-sec { margin-top: clamp(48px, 7vw, 72px); scroll-margin-top: calc(var(--header-h) + 16px); }
.aud-sec-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.aud-sec-index { font: 600 .95rem var(--font-mono); color: var(--line-2); flex: none; padding-top: 4px; }
.aud-sec-kicker { font: 500 .7rem var(--font-mono); text-transform: uppercase; letter-spacing: .16em; color: var(--blue); margin: 0 0 4px; }
.aud-sec-head h2 { font-size: clamp(1.3rem, 1rem + 1.2vw, 1.7rem); font-weight: 600; letter-spacing: -.01em; margin: 0; }
.aud-sec-lede { color: var(--ink-2); font-size: 1rem; line-height: 1.7; margin: 0 0 18px; max-width: 70ch; }
.aud-article p { color: var(--ink-2); line-height: 1.75; margin: 0 0 16px; }
.aud-article p strong, .aud-article p em { color: var(--ink); }
.aud-article a { color: var(--blue); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--blue-soft); transition: text-decoration-color .2s; }
.aud-article a:hover { text-decoration-color: var(--blue); }
.aud-article h3 { font-size: 1.15rem; font-weight: 600; margin: 28px 0 12px; }
.aud-article ul, .aud-article ol { margin: 0 0 16px; padding-left: 22px; color: var(--ink-2); line-height: 1.7; }
.aud-article li { margin-bottom: 8px; }
.aud-article li::marker { color: var(--blue); }

/* ---------- Ordered steps ---------- */
.aud-steps { counter-reset: aud-step; list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 12px; }
.aud-steps > li { counter-increment: aud-step; position: relative; padding: 0 0 0 46px; margin: 0; min-height: 40px; }
.aud-steps > li::before { content: counter(aud-step, decimal-leading-zero); position: absolute; left: 0; top: 0; width: 32px; height: 32px; display: grid; place-items: center; font: 600 .78rem var(--font-mono); color: var(--blue-deep); background: var(--tint); border: 1px solid var(--blue-soft); border-radius: 9px; }
.aud-steps > li strong { color: var(--ink); }

/* ---------- "Do not" list ---------- */
.aud-dont { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 10px; }
.aud-dont li { position: relative; padding: 2px 0 2px 34px; margin: 0; }
.aud-dont li::before { content: "\2715"; position: absolute; left: 0; top: 0; color: #d9534f; font-weight: 700; }
.aud-dont li strong { color: var(--ink); }

/* ---------- Find-your-problem cards + filter ---------- */
.aud-cards { margin: 8px 0; }
.aud-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.aud-filter-btn { font: 500 .8rem var(--font-mono); color: var(--ink-2); background: var(--surface); border: 1px solid var(--line-2); border-radius: 999px; padding: 8px 15px; cursor: pointer; transition: border-color .2s, color .2s, background .2s; }
.aud-filter-btn:hover { border-color: var(--blue); color: var(--blue); }
.aud-filter-btn.is-active { background: var(--blue); border-color: var(--blue); color: #fff; }
.aud-filter-hint { font-size: .82rem; color: var(--ink-3); margin: 0 0 14px; min-height: 1.3em; }
.aud-card-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.aud-card { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); transition: border-color .2s, transform .2s, box-shadow .2s; }
.aud-card:hover, .aud-card:focus-visible { border-color: var(--blue); transform: translateY(-2px); box-shadow: var(--shadow-1); }
.aud-card.is-hidden { display: none; }
.aud-card-num { font: 600 .72rem var(--font-mono); color: var(--line-2); }
.aud-card-title { font-size: 1rem; font-weight: 600; margin: 0; }
.aud-card-sub { font-size: .83rem; color: var(--ink-2); margin: 0; }
.aud-empty { font-size: .9rem; color: var(--ink-3); }

/* ---------- Decision flow ---------- */
.aud-decide { margin: 24px 0; }
.aud-diag-opts { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 16px; }
.aud-diag-btn { text-align: left; font: 500 .95rem var(--font-body); color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; transition: border-color .2s, background .2s, transform .15s; }
.aud-diag-btn:hover { border-color: var(--blue); background: var(--tint); transform: translateY(-1px); }
.aud-diag-btn.is-active { border-color: var(--blue); background: var(--tint); box-shadow: inset 3px 0 0 var(--blue); }
.aud-diag-hint { font-size: .85rem; color: var(--ink-3); margin: 0 0 6px; min-height: 1.4em; }
.aud-diag-result { border: 1px solid var(--line); border-left: 3px solid var(--cyan); border-radius: var(--radius); background: var(--surface); padding: 18px 20px; margin-bottom: 12px; }
.aud-diag-path p { margin: 0 0 12px; font-size: .95rem; color: var(--ink-2); line-height: 1.7; }
.aud-diag-path p:last-child { margin-bottom: 0; }
.aud-diag-path strong { color: var(--ink); }

/* ---------- Verdict ---------- */
.aud-verdict { margin: 40px 0; padding: 22px; background: var(--dark-2); color: var(--dark-ink); border: 1px solid var(--dark-line); border-radius: 14px; }
.aud-verdict-label { margin: 0 0 14px; font: 600 1.05rem var(--font-display); }
.aud-verdict-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.aud-vbtn { font: 500 .88rem var(--font-body); color: var(--dark-ink); background: transparent; border: 1px solid var(--dark-line); border-radius: 10px; padding: 10px 16px; cursor: pointer; transition: border-color .2s, background .2s, color .2s; }
.aud-vbtn:hover { border-color: var(--cyan-bright); color: #fff; }
.aud-vbtn.is-active { background: var(--cyan); border-color: var(--cyan); color: #04222a; }
.aud-verdict-msg { margin: 0; font-size: .9rem; color: var(--dark-muted); min-height: 1.4em; }

/* ---------- Animated SVG diagram ---------- */
.aud-diagram { margin: 32px 0; background: var(--dark-2); border: 1px solid var(--dark-line); border-radius: 14px; padding: clamp(8px, 2vw, 18px); }
.aud-diagram svg { width: 100%; height: auto; display: block; }
.aud-glow { animation: audGlow 7s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
@keyframes audGlow { from { opacity: .6; } to { opacity: 1; transform: scale(1.04); } }
.aud-mic-body { fill: #0b1a30; stroke: #2e5f93; stroke-width: 2; }
.aud-mic-arc { fill: none; stroke: #2e5f93; stroke-width: 2; }
.aud-mic-stand { stroke: #2e5f93; stroke-width: 2; }
.aud-wave { stroke: var(--cyan-bright); stroke-width: 2; fill: none; stroke-dasharray: 6 8; animation: audFlow 1.6s linear infinite; }
@keyframes audFlow { to { stroke-dashoffset: -28; } }
.aud-board { fill: #0b1a30; stroke: #24466f; stroke-width: 2; }
.aud-die { fill: #0e2038; stroke: #2e5f93; stroke-width: 1.5; }
.aud-core { fill: var(--cyan-bright); animation: audCore 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes audCore { 50% { transform: scale(1.25); opacity: .72; } }
.aud-ring { fill: none; stroke: var(--cyan-bright); stroke-width: 1.5; opacity: 0; transform-box: fill-box; transform-origin: center; animation: audRing 3s ease-out infinite; }
@keyframes audRing { 0% { transform: scale(.6); opacity: .7; } 70% { transform: scale(1.9); opacity: 0; } 100% { opacity: 0; } }
.aud-flow { stroke: #24466f; stroke-width: 2; stroke-dasharray: 5 9; animation: audFlow 2s linear infinite; }
.aud-node { fill: #0e2038; stroke: #2e5f93; stroke-width: 1.5; }
.aud-glyph { stroke: var(--cyan-bright); stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.aud-glyph-fill { fill: var(--cyan-bright); }
.aud-svg-label { fill: #8aa3c4; font: 600 12px var(--font-mono); letter-spacing: 1.5px; }
.aud-svg-status { fill: #5b7396; font: 500 12px var(--font-mono); letter-spacing: .5px; }

/* ---------- Copyable commands ---------- */
.aud-cmd { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 10px 0; }
.aud-cmd-label { font: 500 .68rem var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); min-width: 88px; }
.aud-cmd code { font: 500 .85rem var(--font-mono); color: var(--ink); background: var(--tint); border-radius: 6px; padding: 6px 10px; overflow-x: auto; white-space: nowrap; }
.aud-cmd-copy { font: 500 .78rem var(--font-mono); color: var(--blue); background: none; border: 1px solid var(--blue-soft); border-radius: 7px; padding: 6px 12px; cursor: pointer; transition: background .2s, color .2s; flex: none; }
.aud-cmd-copy:hover { background: var(--blue); color: #fff; border-color: var(--blue); }
.aud-cmd-note { grid-column: 1 / -1; margin: 2px 0 0; font-size: .8rem; color: var(--ink-3); }

/* ---------- Checklist ---------- */
.aud-check { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.aud-check-file { display: flex; justify-content: space-between; font-size: .72rem; color: var(--ink-3); border-bottom: 1px dashed var(--line-2); padding-bottom: 12px; margin: 0 0 12px; }
.aud-check-list { list-style: none; padding: 0; margin: 0; }
.aud-check-list li { margin: 0; }
.aud-check-list label { display: flex; align-items: flex-start; gap: 12px; padding: 10px 8px; border-radius: 8px; cursor: pointer; transition: background .15s; font-size: .93rem; color: var(--ink-2); }
.aud-check-list label:hover { background: #f2f7ff; }
.aud-check-box { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--blue); flex: none; cursor: pointer; }
.aud-check-box:checked + span { color: var(--ink); }
.aud-check-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.aud-check-hint { font-size: .7rem; color: var(--ink-3); margin: 0; }

/* ---------- Expandable "go deeper" ---------- */
.aud-more { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin: 16px 0; }
.aud-more summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 14px 16px; font-weight: 600; font-size: .95rem; color: var(--ink); }
.aud-more summary::-webkit-details-marker { display: none; }
.aud-more-ico { margin-left: auto; position: relative; width: 14px; height: 14px; flex: none; }
.aud-more-ico::before, .aud-more-ico::after { content: ""; position: absolute; left: 0; top: 6px; width: 14px; height: 2px; background: var(--ink-3); transition: transform .25s, background .25s; }
.aud-more-ico::after { transform: rotate(90deg); }
.aud-more[open] .aud-more-ico::after { transform: rotate(0deg); }
.aud-more[open] .aud-more-ico::before, .aud-more[open] .aud-more-ico::after { background: var(--blue); }
.aud-more-inner { padding: 0 16px 16px; }
.aud-more-inner p { margin: 0 0 12px; font-size: .92rem; color: var(--ink-2); line-height: 1.7; }
.aud-more-inner p:last-child { margin-bottom: 0; }

/* ---------- FAQ (native <details>) ---------- */
.aud-faq { display: grid; gap: 10px; }
.aud-faq-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .2s; }
.aud-faq-item[open] { border-color: var(--blue-soft); }
.aud-faq-sum { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 16px 18px; font-weight: 600; font-size: .98rem; color: var(--ink); }
.aud-faq-sum::-webkit-details-marker { display: none; }
.aud-faq-ico { margin-left: auto; position: relative; width: 16px; height: 16px; flex: none; }
.aud-faq-ico::before, .aud-faq-ico::after { content: ""; position: absolute; left: 0; top: 7px; width: 16px; height: 2px; background: var(--ink-3); transition: transform .25s, background .25s; }
.aud-faq-ico::after { transform: rotate(90deg); }
.aud-faq-item[open] .aud-faq-ico::after { transform: rotate(0deg); }
.aud-faq-item[open] .aud-faq-ico::before, .aud-faq-item[open] .aud-faq-ico::after { background: var(--blue); }
.aud-faq-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .35s ease; }
.aud-faq-item[open] .aud-faq-panel { grid-template-rows: 1fr; }
.aud-faq-inner { overflow: hidden; min-height: 0; visibility: hidden; transition: visibility 0s .35s; }
.aud-faq-item[open] .aud-faq-inner { visibility: visible; transition-delay: 0s; }
.aud-faq-inner p { margin: 0; padding: 0 18px 18px; color: var(--ink-2); font-size: .95rem; line-height: 1.7; }

/* ---------- Related ---------- */
.aud-related { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 8px; }
.aud-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 .2s, transform .2s, box-shadow .2s; }
.aud-related-card:hover, .aud-related-card:focus-visible { border-color: var(--blue); transform: translateY(-3px); box-shadow: var(--shadow-1); }
.aud-related-title { font-size: 1.02rem; font-weight: 600; margin: 0; }
.aud-related-sub { font-size: .86rem; color: var(--ink-2); margin: 0; }

/* ---------- Article footer ---------- */
.aud-foot { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); }
.aud-foot p { font-size: .85rem; color: var(--ink-3); margin: 0; }

/* ---------- Ad slot (matches the shared component) ---------- */
.ad-wrap { margin: clamp(40px, 6vw, 64px) 0; }
.ad-slot { display: none; }
.ad-slot:not(:empty) { display: flex; align-items: center; justify-content: center; position: relative; max-width: 720px; min-height: 250px; margin-inline: auto; border: 1px dashed var(--line-2); background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.ad-slot:not(:empty)::before { content: "Advertisement"; position: absolute; top: 8px; right: 12px; font: 500 .62rem var(--font-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); }
.ad-slot:not(:empty) * { max-width: 100%; }

/* ---------- Responsive ---------- */
@media (min-width: 560px) {
  .aud-card-grid { grid-template-columns: 1fr 1fr; }
  .aud-diag-opts { grid-template-columns: 1fr 1fr; }
  .aud-related { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1000px) {
  .aud-grid { grid-template-columns: 230px minmax(0, 1fr); gap: 56px; }
  .aud-toc { display: block; position: sticky; top: calc(var(--header-h) + 24px); align-self: start; max-height: calc(100vh - var(--header-h) - 48px); overflow: auto; }
}
@media (max-width: 559px) {
  .aud-cmd { grid-template-columns: 1fr; }
  .aud-cmd-label { min-width: 0; }
  .aud-diag-opts { grid-template-columns: 1fr; }
}

/* ---------- Dark theme (loaded after this file) ---------- */
[data-theme="dark"] .aud-warn { background: #241a09; border-color: #5a4417; }
[data-theme="dark"] .aud-warn-text { color: #d8b878; }
[data-theme="dark"] .aud-callout.aud-tip { background: #0d2419; }
[data-theme="dark"] .aud-callout.aud-note { background: #0a2226; }
[data-theme="dark"] .aud-steps > li::before { background: var(--tint); color: var(--blue); border-color: var(--blue-soft); }
[data-theme="dark"] .aud-cmd code { background: var(--tint); }
[data-theme="dark"] .aud-check-list label:hover { background: var(--tint); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .aud-progress { display: none; }
  .aud-glow, .aud-core, .aud-ring, .aud-wave, .aud-flow { animation: none !important; }
  .aud-wave { stroke-dasharray: none; }
  .aud-flow { stroke-dasharray: none; opacity: .5; }
  .aud-faq-panel, .aud-faq-inner { transition: none; }
}

/* ---------- Print ---------- */
@media print {
  .aud-progress, .aud-toc, .to-top, .site-header, .topbar, .aud-diagram, .ad-wrap, .aud-verdict, .site-footer, .consent { display: none !important; }
  .aud-grid { display: block; padding: 0; }
  .aud-article { max-width: 100%; }
  .aud-cards, .aud-decide { display: none; }
  a { color: var(--ink); text-decoration: none; }
  .aud-sec { page-break-inside: avoid; }
}
