/* ==========================================================================
   Redwan Rahman & Co. — mobile & tablet experience layer
   Loaded after layout.css / home.css on every page. Desktop (> 920px) is untouched
   except for the shared helpers at the top, which have no visual effect there.
   ========================================================================== */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body { -webkit-tap-highlight-color: rgba(13, 20, 26, .08); }

/* Call / email shortcuts live only in the mobile menu */
.menu-cta { display: none; }

/* Back-to-top button (created by site.js) */
.to-top {
  position: fixed;
  right: 28px;
  bottom: 100px;
  z-index: 59;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  color: var(--c-ink, #0d141a);
  background: rgba(255, 255, 255, .96);
  border: 1px solid rgba(13, 20, 26, .12);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .25s ease, transform .25s ease, visibility .25s;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: #fff; }

/* Visible keyboard focus everywhere */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid #5d6d7e;
  outline-offset: 3px;
}

/* Tall builder blocks: slide in from a fixed short distance instead of 20% of their height */
.transition.transition--slide:not(.transition--root-hidden):not([data-animation-state="active"]) {
  transform: translateY(min(20%, 48px));
}

@media (prefers-reduced-motion: reduce) {
  .transition,
  .transition [data-animation-role] { opacity: 1 !important; transform: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ==========================================================================
   Phones & small tablets
   ========================================================================== */
@media (max-width: 920px) {

  /* ---------- Header: slimmer, and compacts with a shadow once you scroll ---------- */
  :root { --header-h: 72px; }
  .site-header { transition: box-shadow .25s ease, height .25s ease; }
  .site-header.is-scrolled { box-shadow: 0 2px 16px rgba(13, 20, 26, .08); }
  .site-header__inner { padding: 0 12px 0 20px; }
  .site-header__logo img { width: 236px; height: 47px; }

  .burger { width: 44px; height: 44px; border-radius: 10px; }
  .burger span { left: 11px; right: 11px; }
  .burger span:nth-child(1) { top: 15px; }
  .burger span:nth-child(2) { top: 21px; }
  .burger span:nth-child(3) { top: 27px; }
  .burger:active { background: rgba(13, 20, 26, .06); }

  /* ---------- Menu: full-width list with clear tap rows ---------- */
  .site-header__menu {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 20px calc(24px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(13, 20, 26, .08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity .22s ease, transform .22s ease, visibility .22s;
  }
  .site-header.is-open .site-header__menu { opacity: 1; visibility: visible; transform: none; }

  .site-header__menu nav { width: 100%; }
  .nav { gap: 0; align-items: stretch; }
  .nav > .nav__item { text-align: left; border-bottom: 1px solid rgba(13, 20, 26, .08); }
  .nav > .nav__item > .nav__link {
    display: flex;
    justify-content: space-between;
    width: 100%;
    min-height: 56px;
    font-size: 18px;
    text-decoration: none;
  }
  .nav > .nav__item > .nav__link.is-active { font-weight: 600; text-decoration: none; }
  .nav > .nav__item > .nav__link.is-active::before {
    content: '';
    width: 4px;
    height: 20px;
    margin-right: 12px;
    border-radius: 2px;
    background: #5d6d7e;
    order: -1;
  }
  .nav > .nav__item > .nav__link.is-active { justify-content: flex-start; }
  .nav__item--dropdown > .nav__link .nav__caret { margin-left: auto; width: 12px; height: 8px; }

  /* Services sub-menu: smooth accordion */
  .nav__dropdown-area,
  .nav__item--dropdown:hover .nav__dropdown-area {
    display: grid;
    grid-template-rows: 0fr;
    padding: 0;
    transition: grid-template-rows .25s ease;
  }
  .nav__item--dropdown.is-open .nav__dropdown-area { display: grid; grid-template-rows: 1fr; }
  .nav__dropdown {
    overflow: hidden;
    align-items: stretch;
    gap: 0;
    padding: 0 0 0 16px;
    background: transparent;
    box-shadow: none;
  }
  .nav__item--dropdown.is-open .nav__dropdown { padding-bottom: 8px; }
  .nav__dropdown .nav__link {
    display: flex;
    min-height: 44px;
    font-size: 16px;
    color: #56585e;
    text-decoration: none;
  }
  .nav__dropdown .nav__link.is-active { color: var(--c-ink, #0d141a); font-weight: 600; }

  .menu-cta { display: flex; flex-direction: column; gap: 12px; margin-top: 28px; }
  .menu-cta__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 52px;
    padding: 0 20px;
    font-family: var(--f-body, Inter, sans-serif);
    font-size: 16px;
    font-weight: 500;
    color: var(--c-ink, #0d141a);
    text-decoration: none;
    border: 1px solid var(--c-ink, #0d141a);
    border-radius: 28px;
  }
  .menu-cta__btn--primary { color: #fff; background: #1c2833; border-color: #1c2833; }
  .site-header__menu .socials { justify-content: center; gap: 8px; margin-top: 20px; }
  .site-header__menu .socials a { width: 44px; height: 44px; align-items: center; justify-content: center; }

  /* keep floating buttons out of the way while the menu is open */
  body.menu-open .whatsapp,
  body.menu-open .to-top { opacity: 0; visibility: hidden; }

  /* ---------- Floating buttons: smaller and clear of the home-indicator area ---------- */
  .whatsapp { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); }
  .whatsapp svg { width: 56px; height: 56px; }
  .to-top { right: 20px; bottom: calc(84px + env(safe-area-inset-bottom)); width: 44px; height: 44px; }

  /* ---------- Content (builder pages) ---------- */
  /* short pages: the footer follows the content instead of leaving a white band */
  main.page { min-height: 0; }

  /* bigger tap area for links inside text, without moving the text */
  .text-box a { padding-block: 6px; }
  .text-box p,
  .text-box li { overflow-wrap: anywhere; }
  .text-box p { text-wrap: pretty; }
  .text-box h1,
  .text-box h2,
  .text-box h3 { text-wrap: balance; }

  /* small pill buttons (phone numbers, e-mail on Contact) become comfortable to tap */
  .layout-element .grid-button { min-height: 40px; }

  /* the services diagram is shown whole, never cropped */
  .m-contain .image__image { object-fit: contain !important; }

  /* contact form: thumb-friendly controls */
  .js-contact-form .input__component { min-height: 52px; font-size: 16px; }
  .js-contact-form textarea.input__component { min-height: 140px; }
  .js-contact-form .form__button { width: 100%; min-height: 52px; }

  /* map fills the width nicely */
  .grid-map__frame { border-radius: 12px; }

  /* ---------- Home page specifics ---------- */
  .q-card__body .btn { min-height: 44px; }
  .slideshow__dots { gap: 0; bottom: 12px; }
  .slideshow__dot { box-sizing: content-box; padding: 11px 7px; background-clip: content-box; }
  .slideshow__nav { padding: 0 16px; }

  /* ---------- Footer ---------- */
  .site-footer { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .footer__grid { gap: 36px; }
  .footer__heading { margin-bottom: 8px; letter-spacing: .02em; }
  .footer__list { line-height: 1.5; }
  .footer__list li a { display: inline-block; padding: 8px 0; }
  .footer__list--plain {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 16px;
  }
  .footer__contact p { margin: 0; }
  .footer__contact p a,
  .footer__contact p:last-child { display: inline-block; padding: 8px 0; }
  .subscribe button { width: 100%; min-height: 52px; }
  .footer__socials a { width: 44px; height: 44px; align-items: center; justify-content: center; }
  .footer__legal a { display: inline-block; padding: 8px 2px; }
  .footer__bottom { gap: 8px; }
}

/* Small phones */
@media (max-width: 360px) {
  .site-header__logo img { width: 204px; height: 40px; }
  .footer__list--plain { grid-template-columns: 1fr; }
}

/* Landscape phones: don't let the open menu run off-screen */
@media (max-width: 920px) and (max-height: 500px) {
  .nav > .nav__item > .nav__link { min-height: 46px; }
  .menu-cta { flex-direction: row; }
  .menu-cta__btn { flex: 1; }
}
