/* ============================================================
   content.css — styles for the content system (content.js)
   Shared, unchanged, by sibylsoft.com and federatedcybersecurity.com.
   Cards, the hub, article pages, the slider, related articles and
   series navigation.

   It takes its look from the host site's design tokens (--primary,
   --ink, --border, --radius …), so load it after the site's own
   stylesheet. A site can also set these optional tokens:
     --cx-font-display  --cx-font-body   typefaces
     --cx-surface                        card and panel background
     --cx-rule                           hairline colour
     --cx-mark                           search highlight
     --cx-tone-0 … --cx-tone-3           one accent per topic group
   ============================================================ */

/* ── Elements ──────────────────────────────────────────────── */
content-hub,
content-article,
content-slider,
content-related,
content-series-nav {
  display: block;
}

content-hub[hidden],
content-article[hidden],
content-slider[hidden],
content-related[hidden],
content-series-nav[hidden] {
  display: none;
}

/* Hold the page open while the catalog loads */
content-hub:empty,
content-article:empty {
  min-height: 60vh;
}

.cx-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.cx-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--orange);
  background: #fdf0e8;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
}

.cx-empty {
  text-align: center;
  color: var(--muted);
  padding: 4rem 1rem;
}

/* ── Cards ─────────────────────────────────────────────────── */
.cx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.cx-card {
  --tone: var(--primary);
  display: flex;
  flex-direction: column;
  background: var(--cx-surface, white);
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--border);
  border-top: 3px solid var(--tone);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}

.cx-card[data-tone="0"] { --tone: var(--cx-tone-0, var(--primary)); }
.cx-card[data-tone="1"] { --tone: var(--cx-tone-1, var(--orange)); }
.cx-card[data-tone="2"] { --tone: var(--cx-tone-2, var(--blue)); }
.cx-card[data-tone="3"] { --tone: var(--cx-tone-3, var(--green)); }

.cx-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.cx-card:focus-visible,
.cx-chip:focus-visible,
.cx-arrow:focus-visible,
.cx-track:focus-visible,
.cx-series-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.cx-card-media {
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--off-white);
}

.cx-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cx-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.75rem;
}

.cx-card-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tone);
  margin-bottom: 0.75rem;
}

.cx-card-title {
  font-family: var(--cx-font-display, 'Montserrat', sans-serif);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 0.6rem;
}

.cx-card-summary {
  font-size: 0.9rem;
  color: var(--ink-soft);
  line-height: 1.65;
}

.cx-card-snippet {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.6;
  margin-top: 0.9rem;
  padding-left: 0.85rem;
  border-left: 2px solid var(--primary-light);
}

.cx-card mark {
  background: var(--cx-mark, rgba(127, 68, 248, 0.16));
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

.cx-card-foot {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 1.25rem;
}

.cx-card-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.cx-card-more {
  margin-left: auto;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--primary);
  white-space: nowrap;
}

/* ── Hub (resources.html) ──────────────────────────────────── */
.cx-hub {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 2.5rem 5rem;
}

.cx-search input {
  width: 100%;
  padding: 0.95rem 1.25rem 0.95rem 3rem;
  font-family: var(--cx-font-body, 'Roboto', sans-serif);
  font-size: 1rem;
  color: var(--ink);
  background: var(--cx-surface, white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23767676' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 1rem center / 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.cx-search input:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.cx-filters {
  margin-top: 1.5rem;
}

.cx-chips,
.cx-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.cx-filter-row {
  margin-top: 0.85rem;
}

.cx-chip {
  font-family: var(--cx-font-body, 'Roboto', sans-serif);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-soft);
  background: var(--cx-surface, white);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.45rem 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
}

.cx-chip span {
  font-size: 0.75rem;
  color: var(--muted);
  margin-left: 0.25rem;
}

.cx-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.cx-chip[aria-pressed="true"],
.cx-chip-active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.cx-chip[aria-pressed="true"] span,
.cx-chip-active span {
  color: rgba(255, 255, 255, 0.8);
}

.cx-chip-active:hover {
  background: var(--primary-dark);
  color: white;
}

.cx-select select {
  font-family: var(--cx-font-body, 'Roboto', sans-serif);
  font-size: 0.85rem;
  color: var(--ink-soft);
  background: var(--cx-surface, white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45rem 0.75rem;
  cursor: pointer;
}

.cx-select select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.cx-clear {
  font-family: var(--cx-font-body, 'Roboto', sans-serif);
  font-size: 0.85rem;
  color: var(--primary);
  background: none;
  border: none;
  padding: 0.45rem 0.5rem;
  cursor: pointer;
  text-decoration: underline;
}

.cx-status {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 1.5rem 0 1.25rem;
}

.cx-group + .cx-group {
  margin-top: 3.5rem;
}

.cx-group-head {
  margin-bottom: 1.5rem;
}

.cx-group-head h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
}

.cx-group-head p {
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin-top: 0.25rem;
}

/* ── Article (article.html) ────────────────────────────────── */
.hero.cx-article-hero {
  padding: 7rem 2.5rem 3.5rem;
}

.cx-article-head {
  max-width: 760px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.cx-article-hero h1 {
  font-size: clamp(1.9rem, 3.4vw, 2.6rem);
}

.cx-article-hero .hero-sub {
  max-width: none;
  margin-bottom: 1.25rem;
}

.cx-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

.cx-crumbs a {
  color: var(--primary);
  text-decoration: none;
}

.cx-crumbs a:hover {
  text-decoration: underline;
}

.cx-article-meta {
  font-size: 0.875rem;
  color: var(--muted);
}

.cx-article-body {
  max-width: calc(760px + 5rem);
  margin: 0 auto;
  padding: 3.5rem 2.5rem 4rem;
}

.cx-article-body p,
.cx-article-body li {
  font-size: 1.05rem;
  color: var(--ink-soft);
  line-height: 1.8;
}

.cx-article-body p {
  margin-bottom: 1.25rem;
}

.cx-article-body h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
  margin: 2.75rem 0 1rem;
  scroll-margin-top: 88px;
}

.cx-article-body > h2:first-child {
  margin-top: 0;
}

.cx-article-body h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  margin: 2rem 0 0.75rem;
  scroll-margin-top: 88px;
}

.cx-article-body ul,
.cx-article-body ol {
  padding-left: 1.4rem;
  margin-bottom: 1.25rem;
}

.cx-article-body li {
  margin-bottom: 0.6rem;
}

.cx-article-body strong {
  color: var(--ink);
  font-weight: 600;
}

.cx-article-body a {
  color: var(--primary);
}

.cx-article-body a:hover {
  color: var(--primary-dark);
}

.cx-article-body code {
  font-size: 0.9em;
  background: var(--off-white);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

.cx-article-body blockquote {
  background: var(--off-white);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  padding: 1.5rem 2rem;
  margin: 2rem 0;
}

.cx-article-body blockquote p {
  font-style: italic;
  color: var(--ink);
  margin-bottom: 0;
}

.cx-article-body blockquote cite {
  display: block;
  font-size: 0.875rem;
  font-style: normal;
  font-weight: 500;
  color: var(--muted);
  margin-top: 0.75rem;
}

.cx-callout {
  background: var(--primary-subtle);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.1rem 1.5rem;
  margin: 2rem 0;
  font-size: 1rem;
  color: var(--ink);
  line-height: 1.7;
}

.cx-figure {
  margin: 2rem 0;
}

.cx-figure-scroll {
  overflow-x: auto;
  background: var(--cx-surface, white);
  border: 1px solid var(--cx-rule, #e8e8f0);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.cx-figure img {
  display: block;
  width: 100%;
  min-width: 600px;
  height: auto;
}

.cx-figure figcaption {
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
  margin-top: 0.75rem;
}

.cx-table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin: 1.75rem 0;
}

.cx-table-scroll table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.cx-table-scroll th {
  font-family: var(--cx-font-display, 'Montserrat', sans-serif);
  font-size: 0.82rem;
  font-weight: 700;
  text-align: left;
  color: var(--ink);
  background: var(--primary-subtle);
  padding: 0.85rem 1.1rem;
}

.cx-table-scroll td {
  color: var(--ink-soft);
  line-height: 1.6;
  vertical-align: top;
  padding: 0.85rem 1.1rem;
  border-top: 1px solid var(--cx-rule, #e8e8f0);
}

.cx-table-scroll td:first-child {
  font-weight: 500;
  color: var(--ink);
}

.cx-article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--cx-rule, #e8e8f0);
}

.cx-article-body .cx-tag {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  background: var(--off-white);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.3rem 0.8rem;
  transition: all 0.2s;
}

.cx-article-body .cx-tag:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-subtle);
}

/* Copyright, trademark and license lines under an article */
.cx-notice {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--cx-rule, #e8e8f0);
}

.cx-article-tags + .cx-notice {
  margin-top: 1.5rem;
}

.cx-article-body .cx-notice p {
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.cx-article-body .cx-notice p:last-child {
  margin-bottom: 0;
}

/* ── Series navigation ─────────────────────────────────────── */
.cx-series {
  padding: 0 2.5rem 4.5rem;
}

.cx-series-inner {
  max-width: 760px;
  margin: 0 auto;
}

.cx-series-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.cx-series-link {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-decoration: none;
  background: var(--cx-surface, white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.cx-series-link:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.cx-series-next {
  text-align: right;
}

.cx-series-dir {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.cx-series-title {
  font-family: var(--cx-font-display, 'Montserrat', sans-serif);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
}

.cx-series-link:hover .cx-series-title {
  color: var(--primary);
}

/* ── Related articles ──────────────────────────────────────── */
.cx-related {
  background: var(--off-white);
  padding: 4.5rem 2.5rem;
}

.cx-related-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.cx-related .section-title {
  margin-bottom: 2rem;
}

/* ── Slider ────────────────────────────────────────────────── */
.cx-slider {
  padding: 5rem 2.5rem;
}

.cx-slider.cx-tint {
  background: var(--off-white);
}

.cx-slider-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.cx-slider-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.cx-slider-head .section-title {
  margin-bottom: 0;
}

.cx-slider-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.cx-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-size: 1rem;
  color: var(--primary);
  background: var(--cx-surface, white);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
}

.cx-arrow[hidden] {
  display: none;
}

.cx-arrow:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-subtle);
}

.cx-arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

.cx-slider-all {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
  margin-left: 0.75rem;
  white-space: nowrap;
}

.cx-slider-all:hover {
  text-decoration: underline;
}

.cx-track {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 4px;
  scrollbar-width: none;
  /* room for card shadows and the hover lift */
  padding: 6px 4px 1.25rem;
  margin: 0 -4px;
}

.cx-track::-webkit-scrollbar {
  display: none;
}

.cx-track .cx-card {
  flex: 0 0 calc((100% - 3rem) / 3);
  scroll-snap-align: start;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1000px) {
  .cx-track .cx-card {
    flex-basis: calc((100% - 1.5rem) / 2);
  }
}

@media (max-width: 900px) {
  .cx-hub {
    padding: 2rem 1.25rem 4rem;
  }

  .hero.cx-article-hero {
    padding: 6.5rem 1.25rem 2.5rem;
  }

  .cx-article-body {
    padding: 2.5rem 1.25rem 3rem;
  }

  .cx-series {
    padding: 0 1.25rem 3.5rem;
  }

  .cx-related,
  .cx-slider {
    padding: 4rem 1.25rem;
  }
}

@media (max-width: 640px) {
  .cx-grid {
    grid-template-columns: 1fr;
  }

  .cx-track .cx-card {
    flex-basis: 86%;
  }

  .cx-slider-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .cx-series-links {
    grid-template-columns: 1fr;
  }

  .cx-series-next {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cx-card,
  .cx-card:hover {
    transition: none;
    transform: none;
  }
}
