/* ============================================================================
   ReneCEO — Cal.com public booking-page CSS layer
   ----------------------------------------------------------------------------
   Served by Caddy at /_reneceo/booker.css and <link>-ed into the booking page
   HTML by the `replace` directive in compose/Caddyfile. The Cal.com image is
   NEVER modified and its source is NEVER patched: this file sits entirely in
   front of the app, at the reverse proxy.

   Scope: the public booker routes only (`/reneceo`, `/reneceo/<event>`,
   `/reneceo/<event>/embed`). Cal.com's own admin UI — /event-types, /bookings,
   /settings, /availability, /apps, /auth/* — never receives this stylesheet.

   Target: Cal.com v6.2.0
   (image calcom/cal.com:v6.2.0,
    sha256:ace3bb1219fb7306585ab9f4d94d41af7ee064c343db0498173436bbe857bd49)

   !! UPGRADE-SENSITIVE !!
   Every selector below is pinned to markup that Cal.com can change in any
   release. After ANY Cal.com version bump, re-run:
       scripts/verify-booker-css.sh
   which checks each selector logged out, in month_view and week_view, at
   1400px and 390px, and fails loudly if a selector stops matching or if the
   credit badge stops being legible. See docs/DECISIONS.md.

   THE LICENSING LINE — this is not a style choice, do not "tidy" it:
     * The overlay toggle and the owner "Need help?" button are ordinary AGPL
       UI. Nothing is licensed about them. They may be hidden.
     * The Cal.com credit badge is a COMMERCIALLY LICENSED feature
       (`users.hideBranding` is the paid switch and stays `false`). It is
       RESTYLED ONLY — smaller and muted, with clear space above. It must stay
       legible at a normal glance and clickable.
       Forbidden here, forever: display:none, visibility:hidden, opacity:0,
       font-size:0, zero/clipped size, clip-path, off-screen positioning,
       pointer-events:none, or covering it with another element.
   ============================================================================ */

/* ---------------------------------------------------------------------------
   1. "Overlay my calendar" — hidden.

   The control is gated solely by `isEmbed` in the app
   (Booker.tsx:417 `if (isEmbed) return null`), so on the direct link there is
   no configuration that removes it — see CALCOM_BOOKER_CONTROLS_REPORT.md.
   On this instance the toggle is a dead end: a logged-out click opens a
   "continue with provider" login modal for accounts prospects do not have.

   Markup (OverlayCalendarSwitch.tsx:37-72):
     div.hidden.gap-2.md:flex                      <- component root
       div.flex.items-center.gap-2.pr-2            <- row
         div                                        <- Switch wrapper (@calcom/ui)
           button[data-testid="overlay-calendar-switch"]
         label[for="overlayCalendar"]  "Overlay my calendar"
       button[data-testid="overlay-calendar-settings-button"]   (session only)
   --------------------------------------------------------------------------- */

/* Plain-selector rule: hides the control and its label even in a browser with
   no :has() support. Kept in its own rule on purpose — a selector list is
   dropped wholesale if any selector in it fails to parse. */
[data-testid="overlay-calendar-switch"],
[data-testid="overlay-calendar-settings-button"],
label[for="overlayCalendar"] {
  display: none !important;
}

/* :has() rules: also remove the wrappers, so no empty flex row / gap / pr-2
   padding is left behind in the booker header. Each in its own rule so that a
   markup change to one nesting depth cannot disable the others. */
div:has(> div > div > [data-testid="overlay-calendar-switch"]) {
  display: none !important;
}
div:has(> div > [data-testid="overlay-calendar-switch"]) {
  display: none !important;
}
div:has(> [data-testid="overlay-calendar-settings-button"]) {
  display: none !important;
}

/* ---------------------------------------------------------------------------
   2. "Need help?" — hidden.

   FINDING: this button is NOT public. Header.tsx:70-82 renders it only when
   `isMyLink && !isEmbed`, i.e. only when the signed-in user is looking at
   their own booking link, and only in month view on desktop
   (Header.tsx:65 returns null on mobile). Verified logged out at 1400px and
   390px in both layouts: zero matches, and no third-party support/chat widget
   of any kind on the page. Prospects have never seen it.

   It is hidden anyway (harmless, and it makes Rene's own view match what a
   prospect sees). The anchor has no data-testid; its href is the stable hook —
   the Button carries `href={WEBAPP_URL}/availability/troubleshoot?eventType=…`.
   --------------------------------------------------------------------------- */
a[href*="/availability/troubleshoot"] {
  display: none !important;
}

/* ---------------------------------------------------------------------------
   3. Cal.com credit badge — RESTYLED, NEVER HIDDEN.

   Markup (Booker.tsx:613-621 + PoweredBy.tsx):
     span.mb-6.mt-auto.pt-6.[&_img]:h-[15px]
       div.p-2.text-center.text-xs.sm:text-right
         a[href="https://go.cal.com/booking"].text-subtle
           img[alt="Cal.com Logo"][src=".../api/logo"]

   The stable hooks are the two constants the component is built from:
   POWERED_BY_URL (packages/lib/constants.ts:114) as the href, and the fixed
   alt text — not the Tailwind classes.

   Note: Cal.com itself only renders this badge in DESKTOP MONTH VIEW
   (`layout === MONTH_VIEW ? "block" : "hidden"`, and `layout` becomes "mobile"
   below the sm breakpoint). Where it is absent, that is Cal.com's own
   behaviour, unchanged by this file.

   Treatment: caption-sized, muted ink, clear space above, larger hit target.
   --------------------------------------------------------------------------- */

/* Clear space above the credit, so it reads as a footnote rather than chrome. */
span:has(> div > a[href="https://go.cal.com/booking"]) {
  padding-top: 2rem !important; /* 24px -> 32px */
}

/* Caption type scale on the row that owns the badge's font-size. */
div:has(> a[href="https://go.cal.com/booking"]) {
  font-size: 11px !important;
  line-height: 1.45 !important;
}

/* The credit itself. Muted, not invisible: opacity 0.8 composites the #292929
   wordmark to ~rgb(84,84,84) on white — about 7.7:1 against the page, well
   above WCAG AA. Full opacity on hover/focus. The padding enlarges the click
   target beyond the 12px-tall wordmark. */
a[href="https://go.cal.com/booking"] {
  display: inline-block !important;
  padding: 4px 2px !important;
  font-size: 11px !important;
  line-height: 1.45 !important;
  color: rgb(113, 113, 122) !important;
  opacity: 0.8 !important;
  transition: opacity 120ms ease-in-out;
}

a[href="https://go.cal.com/booking"]:hover,
a[href="https://go.cal.com/booking"]:focus-visible {
  opacity: 1 !important;
}

/* Smaller wordmark — 15px -> 12px tall. Cal.com's own base class in
   PoweredBy.tsx is h-[10px]; 12px is deliberately larger than that floor. */
a[href="https://go.cal.com/booking"] img[alt="Cal.com Logo"] {
  height: 12px !important;
  width: auto !important;
}
