/**
 * Custom CSS for Funktionelle Medizin Würzburg
 * Based on original website design with Raleway font
 */

/* ============================================
   FONT FACE DECLARATIONS - Raleway
   ============================================ */

@font-face {
  font-family: 'Raleway';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/raleway/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvaooCP.ttf') format('truetype');
}

@font-face {
  font-family: 'Raleway';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/raleway/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvoooCP.ttf') format('truetype');
}

@font-face {
  font-family: 'Raleway';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/raleway/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVsEpYCP.ttf') format('truetype');
}

@font-face {
  font-family: 'Raleway';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/raleway/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVs9pYCP.ttf') format('truetype');
}

/* ============================================
   CSS CUSTOM PROPERTIES (VARIABLES)
   ============================================ */

:root {
  /* Font Families */
  --font-family-primary: 'Raleway', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-family-headings: 'Raleway', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  
  /* Theme Custom Colors */
  --theme-customColors-0: #f6c81d;
  --theme-customColors-1: #96c696;
  --theme-customColors-2: #0a934d;
  --theme-customColors-3: #3ebe7d;
  --theme-customColors-4: #69ddf6;
  --theme-customColors-5: #eaeaea;
  
  /* Theme Body Colors */
  --theme-bodyBackground-color: #ffffff;
  --theme-bodyText-color: #444444;
  
  /* Theme Heading Colors */
  --theme-h1-color: #023b6c;
  --theme-h2-color: #023b6c;
  --theme-h3-color: #023b6c;
  --theme-h4-color: #023b6c;
  --theme-h5-color: #444444;
  --theme-h6-color: #444444;
  
  /* Theme Link & Button Colors */
  --theme-link-color: #023b6c;
  --theme-button-color: #01b0f6;
  --theme-navigationActive-color: #0079aa;
  
  /* Legacy color variables (for backward compatibility) */
  --color-primary: var(--theme-h1-color);
  --color-text: var(--theme-bodyText-color);
  --color-text-light: #9e9e9e;
  --color-link: var(--theme-link-color);
  --color-link-hover: var(--theme-navigationActive-color);
  --color-background: var(--theme-bodyBackground-color);
  --color-border: #e0e0e0;
  
  /* Typography */
  --font-size-base: 18px;
  --font-size-small: 16px;
  --font-size-large: 20px;
  --line-height-base: 1.6;
  
  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  
  /* Breakpoints (for reference in media queries) */
  --breakpoint-mobile: 768px;
  --breakpoint-tablet: 1024px;
  --breakpoint-desktop: 1280px;
}

/* ============================================
   GLOBAL TYPOGRAPHY
   ============================================ */

body {
  font-family: var(--font-family-primary) !important;
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--theme-bodyText-color) !important;
  background-color: var(--theme-bodyBackground-color) !important;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-headings) !important;
  font-weight: 600;
  line-height: 1.3;
  margin-top: var(--spacing-md);
  margin-bottom: var(--spacing-sm);
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--theme-h1-color) !important;
}

h2 {
  font-size: 2rem;
  font-weight: 600;
  color: var(--theme-h2-color) !important;
}

h3 {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--theme-h3-color) !important;
  text-align: justify;
  text-justify: inter-word;
}

h4 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--theme-h4-color) !important;
  text-align: justify;
  text-justify: inter-word;
}

h5 {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--theme-h5-color) !important;
  text-align: justify;
  text-justify: inter-word;
}

h6 {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--theme-h6-color) !important;
  text-align: justify;
  text-justify: inter-word;
}

/* Paragraphs */
p {
  margin-bottom: var(--spacing-sm);
  color: var(--theme-bodyText-color) !important;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
  -webkit-hyphens: auto;
  -moz-hyphens: auto;
  -ms-hyphens: auto;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Links */
a {
  color: var(--theme-link-color) !important;
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--theme-navigationActive-color) !important;
  text-decoration: underline;
}

a:focus {
  outline: 2px solid var(--theme-link-color) !important;
  outline-offset: 2px;
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */

#header {
  background-color: var(--theme-bodyBackground-color) !important;
  border-bottom: 1px solid var(--color-border);
}

.navbar {
  font-family: var(--font-family-primary);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.navbar-section.logo {
  flex-shrink: 0;
  min-width: fit-content;
  width: 100%;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  white-space: nowrap;
}

.navbar-brand img {
  max-height: 60px;
  width: auto;
}

.navbar-brand .logo-text {
  font-family: var(--font-family-primary);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--theme-h1-color) !important;
  white-space: nowrap;
}

.navbar a {
  color: var(--theme-bodyText-color) !important;
  font-weight: 500;
}

.navbar a:hover,
.navbar a.active {
  color: var(--theme-navigationActive-color) !important;
}

/* Remove focus outline and click highlight from navbar links */
.navbar a:focus,
.navbar a:active,
.dropmenu a:focus,
.dropmenu a:active {
  outline: none !important;
  box-shadow: none !important;
  -webkit-tap-highlight-color: transparent;
}

/* Remove the black box on click for navbar links */
.navbar a::-moz-focus-inner,
.dropmenu a::-moz-focus-inner {
  border: 0;
}

/* Desktop Menu: Allow wrapping on overflow */
@media (min-width: 841px) {
  /* Logo section takes full width, menu goes below */
  .navbar-section.logo {
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    width: 100% !important;
    margin-right: 0;
    margin-bottom: 0.5rem;
  }
  
  .navbar-section.desktop-menu {
    flex: 1 1 100%;
    width: 100% !important;
    min-width: 0;
    min-height: auto;
    height: auto !important;
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    margin-top: 0;
    padding-left: 0 !important;
    margin-left: 0 !important;
  }
  
  /* Allow header to grow if menu wraps */
  #header {
    min-height: 4rem;
    height: auto !important;
  }
  
  .dropmenu {
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: flex-start;
    padding-left: 0 !important;
    margin-left: 0 !important;
  }
  
  .dropmenu ul {
    white-space: normal !important;
    flex-wrap: wrap !important;
    align-items: center;
    justify-content: flex-start;
    max-width: 100%;
    padding-left: 0 !important;
    margin-left: 0 !important;
  }

  .dropmenu > ul > li {
    flex-shrink: 1;
    min-width: fit-content;
  }
  
  .dropmenu > ul > li > a {
    padding-left: 0 !important;
  }
}

/* Desktop Menu: Hide when scrolled */
@media (min-width: 841px) {
  /* When scrolled, restore fixed height and hide menu */
  #header.scrolled {
    min-height: 2.3rem;
    height: 2.3rem !important;
  }
  
  #header.scrolled .navbar-section.desktop-menu {
    display: none !important;
  }
  
  #header.scrolled .navbar-section {
    min-height: 2.3rem;
    height: 2.3rem !important;
  }
  
  /* Mobile menu icon: Show on desktop when scrolled */
  #header.scrolled ~ .mobile-menu {
    display: block !important;
    position: fixed;
    top: 0;
    right: 0;
    z-index: 3;
  }
  
  /* Ensure mobile menu icon is visible on desktop when scrolled */
  #header.scrolled ~ .mobile-menu .button_container {
    position: absolute;
    top: 1.3rem;
    right: 1rem;
  }
}

/* ============================================
   CONTENT AREA
   ============================================ */

/* Remove left padding from container to align with navigation */
.container.grid-lg,
.container.grid-xl,
.container.grid-md,
.container.grid-sm,
.container.grid-xs {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* Ensure section padding aligns with navigation */
#header .section {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

#body-wrapper {
  padding-top: var(--spacing-xl);
  padding-bottom: var(--spacing-lg);
  background-color: var(--theme-bodyBackground-color) !important;
}

/* Extra spacing below header when menu is visible */
@media (min-width: 841px) {
  #header:not(.scrolled) + #start > #body-wrapper {
    padding-top: calc(var(--spacing-xl) + 1rem);
  }
  
  /* Extra spacing in container when navbar is visible */
  #header:not(.scrolled) ~ #start #body-wrapper .container {
    padding-bottom: calc(2rem + 1.5rem) !important;
  }
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

/* Bild in Section - 100% Breite (nur bei expliziter Anwendung) */
img.full-width,
img.section-full-width {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  margin: var(--spacing-sm) 0;
}

img.right {
  float: right;
  margin-left: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
}

img.center {
  display: block;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: var(--spacing-sm);
  margin-top: var(--spacing-sm);
}

/* Text-Ausrichtung für Absätze und Überschriften */
p.center,
h1.center,
h2.center,
h3.center,
h4.center,
h5.center,
h6.center {
  text-align: center !important;
}

p.left,
h1.left,
h2.left,
h3.left,
h4.left,
h5.left,
h6.left {
  text-align: left !important;
}

p.right,
h1.right,
h2.right,
h3.right,
h4.right,
h5.right,
h6.right {
  text-align: right !important;
}

/* Lists */
ul, ol {
  margin-bottom: var(--spacing-sm);
  padding-left: var(--spacing-md);
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
  -webkit-hyphens: auto;
  -moz-hyphens: auto;
  -ms-hyphens: auto;
  word-break: break-word;
  overflow-wrap: break-word;
}

li {
  margin-bottom: var(--spacing-xs);
  color: var(--theme-bodyText-color) !important;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
  -webkit-hyphens: auto;
  -moz-hyphens: auto;
  -ms-hyphens: auto;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* ============================================
   FOOTER
   ============================================ */

#footer {
  background-color: var(--theme-bodyBackground-color) !important;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-light);
  font-size: var(--font-size-small);
  padding: var(--spacing-md) 0;
}

#footer a {
  color: var(--color-text-light);
}

#footer a:hover {
  color: var(--color-text);
}

/* ============================================
   BUTTONS & FORMS
   ============================================ */

.btn, button {
  font-family: var(--font-family-primary);
  font-weight: 500;
  padding: var(--spacing-xs) var(--spacing-md);
  border-radius: 4px;
  transition: all 0.3s ease;
}

.btn-primary {
  background-color: var(--theme-button-color) !important;
  color: var(--theme-bodyBackground-color) !important;
  border: none;
}

.btn-primary:hover {
  background-color: var(--theme-navigationActive-color) !important;
  color: var(--theme-bodyBackground-color) !important;
}

input, textarea, select {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-base);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: var(--spacing-xs);
}

input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--theme-link-color);
  outline-offset: 2px;
  border-color: var(--theme-link-color);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Mobile First - Base styles are for mobile */

/* Tablet and up */
@media (min-width: 768px) {
  :root {
    --font-size-base: 18px;
  }
  
  h1 {
    font-size: 2.25rem;
  }
  
  h2 {
    font-size: 1.875rem;
  }
  
  .navbar-brand img {
    max-height: 70px;
  }
  
  .navbar-brand .logo-text {
    font-size: 1.375rem;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  :root {
    --font-size-base: 18px;
  }
  
  h1 {
    font-size: 2.5rem;
  }
  
  h2 {
    font-size: 2rem;
  }
  
  #body-wrapper {
    padding-top: var(--spacing-xl);
    padding-bottom: var(--spacing-xl);
  }
}

/* Large Desktop */
@media (min-width: 1280px) {
  h1 {
    font-size: 2.75rem;
  }
  
  h2 {
    font-size: 2.25rem;
  }
}

/* Mobile optimizations */
@media (max-width: 767px) {
  :root {
    --font-size-base: 16px;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
  }
  
  h1 {
    font-size: 2rem;
  }
  
  h2 {
    font-size: 1.75rem;
  }
  
  h3 {
    font-size: 1.5rem;
  }
  
  .navbar-brand img {
    max-height: 50px;
  }
  
  .navbar-brand .logo-text {
    font-size: 1rem;
  }
  
  #body-wrapper {
    padding-top: var(--spacing-md);
    padding-bottom: var(--spacing-md);
  }
}

/* ============================================
   HERO SECTIONS
   ============================================ */

.hero h1 {
  color: var(--theme-h1-color) !important;
}

.hero h2 {
  color: var(--theme-h2-color) !important;
}

/* ============================================
   MOBILE MENU OVERLAY - Better Readability
   ============================================ */

/* Change overlay background to white/light - maximum specificity */
body .mobile-container .overlay,
body .mobile-container #overlay,
body #overlay.overlay,
body #overlay,
body .overlay,
.mobile-container .overlay,
.mobile-container #overlay,
#overlay.overlay,
#overlay,
.overlay {
  background: #ffffff !important;
  background-color: #ffffff !important;
  background-image: none !important;
  opacity: 1 !important;
}

body .mobile-container .overlay.open,
body .mobile-container #overlay.open,
body #overlay.overlay.open,
body #overlay.open,
body .overlay.open,
.mobile-container .overlay.open,
.mobile-container #overlay.open,
#overlay.overlay.open,
#overlay.open,
.overlay.open {
  background: #ffffff !important;
  background-color: #ffffff !important;
  background-image: none !important;
  opacity: 1 !important;
}

/* Mobile menu links - better contrast */
.mobile-container .overlay-menu .treemenu li a,
.overlay-menu .treemenu li a {
  color: var(--theme-bodyText-color) !important;
}

.mobile-container .overlay-menu .treemenu li a:hover,
.mobile-container .overlay-menu .treemenu li a:focus,
.mobile-container .overlay-menu .treemenu li a.active,
.overlay-menu .treemenu li a:hover,
.overlay-menu .treemenu li a:focus,
.overlay-menu .treemenu li a.active {
  color: var(--theme-navigationActive-color) !important;
}

/* Tree menu items background - light gray from color scheme */
.mobile-container .overlay-menu .treemenu li,
.overlay-menu .treemenu li {
  background: var(--theme-customColors-5) !important;
  background-color: var(--theme-customColors-5) !important;
}

/* Mobile logo should work with light background */
.mobile-container .overlay .mobile-logo svg path,
.overlay .mobile-logo svg path {
  fill: var(--theme-h1-color) !important;
}

/* Make the X icon (close button) visible on white background */
.mobile-menu .button_container.active .top,
.mobile-menu .button_container.active .middle,
.mobile-menu .button_container.active .bottom {
  background: var(--theme-h1-color) !important;
}

/* Also ensure the hamburger icon is visible when menu is closed */
.mobile-menu .button_container span {
  background: var(--theme-h1-color) !important;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-primary {
  color: var(--theme-h1-color) !important;
}

.text-light {
  color: var(--color-text-light);
}

.font-raleway {
  font-family: var(--font-family-primary);
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  body {
    font-size: 12pt;
    line-height: 1.5;
    color: #000;
  }
  
  a {
    color: #000;
    text-decoration: underline;
  }
  
  #header, #footer {
    display: none;
  }
}

