/* ============================================================
   DiagMyPCHub — Networking tutorial (page-specific)
   Namespaced .net-* to avoid conflicts with the shared
   ../../css/style.css. Reuses the site design tokens, .btn,
   .table-wrap, .breadcrumbs, .topbar, .site-header/footer.
   ============================================================ */

/* ---------- Reading progress ---------- */
.net-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60; background: transparent; }
.net-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--cyan)); transition: width 0.1s linear; }

/* ---------- Layout ---------- */
.net-grid { display: block; }
.net-toc { display: none; }
.net-article { max-width: 860px; margin-inline: auto; padding: clamp(28px, 5vw, 52px) 0 40px; }

.net-head .sec-kicker { margin-bottom: 10px; }
.net-head h1 { font-size: clamp(2rem, 1.1rem + 3vw, 2.9rem); font-weight: 700; letter-spacing: -0.022em; line-height: 1.08; margin: 0 0 18px; }
.net-intro { font-size: 1.04rem; color: var(--ink-2); }

/* ---------- Callouts ---------- */
.net-callout { display: flex; gap: 14px; align-items: flex-start; background: var(--tint); border: 1px solid var(--blue-soft); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 26px; font-size: 0.94rem; }
.net-callout .net-callout-ico { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--blue); color: #fff; font: 600 0.85rem/1 var(--font-display); font-style: italic; }
.net-callout-title { font-weight: 600; color: var(--ink); margin: 0 0 4px; }
.net-callout-text { margin: 0; color: var(--ink-2); }
.net-callout.net-warn { background: #fdf6e9; border-color: #e3c08a; }
.net-callout.net-warn .net-callout-ico { background: #c98a1e; }
.net-callout.net-note { background: #eef7f2; border-color: #bfe3d3; }
.net-callout.net-note .net-callout-ico { background: var(--ok); }
.net-callout.net-warn span:not(.net-callout-ico),
.net-callout.net-note span:not(.net-callout-ico) { color: var(--ink-2); }

/* ---------- Hero image placeholder ---------- */
.net-figure { margin: 0 0 30px; }
.net-figure[data-empty="true"] { display: none; }
.net-figure img { width: 100%; height: auto; display: block; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.net-figure figcaption { font-size: 0.78rem; color: var(--ink-3); margin-top: 8px; }

/* ---------- Section heads ---------- */
.net-sec { padding: clamp(28px, 4vw, 40px) 0; border-top: 1px solid var(--line); scroll-margin-top: calc(var(--header-h) + 16px); }
.net-sec:first-of-type { border-top: 0; }
.net-sec-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; }
.net-sec-index { font: 600 0.95rem var(--font-mono); color: var(--line-2); letter-spacing: 0.08em; padding-bottom: 6px; flex: none; }
.net-sec-kicker { font: 500 0.7rem var(--font-mono); text-transform: uppercase; letter-spacing: 0.14em; color: var(--blue); margin: 0 0 5px; }
.net-sec-head h2 { font-size: clamp(1.35rem, 1rem + 1.4vw, 1.85rem); font-weight: 600; letter-spacing: -0.015em; margin: 0; }
.net-sec-lede { color: var(--ink-2); font-size: 1rem; margin: 0 0 16px; }
.net-chain { display: inline-block; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; font-size: 0.82rem; color: var(--ink); overflow-x: auto; max-width: 100%; }

/* ---------- Article typography ---------- */
.net-article p { margin: 0 0 1em; }
.net-article a { color: var(--blue); text-decoration: underline; text-underline-offset: 2px; }
.net-article a:hover { color: var(--blue-deep); }
.net-article h3 { font-size: 1.15rem; font-weight: 600; margin: 1.4em 0 0.5em; }
.net-article ul, .net-article ol { margin: 0 0 1em; padding-left: 1.2em; }
.net-article li { margin: 0.35em 0; }
.net-article ul { list-style: disc; }
.net-article ol { list-style: decimal; }
.net-article strong { color: var(--ink); }

.net-steps { counter-reset: netstep; list-style: none; padding: 0; margin: 0 0 1em; }
.net-steps li { counter-increment: netstep; position: relative; padding: 0 0 12px 42px; margin: 0; }
.net-steps li::before { content: counter(netstep, decimal-leading-zero); position: absolute; left: 0; top: 1px; width: 28px; height: 28px; display: grid; place-items: center; font: 600 0.7rem var(--font-mono); color: var(--blue-deep); background: var(--tint); border: 1px solid var(--blue-soft); border-radius: 8px; }
.net-steps li:last-child { padding-bottom: 0; }

/* ---------- Animated diagram ---------- */
.net-diagram { background: var(--dark-2); border: 1px solid var(--dark-line); border-radius: 14px; padding: clamp(8px, 2vw, 16px); margin: 0 0 20px; }
#net-svg { width: 100%; height: auto; display: block; }
.net-glow { animation: netGlow 7s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
@keyframes netGlow { from { opacity: 0.6; } to { opacity: 1; transform: scale(1.04); } }

.net-wire { stroke: #24466f; stroke-width: 2; }
.net-wireless { stroke: #2e5f93; stroke-width: 2; stroke-dasharray: 5 6; }
.net-packet { fill: var(--cyan-bright); }
.net-node { cursor: pointer; outline: none; }
.net-node-shape { fill: #0e2038; stroke: #2e5f93; stroke-width: 2; transition: stroke 0.2s, filter 0.2s; }
.net-node-screen { fill: #122a48; stroke: #1e3a5f; stroke-width: 1.5; }
.net-node-base { fill: #0e2038; stroke: #2e5f93; stroke-width: 1.5; }
.net-antenna { stroke: #2e5f93; stroke-width: 2; stroke-linecap: round; }
.net-led { fill: var(--ok); }
.net-port { fill: #122a48; stroke: #1e3a5f; stroke-width: 1; }
.net-drive { stroke: #1e3a5f; stroke-width: 1.5; }
.net-cloud circle { fill: #10233c; stroke: #2e5f93; stroke-width: 2; }
.net-node-label { fill: #8aa3c4; font: 500 11px var(--font-mono); letter-spacing: 1.5px; transition: fill 0.2s; }

.net-node:hover .net-node-shape,
.net-node:focus-visible .net-node-shape,
.net-node.is-active .net-node-shape { stroke: var(--cyan-bright); filter: drop-shadow(0 0 6px rgba(65, 226, 245, 0.5)); }
.net-node:hover .net-cloud circle,
.net-node:focus-visible .net-cloud circle,
.net-node.is-active .net-cloud circle { stroke: var(--cyan-bright); }
.net-node:hover .net-node-label,
.net-node:focus-visible .net-node-label,
.net-node.is-active .net-node-label { fill: #eaf9ff; }

/* ---------- Component explorer ---------- */
.net-comp-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.net-comp { display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s; cursor: default; }
.net-comp:hover, .net-comp:focus-within, .net-comp.is-active { border-color: var(--blue); box-shadow: var(--shadow-1); }
.net-comp.is-active { transform: translateY(-3px); }
.net-comp-head { display: flex; align-items: center; gap: 12px; }
.net-comp-ico { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: var(--tint); color: var(--blue-deep); transition: background 0.2s, color 0.2s; }
.net-comp:hover .net-comp-ico, .net-comp.is-active .net-comp-ico { background: var(--blue); color: #fff; }
.net-comp-name { font-size: 1rem; font-weight: 600; margin: 0; }
.net-comp-desc { font-size: 0.86rem; color: var(--ink-2); margin: 0; flex: 1; }
.net-comp-link { align-self: flex-start; }

/* Image placeholder system */
.component-image-placeholder { width: 100%; aspect-ratio: 16 / 9; display: grid; place-items: center; text-align: center; border: 1.5px dashed var(--line-2); border-radius: 10px; background: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(13, 27, 46, 0.03) 10px, rgba(13, 27, 46, 0.03) 20px); color: var(--ink-3); font: 500 0.74rem var(--font-mono); letter-spacing: 0.04em; }
.component-image-placeholder span { padding: 8px; }

/* ---------- Command blocks ---------- */
.net-cmd { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--dark-2); border: 1px solid var(--dark-line); border-radius: 10px; padding: 10px 12px; margin: 0 0 10px; }
.net-cmd-label { font: 500 0.64rem var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--dark-muted); flex: none; }
.net-cmd code { flex: 1 1 auto; min-width: 140px; font: 500 0.86rem var(--font-mono); color: #d7e6fb; overflow-x: auto; white-space: nowrap; }
.net-cmd-copy { flex: none; font: 600 0.74rem var(--font-mono); color: #d7e6fb; background: none; border: 1px solid var(--dark-line); border-radius: 7px; padding: 5px 11px; cursor: pointer; transition: border-color 0.2s, color 0.2s, background 0.2s; }
.net-cmd-copy:hover { border-color: var(--cyan-bright); color: #fff; background: rgba(65, 226, 245, 0.1); }
.net-cmd-copy.is-done { border-color: var(--ok); color: var(--ok); }
.net-cmd-note { flex-basis: 100%; margin: 0; font-size: 0.8rem; color: var(--ink-3); }

/* ---------- Decision tree ---------- */
.net-dtree { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 0 0 18px; }
.net-dtree-progress { font-size: 0.72rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 10px; }
.net-dtree-q { font-size: 1.1rem; font-weight: 600; margin: 0 0 16px; }
.net-dtree-opts { display: flex; gap: 10px; flex-wrap: wrap; }
.net-dtree-result { border-top: 1px dashed var(--line-2); padding-top: 16px; margin-top: 4px; }
.net-dtree-note { margin: 0 0 14px; color: var(--ink-2); }
.net-dtree-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Network lab ---------- */
.net-lab { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.net-lab-scene { background: var(--dark-2); color: var(--dark-ink); padding: 18px 20px; border-bottom: 1px solid var(--dark-line); }
.net-lab-scene h3 { color: #fff; font-size: 1rem; margin: 0 0 8px; }
.net-lab-scene ul { list-style: none; padding: 0; margin: 0; }
.net-lab-scene li { font: 400 0.86rem var(--font-mono); color: var(--dark-muted); margin: 3px 0; }
.net-lab-scene li strong { color: #d7e6fb; }
.net-lab-steps { padding: 8px 0; }
.net-lab-step { padding: 14px 20px; border-bottom: 1px solid var(--line); }
.net-lab-step:last-child { border-bottom: 0; }
.net-lab-step.is-done { background: #f2faf6; }
.net-lab-step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.net-lab-num { flex: none; width: 26px; height: 26px; display: grid; place-items: center; font: 600 0.72rem var(--font-mono); color: var(--blue-deep); background: var(--tint); border: 1px solid var(--blue-soft); border-radius: 50%; }
.net-lab-step.is-done .net-lab-num { background: var(--ok); border-color: var(--ok); color: #06281c; }
.net-lab-step-head h4 { font-size: 0.98rem; font-weight: 600; margin: 0; }
.net-lab-run { margin: 4px 0; }
.net-lab-step.is-done .net-lab-run { visibility: hidden; }
.net-lab-out { margin-top: 12px; }
.net-lab-out-pre { margin: 0 0 8px; padding: 12px 14px; background: var(--dark-2); color: #d7e6fb; border-radius: 8px; font: 400 0.8rem/1.6 var(--font-mono); overflow-x: auto; }
.net-lab-out p { margin: 0; font-size: 0.9rem; color: var(--ink-2); }
.net-lab-conclusion { background: var(--tint); border-top: 2px solid var(--blue); padding: 20px; }
.net-lab-conclusion h3 { margin: 0 0 8px; font-size: 1.1rem; }
.net-lab-conclusion p { margin: 0; color: var(--ink-2); }

/* ---------- FAQ ---------- */
.net-faq-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; }
.net-faq-item[open] { border-color: var(--blue-soft); }
.net-faq-q { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 12px; padding: 16px 18px; font-weight: 600; font-size: 0.98rem; }
.net-faq-q::-webkit-details-marker { display: none; }
.net-faq-ico { margin-left: auto; position: relative; width: 15px; height: 15px; flex: none; }
.net-faq-ico::before, .net-faq-ico::after { content: ""; position: absolute; left: 0; top: 6.5px; width: 15px; height: 2px; background: var(--ink-3); transition: transform 0.25s, background 0.25s; }
.net-faq-ico::after { transform: rotate(90deg); }
.net-faq-item[open] .net-faq-ico::after { transform: rotate(0deg); }
.net-faq-item[open] .net-faq-ico::before, .net-faq-item[open] .net-faq-ico::after { background: var(--blue); }
.net-faq-a { padding: 0 18px 16px; }
.net-faq-a p { margin: 0; color: var(--ink-2); font-size: 0.94rem; }

/* ---------- Checklist ---------- */
.net-check { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 20px 20px; }
.net-check-item label { display: flex; align-items: flex-start; gap: 12px; padding: 11px 8px; border-radius: 8px; cursor: pointer; font-size: 0.93rem; color: var(--ink-2); transition: background 0.15s; }
.net-check-item label:hover { background: var(--tint); }
.net-check-item input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--blue); flex: none; cursor: pointer; }
.net-check-item input:checked + span { color: var(--ink); }
.net-check-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.net-check-hint { font-size: 0.7rem; color: var(--ink-3); margin: 0; }

/* ---------- Related ---------- */
.net-related { display: grid; grid-template-columns: 1fr; gap: 14px; }
.net-rel-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; }
.net-rel-card:hover, .net-rel-card:focus-visible { border-color: var(--blue); transform: translateY(-3px); box-shadow: var(--shadow-1); }
.net-rel-ico { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: var(--tint); color: var(--blue-deep); margin-bottom: 6px; }
.net-rel-card:hover .net-rel-ico { background: var(--blue); color: #fff; }
.net-rel-name { font: 600 1.02rem var(--font-display); }
.net-rel-desc { font-size: 0.86rem; color: var(--ink-2); margin: 0; }
.net-rel-path { font-size: 0.7rem; color: var(--ink-3); margin-top: 4px; }

/* ---------- Article footer ---------- */
.net-foot { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); }
.net-foot p { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font: 500 0.74rem var(--font-mono); color: var(--ink-3); margin: 0 0 8px; }
.net-foot-fine { font: 400 0.74rem/1.6 var(--font-body); color: var(--ink-3); }

/* ---------- Ad placeholder ---------- */
.ad-placeholder { display: none; }
.ad-placeholder:not(:empty) { display: flex; align-items: center; justify-content: center; position: relative; min-height: 200px; max-width: 760px; margin: 10px auto; border: 1px dashed var(--line-2); background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.ad-placeholder:not(:empty)::before { content: "Advertisement"; position: absolute; top: 8px; right: 12px; font: 500 0.62rem var(--font-mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); }
.ad-placeholder:not(:empty) * { max-width: 100%; }

/* ---------- Responsive ---------- */
@media (min-width: 560px) {
  .net-comp-grid { grid-template-columns: repeat(2, 1fr); }
  .net-related { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .net-comp-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1000px) {
  .net-grid { display: grid; grid-template-columns: 232px 1fr; gap: 44px; align-items: start; }
  .net-toc { display: block; position: sticky; top: calc(var(--header-h) + 20px); max-height: calc(100vh - var(--header-h) - 40px); overflow-y: auto; padding-right: 8px; }
  .net-toc-title { font: 500 0.68rem var(--font-mono); text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-3); margin: 0 0 12px; }
  .net-toc ul { display: grid; gap: 1px; }
  .net-toc a { display: block; padding: 5px 10px; font-size: 0.8rem; color: var(--ink-2); text-decoration: none; border-left: 2px solid transparent; transition: color 0.15s, border-color 0.15s, background 0.15s; }
  .net-toc a:hover { color: var(--ink); }
  .net-toc a.is-active { color: var(--blue); border-left-color: var(--blue); background: var(--tint); font-weight: 500; }
}
@media (min-width: 1240px) {
  .net-comp-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- Dark theme ---------- */
[data-theme="dark"] .net-lab-step.is-done { background: #0f1c30; }
[data-theme="dark"] .net-callout.net-warn { background: #241d0e; border-color: #4a3c18; }
[data-theme="dark"] .net-callout.net-note { background: #0f1e18; border-color: #1f4436; }
[data-theme="dark"] .component-image-placeholder { background: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255, 255, 255, 0.03) 10px, rgba(255, 255, 255, 0.03) 20px); }
[data-theme="dark"] .net-check-item label:hover { background: var(--tint); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .net-progress span { transition: none; }
  .net-glow { animation: none; }
  .net-packets { display: none; }
}

/* ---------- Print ---------- */
@media print {
  .net-progress, .net-toc, .net-dtree, .net-lab-run, .net-check-actions, .to-top, .toast, .consent, .ad-placeholder, .net-cmd-copy, .nav-toggle { display: none !important; }
  .net-grid { display: block; }
  .net-article { max-width: none; }
  .net-sec { break-inside: avoid-page; }
}
