/* ========================================
   VITALIS SENIORENDIENST - MAIN CSS
   Design System, Reset, Typografie, Layout
   ======================================== */

/* --- Self-hosted Fonts (DSGVO-konform, kein Google-CDN) --- */
/* Body: Source Sans 3 (variable 400–700) – humanistischer Sans, senior-lesbar, self-hosted (DSGVO, INT-205) */
@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../assets/fonts/source-sans-3-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../assets/fonts/source-sans-3-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Headings: Fraunces (variable 400–900, optical sizing) – distinktive Display-Serif, self-hosted */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('../assets/fonts/fraunces-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('../assets/fonts/fraunces-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --- CSS Custom Properties --- */
:root {
  /* Base Colors */
  --blue:           #5079A5;
  --blue-dark:      #3D6089;
  --blue-soft:      #EEF4FA;
  --blue-ghost:     rgba(80, 121, 165, 0.08);

  --teal:           #3D6089;   /* INT-318: war #327878 (teal→blau), WCAG AA 5.7:1 */
  --teal-dark:      #2A4565;
  --teal-ghost:     rgba(80, 121, 165, 0.08);

  --yellow:         #F9DA02;   /* Vitalis Gelb – Logo-Schwung; nur auf Dunkel/dekorativ (Kontrast 1.5:1 auf Weiß) */
  --amber:          #C97B3A;   /* Orange-Akzent – Textakzente (Grosstext ≥22px bold, WCAG AA-Large) */
  --amber-dark:     #A85E1F;

  --ink:            #1C2B3A;
  --ink-muted:      #556070;
  --ink-light:      #64717F;  /* WCAG-AA-fest (~5:1 auf Weiß) – vorher #7A8A9A (3,8:1) */
  --ink-border:     #CDD8E8;
  --ink-bg:         #F4F7FB;
  --ink-warm:       #F6F2EC;
  --white:          #ffffff;

  --color-danger:   #d4534a;

  --font-body: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading: 'Fraunces', Georgia, 'Times New Roman', serif;

  --fs-xs: 0.875rem;
  --fs-sm: 1rem;
  --fs-base: 1.1875rem; /* 19px – senior-freundlich, edel (INT #11), war 1.125rem/18px */
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 1.75rem;
  --fs-3xl: 2rem;
  --fs-4xl: 2.5rem;
  --fs-5xl: 3rem;
  --fs-hero: 3.5rem;

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  --lh-tight: 1.3;
  --lh-normal: 1.6;
  --lh-relaxed: 1.8;

  --spacing-xs: 0.5rem;
  --spacing-sm: 0.75rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  --spacing-3xl: 4rem;
  --spacing-4xl: 5rem;
  --spacing-5xl: 6rem;
  --spacing-section: 4rem;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 50px;
  --radius-circle: 50%;

  --shadow-sm: 0 1px 3px rgba(45, 41, 38, 0.05), 0 1px 2px rgba(45, 41, 38, 0.03);
  --shadow-md: 0 4px 12px rgba(45, 41, 38, 0.06), 0 2px 4px rgba(45, 41, 38, 0.03);
  --shadow-lg: 0 8px 30px rgba(45, 41, 38, 0.07), 0 4px 8px rgba(45, 41, 38, 0.03);
  --shadow-xl: 0 16px 48px rgba(45, 41, 38, 0.09), 0 8px 16px rgba(45, 41, 38, 0.04);
  --shadow-primary: 0 4px 16px rgba(80, 121, 165, 0.3);   /* based on --blue */
  --shadow-secondary: 0 4px 16px rgba(61, 96, 137, 0.25); /* based on --teal */
  --shadow-warm: 0 4px 20px rgba(244, 162, 97, 0.15);

  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;

  --container-max: 1280px;
  --container-narrow: 960px;
  --container-wide: 1440px;
  --container-padding: 1.5rem;

  --nav-height: 80px;
  --trust-bar-height: 48px;

  --z-base: 1;
  --z-dropdown: 10;
  --z-sticky: 20;
  --z-overlay: 30;
  --z-nav: 40;
  --z-mobile-menu: 50;
  --z-modal: 60;
  --z-cookie: 70;
  --z-skip: 100;
}

/* --- CSS Reset / Normalize --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Sticky-Stack beim Ankersprung: klebende Nav (var(--nav-height)) + ggf. der
     TOC-Balken (56px, .page-toc__toggle). Die Trust-Bar scrollt weg und zählt NICHT. */
  scroll-padding-top: calc(var(--nav-height) + 56px + 1rem);
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-normal);
  color: var(--ink);
  background-color: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
}

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

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

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

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

/* Fließtext-Listen zeigen Browser-Marker in Markenblau (INT-666).
   Komponenten-Listen (Nav, Footer, Karten mit Icons …) setzen list-style:none selbst. */
li::marker {
  color: var(--blue-dark);
}

ol > li::marker {
  font-weight: 700;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

fieldset {
  border: none;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  color: var(--ink);
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

/* --- Typografie-System --- */
h1 {
  font-size: var(--fs-hero);
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--fs-4xl);
  letter-spacing: -0.01em;
}

h3 {
  font-size: var(--fs-2xl);
}

h4 {
  font-size: var(--fs-xl);
}

h5 {
  font-size: var(--fs-lg);
}

h6 {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
}

p {
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--ink-muted);
}

.text-large {
  font-size: var(--fs-lg);
  line-height: var(--lh-relaxed);
}

.text-small {
  font-size: var(--fs-sm);
}

.text-muted {
  color: var(--ink-muted);
}

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

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

.text-primary {
  color: var(--blue);
}

.text-secondary {
  color: var(--teal);
}

.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.font-heading {
  font-family: var(--font-heading);
}

.font-body {
  font-family: var(--font-body);
}

.fw-medium {
  font-weight: var(--fw-medium);
}

.fw-semibold {
  font-weight: var(--fw-semibold);
}

.fw-bold {
  font-weight: var(--fw-bold);
}

strong, b {
  font-weight: var(--fw-semibold);
}

/* --- Layout-Klassen --- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

.container-narrow {
  max-width: var(--container-narrow);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

.container-wide {
  max-width: var(--container-wide);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

.section {
  padding-top: var(--spacing-section);
  padding-bottom: var(--spacing-section);
}

.section-sm {
  padding-top: var(--spacing-3xl);
  padding-bottom: var(--spacing-3xl);
}

.section-bg {
  background: var(--ink-bg);
}

.section-cream {
  background-color: var(--ink-warm);
}

.section-white {
  background-color: var(--white);
}

/* --- Background Utility Classes --- */
.bg-white {
  background: #ffffff;
}

.bg-section {
  background: #F4F7FB;
}

.bg-ink {
  background: var(--ink-bg);
}

.bg-cream {
  background: #F5F1EB;
}

.bg-primary-light {
  background: #EEF4FA;
}

/* --- Grid --- */
.grid {
  display: grid;
  gap: var(--spacing-xl);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
  gap: var(--spacing-2xl);
}

.grid-auto {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* --- Flex Utilities --- */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-start {
  display: flex;
  align-items: flex-start;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-end {
  justify-content: flex-end;
}

.gap-xs {
  gap: var(--spacing-xs);
}

.gap-sm {
  gap: var(--spacing-sm);
}

.gap-md {
  gap: var(--spacing-md);
}

.gap-lg {
  gap: var(--spacing-lg);
}

.gap-xl {
  gap: var(--spacing-xl);
}

.gap-2xl {
  gap: var(--spacing-2xl);
}

.gap-3xl {
  gap: var(--spacing-3xl);
}

/* --- Spacing Utilities --- */
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }
.mt-2xl { margin-top: var(--spacing-2xl); }
.mt-3xl { margin-top: var(--spacing-3xl); }

.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mb-xl { margin-bottom: var(--spacing-xl); }
.mb-2xl { margin-bottom: var(--spacing-2xl); }
.mb-3xl { margin-bottom: var(--spacing-3xl); }

/* --- Accessibility Styles --- */
.skip-link {
  position: fixed;
  top: -100%;
  left: var(--spacing-md);
  z-index: var(--z-skip);
  padding: var(--spacing-md) var(--spacing-xl);
  background-color: var(--blue);
  color: var(--white);
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  transition: top var(--transition-base);
}

.skip-link:focus {
  top: 0;
  outline: none;
  color: var(--white);
}

*:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.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;
}

@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;
  }
}

/* --- Selection --- */
::selection {
  background-color: var(--blue);
  color: var(--white);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--ink-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--ink-light);
  border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ink-light);
}

/* --- Cookie Banner --- */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-cookie);
  background-color: var(--white);
  border-top: 1px solid var(--ink-border);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  padding: var(--spacing-md) 0;
  transform: translateY(100%);
  transition: transform var(--transition-base);
}

.cookie-banner.is-visible {
  transform: translateY(0);
}

/* Solange der Cookie-Banner sichtbar ist, den Floating-Telefon-Button ausblenden –
   er läge sonst (z-index 60) unter dem Banner (70) und wäre nicht tippbar.
   Das Nav-Telefon (sticky) bleibt sichtbar. Ohne :has()-Support bleibt das alte Verhalten. */
body:has(.cookie-banner.is-visible) .floating-phone-btn {
  opacity: 0;
  pointer-events: none;
}

.cookie-banner__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-xl);
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

.cookie-banner__text {
  font-size: var(--fs-base);
  color: var(--ink-muted);
  line-height: var(--lh-normal);
  flex: 1;
}

.cookie-banner__text a {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cookie-banner__actions {
  display: flex;
  gap: var(--spacing-md);
  flex-shrink: 0;
}

/* INT-321: beide Knöpfe gleich groß, Senioren-Tippfläche 48 px */
.cookie-banner__actions .btn {
  min-height: 48px;
  min-width: 8rem;
}

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

.w-full {
  width: 100%;
}

.h-full {
  height: 100%;
}

.relative {
  position: relative;
}

.overflow-hidden {
  overflow: hidden;
}

.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

.block {
  display: block;
}

.inline-block {
  display: inline-block;
}

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

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

.rounded-pill {
  border-radius: var(--radius-pill);
}

/* --- Animate on Scroll Base ---
   Verfeinert: kürzere Distanz + handgemachte Easing-Kurve (easeOutQuart)
   statt uniformem 0.6s ease. Wirkt „whisper" statt AOS-Slop. */
.fade-in {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.55s cubic-bezier(0.22, 0.61, 0.36, 1),
              transform 0.55s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.fade-in.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-in-left {
  opacity: 0;
  transform: translate3d(-16px, 4px, 0);
  transition: opacity 0.55s cubic-bezier(0.22, 0.61, 0.36, 1),
              transform 0.55s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.fade-in-left.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.fade-in-right {
  opacity: 0;
  transform: translate3d(16px, 4px, 0);
  transition: opacity 0.55s cubic-bezier(0.22, 0.61, 0.36, 1),
              transform 0.55s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.fade-in-right.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* Fallback: ohne JavaScript kein Verstecken – Inhaltsbilder/Texte bleiben sichtbar */
@media (scripting: none) {
  .fade-in,
  .fade-in-left,
  .fade-in-right {
    opacity: 1;
    transform: none;
  }
}

.scale-in {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.scale-in.is-visible {
  opacity: 1;
  transform: scale(1);
}
