/**
 * KindleStore header — 3 layers: trust bar · main row · catalog bar
 */
:root {
  --ks-hdr-max: 1280px;
  --ks-hdr-control: 46px;
}

/* —— Layer 1: Trust bar —— */
.ks-trustbar {
  background: var(--ks-ink, #16181C);
  color: #CFCBC1;
  font-size: 12.5px;
  line-height: 1.2;
}

.ks-trustbar__inner {
  max-width: var(--ks-hdr-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 38px;
  padding: 0 16px;
}

.ks-trustbar__left,
.ks-trustbar__right {
  display: flex;
  align-items: center;
  gap: 22px;
}

.ks-trustbar__sep {
  opacity: 0.35;
}

.ks-trustbar__link {
  color: #CFCBC1 !important;
  text-decoration: none !important;
  white-space: nowrap;
}

.ks-trustbar__phone {
  color: var(--ks-paper, #FBFAF7) !important;
  font-weight: 500;
}

.ks-trustbar__link:hover {
  color: var(--ks-jade-soft, #3FA48F) !important;
  text-decoration: none !important;
}

.ks-trustbar__text--mobile {
  display: none;
}

/* —— Layer 2: Main row —— */
.ks-header {
  background: var(--ks-white, #fff);
  border-bottom: 1px solid var(--ks-border-soft, #EFECE4);
}

.ks-hdr {
  background: var(--ks-white, #fff);
  font-family: var(--ks-font, "Manrope", sans-serif);
  padding: 16px;
}

.ks-hdr__inner {
  max-width: var(--ks-hdr-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
}

.ks-hdr__burger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: var(--ks-radius, 12px);
  background: transparent;
  color: var(--ks-ink, #16181C);
  cursor: pointer;
  flex: 0 0 auto;
}

.ks-hdr__burger:hover {
  background: var(--ks-sand-fill, #F5F3EE);
}

.ks-hdr__logo {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: 0 0 auto;
  text-decoration: none !important;
  color: var(--ks-ink, #16181C) !important;
  min-height: var(--ks-hdr-control);
}

.ks-hdr__logo:hover {
  color: var(--ks-ink, #16181C) !important;
  text-decoration: none !important;
}

.ks-hdr__logo-mark {
  flex: 0 0 auto;
}

.ks-hdr__wordmark {
  font-family: var(--ks-display, "Newsreader", serif);
  font-size: 24px;
  letter-spacing: -0.015em;
  line-height: 1;
  white-space: nowrap;
  color: var(--ks-ink, #16181C);
}

.ks-hdr__logo-img {
  display: none;
}

/* Search */
.ks-hdr__search {
  flex: 1 1 auto;
  min-width: 140px;
  margin: 0 !important;
  padding: 0 !important;
}

.ks-search {
  width: 100%;
}

.ks-search__wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: var(--ks-hdr-control);
  margin: 0;
  padding: 0 14px;
  background: var(--ks-sand-fill, #F5F3EE);
  border: 1px solid var(--ks-border, #E5E1D8);
  border-radius: var(--ks-radius, 12px);
  cursor: text;
}

.ks-search__wrap:focus-within {
  border-color: var(--ks-jade-soft, #3FA48F);
  box-shadow: 0 0 0 3px rgba(15, 95, 82, 0.12);
}

.ks-search__icon {
  flex: 0 0 auto;
  color: var(--ks-muted-warm, #8A8578);
}

.ks-search__input {
  flex: 1 1 auto;
  min-width: 0;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  font-family: var(--ks-font, "Manrope", sans-serif);
  font-size: 14.5px;
  color: var(--ks-ink, #16181C);
  padding: 0 !important;
  height: auto !important;
}

.ks-search__input::placeholder {
  color: var(--ks-muted-warm, #8A8578);
}

.ks-search__submit {
  display: none;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ks-muted-warm, #8A8578);
  cursor: pointer;
}

/* Tools */
.ks-hdr__tools {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 4px;
}

.ks-hdr__tool,
.ks-hdr__cart .ks-hdr__tool {
  display: inline-flex !important;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: var(--ks-hdr-control);
  padding: 0 14px !important;
  border: 1px solid transparent !important;
  border-radius: var(--ks-radius, 12px) !important;
  background: transparent !important;
  color: var(--ks-ink, #16181C) !important;
  text-decoration: none !important;
  line-height: 1.1;
  white-space: nowrap;
  box-shadow: none !important;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.ks-hdr__tool:hover,
.ks-hdr__account:hover .ks-hdr__tool {
  background: var(--ks-sand-fill, #F5F3EE) !important;
  color: var(--ks-ink, #16181C) !important;
  text-decoration: none !important;
  border-color: transparent !important;
}

.ks-hdr__tool-svg {
  flex: 0 0 auto;
  color: currentColor;
}

.ks-hdr__tool-icon-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ks-hdr__badge {
  position: absolute;
  top: -8px;
  right: -10px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--ks-jade, #0F5F52);
  color: var(--ks-paper, #FBFAF7);
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-sizing: border-box;
}

.ks-hdr__badge.is-empty {
  display: none;
}

.ks-hdr__tool-label {
  font-size: 14px;
  font-weight: 600;
  color: inherit;
}

.ks-hdr__account .dropdown-toggle::after,
.ks-hdr__cart .dropdown-toggle::after {
  display: none;
}

.ks-hdr__account .dropdown-menu,
.ks-hdr__cart .dropdown-menu {
  font-size: 13px;
  border-radius: var(--ks-radius, 12px);
  border-color: var(--ks-border, #E5E1D8);
  min-width: 180px;
  margin-top: 6px !important;
}

.ks-hdr__cart {
  display: flex;
  align-items: center;
  margin: 0 !important;
  padding: 0 !important;
}

.ks-hdr__cart .dropdown {
  position: relative;
}

.ks-hdr__cart .dropdown-menu {
  min-width: 320px;
}

/* Cart pill button */
.ks-hdr__cart-btn {
  position: relative; /* anchor for the absolute badge in the mobile layout */
  display: inline-flex !important;
  align-items: center;
  gap: 10px;
  min-height: var(--ks-hdr-control);
  padding: 0 16px 0 14px !important;
  border: none !important;
  border-radius: var(--ks-radius, 12px) !important;
  background: var(--ks-ink, #16181C) !important;
  color: var(--ks-paper, #FBFAF7) !important;
  font-size: 14px;
  font-weight: 700;
  box-shadow: none !important;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none !important;
}

.ks-hdr__cart-btn:hover,
.ks-hdr__cart-btn:focus {
  background: var(--ks-jade, #0F5F52) !important;
  color: var(--ks-paper, #FBFAF7) !important;
}

.ks-hdr__cart-icon {
  flex: 0 0 auto;
  color: currentColor;
}

.ks-hdr__cart-sum {
  font-weight: 700;
}

.ks-hdr__cart-btn .ks-hdr__badge {
  position: static;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  line-height: 20px;
  font-size: 12px;
  background: var(--ks-jade, #0F5F52);
}

/* —— Layer 3: Catalog bar —— */
.ks-catalog {
  background: var(--ks-white, #fff);
  border-bottom: 1px solid var(--ks-border-soft, #EFECE4);
  font-family: var(--ks-font, "Manrope", sans-serif);
  position: relative;
}

.ks-catalog__inner {
  max-width: var(--ks-hdr-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 52px;
  padding: 0 16px;
}

.ks-catalog__toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 34px;
  padding: 0 14px;
  border: none;
  border-radius: 9px;
  background: var(--ks-mint, #E4EFEB);
  color: var(--ks-jade, #0F5F52);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
}

.ks-catalog__toggle:hover,
.ks-catalog__toggle[aria-expanded="true"] {
  background: #d5e8e2;
}

.ks-catalog__links {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.ks-catalog__links::-webkit-scrollbar {
  display: none;
}

.ks-catalog__links > li > a {
  display: block;
  color: var(--ks-text, #3C4048) !important;
  font-size: 14.5px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none !important;
  white-space: nowrap;
}

.ks-catalog__links > li > a:hover {
  color: var(--ks-jade, #0F5F52) !important;
  text-decoration: none !important;
}

.ks-catalog__links .dropdown-menu {
  border-radius: var(--ks-radius, 12px);
  border-color: var(--ks-border, #E5E1D8);
  padding: 6px 0;
  max-height: 70vh;
  overflow: auto;
  box-shadow: var(--ks-shadow, 0 18px 44px rgba(22, 24, 28, 0.07));
}

.ks-catalog__links .dropdown-item {
  font-size: 13px;
  color: var(--ks-text, #3C4048) !important;
}

.ks-catalog__links .dropdown-item:hover {
  color: var(--ks-jade, #0F5F52) !important;
  background: var(--ks-mint, #E4EFEB);
}

.ks-catalog__meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
  flex: 0 0 auto;
}

.ks-catalog__meta-link {
  color: var(--ks-text, #3C4048) !important;
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none !important;
  white-space: nowrap;
}

.ks-catalog__meta-link:hover {
  color: var(--ks-jade, #0F5F52) !important;
  text-decoration: none !important;
}

/* Full catalog dropdown */
.ks-all-menu {
  background: var(--ks-white, #fff);
  border-bottom: 1px solid var(--ks-border, #E5E1D8);
  box-shadow: var(--ks-shadow, 0 18px 44px rgba(22, 24, 28, 0.07));
}

.ks-all-menu__inner {
  max-width: var(--ks-hdr-max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
  padding: 24px 16px;
}

.ks-all-menu__title {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ks-ink, #16181C) !important;
  margin-bottom: 11px;
  text-decoration: none !important;
}

.ks-all-menu__col ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ks-all-menu__col li a {
  display: block;
  color: var(--ks-text, #3C4048) !important;
  font-size: 14.5px;
  padding: 4px 0;
  text-decoration: none !important;
}

.ks-all-menu__col li a:hover {
  color: var(--ks-jade, #0F5F52) !important;
  text-decoration: none !important;
}

/* —— Responsive —— */
@media (max-width: 991px) {
  .ks-catalog__inner {
    display: none;
  }

  .ks-hdr__burger {
    display: inline-flex;
  }

  .ks-trustbar__text--desktop,
  .ks-trustbar__sep--desktop {
    display: none;
  }

  .ks-trustbar__text--mobile {
    display: inline;
  }

  .ks-trustbar__left {
    gap: 0;
  }

  .ks-trustbar__right {
    gap: 10px;
  }

  .ks-trustbar__sep:not(.ks-trustbar__sep--desktop) {
    display: none;
  }

  .ks-trustbar__link:not(.ks-trustbar__phone) {
    display: none;
  }
}

@media (max-width: 767px) {
  .ks-hdr {
    padding: 12px 14px;
  }

  .ks-hdr__inner {
    flex-wrap: wrap;
    gap: 12px;
  }

  .ks-hdr__logo {
    order: 2;
    flex: 1 1 auto;
    justify-content: center;
  }

  .ks-hdr__burger {
    order: 1;
  }

  .ks-hdr__tools {
    order: 3;
    margin-left: auto;
  }

  .ks-hdr__search {
    order: 4;
    flex: 1 1 100%;
  }

  .ks-hdr__tool-label {
    display: none;
  }

  .ks-hdr__tool {
    min-width: 40px;
    padding: 0 10px !important;
  }

  .ks-hdr__wordmark {
    font-size: 19px;
  }

  .ks-hdr__cart-sum {
    display: none;
  }

  .ks-hdr__cart-btn {
    padding: 0 12px !important;
  }

  .ks-hdr__cart-btn .ks-hdr__badge {
    position: absolute;
    top: -5px;
    right: -7px;
  }

  .ks-hdr__cart .dropdown {
    position: relative;
  }
}

@media (max-width: 575px) {
  .ks-trustbar__inner {
    justify-content: center;
    text-align: center;
    font-size: 11px;
  }

  .ks-trustbar__right {
    display: none;
  }
}

/* Mobile full-width catalog panel when opened from burger */
@media (max-width: 991px) {
  .ks-all-menu {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 1000;
  }
}
