/* ==========================================================================
   Swayrm Documentation Portal - Visual Enhancements & Custom Styling
   ========================================================================== */

/* --- Custom Variables & Palette Tokens --- */
:root {
  --swayrm-primary-rgb: 59, 130, 246;     /* Vibrant Blue */
  --swayrm-accent-rgb: 14, 165, 233;      /* Cyan */
  --swayrm-glow-rgb: 99, 102, 241;        /* Indigo */
  --swayrm-success-rgb: 16, 185, 129;     /* Emerald */
  --swayrm-amber-rgb: 245, 158, 11;       /* Warm Honey */

  --swayrm-gradient-brand: linear-gradient(135deg, #0ea5e9 0%, #6366f1 50%, #8b5cf6 100%);
  --swayrm-gradient-warm: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  --swayrm-gradient-emerald: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  --swayrm-card-bg-light: rgba(255, 255, 255, 0.85);
  --swayrm-card-border-light: rgba(226, 232, 240, 0.8);
}

[data-md-color-scheme="default"] {
  --md-primary-fg-color: #3b5078;
  --md-primary-fg-color--light: #4f6b9e;
  --md-primary-fg-color--dark: #283752;
  --md-accent-fg-color: #0284c7;

  --swayrm-hero-bg: radial-gradient(circle at 50% -20%, rgba(99, 102, 241, 0.12) 0%, rgba(14, 165, 233, 0.05) 50%, transparent 80%);
  --swayrm-card-surface: #ffffff;
  --swayrm-card-border: #e2e8f0;
  --swayrm-card-hover-border: #6366f1;
  --swayrm-card-hover-shadow: 0 16px 32px -8px rgba(99, 102, 241, 0.14);
  --swayrm-pill-bg: rgba(99, 102, 241, 0.08);
  --swayrm-pill-border: rgba(99, 102, 241, 0.25);
  --swayrm-pill-color: #3b5078;
}

[data-md-color-scheme="slate"] {
  --md-primary-fg-color: #1e293b;
  --md-primary-fg-color--light: #334155;
  --md-primary-fg-color--dark: #0f172a;
  --md-accent-fg-color: #38bdf8;

  --swayrm-hero-bg: radial-gradient(circle at 50% -20%, rgba(99, 102, 241, 0.22) 0%, rgba(14, 165, 233, 0.1) 50%, transparent 85%);
  --swayrm-card-surface: #1e293b;
  --swayrm-card-border: #334155;
  --swayrm-card-hover-border: #818cf8;
  --swayrm-card-hover-shadow: 0 16px 32px -8px rgba(0, 0, 0, 0.45);
  --swayrm-pill-bg: rgba(99, 102, 241, 0.16);
  --swayrm-pill-border: rgba(129, 140, 248, 0.35);
  --swayrm-pill-color: #cbd5e1;
}

/* --- Header & Navigation Polish --- */
.md-header {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.md-header__button.md-logo img,
.md-header__button.md-logo svg {
  height: 1.75rem;
  width: 1.75rem;
  object-fit: contain;
  border-radius: 50%;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
  transition: transform 0.2s ease;
}

.md-header__button.md-logo:hover img,
.md-header__button.md-logo:hover svg {
  transform: scale(1.08);
}

.md-tabs {
  border-bottom: 1px solid var(--swayrm-card-border);
  font-weight: 500;
}

/* --- Hero Banner Section --- */
.swayrm-hero {
  position: relative;
  text-align: center;
  padding: 3.5rem 1.5rem 2.5rem;
  margin: -1.5rem -1rem 2.5rem;
  background: var(--swayrm-hero-bg);
  border-radius: 1.25rem;
  border: 1px solid var(--swayrm-card-border);
  overflow: hidden;
}

.swayrm-hero-logo {
  display: block;
  margin: 0 auto 1.25rem;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  box-shadow: 0 12px 32px -4px rgba(99, 102, 241, 0.35);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease;
}

.swayrm-hero-logo:hover {
  transform: scale(1.06) rotate(2deg);
  box-shadow: 0 16px 40px -4px rgba(99, 102, 241, 0.5);
}

.swayrm-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1.1rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--swayrm-pill-bg);
  border: 1px solid var(--swayrm-pill-border);
  color: var(--swayrm-pill-color);
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.swayrm-badge-pill .pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  display: inline-block;
  animation: pulse-glow 2s infinite ease-in-out;
}

@keyframes pulse-glow {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

.swayrm-hero h1,
.swayrm-hero-title {
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.swayrm-hero .headerlink,
.swayrm-hero-title .headerlink {
  display: none !important;
}

/* --- Section Heading Permalinks (Hover-only) --- */
.headerlink {
  opacity: 0;
  transition: opacity 0.2s ease;
  margin-left: 0.35rem;
  text-decoration: none !important;
}

h1:hover .headerlink,
h2:hover .headerlink,
h3:hover .headerlink,
h4:hover .headerlink,
h5:hover .headerlink,
h6:hover .headerlink {
  opacity: 0.5;
}

.headerlink:hover {
  opacity: 1 !important;
}

.swayrm-gradient-title {
  background: var(--swayrm-gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.swayrm-hero-subtitle {
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1.6;
  max-width: 720px;
  margin: 0 auto 1.75rem;
  color: var(--md-default-fg-color--light);
}

.swayrm-hero-quote {
  font-size: 1.05rem;
  font-style: italic;
  max-width: 680px;
  margin: 0 auto 2rem;
  padding: 0.75rem 1.5rem;
  border-left: 3px solid #6366f1;
  border-right: 3px solid #0ea5e9;
  background: rgba(99, 102, 241, 0.04);
  border-radius: 8px;
  color: var(--md-default-fg-color);
}

.swayrm-hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.85rem;
  margin-top: 1.75rem;
}

/* --- Polished Buttons --- */
.md-typeset .md-button {
  font-weight: 600;
  border-radius: 8px;
  padding: 0.65rem 1.4rem;
  font-size: 0.9rem;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.md-typeset .md-button--primary {
  background: var(--swayrm-gradient-brand) !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.md-typeset .md-button--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.45);
}

.md-typeset .md-button:not(.md-button--primary) {
  border: 1px solid var(--swayrm-card-border);
  background: var(--swayrm-card-surface);
  color: var(--md-default-fg-color);
}

.md-typeset .md-button:not(.md-button--primary):hover {
  transform: translateY(-2px);
  border-color: var(--md-accent-fg-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  color: var(--md-accent-fg-color);
}

/* --- Feature Highlights Bar --- */
.swayrm-highlights-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin: 2rem 0 3rem;
}

.swayrm-highlight-chip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.15rem;
  border-radius: 10px;
  background: var(--swayrm-card-surface);
  border: 1px solid var(--swayrm-card-border);
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
  transition: all 0.2s ease;
}

.swayrm-highlight-chip:hover {
  border-color: var(--swayrm-card-hover-border);
  transform: translateY(-2px);
}

.swayrm-highlight-icon {
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Card Grid Customization --- */
.md-typeset .grid.cards > ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.md-typeset .grid.cards > ul > li {
  background: var(--swayrm-card-surface);
  border: 1px solid var(--swayrm-card-border);
  border-radius: 12px;
  padding: 1.5rem;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  position: relative;
  overflow: hidden;
}

.md-typeset .grid.cards > ul > li:hover {
  transform: translateY(-4px);
  border-color: var(--swayrm-card-hover-border);
  box-shadow: var(--swayrm-card-hover-shadow);
}

.md-typeset .grid.cards > ul > li hr {
  margin: 0.85rem 0 1rem;
  border-color: var(--swayrm-card-border);
}

.md-typeset .grid.cards > ul > li > :first-child {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--md-default-fg-color);
}

/* Pillar Card Accent Lines */
.pillar-cards.grid.cards > ul > li:nth-child(1),
.grid.cards.pillar-cards > ul > li:nth-child(1),
.md-typeset .pillar-card-1 {
  border-top: 3px solid #0ea5e9 !important;
}

.pillar-cards.grid.cards > ul > li:nth-child(2),
.grid.cards.pillar-cards > ul > li:nth-child(2),
.md-typeset .pillar-card-2 {
  border-top: 3px solid #8b5cf6 !important;
}

.pillar-cards.grid.cards > ul > li:nth-child(3),
.grid.cards.pillar-cards > ul > li:nth-child(3),
.md-typeset .pillar-card-3 {
  border-top: 3px solid #10b981 !important;
}

/* --- Comparative Matrix Cards --- */
.swayrm-comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0 2.5rem;
}

.swayrm-comparison-card {
  background: var(--swayrm-card-surface);
  border: 1px solid var(--swayrm-card-border);
  border-radius: 12px;
  padding: 1.35rem;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
}

.swayrm-comparison-card.highlight {
  border: 2px solid #6366f1;
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.06) 0%, var(--swayrm-card-surface) 100%);
  box-shadow: 0 8px 24px -4px rgba(99, 102, 241, 0.18);
  position: relative;
}

.swayrm-comparison-card.highlight::before {
  content: "THE SWAYRM PARADIGM";
  position: absolute;
  top: -11px;
  left: 1.25rem;
  background: #6366f1;
  color: #ffffff;
  font-size: 0.675rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 4px;
}

.swayrm-comparison-card h4 {
  margin-top: 0;
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.swayrm-comparison-card p {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--md-default-fg-color--light);
  margin-bottom: 0.5rem;
}

.swayrm-comparison-card .flaw {
  color: #ef4444;
  font-weight: 600;
}

.swayrm-comparison-card .strength {
  color: #10b981;
  font-weight: 600;
}

/* --- Navigation Section Dividers --- */
.section-intro {
  font-size: 1.05rem;
  color: var(--md-default-fg-color--light);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

/* --- Status & Transparency Callout --- */
.swayrm-status-card {
  border: 1px solid var(--swayrm-card-border);
  background: var(--swayrm-card-surface);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  margin: 2rem 0;
}

.swayrm-status-badge {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

/* --- Code & Inline Hilite Tuning --- */
.md-typeset code {
  border-radius: 4px;
  font-weight: 500;
}

/* --- ADR & Navigation List Alignment --- */
.md-typeset ul li code {
  font-size: 0.8em;
  padding: 0.15em 0.5em;
  border-radius: 4px;
}

.md-typeset ul li .twemoji {
  vertical-align: -0.15em;
}

/* --- Responsive Adjustments --- */
@media screen and (max-width: 768px) {
  .swayrm-hero {
    padding: 2.25rem 1rem 1.75rem;
  }

  .swayrm-hero h1 {
    font-size: 2rem;
  }

  .swayrm-hero-subtitle {
    font-size: 1.05rem;
  }

  .swayrm-hero-actions {
    flex-direction: column;
    width: 100%;
  }

  .swayrm-hero-actions .md-button {
    width: 100%;
    justify-content: center;
  }
}
