/* ============================================================
   base.css - reset, colour tokens, typography
   Palette sampled from the Saudi National Day creative.
   ============================================================ */

:root {
  /* Brand - sampled from src/assets/hero.jpg */
  --brand-magenta: #d6156f;  /* rose desert */
  --brand-purple:  #8e2a6b;  /* logo gradient */
  --brand-navy:    #1b2a4a;  /* abaya - body text */
  --brand-sky:     #2e86c8;  /* sky */

  /* Surfaces */
  --page-bg:    #fdf3f7;
  --card-bg:    #ffffff;
  --border:     #e9d7e2;
  --muted:      #6b6570;

  /* State */
  --error:      #d13438;
  --success:    #1a8754;

  /* Shape */
  --radius:     14px;
  --radius-sm:  10px;
  --shadow:     0 10px 30px rgba(142, 42, 107, 0.10);
  --shadow-lg:  0 18px 44px rgba(142, 42, 107, 0.16);

  --maxw:       560px;
  --maxw-wide:  1100px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Figtree', 'Cairo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--page-bg);
  color: var(--brand-navy);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

[dir='rtl'] body {
  font-family: 'Cairo', 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

img { max-width: 100%; display: block; }

a { color: var(--brand-magenta); }

h1, h2, h3 { line-height: 1.25; font-weight: 700; }

:focus-visible {
  outline: 3px solid var(--brand-sky);
  outline-offset: 2px;
}

/* Screen-reader-only helper */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   layout.css - logo strip, split shell, landing cards
   ============================================================ */

/* ---------- Language switch -------------------------------- */
/* Floats on the creative instead of occupying a strip of its own. */

.lang-switch {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 5;
  display: inline-flex;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.24);
}

.lang-switch__btn {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--muted);
  padding: 7px 15px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.lang-switch__btn:hover { color: var(--brand-magenta); }

.lang-switch__btn[aria-pressed='true'] {
  background: linear-gradient(135deg, var(--brand-magenta), var(--brand-purple));
  color: #fff;
}

/* ---------- Stage: shared + 'split' layout ----------------------------------- */
/* Creative on one side, content on the other. The creative is 1920x748 -
   far wider than any half-width column is tall - so it is shown at its own
   aspect ratio and allowed to letterbox against the panel gradient. It is
   never cropped: the <img> has height:auto and no object-fit. */

/* The grid axis is forced to LTR so the creative stays on the left and the
   content on the right in BOTH languages - switching to Arabic must not swap
   the two halves under the reader. Text direction is restored on the inner
   wrappers below, so headings, labels and inputs still flip properly. */
.stage { direction: ltr; }

[dir='rtl'] .visual__inner,
[dir='rtl'] .stage__content-inner { direction: rtl; }

.stage--split {
  flex: 1;
  display: grid;
  grid-template-columns: 54fr 46fr;
  align-items: stretch;
}

.stage__visual {
  position: relative;
  /* Sampled from the creative itself, so the letterboxing reads as a frame
     around the artwork rather than as empty space beside it. */
  background: linear-gradient(165deg, #2e86c8 0%, #6fb4dd 34%, #d6156f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 36px;
}

.visual__inner {
  width: 100%;
  max-width: 820px;
  position: sticky;
  top: 32px;
}

.visual__img {
  width: 100%;
  height: auto;              /* whole image, always */
  border-radius: 14px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.28);
}

.visual__caption {
  text-align: center;
  color: #fff;
  margin-top: 26px;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.25);
}

.visual__title {
  font-size: clamp(20px, 1.9vw, 30px);
  font-weight: 700;
}

.visual__subtitle {
  font-size: clamp(14px, 1.2vw, 18px);
  opacity: 0.94;
  margin-top: 4px;
}

/* The creative is short and wide, so a half-page column is always taller than
   it. Rather than leave the panel two-thirds empty, it carries the branch name
   and what the branch actually offers. */
.visual__services {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
  margin-top: 10px;
}

.visual__services-label {
  color: rgba(255, 255, 255, 0.85);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 24px;
}

.visual__service {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  color: var(--brand-purple);
  font-size: 13.5px;
  font-weight: 700;
  padding: 8px 17px;
  border-radius: 999px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.visual__service::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-magenta), var(--brand-purple));
  flex: none;
}

.stage__content {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 44px 32px;
  background: var(--page-bg);
}

.stage__content-inner {
  width: 100%;
  max-width: 520px;
}

.content-heading {
  font-size: clamp(21px, 2.2vw, 28px);
  color: var(--brand-purple);
  text-align: center;
  margin-bottom: 22px;
}

/* Below 900px the two columns stack: creative on top, content beneath. */
@media (max-width: 900px) {
  .stage--split { grid-template-columns: 1fr; }

  /* Extra top padding clears the floating language switch, which would
     otherwise sit on the creative's own logo in its top-left corner. */
  .stage__visual { padding: 64px 20px 58px; }

  .lang-switch { top: 14px; left: 14px; }

  .visual__inner { position: static; max-width: 560px; }

  .visual__caption { margin-top: 18px; }

  .visual__services { margin-top: 16px; gap: 8px; }

  .visual__service { font-size: 13px; padding: 6px 13px; }

  .stage__content { padding: 28px 20px 40px; }
}


/* ---------- Stage: 'overlay' layout ------------------------ */
/* One screen, no page scroll, and the creative shown WHOLE.
   A 1920x748 image cannot fill a 16:9 viewport without cropping, so it is
   contained rather than covered and the letterbox bands are filled with a
   blurred, scaled copy of the image itself - the artwork stays complete and
   the background still reaches every edge. */

.layout-overlay,
.layout-overlay body { height: 100%; }

@media (min-width: 901px) {
  .layout-overlay {
    height: 100dvh;
    overflow: hidden;          /* the page itself never scrolls */
  }

}

.stage--overlay {
  position: relative;
  display: block;
  flex: 1;
  min-height: 100dvh;
}

.stage--overlay .stage__visual {
  position: absolute;
  inset: 0;
  padding: 0;
  background: #123f63;
  display: block;
  overflow: hidden;
}

/* Blurred fill behind the letterbox bands. Relative to the stylesheet, which
   lives beside the image in assets/, so the path holds at every page depth. */
.stage--overlay .stage__visual::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('hero.jpg') center / cover no-repeat;
  filter: blur(30px) saturate(1.15);
  transform: scale(1.15);
}

.stage--overlay .visual__inner {
  position: static;
  max-width: none;
  height: 100%;
}

.stage--overlay .visual__img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;        /* whole creative, never cropped */
  object-position: center;
  border-radius: 0;
  box-shadow: none;
}

/* A light overall veil for depth. Contrast for the text is handled by the
   content column's own scrim below, not by this. */
.stage--overlay .stage__visual::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(4, 20, 34, 0.16);
}

.stage--overlay .stage__content {
  position: relative;
  z-index: 2;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: flex-end;   /* mirrors to the left in RTL */
  padding: 76px clamp(20px, 4vw, 64px) 32px;
  background: none;
  /* If the viewport is too short for the content, this panel scrolls - never
     the page, so the artwork stays put. */
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Travels with the column, so white text is legible whether the artwork behind
   it happens to be bright sky, magenta sand, or the National Day badge. */
.stage--overlay .stage__content::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to left, rgba(4, 20, 34, 0.86) 0%, rgba(4, 20, 34, 0.66) 48%, rgba(4, 20, 34, 0) 100%);
}

[dir='rtl'] .stage--overlay .stage__content::before {
  background: linear-gradient(to right, rgba(4, 20, 34, 0.86) 0%, rgba(4, 20, 34, 0.66) 48%, rgba(4, 20, 34, 0) 100%);
}

/* Over the artwork the section heading has to be white, not brand magenta. */
.stage--overlay .content-heading {
  color: #fff;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.6);
}

.stage--overlay .stage__content-inner { max-width: 440px; }

.stage--overlay .form-card,
.stage--overlay .thanks {
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
  border-color: transparent;
}

/* Tightened so a five-branch list and a six-field form both fit one screen. */
.stage--overlay .form-card { padding: 22px 22px 24px; }
.stage--overlay .form-group { margin-bottom: 12px; }
.stage--overlay .form-card__intro { margin: 4px 0 16px; }
.stage--overlay .form-textarea { min-height: 66px; }
.stage--overlay .branch-grid { gap: 9px; }
.stage--overlay .branch-card { padding: 12px 18px; }
.stage--overlay .branch-card__cta { margin-top: 4px; }
.stage--overlay .content-heading { margin-bottom: 14px; }

.content-caption { text-align: center; margin-bottom: 16px; }

.stage--overlay .content-caption {
  color: #fff;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.6);
}

.content-caption__title { font-size: clamp(20px, 1.9vw, 27px); font-weight: 700; }

.content-caption__subtitle { font-size: clamp(13px, 1.1vw, 16px); opacity: 0.95; margin-top: 2px; }

.content-caption__services {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin-top: 12px;
}

.content-caption__services .visual__service {
  background: rgba(255, 255, 255, 0.26);
  border-color: rgba(255, 255, 255, 0.55);
  font-size: 13px;
  padding: 5px 13px;
}

/* On a phone the artwork is a wide sliver against a tall screen, so it goes
   back to a band above the content and the page scrolls normally. */
@media (max-width: 900px) {
  .stage--overlay { min-height: 0; }

  .stage--overlay .stage__visual { position: static; background: none; }

  .stage--overlay .stage__visual::before,
  .stage--overlay .stage__visual::after { display: none; }

  .stage--overlay .visual__img { height: auto; }

  .stage--overlay .stage__content {
    height: auto;
    overflow: visible;
    justify-content: center;
    padding: 24px 20px 40px;
    background: var(--page-bg);
  }

  .stage--overlay .content-caption { color: var(--brand-purple); text-shadow: none; }

  .stage--overlay .content-caption__subtitle { color: var(--muted); }

  .stage--overlay .content-caption__services .visual__service {
    background: rgba(142, 42, 107, 0.08);
    border-color: rgba(142, 42, 107, 0.25);
    color: var(--brand-purple);
  }
}

/* ---------- Copyright -------------------------------------- */
/* Sits in the bottom-left of the creative column rather than in a full-width
   strip of its own - same treatment as the language switch in the top-left.
   Pinned physically left in both languages, like the columns themselves. */

.visual__copyright {
  position: absolute;
  left: 36px;
  bottom: 22px;
  z-index: 3;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
}

/* Must come after the base rule: same specificity, so source order decides. */
@media (max-width: 900px) {
  .visual__copyright { left: 20px; bottom: 15px; font-size: 11.5px; }
}

/* ---------- Landing page cards ----------------------------- */

.branch-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.branch-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}

.branch-card::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: linear-gradient(180deg, var(--brand-magenta), var(--brand-purple));
}

.branch-card:hover,
.branch-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--brand-magenta);
}

.branch-card__name {
  font-size: 18px;
  font-weight: 700;
  color: var(--brand-purple);
}

.branch-card__name-alt {
  font-size: 14px;
  color: var(--muted);
}

.branch-card__cta {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--brand-magenta);
}

/* ---------- Thank-you page --------------------------------- */

.thanks {
  text-align: center;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 44px 26px;
}

.thanks__icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 22px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  font-size: 38px;
  line-height: 72px;
  font-weight: 700;
}

.thanks__title { font-size: clamp(26px, 5vw, 34px); color: var(--brand-purple); }

.thanks__message { color: var(--muted); margin-top: 10px; }


.thanks__back {
  display: inline-block;
  margin-top: 26px;
  padding: 13px 30px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand-magenta), var(--brand-purple));
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.thanks__back:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* ============================================================
   form.css - card, inputs, submit button, alerts
   ============================================================ */

.form-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
}

.form-card__heading {
  font-size: clamp(20px, 4vw, 25px);
  color: var(--brand-purple);
  text-align: center;
}

.form-card__intro {
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  margin: 6px 0 24px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 460px) {
  .form-row { grid-template-columns: 1fr; }
}

.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.form-label .req { color: var(--brand-magenta); }

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 16px; /* 16px stops iOS Safari zooming on focus */
  color: var(--brand-navy);
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--brand-magenta);
  box-shadow: 0 0 0 3px rgba(214, 21, 111, 0.13);
}

.form-input.is-invalid,
.form-select.is-invalid {
  border-color: var(--error);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%236b6570'%3E%3Cpath d='M8 11.5 2.5 6h11z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 14px;
  padding-right: 38px;
}

.form-textarea { resize: vertical; min-height: 92px; }

.error-message {
  color: var(--error);
  font-size: 13.5px;
  margin-top: 5px;
  display: none;
}

.error-message.is-visible { display: block; }

/* ---------- Submit button ---------------------------------- */

.submit-btn {
  width: 100%;
  margin-top: 6px;
  padding: 15px;
  border: 0;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand-magenta), var(--brand-purple));
  color: #fff;
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.submit-btn:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }

.spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner.is-visible { display: block; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Alert toast ------------------------------------ */

.alert {
  position: fixed;
  top: 16px;
  inset-inline-end: 16px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  opacity: 0;
  transform: translateY(-14px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.alert.is-visible { opacity: 1; transform: translateY(0); }

.alert--error   { background: var(--error); }
.alert--success { background: var(--success); }

/* ============================================================
   rtl.css - Arabic / right-to-left overrides
   Logical properties (inset-inline-*, padding-inline-*) handle
   most of it; these are the cases that need an explicit flip.
   ============================================================ */

[dir='rtl'] .form-input,
[dir='rtl'] .form-select,
[dir='rtl'] .form-textarea {
  text-align: right;
}

[dir='rtl'] .form-select {
  background-position: left 14px center;
  padding-right: 14px;
  padding-left: 38px;
}

/* Phone numbers stay left-to-right even inside an RTL page,
   otherwise 0598559946 renders in a confusing order. */
[dir='rtl'] input[type='tel'] {
  direction: ltr;
  text-align: right;
}
