/* ==========================================================================
   article-media.css
   --------------------------------------------------------------------------
   Additive polish for technical articles that include real screenshots,
   step-numbered sections, and terminal output (currently used by the VIOS
   migration article). This file does NOT redefine anything already owned by
   tokens.css / theme.css / pages/article-common.css (page shell, base
   headings, .note, .table-wrap, .toc structure, .article-card, pre/code
   base styling, .flow-strip, .back-btn, etc.) — it only layers presentation
   on top of those existing components and adds the few new ones this
   article needed (figures, lightbox, migration timeline, step numbers,
   command/output distinction).

   All custom properties fall back gracefully if the site's real token
   names differ, so this degrades safely rather than breaking.

   Contents:
     1. Variables (local fallbacks)
     2. Base scoping
     3. Typography refinements
     4. Hero
     5. Table of contents (sticky + active state)
     6. Section headings (step numbers)
     7. Code blocks (terminal styling + command/output distinction)
     8. Callouts (info / important / warning / tip)
     9. Tables
     10. Figures / screenshots
     11. Figure lightbox
     12. Migration timeline
     13. Flow strip — step badges + progression accent
     14. Micro-interactions
     15. Responsive
     16. Accessibility / reduced motion
   ========================================================================== */

/* -------------------------------------------------------------------------
   1. Variables
   ------------------------------------------------------------------------- */
.article-content,
.figure-lightbox {
  --am-bg: var(--bg, var(--color-bg, #0b0f14));
  --am-surface: var(--surface, var(--color-surface, #11161d));
  --am-surface-alt: var(--surface-2, var(--color-surface-alt, #151b23));
  --am-text: var(--text, var(--color-text, #e6edf3));
  --am-muted: var(--text-secondary, var(--color-text-secondary, #94a3b8));
  --am-border: var(--border-color, var(--color-border, rgba(148, 163, 184, 0.2)));
  --am-accent: var(--accent, var(--color-accent, #22c55e));
  --am-accent-hover: var(--accent-hover, var(--color-accent-hover, #16a34a));
  --am-code-bg: var(--code-bg, #0d1117);
  --am-code-text: var(--code-text, #d7e0ea);
  --am-warning: var(--color-warning, #f5a524);
  --am-info: var(--color-info, #3b9eff);
  --am-radius: var(--radius-lg, 10px);
  --am-radius-sm: var(--radius-md, 7px);
}

/* -------------------------------------------------------------------------
   3. Typography refinements
   ------------------------------------------------------------------------- */
.article-content {
  font-size: 1.0625rem;
  line-height: 1.75;
}

.article-content p {
  max-width: 68ch;
}

.article-content h2 {
  margin-top: 3rem;
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

.article-content h3 {
  margin-top: 2rem;
  letter-spacing: -0.005em;
}

/* -------------------------------------------------------------------------
   4. Hero
   ------------------------------------------------------------------------- */
.article-hero--aix {
  padding-bottom: 2.25rem;
  border-bottom: 1px solid var(--am-border);
}

.article-hero--aix .eyebrow {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--am-accent);
}

.article-hero--aix .article-title {
  margin-top: 0.6rem;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.article-hero--aix .article-dek {
  margin-top: 0.85rem;
  max-width: 62ch;
  color: var(--am-muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.article-hero--aix .article-meta {
  margin-top: 1.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.article-hero--aix .meta-pill {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* -------------------------------------------------------------------------
   5. Table of contents — sticky + active state
   ------------------------------------------------------------------------- */
@media (min-width: 1025px) {
  .article-layout {
    align-items: flex-start;
  }

  .toc {
    position: sticky;
    top: 1.5rem;
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
    scrollbar-width: thin;
  }
}

.toc h2 {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--am-muted);
  margin-bottom: 0.75rem;
}

.toc a {
  display: block;
  padding: 0.32rem 0 0.32rem 0.75rem;
  border-left: 2px solid transparent;
  font-size: 0.9rem;
  color: var(--am-muted);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.toc a:hover {
  color: var(--am-text);
  border-left-color: var(--am-border);
}

.toc a.active {
  color: var(--am-accent);
  border-left-color: var(--am-accent);
  font-weight: 600;
}

/* -------------------------------------------------------------------------
   6. Section headings — step numbers
   ------------------------------------------------------------------------- */
.h2-step {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
}

.step-num {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.9rem;
  height: 1.9rem;
  padding: 0 0.15rem;
  border-radius: 999px;
  border: 1px solid var(--am-border);
  background: var(--am-surface-alt);
  color: var(--am-accent);
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.step-num::before {
  content: "";
}

/* -------------------------------------------------------------------------
   7. Code blocks — terminal styling + command/output distinction
   ------------------------------------------------------------------------- */
.article-content pre {
  position: relative;
  background: var(--am-code-bg);
  color: var(--am-code-text);
  border: 1px solid var(--am-border);
  border-radius: var(--am-radius);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  padding: 2.1rem 1.1rem 1.1rem;
  margin: 1.25rem 0;
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.65;
}

.article-content pre::before {
  content: "";
  position: absolute;
  top: 0.7rem;
  left: 1.1rem;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.35);
  box-shadow: 0.95rem 0 0 rgba(148, 163, 184, 0.35),
    1.9rem 0 0 rgba(148, 163, 184, 0.35);
}

.article-content pre code {
  background: none;
  padding: 0;
  font-family: var(--font-mono, ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace);
}

/* Output-only blocks (a returned value / example result rather than a
   typed command) get a quieter, labeled treatment so command vs. output
   is visually distinguishable without restructuring the article. */
.article-content pre.pre-output {
  background: var(--am-surface-alt);
  color: var(--am-muted);
  border-left: 3px solid var(--am-accent);
  padding-top: 1.1rem;
}

.article-content pre.pre-output::before {
  content: "OUTPUT";
  position: static;
  display: block;
  width: auto;
  height: auto;
  border-radius: 0;
  background: none;
  box-shadow: none;
  margin-bottom: 0.5rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--am-accent);
  font-family: var(--font-sans, inherit);
}

/* -------------------------------------------------------------------------
   8. Callouts — info / important / warning / tip
   ------------------------------------------------------------------------- */
.note {
  border-radius: var(--am-radius-sm);
  border: 1px solid var(--am-border);
  border-left-width: 3px;
  background: var(--am-surface-alt);
  padding: 0.9rem 1.1rem;
}

.note strong:first-child {
  display: inline-block;
  margin-bottom: 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.note[data-callout="important"] {
  border-left-color: var(--am-accent);
}
.note[data-callout="important"] strong:first-child {
  color: var(--am-accent);
}

.note[data-callout="warning"] {
  border-left-color: var(--am-warning);
}
.note[data-callout="warning"] strong:first-child {
  color: var(--am-warning);
}

.note[data-callout="info"] {
  border-left-color: var(--am-info);
}
.note[data-callout="info"] strong:first-child {
  color: var(--am-info);
}

.note[data-callout="tip"] {
  border-left-color: var(--am-accent-hover);
}
.note[data-callout="tip"] strong:first-child {
  color: var(--am-accent-hover);
}

/* -------------------------------------------------------------------------
   9. Tables
   ------------------------------------------------------------------------- */
.table-wrap table {
  font-size: 0.92rem;
}

.table-wrap th {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--am-muted);
}

.table-wrap td,
.table-wrap th {
  padding: 0.6rem 0.85rem;
}

.table-wrap tbody tr {
  border-top: 1px solid var(--am-border);
}

/* -------------------------------------------------------------------------
   10. Figures / screenshots
   ------------------------------------------------------------------------- */
.article-figure {
  margin: 1.75rem 0;
  border: 1px solid var(--am-border);
  border-radius: var(--am-radius);
  background: var(--am-surface);
  overflow: hidden;
}

.article-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-bottom: 1px solid var(--am-border);
  background: #0b0f14;
}

.article-figure img.is-zoomable {
  cursor: zoom-in;
}

.article-figure img:hover,
.article-figure img:focus-visible {
  filter: brightness(1.04);
}

.article-figure figcaption {
  padding: 0.65rem 1rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--am-muted);
}

.article-figure figcaption code {
  font-size: 0.85em;
}

/* Two screenshots documenting the same step performed on each VIOS
   (VIOS2 then VIOS1) sit side by side on wide screens and stack on
   narrow ones. */
.figure-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin: 1.75rem 0;
}

.figure-grid .article-figure {
  margin: 0;
  position: relative;
}

.figure-grid .figure-tag {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 1;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #06120a;
  background: var(--am-accent);
}

/* -------------------------------------------------------------------------
   11. Figure lightbox
   ------------------------------------------------------------------------- */
.figure-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 4rem 1.25rem 2rem;
  background: rgba(4, 6, 10, 0.88);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease;
}

.figure-lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.figure-lightbox.no-motion {
  transition: none;
}

.figure-lightbox-img {
  max-width: min(96vw, 1400px);
  max-height: 82vh;
  border-radius: var(--am-radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.figure-lightbox-caption {
  max-width: 70ch;
  text-align: center;
  color: #cbd5e1;
  font-size: 0.9rem;
}

.figure-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.figure-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.14);
}

body.figure-lightbox-lock {
  overflow: hidden;
}

/* -------------------------------------------------------------------------
   12. Migration timeline (before / migration order / after)
   ------------------------------------------------------------------------- */
.migration-timeline {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.75rem 0 2.25rem;
  padding: 1.1rem;
  border: 1px solid var(--am-border);
  border-radius: var(--am-radius);
  background: var(--am-surface);
}

.mt-stage {
  flex: 1;
  min-width: 0;
}

.mt-stage--active {
  position: relative;
}

.mt-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--am-muted);
  margin-bottom: 0.55rem;
}

.mt-rows {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.mt-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.mt-node {
  color: var(--am-text);
  font-weight: 600;
}

.mt-version {
  font-variant-numeric: tabular-nums;
  color: var(--am-muted);
  font-family: var(--font-mono, ui-monospace, monospace);
}

.mt-version--target {
  color: var(--am-accent);
}

.mt-arrow {
  flex: none;
  color: var(--am-muted);
  font-size: 1.1rem;
}

/* -------------------------------------------------------------------------
   13. Flow strip — step badges + progression accent
   -------------------------------------------------------------------------
   Scoped to .article-content so the sitewide .flow-strip/.flow-step
   component (owned by article-common.css) is untouched everywhere else it
   is used. This only gives the step number the same circular badge
   treatment already used for .step-num on the h2-step headings elsewhere
   in this article, and adds a left-to-right accent progression on the top
   border so the six boxes read as an ordered flow rather than a flat,
   identical-looking list.
   ------------------------------------------------------------------------- */
.article-content .flow-strip .flow-step {
  border-top: 2px solid var(--am-border);
}

.article-content .flow-strip .flow-step strong {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.article-content .flow-strip .flow-num {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  border: 1px solid var(--am-border);
  background: var(--am-surface-alt);
  color: var(--am-accent);
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.article-content .flow-strip .flow-step:nth-child(1) {
  border-top-color: color-mix(in srgb, var(--am-accent) 30%, var(--am-border));
}
.article-content .flow-strip .flow-step:nth-child(2) {
  border-top-color: color-mix(in srgb, var(--am-accent) 44%, var(--am-border));
}
.article-content .flow-strip .flow-step:nth-child(3) {
  border-top-color: color-mix(in srgb, var(--am-accent) 58%, var(--am-border));
}
.article-content .flow-strip .flow-step:nth-child(4) {
  border-top-color: color-mix(in srgb, var(--am-accent) 72%, var(--am-border));
}
.article-content .flow-strip .flow-step:nth-child(5) {
  border-top-color: color-mix(in srgb, var(--am-accent) 86%, var(--am-border));
}
.article-content .flow-strip .flow-step:nth-child(6) {
  border-top-color: var(--am-accent);
}

/* -------------------------------------------------------------------------
   14. Responsive
   ------------------------------------------------------------------------- */
@media (max-width: 720px) {
  .figure-grid {
    grid-template-columns: 1fr;
  }

  .migration-timeline {
    flex-direction: column;
    align-items: stretch;
  }

  .mt-arrow {
    transform: rotate(90deg);
    align-self: center;
  }

  .article-content pre {
    padding: 1.9rem 0.85rem 0.9rem;
    font-size: 0.85rem;
  }

  .figure-lightbox {
    padding: 3.25rem 0.75rem 1.5rem;
  }
}

/* -------------------------------------------------------------------------
   15. Accessibility / reduced motion
   ------------------------------------------------------------------------- */
.toc a:focus-visible,
.article-figure img:focus-visible,
.figure-lightbox-close:focus-visible {
  outline: 2px solid var(--am-accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .toc a,
  .article-figure img,
  .figure-lightbox {
    transition: none !important;
  }
}
