* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #ffffff;              /* 255 255 255 */
  --header-bg: #fafafa;       /* 250 250 250 */
  --text: #1f2328;
  --muted: #6e7781;
  --accent: #3f684c;
  --accent-soft: #4b7758;
  --divider: rgba(0, 0, 0, 0.08);
  --panel-bg: #fafafa;
  --panel-border: rgba(0, 0, 0, 0.08);
  --panel-icon: rgba(0, 0, 0, 0.6);
  --badge-bg: #111111;
  --badge-text: #ffffff;
  --logo-inner-bg: #ffffff;
}

html[data-theme="dark"] {
  --bg: #0f1113;              /* мягкий графит */
  --header-bg: #0a0c0e;       /* почти черный, но не глухой */
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #3f684c;
  --accent-soft: #4b7758;
  --divider: rgba(255, 255, 255, 0.16);
  --panel-bg: #0a0c0e;
  --panel-border: rgba(255, 255, 255, 0.10);
  --panel-icon: rgba(255, 255, 255, 0.7);
  --badge-bg: #ffffff;
  --badge-text: #111111;
  --logo-inner-bg: #ffffff;
}

html[data-theme="light"] {
  --bg: #ffffff;
  --header-bg: #fafafa;
  --text: #1f2328;
  --muted: #6e7781;
  --accent: #3f684c;
  --accent-soft: #4b7758;
  --divider: rgba(0, 0, 0, 0.14);
  --panel-bg: #fafafa;
  --panel-border: rgba(0, 0, 0, 0.08);
  --panel-icon: rgba(0, 0, 0, 0.6);
  --badge-bg: #111111;
  --badge-text: #ffffff;
  --logo-inner-bg: #ffffff;
}

body {
  background: var(--bg);
  font-family: 'Inter', sans-serif;
}

.header {
  width: 100%;
  background: var(--header-bg);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid var(--divider);
}

.header__container {
  width: 100%;
  height: 80px;
  padding: 0 60px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  column-gap: 32px;
  align-items: center;
}

.header__left {
  display: flex;
  align-items: center;
  min-width: 0;
}

.header__logo-circle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  position: relative;
  flex: 0 0 auto;
}

.header__logo-circle::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid var(--accent);
}

.header__logo-circle-inner {
  position: absolute;
  inset: 5px; /
  background: var(--logo-inner-bg);
  border-radius: 50%;
  overflow: hidden; 
}

.header__logo-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.header__brand {
  margin-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-decoration: none;
  color: var(--text);
  min-width: 0;
}

.header__brand:visited,
.header__brand:hover,
.header__brand:active,
.header__brand:focus {
  text-decoration: none;
  color: var(--text);
}

.header__title {
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.1;
  white-space: nowrap;
  letter-spacing: -0.2px;
}

.header__subtitle {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.1;
  white-space: nowrap;
}

.header__center {
  display: flex;
  justify-content: flex-end;
  min-width: 0;
  padding-left: 24px;
  padding-right: 28px;
}

.header__nav {
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.header__link {
  margin-right: 30px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s ease;
}

.header__link:hover {
  color: var(--muted);
}

.header__nav > a[href="/news"] {
  margin-right: 0;
}

.header__divider {
  width: 1px;
  height: 22px;
  background: var(--divider);
  flex: 0 0 auto;
}

.header__nav > .header__divider {
  margin-left: 15px;
  margin-right: 15px;
}

.header__library {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 0;
}

.header__badge {
  width: 37px;
  height: 19px;
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--badge-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.header__right {
  display: flex;
  justify-content: flex-end;
}

.header__right-group {
  display: flex;
  align-items: center;
}

.header__search,
.header__theme {
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  line-height: 0;
}

.header__search {
  width: 32px;
  height: 32px;
  margin-right: 0;
}

.header__search svg,
.header__adaptive-search svg {
  width: 24px;
  height: 24px;
  display: block;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
}

.header__theme {
  width: 20px;
  height: 20px;
  position: relative;
}

.header__theme-icon {
  position: absolute;
  inset: 0;
  width: 20px;
  height: 20px;
  stroke: var(--text);
  stroke-width: 1.45;
  fill: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.header__theme-icon--sun {
  opacity: 1;
  transform: scale(1);
}

.header__theme-icon--moon {
  opacity: 0;
  transform: scale(0.9);
}

html[data-theme="light"] .header__theme-icon--sun {
  opacity: 0;
  transform: scale(0.9);
}

html[data-theme="light"] .header__theme-icon--moon {
  opacity: 1;
  transform: scale(1);
}

.header__search:hover,
.header__adaptive-search:hover,
.header__theme:hover {
  opacity: 0.68;
}

.header__right-group > .header__divider {
  margin-left: 15px;
  margin-right: 15px;
}

.header__cta-wrap {
  margin: 0;
}

.header__cta {
  width: 152px;
  height: 33px;
  background: var(--accent);
  color: #ffffff;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 14px;
  transition: background-color 0.2s ease;
}

.header__cta:hover {
  background: var(--accent-soft);
}

.header__lang {
  color: var(--text);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
}

.header__lang:hover {
  color: var(--muted);
}

.header__adaptive-controls,
.header__panel {
  display: none;
}

.header__panel-theme-icons {
  width: 20px;
  height: 20px;
  position: relative;
  display: inline-block;
  flex: 0 0 20px;
}

.header__panel-theme-icon {
  position: absolute;
  inset: 0;
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.45;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.header__panel-theme-icon--sun {
  opacity: 1;
  transform: scale(1);
}

.header__panel-theme-icon--moon {
  opacity: 0;
  transform: scale(0.9);
}

html[data-theme="light"] .header__panel-theme-icon--sun {
  opacity: 0;
  transform: scale(0.9);
}

html[data-theme="light"] .header__panel-theme-icon--moon {
  opacity: 1;
  transform: scale(1);
}

@media (max-width: 1359px) {
  .header__container {
    height: 78px;
    padding: 0 20px;
    grid-template-columns: 1fr auto;
    column-gap: 20px;
  }

  .header__center,
  .header__right {
    display: none;
  }

  .header__adaptive-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
  }

  .header__adaptive-search,
  .header__burger {
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
    line-height: 0;
  }

  .header__burger {
    position: relative;
  }

  .header__burger span {
    position: absolute;
    width: 20px;
    height: 1.6px;
    background: var(--text);
    border-radius: 999px;
    transition: transform 0.22s ease, opacity 0.22s ease;
  }

  .header__burger span:nth-child(1) {
    transform: translateY(-6px);
  }

  .header__burger span:nth-child(2) {
    transform: translateY(0);
  }

  .header__burger span:nth-child(3) {
    transform: translateY(6px);
  }

  .header__burger.is-open span:nth-child(1) {
    transform: rotate(45deg) translateY(0);
  }

  .header__burger.is-open span:nth-child(2) {
    opacity: 0;
  }

  .header__burger.is-open span:nth-child(3) {
    transform: rotate(-45deg) translateY(0);
  }

  .header__panel {
    display: block;
    position: fixed;
    top: 78px;
    left: 0;
    width: 100%;
    height: calc(100dvh - 78px);
    z-index: 999;
    visibility: hidden;
    pointer-events: none;
  }

  .header__panel.active {
    visibility: visible;
    pointer-events: auto;
  }

  .header__panel-sheet {
    width: 100%;
    height: 100%;
    background: var(--panel-bg);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.24s ease, transform 0.24s ease;
    display: flex;
    flex-direction: column;
    padding: 0 20px 0;
    overflow-y: auto;
  }

  .header__panel.active .header__panel-sheet {
    opacity: 1;
    transform: translateY(0);
  }

  .header__panel-divider {
    width: 100%;
    height: 1px;
    background: var(--panel-border);
    flex: 0 0 auto;
  }

  .header__panel-divider--middle {
    margin-top: 10px;
  }

  .header__panel-nav {
    display: flex;
    flex-direction: column;
    padding-top: 12px;
  }

  .header__panel-link {
    min-height: 56px;
    display: grid;
    grid-template-columns: 22px 1fr;
    align-items: center;
    column-gap: 14px;
    padding: 0 12px;
    color: var(--text);
    text-decoration: none;
  }

  .header__panel-icon {
    width: 22px;
    height: 22px;
    color: var(--panel-icon);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
  }

  .header__panel-icon svg {
    width: 22px;
    height: 22px;
    display: block;
    stroke-width: 1.6;
    fill: none;
  }

  .header__panel-label {
    font-size: 18px;
    line-height: 1.2;
    color: var(--text);
  }

  .header__panel-lang {
    min-height: 56px;
    background: transparent;
    border: none;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 12px;
    cursor: pointer;
    text-align: left;
  }

  .header__panel-lang-code {
    font-size: 16px;
    color: var(--panel-icon);
    flex: 0 0 auto;
  }

  .header__panel-lang-text {
    font-size: 18px;
    color: var(--text);
  }

  .header__panel-bottom {
    margin-top: auto;
    padding-top: 20px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    position: sticky;
    bottom: 0;
    background: var(--panel-bg);
  }

  .header__panel-cta {
    width: 100%;
    min-height: 52px;
    background: var(--accent);
    border-radius: 10px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 16px;
  }

  .header__panel-cta:hover {
    background: var(--accent-soft);
  }
}

@media (max-width: 767px) {
  .header__container {
    height: 72px;
    padding: 0 14px;
  }

  .header__logo-circle {
    width: 44px;
    height: 44px;
  }

  .header__brand {
    margin-left: 12px;
  }

  .header__title {
    font-size: 16px;
  }

  .header__subtitle {
    font-size: 11px;
  }

  .header__adaptive-search,
  .header__burger {
    width: 40px;
    height: 40px;
  }

  .header__panel {
    top: 72px;
    height: calc(100dvh - 72px);
  }

  .header__panel-sheet {
    padding-left: 16px;
    padding-right: 16px;
    padding-bottom: 0;
  }

  .header__panel-label,
  .header__panel-lang-text {
    font-size: 17px;
  }

  .header__panel-lang-code {
    font-size: 15px;
  }
}

@media (max-width: 360px) {
  .header__title {
    font-size: 15px;
  }

  .header__subtitle {
    font-size: 10px;
  }

  .header__brand {
    margin-left: 10px;
  }

  .header__panel-sheet {
    padding-left: 14px;
    padding-right: 14px;
  }

  .header__panel-link,
  .header__panel-lang {
    padding-left: 10px;
    padding-right: 10px;
  }
}


