/* ============================================================
   DiagMyPCHub — What Actually Is an Operating System (15-tutorial collection)
   Local stylesheet. Depends on the site design tokens from
   ../../../css/style.css (loaded first in <head>). All page styles
   are namespaced with the "os-" prefix so they cannot leak into
   shared site components.
   ============================================================ */

/* ---------- Reading progress ---------- */
.os-progress{ position:fixed; top:0; left:0; right:0; height:3px; z-index:120; background:transparent; pointer-events:none; }
.os-progress span{ display:block; height:100%; width:0; background:linear-gradient(90deg, var(--blue), var(--cyan-bright)); }

/* ---------- Grid: TOC + article ---------- */
.os-grid{ display:grid; grid-template-columns:1fr; gap:36px; padding-top:clamp(28px,4vw,44px); padding-bottom:clamp(56px,8vw,96px); }

/* ---------- Table of contents (block on mobile, sticky sidebar on desktop) ---------- */
.os-toc{ background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:16px 16px 10px; box-shadow:var(--shadow-1); }
.os-toc-title{ font:500 .7rem var(--font-mono); letter-spacing:.02em; color:var(--ink-3); margin:0 0 8px; }
.os-toc-count{ font:500 .72rem var(--font-mono); color:var(--ink-3); margin:0 0 10px; min-height:1em; }
.os-search-wrap input{ width:100%; box-sizing:border-box; background:var(--bg); border:1.5px solid var(--line-2); border-radius:10px; padding:9px 12px; font:400 .9rem var(--font-body); color:var(--ink); }
.os-search-wrap input::placeholder{ color:var(--ink-3); }
.os-search-wrap input:focus{ outline:none; border-color:var(--blue); box-shadow:0 0 0 4px rgba(15,91,215,.12); }
[data-theme="dark"] .os-search-wrap input:focus{ box-shadow:0 0 0 4px rgba(75,136,245,.22); }

.os-chips{ display:flex; flex-wrap:wrap; gap:6px; margin:10px 0 4px; }
.os-chip{ font:500 .72rem var(--font-mono); letter-spacing:.02em; color:var(--ink-2); background:var(--bg); border:1px solid var(--line-2); border-radius:999px; padding:4px 10px; cursor:pointer; transition:border-color .2s, color .2s, background .2s; }
.os-chip:hover{ border-color:var(--blue); color:var(--ink); }
.os-chip.is-active{ background:var(--blue); border-color:var(--blue); color:#fff; }

.os-toc-list{ margin:10px 0 0; padding:0; list-style:none; border-top:1px solid var(--line); }
.os-toc-group{ border-bottom:1px solid var(--line); }
.os-toc-cat{ font:600 .78rem var(--font-body); color:var(--ink); margin:12px 0 6px; letter-spacing:.01em; }
.os-toc-cat .mono{ color:var(--blue); margin-right:6px; font-size:.7rem; }
.os-toc-group ul{ list-style:none; margin:0; padding:0; display:grid; gap:1px; }
.os-toc-item a{ display:flex; gap:8px; align-items:baseline; padding:5px 10px; margin-left:-10px; border-left:2px solid transparent; color:var(--ink-2); text-decoration:none; font-size:.84rem; line-height:1.45; border-radius:0 8px 8px 0; transition:color .2s, border-color .2s, background .15s; }
.os-toc-item a:hover{ color:var(--ink); background:var(--tint); }
.os-toc-item a[aria-current="true"]{ color:var(--blue); border-left-color:var(--blue); font-weight:500; background:var(--tint); }
.os-toc-num{ font:600 .7rem var(--font-mono); color:var(--ink-3); flex:none; width:1.9em; }
.os-toc-empty{ background:var(--bg); border:1px dashed var(--line-2); border-radius:10px; padding:14px; text-align:center; color:var(--ink-2); font-size:.85rem; margin:10px 0 6px; }
.os-inline-reset{ font:inherit; font-size:.85rem; color:var(--blue); background:none; border:0; padding:0; cursor:pointer; text-decoration:underline; text-underline-offset:2px; }

/* ---------- Article head ---------- */
.os-article{ max-width:860px; }
.os-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 16px; }
.os-meta{ display:flex; flex-wrap:wrap; align-items:center; gap:10px; margin:0 0 20px; }
.os-meta-item{ font:500 .72rem var(--font-mono); letter-spacing:.04em; color:var(--ink-3); border:1px solid var(--line-2); background:var(--surface); border-radius:999px; padding:4px 10px; }
.os-intro{ font-size:1.05rem; color:var(--ink-2); line-height:1.7; margin:0 0 16px; }

/* ---------- Hero SVG (original artwork, theme-aware) ---------- */
.os-hero-fig{ margin:28px 0 8px; background:var(--surface); border:1px solid var(--line); border-radius:14px; padding:clamp(10px,2vw,20px); box-shadow:var(--shadow-1); }
.os-hero-fig svg{ width:100%; height:auto; display:block; }
.os-hero-cap{ margin-top:12px; font:400 .8rem/1.6 var(--font-mono); color:var(--ink-3); }

.os-svg-boundary{ fill:none; stroke:var(--line-2); stroke-width:1.5; stroke-dasharray:6 8; }
.os-svg-traces path{ stroke:var(--line-2); stroke-width:2; fill:none; }
.os-svg-vias circle{ fill:var(--line-2); }
.os-svg-band{ fill:var(--tint); stroke:var(--blue-soft); stroke-width:1.5; opacity:.45; }
.os-svg-core rect{ fill:var(--tint); stroke:var(--blue-soft); stroke-width:1.5; }
.os-svg-kernel-text{ fill:var(--ink); font:700 20px var(--font-display); letter-spacing:.5px; }
.os-svg-kernel-sub{ fill:var(--ink-3); font:500 10px var(--font-mono); letter-spacing:.4px; }
.os-svg-chipbody{ fill:var(--surface); stroke:var(--line-2); stroke-width:1.5; }
.os-svg-chiptext{ fill:var(--ink-2); font:600 11px var(--font-mono); letter-spacing:.4px; }
.os-svg-layer-label{ fill:var(--ink-3); font:600 11px var(--font-mono); letter-spacing:1px; text-transform:uppercase; }
.os-svg-band-label{ opacity:.9; }
.os-svg-boundary-label{ font-size:10px; letter-spacing:.5px; opacity:.85; }

.os-svg-flow{ stroke:var(--cyan); stroke-width:2.4; fill:none; stroke-dasharray:10 90; opacity:.85; animation:osFlow 4s linear infinite; }
@keyframes osFlow{ to{ stroke-dashoffset:-100; } }
.os-svg-flow.os-f1{ animation-duration:3.6s; }
.os-svg-flow.os-f2{ animation-duration:4.8s; animation-delay:.5s; }
.os-svg-flow.os-f3{ animation-duration:5.4s; animation-delay:1.1s; }
.os-svg-flow.os-f4{ stroke:var(--blue); opacity:.5; animation-duration:6.2s; animation-delay:2s; }

/* ---------- Categories & tutorial cards ---------- */
.os-cat{ margin-top:clamp(48px,7vw,72px); scroll-margin-top:calc(var(--header-h) + 16px); }
.os-cat-head{ display:flex; align-items:flex-start; gap:16px; margin-bottom:14px; }
.os-cat-index{ font-size:1.05rem; color:var(--line-2); flex:none; padding-top:4px; }
.os-cat-kicker{ font:500 .7rem var(--font-mono); text-transform:uppercase; letter-spacing:.16em; color:var(--blue); margin:0 0 4px; }
.os-cat-head h2{ font-size:clamp(1.3rem, 1rem + 1.2vw, 1.7rem); font-weight:600; letter-spacing:-.01em; margin:0; }
.os-cat-intro{ color:var(--ink-2); font-size:1rem; line-height:1.7; margin:0 0 8px; max-width:70ch; }

.os-tut{ background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:clamp(18px,3vw,28px); margin-top:24px; scroll-margin-top:calc(var(--header-h) + 16px); box-shadow:var(--shadow-1); }
.os-tut-head{ border-bottom:1px solid var(--line); padding-bottom:14px; margin-bottom:18px; }
.os-tut-index{ display:inline-block; font-size:.7rem; letter-spacing:.08em; color:var(--blue-deep); background:var(--tint); border:1px solid var(--blue-soft); border-radius:6px; padding:3px 8px; margin-bottom:10px; }
.os-tut-head h3{ font-size:clamp(1.15rem, .95rem + .8vw, 1.45rem); font-weight:600; letter-spacing:-.01em; margin:0 0 10px; line-height:1.25; }
.os-tut-obj{ font-size:.92rem; color:var(--ink-3); margin:0; line-height:1.6; }
.os-tut-obj strong{ color:var(--ink-2); }

.os-tut p{ color:var(--ink-2); line-height:1.75; margin:0 0 16px; }
.os-tut p strong, .os-tut li strong{ color:var(--ink); }
.os-tut a{ color:var(--blue); text-decoration:underline; text-underline-offset:2px; text-decoration-color:var(--blue-soft); transition:text-decoration-color .2s; }
.os-tut a:hover{ text-decoration-color:var(--blue); }
.os-tut ul, .os-tut ol{ margin:0 0 16px; padding-left:22px; color:var(--ink-2); line-height:1.7; }
.os-tut li{ margin-bottom:8px; }
.os-tut li::marker{ color:var(--blue); }
.os-tut h4{ font-size:1rem; font-weight:600; color:var(--ink); margin:22px 0 10px; }

/* ---------- Ordered steps (program launch) ---------- */
.os-steps{ counter-reset:os-step; list-style:none; padding:0; margin:0 0 20px; display:grid; gap:18px; }
.os-steps > li{ counter-increment:os-step; position:relative; padding:0 0 6px 46px; margin:0; min-height:40px; }
.os-steps > li::before{ content:counter(os-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; }
.os-steps > li strong{ color:var(--ink); }

/* ---------- Knowledge checks (native <details>) ---------- */
.os-check{ background:var(--bg); border:1px solid var(--line); border-radius:10px; margin:4px 0 8px; padding:0 16px; }
.os-check summary{ cursor:pointer; font-weight:600; color:var(--ink); padding:12px 0; list-style:none; display:flex; justify-content:space-between; gap:12px; align-items:center; font-size:.95rem; }
.os-check summary::-webkit-details-marker{ display:none; }
.os-check summary::after{ content:"+"; font:600 1.05rem var(--font-mono); color:var(--blue); flex:none; }
.os-check[open] summary::after{ content:"–"; }
.os-check p{ margin:0 0 12px; font-size:.93rem; color:var(--ink-2); line-height:1.7; }

/* ---------- Code blocks with copy button ---------- */
.os-block{ background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:14px 16px; margin:20px 0; }
.os-block-head{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:10px; flex-wrap:wrap; }
.os-block-label{ font-size:.68rem; text-transform:uppercase; letter-spacing:.08em; color:var(--ink-3); }
.os-code{ margin:0; background:var(--tint); border:1px solid var(--line); border-radius:8px; padding:14px 16px; overflow-x:auto; font:400 .8rem/1.7 var(--font-mono); color:var(--ink); white-space:pre; }
.os-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, border-color .2s; flex:none; }
.os-copy:hover{ background:var(--blue); color:#fff; border-color:var(--blue); }
.os-copy.is-done{ background:var(--ok); border-color:var(--ok); color:#06281c; }
.os-copy.is-error{ background:var(--warn); border-color:var(--warn); color:#3a2a00; }
.os-block-note{ margin:10px 0 0; font-size:.8rem; color:var(--ink-3); line-height:1.6; }

/* ---------- Image placeholders (hidden until a valid image exists) ----------
   Future images: save under images/ and set the <img> data-src to that path.
   The figure is display:none by default; JS adds .is-ready only when
   the image actually loads, and removes it on load error. */
.os-figure{ display:none; margin:16px 0 8px; }
.os-figure.is-ready{ display:block; }
.os-figure img{ width:100%; height:auto; border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); display:block; }
.os-figure figcaption{ margin-top:10px; font:400 .78rem/1.6 var(--font-mono); color:var(--ink-3); }

/* ---------- Related guides ---------- */
.os-related{ margin-top:clamp(48px,7vw,72px); scroll-margin-top:calc(var(--header-h) + 16px); }
.os-related h2{ font-size:clamp(1.3rem, 1rem + 1.2vw, 1.7rem); font-weight:600; letter-spacing:-.01em; margin:0 0 8px; }
.os-related > p{ color:var(--ink-2); font-size:.95rem; line-height:1.65; margin:0 0 14px; max-width:70ch; }
.os-related-list{ list-style:none; margin:0; padding:0; display:grid; grid-template-columns:1fr; gap:14px; }
.os-related-list li{ background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:16px 18px; box-shadow:var(--shadow-1); font-size:.93rem; color:var(--ink-2); line-height:1.65; }
.os-related-list a{ color:var(--blue); font-weight:600; text-decoration:none; }
.os-related-list a:hover{ text-decoration:underline; text-underline-offset:2px; }

/* ---------- Article footer ---------- */
.os-foot{ margin-top:48px; padding-top:20px; border-top:1px solid var(--line); }
.os-foot p{ font-size:.85rem; color:var(--ink-3); margin:0; line-height:1.6; }

/* ---------- Responsive ---------- */
@media (min-width:1000px){
  .os-grid{ grid-template-columns:300px minmax(0,1fr); gap:56px; }
  .os-toc{ 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){
  .os-steps > li{ padding-left:42px; }
  .os-toc-item a{ font-size:.82rem; }
}

/* ---------- Dark theme (local hardcoded colors only) ---------- */
[data-theme="dark"] .os-tut-index{ color:var(--blue); }
[data-theme="dark"] .os-check summary::after{ color:var(--blue); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce){
  .os-progress{ display:none; }
  .os-svg-flow{ animation:none !important; stroke-dasharray:none; opacity:.3; }
}

/* ---------- Print ---------- */
@media print{
  .os-progress, .os-toc, .to-top, .site-header, .topbar, .ad-wrap, .site-footer, .consent{ display:none !important; }
  .os-grid{ display:block; padding:0; }
  .os-article{ max-width:100%; }
  .os-tut{ box-shadow:none; break-inside:avoid; }
  a{ color:var(--ink); text-decoration:none; }
}
