/*
 * Aamin AI (HAFR workspace): lib/book.css, the booking pop-up, its congrats view and the "Book now / Email us" row
 * (v7, 2026-11-28; lib/book.js builds the dialog). Linked by build.mjs and pages/build-pages.mjs on every page.
 *
 *   .hf-book-row       the quiet action row under a price: Book now (an ink button, [data-book]) + Email us (mailto)
 *   .hf-book           the <dialog>: a solid white card over a plain dim backdrop (no blur, no glass); a bottom
 *                      sheet below 768 px with a safe-area-aware bottom padding
 *   .hf-book__view--done   the congrats view: check mark, a burst of brand dots, the six agents
 * The moving gradient ring on the Book buttons (.hf-btn--alive) is lib/alive.css, never this file.
 * Logical properties only, so Arabic mirrors by itself.
 */

/* NEW TOKENS ------------------------------------------------------------------------------------- */
:root {
  --hf-book-w: 560px;
  --hf-book-pad: 32px;
  --hf-book-dim: rgb(11 13 16 / 0.52);
  --hf-book-ring: rgb(11 13 16 / 0.18);
  --hf-book-sea: var(--hf-color-sea-600, #006776);
  --hf-book-mist: #7FB4BC;           /* a light sea for the burst's third dot */
  --hf-book-amber: var(--hf-color-seal, #E9A22F); /* the amber of the logo's eyes */
}

/* The action row under a price -------------------------------------------------------------------- */
.hf-book-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; /* v7-fix: 12 px between the tag and Book now when they stack */
}
.hf-book-row .hf-btn { flex: none; }
.hf-book-row__mail {
  display: inline-flex; align-items: center; gap: 8px; min-block-size: 44px; padding-inline: 2px;
  font-size: 15px; font-weight: 500; line-height: 1.2; color: var(--hf-color-text-1); white-space: nowrap;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px;
  text-decoration-color: rgb(11 13 16 / 0.28);
  transition: text-decoration-color var(--hf-dur-2) var(--hf-ease-out);
}
.hf-book-row__mail:hover { text-decoration-color: currentColor; }
.hf-book-row__mail .hf-icon { flex: none; font-size: 18px; color: var(--hf-book-sea); }
:lang(ar) .hf-book-row__mail { font-size: 15.5px; }

/* The pricing tag (v7 pricing, 2026-11-28, the founder: "for pricing we will not show now but a tag to contact to
   know the pricing"): where a price stood, a sea-tinted pill with the price-tag icon that opens an email whose subject
   is "Pricing: <offer>". Written by sections/process and sections/start, and by pages/templates/_book.mjs priceTag(). */
.hf-price-tag {
  /* v7-fix: 44 px, the house touch-target minimum, on every pointer (it was 40 px except on touch screens) */
  display: inline-flex; align-items: center; gap: 8px; min-block-size: 44px; padding: 8px 16px 8px 12px;
  border-radius: var(--hf-radius-pill, 999px);
  background: rgb(0 135 155 / 0.08); box-shadow: inset 0 0 0 1px rgb(0 103 118 / 0.30);
  font-size: 14.5px; font-weight: 600; line-height: 1.2; color: var(--hf-book-sea); white-space: nowrap;
  text-decoration: none;
  transition: background-color var(--hf-dur-2) var(--hf-ease-out), box-shadow var(--hf-dur-2) var(--hf-ease-out);
}
.hf-price-tag:hover { background: rgb(0 135 155 / 0.15); box-shadow: inset 0 0 0 1px rgb(0 103 118 / 0.55); }
.hf-price-tag .hf-icon { flex: none; font-size: 18px; }
[dir="rtl"] .hf-price-tag { padding: 8px 12px 8px 16px; }
:lang(ar) .hf-price-tag { font-size: 15px; letter-spacing: 0; }
@media (max-width: 30rem) { .hf-price-tag { white-space: normal; } }
/* (v7-fix: where the tag stands, it is the row's email link, so the row is the tag and Book now on one line; the
   old break before a separate Email us is no longer written by _book.mjs) */
.hf-book-row__break { flex-basis: 100%; block-size: 4px; }

/* The page behind does not scroll while the pop-up is open -------------------------------------- */
html[data-book-open] { overflow: hidden; scrollbar-gutter: stable; }

/* The dialog --------------------------------------------------------------------------------------- */
.hf-book {
  position: fixed; inset: 0; margin: auto;
  inline-size: min(var(--hf-book-w), calc(100% - 32px)); max-inline-size: none;
  block-size: fit-content; max-block-size: calc(100dvh - 32px);
  padding: 0; border: 0; background: transparent; color: var(--hf-color-text-1);
  overflow: visible;
}
.hf-book:not([open]) { display: none; }
.hf-book::backdrop { background: var(--hf-book-dim); animation: hf-book-in var(--hf-dur-3) var(--hf-ease-out) both; }
.hf-book[data-closing]::backdrop { animation: hf-book-out 200ms ease-in both; }
@keyframes hf-book-in { from { opacity: 0; } }
@keyframes hf-book-out { to { opacity: 0; } }

.hf-book__card {
  position: relative;
  max-block-size: inherit; overflow: auto; overscroll-behavior: contain;
  padding: var(--hf-book-pad);
  border-radius: var(--hf-radius-lg, 22px);
  background: #FFFFFF;
  box-shadow: var(--hf-shadow-3);
}
/* v7-fix: the close button sticks to the card's top corner while the card scrolls (a 320 px phone after a failed
   submit), on a solid white circle so text scrolling under it never shows through. It keeps its old place: 14 px
   from the card's top and end edges (10 px on phones), taken out of the content's way by its negative margins. */
.hf-book__close {
  --close-at: 14px;
  /* a sticky offset counts from inside the scroller's padding, hence the padding is taken off */
  position: sticky; z-index: 2; inset-block-start: calc(var(--close-at) - var(--hf-book-pad-top, var(--hf-book-pad)));
  display: grid; place-items: center; inline-size: 44px; block-size: 44px;
  margin-block: calc(var(--close-at) - var(--hf-book-pad-top, var(--hf-book-pad))) calc(var(--hf-book-pad-top, var(--hf-book-pad)) - var(--close-at) - 44px);
  margin-inline: auto calc(var(--close-at) - var(--hf-book-pad-x, var(--hf-book-pad)));
  padding: 0; border: 0; border-radius: 50%; background: #FFFFFF; color: var(--hf-color-text-2);
  cursor: pointer; transition: background-color var(--hf-dur-2) var(--hf-ease-out), color var(--hf-dur-2) var(--hf-ease-out);
}
.hf-book__close:hover { background: var(--hf-surface-inset, #F5F6F3); color: var(--hf-color-text-1); }
.hf-book__close:focus-visible { outline-offset: 0; border-radius: 50%; }
.hf-book__close .hf-icon { font-size: 22px; }

/* the head: the offer chip, "Book a call", the old contact line */
.hf-book__head { display: grid; justify-items: start; gap: 6px; padding-inline-end: 44px; margin-block-end: 22px; }
.hf-book__chip {
  display: inline-block; max-inline-size: 100%; margin: 0 0 8px; padding: 6px 12px;
  border-radius: var(--hf-radius-pill); background: var(--hf-surface-inset, #F5F6F3); box-shadow: var(--hf-ring-soft);
  font-size: 13.5px; font-weight: 500; line-height: 1.4; color: var(--hf-color-text-2);
}
.hf-book__chip-k { color: var(--hf-color-text-3); }
.hf-book__chip-offer { font-weight: 600; color: var(--hf-color-text-1); }
.hf-book__chip[hidden] { display: none; }
.hf-book__title {
  margin: 0; font-size: 28px; font-weight: 650; line-height: 1.15; letter-spacing: -0.025em; color: var(--hf-color-text-1);
}
.hf-book__line { margin: 0; font-size: 17px; line-height: 1.5; color: var(--hf-color-text-2); }

/* the form */
.hf-book__form { display: grid; gap: 16px; }
.hf-book__req { margin: 0 0 2px; font-size: 13.5px; line-height: 1.3; color: var(--hf-color-text-2); }
.hf-book__names { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 14px; }
.hf-book__field--first { grid-column: 1 / -1; }
.hf-book__field { display: grid; gap: 7px; min-inline-size: 0; }
.hf-book__label { font-size: 14.5px; font-weight: 550; line-height: 1.3; color: var(--hf-color-text-1); }
.hf-book__star { color: var(--hf-color-danger, #B4271C); font-weight: 650; }
.hf-book__opt { font-weight: 400; color: var(--hf-color-text-3); }
.hf-book__input {
  inline-size: 100%; min-inline-size: 0; block-size: 48px; padding-inline: 14px;
  border: 0; border-radius: 12px; background: #FFFFFF;
  box-shadow: inset 0 0 0 1px var(--hf-book-ring);
  font: inherit; font-size: 16px; color: var(--hf-color-text-1);
  transition: box-shadow var(--hf-dur-2) var(--hf-ease-out), background-color var(--hf-dur-2) var(--hf-ease-out);
}
.hf-book__input:hover { box-shadow: inset 0 0 0 1px rgb(11 13 16 / 0.32); }
.hf-book__input:focus { outline: none; }
.hf-book__input:focus-visible {
  outline: var(--hf-focus-width, 2px) solid var(--hf-color-focus, #2546C4); outline-offset: 2px;
  box-shadow: inset 0 0 0 1px rgb(11 13 16 / 0.32); border-radius: 12px;
}
.hf-book__input[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--hf-color-danger, #B4271C); background: var(--hf-color-danger-tint, #F8ECEB); }
[dir="rtl"] .hf-book__input[dir="ltr"] { text-align: right; }
.hf-book__err {
  display: flex; align-items: flex-start; gap: 6px; margin: 0;
  font-size: 14px; font-weight: 500; line-height: 1.4; color: var(--hf-color-danger, #B4271C);
}
.hf-book__err[hidden] { display: none; }
.hf-book__err .hf-icon { flex: none; font-size: 17px; margin-block-start: 1px; }

.hf-book__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-block-start: 8px; }
.hf-book__proto:empty { display: none; }
.hf-book__proto { margin: 0; font-size: 13px; line-height: 1.4; color: var(--hf-color-text-3); }
.hf-book__submit[data-pending] { cursor: progress; }
.hf-book__submit[data-pending] .hf-btn__orb { position: relative; }
.hf-book__submit[data-pending] .hf-btn__orb .hf-icon { opacity: 0; }
.hf-book__submit[data-pending] .hf-btn__orb::after {
  content: ""; position: absolute; inset: 11px; border-radius: 50%;
  border: 2px solid rgb(11 13 16 / 0.16); border-block-start-color: var(--hf-color-inverse, #0B0D10);
  animation: hf-book-spin 0.8s linear infinite;
}
@keyframes hf-book-spin { to { transform: rotate(1turn); } }

/* The congrats view ---------------------------------------------------------------------------- */
.hf-book__view--done { display: grid; justify-items: center; text-align: center; padding-block-start: 4px; }
.hf-book__view[hidden] { display: none; }
.hf-book__party {
  position: relative; inline-size: 100%; block-size: 216px; margin-block-end: 18px; /* v7-fix: 204 → 216 for the larger agents */
  pointer-events: none;
}
/* the check, the ring of dots and the burst share one centre */
/* (centred, so physical left: 50% is the same in both directions) */
.hf-book__check, .hf-book__halo, .hf-book__burst {
  position: absolute; left: 50%; inset-block-start: 66px;
}
.hf-book__check { z-index: 2; inline-size: 64px; block-size: 64px; margin: -32px 0 0 -32px; }
.hf-book__check svg { display: block; inline-size: 100%; block-size: 100%; overflow: visible; }
.hf-book__check-disc { fill: var(--hf-book-sea); }
.hf-book__check-mark { fill: none; stroke: #FFFFFF; stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; }
.hf-book__halo, .hf-book__burst { z-index: 1; inline-size: 0; block-size: 0; }
.hf-book__dot {
  position: absolute; top: calc(var(--d) / -2); left: calc(var(--d) / -2);
  inline-size: var(--d); block-size: var(--d); border-radius: 50%;
  will-change: transform, opacity;
}
.hf-book__dot--sea { background: var(--hf-book-sea); }
.hf-book__dot--mist { background: var(--hf-book-mist); }
.hf-book__dot--amber { background: var(--hf-book-amber); }
.hf-book__dot--burst { opacity: 0; }
.hf-book__dot--halo { transform: rotate(var(--a)) translateY(-50px); opacity: 0.85; will-change: auto; }
/* the six, on a gentle arc at the foot of the stage */
.hf-book__cast {
  position: absolute; inset-inline: 0; inset-block-end: 0;
  display: flex; justify-content: center; align-items: flex-end; gap: 12px;
}
.hf-book__agent { display: inline-block; line-height: 0; transform-origin: 50% 100%; }
.hf-book__agent:nth-child(2), .hf-book__agent:nth-child(5) { margin-block-end: 10px; }
.hf-book__agent:nth-child(3), .hf-book__agent:nth-child(4) { margin-block-end: 16px; }
/* the headline takes focus so a screen reader reads it; it is not a control, so it shows no ring */
.hf-book__thanks { outline: none; text-wrap: balance; overflow-wrap: anywhere; }
.hf-book__thanks:focus, .hf-book__thanks:focus-visible { outline: none; }
.hf-book__next { max-inline-size: 40ch; margin-block-start: 8px; text-wrap: pretty; }
.hf-book__addr { font-weight: 600; color: var(--hf-color-text-1); overflow-wrap: anywhere; }
.hf-book__done { margin-block-start: 24px; }

/* Arabic */
:lang(ar) .hf-book__title { letter-spacing: 0; line-height: 1.4; font-weight: 700; }
:lang(ar) .hf-book__line, :lang(ar) .hf-book__req, :lang(ar) .hf-book__err { line-height: 1.7; }
:lang(ar) .hf-book__label { font-size: 15px; line-height: 1.5; }
:lang(ar) .hf-book__chip { font-size: 14px; line-height: 1.6; }

/* Phones: a bottom sheet ------------------------------------------------------------------------ */
@media (max-width: 47.99rem) {
  :root { --hf-book-pad: 22px; }
  .hf-book {
    inset: auto 0 0 0; margin: 0; inline-size: 100%;
    max-block-size: calc(100dvh - 12px);
  }
  .hf-book__card {
    --hf-book-pad-top: 24px; --hf-book-pad-x: 20px;
    border-radius: 22px 22px 0 0;
    padding: var(--hf-book-pad-top) var(--hf-book-pad-x) calc(20px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -10px 40px -12px rgb(16 24 40 / 0.35);
  }
  .hf-book__close { --close-at: 10px; }
  .hf-book__head { margin-block-end: 18px; }
  .hf-book__title { font-size: 25px; }
  .hf-book__line { font-size: 16px; }
  .hf-book__names { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .hf-book__form { gap: 14px; }
  .hf-book__foot .hf-book__submit, .hf-book__done { inline-size: 100%; justify-content: space-between; }
  .hf-book__party { block-size: 176px; }
  .hf-book__check, .hf-book__halo, .hf-book__burst { inset-block-start: 50px; }
  .hf-book__cast { gap: 6px; } /* v7-fix: 6 px, so six 52 px agents fit a 390 px phone (book.js shrinks them below that) */
  .hf-book__agent:nth-child(2), .hf-book__agent:nth-child(5) { margin-block-end: 8px; }
  .hf-book__agent:nth-child(3), .hf-book__agent:nth-child(4) { margin-block-end: 12px; }
}

/* Reduced motion: no backdrop fade, no spinner turn (the composed still is lib/book.js's) */
@media (prefers-reduced-motion: reduce) {
  .hf-book::backdrop, .hf-book[data-closing]::backdrop { animation: none; }
  .hf-book__submit[data-pending] .hf-btn__orb::after { animation: none; }
}
:root[data-reduced] .hf-book::backdrop { animation: none; }
:root[data-reduced] .hf-book__submit[data-pending] .hf-btn__orb::after { animation: none; }
