/* ==========================================================================
   "How To Do" — ethical, step-by-step security walkthroughs for a topic.
   Each walkthrough is an expandable <details> card; every one pairs the attack
   with its detection & defence. Content is baked bilingual; CSS toggles the
   language on <html lang>.
   ========================================================================== */

.howto-list {
  max-width: 52rem;
  margin: var(--cds-spacing-07) auto 0;
}

/* An always-visible ethics / authorization notice above the walkthroughs. */
.howto-ethics {
  margin-bottom: var(--cds-spacing-07);
  padding: var(--cds-spacing-05) var(--cds-spacing-06);
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--cds-text-primary);
  background: var(--cds-layer-accent, #e0e0e0);
  border-left: 4px solid var(--cds-support-warning, #f1c21b);
}

.howto {
  margin-bottom: var(--cds-spacing-05);
  background: var(--cds-layer, #fff);
  border: 1px solid var(--cds-border-subtle, #e0e0e0);
}
.howto[open] {
  border-color: var(--cds-border-strong, #8d8d8d);
}

.howto__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--cds-spacing-04);
  padding: var(--cds-spacing-05) var(--cds-spacing-06);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.howto__head::-webkit-details-marker { display: none; }
.howto__head::after {
  content: "+";
  margin-left: auto;
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--cds-text-secondary, #525252);
}
.howto[open] .howto__head::after { content: "–"; }
.howto__head:hover { background: var(--cds-layer-hover, #f4f4f4); }
.howto__head:focus-visible { outline: 2px solid var(--cds-focus, #0f62fe); outline-offset: -2px; }

.howto__title { font-size: 1.0625rem; }

.howto__badges { display: inline-flex; gap: var(--cds-spacing-03); flex-wrap: wrap; }
.howto__badge {
  padding: 0.125rem var(--cds-spacing-03);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--cds-text-secondary, #525252);
  background: var(--cds-layer-accent, #e0e0e0);
}
.howto__badge--role {
  color: var(--cds-text-on-color, #fff);
  background: var(--cds-border-interactive, #0f62fe);
}

.howto__body {
  padding: 0 var(--cds-spacing-06) var(--cds-spacing-06);
  border-top: 1px solid var(--cds-border-subtle, #e0e0e0);
}
.howto__lead {
  margin: var(--cds-spacing-05) 0;
  color: var(--cds-text-secondary, #525252);
  line-height: 1.6;
}

/* Authorization / rules-of-engagement note — can't be missed. */
.howto__auth {
  margin: var(--cds-spacing-05) 0;
  padding: var(--cds-spacing-04) var(--cds-spacing-05);
  font-size: 0.875rem;
  line-height: 1.6;
  background: var(--cds-layer-accent, #e0e0e0);
  border-left: 4px solid var(--cds-support-error, #da1e28);
}
.howto__auth-label { display: block; margin-bottom: var(--cds-spacing-02); }

/* Attack-flow diagram: numbered stages connected by arrows, like a standard company
   attack-flow / kill-chain figure. Wraps on narrow screens. */
.howto__flow {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: var(--cds-spacing-03);
}
.howto__flow-step {
  display: inline-flex;
  align-items: center;
  gap: var(--cds-spacing-03);
  padding: var(--cds-spacing-03) var(--cds-spacing-05) var(--cds-spacing-03) var(--cds-spacing-03);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--cds-text-primary);
  background: var(--cds-layer, #fff);
  border: 1px solid var(--cds-border-interactive, #0f62fe);
  border-radius: 999px;
}
.howto__flow-num {
  display: inline-grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  flex: none;
  font-size: 0.75rem;
  color: var(--cds-text-on-color, #fff);
  background: var(--cds-border-interactive, #0f62fe);
  border-radius: 50%;
}
.howto__flow-arrow {
  align-self: center;
  color: var(--cds-border-interactive, #0f62fe);
  font-size: 1.1rem;
  font-weight: 700;
}

.howto__block { margin-top: var(--cds-spacing-06); }
.howto__sub {
  margin: 0 0 var(--cds-spacing-04);
  padding-bottom: var(--cds-spacing-03);
  color: var(--cds-link-primary, #0f62fe);
  border-bottom: 2px solid var(--cds-border-subtle, #e0e0e0);
}
.howto__list {
  margin: 0;
  padding-left: var(--cds-spacing-06);
  line-height: 1.6;
}
.howto__list li { margin-bottom: var(--cds-spacing-03); }
.howto__list li:last-child { margin-bottom: 0; }

.howto__tools { display: flex; flex-wrap: wrap; gap: var(--cds-spacing-03); }
/* Tool chips are highlighted with a slow animated colour sweep so they stand out. */
.howto__tool {
  padding: 0.25rem var(--cds-spacing-04);
  font-size: 0.8125rem;
  font-family: var(--cds-font-mono);
  color: #fff;
  background-image: linear-gradient(
    90deg,
    var(--cds-blue-60, #0f62fe),
    var(--cds-cyan-60, #0072c3),
    var(--cds-purple-60, #8a3ffc),
    var(--cds-blue-60, #0f62fe)
  );
  background-size: 300% 100%;
  animation: howto-tool-shine 6s linear infinite;
}
@keyframes howto-tool-shine {
  0% { background-position: 0 0; }
  100% { background-position: 300% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .howto__tool { animation: none; background-image: none; background-color: var(--cds-blue-60, #0f62fe); }
}

/* Baked bilingual text: both languages present; CSS shows one per html[lang]. */
.gloss-km { display: none; }
html[lang="km"] .gloss-en { display: none; }
html[lang="km"] .gloss-km { display: inline; }
