/* ==========================================================================
   Responsive — mobile-first overrides
   Breakpoints: 1199px (tablet), 767px (mobile), 480px (small mobile)
   ========================================================================== */

/* Mobile drawer chrome — desktop: wrapper only, hide CTA/close bar */
.smi-mob-drawer {
  display: contents;
}

.smi-mob-drawer-cta {
  display: none;
}

/* ── Tablet ≤ 1199px ── */
@media (max-width: 1199px) {
  :root {
    --hdr-h: 72px;
  }

  .smi-statbar-r,
  .smi-init-bd,
  .smi-news-wrap {
    min-width: 0;
    width: 100%;
  }

  /* Header */
  .smi-hdr-tools {
    direction: ltr;
    gap: 4px;
  }

  .smi-nav-tog { display: flex; }

  .smi-hdr-logo img {
    height: 44px;
    width: auto;
  }

  /* Header — mobile drawer */
  .smi-mob-drawer {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 88vw);
    background: var(--c1d);
    padding: calc(env(safe-area-inset-top, 0px) + 12px) 20px max(24px, env(safe-area-inset-bottom, 0px));
    z-index: 10002;
    overflow-x: hidden;
    overflow-y: auto;
    visibility: hidden;
    transform: translateX(100%);
    transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.38s;
    pointer-events: none;
  }

  .smi-mob-drawer.smi-open {
    visibility: visible;
    transform: translateX(0);
    pointer-events: auto;
  }

  .smi-mob-drawer-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 8px;
    background: var(--c1);
    color: var(--cbth);
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    transition: background 0.25s, color 0.25s;
  }

  .smi-mob-drawer-cta:hover {
    background: var(--c2);
    color: var(--cbt);
  }

  .smi-mob-drawer-cta .smi-icon {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
  }

  .smi-hdr-nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: static;
    width: 100%;
    padding: 0;
    transform: none;
    visibility: visible;
    pointer-events: auto;
    overflow: visible;
    background: transparent;
  }

  .smi-mob-drawer:not(.smi-open) .smi-hdr-nav > li {
    animation: none;
  }

  .smi-mob-drawer.smi-open .smi-hdr-nav > li {
    animation: smiNavItemIn 0.42s ease forwards;
  }

  .smi-mob-drawer.smi-open .smi-hdr-nav > li:nth-child(1) { animation-delay: 0.06s; }
  .smi-mob-drawer.smi-open .smi-hdr-nav > li:nth-child(2) { animation-delay: 0.1s; }
  .smi-mob-drawer.smi-open .smi-hdr-nav > li:nth-child(3) { animation-delay: 0.14s; }
  .smi-mob-drawer.smi-open .smi-hdr-nav > li:nth-child(4) { animation-delay: 0.18s; }
  .smi-mob-drawer.smi-open .smi-hdr-nav > li:nth-child(5) { animation-delay: 0.22s; }
  .smi-mob-drawer.smi-open .smi-hdr-nav > li:nth-child(6) { animation-delay: 0.26s; }
  .smi-mob-drawer.smi-open .smi-hdr-nav > li:nth-child(7) { animation-delay: 0.3s; }

  .smi-hdr-nav > li {
    opacity: 0;
    transform: translateX(18px);
  }

  @keyframes smiNavItemIn {
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }

  .smi-mob-drawer.smi-open .smi-hdr-nav > li > a {
    color: var(--cw) !important;
    min-height: 48px;
    padding: 12px 0;
    font-size: 17px;
    line-height: 1.4;
  }

  .smi-hdr-nav .smi-has-sub > a {
    justify-content: space-between;
    width: 100%;
  }

  .smi-hdr-nav .smi-sub {
    position: static;
    visibility: visible;
    background: transparent;
    box-shadow: none;
    min-width: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    padding: 0 16px;
    transform: none;
    transition: max-height 0.35s ease, opacity 0.28s ease, padding 0.28s ease;
  }

  .smi-hdr-nav .smi-has-sub.smi-sub-open > .smi-sub {
    max-height: 420px;
    opacity: 1;
    padding: 4px 16px 10px;
  }

  .smi-hdr-nav .smi-sub li a {
    color: rgba(255, 255, 255, 0.8);
    min-height: 44px;
    padding: 10px 0;
    font-size: 14px;
    opacity: 0;
    transform: translateX(10px);
    transition: color 0.2s, opacity 0.28s ease, transform 0.28s ease;
  }

  .smi-hdr-nav .smi-has-sub.smi-sub-open .smi-sub li a {
    opacity: 1;
    transform: translateX(0);
  }

  .smi-hdr-nav .smi-has-sub.smi-sub-open .smi-sub li:nth-child(1) a { transition-delay: 0.04s; }
  .smi-hdr-nav .smi-has-sub.smi-sub-open .smi-sub li:nth-child(2) a { transition-delay: 0.08s; }
  .smi-hdr-nav .smi-has-sub.smi-sub-open .smi-sub li:nth-child(3) a { transition-delay: 0.12s; }
  .smi-hdr-nav .smi-has-sub.smi-sub-open .smi-sub li:nth-child(4) a { transition-delay: 0.16s; }
  .smi-hdr-nav .smi-has-sub.smi-sub-open .smi-sub li:nth-child(5) a { transition-delay: 0.2s; }
  .smi-hdr-nav .smi-has-sub.smi-sub-open .smi-sub li:nth-child(6) a { transition-delay: 0.24s; }
  .smi-hdr-nav .smi-has-sub.smi-sub-open .smi-sub li:nth-child(7) a { transition-delay: 0.28s; }

  /* About */
  .smi-about {
    padding: 80px 0 32px;
  }

  .smi-about-r {
    flex-direction: column;
    gap: 24px;
    text-align: center;
    align-items: center;
  }

  .smi-about-lbl { font-size: clamp(28px, 6vw, 36px); }
  .smi-about-ttl { font-size: clamp(22px, 4.5vw, 28px); }

  /* Statement */
  .smi-stmt-title h2 { font-size: clamp(28px, 6vw, 36px); }
  .smi-stmt-sub { font-size: clamp(16px, 3.5vw, 22px); }
  .smi-stmt {
    --stmt-extra: 95vh;
    height: calc(100vh + var(--stmt-extra));
    margin-bottom: calc(-1 * var(--stmt-extra));
  }
  .smi-stmt-btm-txt { font-size: clamp(36px, 8vw, 48px); }

  /* Initiatives */
  .smi-init {
    padding-bottom: var(--section-y);
  }

  .smi-init-hd {
    padding: 40px var(--pad-x) 12px;
  }

  .smi-init-hd h2 {
    font-size: clamp(28px, 5vw, 40px);
  }

  .smi-init-bd {
    flex-direction: column;
    gap: 32px;
    margin-top: 16px;
  }

  .smi-init-imgs {
    flex: 0 0 90%;
    max-width: 90%;
    width: 90%;
    margin-inline: auto;
  }

  .smi-init-txt {
    padding: 0;
    min-height: 0;
    text-align: center;
  }

  .smi-init-nav {
    justify-content: center;
  }

  .smi-init-duo-sm img {
    height: clamp(220px, 32vw, 360px);
  }

  .smi-init-duo-lg img {
    height: clamp(260px, 36vw, 360px);
  }

  /* Stats */
  .smi-statbar {
    padding: var(--section-y) 0;
  }

  .smi-statbar-r {
    flex-direction: column;
    gap: 32px;
  }

  .smi-statbar-slider {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
  }

  .smi-statbar-txt {
    flex: none;
    text-align: center;
    padding: 0;
  }

  .smi-statbar-txt h2 {
    font-size: clamp(28px, 5vw, 36px);
  }

  .smi-statbar-cards-wrap {
    width: 100%;
    min-width: 0;
  }

  .smi-statbar-cards {
    flex-wrap: nowrap;
    justify-content: flex-start;
    min-height: 0;
    gap: 0;
  }

  .smi-stat-swiper .smi-s-card {
    flex: 0 0 auto;
    height: 80vh !important;
    min-height: 80vh !important;
    aspect-ratio: auto;
    opacity: 1;
  }

  /* News */
  .smi-news-tr {
    gap: 16px;
  }

  .smi-nc {
    flex: 0 0 calc(50% - 8px);
    min-width: 0;
    box-sizing: border-box;
  }

  .smi-news-banner h2,
  .smi-news-lbl,
  .smi-news-hd-txt h2 {
    font-size: clamp(28px, 5vw, 36px);
  }

  /* Contributions */
  .smi-contrib-ken .smi-k-content {
    padding: 32px 40px;
  }

  .smi-contrib-ken .smi-k-desc {
    font-size: 16px;
  }

  /* Inner pages */
  .smi-about-intro-ttl {
    font-size: 22px;
    margin-bottom: 28px;
  }

  .smi-about-intro-wrap {
    flex-direction: column;
    align-items: center;
  }

  .smi-about-intro-visual {
    flex: none;
    width: min(100%, 320px);
    order: -1;
  }

  .smi-about-intro-content {
    padding: 0;
    text-align: center;
  }

  .smi-about-intro-qmark {
    text-align: center;
  }

  .smi-ambition-box {
    flex-direction: column;
  }

  .smi-ambition-visual {
    flex: none;
    min-height: 260px;
  }

  .smi-ambition-content {
    padding: 28px 24px 32px;
  }

  .smi-values-grid { grid-template-columns: repeat(2, 1fr); }
  .smi-about-stats-r { grid-template-columns: repeat(2, 1fr); }

  .smi-init-card,
  .smi-init-card:nth-child(even) {
    flex-direction: column;
  }

  .smi-init-card-img { flex: auto; }
  .smi-init-card-img img { min-height: 250px; }

  .smi-news-grid { grid-template-columns: repeat(2, 1fr); }

  .smi-proj-grid { grid-template-columns: repeat(2, 1fr); }

  .smi-wave {
    margin-top: -21px;
  }
}

/* ── Mobile ≤ 767px ── */
@media (max-width: 767px) {
  :root {
    --hdr-h: 85px;
  }

  /* Prevent horizontal page scroll */
  .smi-hero,
  .smi-about,
  .smi-stmt-title,
  .smi-statbar,
  .smi-init,
  .smi-contrib,
  .smi-reviews,
  .smi-news,
  .smi-ftr {
    max-width: 100%;
    overflow-x: hidden;
    padding-bottom: 20px;
  }

  .smi-statbar-r,
  .smi-init-bd,
  .smi-contrib-head,
  .smi-srv-hd-row {
    min-width: 0;
    width: 100%;
  }

  /* Header */
  .smi-hdr-bar {
    min-height: var(--hdr-h);
    padding: 6px max(12px, env(safe-area-inset-right)) 6px max(12px, env(safe-area-inset-left));
    gap: 6px;
  }

  .smi-hdr-tools {
    direction: ltr;
    gap: 2px;
  }

  .smi-hdr-logo img {
    height: 73px;
    width: auto;
    max-width: min(200px, 48vw);
    object-fit: contain;
  }

  .smi-hdr-act .smi-btn-a11y {
    width: 34px;
    height: 34px;
    font-size: 15px;
  }

  .smi-hdr-act .smi-btn-login {
    display: none;
  }

  .smi-nav-tog {
    padding: 6px;
    flex-shrink: 0;
  }

  .smi-hero {
    min-height: 584px;
    height: 64vh;
    max-height: 693px;
    position: relative;
    overflow: hidden;
  }

  .smi-hero::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    height: 10px;
    pointer-events: none;
    background: linear-gradient(90deg, var(--c2) 0%, var(--c2) 46%, var(--c1d) 46%, var(--c1d) 100%);
    clip-path: polygon(0 100%, 0 0, 100% 100%);
  }

  .smi-hero-bg img,
  .smi-hero-bg video {
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: none;
    object-position: top;
    animation: none;
    transform: none;
  }

  .smi-hero-ov {
    background: linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.22) 0%,
      rgba(0, 0, 0, 0.06) 32%,
      rgba(0, 0, 0, 0.45) 68%,
      rgba(0, 0, 0, 0.68) 100%
    );
  }

  .smi-hero-c {
    align-items: flex-end;
    justify-content: flex-start;
    padding: calc(var(--hdr-h) + env(safe-area-inset-top, 0px) + 8px) var(--pad-x) max(40px, env(safe-area-inset-bottom, 0px) + 20px);
  }

  .smi-hero-txt {
    max-width: min(92%, 340px);
    width: 100%;
    min-width: 0;
    text-align: right;
    margin-inline: 0;
    margin-right: 0;
    margin-left: auto;
    padding-bottom: 4px;
  }

  .smi-hero-quote {
    padding: 10px 36px 6px 12px;
    margin-bottom: 14px;
    line-height: 1.5;
    text-align: right;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .smi-hero-quote::before,
  .smi-hero-quote::after {
    color: var(--c3);
    font-size: clamp(36px, 10vw, 48px);
  }

  .smi-hero-quote::before {
    right: 0;
  }

  .smi-hero-quote::after {
    left: 0;
  }

  .smi-hero-sep {
    width: min(100%, 220px);
    margin: 0 0 14px auto;
  }

  .smi-hero-name {
    text-align: right;
    font-size: 13px;
    line-height: 1.75;
  }

  .smi-hero-cta {
    margin-top: 18px;
    width: 100%;
    max-width: 280px;
    justify-content: center;
  }

  .smi-wave {
    margin-top: -27px !important;
    height: clamp(40px, 2.67vw, 76px);
    animation: none;
  }

  .smi-wave__top {
    top: 7px;
    left: -7px;
  }

  /* About */
  .smi-about {
    padding: 56px 0 24px;
  }

  .smi-about-lbl { font-size: 22px; }
  .smi-about-ttl { font-size: 20px; }
  .smi-about-desc { font-size: 16px; }

  /* Statement — ثابت على الجوال، بدون scroll-pin */
  .smi-stmt {
    --stmt-extra: 0;
    height: auto;
    margin-bottom: 0;
  }

  .smi-stmt-title {
    padding: 32px 0 12px;
  }

  .smi-stmt-title h2 { font-size: 26px; }

  .smi-stmt-sub { font-size: 16px; }

  .smi-stmt-pin {
    position: relative;
    top: auto;
    height: auto;
    min-height: 0;
    max-width: 100%;
  }

  .smi-stmt-stage,
  .smi-stmt-visual {
    height: auto;
  }

  .smi-stmt-visual {
    width: 100% !important;
    transform: none !important;
    will-change: auto;
  }

  .smi-stmt-img {
    height: auto;
    aspect-ratio: 3 / 2;
    max-height: min(52vh, 420px);
  }

  .smi-stmt-img img {
    width: 100%;
    height: 100%;
    max-width: none;
    transform: none !important;
    will-change: auto;
    object-fit: cover;
    object-position: center center;
  }

  .smi-stmt-btm {
    transform: none !important;
    will-change: auto;
  }

  .smi-stmt-btm-txt {
    font-size: clamp(28px, 9vw, 36px);
    padding: 0 var(--pad-x);
    overflow-wrap: anywhere;
  }

  /* Scroll reveal — no off-screen shift on mobile; cards visible immediately */
  .smi-statbar .smi-statbar-txt,
  .smi-statbar .smi-s-card,
  .smi-init-bd .smi-init-imgs,
  .smi-init-bd .smi-init-txt {
    transform: none;
    opacity: 1;
  }

  .smi-contrib-ken .smi-k-img img {
    animation: none;
    transform: none;
  }

  /* Initiatives */
  .smi-init-hd {
    padding-top: 32px;
  }

  .smi-init-imgs {
    flex: 0 0 100%;
    max-width: min(320px, 86%);
    width: 100%;
    margin-inline: auto;
  }

  .smi-init-hd h2 { font-size: 26px; }
  .smi-init-hd p { font-size: 16px; }

  /* موبايل: صورة واحدة في المنتصف */
  .smi-init-duo {
    justify-content: center;
    gap: 0;
  }

  .smi-init-duo-sm {
    display: none;
  }

  .smi-init-duo-lg {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
  }

  .smi-init-duo-lg img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 5;
    max-height: 360px;
    object-fit: cover;
    margin-inline: auto;
  }

  /* إن وُجدت الصغيرة فقط */
  .smi-init-duo:not(:has(.smi-init-duo-lg)) .smi-init-duo-sm {
    display: block;
    width: 100%;
  }

  .smi-init-duo:not(:has(.smi-init-duo-lg)) .smi-init-duo-sm img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 5;
    max-height: 360px;
    object-fit: cover;
  }

  .smi-isl h3 { font-size: 24px; }
  .smi-isl p { font-size: 16px; }

  .smi-init-txt {
    text-align: center;
    padding: 0;
  }

  .smi-btn-teal {
    display: inline-block;
    width: auto;
    max-width: 100%;
    margin-inline: auto;
    padding: 10px 18px;
    font-size: 14px;
    text-align: center;
  }

  /* Stats — mobile: كرت + لمحة (Swiper 1.15) */
  .smi-statbar {
    padding: 48px 0;
  }

  .smi-statbar .smi-cn {
    overflow: hidden;
  }

  .smi-statbar-r {
    gap: 28px;
  }

  .smi-statbar-txt p { font-size: 20px; }
  .smi-statbar-txt h2 { font-size: 26px; }

  .smi-statbar-cards-wrap {
    overflow: hidden;
    width: 100%;
  }

  .smi-statbar-cards {
    flex-wrap: nowrap;
    gap: 0;
    min-height: 0;
    margin: 0;
    padding: 4px 0 8px;
    transition: transform 0.55s ease;
    will-change: transform;
  }

  .smi-stat-swiper .smi-s-card {
    flex: 0 0 auto;
    height: 80vh !important;
    min-height: 80vh !important;
    aspect-ratio: auto;
    opacity: 1;
  }

  .smi-stat-swiper .smi-s-card-n {
    font-size: clamp(42px, 11vw, 56px);
    margin-bottom: 12px;
  }

  .smi-stat-swiper .smi-s-card-l {
    font-size: clamp(14px, 3.8vw, 17px);
    line-height: 1.45;
  }

  /* Contributions */
  .smi-contrib-head {
    padding: 40px 0 16px;
  }

  .smi-contrib-head h2 {
    font-size: 26px;
  }

  .smi-contrib-ft {
    padding: 16px 0 40px;
  }

  /* Services */
  .smi-srv-hd-row {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .smi-srv-hd-txt {
    text-align: center;
  }

  .smi-srv-desc {
    margin-inline: auto;
  }

  .smi-srv-hd-row .smi-btn-outline {
    align-self: center;
  }

  .smi-srv-tr .smi-proj-card-ttl {
    font-size: 14px;
    line-height: 1.45;
  }

  .smi-srv-tr .smi-proj-card-bar {
    margin: -22px 12px 14px;
    padding: 14px 14px;
    gap: 10px;
  }

  .smi-contrib-ken {
    min-height: 320px;
    border-radius: 8px;
  }

  .smi-contrib-ken .smi-k-content {
    padding: 20px var(--pad-x);
  }

  .smi-contrib-ken .smi-k-year {
    font-size: 22px;
  }

  .smi-contrib-ken .smi-k-desc {
    font-size: 15px;
    line-height: 1.65;
  }

  .smi-contrib-ken .smi-k-nav {
    transform: translateY(-50%) scale(0.9);
  }

  .smi-contrib-ken .smi-k-nav.smi-prev { right: 8px; }
  .smi-contrib-ken .smi-k-nav.smi-next { left: 8px; }

  /* News */
  .smi-news {
    padding: clamp(40px, 6vw, 56px) 0 64px;
  }

  .smi-news-hd-row {
    flex-direction: row;
    align-items: flex-end;
    text-align: right;
  }

  .smi-news-hd-act {
    justify-content: flex-start;
    flex-wrap: nowrap;
  }

  .smi-news-wrap {
    padding-top: 0;
  }

  .smi-news-lbl,
  .smi-news-hd-txt h2 {
    font-size: clamp(22px, 5.5vw, 28px);
  }

  /* كرت كامل + لمحة من التالي */
  .smi-news-tr {
    gap: 0;
  }

  .smi-news-swiper .smi-nc {
    flex: none;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .smi-nc img {
    aspect-ratio: 16 / 10;
    height: auto;
  }

  .smi-nc-b {
    padding: 10px 0 0;
  }

  .smi-nc-t {
    font-size: 13px;
    line-height: 1.5;
  }

  /* Footer & scroll top */
  .smi-ftr {
    padding: 24px 0;
  }

  .smi-ftr-r {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }

  .smi-ftr-nav {
    width: 100%;
  }

  .smi-ftr-nav-list {
    flex-direction: row;
    justify-content: center;
  }

  .smi-ftr-c {
    flex: 1 1 32px;
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .smi-stt {
    bottom: max(16px, env(safe-area-inset-bottom));
    right: max(16px, env(safe-area-inset-right));
    left: auto;
    width: 40px;
    height: 40px;
  }

  /* Inner pages */
  .smi-pg-banner {
    border-radius: 0 0 clamp(48px, 14vw, 90px) 0;
  }

  .smi-pg-banner h1 { font-size: 24px; }
  .smi-pg-hero h1 { font-size: 28px; }
  .smi-about-intro-ttl { font-size: 20px; }
  .smi-about-intro-content blockquote { font-size: 18px; }
  .smi-values-grid,
  .smi-about-stats-r { grid-template-columns: 1fr; }

  .smi-init-card-body { padding: 20px; }
  .smi-init-card-body h2 { font-size: 20px; }

  .smi-news-grid { grid-template-columns: 1fr; }

  .smi-proj-grid { grid-template-columns: 1fr; }

  .smi-post-nav {
    flex-direction: column;
  }

  .smi-post-nav .smi-post-nav-next {
    text-align: right;
  }
}

/* ── Small mobile ≤ 480px ── */
@media (max-width: 480px) {
  /* صورتا الشراكات تبقيان جنباً إلى جنب على الجوال */
  .smi-init-duo {
    flex-direction: row;
    gap: 10px;
    align-items: stretch;
  }

  .smi-init-duo-sm,
  .smi-init-duo-lg {
    flex: 1 1 50%;
    min-width: 0;
    width: auto;
  }

  .smi-init-duo-sm img,
  .smi-init-duo-lg img {
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 4;
    max-height: 220px;
    object-fit: cover;
  }
}

/* ── Mobile nav overlay ── */
body.smi-nav-open {
  overflow: hidden;
}

body.smi-nav-open .smi-hdr {
  z-index: 10001;
}

body.smi-nav-open::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 9999;
  opacity: 0;
  animation: smiNavOverlayIn 0.38s ease forwards;
  pointer-events: auto;
}

@keyframes smiNavOverlayIn {
  to { opacity: 1; }
}
