/* ============================================================
   Free-analysis offer in a blog post's header
   ============================================================
   A gold pill with the same weight as the studio's "Find an installer", and a
   panel that opens on hover or tap (js/study-cta.js). #chat-header sets 30px
   white centred text, so everything here sets its own. Tokens: style.css. */

.study-cta-wrap {
  /* Out of the header's flex flow, so the centred title stays centred. */
  position: absolute;
  top: 0;
  bottom: 0;
  right: 96px;              /* clear of the theme toggle and the menu */
  z-index: 1001;
  display: flex;
  align-items: center;
  font-size: 16px;
  text-align: left;
}

.study-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.05rem;
  border: none;
  border-radius: 999px;
  background: var(--gold);
  color: #fff;
  font-family: 'Exo 2', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  transition: background 0.15s ease, box-shadow 0.2s ease, transform 0.15s ease;
}
.study-cta:hover,
.study-cta-wrap.is-open .study-cta {
  background: var(--gold-strong);
  box-shadow: 0 4px 12px rgba(202, 162, 0, 0.35);
}
.study-cta:hover { transform: translateY(-1px); }
.study-cta:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.study-cta-short { display: none; }

/* ---------- the panel ---------- */
.study-cta-pop {
  position: absolute;
  top: calc(100% + 2px);
  right: 0;
  width: 380px;
  /* style.css caps everything in .container at 100% of its parent, which here
     is the button's width. */
  max-width: calc(100vw - 24px);
  padding: 1rem 1.05rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink-soft);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
  font-family: 'Exo 2', sans-serif;
  font-size: 0.86rem;
  font-weight: 400;
  line-height: 1.5;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}
.study-cta-wrap.is-open .study-cta-pop {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
}
/* Arrow back at the button. */
.study-cta-pop::before {
  content: '';
  position: absolute;
  top: -6px;
  right: 30px;
  width: 10px;
  height: 10px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  transform: rotate(45deg);
}

.study-cta-pop p { margin: 0 0 0.6rem; }
.study-cta-pop strong { color: var(--ink); font-weight: 600; }
.study-cta-pop a { color: var(--gold-strong); }
body.dark-mode .study-cta-pop a { color: var(--gold); }

.study-cta-title {
  margin: 0 1.8rem 0.35rem 0 !important;
  color: var(--ink);
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.35;
}

.study-cta-points { list-style: none; margin: 0 0 0.9rem; padding: 0; }
.study-cta-points li { display: flex; gap: 0.6rem; margin: 0 0 0.55rem; }
.study-cta-points i {
  flex: none;
  width: 1rem;
  margin-top: 0.22rem;
  color: var(--gold);
  text-align: center;
}

.study-cta-go {
  display: block;
  padding: 0.62rem 1rem;
  border-radius: 8px;
  background: var(--gold);
  color: #fff !important;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: background 0.15s ease;
}
.study-cta-go:hover { background: var(--gold-strong); }
/* After a form submission: a receipt, not a second invitation. */
.study-cta-go.is-done {
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--ink) !important;
  pointer-events: none;
}
.study-cta-alt { margin: 0.45rem 0 0 !important; font-size: 0.76rem; text-align: center; }

.study-cta-privacy {
  display: flex;
  gap: 0.55rem;
  margin: 0.85rem 0 0 !important;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.76rem;
  line-height: 1.45;
}
.study-cta-privacy i { flex: none; margin-top: 0.2rem; }

.study-cta-close {
  position: absolute;
  top: 0.45rem;
  right: 0.5rem;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--ink-soft);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.study-cta-close:hover { background: var(--bg); color: var(--ink); }

/* Below wide desktop the centred title needs the room: short label... */
@media (max-width: 1180px) {
  .study-cta-long { display: none; }
  .study-cta-short { display: inline; }
}
/* ...and just above the phone layout only the icon fits beside it. */
@media (min-width: 769px) and (max-width: 919px) {
  .study-cta-short { display: none; }
  .study-cta { padding: 0.5rem 0.7rem; }
}

/* Phones: the panel hangs from the viewport rather than the button, so it can
   never run off either edge. study-cta.js sets its top just under the header. */
@media (max-width: 768px) {
  .study-cta-wrap { right: 52px; }   /* clear of the theme toggle */
  .study-cta { padding: 0.45rem 0.8rem; font-size: 0.82rem; }
  .study-cta-pop {
    position: fixed;
    left: 12px;
    right: 12px;
    width: auto;
    max-height: calc(100vh - 96px);
    overflow-y: auto;
  }
  .study-cta-pop::before { display: none; }
}
@media (max-width: 420px) {
  .study-cta-short { display: none; }
  .study-cta { padding: 0.5rem 0.65rem; }
}

@media (prefers-reduced-motion: reduce) {
  .study-cta, .study-cta-pop { transition: none; }
  .study-cta:hover { transform: none; }
}

/* ---------- in the Design Studio header ----------
   There the offer sits in the flow of .header-actions, beside "Sign in",
   rather than pinned into the corner of a blog header. */
.header-actions .study-cta-wrap { position: relative; top: auto; right: auto; bottom: auto; }
.header-actions .study-cta-pop { top: calc(100% + 10px); }
@media (max-width: 640px) {
  .header-actions .study-cta-short { display: none; }
  .header-actions .study-cta { padding: 0.5rem 0.7rem; }
}

/* An inline "Request my free analysis" button (data-open-cta) in page copy. */
.analysis-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 10px 0 0;
  padding: 0.55rem 1.15rem;
  border: none;
  border-radius: 999px;
  background: var(--gold, #caa200);
  color: #fff;
  font: inherit;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
.analysis-btn:hover { background: var(--gold-strong, #b08e00); }
.analysis-btn:focus-visible { outline: 2px solid var(--ink, #222); outline-offset: 2px; }
