/* Header & Footer — D impulsion V3 (Direction A) */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 76px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-badge {
  width: 34px;
  height: 34px;
  display: block;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--ink);
}

.menu-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.menu-toggle svg {
  width: 18px;
  height: 18px;
}

.main-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
  flex: 1;
}

.nav-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  list-style: none;
  transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}

.nav-link::-webkit-details-marker {
  display: none;
}

.nav-link svg {
  width: 15px;
  height: 15px;
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--ink);
  background: var(--surface-subtle);
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown__panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: 320px;
  padding: 8px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 20px 44px -16px rgba(11, 16, 22, 0.16);
  display: grid;
  gap: 4px;
}

.nav-dropdown__item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease);
}

.nav-dropdown__item:hover {
  background: var(--surface-subtle);
}

.nav-dropdown__idx {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--blue-deep);
  padding-top: 3px;
}

.nav-dropdown__item strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.nav-dropdown__item small {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.nav-portal {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  transition: color var(--dur-fast) var(--ease);
}

.nav-portal:hover {
  color: var(--blue-deep);
}

.nav-portal svg {
  width: 14px;
  height: 14px;
}

.nav-cta {
  min-height: 42px;
  padding: 0 16px;
  font-size: 14px;
  white-space: nowrap;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  flex-shrink: 0;
  transition:
    border-color var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease);
}

.theme-toggle:hover {
  border-color: var(--blue);
  color: var(--blue-deep);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .icon-sun {
  display: none;
}

:root[data-theme='dark'] .theme-toggle .icon-moon {
  display: none;
}

:root[data-theme='dark'] .theme-toggle .icon-sun {
  display: block;
}

:root[data-theme='dark'] .brand-badge rect {
  fill: #151f2d;
  stroke: rgba(255, 255, 255, 0.16);
}

/* Footer */
.site-footer {
  background: var(--ink-deep);
  color: #fff;
  padding-top: clamp(56px, 6vw, 88px);
  padding-bottom: 32px;
  border-top: 1px solid var(--line-dark);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--line-dark);
}

.footer-logo {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: #fff;
  text-decoration: none;
}

.footer-brand p {
  margin: 14px 0 0;
  max-width: 34ch;
  font-size: 14.5px;
  color: var(--muted-dark);
}

.footer-region {
  font-family: var(--font-mono);
  font-size: 12px !important;
  color: #7ca8ff !important;
}

.footer-col h3 {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-dark);
  margin-bottom: 16px;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.footer-col a {
  font-size: 14.5px;
  color: rgba(255, 255, 255, 0.84);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}

.footer-col a:hover {
  color: #7ca8ff;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
  padding-top: 24px;
  font-size: 13px;
  color: var(--muted-dark);
}

/* Stub pages */
.stub {
  max-width: 72ch;
  padding-block: 24px 48px;
}

.stub h1 {
  font-size: clamp(34px, 4.2vw, 56px);
  margin-bottom: 20px;
}

.stub__lede {
  font-size: 18px;
  color: var(--muted);
  margin: 0 0 20px;
}

.stub__note {
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 28px;
}

.stub__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

@media (max-width: 1120px) {
  .menu-toggle {
    display: inline-flex;
  }

  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-width: none;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding: 20px var(--gutter) 28px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 24px 48px -20px rgba(11, 16, 22, 0.18);
  }

  .main-nav.is-open {
    display: flex;
  }

  .nav-group {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  .nav-dropdown__panel {
    position: static;
    width: 100%;
    margin-top: 6px;
    box-shadow: none;
    background: var(--surface-subtle);
  }

  .nav-actions {
    flex-direction: column;
    align-items: stretch;
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }

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

@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
}
