/* ============================================
   COMPANY.CSS - EngSiteTools Company Styles
   Updated: 2025-12-31 - Reduced header height
   ============================================ */

/* --- News Cards Rail --- */
/* Hide entire news section */
section.news,
section#news,
.news.section,
section.news.section,
section#news.section,
section.news.fade-in,
section#news.fade-in {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Hide News links in header and footer */
header nav a[href="#news"],
header a[href="#news"],
nav a[href="#news"],
footer a[href="#news"],
footer li a[href="#news"] {
  display: none !important;
  visibility: hidden !important;
}

.news-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0;
}

.news-head h2 {
  margin: 0;
}

.news-more {
  font-size: 14px;
  text-decoration: none;
  color: var(--text);
  opacity: 0.8;
}

.news-more:hover {
  text-decoration: underline;
}

.news-rail-wrap {
  position: relative;
  padding: 0;
  min-height: auto;
  height: auto;
  max-height: none;
}

/* Container for navigation buttons - positions buttons on far left and far right */
.news-rail-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  position: relative;
  z-index: 10;
  margin-top: 24px;
  gap: 0;
}

/* Position left button on far left */
.news-rail-nav .news-rail-btn:first-child {
  order: 1;
}

/* Position right button on far right */
.news-rail-nav .news-rail-btn:last-child {
  order: 3;
}

.news-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 85%;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
  padding-top: 2px; /* Add top padding to prevent border clipping in high contrast */
}

/* High contrast mode - ensure rail doesn't clip card borders */
html.high-contrast .news-rail,
html.high-contrast.theme-light .news-rail {
  padding-top: 4px !important;
  padding-bottom: 8px !important;
}

.news-rail::-webkit-scrollbar {
  height: 8px;
}

@media (min-width: 900px) {
  .news-rail {
    grid-auto-columns: calc(100% / 3); /* Full width since buttons are with pagination */
  }
}

/* Entire card is a link with hover/focus animations - Match product card style */
a.news-card,
.news-card,
section.news .news-card,
section#news .news-card,
.news-rail .news-card,
#newsRail .news-card {
  scroll-snap-align: start;
  background: #eeeeee !important;
  background-color: #eeeeee !important;
  border-radius: var(--radius) !important;
  padding: 20px !important;
  box-shadow: var(--shadow) !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none !important;
  color: var(--text) !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid rgba(0, 0, 0, 0.15) !important;
  align-items: flex-start;
  text-align: left;
  box-sizing: border-box !important;
}

/* High contrast mode - use outline in addition to border to prevent clipping */
html.high-contrast .news-card,
html.high-contrast a.news-card,
html.high-contrast section.news .news-card,
html.high-contrast section#news .news-card,
html.high-contrast .news-rail .news-card,
html.high-contrast #newsRail .news-card {
  outline: 2px solid #ffffff !important;
  outline-offset: -2px !important; /* Place outline inside to match border */
  overflow: visible !important; /* Prevent border clipping */
}

html.high-contrast.theme-light .news-card,
html.high-contrast.theme-light a.news-card,
html.high-contrast.theme-light section.news .news-card,
html.high-contrast.theme-light section#news .news-card,
html.high-contrast.theme-light .news-rail .news-card,
html.high-contrast.theme-light #newsRail .news-card {
  outline: 2px solid #000000 !important;
  outline-offset: -2px !important; /* Place outline inside to match border */
  position: relative !important;
  /* Keep overflow: hidden for rounded corners, but use pseudo-element for visible border */
}

/* Use pseudo-element for border to ensure it's never clipped */
html.high-contrast.theme-light .news-card::before,
html.high-contrast.theme-light a.news-card::before {
  content: '' !important;
  position: absolute !important;
  top: -2px !important; /* Account for border width */
  left: -2px !important;
  right: -2px !important;
  bottom: -2px !important;
  border: 2px solid #000000 !important;
  border-radius: var(--radius) !important;
  pointer-events: none !important;
  z-index: 10 !important;
  box-sizing: border-box !important;
}

/* High contrast mode - ensure image container doesn't interfere with border pseudo-element */
html.high-contrast.theme-light .news-card .news-img {
  position: relative !important;
  z-index: 0 !important; /* Behind the border pseudo-element */
}

/* News cards now use same theme-reactive background as product cards */

@media (prefers-color-scheme: dark) {
  a.news-card,
  .news-card,
  section.news .news-card,
  section#news .news-card,
  .news-rail .news-card,
  #newsRail .news-card {
    background: #2a2a2a !important;
    background-color: #2a2a2a !important;
    color: var(--text) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
  }
}

html.theme-dark a.news-card,
html.theme-dark .news-card,
html.theme-dark section.news .news-card,
html.theme-dark section#news .news-card,
html.theme-dark .news-rail .news-card,
html.theme-dark #newsRail .news-card {
  background: #2a2a2a !important;
  background-color: #2a2a2a !important;
  color: var(--text) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

html.theme-light a.news-card,
html.theme-light .news-card,
html.theme-light section.news .news-card,
html.theme-light section#news .news-card,
html.theme-light .news-rail .news-card,
html.theme-light #newsRail .news-card {
  background: #eeeeee !important;
  background-color: #eeeeee !important;
  color: var(--text) !important;
  border: 1px solid rgba(0, 0, 0, 0.15) !important;
  box-shadow: var(--shadow) !important;
}

/* News cards now use same theme-reactive background as product cards - no individual colors */

.news-card,
.news-card * {
  color: var(--text) !important;
  text-decoration: none !important;
}

.news-card:hover,
.news-card:hover * {
  color: var(--text) !important;
  text-decoration: none !important;
}

.news-card:visited,
.news-card:visited * {
  color: var(--text) !important;
  text-decoration: none !important;
}

.news-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
}

.news-card:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.news-img {
  position: relative;
  aspect-ratio: 16/9;
  width: 100%;
  overflow: hidden;
  background: linear-gradient(135deg, #e8e8e8, #d5d5d5);
}

@media (prefers-color-scheme: dark) {
  .news-img {
    background: linear-gradient(135deg, #2a2a2a, #1f1f1f);
  }
}

.news-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.news-card:hover .news-img img {
  transform: scale(1.03);
}

.news-body {
  padding: 14px 16px 18px;
  display: grid;
  gap: 8px;
}

.news-title {
  font-size: 20px;
  line-height: 1.2;
  margin: 0;
  color: inherit;
  text-decoration: none;
}

.news-card .news-title {
  color: var(--text);
  text-decoration: none;
}

.news-card:hover .news-title {
  color: var(--text);
  text-decoration: none;
}

.news-date {
  font-size: 12px;
  color: var(--muted);
}

.news-cta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.news-arrow {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.1);
  display: grid;
  place-items: center;
  text-decoration: none;
  color: var(--text);
}

@media (prefers-color-scheme: dark) {
  .news-arrow {
    border-color: rgba(255,255,255,.15);
  }
}

.news-arrow:hover {
  background: rgba(0,0,0,.05);
}

@media (prefers-color-scheme: dark) {
  .news-arrow:hover {
    background: rgba(255,255,255,.06);
  }
}

.news-card:hover .news-arrow {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.news-card {
  position: relative;
  z-index: 1;
}

/* News Rail Navigation Buttons */
.news-rail-nav {
  display: flex;
  align-items: center;
  gap: 0;
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  order: 1; /* Left side */
  margin-right: auto;
}

/* Individual navigation button styling */
.news-rail-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.2);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
  margin: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.news-rail-btn:hover {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.news-rail-btn:active {
  transform: scale(0.95);
}

.news-rail-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* Dark mode button styles */
@media (prefers-color-scheme: dark) {
  .news-rail-btn {
    background: rgba(42, 42, 42, 0.9);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text);
  }
}

html.theme-dark .news-rail-btn {
  background: rgba(42, 42, 42, 0.9);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text);
}

html.theme-light .news-rail-btn {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(0, 0, 0, 0.2);
  color: var(--text);
}

/* News Pagination Dots - centered in the middle, absolutely positioned */
.news-pagination {
  display: flex !important; /* Override display: none to make visible */
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  margin-bottom: 0;
  margin-left: auto;
  margin-right: auto;
  padding: 0;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  min-height: 40px;
  text-align: center;
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}


.news-pagination-dot {
  width: 8px;
  height: 8px;
  min-width: 8px;
  min-height: 8px;
  max-width: 8px;
  max-height: 8px;
  border-radius: 50%;
  aspect-ratio: 1; /* Force square/circular shape */
  background: rgba(0, 0, 0, 0.5); /* Darker for better visibility */
  border: none;
  cursor: pointer;
  padding: 0;
  margin: 0 4px;
  transition: all 0.2s ease;
  flex-shrink: 0;
  display: inline-block;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  visibility: visible;
  opacity: 1;
  text-indent: -9999px;
  overflow: hidden;
  font-size: 0;
  line-height: 0;
  color: transparent;
  position: relative;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  box-sizing: border-box;
}

/* Force circular shape with pseudo-element */
.news-pagination-dot::before {
  content: '';
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: inherit;
  position: absolute;
  top: 0;
  left: 0;
}

/* Active dot pseudo-element should be dark */
.news-pagination-dot.active::before {
  background: inherit; /* Inherit from .news-pagination-dot.active */
}

.news-pagination-dot:hover {
  background: rgba(0, 0, 0, 0.4);
  transform: scale(1.2);
}

.news-pagination-dot.active {
  background: rgba(0, 0, 0, 0.9); /* Much darker/solid black for active */
  width: 10px;
  height: 10px;
  min-width: 10px;
  min-height: 10px;
  max-width: 10px;
  max-height: 10px;
  aspect-ratio: 1; /* Force square/circular shape */
  border: none;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); /* Stronger shadow for active */
  box-sizing: border-box;
}

@media (prefers-color-scheme: dark) {
  .news-pagination-dot {
    background: rgba(255, 255, 255, 0.3);
  }
  
  .news-pagination-dot::before {
    background: rgba(255, 255, 255, 0.3);
  }
  
  .news-pagination-dot:hover {
    background: rgba(255, 255, 255, 0.5);
  }
  
  .news-pagination-dot:hover::before {
    background: rgba(255, 255, 255, 0.5);
  }
  
  .news-pagination-dot.active {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 1px 3px rgba(255, 255, 255, 0.4);
  }
  
  .news-pagination-dot.active::before {
    background: rgba(255, 255, 255, 0.9);
  }
}

html.theme-dark .news-pagination-dot {
  background: rgba(255, 255, 255, 0.3);
}

html.theme-dark .news-pagination-dot::before {
  background: rgba(255, 255, 255, 0.3);
}

html.theme-dark .news-pagination-dot:hover {
  background: rgba(255, 255, 255, 0.5);
}

html.theme-dark .news-pagination-dot:hover::before {
  background: rgba(255, 255, 255, 0.5);
}

html.theme-dark .news-pagination-dot.active {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 3px rgba(255, 255, 255, 0.4);
}

html.theme-dark .news-pagination-dot.active::before {
  background: rgba(255, 255, 255, 0.9);
}

html.theme-light .news-pagination-dot {
  background: rgba(0, 0, 0, 0.2);
}

html.theme-light .news-pagination-dot::before {
  background: rgba(0, 0, 0, 0.2);
}

html.theme-light .news-pagination-dot:hover {
  background: rgba(0, 0, 0, 0.4);
}

html.theme-light .news-pagination-dot:hover::before {
  background: rgba(0, 0, 0, 0.4);
}

html.theme-light .news-pagination-dot.active {
  background: rgba(0, 0, 0, 0.9);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

html.theme-light .news-pagination-dot.active::before {
  background: rgba(0, 0, 0, 0.9);
}

/* High contrast mode for pagination dots */
html.high-contrast .news-pagination-dot {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid #ffffff;
}

html.high-contrast .news-pagination-dot:hover {
  background: rgba(255, 255, 255, 0.8);
}

html.high-contrast .news-pagination-dot.active {
  background: #00ff00;
  border-color: #00ff00;
}

html.high-contrast.theme-light .news-pagination-dot {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid #000000;
}

html.high-contrast.theme-light .news-pagination-dot:hover {
  background: rgba(0, 0, 0, 0.6);
}

html.high-contrast.theme-light .news-pagination-dot.active {
  background: #0000ff;
  border-color: #0000ff;
}

/* Header & Hero */
/* Header - Compact Size - Always Glassmorphic Dark Blue */
header,
html header,
body header {
  background: linear-gradient(135deg, rgba(26, 26, 46, 0.4) 0%, rgba(22, 33, 62, 0.4) 100%) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  color: #fff !important;
  padding: 6px 20px !important;
  padding-top: 6px !important;
  padding-bottom: 6px !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 100 !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2), 0 1px 0 rgba(255, 255, 255, 0.1) inset !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
  min-height: auto !important;
  max-height: none !important;
  height: auto !important;
  line-height: 1 !important;
  margin: 0 !important;
  transition: all 0.3s ease !important;
}

/* High contrast mode with light theme - header should be dark for contrast */
html.high-contrast.theme-light header,
html.high-contrast.theme-light html header,
html.high-contrast.theme-light body header {
  background: linear-gradient(135deg, #000000 0%, #000000 100%) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  color: #ffffff !important;
  border-bottom: 2px solid #ffffff !important;
}

/* Glassmorphic effect when scrolled - Maximum specificity - MUST come after base header rule */
body header.scrolled,
html body header.scrolled,
body > header.scrolled,
header.scrolled {
  background: linear-gradient(135deg, rgba(26, 26, 46, 0.3) 0%, rgba(22, 33, 62, 0.3) 100%) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2), 0 1px 0 rgba(255, 255, 255, 0.1) inset !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
}

@media (prefers-color-scheme: dark) {
  body header.scrolled,
  html body header.scrolled,
  body > header.scrolled,
  header.scrolled {
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.5) 0%, rgba(22, 33, 62, 0.5) 100%) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
  }
}

html.theme-light body header.scrolled,
html.theme-light html body header.scrolled,
html.theme-light body > header.scrolled,
html.theme-light header.scrolled {
  background: linear-gradient(135deg, rgba(26, 26, 46, 0.4) 0%, rgba(22, 33, 62, 0.4) 100%) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
}

html.theme-dark body header.scrolled,
html.theme-dark html body header.scrolled,
html.theme-dark body > header.scrolled,
html.theme-dark header.scrolled {
  background: linear-gradient(135deg, rgba(26, 26, 46, 0.5) 0%, rgba(22, 33, 62, 0.5) 100%) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
}

header * {
  box-sizing: border-box !important;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-section h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.logo-section img,
header .logo-section img,
.header-content .logo-section img {
  height: 32px !important;
  width: auto !important;
  display: block !important;
  max-height: 32px !important;
  max-width: none !important;
}

/* Make logo black in light mode */
@media (prefers-color-scheme: light) {
  .logo-section img,
  header .logo-section img,
  .header-content .logo-section img,
  body header .logo-section img {
    filter: brightness(0) saturate(100%) !important;
  }
}

html.theme-light .logo-section img,
html.theme-light header .logo-section img,
html.theme-light .header-content .logo-section img,
html.theme-light body header .logo-section img {
  filter: brightness(0) saturate(100%) !important;
}

.logo-section a {
  display: block;
  text-decoration: none;
  transition: opacity 0.2s;
}

.logo-section a:hover {
  opacity: 0.8;
}

nav {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 24px;
}

header .header-content nav a {
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
}

header .header-content nav a:hover {
  color: #fff;
  opacity: 0.8;
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.1);
}

header .header-content nav a:visited {
  color: rgb(255, 255, 255) !important;
  text-decoration: none !important;
  opacity: 1 !important;
  filter: none !important;
}

header .header-content nav a:active,
header .header-content nav a:focus {
  text-decoration: none !important;
}

header .header-content nav a:active {
  transform: translateY(-3px) scale(1.06) !important;
  background: rgba(255, 255, 255, 0.35) !important;
}

/* Header navigation text scaling with accessibility widget */
html.text-larger header .header-content nav a,
html.text-larger header nav a,
html.text-larger nav a {
  font-size: 14.3px !important; /* 13px * 1.1 */
}

html.text-largest header .header-content nav a,
html.text-largest header nav a,
html.text-largest nav a {
  font-size: 16.25px !important; /* 13px * 1.25 */
}

.nav-cta {
  background: var(--brand);
  padding: 8px 20px;
  border-radius: 6px;
  color: white !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: all 0.2s ease;
  text-decoration: none;
}

.nav-cta:hover {
  background: #3367d6;
  opacity: 1 !important;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
}

.nav-cta:active {
  transform: scale(0.98);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.nav-cta:visited {
  color: white !important;
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 80px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg width="60" height="60" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="60" height="60" patternUnits="userSpaceOnUse"><path d="M 60 0 L 0 0 0 60" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="1"/></pattern></defs><rect width="100%" height="100%" fill="url(%23grid)"/></svg>');
  opacity: 0.3;
}

.hero-content {
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero h1 {
  font-size: 48px;
  font-weight: 700;
  margin: 0 0 20px;
  line-height: 1.2;
}

.hero p {
  font-size: 20px;
  margin: 0 0 32px;
  opacity: 0.95;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero-cta {
  display: inline-flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

@media (max-width: 768px) {
  .hero h1 {
    font-size: 36px;
  }
  
  .hero p {
    font-size: 18px;
  }
  
  .header-content {
    justify-content: center;
  }
}

/* Enhanced Footer */
footer {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: #fff;
  padding: 60px 20px 30px;
}

/* High contrast mode with light theme - footer should be dark for contrast */
html.high-contrast.theme-light footer {
  background: linear-gradient(135deg, #000000 0%, #000000 100%) !important;
  color: #ffffff !important;
  border-top: 2px solid #000000 !important;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 40px;
  margin-bottom: 40px;
}

@media (min-width: 769px) {
  .footer-content {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

.footer-section h3 {
  font-size: 18px;
  margin-bottom: 16px;
  font-weight: 600;
}


/* Footer section text scaling with accessibility widget */
html.text-larger .footer-section h3 {
  font-size: 19.8px !important; /* 18px * 1.1 */
}

html.text-largest .footer-section h3 {
  font-size: 22.5px !important; /* 18px * 1.25 */
}

.footer-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-section li {
  margin-bottom: 10px;
}

.footer-section a,
.footer-section a#cookieSettings {
  color: rgba(255,255,255,0.8) !important;
  text-decoration: none !important;
  transition: opacity 0.2s ease;
}

.footer-section a:hover,
.footer-section a#cookieSettings:hover {
  opacity: 0.8;
  color: rgba(255,255,255,0.8) !important;
  text-decoration: none !important;
}

.footer-section a:visited,
.footer-section a#cookieSettings:visited,
.footer-section a:active,
.footer-section a#cookieSettings:active {
  color: rgba(255,255,255,0.8) !important;
  text-decoration: none !important;
}


.footer-brand p {
  color: rgba(255,255,255,0.7);
  line-height: 1.6;
  font-size: 14px;
}

/* Footer brand text scaling with accessibility widget */
html.text-larger .footer-brand p {
  font-size: 15.4px !important; /* 14px * 1.1 */
}

html.text-largest .footer-brand p {
  font-size: 17.5px !important; /* 14px * 1.25 */
}

.footer-bottom {
  max-width: 1200px;
  margin: 0 auto;
  padding-top: 30px;
  border-top: 1px solid rgba(255,255,255,0.1);
  text-align: center;
  color: rgba(255,255,255,0.6);
  font-size: 14px;
}

/* Footer bottom text scaling with accessibility widget */
html.text-larger .footer-bottom,
html.text-larger .footer-bottom p,
html.text-larger footer .footer-bottom,
html.text-larger footer .footer-bottom p {
  font-size: 15.4px !important; /* 14px * 1.1 */
}

html.text-largest .footer-bottom,
html.text-largest .footer-bottom p,
html.text-largest footer .footer-bottom,
html.text-largest footer .footer-bottom p {
  font-size: 17.5px !important; /* 14px * 1.25 */
}

.footer-bottom a {
  color: rgba(255,255,255,0.8) !important;
  text-decoration: none !important;
  margin: 0 8px;
}

.footer-bottom a:hover {
  opacity: 0.8;
  color: rgba(255,255,255,0.8) !important;
  text-decoration: none !important;
}

.footer-bottom a:visited,
.footer-bottom a:active {
  color: rgba(255,255,255,0.8) !important;
  text-decoration: none !important;
}

/* Footer Social Links */
.footer-section .social-links {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.footer-section .social-links a {
  font-size: 20px;
  color: rgba(255,255,255,0.7) !important;
  transition: opacity 0.2s ease;
  text-decoration: none !important; /* Social icons are buttons, not text links */
}

.footer-section .social-links a:hover {
  opacity: 1;
  color: rgba(255,255,255,1) !important;
}

.footer-section .social-links a:visited,
.footer-section .social-links a:active {
  color: rgba(255,255,255,0.7) !important;
}

/* High contrast mode with light theme - make social icons bright white for visibility */
/* Override general link styles - social icons are buttons, not text links */
html.high-contrast.theme-light .footer-section .social-links a,
html.high-contrast.theme-light .footer-section .social-links a:link,
html.high-contrast.theme-light .footer-section .social-links a:visited,
html.high-contrast.theme-light .footer-section .social-links a:active,
html.high-contrast.theme-light .footer-section .social-links a:hover {
  color: #ffffff !important;
  opacity: 1 !important;
  text-decoration: none !important; /* Remove underline - these are buttons */
}

html.high-contrast.theme-light .footer-section .social-links a i,
html.high-contrast.theme-light .footer-section .social-links a:link i,
html.high-contrast.theme-light .footer-section .social-links a:visited i,
html.high-contrast.theme-light .footer-section .social-links a:active i,
html.high-contrast.theme-light .footer-section .social-links a:hover i {
  color: #ffffff !important;
  filter: brightness(0) invert(1) !important; /* Convert any colored icons to white */
}

/* Back to Top Button - Floating widget above accessibility button */
button.back-to-top,
#backToTop,
button#backToTop.back-to-top {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #4285f4;
  background-color: #4285f4;
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  cursor: pointer;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all 0.3s ease;
  opacity: 0;
  margin: 0;
  padding: 0;
}

button.back-to-top i,
#backToTop i,
button#backToTop.back-to-top i {
  color: white;
  font-size: 20px;
  line-height: 1;
  display: inline-block;
}

.back-to-top.visible,
button.back-to-top.visible,
#backToTop.visible,
button#backToTop.back-to-top.visible {
  display: flex;
  opacity: 1;
}

.back-to-top:hover {
  background: #3367d6;
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

/* High Contrast Mode - Back to Top Button */
html.high-contrast button.back-to-top,
html.high-contrast #backToTop,
html.high-contrast button#backToTop.back-to-top {
  background: #00ff00 !important;
  background-color: #00ff00 !important;
  color: #000000 !important;
  border: 2px solid #ffffff !important;
  box-shadow: none !important;
}

html.high-contrast .back-to-top.visible,
html.high-contrast button.back-to-top.visible,
html.high-contrast #backToTop.visible,
html.high-contrast button#backToTop.back-to-top.visible {
  display: flex !important;
  opacity: 1 !important;
  background: #00ff00 !important;
  background-color: #00ff00 !important;
  color: #000000 !important;
  border: 2px solid #ffffff !important;
  box-shadow: none !important;
}

html.high-contrast button.back-to-top:hover,
html.high-contrast #backToTop:hover,
html.high-contrast button#backToTop.back-to-top:hover,
html.high-contrast .back-to-top.visible:hover,
html.high-contrast button.back-to-top.visible:hover,
html.high-contrast #backToTop.visible:hover,
html.high-contrast button#backToTop.back-to-top.visible:hover {
  background: #ffffff !important;
  background-color: #ffffff !important;
  color: #000000 !important;
  transform: none !important;
  box-shadow: none !important;
}

html.high-contrast button.back-to-top i,
html.high-contrast #backToTop i,
html.high-contrast button#backToTop.back-to-top i,
html.high-contrast .back-to-top.visible i,
html.high-contrast button.back-to-top.visible i,
html.high-contrast #backToTop.visible i,
html.high-contrast button#backToTop.back-to-top.visible i {
  color: #000000 !important;
}

html.high-contrast.theme-light button.back-to-top,
html.high-contrast.theme-light #backToTop,
html.high-contrast.theme-light button#backToTop.back-to-top {
  background: #0000ff !important;
  background-color: #0000ff !important;
  color: #ffffff !important;
  border: 2px solid #000000 !important;
  box-shadow: none !important;
}

html.high-contrast.theme-light .back-to-top.visible,
html.high-contrast.theme-light button.back-to-top.visible,
html.high-contrast.theme-light #backToTop.visible,
html.high-contrast.theme-light button#backToTop.back-to-top.visible {
  display: flex !important;
  opacity: 1 !important;
  background: #0000ff !important;
  background-color: #0000ff !important;
  color: #ffffff !important;
  border: 2px solid #000000 !important;
  box-shadow: none !important;
}

html.high-contrast.theme-light button.back-to-top:hover,
html.high-contrast.theme-light #backToTop:hover,
html.high-contrast.theme-light button#backToTop.back-to-top:hover,
html.high-contrast.theme-light .back-to-top.visible:hover,
html.high-contrast.theme-light button.back-to-top.visible:hover,
html.high-contrast.theme-light #backToTop.visible:hover,
html.high-contrast.theme-light button#backToTop.back-to-top.visible:hover {
  background: #ffffff !important;
  background-color: #ffffff !important;
  color: #000000 !important;
  transform: none !important;
  box-shadow: none !important;
}

html.high-contrast.theme-light button.back-to-top i,
html.high-contrast.theme-light #backToTop i,
html.high-contrast.theme-light button#backToTop.back-to-top i,
html.high-contrast.theme-light .back-to-top.visible i,
html.high-contrast.theme-light button.back-to-top.visible i,
html.high-contrast.theme-light #backToTop.visible i,
html.high-contrast.theme-light button#backToTop.back-to-top.visible i {
  color: #ffffff !important;
}

html.high-contrast.theme-light button.back-to-top:hover i,
html.high-contrast.theme-light #backToTop:hover i,
html.high-contrast.theme-light button#backToTop.back-to-top:hover i,
html.high-contrast.theme-light .back-to-top.visible:hover i,
html.high-contrast.theme-light button.back-to-top.visible:hover i,
html.high-contrast.theme-light #backToTop.visible:hover i,
html.high-contrast.theme-light button#backToTop.back-to-top.visible:hover i {
  color: #000000 !important;
}

@media (max-width: 768px) {
  .back-to-top {
    right: 12px !important;
    bottom: 80px !important;
    left: auto !important;
    width: 44px !important;
    height: 44px !important;
    font-size: 18px !important;
  }
}

/* Final override - Ensure visible state always works - MUST be last - Highest specificity */
html body button#backToTop.back-to-top.visible,
html body #backToTop.visible,
body button#backToTop.back-to-top.visible,
body #backToTop.visible,
button#backToTop.back-to-top.visible,
#backToTop.visible,
button.back-to-top.visible,
.back-to-top.visible {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Accessibility Controls */
.accessibility-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  cursor: pointer;
  z-index: 10001; /* Higher than cookie banner (10000) */
  display: grid;
  place-items: center;
  font-size: 24px;
  transition: all 0.3s;
}

.accessibility-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

.accessibility-panel {
  position: fixed;
  bottom: 90px;
  right: 24px;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  padding: 20px;
  width: 280px;
  z-index: 10001; /* Higher than cookie banner (10000) */
  display: none;
}

.accessibility-panel.open {
  display: block;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.accessibility-panel h3 {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.control-group {
  margin-bottom: 20px;
}

.control-group:last-child {
  margin-bottom: 0;
}

.control-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text);
}

.button-group {
  display: flex;
  gap: 8px;
}

.control-btn {
  flex: 1;
  padding: 8px 12px;
  border: 2px solid var(--brand);
  background: transparent;
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.control-btn:hover {
  background: var(--brand);
  color: white;
}

.control-btn.active {
  background: var(--brand);
  color: white;
}

@media (max-width: 768px) {
  .accessibility-panel {
    right: 12px;
    bottom: 80px;
    width: calc(100vw - 24px);
    max-width: 320px;
  }
  
  .accessibility-btn {
    right: 12px;
    bottom: 12px;
  }
}

/* Google Translate Widget Styling */
#google_translate_element {
  padding: 0;
}

.goog-te-banner-frame {
  display: none !important;
}

body {
  top: 0 !important;
}

.goog-te-gadget {
  font-family: 'Inter', sans-serif !important;
  font-size: 14px;
}

.goog-te-gadget-simple {
  background-color: var(--card-bg) !important;
  border: 2px solid var(--brand) !important;
  border-radius: 6px !important;
  padding: 8px 12px !important;
  font-size: 14px !important;
  color: var(--text) !important;
  transition: all 0.2s;
}

.goog-te-gadget-simple:hover {
  background-color: var(--brand) !important;
  color: white !important;
}

.goog-te-gadget-simple .goog-te-menu-value span {
  color: var(--text) !important;
}

.goog-te-gadget-simple:hover .goog-te-menu-value span {
  color: white !important;
}

.goog-te-menu-frame {
  max-height: 400px !important;
}

/* Hide Google Translate branding */
.goog-logo-link {
  display: none !important;
}

.goog-te-gadget span {
  display: none !important;
}

.goog-te-gadget-simple .goog-te-menu-value span:first-child {
  display: inline !important;
}

/* ============================================
   COOKIE CONSENT BANNER
   ============================================ */

.cookie-consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  /* Glassmorphic background */
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.85) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15), 0 -1px 0 rgba(255, 255, 255, 0.5) inset;
  padding: 20px;
  z-index: 10000;
  display: none;
  transform: translateY(100%);
  transition: transform 0.3s ease, background 0.3s ease, backdrop-filter 0.3s ease;
  /* Ensure cookie banner doesn't overlap with accessibility button */
  padding-right: 100px; /* Add padding to leave space for accessibility button */
}

.cookie-consent-banner.show {
  display: block !important;
  transform: translateY(0) !important;
}

@media (prefers-color-scheme: dark) {
  .cookie-consent-banner {
    background: linear-gradient(135deg, rgba(30, 30, 30, 0.9) 0%, rgba(46, 46, 46, 0.85) 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4), 0 -1px 0 rgba(255, 255, 255, 0.1) inset;
  }
}

/* Theme-aware glassmorphic backgrounds */
html.theme-light .cookie-consent-banner {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.85) 100%) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.3) !important;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15), 0 -1px 0 rgba(255, 255, 255, 0.5) inset !important;
}

html.theme-dark .cookie-consent-banner {
  background: linear-gradient(135deg, rgba(30, 30, 30, 0.9) 0%, rgba(46, 46, 46, 0.85) 100%) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4), 0 -1px 0 rgba(255, 255, 255, 0.1) inset !important;
}

@media (max-width: 768px) {
  .cookie-consent-banner {
    /* On mobile, reduce padding to fit smaller screens */
    padding-right: 20px;
  }
}

.cookie-consent-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.cookie-consent-text {
  flex: 1;
  min-width: 250px;
}

.cookie-consent-text h3 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.cookie-consent-text p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.cookie-consent-text a {
  color: #1a73e8; /* Darker blue for better contrast on light background */
  text-decoration: underline;
}

.cookie-consent-text a:hover {
  color: #1557b0; /* Even darker on hover */
}

/* Dark mode cookie banner links */
@media (prefers-color-scheme: dark) {
  .cookie-consent-text a {
    color: #8ab4f8; /* Lighter blue for dark mode */
  }
  
  .cookie-consent-text a:hover {
    color: #aecbfa; /* Even lighter on hover */
  }
}

/* Theme-aware cookie banner links */
html.theme-dark .cookie-consent-text a {
  color: #8ab4f8 !important;
}

html.theme-dark .cookie-consent-text a:hover {
  color: #aecbfa !important;
}

html.theme-light .cookie-consent-text a {
  color: #1a73e8 !important;
}

html.theme-light .cookie-consent-text a:hover {
  color: #1557b0 !important;
}

.cookie-consent-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.cookie-btn {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  white-space: nowrap;
}

.cookie-btn-primary {
  background: var(--brand);
  color: white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.cookie-btn-primary:hover {
  background: #3367d6;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
}

.cookie-btn-primary:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.cookie-btn-secondary {
  background: transparent;
  color: var(--text);
  border: 2px solid var(--brand);
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.cookie-btn-secondary:hover {
  background: var(--brand);
  color: white;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 12px rgba(66, 133, 244, 0.2);
}

.cookie-btn-secondary:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.cookie-btn-link {
  background: transparent;
  color: var(--muted);
  text-decoration: underline;
  padding: 10px 12px;
}

.cookie-btn-link:hover {
  color: var(--text);
}

.cookie-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  font-size: 20px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

.cookie-close-btn:hover {
  color: var(--text);
}

.cookie-preferences-panel {
  display: none;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

@media (prefers-color-scheme: dark) {
  .cookie-preferences-panel {
    border-top-color: rgba(255, 255, 255, 0.1);
  }
}

.cookie-pref-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

@media (prefers-color-scheme: dark) {
  .cookie-pref-item {
    border-bottom-color: rgba(255, 255, 255, 0.05);
  }
}

.cookie-pref-item:last-child {
  border-bottom: none;
}

.cookie-pref-label {
  flex: 1;
}

.cookie-pref-label strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 14px;
}

.cookie-pref-label p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.cookie-pref-toggle {
  width: 44px;
  height: 24px;
  background: #ccc;
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}

.cookie-pref-toggle.active {
  background: var(--brand);
}

.cookie-pref-toggle::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.cookie-pref-toggle.active::after {
  transform: translateX(20px);
}

.cookie-pref-toggle input[type="checkbox"] {
  display: none;
}

@media (max-width: 768px) {
  .cookie-consent-content {
    flex-direction: column;
    align-items: stretch;
  }
  
  .cookie-consent-actions {
    flex-direction: column;
    width: 100%;
  }
  
  .cookie-btn {
    width: 100%;
  }
}

/* Force news card background with maximum specificity */
section.news .news-rail .news-card,
section#news .news-rail .news-card,
.news-rail-wrap .news-rail .news-card,
#newsRail .news-card,
section.news #newsRail .news-card,
section#news #newsRail .news-card {
  background: #eeeeee !important;
  background-color: #eeeeee !important;
}

@media (prefers-color-scheme: dark) {
  section.news .news-rail .news-card,
  section#news .news-rail .news-card,
  .news-rail-wrap .news-rail .news-card,
  #newsRail .news-card,
  section.news #newsRail .news-card,
  section#news #newsRail .news-card {
    background: #2a2a2a !important;
    background-color: #2a2a2a !important;
  }
}

html.theme-light section.news .news-rail .news-card,
html.theme-light section#news .news-rail .news-card,
html.theme-light .news-rail-wrap .news-rail .news-card,
html.theme-light #newsRail .news-card,
html.theme-light section.news #newsRail .news-card,
html.theme-light section#news #newsRail .news-card {
  background: #eeeeee !important;
  background-color: #eeeeee !important;
}

html.theme-dark section.news .news-rail .news-card,
html.theme-dark section#news .news-rail .news-card,
html.theme-dark .news-rail-wrap .news-rail .news-card,
html.theme-dark #newsRail .news-card,
html.theme-dark section.news #newsRail .news-card,
html.theme-dark section#news #newsRail .news-card {
  background: #2a2a2a !important;
  background-color: #2a2a2a !important;
}


