/**
 * Apple-Style Navigation System for genossenschaften.digital
 * Features:
 * - Single-line top navbar (1.25rem font)
 * - Full-width hover overlay drawer with backdrop blur (Desktop)
 * - Subtle, non-colorful tool card design
 * - Smooth drill-down slide menu (Mobile)
 * - Zero emojis (compliance with AGENTS.md)
 */

:root {
  --gd-nav-navy: #100D4C;
  --gd-nav-coral: #FC5D53;
  --gd-nav-yellow: #FFE145;
  --gd-nav-teal: #B8D8D8;
  --gd-nav-card-bg: #F8F9FA;
  --gd-nav-card-border: #E5E7EB;
  --gd-nav-card-border-hover: #100D4C;
  --gd-nav-font: 'Work Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Header & Nav Base */
.gd23-nav-container {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.gd23-nav-container .header-search {
  order: 1;
}

@media (min-width: 1080px) {
  /* Desktop: Apple-style left-aligned menu group next to the logo, search stays right */
  .gd23-nav-container {
    gap: 4px;
    flex: 1;
    justify-content: flex-start;
    margin-left: 0;
  }

  .gd23-nav-container .header-search {
    margin-left: auto;
  }
}

.gd23-nav-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

/* Desktop Links Bar */
.gd23-desktop-nav {
  display: none;
}

@media (min-width: 1080px) {
  .gd23-desktop-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
    white-space: nowrap;
  }
}

.gd23-nav-item {
  list-style: none;
  display: inline-block;
}

.gd23-nav-link {
  font-family: var(--gd-nav-font);
  color: var(--gd23-style-color, var(--gd-nav-navy));
  font-size: 1.25rem; /* 20px - fits comfortably in one line */
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  padding: 8px 12px;
  margin: 0 2px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
  white-space: nowrap;
  -webkit-appearance: none;
  position: static !important;
}

.gd23-nav-link[aria-expanded="true"] {
  position: static !important;
}

.gd23-nav-link:hover,
.gd23-nav-link.is-active {
  color: var(--gd-nav-coral);
  text-decoration-color: var(--gd-nav-coral);
}

/* Apple-Style Full-Width Drawer (Desktop) */
.gd23-apple-drawer {
  position: absolute;
  top: 100%;
  left: -24px;
  width: calc(100% + 32px);
  background: #FFFFFF;
  border-bottom: 2px solid transparent;
  box-shadow: 0 24px 38px rgba(16, 13, 76, 0.14);
  clip-path: inset(0 -50px -50px -50px); /* Strictly NO shadow above 0 */
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  visibility: hidden;
  transition: max-height 0.24s ease-in, opacity 0.2s ease-in, border-color 0.18s ease-in, visibility 0.24s;
  z-index: 1001;
}

.gd23-apple-drawer.is-open {
  max-height: 600px;
  opacity: 1;
  visibility: visible;
  border-bottom-color: var(--gd-nav-navy);
  transition: max-height 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease-out, border-color 0.2s ease-out;
}

.gd23-drawer-panel {
  max-width: 1380px;
  margin: 0 auto;
  padding: 24px 32px 30px 32px;
  display: none;
  grid-template-columns: 1.55fr 1.05fr 1fr;
  gap: 36px;
  box-sizing: border-box;
}

.gd23-drawer-panel.is-active {
  display: grid;
  animation: gd23DrawerFadeIn 0.22s ease forwards;
}

@keyframes gd23DrawerFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Columns */
.gd23-drawer-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gd23-drawer-col-title {
  font-family: var(--gd-nav-font);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #6C6893;
  padding-bottom: 6px;
  border-bottom: 1px solid #E5E7EB;
  margin: 0;
  line-height: 1.2;
}

/* Primary links: large type, hairline separated, no card surface */
.gd23-primary-list {
  display: flex;
  flex-direction: column;
}

.gd23-primary-link {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 0;
  border-bottom: 1px solid #E5E7EB;
  text-decoration: none;
  color: var(--gd-nav-navy);
  transition: color 0.14s ease;
  box-sizing: border-box;
}

.gd23-primary-title {
  font-family: var(--gd-nav-font);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--gd-nav-navy);
  transition: color 0.14s ease;
}

.gd23-primary-desc {
  font-family: var(--gd-nav-font);
  font-size: 0.85rem;
  line-height: 1.4;
  color: #4A476F;
}

.gd23-primary-link:hover .gd23-primary-title {
  color: var(--gd-nav-coral);
}

/* Drawer Sublink Lists */
.gd23-drawer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gd23-drawer-links li {
  line-height: 1.35 !important;
  margin: 0;
  padding: 0;
}

.gd23-drawer-sublink {
  font-family: var(--gd-nav-font);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35 !important;
  color: var(--gd-nav-navy);
  text-decoration: none;
  padding: 6px 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.14s ease;
}

.gd23-drawer-sublink:hover {
  color: var(--gd-nav-coral);
  transform: translateX(4px);
}

.gd23-drawer-sublink .gd23-arrow {
  font-size: 0.95rem;
  transition: transform 0.15s ease;
}

.gd23-drawer-sublink:hover .gd23-arrow {
  transform: translateX(3px);
}

.gd23-drawer-sublink-small {
  font-family: var(--gd-nav-font);
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.35 !important;
  color: #4A476F;
  text-decoration: none;
  padding: 5px 0;
  display: inline-block;
  transition: color 0.14s ease;
}

.gd23-drawer-sublink-small:hover {
  color: var(--gd-nav-coral);
}

.gd23-drawer-cta {
  font-weight: 700;
  color: var(--gd-nav-coral);
}

/* When drawer is open, header background becomes crisp solid white */
header:has(.gd23-apple-drawer.is-open) {
  background-color: #FFFFFF !important;
}

/* Apple Backdrop Blur Overlay (Desktop) - blurs page content beneath the header */
.gd23-apple-backdrop {
  display: none !important;
}

/* ==========================================================================
   MOBILE APPLE-STYLE DRILL-DOWN NAVIGATION
   ========================================================================== */
.gd23-mobile-toggle-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  gap: 5px;
  width: 36px;
  height: 36px;
  color: var(--gd23-style-color, var(--gd-nav-navy));
  z-index: 1003;
  order: 2;
}

@media (min-width: 1080px) {
  .gd23-mobile-toggle-btn {
    display: none;
  }
}

.gd23-mobile-toggle-btn span {
  display: block;
  height: 2px;
  width: 24px;
  background-color: currentColor;
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Mobile Fullscreen Drawer - True Fullscreen from top 0 */
.gd23-mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100dvh;
  background: #FFFFFF;
  z-index: 10005;
  overflow: hidden;
  display: none;
  flex-direction: column;
}

.gd23-mobile-menu.is-active {
  display: flex;
}

.gd23-mobile-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 64px;
  border-bottom: 1px solid #E5E7EB;
  background: #FFFFFF;
  flex-shrink: 0;
  box-sizing: border-box;
}

.gd23-mobile-logo img {
  height: 38px;
  width: auto;
  display: block;
}

.gd23-mobile-close-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--gd-nav-navy);
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  line-height: 1;
}

.gd23-mobile-close-btn:hover {
  color: var(--gd-nav-coral);
}

/* 2-Level Slider */
.gd23-mobile-slider {
  display: flex;
  width: 200%;
  height: calc(100dvh - 64px);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.gd23-mobile-slider.show-level2 {
  transform: translateX(-50%);
}

.gd23-mobile-panel {
  width: 50%;
  height: 100%;
  padding: 24px 20px 60px 20px;
  overflow-y: auto;
  box-sizing: border-box;
}

/* Level 1: Large Bold Typography like Apple */
.gd23-mobile-l1-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.gd23-mobile-l1-item {
  border-bottom: 1px solid #E5E7EB;
  padding: 16px 0;
}

.gd23-mobile-l1-btn {
  font-family: var(--gd-nav-font);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gd-nav-navy);
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 0;
}

.gd23-mobile-l1-link {
  font-family: var(--gd-nav-font);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gd-nav-navy);
  text-decoration: none;
  display: block;
  width: 100%;
}

.gd23-mobile-l1-btn:hover,
.gd23-mobile-l1-link:hover {
  color: var(--gd-nav-coral);
}

.gd23-mobile-l1-arrow {
  font-size: 1.3rem;
  color: #9CA3AF;
  font-weight: 400;
}

/* Level 2: Sub-Level View */
.gd23-mobile-back-btn {
  font-family: var(--gd-nav-font);
  font-size: 0.95rem;
  font-weight: 700;
  color: #6C6893;
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
  padding: 6px 0;
}

.gd23-mobile-back-btn:hover {
  color: var(--gd-nav-navy);
}

.gd23-mobile-sub-title {
  font-family: var(--gd-nav-font);
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--gd-nav-navy);
  margin-bottom: 20px;
}

.gd23-mobile-overview-link {
  font-family: var(--gd-nav-font);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gd-nav-navy);
  text-decoration: underline;
  text-underline-offset: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  margin-bottom: 20px;
}

.gd23-mobile-overview-link:hover {
  color: var(--gd-nav-coral);
  text-decoration-color: var(--gd-nav-coral);
}

.gd23-mobile-subgroup {
  margin-bottom: 24px;
}

.gd23-mobile-subgroup-label {
  font-family: var(--gd-nav-font);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #6C6893;
  margin-bottom: 12px;
  display: block;
}

.gd23-mobile-links-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gd23-mobile-links-list a {
  font-family: var(--gd-nav-font);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--gd-nav-navy);
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}

.gd23-mobile-links-list a:hover {
  color: var(--gd-nav-coral);
}

/* ==========================================================================
   ACCESSIBILITY: FOCUS RINGS, HIDDEN SLIDE PANELS & REDUCED MOTION
   ========================================================================== */
.gd23-nav-link:focus-visible,
.gd23-primary-link:focus-visible,
.gd23-drawer-sublink:focus-visible,
.gd23-drawer-sublink-small:focus-visible,
.gd23-mobile-toggle-btn:focus-visible,
.gd23-mobile-close-btn:focus-visible,
.gd23-mobile-l1-btn:focus-visible,
.gd23-mobile-l1-link:focus-visible,
.gd23-mobile-back-btn:focus-visible,
.gd23-mobile-overview-link:focus-visible,
.gd23-mobile-links-list a:focus-visible {
  outline: 3px solid var(--gd-nav-coral);
  outline-offset: 3px;
  border-radius: 4px;
}

.gd23-mobile-panel.is-panel-hidden {
  visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .gd23-apple-drawer,
  .gd23-drawer-panel.is-active,
  .gd23-mobile-slider,
  .gd23-drawer-sublink,
  .gd23-drawer-sublink .gd23-arrow {
    transition: none;
    animation: none;
  }
}
