/**
 * Trailblazer CMS - Front End Stylesheet
 * Responsive Bootstrap 5 theme with Age UK structure and Trailblazer brand colors.
 */

/* ==========================================================================
   Typography & Base
   ========================================================================== */
body {
  font-family: var(--font-body);
  font-size: var(--font-base-size, 18px);
  color: var(--text);
  background-color: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .font-heading {
  font-family: var(--font-heading);
  color: var(--heading);
  font-weight: 700;
  letter-spacing: -0.01em;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s ease-in-out;
}
a:hover, a:focus {
  color: var(--link-hover);
}

/* Accessibility anchor offset for sticky header */
[id] {
  scroll-margin-top: 110px;
}

/* Focus indicator */
:focus-visible {
  outline: 3px solid var(--brand-primary) !important;
  outline-offset: 2px !important;
}

/* ==========================================================================
   Brand Color Utilities
   ========================================================================== */
.bg-surface {
  background-color: var(--surface) !important;
}
.bg-soft {
  background-color: var(--accent-soft) !important;
}
.bg-dark-olive {
  background-color: var(--brand-secondary) !important;
}
.text-primary {
  color: var(--brand-primary) !important;
}
.text-secondary {
  color: var(--brand-secondary) !important;
}
.letter-spacing-1 {
  letter-spacing: 0.08em;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  border-radius: var(--btn-radius, 0.5rem);
  font-family: var(--font-heading);
  font-weight: 600;
  text-decoration: none !important;
  transition: all 0.2s ease-in-out;
}

.btn-primary {
  background-color: var(--btn-primary-bg) !important;
  border-color: var(--btn-primary-bg) !important;
  color: var(--btn-primary-text) !important;
}
.btn-primary:hover, .btn-primary:focus {
  filter: brightness(0.92);
  box-shadow: 0 4px 12px rgba(243, 138, 57, 0.35);
}

.btn-secondary {
  background-color: var(--btn-secondary-bg) !important;
  border-color: var(--btn-secondary-bg) !important;
  color: var(--btn-secondary-text) !important;
}
.btn-secondary:hover, .btn-secondary:focus {
  filter: brightness(1.15);
  box-shadow: 0 4px 12px rgba(68, 67, 17, 0.25);
}

.btn-dark-olive {
  background-color: var(--brand-secondary) !important;
  border-color: var(--brand-secondary) !important;
  color: #FFFFFF !important;
}
.btn-dark-olive:hover {
  background-color: #2b2a0b !important;
}

.btn-outline-primary {
  color: var(--link) !important;
  border-color: var(--brand-primary) !important;
  border-width: 2px;
}
.btn-outline-primary:hover {
  background-color: var(--brand-primary) !important;
  color: var(--btn-primary-text) !important;
}

.btn-outline-brand {
  color: var(--brand-secondary) !important;
  border-color: var(--brand-secondary) !important;
  border-width: 2px;
}
.btn-outline-brand:hover {
  background-color: var(--brand-secondary) !important;
  color: #FFFFFF !important;
}

.btn-icon-round {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* ==========================================================================
   Header & Top Utility Bar
   ========================================================================== */
.site-header {
  background: #ffffff;
  z-index: 1020;
}

.topbar-nav .topbar-link {
  color: var(--topbar-text);
  opacity: 0.9;
  font-size: 0.875rem;
}
.topbar-nav .topbar-link:hover {
  opacity: 1;
  text-decoration: underline;
}

/* ==========================================================================
   Main Desktop Navigation & Mega Menu (2-Layer Submenu Architecture)
   ========================================================================== */
.desktop-nav-bar {
  background: #ffffff;
}

.main-nav-list .nav-item {
  position: static; /* Allows mega menu dropdown to span full width */
}

.main-nav-list .nav-link {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--header-text);
  padding: 1rem 1.15rem !important;
  text-decoration: none !important;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.main-nav-list .nav-link:hover,
.main-nav-list .nav-link:focus,
.main-nav-list .nav-item.active .nav-link,
.main-nav-list .nav-item.dropdown:hover .nav-link {
  color: var(--link);
  border-bottom-color: var(--brand-primary);
}

.nav-chevron {
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}
.mega-menu-item:hover .nav-chevron,
.mega-menu-item.show .nav-chevron {
  transform: rotate(180deg);
}

/* Mega Menu Dropdown Panel */
.mega-menu-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  width: 100vw;
  background-color: #ffffff;
  border-top: 3px solid var(--brand-primary) !important;
  border-radius: 0;
  margin-top: 0;
  padding: 0;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12);
  display: none;
  animation: megaFadeIn 0.2s ease-out;
}

@keyframes megaFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hover support on desktop */
@media (min-width: 992px) {
  .mega-menu-item:hover > .mega-menu-panel {
    display: block;
  }
}

.mega-menu-panel.show {
  display: block;
}

/* Mega Menu Group Headers (Layer 1 Submenu) */
.mega-group-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--brand-secondary);
  text-decoration: none !important;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--border);
  transition: color 0.15s ease;
}
a.mega-group-title:hover {
  color: var(--link);
  border-bottom-color: var(--brand-primary);
}

/* Mega Menu Child Links (Layer 2 Sub-submenu) */
.mega-child-list {
  padding-top: 0.35rem;
}
.mega-child-item {
  margin-bottom: 0.35rem;
}
.mega-child-link {
  display: block;
  color: var(--text);
  font-size: 0.95rem;
  text-decoration: none !important;
  padding: 0.25rem 0;
  transition: all 0.15s ease;
}
.mega-child-link:hover,
.mega-child-item.active .mega-child-link {
  color: var(--link);
  padding-left: 0.35rem;
}

/* Mega Menu Flat link */
.mega-simple-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-radius: 0.5rem;
  color: var(--brand-secondary);
  font-weight: 600;
  text-decoration: none !important;
  transition: all 0.2s ease;
}
.mega-simple-link:hover,
.mega-simple-link.active {
  background: var(--brand-primary);
  color: var(--btn-primary-text);
  transform: translateX(4px);
}

/* Mega Menu Promo Card */
.mega-promo-card {
  background: var(--surface);
  border-left: 4px solid var(--brand-primary) !important;
}
.mega-promo-card h4, .mega-promo-card strong {
  font-family: var(--font-heading);
  color: var(--brand-secondary);
}

/* ==========================================================================
   Mobile Drill-Down Off-Canvas Navigation (3-level hierarchy)
   ========================================================================== */
.mobile-menu-offcanvas {
  width: 320px;
  max-width: 85vw;
}

.mobile-nav-slider {
  overflow-x: hidden;
  position: relative;
  min-height: 400px;
}

.mobile-nav-panel {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateX(100%);
  background: #ffffff;
  z-index: 1;
}

.mobile-nav-panel.mobile-nav-root {
  transform: translateX(0);
  position: relative;
}

.mobile-nav-panel.active {
  transform: translateX(0);
  z-index: 2;
}

.mobile-nav-list .mobile-nav-row {
  border-bottom: 1px solid var(--border);
}

.mobile-nav-link {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--text);
  text-decoration: none !important;
  font-size: 1.05rem;
}
.mobile-nav-link:hover,
.mobile-nav-item.active > .mobile-nav-row .mobile-nav-link,
.mobile-nav-item.active > .mobile-nav-link {
  color: var(--link);
}

.mobile-nav-drill {
  color: var(--brand-secondary);
  font-size: 1.1rem;
}

.mobile-nav-back {
  font-weight: 600;
}

/* ==========================================================================
   Page Builder Blocks Styling
   ========================================================================== */
.hero-section {
  overflow: hidden;
}

.card-item {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08) !important;
}

/* Signature Statement */
.statement-block {
  padding: 2.5rem 1rem;
}
.statement-line {
  line-height: 1.25;
}
.statement-tail {
  letter-spacing: -0.01em;
}

/* Questions list */
.list-questions .question-line {
  transition: transform 0.2s ease;
}
.list-questions .question-line:hover {
  transform: translateX(6px);
}

/* Split block image */
.split-media-wrapper img {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  font-size: 0.95rem;
}
.footer-link-list .footer-link {
  color: var(--footer-link);
  text-decoration: none;
  display: inline-block;
  padding: 0.2rem 0;
  transition: color 0.15s ease, transform 0.15s ease;
}
.footer-link-list .footer-link:hover {
  color: #ffffff;
  transform: translateX(3px);
  text-decoration: underline;
}

.hover-text-primary:hover {
  color: var(--brand-primary) !important;
}

/* ==========================================================================
   Cookie Banner
   ========================================================================== */
.cookie-banner {
  z-index: 1080;
}
