/* Шапка: бренд, группа кнопок, аватар и палитра. */

header {
  height: 76px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: relative;
  z-index: 20;

  @media (max-width: 760px) {
    height: 120px;
    padding: 0 14px;
    align-items: flex-start;
  }

  @media (min-width: 761px) {
    gap: 22px;
    padding: 0 24px;
    flex-shrink: 0;
    height: auto;
    min-height: 88px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  @media (min-width: 761px) and (max-width: 1320px) {
    flex-wrap: wrap;
    align-content: center;
    gap: 10px 17px;
    min-height: 130px;
    height: auto;
  }

  :where([data-layout="mobile"]) & {
    position: fixed !important;
    top: calc(8px + env(safe-area-inset-top)) !important;
    left: 12px !important;
    right: 12px !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 0 !important;
    background: transparent !important;
    border: 0 !important;
    z-index: 70;
    pointer-events: none;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--ink);
  text-decoration: none;

  @media (max-width: 760px) {
    gap: 7px;
    margin-top: 18px;
    font-size: 22px;
  }

  @media (max-width: 365px) {
    font-size: 20px;
  }

  @media (min-width: 761px) {
    flex-shrink: 0;
  }

  @media (min-width: 761px) and (max-width: 1320px) {
    order: 0;
    font-size: 22px;
  }

  :where([data-layout="mobile"]) & {
    order: 0 !important;
    pointer-events: auto;
    margin: 0 !important;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 13px;
    font-size: 16px !important;
    gap: 7px;
    padding: 5px !important;
    border-color: color-mix(in srgb, var(--line) 55%, transparent) !important;
    box-shadow: 0 2px 8px #0001 !important;
  }

  > span:last-child {
    :where([data-layout="mobile"]) & {
      display: none;
    }
  }
}

.brandaccent {
  font-weight: 400;
}

.logo {
  display: grid;
  place-items: center;
  height: 36px;
  width: 36px;
  border-radius: 12px;
  background: var(--accent);
  color: #172c20;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -3px;
  padding-right: 3px;

  @media (max-width: 760px) {
    width: 29px;
    height: 29px;
    font-size: 21px;
    border-radius: 9px;
  }

  :where([data-layout="mobile"]) & {
    border-radius: 9px !important;
    width: 32px !important;
    height: 32px !important;
    font-size: 21px !important;
  }

  :where(body.dark) & {
    color: #151515;
  }
}

.headeractions {
  display: flex;
  align-items: center;
  gap: 16px;

  @media (max-width: 760px) {
    display: block;
    position: absolute;
    inset: 0;
    pointer-events: none;
  }

  @media (min-width: 761px) {
    gap: 7px;
    flex-shrink: 0;
  }

  @media (min-width: 761px) and (max-width: 1320px) {
    order: 2;
  }

  :where([data-layout="mobile"]) & {
    margin-left: auto;
    gap: 8px !important;
    position: static !important;
    flex-direction: row !important;
    order: 1 !important;
    transform: none !important;
    width: auto !important;
    align-items: center !important;
    display: none !important;
  }

  > button {
    :where([data-layout="mobile"]) & {
      position: static !important;
      inset: auto !important;
    }
  }
}

/* Кнопки создания подборки и метки в шапке. */
.headerCreateButton {
  min-height: 44px;
  border-radius: 11px;
  font-size: 13px;
}

#addCollection {
  padding: 10px 16px;

  @media (max-width: 1320px) {
    padding: 10px 12px;
  }

  :where([data-layout="mobile"]) & {
    display: none;
  }
}

#addPlace {
  padding: 11px 17px;
  margin-left: 4px;

  @media (max-width: 1320px) {
    padding: 10px 12px;
  }

  :where([data-layout="mobile"]) & {
    display: none;
  }
}

.ha-group {
  display: flex;
  align-items: center;
  gap: 10px;

  @media (max-width: 760px) {
    display: contents;
  }
}

.ha-divider {
  width: 1px;
  height: 24px;
  background: var(--line);

  @media (max-width: 760px) {
    display: none;
  }
}

.dropdown {
  position: absolute;
  right: 25px;
  top: 66px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 17px;
  width: 255px;
  padding: 8px;
  box-shadow: 0 16px 50px #0003;

  @media (max-width: 760px) {
    top: 56px;
    right: 12px;
    width: 235px;
  }
}

.dropdown button {
  width: 100%;
  text-align: left;
  padding: 13px 12px;
  border-radius: 10px;
  font-size: 19px;
}

.dropdown button:hover {
  background: var(--soft);
}

.dropdown span {
  font-size: 15px;
  font-weight: 650;
  margin-left: 12px;
}

.dropdown small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-left: 31px;
}

.headeractions .quiet {

  @media (max-width: 760px) {
    padding: 8px;
    max-width: 75px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 10px;
  }
}

.palette {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  margin-right: 28px;

  @media (max-width: 760px) {
    position: absolute;
    left: 9px;
    bottom: 8px;
    gap: 0;
    margin: 0;
  }

  @media (min-width: 761px) {
    margin: 0;
    gap: 1px;
  }

  @media (min-width: 761px) and (max-width: 1320px) {
    order: 3;
    width: 100%;
    justify-content: center;
    gap: 10px;
    margin-top: 3px;
  }
}

.palettelabel {
  font-size: 10px;
  color: var(--muted);
  margin-right: 7px;

  @media (max-width: 760px) {
    display: none;
  }

  @media (min-width: 761px) {
    display: none;
  }

  @media (min-width: 761px) and (max-width: 1320px) {
    display: inline;
    font-size: 11px;
  }
}

.palette button {
  width: 32px;
  height: 38px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  position: relative;

  @media (max-width: 760px) {
    width: 31px;
    height: 44px;
  }

  @media (max-width: 365px) {
    width: 27px;
  }

  @media (min-width: 761px) {
    width: 30px;
    height: 42px;
  }

  @media (min-width: 761px) and (max-width: 1320px) {
    height: 29px;
    width: 34px;
  }
}

.palette button:before {
  content: "";
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--swatch);
  border: 1px solid #172c2030;

  @media (min-width: 761px) and (max-width: 1320px) {
    width: 20px;
    height: 20px;
  }
}

.palette button[aria-pressed="true"] {
  background: var(--soft);
  outline: 1px solid var(--line);
}

.palette button[aria-pressed="true"]:after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #172c20;
  font-size: 12px;
  font-weight: 800;
}

.headeractions > * {

  @media (max-width: 760px) {
    pointer-events: auto;
  }
}

.headeractions .iconbutton {

  @media (max-width: 760px) {
    position: absolute;
    right: 86px;
    top: 9px;
    width: 44px;
    height: 44px;
    font-size: 22px;
  }
}

#login {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 18px;
  border: 2px solid var(--line);
  cursor: pointer;
  padding: 0;
  transition: all 0.2s;

  svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;

    :where([data-layout="mobile"]) & {
      width: 22px;
      height: 22px;
      fill: currentColor;
      stroke: currentColor;
      stroke-width: 1.5;
    }
  }

  &:hover {
    border-color: var(--accent);
  }

  &.logged-in {
    border-color: var(--accent);
    background: var(--accent) !important;
    color: var(--onaccent) !important;

    :where([data-layout="mobile"]) & {
      background: var(--accent) !important;
      border-color: var(--panel) !important;
      color: var(--onaccent) !important;
    }
  }

  :where([data-layout="mobile"]) & {
    display: grid !important;
    place-items: center;
    pointer-events: auto;
    width: 46px !important;
    height: 46px !important;
    border-radius: 50% !important;
    background: var(--panel) !important;
    border: 4px solid var(--panel) !important;
    color: var(--ink) !important;
    font-size: 18px !important;
    font-weight: 700;
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 35%, transparent), 0 0 0 4px color-mix(in srgb, var(--panel) 75%, transparent), 0 5px 20px #0009;
    position: fixed !important;
    top: calc(12px + env(safe-area-inset-top));
    right: 12px;
    margin: 0;
  }
}

.header-divider {
  width: 1px;
  height: 24px;
  background: var(--line);
  margin: 0 4px;

  @media (max-width: 760px) {
    display: none;
  }

  :where([data-layout="mobile"]) & {
    display: none;
  }
}

.palette-corner {
  position: absolute;
  width: fit-content;
  max-width: calc(100% - 32px);
  left: 16px;
  bottom: 16px;
  z-index: 4;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 6px 8px;
  box-shadow: 0 4px 22px #0002;
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0;

  @media (max-width: 760px) {
    left: 12px;
    bottom: 12px;
    padding: 5px 6px;
    border-radius: 12px;
  }

  :where([data-layout="mobile"]) & {
    display: none !important;
  }
}

.palette-corner button {
  width: 32px;
  height: 38px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  position: relative;

  @media (max-width: 760px) {
    width: 28px;
    height: 36px;
    padding: 0;
  }
}

.palette-corner button:before {
  content: "";
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--swatch);
  border: 1px solid #172c2030;

  @media (max-width: 760px) {
    width: 17px;
    height: 17px;
  }
}

.palette-corner button[aria-pressed="true"] {
  background: var(--soft);
  outline: 1px solid var(--line);
}

.palette-corner button[aria-pressed="true"]:after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #172c20;
  font-size: 12px;
  font-weight: 800;
}

body.dark .palette-corner button[aria-pressed="true"]:after {
  color: #171717;
}

body.dark .palette-corner {
  background: #1a1a1a;
}

.selecting .palette-corner {
  display: none !important;
}

#theme {

  :where([data-layout="mobile"]) & {
    display: none;
  }
}

header .palette {

  :where([data-layout="mobile"]) & {
    display: none !important;
  }
}

