/**
 * Base Theme — Components
 *
 * Generic, reusable components: cards, buttons, badges, forms,
 * breadcrumbs, hero, accordion, stats, share bar, utilities.
 * All values via CSS variables — no hardcoded colors.
 */

/* ══════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 0.75rem 1.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: var(--text-base);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  min-height: 44px;
  line-height: 1.4;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
  text-decoration: none;
}

.btn-secondary,
.btn--secondary {
  background: var(--bg-alt);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover,
.btn--secondary:hover {
  background: var(--border);
  color: var(--text);
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}

.btn-ghost:hover {
  background: var(--accent-light);
  text-decoration: none;
}

/* ══════════════════════════════════════════════════════════════
   BADGES
   ══════════════════════════════════════════════════════════════ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.4;
}

.badge--success { background: var(--success); color: #fff; }
.badge--warning { background: var(--warning); color: #000; }
.badge--error   { background: var(--danger); color: #fff; }
.badge--info    { background: var(--info); color: #fff; }

/* ══════════════════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════════════════ */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: var(--space-lg);
}

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
}

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

.card__image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.card__body {
  padding: var(--space-md);
}

.card:not(:has(.card__image)) .card__body {
  padding: var(--space-lg);
}

.card__category {
  font-size: var(--text-sm);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin: 0 0 var(--space-xs);
}

.card__title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text);
  margin: 0 0 var(--space-sm);
  line-height: 1.3;
}

.card__title a {
  color: inherit;
  text-decoration: none;
}

.card__title a:hover {
  color: var(--accent);
}

.card__excerpt {
  font-size: var(--text-base);
  color: var(--text-light);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Featured card variant */
.card--featured {
  grid-column: 1 / -1;
}

/* ── Card-grid column-count modifiers ─────────────────────────────────
   For hub-style grids that want a specific column count at desktop widths.
   Default .card-grid uses auto-fit; these modifiers lock to 2/3/4 columns
   above 900px and fall back to auto-fit at smaller widths. */
.card-grid--2col { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.card-grid--3col { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.card-grid--4col { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }

@media (min-width: 900px) {
  .card-grid--2col { grid-template-columns: repeat(2, 1fr); }
  .card-grid--3col { grid-template-columns: repeat(3, 1fr); }
  .card-grid--4col { grid-template-columns: repeat(4, 1fr); }
}

/* ── Info-card: hub-style stacked-content card ────────────────────────
   Use case: content-rich hub cards with a heading + multi-line description,
   optionally clickable (linked). Distinct from .related-page-card (which is
   designed for compact icon+short-text+arrow nav links and uses row-flex).
   Distinct from .card (which is designed for image + body article cards).
   Designed for /resources-tools tool clusters, /global-conflict-map
   "How to Read" and "What to Do" sections, similar hub-style use cases. */
.info-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

/* Hover variant for clickable info-cards (used as anchor tags) */
.info-card--hover {
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.info-card--hover:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.info-card__title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
  margin: 0 0 var(--space-xs);
  line-height: 1.3;
}

.info-card__text {
  font-size: var(--text-base);
  color: var(--text-light);
  line-height: 1.5;
  margin: 0;
}

.info-card a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.info-card a:hover {
  text-decoration: underline;
}

/* Enhanced cards */
.card-enhanced {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  height: 100%;
}

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

.card-enhanced__image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.card-enhanced__body {
  padding: var(--space-md);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-enhanced:not(:has(.card-enhanced__image)) .card-enhanced__body {
  padding: var(--space-lg);
}

.card-enhanced__category {
  display: inline-block;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.card-enhanced__title {
  font-size: var(--text-xl);
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 var(--space-sm);
  color: var(--text);
}

.card-enhanced__title a {
  color: inherit;
  text-decoration: none;
}

.card-enhanced__title a:hover {
  color: var(--accent);
}

.card-enhanced__text {
  color: var(--text-light);
  line-height: 1.6;
  margin: 0 0 var(--space-md);
  flex: 1;
}

.card-enhanced__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-sm);
  color: var(--text-light);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.card-enhanced__cta {
  display: inline-block;
  padding: var(--space-xs) var(--space-sm);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: var(--text-sm);
  transition: all var(--transition);
}

.card-enhanced__cta:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

.card-enhanced-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-lg);
}

/* ══════════════════════════════════════════════════════════════
   FEATURE GRID
   ══════════════════════════════════════════════════════════════ */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: var(--space-lg);
}

.feature-card {
  padding: var(--space-lg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.feature-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.feature-card__icon {
  font-size: var(--text-4xl);
  margin-bottom: var(--space-sm);
  line-height: 1;
}

.feature-card h3 {
  font-size: var(--text-xl);
  margin: 0 0 var(--space-sm);
}

.feature-card p {
  margin: 0;
  color: var(--text-light);
  line-height: 1.7;
}

/* ══════════════════════════════════════════════════════════════
   STATS
   ══════════════════════════════════════════════════════════════ */

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-lg);
  text-align: center;
  padding: var(--space-lg) 0;
}

.stat__number {
  font-size: var(--text-4xl);
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.stat__label {
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: var(--space-xs);
}

/* Stats section (from engine shared components) */
.stats-section {
  padding: var(--space-xl) var(--space-md);
  background: var(--bg-alt);
  border-radius: var(--radius);
  margin: var(--space-xl) 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-xl);
  text-align: center;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat__description {
  font-size: var(--text-sm);
  color: var(--text-light);
  margin-top: var(--space-xs);
  line-height: 1.5;
}

/* ══════════════════════════════════════════════════════════════
   HERO
   ══════════════════════════════════════════════════════════════ */

.hero {
  padding: var(--space-xl) var(--space-md);
  background: var(--bg-alt);
  text-align: center;
}

.hero__inner {
  max-width: var(--wide-width);
  margin: 0 auto;
}

.hero__title {
  font-size: var(--text-4xl);
  font-weight: 700;
  line-height: 1.1;
  margin: 0 0 var(--space-md);
}

.hero__subtitle {
  font-size: var(--text-xl);
  color: var(--text-light);
  max-width: 50ch;
  margin: 0 auto var(--space-lg);
  line-height: 1.6;
}

.hero__cta {
  display: inline-flex;
  align-items: center;
  padding: var(--space-sm) var(--space-lg);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: var(--text-lg);
  min-height: 48px;
  transition: background var(--transition);
}

.hero__cta:hover {
  background: var(--accent-hover);
  color: #fff;
  text-decoration: none;
}

/* Hero — centered variant (no split, no visual, just centered text) */
.hero--centered .hero__inner {
  display: block;
  text-align: center;
}

.hero--centered .hero__content {
  max-width: 50ch;
  margin: 0 auto;
}

/* Hero with image overlay */
.hero--image {
  background-size: cover;
  background-position: center;
  position: relative;
}

.hero--image::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.hero--image .hero__inner {
  position: relative;
  z-index: 1;
}

/* Hero image (full-width variant) */
.hero-image {
  position: relative;
  width: 100%;
  min-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.hero-image::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.5));
  z-index: 1;
}

.hero-image__content {
  position: relative;
  z-index: 2;
  text-align: center;
  color: #fff;
  max-width: 900px;
  padding: var(--space-xl) var(--space-md);
}

.hero-image__title {
  font-size: var(--text-4xl);
  font-weight: 700;
  line-height: 1.1;
  margin: 0 0 var(--space-md);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.hero-image__subtitle {
  font-size: var(--text-xl);
  line-height: 1.4;
  margin: 0 0 var(--space-lg);
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
  opacity: 0.95;
}

.hero-image__cta {
  display: inline-block;
  padding: var(--space-sm) var(--space-lg);
  background: #fff;
  color: var(--text);
  text-decoration: none;
  border-radius: 50px;
  font-weight: 600;
  font-size: var(--text-lg);
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.hero-image__cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.3);
  color: var(--text);
  text-decoration: none;
}

@media (max-width: 767px) {
  .hero-image { min-height: 400px; }
}

/* ══════════════════════════════════════════════════════════════
   BREADCRUMBS
   ══════════════════════════════════════════════════════════════ */

.breadcrumbs {
  padding: var(--space-sm) 0;
  font-size: var(--text-sm);
}

.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  padding: 0;
  margin: 0;
}

.breadcrumbs li + li::before {
  content: "/";
  margin: 0 var(--space-xs);
  color: var(--muted);
}

.breadcrumbs a {
  color: var(--link);
  text-decoration: none;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

.breadcrumbs [aria-current] {
  color: var(--muted);
}

/* ══════════════════════════════════════════════════════════════
   ARTICLE META
   ══════════════════════════════════════════════════════════════ */

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.article-meta__date,
.article-meta__reading-time {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.article-meta__icon {
  opacity: 0.6;
  flex-shrink: 0;
}

.article-meta__updated {
  opacity: 0.7;
  font-style: italic;
}

/* ══════════════════════════════════════════════════════════════
   ACCORDION / FAQ
   ══════════════════════════════════════════════════════════════ */

.accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.accordion details {
  border-bottom: 1px solid var(--border);
}

.accordion details:last-child {
  border-bottom: none;
}

.accordion summary {
  padding: var(--space-sm) var(--space-md);
  font-weight: 600;
  font-size: var(--text-lg);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 48px;
  transition: background var(--transition);
}

.accordion summary:hover {
  background: var(--bg-alt);
}

.accordion summary::after {
  content: '+';
  font-size: var(--text-xl);
  color: var(--muted);
  transition: transform var(--transition);
}

.accordion details[open] summary::after {
  content: '\2212';
}

.accordion .accordion__content {
  padding: 0 var(--space-md) var(--space-md);
  line-height: 1.7;
}

.accordion summary::-webkit-details-marker { display: none; }

.faq-section { margin: var(--space-lg) 0; }
.faq-item { margin-bottom: var(--space-lg); }
.faq-item h3 { font-size: var(--text-xl); margin: 0 0 var(--space-sm); }
.faq-item p { margin: 0; line-height: 1.7; }

/* ══════════════════════════════════════════════════════════════
   BLOCKQUOTES
   ══════════════════════════════════════════════════════════════ */

blockquote,
.pull-quote {
  border-left: 4px solid var(--accent);
  padding: var(--space-md) var(--space-lg);
  margin: var(--space-lg) 0;
  font-size: var(--text-xl);
  font-style: italic;
  color: var(--text);
  background: var(--accent-light);
  border-radius: 0 var(--radius) var(--radius) 0;
}

blockquote cite {
  display: block;
  margin-top: var(--space-sm);
  font-size: var(--text-sm);
  font-style: normal;
  font-weight: 600;
  color: var(--muted);
}

blockquote cite::before {
  content: '\2014\00a0';
}

/* ══════════════════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════════════════ */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="tel"],
textarea,
select {
  width: 100%;
  padding: 0.75rem var(--space-sm);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  transition: border-color var(--transition);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

label {
  display: block;
  margin-bottom: var(--space-xs);
  font-weight: 600;
  font-size: var(--text-sm);
}

/* ══════════════════════════════════════════════════════════════
   TABLES (responsive)
   ══════════════════════════════════════════════════════════════ */

.content-block table,
.prose table {
  width: 100%;
  border-collapse: collapse;
  overflow-x: auto;
  display: block;
  margin: var(--space-lg) 0;
}

@media (min-width: 768px) {
  .content-block table,
  .prose table {
    display: table;
  }
}

/* ══════════════════════════════════════════════════════════════
   SHARE BUTTONS
   ══════════════════════════════════════════════════════════════ */

.share-buttons {
  text-align: center;
  margin: var(--space-lg) 0;
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border);
}

.share-label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.share-buttons a {
  display: inline-flex;
  align-items: center;
  margin: 0 var(--space-xs);
  color: var(--link);
  text-decoration: none;
  min-height: 44px;
}

.share-buttons a:hover {
  text-decoration: underline;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--transition);
}

.share-btn:hover {
  border-color: var(--accent);
  text-decoration: none;
}

/* ══════════════════════════════════════════════════════════════
   AUTHOR BOX
   ══════════════════════════════════════════════════════════════ */

.author-box {
  margin: var(--space-sm) 0;
  padding: var(--space-sm) 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.author-name {
  font-weight: 600;
  color: var(--text);
}

/* ══════════════════════════════════════════════════════════════
   RELATED CONTENT
   ══════════════════════════════════════════════════════════════ */

.related-content {
  margin: var(--space-lg) 0;
  padding: var(--space-lg);
  background: var(--bg-alt);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.related-content h2 {
  font-size: var(--text-2xl);
  margin: 0 0 var(--space-md);
}

.related-content ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.related-content li {
  margin-bottom: var(--space-sm);
}

.related-content a {
  color: var(--link);
  text-decoration: none;
  font-weight: 500;
}

.related-content a:hover {
  text-decoration: underline;
}

/* ══════════════════════════════════════════════════════════════
   AD BLOCK
   ══════════════════════════════════════════════════════════════ */

.ad-block {
  min-height: 250px;
  text-align: center;
  margin: var(--space-lg) 0;
  contain: layout;
}

.ad-container {
  margin: var(--space-lg) auto;
  text-align: center;
  overflow: hidden;
}

/* Google-approved: hide unfilled ads AFTER AdSense decides not to fill them */
/* See: https://support.google.com/adsense/answer/10762946 */
ins.adsbygoogle[data-ad-status="unfilled"] {
  display: none !important;
}

.ad-label {
  font-size: var(--text-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-sm);
  font-weight: 600;
}

/* ══════════════════════════════════════════════════════════════
   FACTS BOX
   ══════════════════════════════════════════════════════════════ */

.facts-box {
  background: var(--bg-alt);
  border-radius: var(--radius);
  padding: var(--space-md);
  margin: var(--space-lg) 0;
  border-left: 4px solid var(--accent);
}

.facts-title {
  margin: 0 0 var(--space-sm);
  font-size: var(--text-lg);
  font-weight: 700;
}

.facts-box table { margin: 0; }
.facts-box th { width: 35%; font-weight: 600; background: transparent; }
.facts-box td { width: 65%; }

/* ══════════════════════════════════════════════════════════════
   PILLS / FILTER BUTTONS
   ══════════════════════════════════════════════════════════════ */

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin: var(--space-lg) 0;
}

.pills--center {
  justify-content: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.6rem 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 50px;
  color: var(--text);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
}

.pill:hover {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
}

.pill--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.pill--active:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

/* ══════════════════════════════════════════════════════════════
   IMAGE GALLERY
   ══════════════════════════════════════════════════════════════ */

.image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
  margin: var(--space-xl) 0;
}

.image-gallery--2col { grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); }
.image-gallery--3col { grid-template-columns: repeat(3, 1fr); }
.image-gallery--4col { grid-template-columns: repeat(4, 1fr); }

.image-gallery__item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--bg-alt);
  transition: transform 0.3s ease;
}

.image-gallery__item:hover {
  transform: scale(1.02);
}

.image-gallery__image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.image-gallery__caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-md);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  color: #fff;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.image-gallery__item:hover .image-gallery__caption {
  transform: translateY(0);
}

@media (max-width: 1024px) {
  .image-gallery--3col,
  .image-gallery--4col { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 767px) {
  .image-gallery,
  .image-gallery--2col,
  .image-gallery--3col,
  .image-gallery--4col { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════════════
   SIDEBAR COMPONENTS
   ══════════════════════════════════════════════════════════════ */

.sidebar-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}

.sidebar-box__title {
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 0 0 var(--space-sm);
}

/* Table of contents */
.toc {
  background: var(--bg-alt);
  padding: var(--space-md);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: var(--space-lg);
}

.toc__title {
  font-size: var(--text-lg);
  font-weight: 700;
  margin: 0 0 var(--space-sm);
}

.toc ol { margin: 0; padding-left: var(--space-md); }
.toc li { padding: var(--space-xs) 0; }
.toc a { text-decoration: none; color: var(--text); }
.toc a:hover { color: var(--accent); text-decoration: underline; }

@media (min-width: 1400px) {
  .toc {
    position: sticky;
    top: var(--space-lg);
    float: right;
    width: 250px;
    margin-left: var(--space-lg);
    margin-bottom: var(--space-md);
  }
}

/* Footer notice */
.footer-updates-notice {
  text-align: center;
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  background: var(--accent-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.updates-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  margin-bottom: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  background: var(--accent-light);
  border-radius: 20px;
  font-size: var(--text-sm);
  color: var(--accent);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

.footer-updates-notice p {
  font-size: var(--text-sm);
  color: var(--text-light);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ══════════════════════════════════════════════════════════════
   CODE
   ══════════════════════════════════════════════════════════════ */

code {
  background: var(--bg-alt);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.9em;
}

pre code {
  display: block;
  padding: var(--space-sm);
  overflow-x: auto;
  border-radius: var(--radius);
}

/* ══════════════════════════════════════════════════════════════
   UTILITIES
   ══════════════════════════════════════════════════════════════ */

.text-muted { color: var(--muted); }
.text-center { text-align: center; }
.text-sm { font-size: var(--text-sm); }
.lead { font-size: var(--text-lg); color: var(--text-light); line-height: 1.7; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-sm { margin-top: var(--space-sm); }
.mb-sm { margin-bottom: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mb-md { margin-bottom: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-lg { margin-bottom: var(--space-lg); }

/* ══════════════════════════════════════════════════════════════
   ERROR PAGE
   ══════════════════════════════════════════════════════════════ */

.error-page {
  text-align: center;
  padding: var(--space-xl) 0;
}

.error-page__code {
  font-size: clamp(4rem, 10vw, 8rem);
  font-weight: 800;
  line-height: 1;
  color: var(--accent);
  margin: 0;
}

.error-page__message {
  font-size: var(--text-2xl);
  margin: var(--space-sm) 0 var(--space-md);
}

.error-page__detail {
  font-size: var(--text-lg);
  color: var(--text-light);
  max-width: 50ch;
  margin: 0 auto var(--space-lg);
}

.error-page__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

.error-page__help {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
  text-align: left;
  max-width: 50ch;
  margin-left: auto;
  margin-right: auto;
}

.error-page__help h2 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-sm);
}

.error-page__help ul {
  padding-left: var(--space-md);
  color: var(--text-light);
}

.error-page__help li + li {
  margin-top: var(--space-xs);
}

/* Content section divider (used in 404 suggestions) */
.content-section {
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
}

.content-section h2 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-sm);
}

/* Share bar (structural layout for share-bar.php partial) */
.share-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  border-top: 1px solid var(--border);
  margin-top: var(--space-lg);
}

.share-bar--compact { gap: var(--space-xs); }

.share-bar__label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-light);
}

.share-bar__text {
  font-size: var(--text-sm);
  color: var(--text-light);
}

.share-bar__hint {
  font-size: var(--text-xs);
  color: var(--muted);
  flex-basis: 100%;
}

.share-toast {
  position: fixed;
  bottom: var(--space-md);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  z-index: 1000;
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.share-toast.visible { opacity: 1; }

/* System announcement banner */
.system-announcement {
  padding: var(--space-sm) 0;
  background: var(--accent);
  color: #fff;
}

.system-announcement--warning { background: var(--warning, #f59e0b); }
.system-announcement--danger { background: var(--danger); }
.system-announcement--success { background: var(--success, #22c55e); }

.system-announcement__inner {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.system-announcement__title {
  font-weight: 700;
  font-size: var(--text-sm);
}

.system-announcement__text {
  font-size: var(--text-sm);
  flex: 1;
}

.system-announcement__cta {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  white-space: nowrap;
}

.system-announcement__close {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: var(--space-xs);
  font-size: var(--text-lg);
  line-height: 1;
  opacity: 0.7;
}

.system-announcement__close:hover { opacity: 1; }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
  .card-grid { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .card-enhanced-grid { grid-template-columns: 1fr; }
  .share-buttons a { margin: 0 var(--space-xs); }
  .pills { gap: var(--space-xs); }
}
