/* =============================================================
   PALARY — COMPONENTS
   Button / Card / Tag / Nav / Footer + their default/hover/focus/
   disabled states (design.md §3.4, components.tokens.json).
   Also: nav-scroll-state + link-underline CSS from the motion spec.
   ============================================================= */

/* ====================== BUTTON ======================
   One height (50px) resolves the 50/55 inconsistency (§3.1).
   Two fills: Primary (lime, on dark/forest) and Primary Inverse
   (charcoal, on light). Lime is reserved for CTAs only (§2.7). */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-8, 8px);
  height: 50px;
  padding-inline: var(--pd-20);
  border-radius: var(--rd-8);
  font-family: var(--font-body);     /* Inter */
  font-weight: 600;
  font-size: var(--fs-button);
  line-height: 1;
  letter-spacing: normal;            /* sentence case — not the uppercase label tracking */
  text-transform: none;              /* render copy as typed: "Demo anfordern" */
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-default) var(--ease-out);
  /* vertical lift on hover is owned by GSAP (data-hover="button") */
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(194,247,52,0.45);   /* lime focus ring */
}

/* Primary — lime fill, on dark + forest backgrounds */
.btn--primary {
  background: var(--button-primary-bg);
  color: var(--button-primary-text);
}
/* Accent CTA hover: a soft lime halo reads more natural than darkening the fill. */
.btn--primary:hover {
  box-shadow: 0 6px 22px -2px rgba(194, 247, 52, 0.55),
              0 2px 10px -2px rgba(194, 247, 52, 0.40);
}

/* Primary Inverse — charcoal fill, on light backgrounds */
.btn--inverse {
  background: var(--button-primary-inverse-bg);
  color: var(--button-primary-inverse-text);
}
.btn--inverse:hover { background: var(--button-primary-inverse-bg-hover); }
.btn--inverse:focus-visible { box-shadow: 0 0 0 3px rgba(48,48,47,0.30); }

/* Secondary ghost — on dark/forest */
.btn--ghost {
  background: transparent;
  color: var(--color-text-primary);
  box-shadow: inset 0 0 0 1px var(--color-text-primary);
}
.btn--ghost:hover { background: rgba(241,241,241,0.14); }

/* Secondary inverse ghost — on light */
.btn--ghost-inverse {
  background: transparent;
  color: var(--color-text-inverse-primary);
  box-shadow: inset 0 0 0 1px var(--color-text-inverse-primary);
}
.btn--ghost-inverse:hover { background: rgba(24,24,23,0.08); }

.btn[disabled], .btn[aria-disabled="true"] {
  opacity: 0.4; pointer-events: none;
}

/* ====================== TAG ======================
   4 variants matching Figma component set (node 656:2428):
   Default (light), on-dark, on-brand (integration), on-accent (lime CTA).
   Variants auto-apply via section cascade (.bg-* .tag in sections.css);
   explicit classes available for override outside a section context. */
.tag {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding-inline: var(--pd-12);
  border-radius: var(--rd-6);
  background: var(--tag-bg);
  color: var(--tag-text);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--fs-tag);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}
.tag--on-dark   { background: var(--tag-bg-on-dark);   color: var(--tag-text-on-dark); }
.tag--on-brand  { background: var(--tag-bg-on-brand);  color: var(--tag-text-on-brand); }
.tag--on-accent { background: var(--tag-bg-on-accent); color: var(--tag-text-on-accent); }

/* ====================== CARD ======================
   Primary: image top + text. Secondary: text-only, larger padding.
   Cards always sit on a contrasting bg (white on light, etc. §3.3). */
.card {
  border-radius: var(--rd-12);
  overflow: hidden;   /* contain child overflow during GSAP transform; does not clip own box-shadow */
  transition: background-color var(--dur-default) var(--ease-out),
              box-shadow var(--dur-default) var(--ease-out),
              transform var(--dur-default) var(--ease-out);
}

/* Card Primary — Features section, white on light */
.card--primary {
  background: var(--card-primary-bg);
  display: flex;
  flex-direction: column;
}
.card--primary:hover { background: var(--card-primary-bg-hover); box-shadow: var(--shadow-md); }
.card--primary .card__media {
  aspect-ratio: 16 / 10;
  background: var(--color-bg-light);
  display: grid; place-items: center;
  overflow: hidden;
  border-radius: 0 0 var(--rd-12) var(--rd-12);
}
.card--primary .card__media img { width: 100%; height: 100%; object-fit: cover; }
.card--primary .card__body { padding: var(--pd-24) var(--pd-16) var(--pd-20); display: flex; flex-direction: column; gap: var(--gap-12); }

/* Features-section overrides: white card, pure float on hover */
.features__grid .card--primary {
  background: #FFFFFF;
}
.features__grid .card--primary:hover {
  background: #FFFFFF;
  box-shadow: none;
  transform: translateY(-4px);
}

/* Card Secondary — Drei Plattformen, white card with border on light bg */
.card--secondary {
  background: #FFFFFF;
  border: var(--bd-1) solid var(--color-border-light);
  padding: var(--pd-32);
  display: flex; flex-direction: column; gap: var(--gap-20);
}
.card--secondary:hover { background: var(--card-secondary-bg); }

/* Forest card — for cards placed on forest sections */
.card--forest {
  background: var(--forest-600);
  color: var(--color-text-on-forest);
  padding: var(--pd-32);
  display: flex; flex-direction: column; gap: var(--gap-20);
}
.card--forest:hover { background: var(--forest-500); }

/* ====================== CONTACT ELEMENTS ======================
   Avatar, name, title — used inside .final-cta__person on the lime §8 section.
   Colors inherit from .final-cta (--color-text-on-accent = charcoal-900). */
.contact-card__avatar {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--rd-12);
  object-fit: cover;
}
.contact-card__meta {
  display: flex; flex-direction: column; align-items: center; gap: var(--gap-12);
}
.contact-card__name {
  font-family: var(--font-body); font-weight: 600; font-size: var(--fs-xl);
}
.contact-card__title { font-size: var(--fs-sm); opacity: 0.65; }

/* ====================== MODAL ======================
   Calendar appointment modal. Overlay: fixed full-viewport dark scrim.
   Box: centered, var(--container-sm) max-width. Full-screen bottom sheet on mobile. */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(24, 24, 23, 0.72);
  z-index: 400;
  display: flex; align-items: center; justify-content: center;
  padding: var(--pd-20);
  opacity: 0; visibility: hidden;
  transition: opacity var(--dur-default) var(--ease-out),
              visibility var(--dur-default);
}
.modal-overlay.is-open { opacity: 1; visibility: visible; }
.modal-overlay[hidden] { display: none; }
.modal {
  position: relative;
  width: 100%; max-width: var(--container-sm);
  background: var(--color-bg-light-pure);
  border-radius: var(--rd-16);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  max-height: calc(100dvh - 80px);
}
.modal__close {
  position: absolute; top: var(--pd-16); right: var(--pd-16);
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--rd-8);
  background: var(--charcoal-50);
  color: var(--color-text-inverse-primary);
  transition: background var(--dur-fast) var(--ease-out);
  z-index: 1;
}
.modal__close:hover { background: var(--charcoal-100); }
.modal__close:focus-visible { outline: 2px solid var(--forest-500); outline-offset: 2px; }
/* Scroll container: our DOM element scrolls, not the cross-origin iframe.
   Works on iOS, Android, and Chrome — iframe touch events pass through
   when the iframe itself has no internal overflow. */
.modal__scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  min-height: 0;
}
.modal__iframe {
  display: block; width: 100%; height: 1400px;
  border: 0; flex-shrink: 0;
}
/* Mobile + tablet: full-height bottom-sheet */
@media (max-width: 768px) {
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    max-width: 100%;
    height: 92dvh;
    max-height: 92dvh;
    border-radius: var(--rd-16) var(--rd-16) 0 0;
  }
}

/* ====================== NAV ======================
   Logo + single CTA (v1). 64px tall. White bg. Sticky.
   Scroll state (.is-scrolled) condenses + blurs — from motion HEAD. */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--color-bg-light-pure);
  transition: background-color var(--dur-slow) var(--ease-standard),
              box-shadow var(--dur-slow) var(--ease-standard),
              border-color var(--dur-slow) var(--ease-standard);
  will-change: background-color;
}
.nav__inner {
  height: 64px;
  display: flex; align-items: center;
  gap: var(--gap-28);
}
.nav__logo { display: inline-flex; align-items: center; gap: var(--gap-12); flex-shrink: 0; margin-right: auto; }
.nav__inner .btn { flex-shrink: 0; }
.nav__logo svg, .nav__logo img { height: 28px; width: auto; }

/* Nav CTA — deliberately subtle. The prominent "Demo anfordern" lives in the
   hero and the final CTA section, so here it stays understated: a faint resting
   pill marks it as a button (distinct from the Developer Portal link), stepping
   one shade darker on hover. */
.nav__cta {
  background: var(--charcoal-50);
  color: var(--color-text-inverse-primary);
}
.nav__cta:hover { background: var(--charcoal-100); }

/* ---- Hamburger toggle + dropdown panel (<1024px) ---- */
.nav__toggle {
  display: none;                       /* desktop: hidden */
  flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; width: 44px; height: 44px; margin-right: -10px;  /* 44px tap target */
  color: var(--color-text-inverse-primary);
}
.nav__toggle-bar {
  width: 22px; height: 2px; background: currentColor; border-radius: 2px;
  transition: transform var(--dur-slow) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
}
.nav__toggle[aria-expanded="true"] .nav__toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] .nav__toggle-bar:nth-child(2) { opacity: 0; }
.nav__toggle[aria-expanded="true"] .nav__toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav__menu {
  display: none;                       /* desktop: never shown */
  position: absolute; top: 64px; left: 0; right: 0;
  background: var(--color-bg-light-pure);
  border-bottom: var(--bd-1) solid var(--color-border-light);
  box-shadow: var(--shadow-md);
  opacity: 0; visibility: hidden; transform: translateY(-8px);
  transition: opacity var(--dur-slow) var(--ease-out),
              transform var(--dur-slow) var(--ease-out),
              visibility var(--dur-slow);
}
.nav__menu.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
.nav__menu-inner { display: flex; flex-direction: column; gap: var(--gap-12); padding-block: var(--gap-24); }
.nav__menu-link {
  font-family: var(--font-body); font-weight: 500; font-size: var(--fs-xl);
  color: var(--color-text-inverse-primary); padding-block: var(--pd-8);
  border-bottom: var(--bd-1) solid var(--color-border-light);
}
.nav__menu-link:last-of-type { border-bottom: none; }
.nav__menu-cta { width: 100%; justify-content: center; margin-top: var(--gap-12); }

@media (max-width: 1023px) {
  .nav__cta   { display: none; }
  .nav__inner .lang-menu { display: none; }  /* specificity (0,2,0) beats the base .lang-menu { display: inline-flex } below */
  .nav__toggle { display: inline-flex; }
  .nav__menu   { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  .nav__menu, .nav__toggle-bar { transition: none; }
}

/* ---- Language dropdown ---- */
.lang-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.lang-menu__trigger {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-body); font-weight: 500; font-size: 13px;
  letter-spacing: 0.072em; text-transform: uppercase;
  color: var(--color-text-inverse-primary);
  background: none; border: none; cursor: pointer; padding: 4px 6px; border-radius: var(--rd-6);
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.lang-menu__trigger:hover { color: var(--charcoal-500); background: var(--charcoal-50); }
.lang-menu__dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 130px; padding: 6px 0;
  background: var(--color-bg-light-pure);
  border: var(--bd-1) solid var(--color-border-light);
  border-radius: var(--rd-8);
  box-shadow: 0 8px 24px rgba(0,0,0,0.10);
  list-style: none; margin: 0;
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out),
              visibility var(--dur-fast);
  z-index: 200;
}
.lang-menu__dropdown.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
.lang-menu__dropdown [role="option"] {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px;
  font-family: var(--font-body); font-weight: 400; font-size: 14px;
  color: var(--color-text-inverse-primary); cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.lang-menu__dropdown [role="option"]:hover { background: var(--charcoal-50); }
.lang-menu__dropdown [role="option"].is-active { font-weight: 600; }
.lang-menu__dropdown [role="option"].is-active::after {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--charcoal-900); flex-shrink: 0;
}

/* Mobile version: inline row, no absolute dropdown — drops within the menu panel */
.lang-menu--mobile {
  position: static;
  padding-block: var(--pd-8);
  flex-direction: column; align-items: flex-start;
}
.lang-menu--mobile .lang-menu__trigger {
  font-size: var(--fs-xl); letter-spacing: 0.072em;
  padding: var(--pd-8) var(--pd-12);
}
.lang-menu--mobile .lang-menu__dropdown {
  position: static; opacity: 1; visibility: visible; transform: none;
  box-shadow: none; border: none; border-radius: 0;
  padding: 0; min-width: unset; width: 100%;
  display: none;
}
.lang-menu--mobile .lang-menu__dropdown.is-open { display: block; }
.lang-menu--mobile .lang-menu__dropdown [role="option"] {
  padding: var(--pd-8) 0; font-size: var(--fs-xl);
}
.nav.is-scrolled {
  background-color: rgba(255,255,255,0.85);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid rgba(48,48,47,0.08);
  box-shadow: 0 1px 24px rgba(48,48,47,0.06);
}

/* ====================== FOOTER ======================
   Brand block + 3 link columns (Produkt / Unternehmen / Rechtliches). */
/* Footer: white outer frame → floating dark gradient card (mirrors the lime CTA
   "card inside wrapper" pattern). The 28px frame on all sides lifts the card off
   the page edge; the gradient gives depth without introducing a flat dark band. */
.footer {
  background: var(--color-bg-light-pure);
  padding: var(--gap-28);
}
.footer__card {
  background: linear-gradient(120deg, #30302F 0%, #3F3F3F 48%, #171717 100%);
  border-radius: 32px;
  padding: var(--gap-64) var(--pd-80);
  display: flex;
  flex-direction: column;
  gap: var(--gap-64);
  color: var(--color-text-primary);
}
.footer__inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--gap-40);
}
.footer__brand { display: flex; flex-direction: column; gap: var(--gap-16); max-width: 320px; }
.footer__brand p { color: var(--charcoal-200); font-size: var(--fs-sm); line-height: 1.57; font-weight: 500; }
.footer__col { display: flex; flex-direction: column; gap: var(--gap-16); }
.footer__col-title {
  font-family: var(--font-body); font-weight: 600; font-size: var(--fs-tag);
  letter-spacing: var(--tracking-label); text-transform: uppercase;
  color: var(--charcoal-200);
}
.footer__col a { color: var(--color-text-primary); width: max-content; font-size: var(--fs-sm); font-weight: 500; }
.footer__bottom {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: var(--gap-24);
  border-top: var(--bd-1) solid var(--charcoal-600);
  color: var(--charcoal-200);
  font-size: var(--fs-sm);
}
.footer__legal {
  display: flex; align-items: center; gap: var(--gap-24);
}
.footer__legal a,
.footer__legal button {
  color: var(--charcoal-200); font-size: var(--fs-sm); font-weight: 500;
  background: none; border: none; padding: 0; cursor: pointer;
}
@media (max-width: 1023px) {
  .footer { padding: var(--gap-28) 0 0; }
  .footer__card { padding: var(--gap-48) var(--pd-40); border-radius: 32px 32px 0 0; }
  .footer__inner { grid-template-columns: 1fr 1fr; }
  .footer__brand { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  /* Small bottom frame so the card doesn't hard-cut at the screen edge */
  .footer { padding: var(--gap-16) 0; }
  .footer__card { padding: var(--gap-48) var(--pd-24); border-radius: var(--rd-16); }
  .footer__inner { grid-template-columns: 1fr; }
  .footer__bottom { flex-direction: column; align-items: flex-start; gap: var(--gap-16); }
  .footer__legal { flex-wrap: wrap; gap: var(--gap-12); }
}

/* ====================== LINK UNDERLINE (motion Pattern 5) ====================== */
[data-hover="link"] { position: relative; }
[data-hover="link"]::after {
  content: ""; position: absolute; left: 0; bottom: -2px;
  width: 100%; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: left center;
  transition: transform .22s ease;
}
[data-hover="link"].is-hovered::after { transform: scaleX(1); }

@media (prefers-reduced-motion: reduce) {
  .nav, [data-hover="link"]::after { transition: none; }
}

/* ====================== COOKIE CONSENT BANNER ====================== */
/* cookieconsent v3.1.0 — all variable names verified against the source.
   Previous version used wrong names (--cc-text, --cc-btn-primary-text)
   which defined dead variables, leaving defaults (dark on dark) in place. */
#cc-main {
  --cc-font-family:         'Inter', sans-serif;
  --cc-modal-border-radius: var(--rd-12);
  --cc-btn-border-radius:   var(--rd-8);

  /* Surface */
  --cc-bg:              var(--charcoal-900);   /* #181817 */
  --cc-primary-color:   var(--charcoal-100);   /* #F1F1F1 — titles + body text */
  --cc-secondary-color: var(--charcoal-300);   /* #ADADAC — descriptions */
  --cc-separator-border-color: var(--charcoal-700);
  --cc-link-color:      var(--lime-500);       /* links inside description text */

  /* Primary button — lime, BLACK text */
  --cc-btn-primary-bg:               var(--lime-500);
  --cc-btn-primary-color:            var(--charcoal-900); /* correct name: -color not -text */
  --cc-btn-primary-border-color:     var(--lime-500);
  --cc-btn-primary-hover-bg:         var(--lime-600);
  --cc-btn-primary-hover-color:      var(--charcoal-900);
  --cc-btn-primary-hover-border-color: var(--lime-600);

  /* Secondary button (Auswahl speichern + consent modal ghost) */
  --cc-btn-secondary-bg:               transparent;
  --cc-btn-secondary-color:            var(--charcoal-200); /* correct name: -color not -text */
  --cc-btn-secondary-border-color:     var(--charcoal-500); /* visible ghost border */
  --cc-btn-secondary-hover-bg:         var(--charcoal-800);
  --cc-btn-secondary-hover-color:      var(--charcoal-100);
  --cc-btn-secondary-hover-border-color: var(--charcoal-400);

  /* Category blocks */
  --cc-cookie-category-block-bg:            var(--charcoal-800);
  --cc-cookie-category-block-border:        var(--charcoal-700);
  --cc-cookie-category-block-hover-bg:      var(--charcoal-700);
  --cc-cookie-category-block-hover-border:  var(--charcoal-600);
  --cc-cookie-category-expanded-block-bg:   var(--charcoal-800);
  --cc-cookie-category-expanded-block-hover-bg: var(--charcoal-700);
  --cc-section-category-border:             var(--charcoal-700);

  /* Preferences modal footer */
  --cc-footer-bg:           var(--charcoal-900);
  --cc-footer-color:        var(--charcoal-100);
  --cc-footer-border-color: var(--charcoal-700);

  /* Toggle */
  --cc-toggle-on-bg:                 var(--lime-500);
  --cc-toggle-off-bg:                var(--charcoal-600);
  --cc-toggle-on-knob-bg:            var(--charcoal-900);
  --cc-toggle-off-knob-bg:           var(--charcoal-100);
  --cc-toggle-enabled-icon-color:    var(--charcoal-900);
  --cc-toggle-disabled-icon-color:   var(--charcoal-100);
  --cc-toggle-readonly-bg:           var(--charcoal-700);
  --cc-toggle-readonly-knob-bg:      var(--charcoal-400);
  --cc-toggle-readonly-knob-icon-color: var(--charcoal-200);

  /* Overlay */
  --cc-overlay-bg: rgba(24, 24, 23, 0.72);
}

/* Preferences modal: "Ablehnen" has no --secondary class so it inherits
   primary lime. Override explicitly with ghost style. */
#cc-main .pm__btn[data-role="necessary"] {
  background:   transparent;
  color:        var(--charcoal-200);
  border:       1px solid var(--charcoal-500);
}
#cc-main .pm__btn[data-role="necessary"]:hover {
  background:   var(--charcoal-800);
  color:        var(--charcoal-100);
  border-color: var(--charcoal-400);
}

/* Close button — needs explicit light color on dark background */
#cc-main .pm__close-btn {
  color:        var(--charcoal-300);
  border-color: var(--charcoal-600);
}
#cc-main .pm__close-btn:hover {
  color:        var(--charcoal-100);
  background:   var(--charcoal-800);
  border-color: var(--charcoal-400);
}

/* Consent modal: "Einstellungen" text link */
#cc-main .cm__btn--secondary {
  border:               none;
  text-decoration:      underline;
  text-underline-offset: 3px;
  color:                var(--charcoal-200);
}
