/* ---------------------------------------------------------------------------
   AllVia website — the styling Tailwind's utility classes cannot express:
   keyframes, direction-aware typography, and the long-form prose used by the
   policy pages.
   ------------------------------------------------------------------------ */

html, body { margin: 0; padding: 0; height: auto; overflow-x: hidden; }
body { overscroll-behavior: auto; }

::-webkit-scrollbar { display: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Arabic gets its own face; the Material glyphs are mirrored with it, except
   the ones that are symbols rather than directions. */
html[dir="rtl"] { font-family: 'IBM Plex Sans Arabic', sans-serif !important; }
html[dir="rtl"] .font-body-md,
html[dir="rtl"] .font-body-lg,
html[dir="rtl"] .font-label-md,
html[dir="rtl"] .font-headline-md,
html[dir="rtl"] .font-headline-lg,
html[dir="rtl"] .font-display-lg,
html[dir="rtl"] .font-headline-lg-mobile { font-family: 'IBM Plex Sans Arabic', sans-serif !important; }
html[dir="rtl"] .material-symbols-outlined { transform: scaleX(-1); }
html[dir="rtl"] .material-symbols-outlined.no-flip { transform: scaleX(1); }

/* --- The announcement bar's hold on the header ---------------------------
   Two custom properties, both written by partials/topbar.php and both zero
   when there is no bar — which is why the rules below can be unconditional.

   --av-topbar-shift  how far down the window the header starts. Fixed at the
                      bar's height while the bar is pinned; wound down to zero
                      by the bar's own script while it scrolls away.
   --av-topbar-pin    the same height, but only while the bar is pinned — a bar
                      that leaves with the page is not covering an anchor by
                      the time the page has finished scrolling to it.
   ---------------------------------------------------------------------- */
:root { --av-topbar-shift: 0px; --av-topbar-pin: 0px; }

#site-header { top: var(--av-topbar-shift); }

/* Anchored sections have to clear the fixed 80px header when jumped to. */
[id] { scroll-margin-top: calc(96px + var(--av-topbar-pin)); }

/* --- Layout -------------------------------------------------------------- */

/* Every section's content is boxed to the same width and gutter. Only the
   header opts out: a bar pinned to the top of the window reads as part of the
   window rather than as part of the page, so it runs the full width. */
.av-container {
  width: 100%;
  max-width: var(--av-container, 1400px);
  margin-inline: auto;
  padding-inline: 16px;
}
@media (min-width: 1024px) {
  .av-container { padding-inline: 64px; }
}

/* A strip that scrolls sideways still starts and ends on the container edge,
   but is allowed to run past it while scrolling rather than being clipped. */
.av-container--flush { padding-inline: 0; }
.av-container--flush > .av-rail { padding-inline: 16px; }
@media (min-width: 1024px) {
  .av-container--flush > .av-rail { padding-inline: 64px; }
}

/* --- Frosted panels ------------------------------------------------------ */

/* These were bg-white/60 border-white/60 in the markup, which is exactly right
   in light mode and a sheet of glare in dark mode. Naming them means one
   variable changes the whole set. */
.av-glass        { background-color: var(--av-glass); border-color: var(--av-glass-border); }
.av-glass-strong { background-color: var(--av-glass-strong); border-color: var(--av-glass-border); }
.av-glass-hover:hover { background-color: var(--av-glass-hover); }

/* --- Motion ------------------------------------------------------------- */

@keyframes fade-in-up { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade-in    { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes float      { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-15px) rotate(1deg); } }

.animate-fade-in-up { animation: fade-in-up 1s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.animate-fade-in    { animation: fade-in 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.animate-float      { animation: float 6s ease-in-out infinite; }

/* Hidden until scrolled into view — but only when there is JavaScript to
   reveal it again, otherwise the content would never appear at all. */
.js .animate-on-scroll { opacity: 0; transform: translateY(20px); transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1); }
.js .animate-on-scroll.is-visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .animate-fade-in-up, .animate-fade-in, .animate-float { animation: none; }
  .js .animate-on-scroll { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* --- Hero --------------------------------------------------------------- */

.glass-node { transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.glass-node:hover { transform: scale(1.08) translateY(-5px) !important; background: var(--av-glass-hover); z-index: 50; }
.connection-path { stroke-dasharray: 4 2; filter: url(#glow); opacity: 0.6; }

/* The panel the nodes orbit in.
   It used to be a flat gradient between two near-white greys, which drew a hard
   line down the side of the page wherever it met the surface colour. A radial
   tint that fades out to nothing has no edge to see, and follows the palette
   into dark mode by itself. */
.hero-visual {
  background:
    radial-gradient(115% 85% at 50% 42%,
      rgb(var(--m3-surface-container-low) / 0.95) 0%,
      rgb(var(--m3-surface-container-low) / 0.45) 42%,
      rgb(var(--m3-surface) / 0) 72%);
}

/* --- Drag-to-scroll strips ----------------------------------------------- */

/* Only a mouse gets the grab cursor; on a touch screen there is no pointer to
   change and the gesture is native anyway. */
@media (hover: hover) and (pointer: fine) {
  .is-draggable { cursor: grab; }
  .is-draggable.is-dragging { cursor: grabbing; scroll-behavior: auto; scroll-snap-type: none; }
  .is-draggable.is-dragging * { user-select: none; }
}

/* --- Framework carousel -------------------------------------------------- */

.editorial-card { transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
.editorial-card.active { transform: scale(1.04); opacity: 1; z-index: 10; }
.editorial-card:not(.active) { transform: scale(0.95); opacity: 0.6; }
.editorial-card:hover { background: var(--av-glass-strong); }

/* --- Bento grid ---------------------------------------------------------- */

.bento-tile {
  transition: transform .45s cubic-bezier(.16,1,.3,1), box-shadow .45s ease,
              margin .45s cubic-bezier(.16,1,.3,1), background-color .3s ease,
              border-color .3s ease;
}
.bento-tile:focus-visible {
  outline: 2px solid rgb(var(--m3-secondary));
  outline-offset: 3px;
}

/* The card shows a summary; the whole thing is in the popup. Clamped rather
   than cut short in PHP, so it survives the language switcher writing the full
   Arabic back into the element. */
.bento-summary {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bento-tile.glow-effect {
  box-shadow: 0 0 30px rgb(var(--m3-secondary-container) / 0.3);
  border-color: rgb(var(--m3-secondary-container) / 0.6);
  background: var(--av-glass-hover);
}

.bento-path {
  stroke: currentColor; stroke-width: 1.5; fill: none; stroke-dasharray: 6 3;
  filter: url(#bento-glow); opacity: 0; transition: opacity 0.4s ease;
}
.bento-path.active { opacity: 0.6; }

@keyframes particle { to { offset-distance: 100%; } }
.particle-circle { offset-rotate: auto; animation: particle 3s linear infinite; }

/* --- Bento: the mobile deck ---------------------------------------------- */

/* Twelve columns of one column each is just a long list on a phone, and six
   full-height cards is a lot of scrolling to find out what the section is
   about. Stacked with a negative margin they read as a deck: every card shows
   its icon and title, and the one you tap comes to the front and opens.
   The z-index counting up in the markup is what puts each card in front of the
   one before it, so the overlap falls the right way. */
@media (max-width: 1023px) {
  .bento-stack { display: block; }

  /* Icon beside the title rather than above it, so a closed card is short
     enough that the overlap can hide part of it without hiding the one thing
     you need in order to choose it — its name. */
  .bento-stack .bento-head {
    display: flex;
    align-items: center;
    gap: 14px;
  }
  .bento-stack .bento-head > * { margin-top: 0 !important; }
  .bento-stack .bento-head > div:first-child { width: 44px; height: 44px; flex: none; }

  .bento-stack .bento-tile {
    position: relative;
    padding: 20px;
    margin-top: -26px;
    box-shadow: 0 -8px 24px -12px rgb(0 0 0 / .25);
  }
  .bento-stack .bento-tile:first-child { margin-top: 0; }

  .bento-stack .bento-tile.is-active {
    z-index: 40 !important;
    box-shadow: 0 18px 40px -16px rgb(var(--m3-primary) / .3);
    border-color: rgb(var(--m3-primary) / .25);
  }
  /* The card after the open one steps back down, so the open card's own
     bottom edge is not tucked underneath it. */
  .bento-stack .bento-tile.is-active + .bento-tile { margin-top: 14px; }

  /* 0fr to 1fr animates to the content's real height, which `height: auto`
     famously will not. */
  .bento-stack .bento-body {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transition: grid-template-rows .45s cubic-bezier(.16,1,.3,1), opacity .3s ease;
  }
  .bento-stack .bento-body > * { overflow: hidden; }
  .bento-stack .bento-tile.is-active .bento-body { grid-template-rows: 1fr; opacity: 1; }

  .bento-stack .bento-tile:not(.is-active) .bento-head { opacity: .85; }
}

@media (prefers-reduced-motion: reduce) {
  .bento-tile, .bento-stack .bento-body { transition: none; }
}

/* --- CRM introduction ----------------------------------------------------- */

/* The five panels are one set of markup. Here they are ordinary cards in a
   column, which is the whole of the phone layout; the collage only exists from
   `lg` up, where they are lifted out of flow and overlapped. */
.crm-scene {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.crm-panel { transition: transform .3s cubic-bezier(.4,0,.2,1), box-shadow .3s ease; }

/* The flourish under the coloured words in the headline. It is drawn here
   rather than written into the admin's text box, so nobody has to maintain an
   inline <svg> inside a content field. */
.crm-headline .text-secondary {
  position: relative;
  display: inline;
  background-image: linear-gradient(to right,
    rgb(var(--m3-secondary) / 0.35), rgb(var(--m3-secondary) / 0.35));
  background-repeat: no-repeat;
  background-size: 100% 3px;
  background-position: 0 100%;
  padding-bottom: 4px;
}

@keyframes crm-shimmer { 100% { transform: translateX(200%); } }
.crm-shimmer::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 60%;
  transform: translateX(-150%);
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / .18), transparent);
  pointer-events: none;
}
.crm-shimmer:hover::after { animation: crm-shimmer 1.2s ease-out; }

/* `translate` rather than `transform: translateY`, because the scene also
   carries a transform of its own at narrow widths — and an animation on
   `transform` wins over the specified value, which silently threw the scaling
   away and let the collage run off the side of the page. The two properties
   compose instead of fighting. */
@keyframes crm-float {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -6px; }
}

@media (min-width: 1024px) {
  /* A fixed box for the collage: the panels are positioned against it, so it
     needs a height of its own — they are out of flow and cannot give it one. */
  .crm-stage {
    position: relative;
    height: 720px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .crm-scene {
    position: relative;
    display: block;
    width: 620px;
    height: 660px;
    animation: crm-float 8s ease-in-out infinite;
  }

  .crm-panel {
    position: absolute;
    margin: 0;
  }
  .crm-panel:hover {
    transform: translateY(-4px) scale(1.02) rotate(0deg) !important;
    z-index: 60;
  }

  /* The panels overlap on purpose, but only ever at their edges — a panel
     covering another one's words is a collage that has stopped being a
     screenshot of anything. */
  .crm-panel--customer  { top: 0;       inset-inline-start: 0;    width: 330px; transform: rotate(-2deg); z-index: 50; }
  .crm-panel--journey   { top: 150px;   inset-inline-end: -40px;  width: 560px; transform: rotate(1deg);  z-index: 20; }
  .crm-panel--intel     { bottom: 18px; inset-inline-start: -30px; width: 340px; transform: rotate(3deg); z-index: 40; }
  .crm-panel--activity  { top: 350px;   inset-inline-end: 0;      width: 285px; transform: rotate(-1deg); z-index: 30; }
  .crm-panel--checklist { bottom: -58px; inset-inline-end: -55px; width: 252px; transform: rotate(2deg);  z-index: 35; }

  /* Between 1024 and 1280 the column is narrower than the collage, so the whole
     thing is scaled rather than left to spill over the copy beside it. */
  @media (max-width: 1279px) {
    .crm-stage { height: 580px; }
    .crm-scene { transform: scale(.78); }
  }
}

@media (prefers-reduced-motion: reduce) {
  .crm-scene { animation: none; }
  .crm-shimmer:hover::after { animation: none; }
}

/* --- App control ---------------------------------------------------------- */

/* The mock of the control panel's app screen. Two columns from `xl` up — the
   phone on one side, the list of blocks on the other, which is how the real
   page is laid out — and one column below that, where the phone goes on top
   and the blocks read as an ordinary list underneath it. */
.appc-window { max-width: 100%; }

.appc-preview {
  width: 100%;
  display: flex;
}
@media (min-width: 1280px) {
  .appc-preview { width: 268px; }
}

/* The phone drifts, so the panel reads as a live preview rather than a
   picture. `translate` rather than a transform, so nothing it is nested in has
   to fight the animation for the same property. */
@keyframes appc-float {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -7px; }
}
.appc-phone {
  animation: appc-float 9s ease-in-out infinite;
  min-height: 420px;
}

/* One block row. It lifts toward the reader on hover the way a draggable row
   does, which is the whole point being made about the panel. */
.appc-row { transition: transform .3s cubic-bezier(.4,0,.2,1), box-shadow .3s ease; }
.appc-row:hover {
  transform: translateY(-2px);
  box-shadow: var(--av-shadow);
}

/* Two lines of description, however long the admin's text is: a paragraph that
   grows pushes the switch beside it out of line with every other row. */
.appc-desc {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

/* The sheen that crosses the publish button. It runs by itself here rather
   than on hover: the button is part of a picture, not something to click. */
@keyframes appc-sheen { 0% { transform: translateX(-160%); } 55%, 100% { transform: translateX(260%); } }
.appc-shimmer::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 55%;
  transform: translateX(-160%);
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / .28), transparent);
  pointer-events: none;
}
.appc-window .appc-shimmer::after { animation: appc-sheen 5s ease-in-out infinite; }
a.appc-shimmer:hover::after { animation: appc-sheen 1.2s ease-out; }

/* The underline under the coloured words, matching the CRM headline above it. */
.appc-headline .text-secondary {
  background-image: linear-gradient(to right,
    rgb(var(--m3-secondary) / 0.35), rgb(var(--m3-secondary) / 0.35));
  background-repeat: no-repeat;
  background-size: 100% 3px;
  background-position: 0 100%;
  padding-bottom: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .appc-phone { animation: none; }
  .appc-window .appc-shimmer::after,
  a.appc-shimmer:hover::after { animation: none; }
  .appc-row:hover { transform: none; }
}

/* --- Liquid glass popup --------------------------------------------------- */

.av-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.av-modal[hidden] { display: none; }

.av-modal-scrim {
  position: absolute;
  inset: 0;
  background: var(--av-scrim);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity .35s ease;
}
.av-modal.is-open .av-modal-scrim { opacity: 1; }

/* The glass itself: a heavy blur with the saturation pushed up, so whatever is
   behind it bleeds through as colour rather than as grey; a hairline border and
   an inset highlight along the top edge for the lit-rim look; and a soft
   specular sweep across the top-left corner. */
.av-modal-panel {
  position: relative;
  width: min(620px, 100%);
  max-height: min(82vh, 760px);
  overflow-y: auto;
  padding: 32px;
  border-radius: 32px;
  border: 1px solid var(--av-glass-border);
  background: var(--av-liquid);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  box-shadow:
    0 40px 80px -24px rgb(0 0 0 / .45),
    inset 0 1px 0 var(--av-liquid-rim);
  opacity: 0;
  transform: translateY(28px) scale(.96);
  transition: opacity .35s ease, transform .45s cubic-bezier(.16,1,.3,1);
}
.av-modal.is-open .av-modal-panel { opacity: 1; transform: none; }

.av-modal-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(120% 80% at 12% 0%, var(--av-liquid-sheen) 0%, transparent 60%);
}
.av-modal-panel > * { position: relative; }

.av-modal-close {
  position: absolute;
  top: 18px;
  inset-inline-end: 18px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  color: rgb(var(--m3-on-surface-variant));
  background: rgb(var(--m3-on-surface) / .06);
  transition: background .2s ease, color .2s ease;
}
.av-modal-close:hover { background: rgb(var(--m3-on-surface) / .12); color: rgb(var(--m3-primary)); }
.av-modal-close:focus-visible { outline: 2px solid rgb(var(--m3-secondary)); outline-offset: 2px; }

/* Room for the close button, so a long title does not run underneath it. */
#bento-modal-body [data-bento-heading] { padding-inline-end: 32px; }

@media (prefers-reduced-motion: reduce) {
  .av-modal-scrim, .av-modal-panel { transition: none; }
  .av-modal-panel { transform: none; }
}

/* --- Long-form pages (privacy, terms) ------------------------------------ */

.prose-allvia { color: rgb(var(--m3-on-surface-variant)); font-size: 17px; line-height: 1.75; }
.prose-allvia > *:first-child { margin-top: 0; }
.prose-allvia h2 {
  font-family: Montserrat, sans-serif; font-weight: 600; font-size: 24px; line-height: 1.35;
  color: rgb(var(--m3-primary)); margin: 2.5rem 0 0.75rem;
}
.prose-allvia h3 {
  font-family: Montserrat, sans-serif; font-weight: 600; font-size: 19px;
  color: rgb(var(--m3-primary)); margin: 2rem 0 0.5rem;
}
.prose-allvia p { margin: 0 0 1.1rem; }
.prose-allvia ul, .prose-allvia ol { margin: 0 0 1.25rem; padding-inline-start: 1.4rem; }
.prose-allvia li { margin-bottom: 0.55rem; }
.prose-allvia ul { list-style: disc; }
.prose-allvia ol { list-style: decimal; }
.prose-allvia strong { color: rgb(var(--m3-on-surface)); font-weight: 600; }
.prose-allvia a { color: rgb(var(--m3-secondary)); text-decoration: underline; text-underline-offset: 3px; }
.prose-allvia a:hover { color: rgb(var(--m3-primary)); }
.prose-allvia hr { border: 0; border-top: 1px solid rgb(var(--m3-outline-variant) / 0.6); margin: 2.5rem 0; }

/* --- Blog ---------------------------------------------------------------- */

/* The blog runs a little wider than the rest of the site: a column of articles
   next to a sidebar needs the extra width, and the pages have no full-bleed
   artwork to be judged against. Set on <main>, so the header and footer keep
   the site's own measure. */
.av-blog-page { --av-container: 1400px; }

/* Sidebar in the first column, articles in the second.
   Under dir="rtl" CSS grid lays its columns out right to left, which puts the
   sidebar on the right in Arabic — the whole of the requirement, from two
   declarations and nothing duplicated. */
.av-blog-layout { display: grid; gap: 2.5rem; align-items: start; }
@media (min-width: 1024px) {
  .av-blog-layout { grid-template-columns: 320px minmax(0, 1fr); gap: 3rem; }
  .av-blog-layout > .av-blog-side { grid-column: 1; grid-row: 1; }
  .av-blog-layout > .av-blog-main { grid-column: 2; grid-row: 1; }
  .av-blog-layout--full { grid-template-columns: minmax(0, 1fr); }
  .av-blog-layout--full > .av-blog-main { grid-column: 1; }

  /* The sidebar is as tall as its widgets and has no scrollbar of its own.
     It used to be sticky with `max-height: calc(100vh - 120px); overflow-y:
     auto`, which meant that as soon as the widgets added up to more than a
     screen — which four widgets and a banner comfortably do — reading the
     bottom of the sidebar meant finding and dragging a second scrollbar
     inside the page. Two scrollbars on one screen is the problem; capping the
     height is what creates it, so the cap is gone.

     Sticky is gone with it, and not by accident: a sticky box taller than the
     viewport pins its top and puts its own bottom permanently out of reach,
     which is the same bug in a worse disguise. The column simply scrolls with
     the page. */
  .av-blog-side {
    align-self: start;
  }
}

/* On a phone the sidebar comes after the articles, which is what the source
   order already says — nothing to do but let it stack. */

.av-post-grid { display: grid; gap: 1.75rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) {
  .av-post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .av-post-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .av-post-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  /* Beside a sidebar there is not the width for more than two until the screen
     is genuinely wide, whatever the setting asks for. */
  .av-post-grid--with-sidebar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1400px) {
  .av-post-grid--with-sidebar.av-post-grid--3,
  .av-post-grid--with-sidebar.av-post-grid--4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.av-post-card { transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease; }
.av-post-card:hover { transform: translateY(-6px); box-shadow: var(--av-shadow); }
/* A fixed shape rather than whatever the picture happens to be, so a row of
   cards lines up however the pictures were cropped. */
.av-post-card__media { aspect-ratio: 16 / 10; }

/* --- Blog sidebar widgets ------------------------------------------------ */

.av-widget-title {
  font-family: Montserrat, sans-serif; font-weight: 600; font-size: 15px;
  letter-spacing: 0.02em; color: rgb(var(--m3-primary));
}
html[dir="rtl"] .av-widget-title { font-family: 'El Messiri', sans-serif; }

.av-widget-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.55rem 0.75rem; border-radius: 0.75rem;
  font-size: 15px; color: rgb(var(--m3-on-surface-variant));
  transition: background 0.2s, color 0.2s;
}
.av-widget-row:hover { background: rgb(var(--m3-primary) / 0.06); color: rgb(var(--m3-primary)); }
.av-widget-row.is-active { background: rgb(var(--m3-primary) / 0.1); color: rgb(var(--m3-primary)); font-weight: 600; }
.av-widget-count {
  flex: none; min-width: 1.75rem; text-align: center;
  padding: 0.1rem 0.45rem; border-radius: 999px;
  background: rgb(var(--m3-surface-container-highest) / 0.7);
  font-size: 12px; font-variant-numeric: tabular-nums;
}

.av-tag {
  display: inline-block; padding: 0.35rem 0.85rem; border-radius: 999px;
  border: 1px solid rgb(var(--m3-outline-variant) / 0.7);
  font-size: 13px; color: rgb(var(--m3-on-surface-variant));
  transition: all 0.2s;
}
.av-tag:hover {
  border-color: rgb(var(--m3-secondary)); color: rgb(var(--m3-secondary));
  background: rgb(var(--m3-secondary) / 0.06);
}

/* --- The sidebar banner advert ------------------------------------------- */

/* Artwork, a tint and the wording, all stacked in one grid cell.

   A grid rather than `position: absolute` because the height then follows
   whichever is taller — the picture or the words. Absolute positioning would
   let a headline and a coupon spill out of the bottom of a short picture, and
   the only defence against that would be asking the admin to guess a height
   that fits both languages. */
.av-blog-banner {
  position: relative;
  display: grid;
  isolation: isolate;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgb(var(--m3-primary) / 0.18);
}
.av-blog-banner > * { grid-area: 1 / 1; min-width: 0; }

.av-blog-banner__img {
  width: 100%;
  height: 100%;
  align-self: stretch;
  object-fit: cover;
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.av-blog-banner:hover .av-blog-banner__img { transform: scale(1.03); }

.av-blog-banner__veil { background: var(--av-banner-veil, transparent); }

/* The link, as a layer rather than as a wrapper — see the note in
   partials/blog/banner.php for why the obvious <a> around everything is not
   legal here once the card has a button of its own. */
.av-blog-banner__hit { z-index: 2; border-radius: inherit; }

/* The wording sits above the link layer, and lets clicks through to it. The
   two controls that must not are switched back on directly underneath. */
.av-blog-banner__body {
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.5rem;
  pointer-events: none;
}
.av-blog-banner__body a,
.av-blog-banner__body button,
.av-blog-banner__code { pointer-events: auto; }

/* Every colour, size and weight below arrives in a style attribute from the
   settings. What is left here is the shape they are drawn in. */
.av-blog-banner__title {
  font-family: Montserrat, sans-serif;
  line-height: 1.25;
  margin: 0;
  text-shadow: 0 1px 12px rgb(0 0 0 / 0.25);
}
html[dir="rtl"] .av-blog-banner__title { font-family: 'El Messiri', sans-serif; }

.av-blog-banner__subtitle { line-height: 1.4; margin: 0; text-shadow: 0 1px 10px rgb(0 0 0 / 0.22); }

/* pre-line, not <br>: the language switcher writes a translated field with
   textContent, which would drop the markup — this keeps the line breaks in
   both languages without any. */
.av-blog-banner__text {
  line-height: 1.6;
  margin: 0;
  white-space: pre-line;
  text-shadow: 0 1px 10px rgb(0 0 0 / 0.22);
}

.av-blog-banner__coupon-wrap { display: flex; flex-direction: column; gap: 0.35rem; width: 100%; }
.av-blog-banner__coupon-label {
  font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.85;
}

.av-blog-banner__coupon {
  display: flex;
  align-items: stretch;
  gap: 0.25rem;
  padding: 0.25rem 0.25rem 0.25rem 0.75rem;
  border-radius: 14px;
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.18);
}
html[dir="rtl"] .av-blog-banner__coupon { padding: 0.25rem 0.75rem 0.25rem 0.25rem; }

.av-blog-banner__code {
  flex: 1 1 auto;
  min-width: 0;
  align-self: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  /* Selecting it by hand still works — the button is the shortcut, not the
     only way in — which is why the code takes its pointer events back from the
     link layer above. A click on it selects the code rather than following the
     banner's link, which is what somebody clicking a coupon code meant. */
  user-select: all;
}

.av-blog-banner__copy {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  border-radius: 10px;
  background: rgb(0 0 0 / 0.06);
  transition: background 0.2s, transform 0.15s;
}
.av-blog-banner__copy:hover { background: rgb(0 0 0 / 0.12); }
.av-blog-banner__copy:active { transform: scale(0.94); }
.av-blog-banner.is-copied .av-blog-banner__copy { background: rgb(34 197 94 / 0.22); }

.av-blog-banner__button {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  border-radius: 999px;
  line-height: 1.2;
  box-shadow: 0 8px 20px rgb(0 0 0 / 0.22);
  transition: transform 0.2s, filter 0.2s;
}
.av-blog-banner__button:hover { transform: translateY(-2px); filter: brightness(1.06); }

/* The banner has an Arabic twin for artwork with words on it. Both are in the
   page and CSS shows one, so switching language never leaves a gap while a
   second file downloads. */
.av-banner-ar { display: none; }
html[dir="rtl"] .av-banner-ar { display: block; }
html[dir="rtl"] .av-banner-en { display: none; }

/* --- Pagination ---------------------------------------------------------- */

.av-page-link {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.75rem; height: 2.75rem; padding: 0 0.6rem; border-radius: 999px;
  border: 1px solid rgb(var(--m3-outline-variant) / 0.7);
  font-size: 15px; font-variant-numeric: tabular-nums;
  color: rgb(var(--m3-on-surface-variant));
  transition: all 0.2s;
}
.av-page-link:hover { border-color: rgb(var(--m3-primary)); color: rgb(var(--m3-primary)); }
.av-page-link.is-current {
  background: rgb(var(--m3-primary)); border-color: rgb(var(--m3-primary));
  color: rgb(var(--m3-on-primary)); font-weight: 600;
}
.av-page-link--arrow { min-width: 2.75rem; padding: 0; }

/* --- Article ------------------------------------------------------------- */

/* Reading progress, pinned under the fixed header. */
.av-read-progress {
  position: fixed; top: calc(80px + var(--av-topbar-shift)); inset-inline: 0; height: 3px; z-index: 40;
  background: rgb(var(--m3-outline-variant) / 0.25); pointer-events: none;
}
.av-read-progress > span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, rgb(var(--m3-primary)), rgb(var(--m3-secondary)));
  transform-origin: inline-start;
}

/* The prose rules the policy pages already use, plus the handful of things an
   article can contain that a policy page cannot. */
.av-article-body { font-size: 18px; }
.av-article-body h2, .av-article-body h3 { scroll-margin-top: 110px; }
.av-article-body img { max-width: 100%; height: auto; border-radius: 18px; }
.av-article-body figure { margin: 2.25rem 0; }
.av-article-body figcaption {
  margin-top: 0.65rem; text-align: center; font-size: 14px;
  color: rgb(var(--m3-on-surface-variant) / 0.75);
}
.av-article-body blockquote {
  margin: 2rem 0; padding: 0.25rem 0 0.25rem 1.4rem;
  border-inline-start: 4px solid rgb(var(--m3-secondary));
  font-size: 20px; line-height: 1.6; color: rgb(var(--m3-on-surface));
}
html[dir="rtl"] .av-article-body blockquote { padding: 0.25rem 1.4rem 0.25rem 0; }
.av-article-body pre {
  margin: 1.75rem 0; padding: 1.15rem 1.35rem; border-radius: 16px; overflow-x: auto;
  background: rgb(var(--m3-surface-container-highest) / 0.7);
  font-size: 14.5px; line-height: 1.6; direction: ltr; text-align: left;
}
.av-article-body :not(pre) > code {
  padding: 0.15rem 0.4rem; border-radius: 6px;
  background: rgb(var(--m3-surface-container-highest) / 0.8);
  font-size: 0.9em; direction: ltr; unicode-bidi: embed;
}
.av-article-body table {
  width: 100%; margin: 1.75rem 0; border-collapse: collapse; font-size: 16px;
  display: block; overflow-x: auto;
}
.av-article-body th, .av-article-body td {
  padding: 0.7rem 0.9rem; border: 1px solid rgb(var(--m3-outline-variant) / 0.6);
  text-align: start;
}
.av-article-body th { background: rgb(var(--m3-surface-container) / 0.6); color: rgb(var(--m3-on-surface)); font-weight: 600; }
.av-article-body iframe, .av-article-body video { max-width: 100%; border-radius: 18px; }

.av-toc-link {
  display: block; padding: 0.25rem 0; font-size: 15px; line-height: 1.5;
  color: rgb(var(--m3-on-surface-variant)); transition: color 0.2s;
  border-inline-start: 2px solid transparent; padding-inline-start: 0.75rem;
}
.av-toc-link:hover { color: rgb(var(--m3-primary)); }
.av-toc-link.is-current {
  color: rgb(var(--m3-primary)); font-weight: 600;
  border-inline-start-color: rgb(var(--m3-secondary));
}

.av-share-button {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.5rem; height: 2.5rem; border-radius: 999px;
  border: 1px solid rgb(var(--m3-outline-variant) / 0.7);
  color: rgb(var(--m3-on-surface-variant));
  transition: all 0.2s;
}
.av-share-button:hover {
  background: rgb(var(--m3-primary)); border-color: rgb(var(--m3-primary));
  color: rgb(var(--m3-on-primary));
}
.av-copied-note {
  position: absolute; bottom: calc(100% + 0.5rem); inset-inline-start: 50%;
  transform: translateX(-50%); white-space: nowrap;
  padding: 0.25rem 0.6rem; border-radius: 999px;
  background: rgb(var(--m3-inverse-surface)); color: rgb(var(--m3-inverse-on-surface));
  font-size: 12px;
}
html[dir="rtl"] .av-copied-note { transform: translateX(50%); }

/* --- Forms --------------------------------------------------------------- */

/* Element-qualified on purpose. The Tailwind CDN injects its stylesheet — forms
   plugin reset included — at runtime, so it lands after this file; a bare
   .av-field would tie on specificity and lose. */
input.av-field, textarea.av-field, select.av-field {
  width: 100%; padding: 0.875rem 1.125rem; border-radius: 1rem;
  border: 1px solid rgb(var(--m3-outline-variant) / 0.8);
  background: rgb(var(--m3-surface-container-lowest) / 0.7);
  font-size: 16px; line-height: 1.5; color: rgb(var(--m3-on-surface));
  transition: border-color .2s, box-shadow .2s, background .2s;
}
input.av-field::placeholder, textarea.av-field::placeholder { color: rgb(var(--m3-outline)); opacity: 1; }
input.av-field:focus, textarea.av-field:focus, select.av-field:focus {
  outline: none; background: rgb(var(--m3-surface-container-lowest));
  border-color: rgb(var(--m3-secondary));
  box-shadow: 0 0 0 4px rgb(var(--m3-secondary-container) / 0.2);
}
input.av-field.is-invalid, textarea.av-field.is-invalid {
  border-color: rgb(var(--m3-error)); box-shadow: 0 0 0 4px rgb(var(--m3-error) / 0.15);
}
textarea.av-field { resize: vertical; min-height: 8rem; }

/* On a dark panel the translucent fill reads as grey rather than as a field. */
input.av-field--on-dark {
  background: rgb(var(--m3-surface-container-lowest)); border-color: transparent;
  box-shadow: 0 8px 20px -8px rgb(0 0 0 / 0.35);
}
.av-label {
  display: block; font-size: 14px; font-weight: 500; letter-spacing: 0.03em;
  color: rgb(var(--m3-on-surface-variant)); margin-bottom: 0.4rem;
}

.av-feedback {
  display: none; align-items: center; gap: 0.625rem; border-radius: 1rem;
  padding: 0.875rem 1.125rem; font-size: 15px; font-weight: 500; margin-top: 1rem;
}
.av-feedback.is-success, .av-feedback.is-error {
  display: flex; animation: av-feedback-in 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.av-feedback.is-success { background: rgb(16 185 129 / 0.15); color: #0f9d76; }
.av-feedback.is-error   { background: rgb(var(--m3-error) / 0.12); color: rgb(var(--m3-error)); }
.av-feedback.is-success::before, .av-feedback.is-error::before {
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 999px; font-size: 13px; font-weight: 700;
  color: #fff;
}
.av-feedback.is-success::before { content: "\2713"; background: #0f9d76; }
.av-feedback.is-error::before   { content: "!"; background: rgb(var(--m3-error)); }

@keyframes av-feedback-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- Mobile navigation drawer -------------------------------------------- */

/* A panel rather than a full-screen takeover: it slides in over four fifths of
   the width, the page stays visible behind a scrim, and tapping the scrim is
   the gesture most people try first. */
.av-drawer {
  width: 80%;
  max-width: 380px;
  border-start-start-radius: 28px;
  border-end-start-radius: 28px;
  box-shadow: -24px 0 60px -20px rgb(0 0 0 / 0.35);
}
html[dir="rtl"] .av-drawer { box-shadow: 24px 0 60px -20px rgb(0 0 0 / 0.35); }

.av-drawer-scrim {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.av-drawer-scrim.is-open { opacity: 1; pointer-events: auto; }

/* The items stagger in behind the panel. Small enough not to be waited on, big
   enough that the menu feels assembled rather than dumped. */
.av-drawer .av-drawer-item {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.av-drawer.is-open .av-drawer-item { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .av-drawer .av-drawer-item { opacity: 1; transform: none; transition: none; }
  .av-drawer, .av-drawer-scrim { transition: none; }
}

/* --- Theme switch --------------------------------------------------------- */

/* One button, two glyphs: whichever mode you are in, the icon shows the mode
   you would get by pressing it. */
.av-theme-toggle .av-icon-dark { display: none; }
html.dark .av-theme-toggle .av-icon-dark { display: inline; }
html.dark .av-theme-toggle .av-icon-light { display: none; }

/* The logo is a picture, so it cannot follow the palette. Both versions are in
   the page and the one that suits the current mode is the one on show — which
   also means switching mode does not have to wait for an image to load. */
.av-logo-dark { display: none; }
html.dark .av-logo-dark { display: block; }
html.dark .av-logo-light { display: none; }

/* --- Not found ------------------------------------------------------------ */

/* The numeral on the 404 page. Drawn in the brand gradient rather than a flat
   colour, and clamped rather than given breakpoints, so it stays the largest
   thing on the page at any width without a media query per size. */
.av-404-mark {
  font-size: clamp(96px, 22vw, 200px);
  font-weight: 700;
  background: linear-gradient(135deg, rgb(var(--m3-primary)), rgb(var(--m3-secondary)) 55%, rgb(var(--m3-secondary-container)));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-block;
}
