/*
Theme Name: OfekVisa
Theme URI: https://ofekvisa.co.il
Author: אופק ויזה
Description: Block theme for אופק ויזה — RTL-first Hebrew with an English (/en/) mirror. Built to the CWV budget: LCP <2.0s, CLS <0.05, INP <150ms.
Version: 1.0.0
Requires at least: 6.5
Tested up to: 7.0
Requires PHP: 8.0
License: GPL-2.0-or-later
Text Domain: ofekvisa
*/

/* ---------------------------------------------------------------
   RTL RULES — see docs/07-wireframes-and-cro.md §0
   The sticky WhatsApp button is NOT mirrored. Thumb reach is
   physical, not linguistic. Mirroring it to bottom-left in Hebrew
   is the most common Israeli-build error and it costs taps.
   --------------------------------------------------------------- */

/* Latin/numeric tokens inside RTL text.
   Without this, "B1/B2" renders as "B2/B1". Real bug, not cosmetic. */
bdi,
.ltr-token {
  direction: ltr;
  unicode-bidi: isolate;
}

/* Phone and email inputs: LTR content, right-aligned in RTL. */
input[type="tel"],
input[type="email"],
input[type="url"],
input[type="number"] {
  direction: ltr;
  text-align: right;
}
[dir="ltr"] input[type="tel"],
[dir="ltr"] input[type="email"],
[dir="ltr"] input[type="url"],
[dir="ltr"] input[type="number"] {
  text-align: left;
}

/* --- Sticky conversion bar ------------------------------------- */
.ofek-sticky {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 900;
  display: flex;
  gap: 1px;
  transform: translateY(110%);
  transition: transform 180ms ease-out;
  /* height reserved by --ofek-sticky-h on body: prevents CLS */
}
.ofek-sticky.is-visible { transform: translateY(0); }
.ofek-sticky.is-hidden  { transform: translateY(110%); }

.ofek-sticky a {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 56px;
  font-weight: 600;
  text-decoration: none;
  color: #fff;
  font-size: 1rem;
}
.ofek-sticky .ofek-wa   { background: var(--wp--preset--color--whatsapp, #25D366); color: #06301A; }
.ofek-sticky .ofek-tel  { background: var(--wp--preset--color--primary, #1B2A4A); }

/* FAB variant for TOFU pages — bottom-RIGHT in both directions. */
.ofek-fab {
  position: fixed;
  bottom: 1rem;
  right: 1rem;   /* deliberately not `inset-inline-end` */
  left: auto;
  z-index: 900;
  width: 56px; height: 56px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--wp--preset--color--whatsapp, #25D366);
  box-shadow: 0 4px 14px rgba(0,0,0,.28);
  opacity: 0; visibility: hidden;
  transition: opacity 180ms ease-out;
}
.ofek-fab.is-visible { opacity: 1; visibility: visible; }

/* Body padding so the bar never covers the footer disclaimer. */
body.has-sticky-cta { padding-bottom: var(--ofek-sticky-h, 56px); }

/* --- Trust + legal --------------------------------------------- */
.ofek-trust-strip {
  display: flex; flex-wrap: wrap; gap: .5rem 1.25rem;
  font-size: .875rem; color: var(--wp--preset--color--muted, #667085);
}
.ofek-disclaimer {
  font-size: .875rem;
  line-height: 1.6;
  color: var(--wp--preset--color--muted, #667085);
  border-inline-start: 3px solid var(--wp--preset--color--primary, #1B3A5C);
  padding-inline-start: 1rem;
}

/* --- Byline ----------------------------------------------------- */
.ofek-byline { font-size: .9rem; color: var(--wp--preset--color--muted, #667085); }
.ofek-byline strong { color: var(--wp--preset--color--contrast, #101828); }

/* --- Media ------------------------------------------------------ */
img, video, iframe { max-width: 100%; height: auto; }

/* Wide content scrolls inside itself; the page body never does. */
.wp-block-table,
.ofek-scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* YouTube facade — avoids ~1MB of iframe JS on load (CWV budget). */
.ofek-video-facade {
  position: relative; aspect-ratio: 16/9; cursor: pointer;
  background: #000 center/cover no-repeat;
}
.ofek-video-facade::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 68px; height: 48px; border-radius: 12px;
  background: rgba(0,0,0,.75);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}
.ofek-video-facade iframe { position: absolute; inset: 0; width: 100%; height: 100%; }

/* --- Focus visibility (WCAG 2.4.7) ------------------------------ */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--wp--preset--color--primary, #1B3A5C);
  outline-offset: 2px;
  border-radius: 2px;
}
/* Sticky bar sits on a coloured background — needs a light ring. */
.ofek-sticky a:focus-visible,
.ofek-fab:focus-visible {
  outline: 3px solid #fff;
  outline-offset: -5px;
}

.skip-link:focus {
  position: fixed; inset-block-start: 8px; inset-inline-start: 8px;
  z-index: 1000; padding: .75rem 1rem; background: #fff;
}

@media (prefers-reduced-motion: reduce) {
  .ofek-sticky, .ofek-fab { transition: none; }
}

