/* ─────────────────────────────────────────────────────────────────────────
   DOWNLOAD DOCK + REPORT FORM POPUP (src/components/ReportDownload.astro)
   ─────────────────────────────────────────────────────────────────────────
   In the report's own palette: plum grounds, paper cards, coral actions,
   the display serif for titles, Passenger Sans for controls. The HubSpot
   form is themed through its --hsf-* custom properties, which its CSS reads
   as var(--hsf-x, var(--hsf-default-x)) — so they inherit from here and no
   selector has to fight HubSpot's.
   ───────────────────────────────────────────────────────────────────────── */
.soeb-dock,
.report-gate {
  --g-plum: #1D0716;
  --g-plum-2: #2A0F22;
  --g-plum-3: #3A1830;
  --g-paper: #FFFAF2;
  --g-paper-2: #F6EFE4;
  --g-cream: #FFF8F2;
  --g-coral: #FF4052;
  --g-coral-deep: #E93A4A;
  --g-ink: #43141D;
  --g-ink-2: #6D3A41;
  --g-ink-3: #95656A;
  --g-head: #55151B;
  --g-rule: #E5D4C8;
  --g-lav: #C0ADDD;
  --g-serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --g-sans: "Passenger Sans", "Helvetica Neue", Arial, sans-serif;
}

/* ── Dock ─────────────────────────────────────────────────────────────── */
.soeb-dock {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 90; /* the report's own back-to-top sat here: over the page, under the site nav */
  display: flex;
  align-items: stretch;
  gap: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .22s ease, transform .22s ease, visibility .22s;
}
.soeb-dock.is-visible { opacity: 1; visibility: visible; transform: none; }

.soeb-dock__btn {
  box-sizing: border-box;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 0 20px 0 16px;
  border-radius: 14px;
  border: 1.5px solid rgb(255 248 242 / 30%);
  background: rgb(29 7 22 / 88%);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--g-cream);
  font: 500 15px/1 var(--g-sans);
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 8px 24px rgb(14 3 11 / 24%);
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
  -webkit-tap-highlight-color: transparent;
}
.soeb-dock__btn svg {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* The reference pairs an outlined pill with a filled square. */
.soeb-dock__top {
  width: 48px;
  padding: 0;
  background: var(--g-plum-3);
  border-color: var(--g-plum-3);
}
.soeb-dock__btn:hover { background: var(--g-coral); border-color: var(--g-coral); color: #fff; }
.soeb-dock__btn:active { transform: translateY(1px); }
.soeb-dock__btn:focus-visible { outline: 2px solid var(--g-coral); outline-offset: 3px; }

/* Where the page already shows a download (closing section) and over the
   site footer, the pill steps aside; ↑ stays put at the right edge. */
.soeb-dock__download { transition: opacity .18s ease, visibility .18s, background-color .16s ease, border-color .16s ease, color .16s ease; }
.soeb-dock.is-quiet .soeb-dock__download { opacity: 0; visibility: hidden; pointer-events: none; }

/* Out of the way while the phone contents drawer or the site menu is open. */
body.toc-open:not(.toc-pinned) .soeb-dock,
.navbar.nav--menu-open ~ .soeb-dock { opacity: 0; visibility: hidden; }

@media (max-width: 480px) {
  .soeb-dock__btn { height: 46px; font-size: 14.5px; padding: 0 16px 0 14px; gap: 8px; }
  .soeb-dock__top { width: 46px; padding: 0; }
}

/* ── Dialog ───────────────────────────────────────────────────────────── */
html.gate-open { overflow: hidden; scrollbar-gutter: stable; }

dialog.report-gate {
  box-sizing: border-box;
  width: min(900px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: var(--g-paper);
  color: var(--g-ink);
  box-shadow: 0 40px 100px rgb(14 3 11 / 55%);
  overflow: hidden;
}
dialog.report-gate::backdrop {
  background: rgb(14 3 11 / 74%);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
dialog.report-gate[open] { animation: gate-in .26s cubic-bezier(.22, .7, .3, 1); }
dialog.report-gate[open]::backdrop { animation: gate-fade .26s ease; }
@keyframes gate-in { from { opacity: 0; transform: translateY(14px) scale(.985); } }
@keyframes gate-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  dialog.report-gate[open], dialog.report-gate[open]::backdrop { animation: none; }
}

.report-gate__card {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  min-height: min(580px, calc(100dvh - 32px));
  max-height: calc(100dvh - 32px);
}

/* The closing frame: the flat book cover on the report's plum. */
.report-gate__art {
  position: relative;
  background-color: #1E0816;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}
.report-gate__edition {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 22px;
  margin: 0;
  text-align: center;
  font: 400 13px/1.4 var(--g-sans);
  color: var(--g-lav);
}

.report-gate__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 48px 36px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.report-gate__step[hidden] { display: none; }

.report-gate__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--g-ink-2);
  cursor: pointer;
  transition: background-color .16s ease, color .16s ease;
}
.report-gate__close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.report-gate__close:hover { background: var(--g-paper-2); color: var(--g-head); }
.report-gate__close:focus-visible { outline: 2px solid var(--g-coral); outline-offset: 2px; }

.report-gate__kicker {
  margin: 0 0 10px;
  font: 500 13px/1.3 var(--g-sans);
  color: #D92F41;
}
.report-gate__title {
  margin: 0 0 12px;
  max-width: none;
  font: 400 34px/1.08 var(--g-serif);
  letter-spacing: -.01em;
  color: var(--g-head);
}
.report-gate__title:focus { outline: none; }
.report-gate__lede {
  margin: 0 0 26px;
  max-width: 44ch;
  font: 400 16px/1.55 var(--g-serif);
  color: var(--g-ink-2);
}
.report-gate__lede em { font-style: italic; }

.report-gate__fine {
  margin: 18px 0 0;
  font: 400 12.5px/1.5 var(--g-sans);
  color: var(--g-ink-3);
}
.report-gate__fine a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.report-gate__fine a:hover { color: var(--g-coral-deep); }

/* Primary action, the report's coral pill (.dl-btn). */
.report-gate__cta {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: 14px 24px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  background: var(--g-coral);
  color: #fff;
  font: 500 16px/1.2 var(--g-sans);
  text-decoration: none;
  transition: background-color .16s ease, transform .16s ease;
}
.report-gate__cta svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.report-gate__cta span { font-size: 13px; opacity: .85; }
.report-gate__cta:hover { background: var(--g-coral-deep); transform: translateY(-1px); }
.report-gate__cta:focus-visible { outline: 2px solid var(--g-head); outline-offset: 3px; }

.report-gate__error p { margin: 0 0 16px; font: 400 15px/1.5 var(--g-sans); color: var(--g-ink-2); }

.report-gate__tick {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin: 0 0 20px;
  border-radius: 50%;
  background: var(--g-coral);
  color: #fff;
}
.report-gate__tick svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ── The HubSpot form, in the report's type and colour ─────────────────── */
.report-gate__form {
  position: relative;
  min-height: 312px; /* ≈ the rendered form: no jump when it arrives */
  --hsf-global__font-family: var(--g-sans);
  --hsf-global__font-size: 15px;
  --hsf-global__color: var(--g-ink);
  --hsf-global__error-color: #C8233B;
  --hsf-row__vertical-spacing: 12px;
  --hsf-row__horizontal-spacing: 12px;
  --hsf-module__vertical-spacing: 6px;
  --hsf-background__padding: 0;
  --hsf-background__border-width: 0;
  --hsf-background__background-color: transparent;
  --hsf-field-label__font-size: 13px;
  --hsf-field-label__color: var(--g-ink-2);
  --hsf-field-input__font-family: var(--g-sans);
  --hsf-field-input__font-size: 16px; /* 16px keeps iOS from zooming on focus */
  --hsf-field-input__color: var(--g-ink);
  --hsf-field-input__background-color: #FFFFFF;
  --hsf-field-input__placeholder-color: var(--g-ink-3);
  --hsf-field-input__border-color: var(--g-rule);
  --hsf-field-input__border-width: 1.5px;
  --hsf-field-input__border-style: solid;
  --hsf-field-input__border-radius: 12px;
  --hsf-field-input__padding: 13px 16px;
  --hsf-field-dropdown-options__border-radius: 12px;
  --hsf-erroralert__font-family: var(--g-sans);
  --hsf-erroralert__font-size: 13px;
  --hsf-erroralert__color: #C8233B;
  --hsf-infoalert__font-family: var(--g-sans);
  --hsf-infoalert__font-size: 13px;
  --hsf-infoalert__color: var(--g-ink-2);
  --hsf-richtext__font-family: var(--g-sans);
  --hsf-richtext__font-size: 14px;
  --hsf-richtext__color: var(--g-ink-2);
  --hsf-button__width: 100%;
  --hsf-button__font-family: var(--g-sans);
  --hsf-button__font-size: 16px;
  --hsf-button__font-weight: 500;
  --hsf-button__color: #FFFFFF;
  --hsf-button__background-color: var(--g-coral);
  --hsf-button__background-image: none;
  --hsf-button__border-width: 0;
  --hsf-button__border-style: solid;
  --hsf-button__border-color: transparent;
  --hsf-button__border-radius: 999px;
  --hsf-button__padding: 16px 24px;
  --hsf-button__box-shadow: none;
  --hsf-button--hover__background-color: var(--g-coral-deep);
  --hsf-button--hover__color: #FFFFFF;
  --hsf-button--focus__background-color: var(--g-coral-deep);
  --hsf-button--focus__color: #FFFFFF;
  --hsf-button--focus__border-color: transparent;
  --hsf-navigationrow-buttons__justify-content: stretch;
  --hsf-navigationrow-buttons-single__justify-content: stretch;
}
.report-gate__form[hidden] { display: none; }

/* A visible focus ring; HubSpot's own is a 3px blur in the border colour. */
.report-gate [data-hsfc-id=Renderer] .hsfc-TextInput:focus,
.report-gate [data-hsfc-id=Renderer] .hsfc-PhoneInput__FlagAndCaret:focus {
  border-color: var(--g-coral);
  box-shadow: 0 0 0 3px rgb(255 64 82 / 18%);
  outline: none;
}
.report-gate [data-hsfc-id=Renderer] .hsfc-TextInput:hover:not(:focus) { box-shadow: none; border-color: var(--g-ink-3); }
.report-gate [data-hsfc-id=Renderer] .hsfc-TextInput[aria-invalid="true"] { border-color: #C8233B; }
.report-gate [data-hsfc-id=Renderer] .hsfc-NavigationRow { margin-top: 8px; }
.report-gate [data-hsfc-id=Renderer] .hsfc-Button { min-height: 52px; letter-spacing: 0; }
.report-gate [data-hsfc-id=Renderer] .hsfc-Button:not([disabled]):hover { transform: translateY(-1px); }
/* Placeholder-only fields: labels carry the accessible name, not a visible one. */
.report-gate [data-hsfc-id=Renderer] .hsfc-FieldLabel {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
/* The report's styles.css sets p margins and a global text-transform. */
.report-gate [data-hsfc-id=Renderer] p { margin: 0; }

/* Skeleton while HubSpot's script and form load. */
.report-gate__skeleton { display: grid; gap: 12px; }
.report-gate__skeleton i {
  display: block;
  height: 49px;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--g-paper-2) 0%, #FBF4EA 50%, var(--g-paper-2) 100%) 0 0 / 200% 100%;
  animation: gate-shimmer 1.4s linear infinite;
}
.report-gate__skeleton i.btn { height: 52px; margin-top: 8px; border-radius: 999px; }
@keyframes gate-shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .report-gate__skeleton i { animation: none; } }
.report-gate__form.is-ready .report-gate__skeleton { display: none; }
.report-gate__form:not(.is-ready) .hs-form-html { position: absolute; inset: 0; opacity: 0; pointer-events: none; }

/* ── Phones: one column, the form first ───────────────────────────────── */
@media (max-width: 760px) {
  dialog.report-gate {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
    border-radius: 18px;
  }
  .report-gate__card { grid-template-columns: 1fr; min-height: 0; max-height: calc(100dvh - 24px); }
  .report-gate__art { display: none; }
  .report-gate__panel { padding: 30px 22px 22px; justify-content: flex-start; }
  .report-gate__title { font-size: 28px; padding-right: 36px; }
  .report-gate__lede { font-size: 15.5px; margin-bottom: 20px; }
  .report-gate__form { min-height: 300px; }
}

@media print {
  .soeb-dock, dialog.report-gate { display: none !important; }
}
