/* ==========================================================================
   Shenawy foundation: reset, motion, layout and the shared sh-* primitives.
   Tokens only. Logical properties only. Works with `dir` alone.
   ========================================================================== */

:root {
  --dur-1: 120ms;
  --dur-2: 220ms;
  --dur-3: 420ms;
  --dur-4: 700ms;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-in-out: cubic-bezier(.6, 0, .2, 1);

  /* Height of whatever is docked to the bottom of the screen on this page.
     Site chrome raises it; site.js measures it precisely when it runs. */
  --sh-dock: 0px;
  --sh-gutter: var(--space-4);
  --sh-z-bar: 50;
  --sh-z-float: 60;
  --sh-z-sheet: 80;

  /* The chamfer follows the fold of the mark: twice as wide as it is tall. */
  --sh-facet-x: 56px;
  --sh-facet-y: 28px;
}

@media (min-width: 600px) { :root { --sh-gutter: var(--space-6); } }
@media (min-width: 900px) { :root { --sh-gutter: var(--space-8); } }
@media (min-width: 1200px) { :root { --sh-gutter: var(--space-12); } }

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-padding-block-start: var(--space-24);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 26px;
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg, video, canvas { display: block; max-inline-size: 100%; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
summary { cursor: pointer; }
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

::selection { background: var(--accent); color: var(--on-accent); }

/* Latin copy gets a tighter display fit. Arabic is never letter-spaced. */
:lang(en) .display,
:lang(en) .display-lg,
:lang(en) .h1 { letter-spacing: -.02em; }
:lang(en) .h2,
:lang(en) .h3 { letter-spacing: -.01em; }

/* --------------------------------------------------------------------------
   Layout and utility
   -------------------------------------------------------------------------- */

.sh-container {
  inline-size: 100%;
  max-inline-size: 1344px;
  margin-inline: auto;
  padding-inline: var(--sh-gutter);
}

.sh-visually-hidden {
  position: absolute !important;
  inline-size: 1px;
  block-size: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.sh-icon {
  inline-size: 24px;
  block-size: 24px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sh-icon--sm { inline-size: 20px; block-size: 20px; }

/* Direction-bearing icons are drawn pointing forward in LTR. */
.sh-flip:dir(rtl) { transform: scaleX(-1); }

/* A placeholder stays visibly a placeholder until the clinic supplies the fact. */
.sh-ph {
  border-block-end: 1.5px dashed currentColor;
  padding-block-end: .04em;
}

/* Horizontal snap rail with a visible peek of the next item. */
.sh-rail {
  --sh-rail-item: 78%;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--sh-rail-item);
  gap: var(--space-3);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--sh-gutter);
  padding-inline: var(--sh-gutter);
  padding-block: var(--space-1) var(--space-6);
  scrollbar-width: none;
}
.sh-rail::-webkit-scrollbar { display: none; }
.sh-rail > * { scroll-snap-align: start; min-inline-size: 0; }

/* --------------------------------------------------------------------------
   Button
   -------------------------------------------------------------------------- */

.sh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-block-size: 52px;
  padding-inline: var(--space-6);
  padding-block: var(--space-2);
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition:
    transform var(--dur-1) var(--ease-out),
    background-color var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out),
    color var(--dur-2) var(--ease-out);
}
.sh-btn:active { transform: scale(.97); }

.sh-btn--primary { background: var(--accent); color: var(--on-accent); }
.sh-btn--secondary { background: var(--accent-soft); color: var(--on-accent-soft); }
.sh-btn--outline { border-color: var(--line-strong); color: var(--ink); }
.sh-btn--ghost { color: var(--accent); padding-inline: var(--space-3); }
.sh-btn--small { min-block-size: 44px; padding-inline: var(--space-4); font-size: 14px; line-height: 20px; }
.sh-btn--block { display: flex; inline-size: 100%; }

@media (hover: hover) {
  .sh-btn--primary:hover { background: var(--accent-strong); }
  .sh-btn--secondary:hover { background: var(--hero); }
  .sh-btn--outline:hover { border-color: var(--accent); color: var(--accent); }
  .sh-btn--ghost:hover { background: var(--accent-soft); color: var(--on-accent-soft); }
}

.sh-btn[disabled], .sh-btn[aria-disabled="true"], .sh-btn.is-disabled {
  background: var(--surface-sunken);
  border-color: transparent;
  color: var(--ink-muted);
  cursor: not-allowed;
  transform: none;
}
.sh-btn.is-loading { pointer-events: none; }
.sh-btn.is-loading::before {
  content: "";
  inline-size: 18px;
  block-size: 18px;
  border: 2px solid currentColor;
  border-block-start-color: transparent;
  border-radius: var(--radius-pill);
  animation: sh-spin 800ms linear infinite;
}
@keyframes sh-spin { to { transform: rotate(360deg); } }

.sh-btn__icon { inline-size: 20px; block-size: 20px; flex: none; }

/* --------------------------------------------------------------------------
   Form field
   -------------------------------------------------------------------------- */

.sh-field { display: grid; gap: var(--space-2); }
.sh-field__label { font-size: 14px; line-height: 20px; font-weight: 500; color: var(--ink); }
.sh-required { color: var(--danger); margin-inline-start: var(--space-1); }

.sh-field__control {
  inline-size: 100%;
  min-block-size: 52px;
  padding-inline: var(--space-4);
  padding-block: var(--space-3);
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--ink);
  font-size: 16px;
  line-height: 24px;
  transition: border-color var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out);
}
textarea.sh-field__control { min-block-size: 120px; resize: vertical; }
select.sh-field__control {
  appearance: none;
  -webkit-appearance: none;
  padding-inline-end: var(--space-12);
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-size: 7px 7px;
  background-repeat: no-repeat;
  background-position: calc(100% - 25px) 50%, calc(100% - 18px) 50%;
}
select.sh-field__control:dir(rtl) { background-position: 18px 50%, 25px 50%; }
.sh-field__control::placeholder { color: var(--ink-muted); opacity: 1; }
.sh-field__control:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--focus);
}
.sh-field__control[disabled] { background: var(--surface-sunken); color: var(--ink-muted); cursor: not-allowed; }

.sh-field__help { font-size: 14px; line-height: 22px; color: var(--ink-muted); }
.sh-field__error {
  display: none;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: 14px;
  line-height: 22px;
  font-weight: 500;
  color: var(--danger);
}
.sh-field.is-invalid .sh-field__error { display: flex; }
.sh-field.is-invalid .sh-field__control { border-color: var(--danger); }
.sh-field.is-invalid .sh-field__control:focus-visible { box-shadow: 0 0 0 2px var(--danger); }

/* --------------------------------------------------------------------------
   Chip
   -------------------------------------------------------------------------- */

.sh-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-block-size: 44px;
  padding-inline: var(--space-4);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--ink);
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition:
    transform var(--dur-1) var(--ease-out),
    background-color var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out),
    color var(--dur-2) var(--ease-out);
}
.sh-chip:active { transform: scale(.97); }
@media (hover: hover) {
  .sh-chip:hover { border-color: var(--accent); }
}
.sh-chip.is-selected, .sh-chip[aria-pressed="true"], .sh-chip[aria-selected="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.sh-chip[disabled] {
  background: var(--surface-sunken);
  border-color: transparent;
  color: var(--ink-muted);
  cursor: not-allowed;
  transform: none;
}

/* --------------------------------------------------------------------------
   Card and facet
   -------------------------------------------------------------------------- */

.sh-card {
  display: block;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-5);
}
.sh-card--flat { box-shadow: none; border: 1px solid var(--line); }
.sh-card--sunken { box-shadow: none; background: var(--surface-sunken); }
.sh-card--hero { --line-strong: var(--on-hero-muted); box-shadow: none; background: var(--hero); color: var(--on-hero); }
.sh-card--link {
  transition: transform var(--dur-1) var(--ease-out), box-shadow var(--dur-2) var(--ease-out);
}
.sh-card--link:active { transform: scale(.985); }
@media (hover: hover) {
  .sh-card--link:hover { box-shadow: var(--shadow-pop); }
}

/* One chamfered corner, at the top of the inline end. Mirrors with `dir`.
   clip-path also cuts box-shadow, so a facet block never carries one. */
.sh-facet {
  clip-path: polygon(
    0 0,
    calc(100% - var(--sh-facet-x)) 0,
    100% var(--sh-facet-y),
    100% 100%,
    0 100%
  );
}
.sh-facet:dir(rtl) {
  clip-path: polygon(
    var(--sh-facet-x) 0,
    100% 0,
    100% 100%,
    0 100%,
    0 var(--sh-facet-y)
  );
}
.sh-facet--sm { --sh-facet-x: 32px; --sh-facet-y: 16px; }
.sh-facet--lg { --sh-facet-x: 96px; --sh-facet-y: 48px; }

/* Chamfer on the bottom of the inline end. */
.sh-facet--bottom {
  clip-path: polygon(
    0 0,
    100% 0,
    100% calc(100% - var(--sh-facet-y)),
    calc(100% - var(--sh-facet-x)) 100%,
    0 100%
  );
}
.sh-facet--bottom:dir(rtl) {
  clip-path: polygon(
    0 0,
    100% 0,
    100% 100%,
    var(--sh-facet-x) 100%,
    0 calc(100% - var(--sh-facet-y))
  );
}

/* --------------------------------------------------------------------------
   Badge: base look. Status always pairs a word and an icon with its color.
   -------------------------------------------------------------------------- */

.sh-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-block-size: 26px;
  padding-inline: var(--space-2) var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 18px;
  font-weight: 500;
  white-space: nowrap;
}
.sh-badge .sh-icon { inline-size: 16px; block-size: 16px; }
.sh-badge--pending { background: var(--warning-soft); color: var(--warning); }
.sh-badge--confirmed { background: var(--success-soft); color: var(--success); }
.sh-badge--arrived { background: var(--info-soft); color: var(--info); }
.sh-badge--completed { background: var(--surface-sunken); color: var(--ink); }
.sh-badge--cancelled { background: var(--danger-soft); color: var(--danger); }
.sh-badge--noshow { background: var(--surface-sunken); color: var(--danger); }

/* --------------------------------------------------------------------------
   Skeleton
   -------------------------------------------------------------------------- */

.sh-skeleton {
  display: block;
  background: var(--surface-sunken);
  border-radius: var(--radius-sm);
  animation: sh-pulse 1400ms var(--ease-in-out) infinite alternate;
}
@keyframes sh-pulse { from { opacity: 1; } to { opacity: .55; } }

/* --------------------------------------------------------------------------
   Reveal: the resting state is the visible state. site.js adds .is-revealing
   the moment an element enters the viewport, once. Without JS nothing changes.
   -------------------------------------------------------------------------- */

.sh-reveal.is-revealing {
  animation: sh-rise var(--dur-3) var(--ease-out) backwards;
}
@keyframes sh-rise {
  from { opacity: .001; transform: translateY(16px); }
}

/* --------------------------------------------------------------------------
   WhatsApp float: rests at the inline start (right in Arabic, left in English),
   above whatever is docked, and hides while typing. The brand green with a white
   glyph; hover and pressed darken it with a mix.
   -------------------------------------------------------------------------- */

.sh-wa {
  position: fixed;
  z-index: var(--sh-z-float);
  inset-block-end: calc(var(--sh-dock) + env(safe-area-inset-bottom, 0px) + var(--space-3));
  inset-inline-start: var(--space-4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-inline-size: 56px;
  min-block-size: 56px;
  border-radius: var(--radius-pill);
  background: var(--whatsapp);
  color: var(--on-whatsapp);
  box-shadow: var(--shadow-float);
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
  transition:
    transform var(--dur-2) var(--ease-out),
    opacity var(--dur-2) var(--ease-out),
    background-color var(--dur-2) var(--ease-out),
    inset-block-end var(--dur-2) var(--ease-out);
}
@media (hover: hover) { .sh-wa:hover { background: color-mix(in srgb, var(--whatsapp) 88%, black); } }
.sh-wa:active { transform: scale(.97); background: color-mix(in srgb, var(--whatsapp) 76%, black); }
.sh-wa__icon { inline-size: 28px; block-size: 28px; fill: currentColor; flex: none; }
.sh-wa__label { display: none; }
.sh-wa.is-hidden { opacity: 0; transform: translateY(16px) scale(.9); pointer-events: none; }

@media (min-width: 900px) {
  .sh-wa { padding-inline: var(--space-4) var(--space-5); inset-inline-start: var(--space-6); inset-block-end: var(--space-6); }
  .sh-wa__label { display: inline; }
}

/* --------------------------------------------------------------------------
   Reduced motion: no slides, morphs or pulses. State changes stay.
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .sh-btn:active, .sh-chip:active, .sh-card--link:active, .sh-wa:active { transform: none; }
  .sh-reveal.is-revealing { animation: none; }
  .sh-skeleton { animation: none; }
  .sh-btn.is-loading::before { animation-duration: 1600ms; }
  .sh-wa.is-hidden { transform: none; }
}
