/* =====================================================
   CSS-only site navigation — medi-tigelhardt.de
   ===================================================== */

/* ─── Checkbox toggle (hidden visually) ──────────────── */

.nav-toggle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

/* ─── Hamburger icon (mobile only) ───────────────────── */

.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  padding: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.nav-hamburger .bar {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Animate hamburger → × when menu is open */
.nav-toggle:checked ~ .nav-hamburger .bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle:checked ~ .nav-hamburger .bar:nth-child(2) {
  opacity: 0;
}
.nav-toggle:checked ~ .nav-hamburger .bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ─── Logo image size ───────────────────────────────── */

/* The logo image has hardcoded width="300" height="673" (portrait).
   Cap it to a reasonable logo height; width auto preserves aspect ratio. */
.c5aiwd {
  max-height: 160px;
  width: auto;
}

/* Force all items in the logo container to be vertically centered.
   The H1 has align-self:flex-start (ci2thuj) which overrides the container's
   align-items:center — this resets all direct children to center. */
.cmards8 {
  align-items: center !important;
}
.cmards8 > * {
  align-self: center !important;
}

/* ─── Header padding override ───────────────────────── */

/* The Webstudio header classes (c1ill8wu, c1gg8cl3) add
   calc(--spacing-default / 2) ≈ 12-16px of padding top and bottom.
   Replace with compact values so the nav bar sits tight. */
header.w-box {
  padding-top: 0.35rem !important;
  padding-bottom: 0.35rem !important;
}

/* ─── Desktop nav container ──────────────────────────── */

.site-nav {
  flex: 1;
  display: flex;
  align-items: center;
}

.site-nav > ul {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav li {
  position: relative;
}

.site-nav a {
  display: block;
  padding: 0.85em 0.85em;
  color: var(--foreground-primary);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.site-nav a:hover {
  color: var(--foreground-muted, #888);
}

/* Dropdown arrow indicator */
.site-nav .has-dropdown > a::after {
  content: " ▾";
  font-size: 0.7em;
  vertical-align: middle;
}

/* ─── Dropdown submenu ───────────────────────────────── */

.site-nav .has-dropdown > ul {
  display: none;
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  min-width: 230px;
  list-style: none;
  margin: 0;
  padding: 4px 0;
  background: var(--background-primary, #fff);
  border: 1px solid var(--foreground-border, rgba(0, 0, 0, 0.12));
  border-radius: var(--radius-2, 4px);
  box-shadow: var(--shadow-3, 0 4px 16px rgba(0, 0, 0, 0.15));
  z-index: 300;
}

.site-nav .has-dropdown > ul li {
  display: block;
  position: static;
}

.site-nav .has-dropdown > ul a {
  padding: 0.45em 1.1em;
  border-bottom: none;
  font-size: 0.95em;
}

/* Show on hover or keyboard focus */
.site-nav .has-dropdown:hover > ul,
.site-nav .has-dropdown:focus-within > ul {
  display: block;
}

/* ─── Spacing fix ────────────────────────────────────── */

/* Logo/banner section: remove large top padding so it sits flush under the nav.
   Specificity (0,2,1) beats Webstudio's single-class rule (0,1,0).
   !important added as extra guarantee since nav.css now loads after Webstudio CSS. */
.c16xk5c3.c1abpekd {
  padding-top: 0 !important;
}

/* Subpage wrapper: the flex column container between header and logo section
   uses row-gap: var(--size-fluid-5) = 64-80px between its children.
   Cap it to a reasonable value so logo and content aren't separated by 80px. */
.c9ikdcv.c5b3tml.c1xfj3sz {
  row-gap: var(--size-fluid-2, 1.5rem) !important;
}

/* ─── Mobile ─────────────────────────────────────────── */

@media (max-width: 767px) {
  .nav-hamburger {
    display: flex;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--background-primary, #fff);
    border-top: 1px solid var(--foreground-border, rgba(0, 0, 0, 0.1));
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    z-index: 299;
  }

  .nav-toggle:checked ~ .site-nav {
    display: flex;
  }

  .site-nav > ul {
    flex-direction: column;
    width: 100%;
    align-items: stretch;
  }

  .site-nav > ul > li {
    border-bottom: 1px solid var(--foreground-border, rgba(0, 0, 0, 0.08));
  }

  .site-nav a {
    padding: 0.75em 1.25em;
  }

  /* On mobile always expand sub-links (no hover needed) */
  .site-nav .has-dropdown > ul {
    display: block;
    position: static;
    box-shadow: none;
    border: none;
    border-radius: 0;
    background: var(--background-accent, rgba(0, 0, 0, 0.04));
    padding: 0;
  }

  .site-nav .has-dropdown > ul a {
    padding-left: 2.25em;
    font-size: 0.9em;
  }

  .site-nav .has-dropdown > a::after {
    display: none;
  }
}
