/* Content graph pages — light defaults, dark via system preference */
.cg-page {
  --cg-text: #1a202c;
  --cg-text-secondary: #4a5568;
  --cg-text-muted: #718096;
  --cg-link: #1a365d;
  --cg-border: #e2e8f0;
  --cg-input-border: #cbd5e0;
  --cg-surface-muted: #f7fafc;
  --cg-button-bg: #1a365d;
  --cg-button-bg-hover: #2c5282;
  --cg-button-text: #fff;
  --cg-button-secondary-bg: #fff;
  --cg-button-secondary-hover: #edf2f7;

  max-width: 920px;
  color: var(--cg-text);
}

@media (prefers-color-scheme: dark) {
  .cg-page {
    --cg-text: #e2e8f0;
    --cg-text-secondary: #cbd5e1;
    --cg-text-muted: #94a3b8;
    --cg-link: #93c5fd;
    --cg-border: #334155;
    --cg-input-border: #475569;
    --cg-surface-muted: #1e293b;
    --cg-button-bg: #3b82f6;
    --cg-button-bg-hover: #60a5fa;
    --cg-button-text: #0f172a;
    --cg-button-secondary-bg: transparent;
    --cg-button-secondary-hover: #1e293b;
  }
}

.cg-header h1 {
  margin-bottom: 0.35rem;
  font-size: clamp(1.75rem, 2.5vw, 2.25rem);
  font-weight: 700;
  color: var(--cg-text);
}

.cg-lead {
  color: var(--cg-text-secondary);
  max-width: 42rem;
  margin-bottom: 1rem;
}

.cg-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin: 0 0 1.5rem;
  padding: 0;
}

.cg-nav a {
  color: var(--cg-link);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 2px solid transparent;
}

.cg-nav a:hover,
.cg-nav a:focus {
  border-bottom-color: var(--cg-link);
}

.cg-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

.cg-list-item {
  border-top: 1px solid var(--cg-border);
  padding-top: 1rem;
}

.cg-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.cg-card-link h2,
.cg-card-link h3 {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
  color: var(--cg-text);
}

.cg-card-link:hover h2,
.cg-card-link:hover h3 {
  color: var(--cg-link);
}

.cg-meta {
  color: var(--cg-text-muted);
  font-size: 0.9rem;
  margin: 0.25rem 0;
}

.cg-section {
  margin: 2rem 0;
}

.cg-section h2 {
  font-size: 1.2rem;
  margin-bottom: 0.65rem;
  color: var(--cg-text);
}

.cg-related {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.cg-related a {
  color: var(--cg-link);
  font-weight: 600;
  text-decoration: none;
}

.cg-related a:hover {
  text-decoration: underline;
}

.cg-claim-form {
  display: grid;
  gap: 0.75rem;
  max-width: 32rem;
}

.cg-claim-form label {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
  color: var(--cg-text);
}

.cg-claim-form textarea,
.cg-claim-form input {
  font: inherit;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--cg-input-border);
  border-radius: 0.25rem;
  background: var(--cg-surface-muted);
  color: var(--cg-text);
}

.cg-button {
  justify-self: start;
  display: inline-block;
  background: var(--cg-button-bg);
  color: var(--cg-button-text);
  border: 0;
  border-radius: 0.25rem;
  padding: 0.55rem 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.cg-button:hover {
  background: var(--cg-button-bg-hover);
  color: var(--cg-button-text);
}

.cg-button--secondary {
  background: var(--cg-button-secondary-bg);
  color: var(--cg-link);
  border: 1px solid var(--cg-link);
}

.cg-button--secondary:hover {
  background: var(--cg-button-secondary-hover);
  color: var(--cg-link);
}

.cg-contribute-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.cg-empty {
  color: var(--cg-text-muted);
}

/* Force readable RTL for content-graph pages in Persian mode */
.cg-page[dir="rtl"],
.cg-page.persian-text,
.cg-page.cg-page--rtl {
  direction: rtl !important;
  text-align: right !important;
}

.cg-page[dir="rtl"] .cg-header,
.cg-page[dir="rtl"] .cg-list,
.cg-page[dir="rtl"] .cg-detail,
.cg-page[dir="rtl"] .cg-section,
.cg-page[dir="rtl"] .cg-card-link,
.cg-page[dir="rtl"] .cg-lead,
.cg-page[dir="rtl"] .cg-meta,
.cg-page[dir="rtl"] .cg-empty,
.cg-page[dir="rtl"] .cg-prose,
.cg-page[dir="rtl"] .cg-quote {
  direction: rtl !important;
  text-align: right !important;
}

.cg-page[dir="rtl"] .cg-lead {
  margin-left: auto;
  margin-right: 0;
  max-width: 42rem;
}

.cg-page[dir="rtl"] .cg-nav {
  flex-direction: row;
  justify-content: flex-start;
}

.cg-page[dir="rtl"] .cg-claim-form {
  margin-left: auto;
  margin-right: 0;
}

.cg-page[dir="rtl"] .cg-claim-form label {
  text-align: right !important;
}

.cg-page[dir="rtl"] .cg-button {
  justify-self: start;
}

.cg-page[dir="rtl"] input[dir="ltr"],
.cg-page[dir="rtl"] a[href^="http"] {
  direction: ltr;
  unicode-bidi: isolate;
}

.cg-prose {
  line-height: 1.7;
  color: var(--cg-text);
  max-width: 42rem;
}

.cg-page[dir="rtl"] .cg-lead,
.cg-page[dir="rtl"] .cg-prose,
.cg-page[dir="rtl"] .cg-quote p {
  text-align: justify !important;
  text-align-last: start;
  text-justify: inter-word;
  font-weight: 500;
}

.cg-section--about .cg-prose + .cg-prose {
  margin-top: 1rem;
}

.cg-why-read {
  padding: 1.25rem 1.35rem;
  background: var(--cg-surface-muted);
  border: 1px solid var(--cg-border);
  border-inline-start: 3px solid var(--cg-accent);
  border-radius: 0.35rem;
  max-width: 44rem;
}

.cg-why-read h2 {
  margin-top: 0;
  color: var(--cg-accent);
}

.cg-why-read .cg-prose {
  margin-bottom: 0;
}

.cg-why-read .cg-prose + .cg-prose {
  margin-top: 0.9rem;
}

.cg-page--work-gateway .cg-section--about .cg-prose {
  font-size: 1.05rem;
}

.cg-quote {
  margin: 0;
  padding: 0.85rem 1rem;
  border-inline-start: 3px solid var(--cg-link);
  background: var(--cg-surface-muted);
  max-width: 42rem;
  color: var(--cg-text);
}

.cg-quote p {
  margin: 0;
  font-style: italic;
  line-height: 1.6;
  color: var(--cg-text);
}

.cg-explore-group {
  margin-top: 1.15rem;
}

.cg-explore-group h3 {
  font-size: 1rem;
  margin: 0 0 0.45rem;
  color: var(--cg-text);
  font-weight: 600;
}

.cg-page[dir="rtl"] .cg-explore-group,
.cg-page[dir="rtl"] .cg-explore {
  direction: rtl !important;
  text-align: right !important;
}

.cg-entity-badge {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--cg-text-muted);
}

.cg-page-headline {
  margin: 0.35rem 0 0.75rem;
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  font-weight: 600;
  line-height: 1.35;
  color: var(--cg-text);
  max-width: 40rem;
}

.cg-layer {
  margin: 2.5rem 0;
  padding-top: 0.5rem;
  border-top: 1px solid var(--cg-border);
}

.cg-layer-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 0 0 1rem;
  color: var(--cg-link);
}

.cg-layer h3 {
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
  color: var(--cg-text);
}

.cg-layer h4 {
  font-size: 0.95rem;
  margin: 0 0 0.4rem;
  color: var(--cg-text);
}

.cg-theme-card {
  margin: 1.25rem 0;
  padding: 1rem 1.1rem;
  background: var(--cg-surface-muted);
  border-inline-start: 3px solid var(--cg-link);
}

.cg-theme-question {
  font-weight: 600;
  font-style: italic;
  color: var(--cg-text);
  margin: 0.35rem 0 0.65rem;
  max-width: 40rem;
  line-height: 1.55;
}

.cg-chip-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.cg-chip-list li {
  font-size: 0.85rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--cg-border);
  border-radius: 0.25rem;
  color: var(--cg-text-secondary);
  background: transparent;
}

.cg-influence-map {
  margin-top: 1.75rem;
  display: grid;
  gap: 1rem;
}

@media (min-width: 720px) {
  .cg-influence-map {
    grid-template-columns: 1fr auto 1fr;
    align-items: start;
  }
}

.cg-influence-map__col ul {
  margin: 0;
  padding-inline-start: 1.1rem;
  color: var(--cg-text-secondary);
  line-height: 1.55;
}

.cg-influence-map__center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.75rem 0.5rem;
  text-align: center;
  font-weight: 700;
}

.cg-influence-map__arrow {
  color: var(--cg-text-muted);
  font-size: 1.1rem;
}

.cg-encounter-list {
  margin: 1.25rem 0;
  padding-inline-start: 1.25rem;
  display: grid;
  gap: 1.15rem;
}

.cg-encounter-list li {
  max-width: 40rem;
}

.cg-challenge {
  margin-top: 1.5rem;
  padding: 1.1rem 1.2rem;
  background: var(--cg-surface-muted);
  border: 1px solid var(--cg-border);
  max-width: 42rem;
}

.cg-principle {
  margin: 0.85rem 0 0;
  font-weight: 600;
  color: var(--cg-text-secondary);
  line-height: 1.55;
}

.cg-page[dir="rtl"] .cg-layer,
.cg-page[dir="rtl"] .cg-theme-card,
.cg-page[dir="rtl"] .cg-influence-map,
.cg-page[dir="rtl"] .cg-encounter-list,
.cg-page[dir="rtl"] .cg-challenge,
.cg-page[dir="rtl"] .cg-page-headline {
  direction: rtl !important;
  text-align: right !important;
}

/* —— Atlas / museum entity pages (distinct from social user profiles) —— */
.cg-page--atlas {
  --cg-text: #1c1917;
  --cg-text-secondary: #44403c;
  --cg-text-muted: #78716c;
  --cg-link: #44403c;
  --cg-border: #d6d3d1;
  --cg-input-border: #a8a29e;
  --cg-surface-muted: #f5f5f4;
  --cg-button-bg: #292524;
  --cg-button-bg-hover: #44403c;
  --cg-button-text: #fafaf9;
  --cg-button-secondary-bg: transparent;
  --cg-button-secondary-hover: #f5f5f4;
  --cg-hero-bg: #1c1917;
  --cg-hero-text: #fafaf9;
  --cg-hero-muted: #d6d3d1;
  --cg-aside-bg: #fafaf9;
  max-width: 1120px;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  .cg-page--atlas {
    --cg-text: #e7e5e4;
    --cg-text-secondary: #d6d3d1;
    --cg-text-muted: #a8a29e;
    --cg-link: #d6d3d1;
    --cg-border: #44403c;
    --cg-input-border: #57534e;
    --cg-surface-muted: #292524;
    --cg-button-bg: #e7e5e4;
    --cg-button-bg-hover: #fafaf9;
    --cg-button-text: #1c1917;
    --cg-button-secondary-bg: transparent;
    --cg-button-secondary-hover: #292524;
    --cg-hero-bg: #0c0a09;
    --cg-hero-text: #fafaf9;
    --cg-hero-muted: #a8a29e;
    --cg-aside-bg: #1c1917;
  }
}

.cg-page--atlas .cg-header h1,
.cg-atlas-header h1 {
  font-family: inherit;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: clamp(2rem, 3.5vw, 2.75rem);
  margin: 0.25rem 0 0.5rem;
}

.cg-atlas-header {
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--cg-border);
}

.cg-icon {
  display: inline-block;
  margin-inline-end: 0.35rem;
  opacity: 0.75;
  font-style: normal;
}

.cg-atlas-layout {
  display: grid;
  gap: 2rem;
}

@media (min-width: 960px) {
  .cg-atlas-layout {
    grid-template-columns: minmax(0, 1fr) 280px;
    align-items: start;
    gap: 2.5rem;
  }
}

.cg-explore-sticky {
  position: sticky;
  top: 1.25rem;
  padding: 1.1rem 1.15rem;
  background: var(--cg-aside-bg);
  border: 1px solid var(--cg-border);
}

.cg-explore-title {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cg-text-muted);
}

.cg-explore-block {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--cg-border);
}

.cg-explore-block:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.cg-explore-block h3 {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.cg-explore-block--cta .cg-button {
  margin-top: 0.65rem;
  width: 100%;
  text-align: center;
}

.cg-hero-encounter {
  background: var(--cg-hero-bg);
  color: var(--cg-hero-text);
  padding: 1.75rem 1.5rem 2rem;
  margin: 0 0 2rem;
}

.cg-hero-encounter .cg-theme-question,
.cg-hero-encounter .cg-prose,
.cg-hero-encounter .cg-principle,
.cg-hero-encounter h2,
.cg-hero-encounter h3 {
  color: var(--cg-hero-text);
}

.cg-hero-encounter .cg-meta {
  color: var(--cg-hero-muted);
}

.cg-hero-kicker {
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cg-hero-muted);
}

.cg-hero-encounter h2 {
  margin: 0 0 0.85rem;
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  font-weight: 600;
  line-height: 1.3;
  max-width: 36rem;
}

.cg-hero-lead {
  margin: 0 0 1.25rem;
  color: var(--cg-hero-muted);
  max-width: 38rem;
  line-height: 1.65;
  font-size: 1.05rem;
}

.cg-hero-encounter .cg-challenge {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
}

.cg-layer--muted {
  opacity: 0.92;
}

.cg-layer--muted .cg-layer-title {
  color: var(--cg-text-muted);
  font-weight: 600;
}

.cg-prose--compact {
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 38rem;
}

.cg-bio-more {
  margin: 0.75rem 0 1rem;
  max-width: 38rem;
}

.cg-bio-more summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--cg-text-secondary);
  margin-bottom: 0.5rem;
}

.cg-media-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.cg-media-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--cg-border);
}

.cg-media-kind {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cg-text-muted);
  margin-inline-end: 0.5rem;
}

.cg-journey-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.cg-journey-list a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--cg-text);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.cg-journey-list a:hover {
  border-bottom-color: var(--cg-text);
}

.cg-journey-arrow {
  color: var(--cg-text-muted);
}

.cg-ecosystem-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.15rem;
}

.cg-eco-label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.35rem;
  font-size: 0.95rem;
}

.cg-empty-cta {
  margin: 0;
  color: var(--cg-text-muted);
  font-size: 0.92rem;
  line-height: 1.5;
  max-width: 28rem;
}

.cg-text-link {
  display: inline-block;
  margin-top: 0.35rem;
  color: var(--cg-link);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.cg-inspired-cta {
  margin: 2.5rem 0 1.5rem;
  padding: 1.75rem 1.5rem;
  border: 2px solid var(--cg-text);
  background: var(--cg-surface-muted);
}

.cg-inspired-cta h2 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
}

.cg-inspired-cta p {
  margin: 0 0 1.15rem;
  max-width: 36rem;
  color: var(--cg-text-secondary);
  line-height: 1.6;
}

.cg-inspired-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.cg-section--quiet {
  opacity: 0.85;
}

.cg-page--atlas[dir="rtl"] .cg-atlas-header,
.cg-page--atlas[dir="rtl"] .cg-hero-encounter,
.cg-page--atlas[dir="rtl"] .cg-continue,
.cg-page--atlas[dir="rtl"] .cg-ecosystem,
.cg-page--atlas[dir="rtl"] .cg-inspired-cta,
.cg-page--atlas[dir="rtl"] .cg-explore-sticky {
  direction: rtl !important;
  text-align: right !important;
}

/* —— Catalog indexes (ui-ux-pro-max: Soft UI + Academic Journal) —— */
.cg-page--catalog,
.cg-page--atlas {
  --cg-font-display: "Cinzel", "Times New Roman", serif;
  --cg-font-heading: "Cormorant Garamond", Georgia, serif;
  --cg-font-body: "Crimson Pro", Georgia, serif;
  --cg-space-sm: 0.5rem;
  --cg-space-md: 1rem;
  --cg-space-lg: 1.5rem;
  --cg-space-xl: 2rem;
  --cg-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --cg-shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  font-family: var(--cg-font-body);
}

.cg-page--catalog {
  --cg-text: #0f172a;
  --cg-text-secondary: #334155;
  --cg-text-muted: #64748b;
  --cg-link: #1e3a5f;
  --cg-border: #cbd5e1;
  --cg-surface-muted: #e9eef5;
  --cg-card: #ffffff;
  --cg-accent: #b45309;
  --cg-button-bg: #1e3a5f;
  --cg-button-bg-hover: #152a45;
  --cg-button-text: #ffffff;
  --cg-button-secondary-bg: transparent;
  --cg-button-secondary-hover: #f1f5f9;
  background: #f7f5f2;
  max-width: min(1120px, 100%);
  width: 100%;
  color: var(--cg-text);
  overflow-x: clip;
  overscroll-behavior-x: none;
  touch-action: pan-y;
  box-sizing: border-box;
}

/* Catalog pages must not create sideways touch scrolling on phones */
html:has(.cg-page--catalog),
body:has(.cg-page--catalog) {
  overflow-x: hidden;
}

@media (prefers-color-scheme: dark) {
  .cg-page--catalog {
    --cg-text: #e7e5e4;
    --cg-text-secondary: #d6d3d1;
    --cg-text-muted: #a8a29e;
    --cg-link: #93c5fd;
    --cg-border: #44403c;
    --cg-surface-muted: #292524;
    --cg-card: #1c1917;
    --cg-accent: #d97706;
    --cg-button-bg: #e7e5e4;
    --cg-button-bg-hover: #fafaf9;
    --cg-button-text: #1c1917;
    --cg-button-secondary-hover: #292524;
    background: #0c0a09;
  }
}

.cg-page--catalog h1,
.cg-page--catalog h2,
.cg-page--catalog h3,
.cg-page--atlas h1,
.cg-page--atlas h2,
.cg-page--atlas h3 {
  font-family: var(--cg-font-heading);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.cg-skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  background: var(--cg-button-bg);
  color: var(--cg-button-text);
  z-index: 100;
  border-radius: 0.25rem;
}

.cg-skip-link:focus {
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0.5rem 0.75rem;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

.cg-catalog-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  margin-bottom: var(--cg-space-xl);
  padding-bottom: var(--cg-space-lg);
  border-bottom: 1px solid var(--cg-border);
  max-width: 100%;
  min-width: 0;
}

.cg-catalog-hero__main {
  flex: 1 1 18rem;
  min-width: 0;
}

.cg-catalog-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  margin-bottom: var(--cg-space-lg);
}

.cg-catalog-hero h1 {
  margin: 0.35rem 0 0.65rem;
  font-size: clamp(2.1rem, 4vw, 3rem);
  line-height: 1.15;
  color: var(--cg-text);
}

.cg-catalog-hero .cg-lead {
  max-width: 40rem;
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--cg-text-secondary);
}

.cg-icon-diamond {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-inline-end: 0.4rem;
  border: 1.5px solid currentColor;
  transform: rotate(45deg);
  vertical-align: 0.1em;
}

.cg-page--catalog .cg-entity-badge,
.cg-page--atlas .cg-entity-badge {
  font-family: var(--cg-font-display);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--cg-accent);
}

.cg-page--catalog .cg-nav,
.cg-page--atlas .cg-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.25rem 0 0;
  padding: 0;
  max-width: 100%;
  min-width: 0;
}

.cg-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--cg-border);
  border-radius: 999px;
  color: var(--cg-text-secondary);
  text-decoration: none;
  font-family: var(--cg-font-body);
  font-weight: 600;
  font-size: 0.95rem;
  background: var(--cg-card);
  cursor: pointer;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.cg-nav__link:hover,
.cg-nav__link:focus-visible {
  border-color: var(--cg-link);
  color: var(--cg-link);
  box-shadow: var(--cg-shadow-sm);
  outline: none;
}

.cg-nav__link:focus-visible {
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.25);
}

.cg-nav__link.is-active {
  background: var(--cg-button-bg);
  border-color: var(--cg-button-bg);
  color: var(--cg-button-text);
}

.cg-nav__mark {
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
}

.cg-catalog-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--cg-space-lg);
  grid-template-columns: minmax(0, 1fr);
  max-width: 100%;
  min-width: 0;
}

.cg-catalog-grid > li {
  min-width: 0;
  max-width: 100%;
}

@media (min-width: 640px) {
  .cg-catalog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .cg-catalog-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .cg-catalog-grid--compact {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.cg-catalog-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 11rem;
  min-width: 0;
  max-width: 100%;
  padding: 1.25rem 1.2rem 1.15rem;
  background: var(--cg-card);
  border: 1px solid var(--cg-border);
  border-radius: 0.35rem;
  box-shadow: var(--cg-shadow-sm);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.cg-catalog-card:hover,
.cg-catalog-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--cg-shadow-md);
  border-color: var(--cg-link);
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  .cg-catalog-card,
  .cg-nav__link {
    transition: none;
  }

  .cg-catalog-card:hover,
  .cg-catalog-card:focus-visible {
    transform: none;
  }
}

.cg-catalog-card__kind {
  font-family: var(--cg-font-display);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cg-accent);
  margin-bottom: 0.55rem;
}

.cg-catalog-card__title {
  margin: 0 0 0.5rem;
  font-size: 1.45rem;
  line-height: 1.25;
  color: var(--cg-text);
}

.cg-catalog-card__authors {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
  color: var(--cg-text-secondary);
  font-style: italic;
}

.cg-catalog-card__text {
  margin: 0 0 0.85rem;
  flex: 1;
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--cg-text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cg-catalog-card__meta {
  margin: auto 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  font-size: 0.85rem;
  color: var(--cg-text-muted);
}

.cg-page--catalog .cg-detail .cg-header h1 {
  font-size: clamp(2rem, 3.5vw, 2.75rem);
}

.cg-catalog-join {
  flex: 0 1 16.5rem;
  width: 100%;
  max-width: 18rem;
  margin: 0;
  margin-inline-start: auto; /* EN: top-right · FA (RTL): top-left */
  padding: 1rem 1.15rem;
  background: var(--cg-card);
  border: 1px solid var(--cg-border);
  border-inline-start: 3px solid var(--cg-accent);
  border-radius: 0.35rem;
  box-shadow: var(--cg-shadow-sm);
}

@media (max-width: 639px) {
  .cg-catalog-join {
    flex-basis: 100%;
    max-width: none;
    margin-inline-start: 0;
  }
}

.cg-catalog-join h3 {
  margin: 0 0 0.35rem;
  font-family: var(--cg-font-display);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cg-accent);
}

.cg-catalog-join__text {
  margin: 0 0 0.75rem;
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--cg-text-secondary);
}

.cg-catalog-join .cg-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.45rem 1rem;
  background: var(--cg-button-bg);
  color: var(--cg-button-text);
  border: 1px solid var(--cg-button-bg);
  border-radius: 0.3rem;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 180ms ease, border-color 180ms ease;
}

.cg-catalog-join .cg-button:hover,
.cg-catalog-join .cg-button:focus-visible {
  background: var(--cg-button-bg-hover);
  border-color: var(--cg-button-bg-hover);
  outline: none;
}

.cg-page--catalog[dir="rtl"] .cg-catalog-join {
  direction: rtl !important;
  text-align: right !important;
}

.cg-page--catalog[dir="rtl"] .cg-catalog-hero,
.cg-page--catalog[dir="rtl"] .cg-catalog-hero__main,
.cg-page--catalog[dir="rtl"] .cg-catalog-topbar,
.cg-page--catalog[dir="rtl"] .cg-catalog-card,
.cg-page--catalog[dir="rtl"] .cg-nav {
  direction: rtl !important;
  text-align: right !important;
}

.cg-page--catalog .cg-catalog-topbar .cg-nav {
  margin-top: 0;
  flex: 1 1 auto;
}
