/* "Book samtale" button + modal (inc/book-modal.php + js/book-modal.js)
   State: html.ml-book-open */
:root {
  --ml-book-bg: #a0a7b9;        /* light blue from the design */
  --ml-book-bg-soft: rgba(255, 255, 255, 0.72);   /* over photos (design: white, semi-transparent) */
  --ml-book-bg-light: rgba(160, 167, 185, 0.6);   /* over light sections: the light blue, semi-transparent */
  --ml-book-color: #fff;
  --ml-book-size: max(5.2rem, calc(55 * var(--u, 2px)));   /* 90 % of the design's 61 pt circle */
  --ml-book-offset: max(1.25rem, 2.5vw);
  --ml-book-offset-r: max(1.25rem, calc(23.8 * var(--u, 2px)));
  --ml-book-offset-b: max(1.25rem, calc(22.7 * var(--u, 2px)));
  --ml-book-modal-bg: #fff;
  --ml-book-backdrop: rgba(29, 29, 27, 0.75);
  --ml-ease: cubic-bezier(0.625, 0.05, 0, 1);
  --ml-form-ink: #1d1d1b;
  --ml-form-line: rgba(29, 29, 27, 0.22);
  --ml-form-error: #9b161b;      /* red from the icons */
}

/* ---------- Round button ---------- */
.ml-book {
  position: fixed;
  right: var(--ml-book-offset-r);
  bottom: var(--ml-book-offset-b);
  z-index: 99980; /* below the burger menu */
  display: grid;
  place-items: center;
  width: var(--ml-book-size);
  height: var(--ml-book-size);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background-color: var(--ml-book-bg-soft);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: var(--ml-book-color);
  font-family: inherit;
  font-size: calc(var(--ml-book-size) * 0.2295); /* design: 14 pt in a 61 pt circle */
  font-style: italic;
  line-height: 1;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  animation: ml-book-in 1.2s var(--ml-ease) 0.8s backwards;
  translate: 0 calc(-1 * var(--ml-book-lift, 0px)); /* stops at the footer (js/book-modal.js) */
  transition: scale 0.7s var(--ml-ease), rotate 0.7s var(--ml-ease), background-color 0.5s var(--ml-ease);
}
/* over light sections (class set by js/burger-menu.js, like the burger colour) */
.ml-book.is-dark {
  background-color: var(--ml-book-bg-light);
}
.ml-book__text {
  display: block;
  transition: scale 0.7s var(--ml-ease);
}
@keyframes ml-book-in {
  from { scale: 0; rotate: -20deg; }
  to { scale: 1; rotate: 0deg; }
}
@media (hover: hover) and (pointer: fine) {
  .ml-book:hover {
    scale: 1.06;
    rotate: -6deg;
  }
  .ml-book:hover .ml-book__text {
    scale: 1.04;
  }
}
.ml-book:active {
  scale: 0.94;
}
.ml-book:focus {
  outline: none;
}
.ml-book:focus-visible {
  outline: 1px solid var(--ml-book-bg);
  outline-offset: 4px;
}

/* Hidden while the menu or the modal is open */
html.ml-menu-open .ml-book,
html.ml-book-open .ml-book {
  scale: 0;
  rotate: 20deg;
}

/* ---------- Modal ---------- */
html.ml-book-open,
html.ml-book-open body {
  overflow: hidden;
}

.ml-book-modal {
  position: fixed;
  inset: 0;
  z-index: 99998; /* above the burger */
  display: grid;
  place-items: center;
  padding: var(--ml-book-offset);
  overflow-y: auto;
  overscroll-behavior: contain;
  visibility: hidden;
  transition: visibility 0s linear 0.9s;
}
html.ml-book-open .ml-book-modal {
  visibility: visible;
  transition-delay: 0s;
}

.ml-book-modal__backdrop {
  position: fixed;
  inset: 0;
  background-color: var(--ml-book-backdrop);
  opacity: 0;
  transition: 0.6s var(--ml-ease) 0.2s;
  backdrop-filter: blur(3px);
}
html.ml-book-open .ml-book-modal__backdrop {
  opacity: 1;
  transition-delay: 0s;
}

.ml-book-modal__panel {
  position: relative;
  width: min(42rem, 100%);
  max-height: calc(100dvh - 2 * var(--ml-book-offset));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4.25rem clamp(1.5rem, 5vw, 4rem) clamp(3rem, 5vw, 4.5rem); /* top: room for the close cross */
  box-sizing: border-box;
  background-color: var(--ml-book-modal-bg);
  clip-path: inset(100% 0 0 0);
  translate: 0 3rem;
  transition: clip-path 0.6s var(--ml-ease), translate 0.7s var(--ml-ease);
}
html.ml-book-open .ml-book-modal__panel {
  clip-path: inset(0 0 0 0);
  translate: 0 0;
  transition: clip-path 1s var(--ml-ease) 0.1s, translate 1.1s var(--ml-ease) 0.1s;
}

/* Form, centred */
.ml-book-modal__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  opacity: 0;
  translate: 0 1rem;
  transition: opacity 0.3s ease, translate 0.4s var(--ml-ease);
}
.ml-book-modal__content > * {
  width: 100%;
  max-width: 34rem;
  margin-inline: auto;
}
html.ml-book-open .ml-book-modal__content {
  opacity: 1;
  translate: 0 0;
  transition: opacity 0.8s ease 0.45s, translate 1.1s var(--ml-ease) 0.45s;
}

/* Headline */
.ml-book-modal__header {
  max-width: 34rem;
  margin: 0 auto 2.25rem;
  color: var(--ml-form-ink);
}
.ml-book-modal__title {
  margin: 0 0 0.75rem;
  padding: 0;
  color: inherit;
  font-family: inherit;
  font-size: 26px;
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.01em;
}
.ml-book-modal__intro {
  margin: 0;
  padding: 0;
  font-size: 1.125rem;
  font-style: italic;
  line-height: 1.4;
  opacity: 0.75;
}

/* ---------- Form (Formidable) ---------- */
.ml-book-modal .with_frm_style {
  text-align: left;
}
.ml-book-modal .with_frm_style fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}
.ml-book-modal .with_frm_style .frm_form_field {
  margin-bottom: 1.1rem;
}

/* Floating labels: the label sits in the field like a placeholder and moves up, smaller, when the field is active or filled
   (.ml-float / .is-active / .is-filled are set by js/book-modal.js) */
.ml-book-modal .ml-float {
  position: relative;
}
.ml-book-modal .ml-float > .frm_primary_label {
  position: absolute;
  top: 1.45rem;
  left: 0;
  z-index: 1;
  margin: 0;
  padding: 0;
  color: var(--ml-form-ink);
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: none;
  opacity: 0.55;
  pointer-events: none;
  transform-origin: left top;
  transition:
    top 0.6s var(--ml-ease),
    font-size 0.6s var(--ml-ease),
    opacity 0.4s ease;
}
.ml-book-modal .ml-float.is-active > .frm_primary_label,
.ml-book-modal .ml-float.is-filled > .frm_primary_label {
  top: 0.1rem;
  font-size: 0.8125rem;
  opacity: 0.6;
}
.ml-book-modal .ml-float.is-active > .frm_primary_label {
  opacity: 1;
}
.ml-book-modal .ml-float .frm_required {
  color: inherit;
}

.ml-book-modal .with_frm_style .ml-float input,
.ml-book-modal .with_frm_style .ml-float textarea {
  display: block;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 1.45rem 0 0.6rem !important;
  border: 0 !important;
  border-bottom: 1px solid var(--ml-form-line) !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--ml-form-ink) !important;
  font-family: inherit !important;
  font-size: 1.15rem !important;
  line-height: 1.3 !important;
  outline: none !important;
  transition: border-color 0.5s var(--ml-ease) !important;
}
.ml-book-modal .with_frm_style .ml-float textarea {
  min-height: 7.5rem !important;
  resize: vertical;
}
.ml-book-modal .with_frm_style .ml-float input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 100px var(--ml-book-modal-bg) inset !important;
  -webkit-text-fill-color: var(--ml-form-ink) !important;
}

/* Active line draws in from the left */
.ml-book-modal .ml-float::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background-color: var(--ml-form-ink);
  scale: 0 1;
  transform-origin: left center;
  transition: scale 0.8s var(--ml-ease);
  pointer-events: none;
}
.ml-book-modal .ml-float.ml-float--input::after { top: calc(1.45rem + 1.15rem * 1.3 + 0.6rem); }
.ml-book-modal .ml-float.ml-float--textarea::after { display: none; }
.ml-book-modal .ml-float.is-active::after {
  scale: 1 1;
}
.ml-book-modal .with_frm_style .ml-float textarea:focus {
  border-bottom-color: var(--ml-form-ink) !important;
}

/* Errors */
.ml-book-modal .with_frm_style .frm_blank_field input,
.ml-book-modal .with_frm_style .frm_blank_field textarea {
  border-bottom-color: var(--ml-form-error) !important;
}
.ml-book-modal .with_frm_style .frm_blank_field > .frm_primary_label {
  color: var(--ml-form-error);
}
.ml-book-modal .with_frm_style .frm_error {
  margin-top: 0.4rem;
  padding: 0;
  color: var(--ml-form-error);
  font-size: 0.875rem;
  font-style: italic;
}
.ml-book-modal .with_frm_style .frm_error_style,
.ml-book-modal .with_frm_style .frm_message {
  margin: 0 0 1.5rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ml-form-ink);
  font-size: 1.15rem;
  font-style: italic;
  text-align: center;
}

/* Submit: Button 029 (rebuilt by js/book-modal.js), centred */
.ml-book-modal .with_frm_style .frm_submit {
  display: flex;
  justify-content: center;
  margin-top: 1.25rem;
}
.ml-book-modal .with_frm_style .frm_submit button.frm_button_submit.button-029 {
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  font-family: inherit !important;
  font-size: 1.15rem !important;
  line-height: 1 !important;
}

/* Close (cross like the burger) */
.ml-book-modal__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.75rem;
  height: 2.75rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #1d1d1b;
  cursor: pointer;
  transition: rotate 0.8s var(--ml-ease);
}
.ml-book-modal__close span {
  position: absolute;
  top: calc(50% - 0.75px);
  left: 20%;
  width: 60%;
  height: 1.5px;
  background-color: currentColor;
  border-radius: 1px;
  rotate: 45deg;
}
.ml-book-modal__close span + span {
  rotate: -45deg;
}
@media (hover: hover) and (pointer: fine) {
  .ml-book-modal__close:hover {
    rotate: 90deg;
  }
}
.ml-book-modal__close:focus {
  outline: none;
}
.ml-book-modal__close:focus-visible {
  outline: 1px solid currentColor;
}

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
  :root {
    --ml-book-size: 3.25rem;  /* 52px – kept small on phones so it doesn't dominate; the text follows the size */
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .ml-book,
  .ml-book-modal,
  .ml-book-modal__backdrop,
  .ml-book-modal__panel,
  .ml-book-modal__content,
  html.ml-book-open .ml-book-modal__panel,
  html.ml-book-open .ml-book-modal__content {
    animation: none !important;
    transition-duration: 0.01s !important;
    transition-delay: 0s !important;
  }
}

/* ---------- Round "Book" link inside the page content ----------
   Any link with the class "ml-book-inline" and href="#book-samtale" (opens the modal) */
a.ml-book-inline {
  display: inline-grid;
  place-items: center;
  width: var(--ml-book-size);
  height: var(--ml-book-size);
  padding: 0.5rem;
  box-sizing: border-box;
  border-radius: 50%;
  background-color: var(--ml-book-bg);
  color: var(--ml-book-color) !important;
  font-size: calc(var(--ml-book-size) * 0.15);
  font-style: italic;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  transition: scale 0.7s var(--ml-ease), rotate 0.7s var(--ml-ease);
}
@media (hover: hover) and (pointer: fine) {
  a.ml-book-inline:hover {
    scale: 1.06;
    rotate: -6deg;
  }
}
a.ml-book-inline:active {
  scale: 0.94;
}

/* Inline "Book samtale" links in the page content are not used any more – the fixed round button follows along.
   Hides the link's text module, and the whole row when that module is all it contains */
a.ml-book-inline,
.et_pb_module:has(a.ml-book-inline),
.et_pb_row:has(a.ml-book-inline):not(:has(.et_pb_column:nth-child(2), .et_pb_module:nth-of-type(2))) {
  display: none !important;
}
