/* 01 — Site header (classes prefixed h01-)
   Sticky editorial bar, light-default dual theme.
   Colors only via base.css tokens; motion = transform/opacity, --ease-out-* only.
   Signature interaction: the Services dropdown (one per section, per contract). */

.h01 {
  --h01-h: 72px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.h01-bar {
  display: flex;
  align-items: center;
  gap: 24px;
  height: var(--h01-h);
}

/* ---------- Wordmark ---------- */

.h01-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  color: var(--ink);
}

.h01-brand__mark {
  display: block;
  width: 20px;
  height: 16px;
  transition: color 0.2s ease;
}

.h01-brand:hover .h01-brand__mark {
  color: var(--link-ink);
}

.h01-brand__word {
  display: inline-flex;
  align-items: baseline;
}

.h01-brand__i {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 17px;
}

.h01-brand__main {
  margin-left: 2px;
  font-family: var(--font-head);
  font-weight: 500;
  font-size: 19px;
  letter-spacing: 0.14em;
}

/* ---------- Desktop nav ---------- */

.h01-nav {
  align-self: stretch;
  display: flex;
  margin-inline: auto; /* centers links between brand and actions */
}

.h01-nav__list {
  display: flex;
}

.h01-nav__item {
  position: relative;
  display: flex;
  align-items: center;
}

/* thin vertical divider between links, like the original */
.h01-nav__item + .h01-nav__item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 1px;
  height: 16px;
  background: var(--line);
  transform: translateY(-50%);
}

.h01-nav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  color: var(--ink-dim);
  transition: color 0.2s ease;
}

/* accent underline draws in on hover (fill, not text color) */
.h01-nav__link::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 4px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s var(--ease-out-quart);
}

.h01-nav__link:hover,
.h01-nav__item--drop:hover .h01-nav__link,
.h01-nav__item--drop:focus-within .h01-nav__link {
  color: var(--ink);
}

.h01-nav__link:hover::after,
.h01-nav__item--drop:hover .h01-nav__link::after,
.h01-nav__item--drop:focus-within .h01-nav__link::after {
  transform: scaleX(1);
}

.h01-nav__caret {
  transition: transform 0.2s ease;
}

.h01-nav__item--drop:hover .h01-nav__caret,
.h01-nav__item--drop:focus-within .h01-nav__caret {
  transform: rotate(180deg);
}

/* ---------- Services dropdown ---------- */

.h01-drop {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 300px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-top: 2px solid var(--accent);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.18s ease, transform 0.22s var(--ease-out-quart),
              visibility 0s linear 0.22s; /* hide only after the fade finishes */
}

.h01-nav__item--drop:hover .h01-drop,
.h01-nav__item--drop:focus-within .h01-drop {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  transition: opacity 0.18s ease, transform 0.22s var(--ease-out-quart), visibility 0s;
}

.h01-drop li + li {
  border-top: 1px solid var(--line);
}

.h01-drop__link {
  display: block;
  padding: 14px 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  color: var(--ink-dim);
  transition: color 0.15s ease, transform 0.2s var(--ease-out-quart);
}

.h01-drop__link::before {
  content: "//";
  margin-right: 10px;
  color: var(--tag-ink); /* yellow-ish text token — AA on --bg-alt in both themes */
  opacity: 0;
  transition: opacity 0.15s ease;
}

.h01-drop__link:hover {
  color: var(--ink);
  transform: translateX(4px);
}

.h01-drop__link:hover::before {
  opacity: 1;
}

/* ---------- Actions: theme toggle + CTA ---------- */

.h01-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.h01-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.15s var(--ease-out-quart), border-color 0.2s ease, color 0.2s ease;
}

.h01-toggle:hover {
  transform: translateY(-2px);
  border-color: var(--ink);
}

.h01-toggle:active {
  transform: translateY(0) scale(0.98);
}

/* icon swap: moon offered in light theme, sun offered in dark theme */
.h01-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .h01-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .h01-toggle .icon-moon { display: none; }

/* ---------- Language switcher (i18n contract) ---------- */

.h01-lang {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

/* matches the theme toggle: 1px --line box, mono 12px uppercase */
.h01-langbtn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 13px;
  background: transparent;
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.15s var(--ease-out-quart), border-color 0.2s ease, color 0.2s ease;
}

.h01-langbtn:hover {
  transform: translateY(-2px);
  color: var(--link-ink);
  border-color: var(--link-ink);
}

.h01-langbtn:active {
  transform: translateY(0) scale(0.98);
}

.h01-langbtn[aria-expanded="true"] {
  color: var(--link-ink);
  border-color: var(--link-ink);
}

/* no display declaration here — the [hidden] attribute must keep working */
.h01-langmenu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0; /* aligns to the button's right edge, never bleeds off-viewport */
  z-index: 110;
  min-width: 160px;
  padding: 6px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
}

.h01-langmenu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  color: var(--ink-dim);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.h01-langmenu a:hover {
  background: color-mix(in srgb, var(--line) 40%, transparent);
  color: var(--ink);
}

/* current locale: yellow dot marker (--tag-ink is AA-safe in both themes) */
.h01-langmenu a[aria-current="true"] {
  color: var(--ink);
}

.h01-langmenu a[aria-current="true"]::after {
  content: "●";
  font-size: 8px;
  color: var(--tag-ink);
}

/* tighter bar padding on mid-size windows, same as the nav links */
@media (max-width: 1100px) {
  .h01-langbtn { padding: 0 10px; gap: 6px; }
}

/* mobile: desktop instance hides with the bar actions; the panel instance
   goes full-width stacked, its menu opens in flow and pushes the CTA down */
@media (max-width: 900px) {
  .h01-actions > .h01-lang {
    display: none;
  }

  .h01-mobile .h01-lang {
    display: block;
    width: 100%;
    padding: 18px 0;
    border-bottom: 1px solid var(--line);
  }

  .h01-mobile .h01-langbtn {
    width: 100%;
    height: 48px;
    justify-content: flex-start;
    font-size: 13px;
  }

  .h01-mobile .h01-langbtn:hover {
    transform: none; /* no lift on touch layouts */
  }

  .h01-mobile .h01-langmenu {
    position: static;
    min-width: 0;
    margin-top: 12px;
  }
}

.h01-cta {
  padding: 12px 22px;
  font-size: 12px;
}

/* ---------- Hamburger ---------- */

.h01-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.h01-burger:hover {
  border-color: var(--ink);
}

.h01-burger__line {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--ink);
  transition: transform 0.2s var(--ease-out-quart), opacity 0.2s ease;
}

.h01-burger.is-open .h01-burger__line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.h01-burger.is-open .h01-burger__line:nth-child(2) {
  opacity: 0;
}

.h01-burger.is-open .h01-burger__line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---------- Mobile stacked menu (activated ≤900px below) ---------- */

.h01-mobile {
  display: none;
}

/* ---------- Focus visibility (explicit, both themes) ---------- */

.h01 a:focus-visible,
.h01 button:focus-visible {
  outline: 2px solid var(--link-ink);
  outline-offset: 3px;
}

.h01-nav__link:focus-visible,
.h01-drop__link:focus-visible,
.h01-mobile__link:focus-visible,
.h01-mobile__sublink:focus-visible {
  outline-offset: -2px;
}

/* ---------- Responsive ---------- */

/* tighten paddings so the full nav still fits mid-size windows */
@media (max-width: 1100px) {
  .h01-bar { gap: 16px; }
  .h01-nav__link { padding: 10px 12px; letter-spacing: 0.06em; }
  .h01-nav__link::after { left: 12px; right: 12px; }
  .h01-actions { gap: 10px; }
  .h01-cta { padding: 12px 16px; }
}

/* full nav no longer fits below ~900px → hamburger + stacked panel */
@media (max-width: 900px) {
  .h01-nav,
  .h01-cta,
  .h01-actions > .h01-toggle {
    display: none;
  }

  .h01-actions {
    margin-left: auto;
  }

  .h01-burger {
    display: inline-flex;
  }

  .h01-mobile {
    display: block;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: calc(100vh - var(--h01-h));
    max-height: calc(100dvh - var(--h01-h));
    overflow-y: auto;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--line);
    transition: background-color 0.25s ease, border-color 0.25s ease;
  }

  .h01-mobile[hidden] {
    display: none;
  }

  .h01-mobile__inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 8px var(--pad) 28px;
  }

  .h01-mobile__item {
    border-bottom: 1px solid var(--line);
  }

  .h01-mobile__link {
    display: block;
    padding: 16px 0;
    font-family: var(--font-mono);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink);
    transition: color 0.2s ease;
  }

  .h01-mobile__link:hover {
    color: var(--link-ink);
  }

  .h01-mobile__sub {
    padding: 0 0 14px 18px;
  }

  .h01-mobile__sublink {
    display: block;
    padding: 10px 0;
    font-family: var(--font-mono);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-dim);
    transition: color 0.2s ease;
  }

  .h01-mobile__sublink::before {
    content: "//";
    margin-right: 10px;
    color: var(--tag-ink);
  }

  .h01-mobile__sublink:hover {
    color: var(--ink);
  }

  .h01-mobile__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 0;
    border-bottom: 1px solid var(--line);
  }

  .h01-mobile__row-label {
    font-family: var(--font-mono);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
  }

  .h01-mobile__cta {
    display: block;
    margin-top: 22px;
    text-align: center;
  }
}

@media (max-width: 768px) {
  .h01 {
    --h01-h: 60px;
  }

  .h01-brand__i {
    font-size: 15px;
  }

  .h01-brand__main {
    font-size: 17px;
  }
}
