/* =========================================================
   zaur-content.css - Layer A, loads on every front-end page
   =========================================================
   Styles for plugin markup that appears outside tools.

   Article code blocks are not here: their frame lives in the
   site's Additional CSS and their token colours in
   prism-zaur.css.

   Subnet bit diagram: moved verbatim from zaur-tools.css
   (section 16 and its two responsive overrides) in tools
   phase A, task 2. The IP subnet calculator renders it, and
   two articles embed the same markup as static HTML
   (/base64-encoding-explained-how-it-works-and-when-to-use-it/,
   /ip-subnetting-cheat-sheet/), where zaur-tools.css no
   longer loads.
   ========================================================= */


/* =========================================================
   16. Tool: IP Subnet calculator - binary visualization
   Grid-based layout, 32 columns for 32-bit IPv4 display.
   ========================================================= */

.zt-sc-binary {
  overflow-x: auto;
}

.zt-sc-bit-numbers,
.zt-sc-bit-values {
  display: grid;
  grid-template-columns: repeat(32, minmax(24px, 1fr));
  gap: 4px;
  align-items: center;
}

.zt-sc-bit-numbers {
  margin-bottom: 6px;
}

.zt-sc-bit-values {
  margin-bottom: 12px;
}

.zt-sc-bit-num {
  text-align: center;
  font-size: 0.72rem;
  line-height: 1;
  color: #64748b;
  font-weight: 600;
}

.zt-sc-bit {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border-radius: 10px;
  font-family: var(--zt-font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  border: 1px solid #dbe3ec;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}

.zt-sc-bit:hover {
  transform: translateY(-1px);
}

/* Bit color states */
.zt-sc-bit--net {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.zt-sc-bit--sub {
  background: #ffedd5;
  color: #c2410c;
  border-color: #fdba74;
}

.zt-sc-bit--host {
  background: #f1f5f9;
  color: var(--zt-text-body, #475569);
  border-color: #cbd5e1;
}

/* Octet boundary spacing */
.zt-sc-bit-values .zt-sc-bit:nth-child(8),
.zt-sc-bit-values .zt-sc-bit:nth-child(16),
.zt-sc-bit-values .zt-sc-bit:nth-child(24),
.zt-sc-bit-values .zt-sc-bit:nth-child(32) {
  margin-right: 8px;
}

.zt-sc-bit-numbers .zt-sc-bit-num:nth-child(8),
.zt-sc-bit-numbers .zt-sc-bit-num:nth-child(16),
.zt-sc-bit-numbers .zt-sc-bit-num:nth-child(24),
.zt-sc-bit-numbers .zt-sc-bit-num:nth-child(32) {
  margin-right: 8px;
}

/* Legend */
.zt-sc-bit-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  font-size: 0.88rem;
  color: var(--zt-text-body, #475569);
}

.zt-sc-bit-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.zt-sc-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
  border: 1px solid transparent;
}

.zt-sc-legend-dot--net {
  background: #bbf7d0;
  border-color: #86efac;
}

.zt-sc-legend-dot--sub {
  background: #fed7aa;
  border-color: #fdba74;
}

.zt-sc-legend-dot--host {
  background: var(--zt-bg-muted);
  border-color: #cbd5e1;
}

/* Binary meta text (bit count summary) */
.zt-sc-bit-meta {
  margin-top: 8px;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--zt-text-body, #475569);
  font-weight: 500;
}


@media (max-width: 900px) {
  .zt-sc-bit-numbers,
  .zt-sc-bit-values {
    grid-template-columns: repeat(32, 24px);
    width: max-content;
  }
}

@media (max-width: 600px) {
  .zt-sc-bit {
    font-size: 0.6rem;
    padding: 3px 0;
  }

  .zt-sc-bit-num {
    font-size: 0.5rem;
  }
}


/* =========================================================
   Tool card: [zt_tool_card] (includes/shortcodes/tool-card.php,
   tools phase A task 7). A compact call to action inside articles:
   topic icon, tool title and promise, one button to the tool page.
   Layer A on purpose: the article loads no tool CSS or JS.
   Topic colours come from --zt-topic-* in Additional CSS, as in
   the tool shell.
   ========================================================= */

.zt-tool-card--cmd {
  --zt-card-accent: var(--zt-topic-cmd);
  --zt-card-accent-bg: var(--zt-topic-cmd-bg);
}

.zt-tool-card--ps {
  --zt-card-accent: var(--zt-topic-ps);
  --zt-card-accent-bg: var(--zt-topic-ps-bg);
}

.zt-tool-card--ad {
  --zt-card-accent: var(--zt-topic-ad);
  --zt-card-accent-bg: var(--zt-topic-ad-bg);
}

.zt-tool-card--vm {
  --zt-card-accent: var(--zt-topic-vm);
  --zt-card-accent-bg: var(--zt-topic-vm-bg);
}

.zt-tool-card--net {
  --zt-card-accent: var(--zt-topic-net);
  --zt-card-accent-bg: var(--zt-topic-net-bg);
}

.zt-tool-card--sto {
  --zt-card-accent: var(--zt-topic-sto);
  --zt-card-accent-bg: var(--zt-topic-sto-bg);
}

.zt-tool-card--sec {
  --zt-card-accent: var(--zt-topic-sec);
  --zt-card-accent-bg: var(--zt-topic-sec-bg);
}

.zt-tool-card--lnx {
  --zt-card-accent: var(--zt-topic-lnx);
  --zt-card-accent-bg: var(--zt-topic-lnx-bg);
}

.zt-tool-card {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 28px 0;
  padding: 18px 20px;
  border: 1px solid var(--zt-border);
  border-left: 4px solid var(--zt-card-accent, var(--zt-primary));
  border-radius: var(--zt-radius-md);
  background: var(--zt-bg-subtle);
  box-shadow: var(--zt-shadow-sm);
}

.zt-tool-card__icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--zt-radius-sm);
  background: var(--zt-card-accent-bg, var(--zt-primary-light));
  color: var(--zt-card-accent, var(--zt-primary));
}

.zt-tool-card__text {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.zt-tool-card .zt-tool-card__title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--zt-text-primary);
}

.zt-tool-card .zt-tool-card__promise {
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--zt-text-secondary);
}

.zt-tool-card .zt-tool-card__button {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: var(--zt-radius-md);
  background: var(--zt-primary);
  color: var(--zt-primary-ink);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s ease;
}

.zt-tool-card .zt-tool-card__button:hover,
.zt-tool-card .zt-tool-card__button:focus-visible {
  background: var(--zt-primary-hover);
  color: var(--zt-primary-ink);
  text-decoration: none;
}

.zt-tool-card .zt-tool-card__button:focus-visible {
  outline: 2px solid var(--zt-primary);
  outline-offset: 2px;
}

.zt-tool-card__button .zt-icon {
  flex: none;
}

/* Phones: icon and text on one row, the button full width below. */
@media (max-width: 600px) {
  .zt-tool-card {
    flex-wrap: wrap;
    gap: 12px 14px;
    padding: 16px;
  }

  .zt-tool-card__text {
    flex-basis: calc(100% - 58px);
  }

  .zt-tool-card .zt-tool-card__button {
    flex-basis: 100%;
    white-space: normal;
  }
}


/* =========================================================
   Content layout helpers (L1, TOOLS-PHASE-C/L1-tool-page-layout.md)
   .zt-card: a card style for a core Group or Column block,
   added through the block's "Additional CSS class". The
   sections under a tool become grids of core Columns with
   these cards (built by the content session).
   ========================================================= */

.zt-card {
  box-sizing: border-box;
  padding: 18px 20px;
  border: 1px solid var(--zt-border);
  border-radius: var(--zt-radius-lg);
  background: var(--zt-bg-page);
}

.zt-card > :first-child {
  margin-top: 0;
}

.zt-card > :last-child {
  margin-bottom: 0;
}


/* =========================================================
   In-page navigation: [zt_page_nav] (includes/shortcodes/page-nav.php)
   One row of links, scrolled sideways when it does not fit.
   Sticky under the site header at 1100 px and wider; there
   it is 52 px high, which zaur-tools.css adds to the offset
   of a split tool's sticky output column, and the sections
   it links to get the same scroll margin on top of the
   html scroll-padding from Additional CSS.
   ========================================================= */

.zt-page-nav {
  margin: 0 0 16px;
  border-bottom: 1px solid var(--zt-border-light);
  background: var(--zt-bg-page);
}

.zt-page-nav .zt-page-nav__list {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 8px 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: thin;
}

.zt-page-nav .zt-page-nav__list > li {
  flex: none;
  margin: 0;
}

.zt-page-nav .zt-page-nav__link {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--zt-text-secondary);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.zt-page-nav .zt-page-nav__link:hover {
  background: var(--zt-bg-muted);
  color: var(--zt-text-primary);
}

.zt-page-nav .zt-page-nav__link:focus-visible {
  outline: 2px solid var(--zt-primary);
  outline-offset: -2px;
}

@media (min-width: 1100px) {
  .zt-page-nav {
    position: sticky;
    top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--zt-header-height, 0px));
    z-index: 40;
    box-sizing: border-box;
    height: 52px;
  }

  html:has(.zt-page-nav) :is(h2, h3, .zt-shell)[id] {
    scroll-margin-top: 52px;
  }
}
