/**
 * AIM Single-Post Component Styles
 *
 * Loaded only on singular 'post' pages via wp_enqueue_style( 'aim-post-components' ).
 * Contains: Sync Protocol card, Free-Access / CC banner, Support CTA banner,
 *           Reading progress bar, Path selector grid.
 *
 * A1 FIX: emblem-shimmer animation wrapped in prefers-reduced-motion media query.
 *         Prevents continuous GPU paint on mobile and respects vestibular preferences.
 * A2 FIX: Shared CSS custom properties (--teal-dark, --teal-mid, --gold, --gold-light,
 *         --text) removed from per-component scope — they now cascade from :root in
 *         aim-global.css. Component-specific --text-muted kept scoped.
 * A3 FIX: speak: never added to decorative ◆ Unicode pseudo-elements so screen
 *         readers don't announce "black diamond suit" to users.
 *
 * @package    Ahmed Alshamsy
 * @since      2.0.0
 */

/* =============================================================================
   READING PROGRESS BAR — fixed top strip
   ============================================================================= */

#reading-progress-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: transparent;
  z-index: 99999;
}

#reading-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--gold);
  transition: width 0.1s ease-out;
  box-shadow: 0 0 10px rgba(197, 160, 89, 0.5);
}

/* =============================================================================
   PATH SELECTOR GRID — "Which option fits you?"
   ============================================================================= */

/*
 * Selector specificity: .entry-content .aim-selector-container beats Astra's
 * .entry-content a and .ast-single-post-structure a without !important.
 */
.entry-content .aim-selector-container {
  margin: 40px auto;
  padding: 20px;
  max-width: 1100px;
  text-align: center;
  font-family: Inter, -apple-system, BlinkMacSystemFont, sans-serif;
  box-sizing: border-box;
}

.entry-content .aim-selector-header {
  color: var(--teal-dark);
  font-size: 1.4rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 25px;
  display: block;
}

.entry-content .aim-decision-grid {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  justify-content: center;
  list-style: none;
  padding: 0;
  margin: 0;
}

.entry-content .aim-decision-grid li {
  flex: 1 1 300px;
  margin: 0;
  padding: 0;
  display: flex;
}

.entry-content .aim-path-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 25px 20px;
  background-color: #F4F9F8;
  border: 2px solid rgba(197, 160, 89, 0.3);
  color: var(--teal-dark);
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  border-radius: 6px;
  transition: all 0.3s ease;
  text-align: center;
  line-height: 1.4;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.entry-content .aim-path-link:hover {
  border-color: var(--gold);
  background-color: #ffffff;
  transform: translateY(-3px);
  box-shadow: 0 8px 15px rgba(0, 77, 64, 0.1);
  color: var(--gold);
}

/* Patron variant */
.entry-content .path-patron {
  background-color: var(--teal-dark);
  color: var(--gold);
  border: 2px solid var(--gold);
}

.entry-content .path-patron:hover {
  background-color: var(--text);
  color: #ffffff;
}

@media (max-width: 768px) {
  .entry-content .aim-decision-grid {
    flex-direction: column;
  }

  .entry-content .aim-path-link {
    padding: 20px;
    font-size: 0.95rem;
  }
}

/* =============================================================================
   SOVEREIGN SYMPHONY PROTOCOL CARD
   ============================================================================= */

.aim-protocol-card {
  --pc-muted:    #64748b; /* subtitle / step text */
  --pc-light:    #475569; /* tag text / layer text */
  --pc-rule:     #f1f5f9; /* dividers */
  --pc-surface:  #f8fafc; /* layer grid bg */
  --pc-hover:    #2a5a5a; /* sync-btn hover */

  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-top: 4px solid var(--teal-text);
  border-radius: 8px;
  padding: 40px;
  margin: 40px auto;
  max-width: 800px;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  box-shadow: 0 10px 30px rgba(26, 58, 58, 0.05);
  position: relative;
}

.aim-protocol-header {
  text-align: center;
  margin-bottom: 35px;
}

.aim-protocol-title {
  font-family: "Playfair Display", serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--teal-text);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.aim-protocol-subtitle {
  font-size: 0.95rem;
  color: var(--pc-muted);
  line-height: 1.6;
  max-width: 600px;
  margin: 0 auto;
}

/* Steps */
.aim-step-container {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.aim-step {
  display: flex;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--pc-rule);
}

.aim-step:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.aim-step-num {
  background: var(--gold);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.75rem;
  min-width: 65px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 5px;
}

.aim-step-content {
  flex: 1;
}

.aim-step-title {
  font-weight: 700;
  color: var(--teal-text);
  font-size: 1.1rem;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.aim-tag {
  font-size: 0.65rem;
  background: var(--pc-rule);
  color: var(--pc-light);
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  font-weight: 700;
}

.aim-step-text {
  font-size: 0.95rem;
  color: var(--pc-light);
  line-height: 1.6;
}

/* Layers grid inside step */
.aim-layers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 15px;
  background: var(--pc-surface);
  padding: 15px;
  border-radius: 6px;
}

.aim-layer-item {
  font-size: 0.8rem;
  color: var(--teal-text);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.aim-layer-dot {
  color: var(--gold);
  font-weight: bold;
}

/* Protocol action buttons */
.aim-sync-btn {
  display: inline-block;
  padding: 12px 24px;
  background: var(--teal-text);
  color: #ffffff !important;
  text-decoration: none !important;
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 4px;
  transition: background 0.3s ease;
}

.aim-sync-btn:hover {
  background: var(--pc-hover);
}

.aim-sync-btn-outline {
  display: inline-block;
  padding: 12px 24px;
  background: transparent;
  color: var(--teal-text) !important;
  text-decoration: none !important;
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 4px;
  border: 2px solid var(--teal-text);
  transition: all 0.3s ease;
}

.aim-sync-btn-outline:hover {
  background: var(--teal-text);
  color: #ffffff !important;
}

.aim-sync-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--pc-rule);
}

@media (max-width: 600px) {
  .aim-step {
    flex-direction: column;
    gap: 10px;
  }

  .aim-layers-grid {
    grid-template-columns: 1fr;
  }

  .aim-protocol-card {
    padding: 25px 20px;
  }
}

/* =============================================================================
   FREE-ACCESS / CC BANNER — prepended above post content
   ============================================================================= */

.aim-free-access-banner-wrap {
  --fab-body:   #27464a; /* banner body text — dark teal */
  --fab-muted:  #6b8a85; /* banner note text — muted teal */
  max-width: 980px;
  margin: 18px auto;
  padding: 0;
  font-family: "Inter", system-ui, sans-serif;
  box-sizing: border-box;
}

.aim-free-access-banner-frame {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 0% 0%, rgba(0, 105, 92, 0.22) 0%, transparent 55%),
    radial-gradient(ellipse at 100% 100%, rgba(197, 160, 89, 0.18) 0%, transparent 55%),
    radial-gradient(ellipse at 100% 0%, rgba(0, 77, 64, 0.12) 0%, transparent 45%),
    linear-gradient(135deg, #e8f5f2 0%, #f4faf8 40%, #fdf8ee 100%);
  box-shadow:
    0 0 0 1px rgba(197, 160, 89, 0.2),
    0 16px 48px rgba(0, 77, 64, 0.11),
    0 4px 12px rgba(0, 77, 64, 0.07);
}

/* Top gradient rule */
.aim-free-access-banner-frame::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #004D40, #C5A059 50%, #004D40);
  z-index: 2;
}

/* Diagonal hatch texture */
.aim-free-access-banner-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 28px,
    rgba(0, 77, 64, 0.022) 28px,
    rgba(0, 77, 64, 0.022) 29px
  );
  pointer-events: none;
  z-index: 0;
}

/* Ghost watermark */
.aim-free-access-banner-wm {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  padding-right: 28px;
  pointer-events: none;
  user-select: none;
  z-index: 0;
  line-height: 0.88;
  overflow: hidden;
}

.aim-free-access-banner-wm span {
  font-family: "Playfair Display", serif;
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 800;
  color: transparent;
  -webkit-text-stroke: 1px rgba(0, 77, 64, 0.05);
  letter-spacing: -1px;
  white-space: nowrap;
  display: block;
}

/* Gold side pillars */
.aim-free-access-banner-pillar-l,
.aim-free-access-banner-pillar-r {
  position: absolute;
  top: 18px;
  bottom: 18px;
  width: 3px;
  border-radius: 4px;
  background: linear-gradient(to bottom, transparent, #C5A059 30%, #C5A059 70%, transparent);
  opacity: 0.55;
  z-index: 3;
}

.aim-free-access-banner-pillar-l { left: 14px; }
.aim-free-access-banner-pillar-r { right: 14px; }

/* Inner layout */
.aim-free-access-banner-inner {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 18px;
  align-items: flex-start;
  padding: 22px 38px 20px;
}

/* Emblem */
.aim-free-access-banner-emblem {
  flex: 0 0 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, #004D40 0%, #00695C 60%, #C5A059 140%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(0, 77, 64, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

/* A1 FIX: Shimmer pseudo-element — animation declared separately below inside
   prefers-reduced-motion query. Users who request reduced motion see no animation
   but still get the emblem's gradient background (no visual loss). */
.aim-free-access-banner-emblem::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -60%;
  width: 40%;
  height: 200%;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.12) 50%, transparent 70%);
}

/* A1 FIX: Only animate for users who have NOT requested reduced motion.
   Prevents continuous GPU repaint on mobile and respects WCAG 2.3.3. */
@media (prefers-reduced-motion: no-preference) {
  .aim-free-access-banner-emblem::after {
    animation: emblem-shimmer 4s infinite;
  }

  @keyframes emblem-shimmer {
    0%, 100% { left: -60%; }
    50%       { left: 120%;  }
  }
}

/* Content */
.aim-free-access-banner-content {
  flex: 1 1 auto;
  min-width: 0;
}

.aim-free-access-banner-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.aim-free-access-banner-heading h2 {
  margin: 0;
  font-family: "Playfair Display", serif;
  font-size: 1.05rem;
  font-weight: 800;
  color: #0b2f2a;
  line-height: 1.2;
  /* Override .entry-content h2 cascade (border-bottom, Merriweather, padding) */
  border-bottom: none;
  padding-top: 0;
  padding-bottom: 0;
  letter-spacing: normal;
}

/* A3 FIX: speak: never prevents screen readers from announcing the decorative
   ◆ character as "black diamond suit". font-variant: none disables SR text
   normalization. These rules apply to all ◆ pseudo-elements in this file. */
.aim-free-access-banner-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, #004D40, #00695C);
  color: #C5A059;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 4px 10px;
  border-radius: 50px;
  border: 1px solid rgba(197, 160, 89, 0.35);
  box-shadow: 0 2px 8px rgba(0, 77, 64, 0.2);
  white-space: nowrap;
}

.aim-free-access-banner-tag::before {
  content: "◆";
  font-size: 0.4rem;
  opacity: 0.8;
  speak: never;           /* A3 FIX: hide from screen readers */
  font-variant: none;
  unicode-bidi: isolate;
}

.aim-free-access-banner-body {
  margin: 0 0 10px;
  color: var(--fab-body);
  font-size: 0.95rem;
  line-height: 1.6;
}

.aim-free-access-banner-link {
  color: #004D40;
  font-weight: 700;
  text-decoration: none;
  position: relative;
  display: inline-block;
}

.aim-free-access-banner-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(197, 160, 89, 0.25);
  border-radius: 2px;
  z-index: -1;
  transition: height 0.2s, background 0.2s;
}

.aim-free-access-banner-link:hover::after {
  height: 100%;
  background: rgba(197, 160, 89, 0.12);
}

.aim-free-access-banner-note {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.72rem;
  color: var(--fab-muted);
  line-height: 1.4;
}

.aim-free-access-banner-note::before {
  content: "ℹ";
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  background: rgba(0, 77, 64, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  color: #004D40;
  font-style: normal;
}

/* Responsive — free-access banner */
@media (max-width: 680px) {
  .aim-free-access-banner-wrap {
    padding: 0;
    margin: 14px 0;
    max-width: 100%;
  }

  .aim-free-access-banner-frame {
    border-radius: 0;
    box-shadow:
      0 0 0 1px rgba(197, 160, 89, 0.18),
      0 6px 20px rgba(0, 77, 64, 0.08);
  }

  .aim-free-access-banner-inner {
    padding: 20px 26px 18px;
    gap: 14px;
  }

  .aim-free-access-banner-pillar-l { left: 10px; }
  .aim-free-access-banner-pillar-r { right: 10px; }

  .aim-free-access-banner-emblem {
    flex: 0 0 48px;
    height: 48px;
    border-radius: 12px;
  }

  .aim-free-access-banner-body {
    font-size: 0.9rem;
  }
}

@media (max-width: 420px) {
  .aim-free-access-banner-inner {
    padding: 18px 20px 16px;
  }

  .aim-free-access-banner-heading h2 {
    font-size: 0.97rem;
  }

  .aim-free-access-banner-wm span {
    font-size: 1.8rem;
  }
}

/* =============================================================================
   SUPPORT / CTA BANNER — appended below post content
   A2 FIX: --teal-dark, --teal-mid, --gold, --gold-light, --text removed
   (they now inherit from :root in aim-global.css). --text-muted kept here
   because this component uses a different value (#5a7a74) than other components.
   ============================================================================= */

.aim-mg-support-banner {
  --text-muted: #5a7a74;
  max-width: 1260px;
  margin: 0 auto;
  padding: 18px 20px;
  box-sizing: border-box;
  font-family: "Inter", system-ui, sans-serif;
}

.aim-mg-support-panel {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  background:
    radial-gradient(ellipse at 0% 0%,   rgba(0, 105, 92, 0.16)  0%, transparent 55%),
    radial-gradient(ellipse at 100% 100%, rgba(197, 160, 89, 0.14) 0%, transparent 52%),
    radial-gradient(ellipse at 100% 0%,  rgba(0, 77, 64, 0.08)   0%, transparent 45%),
    linear-gradient(160deg, #f3faf8 0%, #f8fcfb 48%, #fffaf0 100%);
  border: 1px solid rgba(197, 160, 89, 0.18);
  box-shadow:
    0 0 0 1px rgba(0, 77, 64, 0.04),
    0 18px 50px rgba(0, 77, 64, 0.10),
    0 6px 18px rgba(0, 77, 64, 0.06);
  padding: 22px 22px 20px;
}

.aim-mg-support-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 28px,
    rgba(0, 77, 64, 0.018) 28px,
    rgba(0, 77, 64, 0.018) 29px
  );
  pointer-events: none;
}

.aim-mg-support-panel::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #004D40, #C5A059 50%, #004D40);
  z-index: 1;
}

.aim-mg-support-content {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 18px;
  text-align: center;
}

/* Kicker pill */
.aim-mg-support-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 auto;
  padding: 7px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--teal-dark), var(--teal-mid));
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  border: 1px solid rgba(197, 160, 89, 0.35);
  box-shadow: 0 6px 18px rgba(0, 77, 64, 0.16);
  user-select: none;
}

/* A3 FIX: speak: never on decorative ◆ characters */
.aim-mg-support-kicker::before,
.aim-mg-support-kicker::after {
  content: "◆";
  font-size: 0.42rem;
  opacity: 0.72;
  speak: never;
  font-variant: none;
  unicode-bidi: isolate;
}

/* Body text */
.aim-mg-support-text {
  margin: 0 auto;
  max-width: 920px;
  color: var(--text);
  font-size: clamp(1rem, 1.45vw, 1.08rem);
  line-height: 1.8;
  text-wrap: balance;
}

.aim-mg-support-text strong { color: var(--teal-dark); font-weight: 800; }
.aim-mg-support-text .gold  { color: var(--gold);      font-weight: 800; }

/* Action buttons */
.aim-mg-support-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 2px;
}

.aim-mg-support-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 12px 18px;
  border-radius: 14px;
  text-decoration: none;
  font-weight: 800;
  font-size: 0.88rem;
  letter-spacing: 0.2px;
  line-height: 1.3;
  text-align: center;
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease, border-color 0.22s ease;
  border: 1px solid transparent;
  box-sizing: border-box;
  flex: 1 1 340px;
  max-width: 430px;
}

.aim-mg-support-cta:hover {
  transform: translateY(-2px);
}

/* Mission / Patron CTA */
.aim-mg-support-mission {
  background: linear-gradient(135deg, var(--teal-dark), var(--teal-mid));
  color: #fff !important;
  box-shadow: 0 10px 24px rgba(0, 77, 64, 0.18);
  border-color: rgba(197, 160, 89, 0.22);
}

.aim-mg-support-mission:hover {
  box-shadow: 0 14px 30px rgba(0, 77, 64, 0.24);
}

/* Subscribe CTA */
.aim-mg-support-subscribe {
  background: linear-gradient(135deg, #ffffff, #f8f4ea);
  color: var(--teal-dark) !important;
  border-color: rgba(197, 160, 89, 0.28);
  box-shadow: 0 10px 24px rgba(197, 160, 89, 0.12);
}

.aim-mg-support-subscribe:hover {
  box-shadow: 0 14px 30px rgba(197, 160, 89, 0.18);
}

/* Note */
.aim-mg-support-note {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.96rem;
  line-height: 1.7;
  text-align: center;
}

.aim-mg-support-note code {
  display: inline-block;
  padding: 0;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  white-space: normal;
}

/* Responsive — support banner */
@media (max-width: 720px) {
  .aim-mg-support-banner {
    max-width: 100%;
    padding: 0;
  }

  .aim-mg-support-panel {
    border-radius: 0;
    padding: 18px 14px 16px;
  }

  .aim-mg-support-content {
    gap: 14px;
  }

  .aim-mg-support-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .aim-mg-support-cta {
    width: 100%;
    max-width: none;
    flex: 1 1 auto;
    min-height: 52px;
  }

  .aim-mg-support-text {
    font-size: 0.98rem;
  }
}

@media (max-width: 400px) {
  .aim-mg-support-panel {
    padding: 16px 12px 14px;
  }

  .aim-mg-support-cta {
    font-size: 0.84rem;
    padding: 12px 14px;
  }
}