/* ==================== LOCAL WEBFONTS (DSGVO-KONFORM) ==================== */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/plus-jakarta-sans-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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/plus-jakarta-sans-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;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../assets/fonts/plus-jakarta-sans-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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../assets/fonts/plus-jakarta-sans-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;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../assets/fonts/plus-jakarta-sans-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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../assets/fonts/plus-jakarta-sans-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;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../assets/fonts/plus-jakarta-sans-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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../assets/fonts/plus-jakarta-sans-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;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('../assets/fonts/plus-jakarta-sans-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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('../assets/fonts/plus-jakarta-sans-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;
}

/* ==================== GLOBAL LAYOUT & SCROLL POLISH ==================== */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* Prevent sticky header (h-20 = 5rem) from overlapping anchor targets */
section[id],
article[id],
h2[id] {
  scroll-margin-top: 7rem;
}

/* ==================== NATIVE MODAL DIALOGS ==================== */
/* Never set display unconditionally on dialog; scope modal rules to dialog:modal / dialog[open] */
dialog.ol-dialog {
  padding: 0;
  margin: auto;
  border: 0;
  background: transparent;
  max-width: calc(100vw - 2rem);
  max-height: calc(100dvh - 2rem);
  border-radius: 1rem;
  overflow: auto;
  color: #1e293b;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition:
    opacity 180ms ease-out,
    transform 180ms ease-out,
    overlay 180ms ease-out allow-discrete,
    display 180ms ease-out allow-discrete;
}

dialog.ol-dialog:modal {
  /* MANDATORY: Prevent scroll chaining from the modal to the underlying page */
  overscroll-behavior: contain;
}

dialog.ol-dialog[open]:where(:not([data-closing])) {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@starting-style {
  dialog.ol-dialog[open]:where(:not([data-closing])) {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}

dialog.ol-dialog::backdrop {
  /* MANDATORY: Make ::backdrop a non-scrollable scroll container so overscroll-behavior applies */
  overflow: hidden;
  overscroll-behavior: contain;
  background-color: rgba(15, 23, 42, 0);
  -webkit-backdrop-filter: blur(0px);
  backdrop-filter: blur(0px);
  transition:
    background-color 180ms ease-out,
    backdrop-filter 180ms ease-out,
    -webkit-backdrop-filter 180ms ease-out,
    overlay 180ms ease-out allow-discrete,
    display 180ms ease-out allow-discrete;
}

dialog.ol-dialog[open]:where(:not([data-closing]))::backdrop {
  background-color: rgba(15, 23, 42, 0.65);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

@starting-style {
  dialog.ol-dialog[open]:where(:not([data-closing]))::backdrop {
    background-color: rgba(15, 23, 42, 0);
    -webkit-backdrop-filter: blur(0px);
    backdrop-filter: blur(0px);
  }
}

@media (prefers-reduced-motion: reduce) {
  dialog.ol-dialog,
  dialog.ol-dialog::backdrop {
    transition: none;
    transform: none;
  }
}

/* ==================== FULLSCREEN MOBILE NAVIGATION OVERLAY ==================== */
/* Never set display unconditionally on dialog; strictly hide when closed and scope flex to [open] */
dialog.ol-mobile-menu:not([open]) {
  display: none;
}

dialog.ol-mobile-menu {
  position: fixed;
  inset: 0;
  padding: 0;
  margin: 0;
  border: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  background-color: #ffffff;
  color: #1e293b;
  overflow: hidden;
}

dialog.ol-mobile-menu:modal {
  /* MANDATORY: Prevent scroll chaining from the overlay to the underlying page */
  overscroll-behavior: contain;
}

dialog.ol-mobile-menu[open] {
  display: flex;
  flex-direction: column;
}

dialog.ol-mobile-menu::backdrop {
  /* MANDATORY: Make ::backdrop a non-scrollable scroll container so overscroll-behavior applies */
  overflow: hidden;
  overscroll-behavior: contain;
  background-color: #ffffff;
}

.ol-mobile-menu__bar {
  padding: 0;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  background-color: #ffffff;
  flex-shrink: 0;
}

.ol-mobile-menu__body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
  overscroll-behavior: contain;
  background-color: #ffffff;
  padding: 1.75rem 1.5rem calc(1.75rem + env(safe-area-inset-bottom, 0px));
  opacity: 1;
  transform: translateY(0);
  transition: opacity 180ms ease-out, transform 180ms ease-out;
}

@starting-style {
  dialog.ol-mobile-menu[open] .ol-mobile-menu__body {
    opacity: 0;
    transform: translateY(6px);
  }
}

.ol-mobile-menu__nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ol-mobile-menu__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem;
  border-radius: 1rem;
  font-size: 1.375rem;
  line-height: 1.3;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
  transition: background-color 150ms ease, color 150ms ease;
}

.ol-mobile-menu__link:hover,
.ol-mobile-menu__link:focus-visible {
  background-color: #f8fafc;
  color: #ea580c;
  outline: none;
}

.ol-mobile-menu__link:focus-visible {
  box-shadow: 0 0 0 2px #f97316;
}

.ol-mobile-menu__footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(226, 232, 240, 0.8);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (prefers-reduced-motion: reduce) {
  dialog.ol-mobile-menu .ol-mobile-menu__body {
    transition: none;
    transform: none;
  }
}

/* ==================== FORM VALIDATION (:user-invalid / :user-valid) ==================== */
.ol-hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.ol-field .ol-error {
  display: none;
}

.ol-field :is(input, select, textarea):user-invalid,
.ol-field :is(input, select, textarea).user-invalid-fallback {
  border-color: #dc2626;
  background-color: #fef2f2;
}

.ol-field :is(input, select, textarea):user-invalid:focus,
.ol-field :is(input, select, textarea).user-invalid-fallback:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.16);
}

.ol-field :is(input, select, textarea):user-invalid + .ol-error,
.ol-field :is(input, select, textarea).user-invalid-fallback + .ol-error,
.ol-field:has(input[type="checkbox"]:user-invalid) .ol-error,
.ol-field:has(input[type="checkbox"].user-invalid-fallback) .ol-error {
  display: flex;
}

.ol-field :is(input:not([type="checkbox"]), select, textarea):required:user-valid,
.ol-field :is(input:not([type="checkbox"]), select, textarea):required.user-valid-fallback {
  border-color: #10b981;
}

/* ==================== LEGAL PAGE TOC ACTIVE STATE ==================== */
.toc-link {
  position: relative;
  transition: color 150ms ease, background-color 150ms ease;
}

.toc-link[aria-current="true"] {
  background-color: #fff7ed;
  color: #ea580c;
  font-weight: 700;
}

.toc-link[aria-current="true"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.375rem;
  bottom: 0.375rem;
  width: 3px;
  border-radius: 9999px;
  background-color: #f97316;
}

/* ==================== PLACEHOLDER BADGE FOR LEGAL TEMPLATES ==================== */
.legal-placeholder {
  display: inline-flex;
  align-items: center;
  padding: 0.05rem 0.45rem;
  border-radius: 0.375rem;
  background-color: #fff7ed;
  border: 1px dashed #fdba74;
  color: #9a3412;
  font-weight: 600;
  font-size: 0.92em;
}

/* ==================== PRINT STYLES (LEGAL PAGES) ==================== */
@media print {
  header,
  footer,
  aside,
  .no-print {
    display: none !important;
  }

  body {
    background: #ffffff !important;
    color: #0f172a !important;
  }
}
