/* HY Visa Services — shared styles
   Brand: navy #0A2342 → #1C4A7F, cyan #0F7EA6 → #2EC0E6, Teal Ink #0B78A3 for text
   Dark mode: Night #071A33, Passport Navy #0C2D52 (brand kit v1.1 colours)
   Fonts (brand kit): Exo 2 = headlines and labels, Plus Jakarta Sans = body text,
   Cairo = Arabic. Self-hosted in /assets/fonts (SIL Open Font License, see LICENSE-*.txt). */

/* ---------- Fonts ---------- */

@font-face {
  font-family: "Exo 2";
  src: url("/assets/fonts/exo-2-latin-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/assets/fonts/plus-jakarta-sans-latin-wght.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Cairo";
  src: url("/assets/fonts/cairo-arabic-wght.woff2") format("woff2");
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  --navy-900: #0A2342;
  --navy-500: #1C4A7F;
  --teal: #0B78A3;      /* brand Teal Ink: the cyan to use for text on light backgrounds */
  --cyan-500: #18A9D2;
  --cyan-300: #2EC0E6;
  --bg: #FBFCFD;
  --surface: #FFFFFF;
  --text: #0C2D52;      /* brand Passport Navy */
  --muted: #4A5F7D;
  --line: #DCE4EE;
  --sep: rgba(12, 45, 82, .22);     /* thin separator in the top bar */
  --accent: var(--teal);
  --rule: var(--cyan-500);          /* underline under section titles */
  --tint: rgba(24, 169, 210, .12);  /* soft cyan behind icons */
  --link: var(--navy-500);
  --primary-bg: linear-gradient(135deg, var(--navy-500), var(--navy-900));
  --primary-text: #FFFFFF;
  /* Top-of-page glow: a colour (--glow-rgb) and its strength at the very top (--glow-a).
     The body rule below eases it out to nothing. Light mode: brand cyan. */
  --glow-rgb: 46, 192, 230;
  --glow-a: .38;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(10, 35, 66, .06), 0 8px 24px rgba(10, 35, 66, .08);

  /* ---- Type scale ----
     Every piece of text uses one of these sizes and weights, so things with the same job
     always look the same. Do not write a raw font-size or font-weight on a component.
       meta  14  language buttons, copyright, copy button
       body  15  descriptions, notices
       label 16  button labels, social names, footer link
       lead  18  main (WhatsApp) button, slogan, service titles
       title 24  section titles, 01 / 02 / 03        hero 28  homepage title
     Weights: 400 text · 600 labels and titles · 700 main button, section titles, numbers */
  --fs-meta: 14px;
  --fs-body: 15px;
  --fs-label: 16px;
  --fs-lead: 18px;
  --fs-title: 24px;
  --fs-hero: 28px;
  --fw-regular: 400;
  --fw-label: 600;
  --fw-bold: 700;
  --lh-label: 1.3;
  --lh-body: 1.5;

  /* Cairo is listed after the Latin fonts so Arabic words on a French/English page
     (e.g. the homepage button) still use the brand Arabic font. */
  --font-display: "Exo 2", "Plus Jakarta Sans", "Cairo", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-text: "Plus Jakarta Sans", "Cairo", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* Cairo only covers Arabic here; Latin words inside Arabic text (Instagram, hyvisaservices.com)
     fall through to Plus Jakarta Sans. */
  --font-arabic: "Cairo", "Plus Jakarta Sans", "Noto Sans Arabic", "Geeza Pro", "Segoe UI Arabic", system-ui, sans-serif;
  color-scheme: light;
}

/* Arabic page: Cairo for everything. */
:root:lang(ar) {
  --font-display: var(--font-arabic);
  --font-text: var(--font-arabic);
  /* Arabic script reads smaller at the same size, so running text and the lead tier get +1px.
     This is the only place Arabic sizes differ; components never override them. Labels stay 16
     so "البريد الإلكتروني" fits in the half-width E-mail button. Section titles: see h2 below. */
  --fs-body: 16px;
  --fs-lead: 19px;
  --lh-label: 1.45;
  --lh-body: 1.7;
}

/* Dark mode: data-theme is set by /assets/js/theme.js before the page paints. */
:root[data-theme="dark"] {
  --bg: #071A33;      /* brand "Night" */
  --surface: #0C2D52; /* brand "Passport Navy" */
  --text: #E8EFF7;
  --muted: #A3B6CE;
  --line: #1D4270;
  --sep: rgba(232, 239, 247, .28);
  --accent: var(--cyan-300);
  --rule: var(--cyan-300);
  --tint: rgba(46, 192, 230, .16);
  --link: var(--cyan-300);
  --primary-bg: linear-gradient(135deg, var(--cyan-300), var(--cyan-500));
  --primary-text: var(--navy-900);
  /* Dark mode glow: a deeper brand blue (cyan over the navy looked like a grey-teal haze). */
  --glow-rgb: 22, 120, 210;
  --glow-a: .44;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  /* svh = the screen height WITH the phone's address bar showing, so a short page never gets a
     pointless scrollbar. The vh line is the fallback for older browsers. */
  min-height: 100vh;
  min-height: 100svh;
  font-family: var(--font-text);
  font-size: var(--fs-label);
  color: var(--text);
  /* Blue glow at the top of the page: full strength at the very top, fading out
     exactly at 50% of the screen height (50vh). Colour and strength: --glow-rgb / --glow-a above.
     The fade follows a smoothstep curve (1 - (3t^2 - 2t^3)) in ten small steps. A gradient with
     only a few stops has sharp bends that show up as faint lines along the screen edges; this
     one has none, and it reaches zero gently. The base colour is its own declaration so the
     page keeps its background colour even where the glow is not supported. */
  background-color: var(--bg);
  background-repeat: no-repeat;
  background-position: 50% 0;
  background-size: 100% 50vh;
  background-size: 100% 50svh;
  background-image: radial-gradient(ellipse 120% 100% at 50% 0,
    rgba(var(--glow-rgb), var(--glow-a)) 0%,
    rgba(var(--glow-rgb), calc(var(--glow-a) * .972)) 10%,
    rgba(var(--glow-rgb), calc(var(--glow-a) * .896)) 20%,
    rgba(var(--glow-rgb), calc(var(--glow-a) * .784)) 30%,
    rgba(var(--glow-rgb), calc(var(--glow-a) * .648)) 40%,
    rgba(var(--glow-rgb), calc(var(--glow-a) * .5)) 50%,
    rgba(var(--glow-rgb), calc(var(--glow-a) * .352)) 60%,
    rgba(var(--glow-rgb), calc(var(--glow-a) * .216)) 70%,
    rgba(var(--glow-rgb), calc(var(--glow-a) * .104)) 80%,
    rgba(var(--glow-rgb), calc(var(--glow-a) * .028)) 90%,
    rgba(var(--glow-rgb), 0) 100%);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

:root:lang(ar) body { line-height: 1.7; }

a { color: inherit; }

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

/* ---------- Card page ---------- */

.card {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  /* 20px sides, or the notch / rounded-corner area if that is bigger (phone held sideways) */
  padding: max(16px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
           max(36px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}

/* Top bar: the dark mode button and the three languages form one centred group, with a thin
   separator between items. No borders or backgrounds: the selected language and the dark mode
   button only change colour (the button also swaps its icon). The bar is always left-to-right
   (dir="ltr" in the HTML), so switching to Arabic never moves anything. */
.topbar {
  direction: ltr;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lang {
  display: flex;
  align-items: center;
}

/* separator between the dark mode button and the languages */
.theme-toggle + .lang::before {
  content: "";
  width: 1px;
  height: 16px;
  margin-inline-start: 2px;
  background: var(--sep);
}

.lang button {
  position: relative;
  font-family: var(--font-text);
  font-size: var(--fs-meta);
  font-weight: var(--fw-label);
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 8px;
  min-height: 44px; /* comfortable thumb target */
  padding: 0 14px;
  cursor: pointer;
  transition: color .15s ease;
}

/* separator between two languages */
.lang button + button::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 50%;
  width: 1px;
  height: 16px;
  transform: translateY(-50%);
  background: var(--sep);
}

.lang button[lang="ar"] {
  font-family: var(--font-arabic);
}

.lang button:hover { color: var(--text); }

.lang button[aria-pressed="true"] { color: var(--accent); }

.card-head {
  text-align: center;
  margin-top: 14px;
}

.logo {
  display: block;
  width: 220px;
  max-width: 100%; /* never wider than the screen, even on a 280px folded phone */
  height: auto;
  margin: 0 auto;
}

/* Each page has both official logo versions; CSS shows the one for the theme.
   Dark mode uses "reversed", the brand kit's version for dark backgrounds. */
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }

.slogan {
  margin: 10px auto 0;
  text-wrap: balance; /* if it ever has to wrap (small phones), split it evenly */
  font-family: var(--font-display);
  font-size: var(--fs-lead);
  font-weight: var(--fw-label);
  line-height: var(--lh-label);
  color: var(--accent);
}

.actions {
  display: grid;
  gap: 12px;
  margin-top: 30px;
}

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

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 58px;
  padding: 14px 18px;
  font-size: var(--fs-label);
  font-weight: var(--fw-label);
  line-height: var(--lh-label);
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease;
}

.btn:hover { border-color: var(--cyan-500); }
.btn:active { transform: scale(.98); }

.btn-primary {
  min-height: 66px;
  font-size: var(--fs-lead);
  font-weight: var(--fw-bold);
  color: var(--primary-text);
  border: 0;
  background: var(--primary-bg);
}

.btn-primary:hover { filter: brightness(1.1); }

.btn-primary .ico { width: 24px; height: 24px; }

/* The two half-width buttons have less side padding in every language, and their label never
   wraps (it would split "Appelez-nous" at the hyphen and make the row taller). The longest
   labels, "البريد الإلكتروني" and "Appelez-nous", fit from 370px wide up; below that the two
   buttons stack (see the media query further down). */
.btn-row .btn { padding-inline: 6px; }
.btn-row .btn span { white-space: nowrap; }

.ico {
  width: 22px;
  height: 22px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn:not(.btn-primary) .ico { stroke: var(--accent); }

/* "No app opened?" notice under the Call / E-mail buttons */
.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.notice[hidden] { display: none; }

.notice p {
  margin: 0;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--muted);
}

.notice-value {
  display: block;
  margin-top: 2px;
  font-family: var(--font-text);
  font-size: var(--fs-label);
  font-weight: var(--fw-label);
  color: var(--text);
  user-select: all;
}

.notice-copy {
  flex: none;
  min-height: 44px;
  padding: 8px 16px;
  font-family: var(--font-text);
  font-size: var(--fs-meta);
  font-weight: var(--fw-bold);
  color: var(--primary-text);
  background: var(--primary-bg);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.notice-copy:hover { filter: brightness(1.1); }

/* ---------- Dark mode button ---------- */

/* Just the icon: no border, no background. Moon in light mode, sun in dark mode, each in
   that mode's accent colour. */
.theme-toggle {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--accent);
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: color .15s ease;
}

.theme-toggle:hover { color: var(--text); }

.theme-toggle .ico {
  width: 20px;
  height: 20px;
}

.theme-toggle .ico-sun,
:root[data-theme="dark"] .theme-toggle .ico-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .ico-sun { display: block; }

/* ---------- Section titles: big and underlined ---------- */

h2 {
  margin: 0 0 20px;
  text-align: center;
  font-family: var(--font-display);
  font-size: var(--fs-title);
  font-weight: var(--fw-bold);
  line-height: 1.25;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 3px;
  text-decoration-skip-ink: none;
  text-underline-offset: 9px;
}

:root:lang(ar) h2 {
  font-size: 26px;
  letter-spacing: 0;
  text-transform: none;
  text-underline-offset: 11px;
}

/* ---------- Socials ---------- */

.social { margin-top: 44px; }

.social ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* If the number of tiles is odd, the last one spans both columns so no half-empty row is left. */
.social li:last-child:nth-child(odd) { grid-column: 1 / -1; }

.social-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 14px;
  font-size: var(--fs-label);
  font-weight: var(--fw-label);
  line-height: var(--lh-label);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease;
}

.social-link:hover { border-color: var(--cyan-500); }
.social-link:active { transform: scale(.98); }

.social-ico {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  color: var(--accent);
  background: var(--tint);
  border-radius: 12px;
}

.social-ico .ico { width: 22px; height: 22px; }

/* Phones up to 369px wide (the common 360px Androids included): Call and E-mail one per row,
   full width, so their labels are never cramped in any language. */
@media (max-width: 369px) {
  .btn-row { grid-template-columns: 1fr; }
}

/* Very small phones (320 px wide): one tile per row so "Instagram" never gets squeezed. */
@media (max-width: 359px) {
  .social ul { grid-template-columns: 1fr; }
}

/* ---------- Services ---------- */

.services { margin-top: 44px; }

.services ul {
  list-style: none;
  counter-reset: service;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.services li {
  counter-increment: service;
  display: grid;
  grid-template-columns: 40px 1fr;
  column-gap: 14px;
  align-items: start;
  padding: 18px 18px;
  border-top: 1px solid var(--line);
}

.services li:first-child { border-top: 0; }

/* 01 / 02 / 03, drawn by CSS so the markup stays clean */
.services li::before {
  content: counter(service, decimal-leading-zero);
  grid-row: 1 / span 2;
  direction: ltr;
  font-family: var(--font-display);
  font-size: var(--fs-title);
  font-weight: var(--fw-bold);
  line-height: 1.2;
  color: var(--accent);
}

.services strong {
  font-family: var(--font-display);
  font-size: var(--fs-lead);
  font-weight: var(--fw-label);
  line-height: var(--lh-label);
}

.services span {
  margin-top: 4px;
  font-size: var(--fs-body);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  color: var(--muted);
}

/* ---------- Footer ---------- */

.card-foot {
  margin-top: 44px;
  text-align: center;
  font-size: var(--fs-meta);
  color: var(--muted);
}

.card-foot a {
  /* the text is small, so pad it to a 44px-tall tap area; the negative margin gives the
     space back so the layout does not move */
  display: inline-block;
  padding: 12px 10px;
  margin: -12px 0;
  font-family: var(--font-text);
  font-size: var(--fs-label);
  font-weight: var(--fw-label);
  color: var(--link);
  text-decoration: none;
}

.card-foot p { margin: 6px 0 0; }

/* ---------- Simple pages (home, 404) ---------- */

.simple {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
}

/* Homepage and 404 page. The top bar (same as /socials) floats over the top of the screen and
   takes no space in the layout, so the content is centred on the WHOLE screen, not in what is
   left below the bar. The content has the bar's height as padding above AND below, which also
   keeps it from ever sliding under the bar on a short screen. */
.has-topbar {
  --topbar-h: calc(max(16px, env(safe-area-inset-top)) + 44px); /* top padding + 44px buttons */
  position: relative;
}

.has-topbar > .topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: max(16px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 0
           max(20px, env(safe-area-inset-left));
}

.has-topbar .simple {
  padding-block: var(--topbar-h);
}

/* 260px, but on a short screen (phone held sideways) it shrinks so the page fits better */
.simple .logo { width: 260px; width: min(260px, 34svh); }

.simple h1 {
  margin: 28px 0 10px;
  margin-block-start: clamp(14px, 3.2svh, 28px); /* tighter on short phones, 28px on tall ones */
  font-family: var(--font-display);
  font-size: var(--fs-hero);
  font-weight: var(--fw-bold);
  line-height: 1.2;
  text-wrap: balance; /* "Website under construction" splits evenly on a narrow phone */
}

.simple p {
  margin: 0 auto;
  max-width: 34ch;
  font-size: var(--fs-lead);
  line-height: var(--lh-body);
  color: var(--muted);
  text-wrap: balance; /* no lone word on the last line */
}

.simple .btn {
  display: inline-flex;
  margin-top: 28px;
  margin-block-start: clamp(14px, 3.2svh, 28px);
}

@media (prefers-reduced-motion: reduce) {
  .btn, .theme-toggle, .lang button, .social-link { transition: none; }
}

.simple p + p { margin-top: 8px; }
