/* ============================================
   HankyBook Cookie Consent
   Self-contained: scoped under #hb-consent-root
   No dependency on site CSS variables.
   ============================================ */

#hb-consent-root,
#hb-consent-root * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Open Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#hb-consent-root {
  color: #4d4d4f;
  font-size: 15px;
  position: relative;
  z-index: 2147483000;
}

#hb-consent-root button {
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

#hb-consent-root a {
  color: #f79751;
  text-decoration: underline;
}

/* ============================================
   BANNER (bottom bar)
   ============================================ */
#hb-consent-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #ffffff;
  border-top: 1px solid #e6e6e6;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
  transform: translateY(110%);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  max-height: 80vh;
  overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom);
}

#hb-consent-banner.hb-is-visible {
  transform: translateY(0);
}

#hb-consent-banner.hb-mode-notice {
  border-top: 1px solid #e6e6e6;
}

.hb-banner__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.hb-banner__text {
  flex: 1 1 320px;
  min-width: 0;
}

.hb-banner__title {
  font-family: "Josefin Sans", "Open Sans", sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #212121;
  margin-bottom: 4px;
}

.hb-banner__desc {
  font-size: 13.5px;
  color: #616161;
  line-height: 1.55;
}

.hb-banner__desc .hb-link {
  color: #f79751;
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  display: inline;
}

.hb-banner__actions {
  flex: 0 0 auto;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* Buttons */
#hb-consent-root .hb-btn {
  font-family: "Josefin Sans", "Open Sans", sans-serif;
  font-weight: 600;
  font-size: 14px;
  padding: 12px 20px;
  border-radius: 4px;
  border: 1px solid transparent;
  letter-spacing: 0.3px;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

#hb-consent-root .hb-btn--primary {
  background-color: #f79751;
  color: #ffffff;
  border-color: #f79751;
}

#hb-consent-root .hb-btn--primary:hover {
  background-color: #f68731;
  border-color: #f68731;
}

#hb-consent-root .hb-btn--secondary {
  background-color: #ffffff;
  color: #4d4d4f;
  border-color: #dddedf;
}

#hb-consent-root .hb-btn--secondary:hover {
  border-color: #f79751;
  color: #f79751;
}

#hb-consent-root .hb-btn--ghost {
  background: none;
  color: #616161;
  border: none;
  padding: 10px 8px;
  text-decoration: underline;
  font-weight: 500;
}

#hb-consent-root .hb-btn--ghost:hover {
  color: #f79751;
}

/* CCPA-only "Do Not Sell/Share" inline link (notice mode) */
.hb-banner__dnss {
  font-size: 13.5px;
  color: #616161;
}

.hb-banner__dnss .hb-btn--ghost {
  padding: 0 0 0 4px;
}

/* ============================================
   CUSTOMIZE MODAL
   ============================================ */
#hb-consent-modal {
  position: fixed;
  inset: 0;
  background: rgba(33, 33, 33, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 2147483001;
}

#hb-consent-modal.hb-is-open {
  display: flex;
}

.hb-modal__panel {
  background: #ffffff;
  border-radius: 8px;
  max-width: 620px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
}

.hb-modal__header {
  padding: 22px 24px 14px;
  border-bottom: 1px solid #ececec;
}

.hb-modal__title {
  font-family: "Josefin Sans", "Open Sans", sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #212121;
}

.hb-modal__subtitle {
  font-size: 13.5px;
  color: #616161;
  margin-top: 4px;
}

.hb-modal__body {
  padding: 8px 24px 16px;
  flex: 1;
}

.hb-category {
  padding: 16px 0;
  border-bottom: 1px solid #f0f0f0;
}

.hb-category:last-child {
  border-bottom: none;
}

.hb-category__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.hb-category__info {
  flex: 1;
  min-width: 0;
}

.hb-category__name {
  font-family: "Josefin Sans", "Open Sans", sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #212121;
  margin-bottom: 2px;
}

.hb-category__desc {
  font-size: 13px;
  color: #616161;
}

.hb-category__desc .hb-link {
  color: #f79751;
  text-decoration: underline;
}

/* Toggle switch */
.hb-toggle {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 24px;
}

.hb-toggle__input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.hb-toggle__track {
  position: absolute;
  inset: 0;
  background-color: #d4d4d4;
  border-radius: 999px;
  transition: background-color 0.18s ease;
}

.hb-toggle__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.18s ease;
}

.hb-toggle__input:checked + .hb-toggle__track {
  background-color: #f79751;
}

.hb-toggle__input:checked + .hb-toggle__track .hb-toggle__thumb {
  transform: translateX(20px);
}

.hb-toggle__input:focus-visible + .hb-toggle__track {
  outline: 2px solid #f79751;
  outline-offset: 2px;
}

.hb-toggle--locked .hb-toggle__track {
  background-color: #b6b6b6;
  opacity: 0.7;
}

.hb-toggle--locked .hb-toggle__thumb {
  transform: translateX(20px);
}

.hb-toggle__label {
  font-size: 12px;
  color: #616161;
  font-weight: 600;
  margin-top: 4px;
  text-align: right;
}

.hb-category__toggle-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.hb-modal__footer {
  padding: 16px 24px 22px;
  border-top: 1px solid #ececec;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  background: #fafafa;
  border-radius: 0 0 8px 8px;
}

/* ============================================
   FOOTER PREFERENCES BUTTON (floating, post-consent)
   ============================================ */
#hb-consent-root #hb-consent-prefs {
  position: fixed;
  left: 16px;
  bottom: 16px;
  background: #4d4d4f;
  border: 1px solid #4d4d4f;
  color: #ffffff;
  font-family: "Josefin Sans", "Open Sans", sans-serif;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  z-index: 2147482999;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

#hb-consent-root #hb-consent-prefs.hb-is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#hb-consent-root #hb-consent-prefs:hover {
  background-color: #f79751;
  border-color: #f79751;
  color: #ffffff;
}

/* ============================================
   STICKY-BAR COEXISTENCE
   When consent banner/modal is open, suppress the
   site's buy-now sticky-bar to avoid overlap.
   When the sticky-bar is visible, lift the prefs
   button above it on mobile.
   ============================================ */
body.hb-consent-banner-open .sticky-bar {
  display: none !important;
}

@media (max-width: 767px) {
  body.hb-sticky-bar-visible #hb-consent-root #hb-consent-prefs {
    bottom: 140px;
  }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 720px) {
  .hb-banner__inner {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 18px 20px;
  }

  .hb-banner__text {
    flex: 1 1 auto;
  }

  .hb-banner__actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .hb-btn {
    width: 100%;
    text-align: center;
    padding: 12px 16px;
  }

  .hb-btn--ghost {
    padding: 10px 12px;
  }

  .hb-modal__header,
  .hb-modal__body,
  .hb-modal__footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .hb-modal__footer {
    flex-direction: column-reverse;
  }

  .hb-modal__footer .hb-btn {
    width: 100%;
  }
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  #hb-consent-banner,
  #hb-consent-prefs,
  .hb-toggle__track,
  .hb-toggle__thumb,
  .hb-btn {
    transition: none !important;
  }
}
