/*
 * Herb Calm shared analytics notice.
 * Keep this file self-contained: it can be loaded by both the app and
 * education pages without changing their typography or component styles.
 */

body {
  padding-bottom: var(--hc-consent-height, 0px);
}

.hc-consent,
.hc-consent *,
.hc-analytics-preferences {
  box-sizing: border-box;
}

.hc-consent[hidden],
.hc-consent [hidden] {
  display: none !important;
}

.hc-consent {
  position: fixed;
  z-index: 40;
  inset: auto max(1rem, env(safe-area-inset-right, 0px))
    max(1rem, env(safe-area-inset-bottom, 0px)) auto;
  width: min(29rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1rem;
  border: 1px solid #d9ddd3;
  border-radius: 7px;
  background: #faf8f2;
  color: #303b32;
  box-shadow: 0 8px 26px rgba(48, 59, 50, 0.13);
  font: inherit;
  line-height: 1.48;
}

.hc-consent__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.45rem;
}

.hc-consent__text {
  display: contents;
}

.hc-consent__title {
  margin: 0;
  color: #303b32;
  font-family: "Playfair Display", Georgia, "Times New Roman", serif;
  font-size: 1.12rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.hc-consent__privacy,
.hc-consent__body,
.hc-consent__status {
  margin: 0;
  color: #58645a;
  font-size: 0.86rem;
  line-height: 1.48;
  overflow-wrap: anywhere;
}

.hc-consent__privacy {
  color: #445548;
  font-weight: 600;
}

.hc-consent__status {
  color: #49614d;
  font-size: 0.8rem;
}

.hc-consent__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  justify-content: stretch;
  gap: 0.5rem;
  min-width: 0;
  margin-top: 0.25rem;
}

.hc-consent__button,
.hc-consent__close,
.hc-analytics-preferences {
  min-height: 44px;
  border: 1px solid #708571;
  border-radius: 3px;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hc-consent__button {
  display: inline-flex;
  flex: 1 1 0;
  min-width: 0;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.65rem;
  background: #49614d;
  color: #faf8f2;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.hc-consent__button:hover {
  border-color: #34483a;
  background: #34483a;
}

.hc-consent__close {
  grid-column: 1 / -1;
  justify-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  padding: 0.5rem 0.7rem;
  border-color: transparent;
  background: transparent;
  color: #58645a;
  font-size: 0.88rem;
  text-decoration: underline;
  text-decoration-color: #aebbaa;
  text-underline-offset: 0.2em;
}

.hc-consent__close:hover {
  color: #34483a;
  text-decoration-color: currentColor;
}

.hc-consent__button:focus-visible,
.hc-consent__close:focus-visible,
.hc-analytics-preferences:focus-visible {
  outline: 3px solid #708571;
  outline-offset: 3px;
}

.hc-analytics-preferences {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.65rem;
  border-color: #d9ddd3;
  background: #faf8f2;
  color: #49614d;
  font-size: 0.82rem;
  line-height: 1.35;
  text-decoration: underline;
  text-decoration-color: #aebbaa;
  text-underline-offset: 0.18em;
}

.hc-analytics-preferences:hover {
  border-color: #aebbaa;
  color: #34483a;
  text-decoration-color: currentColor;
}

@media (max-width: 560px) {
  .hc-consent {
    inset-inline: max(0.65rem, env(safe-area-inset-left, 0px))
      max(0.65rem, env(safe-area-inset-right, 0px));
    bottom: max(0.65rem, env(safe-area-inset-bottom, 0px));
    width: auto;
    max-height: calc(100dvh - 1.3rem);
    padding: 0.8rem 0.85rem;
    border-radius: 6px;
  }

  .hc-consent__inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.34rem;
  }

  .hc-consent__title {
    font-size: 1.06rem;
  }

  .hc-consent__privacy,
  .hc-consent__body {
    font-size: 0.82rem;
    line-height: 1.42;
  }

  .hc-consent__actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
    gap: 0.4rem;
    margin-top: 0.2rem;
  }

  .hc-consent__button {
    width: 100%;
    padding: 0.5rem 0.35rem;
    font-size: 0.84rem;
  }

  .hc-consent__close {
    grid-column: 1 / -1;
    justify-self: center;
  }
}

@media (max-width: 360px) {
  .hc-consent {
    inset-inline: max(0.5rem, env(safe-area-inset-left, 0px))
      max(0.5rem, env(safe-area-inset-right, 0px));
    bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
    padding: 0.72rem 0.7rem;
  }

  .hc-consent__privacy,
  .hc-consent__body {
    font-size: 0.82rem;
  }
}

@media (max-width: 400px) {
  .hc-consent {
    display: flex;
    max-height: min(52dvh, calc(100dvh - 1rem));
    overflow: hidden;
    padding: 0.68rem 0.72rem;
  }

  .hc-consent__inner {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    gap: 0.28rem;
  }

  .hc-consent__text {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    gap: 0.28rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  .hc-consent__text:focus-visible {
    outline: 2px solid #708571;
    outline-offset: -2px;
    border-radius: 2px;
  }

  .hc-consent__actions {
    flex: 0 0 auto;
    gap: 0.35rem;
    margin-top: 0.12rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hc-consent__button,
  .hc-consent__close,
  .hc-analytics-preferences {
    scroll-behavior: auto;
    transition: none;
  }
}
