/* ==========================================================================
   CSS Variables & Custom Properties
   ========================================================================== */
:root {
  /* Brand & Theme Colors */
  --track-red: #d32f2f;
  --track-red-dark: #b71c1c;
  --line-yellow: #fbc02d;
  --teal: #00796b;
  --graphite: #2b2d31;
  --graphite-dark: #1a1b1e;
  --concrete: #f1f3f5;
  --synthetic-grey: #868e96;
  
  /* Neutral Colors */
  --white: #ffffff;
  --grey-100: #f8f9fa;
  --grey-200: #e9ecef;
  --grey-300: #dee2e6;
  --grey-600: #6c757d;
  --grey-800: #343a40;
  --grey-900: #212529;
  
  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  
  /* Spacing, Radius, & Shadows */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-subtle: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-float: 0 12px 32px rgba(0, 0, 0, 0.15);
  
  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  color: var(--grey-800);
  background-color: var(--grey-100);
  line-height: 1.6;
  overflow-x: hidden;
}

img, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--track-red);
  text-decoration: none;
  transition: var(--transition-fast);
}

a:hover {
  color: var(--track-red-dark);
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--track-red);
  color: var(--white);
  padding: 8px 16px;
  z-index: 10000;
  font-weight: 600;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 0;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ==========================================================================
   Typography
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
  color: var(--grey-900);
  line-height: 1.2;
  font-weight: 700;
  margin-bottom: 1rem;
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.75rem); }
h4 { font-size: 1.2rem; }

p {
  margin-bottom: 1rem;
}

.eyebrow-label {
  display: inline-block;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--track-red);
  margin-bottom: 0.75rem;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.text-teal { color: var(--teal) !important; }
.text-red { color: var(--track-red) !important; }
.text-yellow { color: var(--line-yellow) !important; }
.text-white { color: var(--white) !important; }

.bg-graphite { background-color: var(--graphite) !important; }
.bg-concrete { background-color: var(--concrete) !important; }
.bg-white { background-color: var(--white) !important; }

.border-subtle { border: 1px solid var(--grey-300); }
.shadow-subtle { box-shadow: var(--shadow-subtle); }

.radius-md { border-radius: var(--radius-md); }
.radius-lg { border-radius: var(--radius-lg); }

.mt-4 { margin-top: 1.5rem !important; }
.p-4 { padding: 1.5rem !important; }
.w-100 { width: 100% !important; }
.text-center { text-align: center !important; }
.img-fluid { width: 100%; height: auto; object-fit: cover; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 1.5rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition-normal);
  text-align: center;
  line-height: 1.2;
}

.btn-primary {
  background-color: var(--track-red);
  color: var(--white);
  border-color: var(--track-red);
}

.btn-primary:hover, .btn-primary:focus {
  background-color: var(--track-red-dark);
  border-color: var(--track-red-dark);
  color: var(--white);
}

.btn-secondary {
  background-color: var(--graphite);
  color: var(--white);
  border-color: var(--graphite);
}

.btn-secondary:hover, .btn-secondary:focus {
  background-color: var(--graphite-dark);
  border-color: var(--graphite-dark);
  color: var(--white);
}

.btn-outline {
  background-color: transparent;
  color: var(--grey-900);
  border-color: var(--grey-300);
}

.btn-outline:hover, .btn-outline:focus {
  border-color: var(--grey-900);
  background-color: var(--grey-100);
}

.btn-text {
  background: none;
  border: none;
  color: var(--grey-600);
  text-decoration: underline;
  padding: 0.5rem 1rem;
}

.btn-text:hover {
  color: var(--grey-900);
}

.btn-compact {
  padding: 0.5rem 1rem;
  background-color: var(--track-red);
  color: var(--white);
}

.btn-compact:hover {
  background-color: var(--track-red-dark);
  color: var(--white);
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.site-header {
  background-color: var(--white);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 80px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--graphite);
}

.brand-icon {
  width: 32px;
  height: 32px;
  color: var(--track-red);
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.menu-toggle {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
}

.hamburger {
  position: relative;
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--graphite);
  transition: all 0.3s ease;
}

.hamburger::before,
.hamburger::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--graphite);
  transition: all 0.3s ease;
}

.hamburger::before { top: -8px; }
.hamburger::after { bottom: -8px; }

.menu-toggle[aria-expanded="true"] .hamburger { background-color: transparent; }
.menu-toggle[aria-expanded="true"] .hamburger::before { transform: rotate(45deg); top: 0; }
.menu-toggle[aria-expanded="true"] .hamburger::after { transform: rotate(-45deg); bottom: 0; }

.main-nav {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background-color: var(--white);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  padding: 1rem 0;
}

.main-nav.is-open {
  display: block;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.nav-list a {
  font-weight: 600;
  color: var(--grey-800);
}

.nav-list a:not(.btn):hover,
.nav-list a.is-active {
  color: var(--track-red);
}

@media (min-width: 992px) {
  .menu-toggle { display: none; }
  
  .main-nav {
    display: block;
    position: static;
    width: auto;
    background: transparent;
    box-shadow: none;
    padding: 0;
  }
  
  .nav-list {
    flex-direction: row;
    gap: 2rem;
  }
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero-section {
  position: relative;
  background-color: var(--graphite-dark);
  color: var(--white);
  overflow: hidden;
  padding: 4rem 0;
  min-height: 80vh;
  display: flex;
  align-items: center;
}

.hero-background-graphic {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.hero-container {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  align-items: center;
}

.hero-content h1 {
  color: var(--white);
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}

.hero-intro {
  font-size: 1.125rem;
  color: var(--grey-300);
  max-width: 540px;
  margin-bottom: 2.5rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 3rem;
}

.hero-metadata {
  display: flex;
  gap: 3rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 1.5rem;
}

.meta-item {
  display: flex;
  flex-direction: column;
}

.meta-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--line-yellow);
}

.meta-label {
  font-size: 0.875rem;
  color: var(--grey-300);
}

.hero-visual {
  display: none;
}

.hero-image {
  width: 100%;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  border: 4px solid var(--graphite);
}

@media (min-width: 992px) {
  .hero-container {
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
  }
  .hero-visual {
    display: block;
  }
}

/* ==========================================================================
   Featured Topics / Card Grid
   ========================================================================== */
.featured-topics-section {
  padding: 5rem 0;
}

.section-header {
  text-align: center;
  margin-bottom: 4rem;
  max-width: 700px;
  margin-inline: auto;
}

.section-header h2 {
  margin-bottom: 0.5rem;
}

.section-header p {
  color: var(--grey-600);
  font-size: 1.125rem;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

.service-card {
  background: var(--white);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-subtle);
  transition: var(--transition-normal);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.service-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

.card-image-wrapper {
  position: relative;
  height: 240px;
  overflow: hidden;
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.service-card:hover .card-image {
  transform: scale(1.05);
}

.card-topic-label {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(43, 45, 49, 0.9);
  color: var(--white);
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.875rem;
  backdrop-filter: blur(4px);
}

.card-info-panel {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card-title {
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
}

.card-desc {
  color: var(--grey-600);
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.card-meta {
  font-size: 0.875rem;
  color: var(--teal);
  font-weight: 600;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--grey-200);
}

.card-cta {
  width: 100%;
}

@media (min-width: 768px) {
  .card-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }
}

/* ==========================================================================
   Topic & Legal Pages
   ========================================================================== */
.topic-header {
  padding: 3rem 0;
  margin-bottom: 3rem;
}

.breadcrumb {
  font-size: 0.875rem;
  color: var(--grey-300);
  margin-bottom: 2rem;
}

.breadcrumb a {
  color: var(--white);
  text-decoration: underline;
}

.breadcrumb a:hover {
  color: var(--track-red);
}

.topic-title {
  color: var(--white);
  margin-bottom: 1.5rem;
}

.topic-intro {
  font-size: 1.25rem;
  color: var(--grey-300);
  max-width: 800px;
}

.topic-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  padding-bottom: 5rem;
}

@media (min-width: 1024px) {
  .topic-layout {
    grid-template-columns: 1fr 380px;
    gap: 4rem;
  }
}

.content-section {
  margin-bottom: 3.5rem;
}

.content-section h2 {
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--grey-200);
}

.content-section h3 {
  margin-top: 2rem;
  margin-bottom: 1rem;
}

/* Layout Components in Content */
.comparison-block {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  padding: 1.5rem;
  border-radius: var(--radius-md);
  margin: 2rem 0;
}

@media (min-width: 768px) {
  .comparison-block {
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
  }
}

.technical-list {
  list-style: none;
  counter-reset: tech-counter;
  margin: 1.5rem 0;
}

.technical-list li {
  position: relative;
  padding-left: 3rem;
  margin-bottom: 1rem;
}

.technical-list li::before {
  counter-increment: tech-counter;
  content: counter(tech-counter, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0;
  color: var(--track-red);
  font-weight: 700;
  font-size: 0.875rem;
  background: var(--grey-100);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}

/* Sidebar Styling */
.topic-sidebar {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.image-caption {
  font-size: 0.875rem;
  color: var(--grey-600);
  margin-top: 0.75rem;
  font-style: italic;
}

.sidebar-widget {
  padding: 1.5rem;
  border-radius: var(--radius-md);
}

.widget-title {
  font-size: 1.125rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--grey-200);
}

.widget-list {
  list-style: none;
}

.widget-list li {
  padding: 0.5rem 0;
  border-bottom: 1px dashed var(--grey-200);
  font-size: 0.95rem;
}

.widget-list li:last-child {
  border-bottom: none;
}

.sidebar-cta {
  padding: 2rem 1.5rem;
  text-align: center;
}

.sidebar-cta p {
  color: var(--grey-300);
  margin-bottom: 1.5rem;
}

/* Legal Pages */
.legal-page {
  padding: 4rem 0;
}

.legal-header {
  text-align: center;
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--grey-300);
}

.legal-updated {
  color: var(--grey-600);
}

.legal-content {
  max-width: 800px;
  margin: 0 auto;
}

.legal-content h2 {
  margin-top: 2.5rem;
  font-size: 1.5rem;
}

.legal-content h3 {
  margin-top: 1.5rem;
  font-size: 1.2rem;
}

.legal-content ul, .legal-content ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

.legal-content li {
  margin-bottom: 0.5rem;
}

.table-responsive {
  overflow-x: auto;
  margin: 2rem 0;
}

.technical-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.technical-table th, 
.technical-table td {
  padding: 1rem;
  border: 1px solid var(--grey-300);
}

.technical-table th {
  background-color: var(--graphite);
  color: var(--white);
  font-weight: 600;
}

.technical-table tr:nth-child(even) {
  background-color: var(--grey-100);
}

.technical-table code {
  background: var(--grey-200);
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
  font-family: monospace;
}

/* ==========================================================================
   Contact Page
   ========================================================================== */
.contact-page {
  padding: 4rem 0;
}

.contact-header {
  text-align: center;
  margin-bottom: 4rem;
  max-width: 700px;
  margin-inline: auto;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
}

@media (min-width: 992px) {
  .contact-grid {
    grid-template-columns: 3fr 2fr;
  }
}

.form-card {
  padding: 2rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--grey-900);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.875rem;
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  color: var(--grey-900);
  transition: border-color var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--track-red);
  box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.1);
}

.error-message {
  display: none;
  color: var(--track-red);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea {
  border-color: var(--track-red);
}

.form-group.has-error .error-message {
  display: block;
}

.form-success-msg {
  background-color: #d1e7dd;
  color: #0f5132;
  padding: 1rem;
  border-radius: var(--radius-sm);
  margin-top: 1.5rem;
  border: 1px solid #badbcc;
}

.info-card {
  padding: 2rem;
}

.map-visual {
  width: 100%;
  height: 250px;
  background-color: var(--concrete);
  border-radius: var(--radius-md);
  overflow: hidden;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background-color: var(--graphite-dark);
  color: var(--grey-300);
  padding-top: 4rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
}

@media (min-width: 768px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr;
  }
}

.footer-brand {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--white);
  display: block;
  margin-bottom: 1.5rem;
}

.footer-heading {
  color: var(--white);
  font-size: 1.125rem;
  margin-bottom: 1.5rem;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 0.75rem;
}

.footer-links a {
  color: var(--grey-300);
}

.footer-links a:hover {
  color: var(--white);
  text-decoration: underline;
}

.footer-bottom {
  background-color: #121316;
  padding: 1.5rem 0;
  text-align: center;
  font-size: 0.875rem;
}

@media (min-width: 768px) {
  .footer-bottom-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .footer-bottom p {
    margin: 0;
  }
}

/* ==========================================================================
   Cookie Banner
   ========================================================================== */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: var(--white);
  box-shadow: 0 -4px 16px rgba(0,0,0,0.1);
  z-index: 9999;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.cookie-content {
  flex-grow: 1;
}

.cookie-title {
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
}

.cookie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

@media (min-width: 768px) {
  .cookie-banner {
    flex-direction: row;
    align-items: center;
    padding: 1.5rem 2rem;
  }
  
  .cookie-content p {
    margin: 0;
  }
  
  .cookie-actions {
    flex-shrink: 0;
  }
}