/* ==========================================================================
   Aethelgard — BESPOKE ASTROLOGY & EPHEMERIS PLATFORM
   Custom Stylesheet (Bootstrap 5.3 + Domain-Native Luxury Editorial System)
   ========================================================================== */

:root {
  --ag-obsidian: #070B14;
  --ag-navy: #0B101E;
  --ag-surface: #121A2F;
  --ag-surface-elevated: #18223C;
  --ag-ivory: #FAF8F5;
  --ag-cream: #F2ECE1;
  --ag-gold: #C6A355;
  --ag-gold-light: #DFC382;
  --ag-gold-dark: #9D7D35;
  --ag-text-light: #F4F0EA;
  --ag-text-muted-dark: #94A3B8;
  --ag-text-dark: #0F172A;
  --ag-text-muted-light: #475569;
  --ag-border-dark: rgba(198, 163, 85, 0.18);
  --ag-border-subtle: rgba(255, 255, 255, 0.08);
  --ag-border-light: rgba(15, 23, 42, 0.1);
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

/* Base & Typography */
html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--ag-navy);
  color: var(--ag-text-light);
  line-height: 1.65;
  font-size: 15.5px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .font-display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.font-mono-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Editorial Section Surfaces */
.section-dark {
  background-color: var(--ag-navy);
  color: var(--ag-text-light);
  border-bottom: 1px solid var(--ag-border-subtle);
}

.section-obsidian {
  background-color: var(--ag-obsidian);
  color: var(--ag-text-light);
  border-bottom: 1px solid var(--ag-border-subtle);
}

.section-ivory {
  background-color: var(--ag-ivory);
  color: var(--ag-text-dark);
  border-bottom: 1px solid var(--ag-border-light);
}

.section-cream {
  background-color: var(--ag-cream);
  color: var(--ag-text-dark);
  border-bottom: 1px solid var(--ag-border-light);
}

/* Top Bar Contract & Sticky Governance */
.ag-navbar {
  background-color: rgba(7, 11, 20, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ag-border-dark);
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
  z-index: 1030;
  transition: background-color 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.ag-brand {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 600;
  color: var(--ag-text-light) !important;
  letter-spacing: 0.03em;
  text-decoration: none;
  white-space: nowrap;
}

.ag-nav-link {
  color: rgba(244, 240, 234, 0.82) !important;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.45rem 0.85rem !important;
  position: relative;
  white-space: nowrap;
  transition: color 160ms ease;
}

.ag-nav-link:hover,
.ag-nav-link.active {
  color: var(--ag-gold-light) !important;
}

.ag-nav-link::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 0.85rem;
  right: 0.85rem;
  height: 1px;
  background-color: var(--ag-gold);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.ag-nav-link:hover::after,
.ag-nav-link.active::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Dropdown Menu */
.ag-dropdown-menu {
  background-color: var(--ag-surface);
  border: 1px solid var(--ag-border-dark);
  border-radius: 6px;
  padding: 0.5rem;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
  min-width: 240px;
}

.ag-dropdown-item {
  color: var(--ag-text-light);
  font-size: 0.875rem;
  padding: 0.55rem 0.9rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background-color 150ms ease, color 150ms ease;
}

.ag-dropdown-item:hover,
.ag-dropdown-item:focus,
.ag-dropdown-item.active {
  background-color: rgba(198, 163, 85, 0.14);
  color: var(--ag-gold-light);
}

/* Buttons */
.btn-ag-gold {
  background-color: var(--ag-gold);
  color: #070B14;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.62rem 1.35rem;
  border-radius: 4px;
  border: 1px solid var(--ag-gold);
  white-space: nowrap;
  transition: background-color 160ms ease, transform 160ms ease, border-color 160ms ease;
}

.btn-ag-gold:hover,
.btn-ag-gold:focus-visible {
  background-color: var(--ag-gold-light);
  border-color: var(--ag-gold-light);
  color: #070B14;
  transform: translateY(-1px);
}

.btn-ag-outline {
  background-color: transparent;
  color: var(--ag-text-light);
  font-weight: 500;
  font-size: 0.88rem;
  padding: 0.62rem 1.35rem;
  border-radius: 4px;
  border: 1px solid var(--ag-border-dark);
  white-space: nowrap;
  transition: border-color 160ms ease, color 160ms ease, background-color 160ms ease;
}

.btn-ag-outline:hover,
.btn-ag-outline:focus-visible {
  border-color: var(--ag-gold);
  color: var(--ag-gold-light);
  background-color: rgba(198, 163, 85, 0.08);
}

.btn-ag-dark {
  background-color: var(--ag-navy);
  color: var(--ag-text-light);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.62rem 1.35rem;
  border-radius: 4px;
  border: 1px solid var(--ag-navy);
  white-space: nowrap;
  transition: background-color 160ms ease, transform 160ms ease;
}

.btn-ag-dark:hover {
  background-color: var(--ag-surface-elevated);
  color: var(--ag-gold-light);
  transform: translateY(-1px);
}

/* Single-Elevation Cards & Editorial Frames */
.ag-card-dark {
  background-color: var(--ag-surface);
  border: 1px solid var(--ag-border-subtle);
  border-radius: 6px;
  transition: border-color 180ms ease, transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.ag-card-dark:hover {
  border-color: var(--ag-border-dark);
}

.ag-card-interactive:hover {
  border-color: var(--ag-gold);
  transform: translateY(-2px);
}

.ag-card-light {
  background-color: #FFFFFF;
  border: 1px solid var(--ag-border-light);
  border-radius: 6px;
  color: var(--ag-text-dark);
  transition: border-color 180ms ease, transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.ag-card-light:hover {
  border-color: var(--ag-gold-dark);
}

/* Unboxed Metadata Discipline (Zero-Pill Rule) */
.ag-meta {
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--ag-text-muted-dark);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.ag-meta-light {
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--ag-text-muted-light);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.ag-kicker {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--ag-gold);
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
  display: block;
}

.ag-kicker-dark {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--ag-gold-dark);
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
  display: block;
}

/* Interactive Segmented Filter Controls */
.ag-segmented-control {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.3rem;
  background-color: var(--ag-obsidian);
  border: 1px solid var(--ag-border-subtle);
  border-radius: 6px;
}

.ag-segment-btn {
  background: transparent;
  border: none;
  color: var(--ag-text-muted-dark);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.45rem 0.95rem;
  border-radius: 4px;
  white-space: nowrap;
  transition: background-color 150ms ease, color 150ms ease;
}

.ag-segment-btn:hover {
  color: var(--ag-text-light);
}

.ag-segment-btn.active {
  background-color: var(--ag-surface-elevated);
  color: var(--ag-gold-light);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Resilient Image Wrappers & Scrims */
.ag-img-container {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #101829 0%, #1c263b 100%);
  border-radius: 4px;
}

.ag-img-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

.ag-card-interactive:hover .ag-img-cover {
  transform: scale(1.02);
}

.ag-scrim-bottom {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(7, 11, 20, 0.92) 0%, rgba(7, 11, 20, 0.45) 45%, rgba(7, 11, 20, 0.1) 100%);
}

/* Custom Forms */
.ag-input,
.ag-select {
  background-color: var(--ag-obsidian) !important;
  border: 1px solid var(--ag-border-subtle) !important;
  color: var(--ag-text-light) !important;
  border-radius: 4px !important;
  padding: 0.65rem 0.9rem !important;
  font-size: 0.92rem !important;
}

.ag-input:focus,
.ag-select:focus {
  border-color: var(--ag-gold) !important;
  box-shadow: 0 0 0 3px rgba(198, 163, 85, 0.18) !important;
  outline: none;
}

.ag-input::placeholder {
  color: rgba(148, 163, 184, 0.6) !important;
}

.ag-input-light,
.ag-select-light {
  background-color: #FFFFFF !important;
  border: 1px solid rgba(15, 23, 42, 0.18) !important;
  color: var(--ag-text-dark) !important;
  border-radius: 4px !important;
  padding: 0.65rem 0.9rem !important;
  font-size: 0.92rem !important;
}

.ag-input-light:focus,
.ag-select-light:focus {
  border-color: var(--ag-gold-dark) !important;
  box-shadow: 0 0 0 3px rgba(157, 125, 53, 0.15) !important;
}

/* Custom Accordion */
.ag-accordion .accordion-item {
  background-color: var(--ag-surface);
  border: 1px solid var(--ag-border-subtle);
  margin-bottom: 0.65rem;
  border-radius: 6px !important;
  overflow: hidden;
}

.ag-accordion .accordion-button {
  background-color: var(--ag-surface);
  color: var(--ag-text-light);
  font-weight: 500;
  font-size: 0.98rem;
  padding: 1.1rem 1.25rem;
  box-shadow: none !important;
}

.ag-accordion .accordion-button:not(.collapsed) {
  background-color: var(--ag-surface-elevated);
  color: var(--ag-gold-light);
}

.ag-accordion .accordion-button::after {
  filter: invert(0.85) sepia(0.3) saturate(1.5) hue-rotate(5deg);
}

.ag-accordion .accordion-body {
  background-color: var(--ag-surface);
  color: var(--ag-text-muted-dark);
  border-top: 1px solid var(--ag-border-subtle);
  font-size: 0.92rem;
  line-height: 1.7;
}

/* Zodiac Grid Cell */
.zodiac-cell {
  background-color: var(--ag-surface);
  border: 1px solid var(--ag-border-subtle);
  padding: 1.35rem;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
  text-align: left;
  width: 100%;
  color: var(--ag-text-light);
}

.zodiac-cell:hover,
.zodiac-cell.active {
  border-color: var(--ag-gold);
  background-color: var(--ag-surface-elevated);
  transform: translateY(-2px);
}

.zodiac-symbol {
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1;
  color: var(--ag-gold);
}

/* Natal Wheel SVG Interactive */
.natal-wheel-svg {
  max-width: 100%;
  height: auto;
}

/* Progress Bars for Synastry */
.ag-progress {
  height: 6px;
  background-color: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.ag-progress-bar {
  height: 100%;
  background-color: var(--ag-gold);
  transition: width 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Back to Top Button */
.ag-back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 4px;
  background-color: var(--ag-surface-elevated);
  border: 1px solid var(--ag-gold);
  color: var(--ag-gold-light);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1020;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease, background-color 180ms ease;
}

.ag-back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.ag-back-to-top:hover {
  background-color: var(--ag-gold);
  color: var(--ag-obsidian);
}

/* Footer */
.ag-footer {
  background-color: var(--ag-obsidian);
  border-top: 1px solid var(--ag-border-dark);
  color: var(--ag-text-muted-dark);
  font-size: 0.88rem;
}

.ag-footer-link {
  color: var(--ag-text-muted-dark);
  text-decoration: none;
  display: inline-block;
  padding: 0.28rem 0;
  transition: color 150ms ease;
}

.ag-footer-link:hover {
  color: var(--ag-gold-light);
}

/* Page Directory Drawer Toggle */
.ag-page-switcher-bar {
  background-color: var(--ag-obsidian);
  border-bottom: 1px solid var(--ag-border-subtle);
  padding: 0.45rem 0;
  font-size: 0.78rem;
}

/* Responsive Safeguards */
@media (max-width: 991.98px) {
  .ag-navbar {
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
  }
  .ag-brand {
    font-size: 1.4rem;
  }
  .ag-nav-link::after {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
