/* ═══════════════════════════════════════════════════════════════════════
   tutorials.css — Tutorials hub + step-by-step guides (/tutorials/*)
   Layered on base.css + style.css. Tokens only; no new colours.
   Mobile-friendly by design (opted in — techs read these on a phone).
   ═══════════════════════════════════════════════════════════════════════ */

.tut-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ── Hub list ───────────────────────────────────────────────────────── */
.tut-list { display: flex; flex-direction: column; gap: 12px; }
.tut-list-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 11px;
  color: var(--dark);
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.tut-list-card:hover {
  border-color: var(--red);
  box-shadow: 0 4px 18px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}
.tut-list-card:hover .tut-list-name,
.tut-list-card:hover .tut-list-arrow { color: var(--red); }
.tut-list-body { flex: 1; min-width: 0; }
.tut-list-name {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 1.0625rem; font-weight: 700; letter-spacing: -0.01em;
  margin-bottom: 4px; transition: color 0.15s;
}
.tut-list-desc { font-size: 0.9rem; line-height: 1.5; color: var(--gray); }
.tut-list-meta {
  margin-top: 6px; font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted);
}
.tut-list-arrow { font-size: 1.5rem; color: var(--border); line-height: 1; transition: color 0.15s; }
.tut-list-foot { margin-top: 20px; }
.tut-list-foot a { color: var(--red); }

/* ── Intro card + "On this page" ────────────────────────────────────── */
.tut-needs { padding-left: 20px; line-height: 1.7; font-size: 0.93rem; }
.tut-toc {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.tut-toc-label {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--muted); margin-bottom: 6px;
}
.tut-toc ol { padding-left: 22px; line-height: 1.9; font-size: 0.93rem; }
.tut-toc a { color: var(--red); text-decoration: none; }
.tut-toc a:hover { text-decoration: underline; }

/* ── Step card ──────────────────────────────────────────────────────── */
.tut-step { scroll-margin-top: 64px; }   /* clear the 52px sticky header */
.tut-step:target { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-light); }
.tut-step-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}
.tut-step-num {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--red);
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.95rem;
}
.tut-step-title { flex: 1; font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; }
.tut-step-link {
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font: inherit;
  font-size: 0.75rem;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.tut-step-link:hover { color: var(--red); border-color: var(--red-border); }
.tut-step-link.is-copied { color: var(--green); border-color: var(--green); }

.tut-step-body { font-size: 0.95rem; line-height: 1.65; }
.tut-step-body > * + * { margin-top: 12px; }
.tut-step-body a:not(.btn) { color: var(--red); }
.tut-step-body code {
  font-family: var(--font-mono); font-size: 0.88em;
  background: var(--light-gray); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px;
}
kbd {
  font-family: var(--font-mono); font-size: 0.82em;
  background: var(--white); border: 1px solid var(--border);
  border-bottom-width: 2px; border-radius: 4px; padding: 1px 6px;
}
.tut-substeps, .tut-list-plain { padding-left: 22px; }
.tut-substeps li, .tut-list-plain li { margin-bottom: 6px; }

/* ── Copy chip ──────────────────────────────────────────────────────── */
.tut-copy {
  display: inline-flex;
  align-items: stretch;
  vertical-align: baseline;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--white);
  max-width: 100%;
}
.tut-copy[hidden] { display: none; }   /* display:inline-flex would override [hidden] */
.tut-copy code,
.tut-step-body .tut-copy code {
  border: none; border-radius: 0; background: var(--light-gray);
  padding: 2px 8px; font-size: 0.88rem; color: var(--dark);
  overflow-wrap: anywhere;
}
.tut-copy-btn {
  border: none;
  border-left: 1px solid var(--border);
  background: var(--white);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 9px;
  color: var(--red);
  cursor: pointer;
}
.tut-copy-btn:hover { background: var(--red-light); }
.tut-copy-btn.is-copied { color: var(--green); background: var(--green-light); }

/* ── Value table (IP / mask, user / password) ───────────────────────── */
.tut-values { border-collapse: collapse; margin: 8px 0 4px; }
.tut-values th {
  text-align: left; font-weight: 600; font-size: 0.88rem; color: var(--gray);
  padding: 6px 18px 6px 0; white-space: nowrap;
}
.tut-values td { padding: 6px 0; }

/* ── Screenshots ────────────────────────────────────────────────────── */
.tut-figure { margin: 14px 0 4px; }
.tut-figure-zoom {
  display: inline-block;
  max-width: 100%;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--white);
  cursor: zoom-in;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  transition: border-color 0.15s;
}
.tut-figure-zoom:hover { border-color: var(--red-border); }
.tut-figure img { display: block; max-width: 100%; height: auto; }
.tut-figure figcaption { margin-top: 6px; font-size: 0.82rem; color: var(--muted); }

/* Full-size view — rides the shared .info-popup-overlay (base.css) */
.info-popup.tut-zoom {
  max-width: min(1240px, 96vw);
  width: auto;
  max-height: 94vh;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.tut-zoom img { max-width: 100%; max-height: calc(94vh - 80px); object-fit: contain; display: block; }
.tut-zoom .close-popup { margin-top: 10px; }

/* ── Callouts ───────────────────────────────────────────────────────── */
.tut-callout { font-size: 0.9rem; line-height: 1.55; margin: 14px 0; }
.tut-callout code { background: rgba(255,255,255,0.6); }

/* ── Ping result pair ───────────────────────────────────────────────── */
.tut-result-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.tut-result { border-radius: 9px; padding: 14px; border: 1px solid var(--border); min-width: 0; }
.tut-result p { font-size: 0.88rem; margin-bottom: 4px; }
.tut-result--ok   { background: var(--green-light); border-color: var(--green); }
.tut-result--fail { background: var(--red-light);   border-color: var(--red-border); }
.tut-result-label { font-weight: 700; margin-bottom: 6px; }
.tut-result--ok   .tut-result-label { color: var(--green); }
.tut-result--fail .tut-result-label { color: var(--red); }

.tut-fix {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 8px;
  font-size: 0.9rem;
}
.tut-fix-label { font-weight: 700; margin-bottom: 6px; }
.tut-fix ul { padding-left: 20px; line-height: 1.6; }

/* ── Password helper ────────────────────────────────────────────────── */
.tut-pw-helper {
  padding: 14px 16px;
  background: var(--light-gray);
  border: 1px dashed var(--border);
  border-radius: 8px;
}
.tut-pw-label { display: block; font-weight: 600; font-size: 0.88rem; margin-bottom: 8px; }
.tut-pw-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tut-pw-input {
  width: 180px; max-width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}
.tut-pw-input:focus { outline: none; border-color: var(--red); }
.tut-pw-arrow { color: var(--muted); }
.tut-pw-empty { font-size: 0.85rem; }

/* ── Link-out card, next/prev, coming soon ──────────────────────────── */
.tut-link-card {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border: 1px solid var(--red-border);
  background: var(--red-light);
  border-radius: 8px;
}
.tut-link-card-name { font-weight: 700; }
.tut-link-card-desc { font-size: 0.88rem; color: var(--gray); }

.tut-next { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.tut-next--inline { justify-content: flex-start; margin-top: 14px; }
.tut-next .btn { text-decoration: none; }

.tut-coming { border-style: dashed; background: var(--light-gray); }
.tut-coming-label {
  display: inline-block; margin-bottom: 6px;
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
}
.tut-coming p { font-size: 0.92rem; color: var(--gray); }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .tut-result-pair { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .tut-step-head { flex-wrap: wrap; }
  .tut-step-title { font-size: 1rem; }
  .tut-list-card { padding: 14px 16px; }
  .tut-next .btn { flex: 1 1 100%; text-align: center; }
}
