/* ═══════════════════════════════════════════════
   HEADER — Sticky bar · Brand · Nav · Controls
   ═══════════════════════════════════════════════ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr 1fr;
  justify-content: space-between;
  align-items: center;
  gap: 32px;
  width: min(1700px, calc(100% - (var(--page-pad) * 2) + 64px));
  height: 106px;
  min-height: 106px;
  margin: 0 auto;
  padding: 18px 32px;
  box-sizing: border-box;
  background: transparent;
}

.site-header::before {
  position: absolute;
  top: 0; right: 50%; bottom: 0; left: 50%;
  width: 100vw;
  box-sizing: border-box;
  z-index: -1;
  content: "";
  background: rgba(214, 214, 224, 0.62);
  box-shadow: 0 0 80px rgba(39, 39, 57, 0.1);
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(18px);
  transform: translateX(-50%) translateY(-10px);
  transition:
    opacity var(--motion-medium) var(--motion-ease),
    transform var(--motion-medium) var(--motion-ease);
}

.site-header.is-scrolled::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── Brand ──────────────────────────────────────────── */
.brand {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 22px;
  width: 260px;
  height: 70px;
  padding: 0 28px;
  color: var(--color-ink);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-soft);
  transition:
    transform var(--motion-fast) var(--motion-ease),
    box-shadow var(--motion-fast) var(--motion-ease);
}

.brand:hover {
  box-shadow: 0 24px 60px rgba(24, 24, 42, 0.14);
}

.brand__logo {
  display: block;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  filter: brightness(0);
}

.brand__name {
  font-family: var(--font-pixel);
  font-size: 16px;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

/* ─── Main Nav ───────────────────────────────────────── */
.main-nav {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  width: 470px;
  height: 70px;
  padding: 0 24px;
  color: var(--color-muted);
  background: var(--color-bg);
  border: 0;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.main-nav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 70px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition:
    color 180ms ease,
    transform 180ms ease;
}

.main-nav__link::after {
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: 20px;
  height: 20px;
  content: "";
  background: var(--color-ink);
  border-radius: 999px;
  transform: translateX(-50%) scale(0);
  transition: transform 180ms ease;
}

.main-nav__link:hover,
.main-nav__link.is-active {
  color: var(--color-ink);
}

.main-nav__link:hover {
  transform: translateY(-1px);
}

.main-nav__link.is-active::after {
  transform: translateX(-50%) scale(1);
}

/* ─── Header Actions ─────────────────────────────────── */
.header-actions {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  justify-content: space-between;
  gap: 30px;
  width: 431px;
  height: 70px;
  padding: 0;
}

/* ─── Language Selector ──────────────────────────────── */
.language-selector {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 101px;
  height: 70px;
}

.language-button,
.theme-toggle,
.menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-ink);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.language-button {
  gap: 18px;
  width: 101px;
  height: 70px;
  padding: 0;
  font-size: 15px;
  font-weight: 700;
}

/* ─── Language Dropdown ──────────────────────────────── */
/* Centered under button: left=50% of 101px=50.5px, half of 290px=145px → margin-left=-94.5px */
.language-menu {
  position: absolute;
  top: calc(100% + 14px);
  left: 50%;
  margin-left: -145px;
  z-index: 200;
  display: grid;
  gap: 0;
  width: 290px;
  padding: 10px;
  align-content: start;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 22px 70px rgba(24, 24, 42, 0.14);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px) scale(0.97);
  transform-origin: top center;
  transition:
    opacity 200ms var(--motion-ease),
    transform 200ms var(--motion-ease);
}

.language-selector.is-open .language-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Figma: SF Pro Display Medium 15, W 270 × H 41, radius 10 */
.language-menu button {
  display: flex;
  align-items: center;
  width: 100%;
  height: 41px;
  min-height: 41px;
  padding: 0 10px;
  color: var(--color-muted);
  background: transparent;
  border: 0;
  border-radius: 10px;
  font-family: var(--font-system);
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  text-align: left;
  cursor: pointer;
  transition:
    color 180ms ease,
    background-color 180ms ease;
}

.language-menu button:hover {
  color: var(--color-ink);
  background: #f2f1f3;
}

.language-menu button.is-active {
  color: var(--color-ink);
  font-weight: 700;
  background: #f2f1f3;
  cursor: default;
}

.language-button__chevron {
  display: block;
  width: 21px;
  height: 21px;
  flex: 0 0 21px;
  object-fit: contain;
  transition: transform var(--motion-fast) var(--motion-ease);
}

.language-selector.is-open .language-button__chevron {
  transform: rotate(180deg);
}

/* ─── Theme Toggle ───────────────────────────────────── */
.theme-toggle {
  position: relative;
  width: 70px;
  height: 40px;
  padding: 0;
  background: var(--color-ink);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 220ms ease;
}

.theme-toggle__knob {
  position: absolute;
  top: 3px;
  left: 3px;
  display: block;
  width: 34px;
  height: 34px;
  background: var(--color-white) url("../toggle.svg") center / 34px 34px no-repeat;
  border-radius: 50%;
  transform: translateX(30px);
  transition:
    background-color 220ms ease,
    transform 260ms var(--motion-ease);
}

.theme-toggle__knob::before {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  content: "";
  background: url("../luna.svg") center / contain no-repeat;
  border-radius: 0;
  filter: brightness(0);
  transform: translate(-50%, -50%);
}

.theme-toggle__knob::after {
  display: none;
  position: absolute;
  top: 5px;
  left: 50%;
  width: 3px;
  height: 3px;
  content: "";
  background: var(--color-ink);
  border-radius: 50%;
  transform: translateX(-50%);
  box-shadow:
    0 21px 0 var(--color-ink),
    11px 10.5px 0 var(--color-ink),
    -11px 10.5px 0 var(--color-ink),
    8px 3px 0 var(--color-ink),
    -8px 18px 0 var(--color-ink),
    -8px 3px 0 var(--color-ink),
    8px 18px 0 var(--color-ink);
}

/* ─── Contact Button ─────────────────────────────────── */
.contact-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 200px;
  height: 70px;
  padding: 0 24px;
  color: var(--color-white);
  font-size: 15px;
  font-weight: 700;
  background: var(--color-ink);
  border-radius: var(--radius-pill);
  transition:
    background-color 180ms ease,
    transform 180ms ease;
}

.contact-button:hover {
  background: #17171d;
  transform: translateY(-1px);
}

/* ─── Mobile Menu Button ─────────────────────────────── */
.menu-button {
  display: none;
  width: 52px;
  height: 52px;
  gap: 6px;
  flex-direction: column;
  background: var(--color-ink);
  border-radius: 16px;
}

.menu-button span {
  width: 21px;
  height: 2px;
  background: var(--color-white);
  border-radius: 999px;
  transition:
    transform 180ms ease,
    opacity 180ms ease;
}

.site-header.is-open .menu-button span:first-child {
  transform: translateY(4px) rotate(45deg);
}

.site-header.is-open .menu-button span:last-child {
  transform: translateY(-4px) rotate(-45deg);
}

/* ─── Page Layout ────────────────────────────────────── */
.page-content {
  width: min(1636px, calc(100% - (var(--page-pad) * 2)));
  margin: 0 auto;
  min-height: calc(100vh - 122px);
}

body.projects-view .page-content > :not(.projects-page):not(.telegram-banner):not(.site-footer),
body.questions-view .page-content > :not(.questions-page):not(.telegram-banner):not(.site-footer) {
  display: none;
}
