/* ===========================================================================
   GenkiCars, phone app shell
   On a phone the site behaves like an app: a bottom tab bar instead of a
   hamburger, a menu that rises as a sheet, room for the notch and the home
   indicator. Installed from the home screen (display-mode: standalone) it
   also gets its own back button, because there is no browser chrome left.
   Desktop is untouched: everything here is inside the phone breakpoint or the
   standalone query.
   =========================================================================== */

.app-tabs, .app-back { display: none; }

/* Language switch: a quiet pill in the header, labelled in the OTHER language
   ("English" on Arabic pages, "العربية" on English ones). */
.footer-blurb { font-size: .9rem; max-width: 44ch; line-height: 1.6; }

/* Arabic script reads small at Latin sizes; lift body text a step and give
   lines more room. Headings keep their scale. */
.lang-ar body, body.lang-ar { font-size: 17px; line-height: 1.75; }
/* Letter-spacing pulls apart the joins between Arabic letters, so none at all. */
.lang-ar * { letter-spacing: 0 !important; }
.lang-ar h1, .lang-ar h2, .lang-ar h3 { line-height: 1.35; }

.footer-disclaimer {
  margin: 2rem 0 0; max-width: 70ch;
  color: var(--ink-3); font-size: .82rem;
}

@media (max-width: 999px) {
  /* ---- bottom tab bar ---------------------------------------------------- */
  .app-tabs {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; inset-inline: 0; bottom: 0; z-index: 120;
    padding-bottom: env(safe-area-inset-bottom);
    /* Solid, not blurred: a blur here is redrawn on every frame of a scroll. */
    background: #fff;
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 24px rgba(16,20,24,.08);
  }
  .app-tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 56px; padding: 6px 2px 4px;
    background: none; border: 0; cursor: pointer;
    font: inherit; font-size: .68rem; font-weight: 600; letter-spacing: .01em;
    color: var(--ink-3);
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none; user-select: none;
  }
  .app-tab:hover { text-decoration: none; color: var(--ink); }
  .app-tab svg {
    width: 24px; height: 24px;
  }
  .app-tab[aria-current="page"], .app-tab[aria-expanded="true"] { color: var(--ink); }
  .app-tab[aria-current="page"] svg { color: var(--green); }
  .app-tab:active svg { transform: scale(.92); }

  /* Room under the content for the bar, given to the footer itself so the
     page ends in the footer's white, not in a grey strip below it. */
  .site-footer { padding-bottom: calc(1.5rem + 56px + env(safe-area-inset-bottom)); }
  /* No rubber-band stretch past the footer (it read as the page scrolling
     on forever on iPhone). */
  html, body { overscroll-behavior-y: none; }

  /* The tab bar's "More" replaces the hamburger. */
  .nav-toggle { display: none; }

  /* ---- the menu becomes a bottom sheet ----------------------------------- */
  .mobile-nav {
    position: fixed; inset-inline: 0; bottom: calc(56px + env(safe-area-inset-bottom)); z-index: 119;
    max-height: 70vh; overflow-y: auto;
    border-radius: 20px 20px 0 0; border-top: 0;
    box-shadow: 0 -12px 40px rgba(16,20,24,.16);
    padding-block: 8px;
    transform: translateY(16px); opacity: 0;
    transition: transform .2s ease, opacity .2s ease;
  }
  .mobile-nav.is-open { display: block; transform: none; opacity: 1; }
  .mobile-nav a { padding-block: 1rem; }
  .mobile-nav a:last-child { border-bottom: 0; }
  .app-scrim {
    position: fixed; inset: 0; z-index: 118;
    background: rgba(16,20,24,.28);
  }

  /* Tighter header on phones: the tab bar carries the navigation now. */
  .site-header { background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .site-header__inner { min-height: 60px; gap: .75rem; }
  .site-logo img { height: 22px; }
  /* The logo sits in the middle, like an app's title bar: back button (when
     installed) on the left, the request button on the right. Three columns,
     the outer two equal, so the logo is centred whatever is beside it. */
  .site-header__inner { display: grid; grid-template-columns: 1fr auto 1fr; }
  .site-header__inner > * { grid-row: 1; }
  .app-back { grid-column: 1; justify-self: start; }
  .site-logo { grid-column: 2; justify-self: center; }
  .header-actions { grid-column: 3; justify-self: end; }
}

/* ---- installed on the home screen ---------------------------------------- */
@media (display-mode: standalone) {
  /* The status bar sits above the page (style "default"); this is 0 then,
     and only matters on devices that still overlay it. */
  .site-header { padding-top: env(safe-area-inset-top); }
  .topbar { display: none !important; }
  .app-back {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; margin-inline-start: -8px;
    color: var(--ink); border-radius: 50%;
  }
  .app-back svg { width: 24px; height: 24px; }
  [dir="rtl"] .app-back svg { transform: scaleX(-1); }
  .app-back:active { background: var(--bg-soft); }
  /* No rubber-band pull revealing a blank page behind the app. */
  html, body { overscroll-behavior-y: none; }
  /* The footer is web furniture; in the app the tabs and More sheet cover it. */
  .site-footer .footer-grid { display: none; }
  .site-footer { margin-top: 2rem; padding-top: 1rem; }
}

/* ---- Touch screens: feel like an app ----------------------------------------
   touch-action: manipulation tells the phone a tap is never the start of a
   double-tap zoom, so it answers at once instead of waiting to see. */
a, button, label, input, select, textarea, summary, [role="button"] { touch-action: manipulation; }
@media (hover: none) {
  .btn:hover { transform: none; }
  .app-tab { transition: color .15s ease; }
  .app-tab svg { transition: transform .16s cubic-bezier(.32, .72, 0, 1); }
  .app-tab:active svg { transform: scale(.86); }
}

/* Header: the buyer's Sign in / My requests link, on every page (not only the match pages). */
/* Computer header: logo | links + "Send a request" | divider | account.
   White, black type, the green only on the one button that matters. */
@media (min-width: 1000px) {
  .site-header { background: rgba(255,255,255,.96); box-shadow: 0 1px 0 rgba(16,20,24,.04), 0 10px 30px rgba(16,20,24,.06); }
  .site-header__inner { min-height: 74px; gap: 1rem; }
  .site-nav { gap: .35rem; }
  .site-nav a:not(.btn) { padding: .6rem 1rem; border-radius: var(--r-pill); color: var(--ink); font-weight: 600; font-size: .95rem; }
  .site-nav a:not(.btn):hover { background: var(--bg-soft); }
  .site-nav a:not(.btn)[aria-current="page"] { background: var(--bg-soft); }
  .site-nav a:not(.btn)[aria-current="page"]::after { display: none; }
  .header-actions { padding-inline-start: 1rem; margin-inline-start: .25rem; border-inline-start: 1px solid var(--line); }
}
/* The nav's link styles must not reach the button inside it. */
.site-nav a.btn, .site-nav a.btn:hover { color: var(--btn-fg); background: var(--btn-bg); }
.site-nav a.btn::after { display: none; }
.site-nav .header-cta, .header-cta { white-space: nowrap; display: inline-flex; align-items: center; gap: .5rem; padding: .6rem 1.15rem .6rem .7rem; border-radius: var(--r-pill); font-weight: 700; }
.header-cta__plus { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--logo-ink); color: #fff; }
.header-cta[aria-current="page"] { box-shadow: 0 0 0 3px var(--green-ring); }
/* The account: a black disc with the person, the words beside it. */
.header-account {
  display: inline-flex; align-items: center; gap: .55rem; padding: .3rem .95rem .3rem .3rem; border-radius: var(--r-pill);
  border: 1px solid var(--line-strong); background: #fff;
  color: var(--ink); font-weight: 600; font-size: .92rem; white-space: nowrap;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.header-account:hover, .header-account[aria-current="page"] { border-color: var(--ink); box-shadow: var(--shadow-sm); text-decoration: none; }
.header-account__icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--logo-ink); color: #fff; position: relative; }
.header-account.is-in .header-account__icon::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 2px #fff; }
/* Phones: the tab bar carries both. */
@media (max-width: 999px) { .header-account, .header-cta { display: none; } }
