/* ============================================================
   inbithaq_dashboard - inb-dir.css (ARSHAD-190)
   Direction-aware and small-screen rules for the Inbithaq theme (school 25).
   Linked once in partials/head.blade.php, after page-inline.css.
   - app.css is a frozen Tailwind v4 build (INV-C02-86): a new utility class
     written in a blade has no rule, so the rules here use selectors.
   - Logical properties only (inline-size, padding-inline, gap): one rule
     serves Arabic (rtl) and English (ltr). No left/right, no per-language copy.
   - Unlayered on purpose: it outranks app.css, whose utilities sit in @layer.
   ============================================================ */

/* ---- Phase 1: the header row fits from 320px up -------------------------
   Measured before (guest, home): the row needs 370px in Arabic and 361px in
   English (menu 40 + logo 128 + language 67 + sign-up 79, gaps 16, padding 32),
   so at 320/360 the page scrolled sideways in Arabic and the sign-up button was
   cut in English. Below 400px: smaller logo, tighter gaps and padding; below
   360px the sign-up button leaves the row (the menu carries it, interactions.js). */
@media (max-width: 399.98px) {
  header > div:last-child {
    gap: 0.5rem;
    padding-inline: 0.75rem;
  }
  header > div:last-child > * {
    min-inline-size: 0;
  }
  header > div:last-child > a:first-of-type img {
    block-size: 3rem;                    /* logo 64px -> 48px */
  }
  header > div:last-child > .ms-auto {
    gap: 0.375rem;
  }
}
@media (max-width: 359.98px) {
  header > div:last-child a[href$="/inbithaq/signup"] {
    display: none;
  }
}

/* The guest's login / sign-up rows in the mobile menu (built by interactions.js
   mobileMenu()): each shows only while the header row hides its button
   (login: below 640px, the row's "hidden sm:inline-flex"; sign-up: below 360px). */
.inb-menu-auth {
  display: block;
  padding-block: 11px;
  padding-inline: 2px;
  font-size: 14px;
  font-weight: 700;
  color: #A63A4A;
  text-decoration: none;
  border-block-end: 1px solid rgba(27, 43, 75, 0.07);
}
@media (min-width: 640px) {
  .inb-menu-auth[data-inb-auth="login"] { display: none; }
}
@media (min-width: 360px) {
  .inb-menu-auth[data-inb-auth="signup"] { display: none; }
}

/* ---- Phase 2 base: the page's direction is its dir attribute ------------
   The frozen app.css sets html{direction:rtl} and body{direction:rtl} whatever
   the dir attribute says; only the layout's shell div carries dir="ltr" in
   English. Anything outside that div (on some pages the floating buttons, the
   toasts, the window's scrollbar) was laid out right-to-left in English, so
   logical properties resolved the wrong way there. */
html[dir="ltr"],
html[dir="ltr"] > body {
  direction: ltr;
}

/* ---- Phase 2a: the floating buttons, one stack on the inline-end side -----
   Every page carries its own copy of three fixed buttons (about 270 pages, two
   placements: WhatsApp bottom-24 or bottom-5 at the left, "toggle mode" bottom-5
   left-5, home bottom-6 right-6), so they sat on both sides of a phone over the
   content. They are found by what they are, not by their classes, and stacked on
   the inline end (left in Arabic, right in English): WhatsApp at the bottom, home
   above it, the mode button on top. Smaller on phones; the iPhone home bar
   (env(safe-area-inset-bottom)) is kept clear; the footer gets bottom room so
   its last line is never under the stack. */
:root {
  --inb-fab: 3.25rem;
  --inb-fab-gap: 0.625rem;
  --inb-fab-edge: 1.25rem;
  --inb-fab-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
}
@media (max-width: 639.98px) {
  :root {
    --inb-fab: 2.75rem;                  /* 44px: still a full tap target */
    --inb-fab-gap: 0.5rem;
    --inb-fab-edge: 0.75rem;
    --inb-fab-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  }
}
a.fixed[href^="https://wa.me/"],
a.fixed:has(> svg.lucide-house),
div.fixed:has(> button > svg.lucide-repeat) {
  inset-inline-start: auto;
  inset-inline-end: var(--inb-fab-edge);
  inset-block-start: auto;
}
a.fixed[href^="https://wa.me/"],
a.fixed:has(> svg.lucide-house),
div.fixed:has(> button > svg.lucide-repeat) > button {
  inline-size: var(--inb-fab);
  block-size: var(--inb-fab);
}
a.fixed[href^="https://wa.me/"] { inset-block-end: var(--inb-fab-bottom); }
a.fixed:has(> svg.lucide-house) { inset-block-end: calc(var(--inb-fab-bottom) + var(--inb-fab) + var(--inb-fab-gap)); }
div.fixed:has(> button > svg.lucide-repeat) { inset-block-end: calc(var(--inb-fab-bottom) + 2 * (var(--inb-fab) + var(--inb-fab-gap))); }
a.fixed[href^="https://wa.me/"] > svg,
a.fixed:has(> svg.lucide-house) > svg,
div.fixed:has(> button > svg.lucide-repeat) svg {
  inline-size: calc(var(--inb-fab) * 0.46);
  block-size: calc(var(--inb-fab) * 0.46);
}
/* room under the footer's last line for the stack (3 buttons, 2 gaps, its bottom offset) */
body:has(a.fixed[href^="https://wa.me/"]) footer {
  padding-block-end: calc(var(--inb-fab-bottom) + 3 * var(--inb-fab) + 2 * var(--inb-fab-gap) + 0.5rem);
}

/* ---- Phase 2b: the home slider (index.blade.php #ann-carousel) ------------
   The arrows were placed by physical side (prev right-3, next left-3): right in
   Arabic, swapped in English. They now sit by logical side, and below 768px
   they leave the text and sit on the dots' line at the slide's foot. The slide's
   diagonal background takes its angle times --inb-x (index.blade.php), which is
   -1 in a left-to-right page, so the diagonal mirrors with the text. */
:root, [dir="rtl"] { --inb-x: 1; }
[dir="ltr"] { --inb-x: -1; }
#ann-prev { inset-inline-start: 0.375rem; inset-inline-end: auto; }   /* clear of the text's 48px padding from 768px */
#ann-next { inset-inline-end: 0.375rem; inset-inline-start: auto; }
@media (max-width: 767.98px) {                                          /* below md the text runs the slide's full width */
  #ann-carousel .ann-slide > div.relative.grid {
    padding-block-end: 4.25rem;          /* the arrows' and dots' line */
  }
  #ann-prev,
  #ann-next {
    inset-block-start: auto;
    inset-block-end: 0.625rem;
    translate: none;
  }
  #ann-carousel > div:has(> .ann-dot) {
    inset-block-end: 1.75rem;            /* dots on the arrows' centre line */
  }
}

/* ---- Phase 2c: arrow icons point forward in English ----------------------
   The pages were drawn right-to-left first: a "forward" arrow points left
   (lucide arrow-left / chevron-left, or arrow-right turned by rotate-180).
   In a left-to-right box (:dir(ltr), so the worksheets that carry their own
   dir="rtl" stay as they are) every horizontal arrow is mirrored, and the hover
   nudge moves the other way. Left out: arrows inside absolutely placed scroll
   buttons (they point at their own screen side), except the slider arrows,
   which now sit by logical side (2b). */
:is(.lucide-arrow-left, .lucide-arrow-right, .lucide-chevron-left, .lucide-chevron-right):dir(ltr):not(button.absolute > svg),
:is(#ann-prev, #ann-next) > svg:dir(ltr) {
  scale: -1 1;
}
.group:hover .group-hover\:-translate-x-1:dir(ltr) { --tw-translate-x: calc(var(--spacing) * 1); }
.group:hover .group-hover\:translate-x-1:dir(ltr) { --tw-translate-x: calc(var(--spacing) * -1); }

/* ---- Phase 5a: no text under 12px ------------------------------------------
   The export set captions, card meta, prices' currency, the footer and the
   header's language / currency pills at 8-11.5px (about 11,000 class uses).
   Every one of those size classes reads 12px now, everywhere; nothing above
   12px moves. The only breakpoint variant of them in the theme is
   md:text-[11px] (15 uses, always beside text-[10px]), so a larger size set at a
   breakpoint is never pulled down by this rule. The few small sizes written in
   page-inline.css and in two pages' own <style> follow (":root" so the later
   <style> of the page does not win). */
:is(.text-\[8px\], .text-\[9px\], .text-\[10px\], .text-\[10\.5px\], .text-\[11px\], .text-\[11\.5px\], .md\:text-\[11px\]),
:is(.inb-badge, .inb-sup-title, .inb-sup-noslots, .inb-sup-c-note, .inb-countdown--card, .inb-ls-tag, .inb-mc-strip, .inb-mc-bar-text),
.inb-countdown--card .inb-countdown-u b,
:root :is(.inbn-when, .inb-pf-err),
:root :is(.pme-card__tag, .pme-modal__eyebrow, .pme-opt__sold, .pme-brand-pill) {
  font-size: 0.75rem;                    /* the last line: the shared meeting-events page's own <style>, on this school only */
}

/* ---- Phase 5b: body copy at least 14px on phones ---------------------------
   Below 640px the paragraphs and list items written at 12-13.5px (and the
   small ones of 5a) read 14px. Labels stay as they are: a line with letter
   spacing, capitals or a heavier weight is a label, not body copy. */
@media (max-width: 639.98px) {
  :is(p, li, dd, blockquote):is(.text-xs, .text-\[12px\], .text-\[12\.5px\], .text-\[13px\], .text-\[13\.5px\], .text-\[8px\], .text-\[9px\], .text-\[10px\], .text-\[10\.5px\], .text-\[11px\], .text-\[11\.5px\]):not([class*="tracking-"], .uppercase, .font-medium, .font-semibold, .font-bold, .font-extrabold) {
    font-size: 0.875rem;
  }
  :root .pme-card__desc {                /* the meeting-events cards' text (13.5px in that page's <style>) */
    font-size: 0.875rem;
  }
}

/* ---- Phase 5c: tap targets at least 40px tall on touch screens ------------
   Only where the main pointer is a finger (pointer: coarse); a mouse keeps the
   compact look. Links, buttons, menus' rows, fields and the footer's links get
   a 40px minimum height. A link that is an inline box (no display class of its
   own, holding text and icons only) becomes inline-flex so the height applies;
   a link inside running text (a paragraph, a label) is left inline: the
   inline-link exception of WCAG 2.5.8. The slider's dots keep their look and
   get a 40px hit area from a transparent ::before (their inline "background"
   shorthand rules out padding with background-clip). */
@media (pointer: coarse) {
  :is(a[href], button, summary, select, [role="button"], input:not([type="checkbox"], [type="radio"], [type="range"], [type="hidden"], [type="file"])):not(.ann-dot, .sr-only, p a, label a) {
    min-block-size: 2.5rem;
  }
  /* left out: any link with a display class of its own, at any breakpoint ("lg:hidden", "sm:inline-flex"...) or
     the hidden attribute, so this rule never shows what the page hides (it is unlayered: it would outrank them) */
  a[href]:not(.flex, .inline-flex, .block, .grid, .inline-block, .contents, .absolute, .fixed, .sr-only, [hidden], [class*="hidden"], [class*=":flex"], [class*=":inline"], [class*=":block"], [class*=":grid"], [class*=":contents"], p a, label a):not(:has(div, p, img, picture, h1, h2, h3, h4, ul, section, article)) {
    display: inline-flex;
    align-items: center;
  }
  /* a flex link or button with no alignment of its own centres its label in the taller box (e.g. the header's
     "sm:inline-flex" Login pill) */
  :is(a[href], button):is(.flex, .inline-flex, [class*=":flex"], [class*=":inline-flex"]):not([class*="items-"], [class*="flex-col"]) {
    align-items: center;
  }
  /* a field drawn inside a bordered padded box (the filters' "rounded-2xl border px-3 py-2"): the box is what the
     eye sees, so it drops its block padding and the field's 40px sets its height (42px with the border) */
  :is(div, label)[class*="border"][class*="py-"]:has(> :is(select, input:not([type="checkbox"], [type="radio"], [type="hidden"])), > details > summary) {
    padding-block: 0;
  }
  /* the supervision filters' multi-choice field (page-inline.css .inb-sup-ms, line-height 24px, ellipsis): its label
     centred in the 40px row by its line height, so the ellipsis stays */
  :root .inb-sup-ms > summary {
    line-height: 2.5rem;
  }
  /* a link inside running text stays inline; padding on an inline box grows its hit area (about 40px) and moves
     no line; only links with no background of their own, so nothing visible changes */
  :is(p, label) a[href]:not([class*="bg-"], .flex, .inline-flex, .block, .inline-block, .grid) {
    padding-block: 0.75rem;
  }
  /* the footer's link lists: the 40px rows replace the 8px gaps between them */
  footer :is(.space-y-1, .space-y-1\.5, .space-y-2, .space-y-3) > li {
    margin-block: 0;
  }
  /* the header's currency and language pills sit side by side, not stacked */
  header div.flex-col:has(> [data-inb-dd][data-inb-live]) {
    flex-direction: row;
  }
  .ann-dot {
    position: relative;
  }
  .ann-dot::before {
    content: "";
    position: absolute;
    inset-block: -1.0625rem;             /* 6px dot + 2 x 17px = 40px */
    inset-inline: -0.25rem;              /* half of the 8px gap on each side */
  }
}
