/* Header: fixed bar, steps aside on scroll down and comes back on scroll up (scripts/header.ts) */
.header {
  position: fixed; inset: 0 0 auto; z-index: var(--z-header);
  pointer-events: none;
}
.header__bar {
  position: relative;
  display: flex; align-items: center; gap: 2rem;
  height: var(--header-h);
  padding-inline: var(--margin);
  pointer-events: auto;
  transition: background-color 0.4s, box-shadow 0.4s;
}
/* Contact strip and bar step aside together */
.header__top { transition: translate 0.6s var(--ease-out); }
html.header-away .header__top { translate: 0 -105%; }
html.header-solid .header__bar { background: var(--c-bg); box-shadow: 0 1px 0 var(--c-line); }
html.menu-open .header__top { translate: none; }
html.menu-open .header__bar { background: var(--c-bg); box-shadow: none; }

/* Contact strip above the bar: main contacts on the right */
.topbar {
  display: flex; justify-content: flex-end; align-items: center;
  height: var(--topbar-h);
  padding-inline: var(--margin);
  background: var(--c-deep); color: var(--c-on-deep);
  font-size: 0.9375rem; font-weight: 500; font-style: normal; letter-spacing: 0.005em;
  pointer-events: auto;
}
.topbar__list { --sep-gap: clamp(0.85rem, 1.6vw, 1.5rem); display: flex; align-items: center; gap: var(--sep-gap); }
.topbar__list li { display: flex; align-items: center; }
/* Thin vertical separator between the two contacts */
.topbar__list li + li::before {
  content: ''; width: 1px; height: 1rem; margin-right: var(--sep-gap);
  background: currentColor; opacity: 0.3;
}
.topbar__link { display: inline-flex; align-items: center; gap: 0.5rem; padding-block: 0.35rem; }
.topbar__icon {
  width: 1.05rem; height: 1.05rem; flex: none;
  fill: none; stroke: var(--c-accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
  transition: translate 0.45s var(--ease-out);
}
/* The underline is traced under the text only, the icon nudges */
.topbar__text { background: linear-gradient(currentColor 0 0) left 100% / 0% 1px no-repeat; padding-bottom: 0.1em; transition: background-size 0.5s var(--ease-out); }
@media (hover: hover) {
  .topbar__link:hover .topbar__text { background-size: 100% 1px; }
  .topbar__link:hover .topbar__icon { translate: 0 -1px; }
}
.topbar__link:focus-visible .topbar__text { background-size: 100% 1px; }
@media (max-width: 767px) {
  .topbar { font-size: 0.8125rem; }
  .topbar__link { gap: 0.4rem; }
  .topbar__icon { width: 0.85rem; height: 0.85rem; }
}

.header__brand { display: inline-flex; align-items: center; gap: 0.7rem; margin-right: auto; min-height: 44px; }
.header__logo { width: 2.25rem; height: 2.25rem; }
.header__name { font-weight: 600; font-size: 1.0625rem; letter-spacing: -0.01em; }

.header__nav ul { display: flex; gap: clamp(1.25rem, 2vw, 2.25rem); }
.header__nav a { font-size: 1rem; font-weight: 500; display: inline-block; padding-block: 0.6rem 0.45rem; background-position: left calc(100% - 0.35rem); }
/* Same size as the menu items (the small button is --t-s); header.css loads after base.css */
.header__cta { font-size: 1rem; }
.header__toggle { display: none; }

@media (max-width: 900px) {
  .header__nav, .header__cta { display: none; }
  .header__toggle {
    display: inline-flex; align-items: center; gap: 0.6rem;
    min-height: 44px; padding-inline: 0.25rem;
    font-size: var(--t-s); font-weight: 500;
  }
  .header__toggle-icon { position: relative; width: 1.25rem; height: 0.6rem; }
  .header__toggle-icon span { position: absolute; left: 0; right: 0; height: 1.5px; background: currentColor; transition: translate 0.4s var(--ease-out), rotate 0.4s var(--ease-out); }
  .header__toggle-icon span:first-child { top: 0; }
  .header__toggle-icon span:last-child { bottom: 0; }
  .header__toggle[aria-expanded='true'] .header__toggle-icon span:first-child { translate: 0 0.24rem; rotate: 45deg; }
  .header__toggle[aria-expanded='true'] .header__toggle-icon span:last-child { translate: 0 -0.24rem; rotate: -45deg; }
}

/* Mobile menu overlay */
.menu {
  position: fixed; inset: 0; z-index: -1;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: calc(var(--header-total) + 2rem) var(--margin) 2rem;
  background: var(--c-bg);
  pointer-events: auto;
  overflow-y: auto;
}
.menu[hidden] { display: none; }
.menu__nav li { overflow: clip; border-bottom: 1px solid var(--c-line); }
.menu__link { display: block; padding-block: 0.9rem; font-size: clamp(2.25rem, 10vw, 3.5rem); font-weight: 500; letter-spacing: -0.035em; line-height: 1.05; }
.menu__link span { display: inline-block; }
.menu__foot { display: grid; gap: 0.5rem; padding-top: 2rem; font-weight: 500; }
.menu__contact { display: inline-block; padding-block: 0.35rem; }

/* Brand: the mark turns a little, the name gets traced */
.header__logo { transition: rotate 0.6s var(--ease-out); }
.header__name { background: linear-gradient(currentColor 0 0) left 100% / 0% 1px no-repeat; padding-bottom: 0.1em; transition: background-size 0.5s var(--ease-out); }
@media (hover: hover) {
  .header__brand:hover .header__logo { rotate: -18deg; }
  .header__brand:hover .header__name { background-size: 100% 1px; }
}
.header__brand:focus-visible .header__name { background-size: 100% 1px; }
.menu__cta { margin-bottom: 1rem; }
