/* ========================= */
/* 🔝 HEADER */
/* ========================= */

.header {
  position: sticky;
  top: 0;
  z-index: 1000;

  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 8px 18px;

  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--border);
}

.header-icons {
  display: flex;
  gap: 10px;
  align-items: center;
}

.header-icon-link {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.header-icon-link:hover {
  background: var(--card);
  border-color: var(--border);
}

.header-icon-link svg {
  width: 21px;
  height: 21px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.header-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border);
  display: block;
}

.header-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}


/* ========================= */
/* 🧠 LOGO */
/* ========================= */

.logo {
  position: relative;
  width: 420px;
  height: 112px;
  display: block;
  flex-shrink: 0;
}

.logo img {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
}

.logo-light { opacity: 1; }
.logo-dark { opacity: 0; }

body.light .logo-light { opacity: 0; }
body.light .logo-dark { opacity: 1; }


/* ========================= */
/* 🌙 THEME ICON */
/* ========================= */

#themeToggle {
  color: #ffaa00;
}

body.light #themeToggle {
  color: #333;
}

.theme-icon {
  position: relative;
  width: 21px;
  height: 21px;
}

.theme-icon svg {
  position: absolute;
  top: 0;
  left: 0;

  width: 21px;
  height: 21px;

  stroke: currentColor;
  fill: none;

  transition: 
    transform 0.4s ease,
    opacity 0.4s ease;
}

/* ☀️ */
.icon-sun {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* 🌙 */
.icon-moon {
  opacity: 0;
  transform: rotate(-90deg) scale(0.6);
}

/* переключение */
body.light .icon-sun {
  opacity: 0;
  transform: rotate(90deg) scale(0.6);
}

body.light .icon-moon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

@media (max-width: 560px) {
  .header {
    padding: 8px 12px;
  }

  .logo {
    width: 240px;
    height: 64px;
  }

  .header-icons {
    gap: 6px;
  }

  .header-icon-link,
  .header-avatar {
    width: 32px;
    height: 32px;
  }
}

/* Keep the header in the same phone-width shell as the app. */
.header {
  width: min(100%, 430px);
  margin-left: auto;
  margin-right: auto;
  padding: 8px 12px;
  box-sizing: border-box;
}

.logo {
  width: 240px;
  height: 64px;
}

@media (max-width: 768px) {
  .header {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 380px) {
  .logo {
    width: 205px;
    height: 55px;
  }
}

@media (min-width: 769px) {
  .header {
    width: min(100%, 760px);
    padding: 14px 18px;
  }

  .logo {
    width: 310px;
    height: 82px;
  }

  .header-icon-link,
  .header-avatar {
    width: 42px;
    height: 42px;
  }

  .theme-icon,
  .theme-icon svg,
  .header-icon-link svg {
    width: 26px;
    height: 26px;
  }
}

@media (max-width: 1200px), (hover: none), (pointer: coarse) {
  .header {
    width: 100% !important;
    max-width: none !important;
    min-height: 94px !important;
    padding: 15px 20px !important;
  }

  .logo {
    width: 230px !important;
    height: 70px !important;
    overflow: visible !important;
  }

  .logo img {
    transform: scale(2);
    transform-origin: left center;
  }

  .header-icon-link,
  .header-avatar {
    width: 52px !important;
    height: 52px !important;
  }

  .theme-icon,
  .theme-icon svg,
  .header-icon-link svg {
    width: 36px !important;
    height: 36px !important;
  }
}
