body.theme-cortex {
  background-color: #F8F9FA;
}

:root {
  --cortex-rail-width: 4.5rem;
  --cortex-divider: 1px solid var(--color-border);
}

.theme-cortex .site-header {
  background-color: #FFFFFF;
  border-block-end: 1px solid #E2E5E9;
}

.theme-cortex .button:not(.button-secondary) {
  background-color: #0066CC;
  border-color: #0066CC;
  color: #FFFFFF;
}

.theme-cortex :where(a, button, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ==========================================================================
   Header & Toolbar Adjustments
   ========================================================================== */
.theme-cortex .site-header {
  border-block-end: var(--cortex-divider);
  box-shadow: none;
}

.theme-cortex .community-toolbar {
  padding-block: 0.75rem;
  border-block-end: var(--cortex-divider);
}

.theme-cortex .community-feed-tabs {
  display: flex;
  gap: 0.25rem;
  padding-block: 0.5rem;
  border-block-end: var(--cortex-divider);
}

.theme-cortex .community-feed-tabs a {
  padding-inline: 0.75rem;
  padding-block: 0.35rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  color: var(--color-muted);
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.theme-cortex .community-feed-tabs a:hover {
  background-color: var(--color-surface-soft);
  color: var(--color-text);
}

.theme-cortex .community-feed-tabs a[aria-current="page"] {
  background-color: var(--color-surface-soft);
  color: var(--color-primary);
  box-shadow: inset 0 -2px 0 var(--color-primary);
}

/* ==========================================================================
   Home & Feed: Scan-List Row Layout
   ========================================================================== */
.theme-cortex .community-feed {
  display: flex;
  flex-direction: column;
  border: var(--cortex-divider);
  border-radius: var(--radius-sm);
  background-color: var(--color-surface);
  overflow: hidden;
}

.theme-cortex .cortex-feed-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding-inline: 1rem;
  padding-block: 0.875rem;
  border-block-end: var(--cortex-divider);
  background-color: var(--color-surface);
  transition: background-color 0.12s ease;
}

.theme-cortex .cortex-feed-row:last-child {
  border-block-end: none;
}

.theme-cortex .cortex-feed-row:hover {
  background-color: var(--color-surface-soft);
}

/* Metric Rail on Inline-Start */
.theme-cortex .cortex-metric-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  inline-size: var(--cortex-rail-width);
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--color-muted);
}

.theme-cortex .cortex-stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  inline-size: 100%;
  padding-block: 0.25rem;
  border-radius: var(--radius-sm);
  line-height: 1.1;
  text-align: center;
}

.theme-cortex .cortex-stat-box strong {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--color-text);
}

.theme-cortex .cortex-stat-box.stat-answers {
  border: 1px solid var(--color-border);
  background-color: transparent;
}

.theme-cortex .cortex-stat-box.stat-answers.has-answers {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.theme-cortex .cortex-stat-box.stat-answers.has-answers strong {
  color: var(--color-primary);
}

.theme-cortex .cortex-stat-box.stat-answers.has-best-answer {
  background-color: var(--color-success);
  border-color: var(--color-success);
  color: #ffffff;
}

.theme-cortex .cortex-stat-box.stat-answers.has-best-answer strong {
  color: #ffffff;
}

.theme-cortex .cortex-stat-box.stat-views {
  font-size: 0.7rem;
}

/* Content Column in Row */
.theme-cortex .cortex-row-content {
  flex: 1 1 auto;
  min-inline-size: 0;
}

.theme-cortex .cortex-row-title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.35;
}

.theme-cortex .cortex-row-title a {
  color: var(--color-primary);
  text-decoration: none;
}

.theme-cortex .cortex-row-title a:hover {
  text-decoration: underline;
}

.theme-cortex .cortex-row-excerpt {
  margin-block-start: 0.25rem;
  margin-block-end: 0.5rem;
  font-size: 0.875rem;
  color: var(--color-muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.theme-cortex .cortex-row-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-block-start: 0.35rem;
}

.theme-cortex .cortex-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.theme-cortex .cortex-tag-chip {
  display: inline-flex;
  align-items: center;
  padding-inline: 0.45rem;
  padding-block: 0.15rem;
  font-size: 0.75rem;
  font-family: monospace, inherit;
  color: var(--color-text);
  background-color: var(--color-surface-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.theme-cortex .cortex-tag-chip:hover {
  background-color: var(--color-border);
}

.theme-cortex .cortex-author-line {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--color-muted);
  margin-inline-start: auto;
}

.theme-cortex .cortex-author-line img {
  border-radius: 50%;
  inline-size: 1.25rem;
  block-size: 1.25rem;
  object-fit: cover;
}

/* ==========================================================================
   Question Detail Page: Vertical Rail & Structured Layout
   ========================================================================== */
.theme-cortex .cortex-qa-item {
  display: grid;
  grid-template-columns: 3.25rem 1fr;
  gap: 1.25rem;
  padding-block: 1.25rem;
  border-block-end: var(--cortex-divider);
}

.theme-cortex .cortex-vote-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.theme-cortex .cortex-vote-count {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1;
}

.theme-cortex .cortex-accepted-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 2rem;
  block-size: 2rem;
  border-radius: 50%;
  background-color: var(--color-success);
  color: #ffffff;
}

.theme-cortex .cortex-meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding-block: 0.5rem;
  font-size: 0.8125rem;
  color: var(--color-muted);
  border-block-end: var(--cortex-divider);
  margin-block-end: 1rem;
}

.theme-cortex .answer-card.answer-best {
  background-color: var(--color-surface-soft);
  border-radius: var(--radius-sm);
  padding-inline: 1rem;
  padding-block: 0.5rem;
  border: 1px solid var(--color-border);
}

/* Collapsed subordinate comments */
.theme-cortex .cortex-comments-block {
  margin-block-start: 1rem;
  padding-inline-start: 1.5rem;
  border-inline-start: 2px solid var(--color-border);
  font-size: 0.875rem;
}

.theme-cortex .cortex-comment-row {
  padding-block: 0.4rem;
  border-block-end: 1px dashed var(--color-border);
}

.theme-cortex .cortex-comment-row:last-child {
  border-block-end: none;
}

/* ==========================================================================
   Topics & Taxonomy Scan Layout
   ========================================================================== */
.theme-cortex .cortex-topic-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-inline: 1rem;
  padding-block: 0.75rem;
  border-block-end: var(--cortex-divider);
  background-color: var(--color-surface);
}

.theme-cortex .cortex-topic-row:hover {
  background-color: var(--color-surface-soft);
}

.theme-cortex .cortex-type-marker {
  display: inline-flex;
  align-items: center;
  padding-inline: 0.4rem;
  padding-block: 0.1rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  background-color: var(--color-secondary);
  color: #ffffff;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 640px) {
  .theme-cortex .cortex-feed-row {
    flex-direction: column;
    gap: 0.5rem;
  }

  .theme-cortex .cortex-metric-rail {
    flex-direction: row;
    inline-size: 100%;
    justify-content: flex-start;
    gap: 0.75rem;
  }

  .theme-cortex .cortex-stat-box {
    flex-direction: row;
    gap: 0.25rem;
    inline-size: auto;
    padding-inline: 0.5rem;
  }

  .theme-cortex .cortex-qa-item {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .theme-cortex .cortex-vote-rail {
    flex-direction: row;
    justify-content: flex-start;
  }
}
