/* ═══════════════════════════════════════════
   Alpha Source — Mobile app layer
   Loaded after styles.css / zahira.css. Everything here is scoped to
   phones and small tablets, so the desktop design is untouched.
   ═══════════════════════════════════════════ */

/* the tab bar and install button exist everywhere but only show on phones */
.app-tabbar, .nav-install { display: none; }

@media (hover: none) {
  a, button, .card, .tm, .gallery-item { -webkit-tap-highlight-color: transparent; }
  a, button { touch-action: manipulation; }
  /* no sticky hover lifts on touch; give a press response instead */
  .card:hover, .tm:hover, .gallery-item:hover, .event-item:hover { transform: none; }
  .btn:active, .card:active, .gallery-item:active, .event-item:active, .filter-btn:active,
  .social-links a:active, .tm-links a:active { transform: scale(0.97); transition: transform 0.12s; }
}

@media (max-width: 768px) {
  :root { --tabbar-h: 64px; --safe-b: env(safe-area-inset-bottom, 0px); }
  html { scroll-padding-top: 72px; }
  body { padding-bottom: calc(var(--tabbar-h) + var(--safe-b)); overscroll-behavior-y: none; }

  /* ── App header: slim, always glass ── */
  .site-nav, .site-nav.scrolled {
    padding: 0; height: 60px; display: flex; align-items: center;
    background: rgba(5,22,23,0.82);
    -webkit-backdrop-filter: blur(16px) saturate(140%); backdrop-filter: blur(16px) saturate(140%);
    border-bottom: 1px solid rgba(221,170,69,0.16);
    padding-top: env(safe-area-inset-top, 0px);
  }
  .nav-inner { width: 100%; }
  .nav-logo, .site-nav.scrolled .nav-logo { height: 38px; }
  .nav-toggle { width: 44px; height: 44px; align-items: center; justify-content: center; border-radius: 12px; }
  .nav-toggle span { width: 22px; transition: transform 0.3s, opacity 0.2s; }
  .nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle.is-open span:nth-child(2) { opacity: 0; }
  .nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* ── Full-screen menu ── */
  .nav-links {
    position: fixed; inset: 0; right: 0; width: 100%; height: 100dvh;
    padding: 78px 28px calc(var(--tabbar-h) + var(--safe-b) + 20px);
    background:
      radial-gradient(120% 60% at 100% 0%, rgba(43,196,182,0.14), transparent 60%),
      linear-gradient(180deg, rgba(5,22,23,0.98), rgba(6,27,28,0.99));
    -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
    border: 0; gap: 4px; align-items: stretch; justify-content: flex-start;
    opacity: 0; visibility: hidden; transform: translateY(-12px);
    transition: opacity 0.3s ease, transform 0.35s ease, visibility 0s linear 0.35s;
    overflow-y: auto;
  }
  .nav-links.open { right: 0; opacity: 1; visibility: visible; transform: none; transition: opacity 0.3s ease, transform 0.35s ease; }
  .nav-links a {
    font-family: var(--f-display); font-size: 25px; font-weight: 500; letter-spacing: 0.02em; text-transform: none;
    color: var(--c-cream); padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,0.06);
    opacity: 0; transform: translateY(10px); transition: opacity 0.35s, transform 0.35s, color 0.2s;
  }
  .nav-links a::after { display: none; }
  .nav-links a.active { color: var(--c-gold); }
  .nav-links.open a { opacity: 1; transform: none; }
  .nav-links.open a:nth-child(2) { transition-delay: 0.03s; } .nav-links.open a:nth-child(3) { transition-delay: 0.06s; }
  .nav-links.open a:nth-child(4) { transition-delay: 0.09s; } .nav-links.open a:nth-child(5) { transition-delay: 0.12s; }
  .nav-links.open a:nth-child(6) { transition-delay: 0.15s; } .nav-links.open a:nth-child(7) { transition-delay: 0.18s; }
  .nav-links.open a:nth-child(8) { transition-delay: 0.21s; } .nav-links.open a:nth-child(9) { transition-delay: 0.24s; }
  .nav-links .nav-meet { font-size: 20px; margin-top: 8px; border: 0; }
  .nav-links .nav-cta { margin-top: 8px; text-align: center; font-family: var(--f-body); font-size: 14px; padding: 16px; border-radius: 12px; border: 0; color: var(--c-bg) !important; }
  .nav-install {
    margin-top: 10px; padding: 14px; border-radius: 12px; font-weight: 700; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--c-teal-hi); border: 1px solid var(--c-teal-soft); display: flex; align-items: center; justify-content: center; gap: 10px;
  }
  body.menu-open { overflow: hidden; }

  /* ── Bottom tab bar ── */
  .app-tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1600;
    height: calc(var(--tabbar-h) + var(--safe-b)); padding: 0 6px var(--safe-b);
    background: rgba(5,22,23,0.9);
    -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%);
    border-top: 1px solid rgba(221,170,69,0.2);
    box-shadow: 0 -10px 30px rgba(0,0,0,0.35);
  }
  .app-tabbar > a, .app-tabbar > button {
    height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    font-size: 10px; font-weight: 600; letter-spacing: 0.04em; color: rgba(245,238,220,0.55);
    transition: color 0.2s;
  }
  .app-tabbar i { font-size: 18px; transition: transform 0.25s; }
  .app-tabbar .is-active { color: var(--c-gold); }
  .app-tabbar .tab-wa { color: #25D366; }
  .app-tabbar .is-active i { transform: translateY(-2px); }
  .app-tabbar .tab-zahira { position: relative; color: var(--c-gold-hi); }
  .tab-zahira .tz-ring {
    position: relative; width: 54px; height: 54px; margin-top: -26px; border-radius: 50%;
    border: 2px solid var(--c-gold); background: #0B2E2D; overflow: hidden;
    box-shadow: 0 0 0 5px rgba(5,22,23,0.9), 0 8px 22px rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--f-accent); font-style: italic; font-size: 26px; color: var(--c-gold-hi);
  }
  .tab-zahira .tz-ring img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 30%; }
  .tab-zahira::after { /* gentle ping until the visitor opens her once */
    content: ''; position: absolute; top: -26px; left: 50%; width: 54px; height: 54px; margin-left: -27px; border-radius: 50%;
    border: 2px solid var(--c-teal); animation: tzPing 2.4s ease-out infinite; pointer-events: none;
  }
  .tab-zahira.seen::after { display: none; }
  @keyframes tzPing { from { transform: scale(1); opacity: 0.8; } to { transform: scale(1.6); opacity: 0; } }

  /* the desktop floating widgets are replaced by the tab bar */
  .wa-float, .z-launcher, .z-teaser { display: none !important; }

  /* ── Zahira & meeting as bottom sheets ── */
  .zahira { left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-b)); z-index: 1590; }
  .zahira .z-panel {
    width: 100%; max-height: min(72dvh, 620px); border-radius: 22px 22px 0 0;
    border-left: 0; border-right: 0; border-bottom: 0;
    animation: sheetUp 0.38s cubic-bezier(.2,.8,.2,1) both;
  }
  .zahira .z-panel::before, .mt-dialog::before {
    content: ''; display: block; width: 40px; height: 4px; border-radius: 4px; margin: 8px auto 0;
    background: rgba(245,238,220,0.25); flex-shrink: 0;
  }
  .zahira.touring .z-log { max-height: 26dvh; }
  .mt-modal { align-items: flex-end; padding: 0; }
  .mt-dialog {
    width: 100%; max-height: 92dvh; border-radius: 22px 22px 0 0; padding: 6px 18px calc(22px + var(--safe-b));
    animation: sheetUp 0.4s cubic-bezier(.2,.8,.2,1) both;
  }
  .mt-x { top: 18px; right: 14px; }
  .mt-head { margin-top: 16px; }
  @keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }

  /* ── Desktop-only sections: hidden on phones with their links ── */
  #about, #pillars, #why,
  .nav-links a[href="#about"], .nav-links a[href="#why"],
  .footer-col a[href="#about"], .footer-col a[href="#why"] { display: none !important; }

  /* ── Type & rhythm ── */
  .section { padding: 60px 0; }
  .section-head { margin-bottom: 26px; }
  .section-head h2, .pillars-title h2, .team-head h2, .loc-info h2 { font-size: 34px; }
  .section-lead { font-size: 14.5px; line-height: 1.65; }
  .eyebrow { font-size: 10.5px; letter-spacing: 0.28em; margin-bottom: 12px; }
  .section, .site-footer { --arc: 26px; }
  .frame::after { display: none; }
  .section-photo { opacity: 0.1; }

  /* ── Hero: brand block + slider card ── */
  .hero { min-height: 0; }
  .hero-content { padding: 84px 16px 22px; }
  .hero-rotator { margin-bottom: 0; }
  .hr-line { font-size: 17px; min-height: 2.7em; }
  /* phones: the header carries the brand, so the hero goes straight to the slogan and actions */
  .hero-logo, .hero-tag, .hero-sub { display: none; }
  .hr-line { margin-bottom: 14px; }
  .hero-tag { font-size: 10.5px; letter-spacing: 0.24em; padding-bottom: 14px; margin-bottom: 14px; }
  .hero-sub { font-size: 15.5px; margin-bottom: 20px; }
  .hero-cta { display: none; /* Services + Meeting live in the tab bar on phones */ grid-template-columns: 1fr; gap: 10px; margin-bottom: 18px; }
  .hero-cta .btn { width: 100%; text-align: center; padding: 15px 16px; border-radius: 12px; display: flex; align-items: center; justify-content: center; gap: 8px; }
  .social-links { flex-wrap: nowrap; justify-content: space-between; gap: 4px; }
  .hero .social-links { display: none; } /* WhatsApp sits in the tab bar instead */
  .social-links a { width: 38px; height: 38px; font-size: 15px; }

  .hero-media {
    margin: 0 12px; min-height: 0; aspect-ratio: 4 / 5.4;
    border: 1px solid rgba(221,170,69,0.35); border-radius: 24px;
    box-shadow: 0 20px 44px rgba(0,0,0,0.5);
    justify-content: flex-end;
  }
  .hero-quote { top: 16px; right: 16px; font-size: 18px; }
  .hs-caption { padding: 0 16px 10px; }
  .hs-title { font-size: 24px; }
  .hs-controls { padding: 0 14px 12px; }
  .hs-bar { padding: 12px 0; }
  .hs-arrow { width: 36px; height: 36px; }
  .hero-stats { grid-template-columns: repeat(4, 1fr); border-radius: 0 0 23px 23px; }
  .stat, .stat:nth-child(2) { padding: 12px 2px; border-bottom: 0; border-right: 1px solid rgba(255,255,255,0.06); }
  .stat:last-child { border-right: 0; }
  .stat-num { font-size: 22px; }
  .stat-label { font-size: 8px; letter-spacing: 0.08em; white-space: normal; line-height: 1.3; }

  /* ── Swipe rails (horizontal, snap) ── */
  .legacy-cards, .pillars-cards, .why-grid {
    display: grid; grid-template-columns: none; grid-auto-flow: column;
    overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
    gap: 12px; margin: 0 -16px; padding: 6px 16px 16px; scroll-padding-left: 16px;
    scrollbar-width: none;
  }
  .legacy-cards::-webkit-scrollbar, .pillars-cards::-webkit-scrollbar, .why-grid::-webkit-scrollbar, .tm-row::-webkit-scrollbar, .gallery-filter::-webkit-scrollbar { display: none; }
  .legacy-cards > *, .pillars-cards > *, .why-grid > *, .tm { scroll-snap-align: start; }
  .legacy-cards { grid-auto-columns: 70%; }
  .pillars-cards, .why-grid { grid-auto-columns: 82%; }
  /* events: every occasion visible as a wrapping cloud of chips */
  .events .section-head { margin-bottom: 20px; }
  .events-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
  .event-item {
    flex: 0 0 auto; padding: 9px 14px 9px 10px; gap: 8px;
    border-radius: 30px; font-size: 13px; font-weight: 600;
    background: rgba(11,46,45,0.6); border-color: rgba(43,196,182,0.22);
  }
  .event-item .event-icon { font-size: 17px; line-height: 1; }
  .event-item .event-flag { width: 18px; height: 18px; }
  .rail-hint { display: flex; align-items: center; gap: 8px; margin: -4px 0 10px; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--c-text-mute); }
  .rail-hint i { color: var(--c-gold); animation: nudge 1.6s ease-in-out infinite; }
  @keyframes nudge { 50% { transform: translateX(5px); } }

  /* ── About ── */
  .about-grid { gap: 30px; }
  .legacy-num { font-size: 104px; }
  .legacy-title { font-size: 40px; }
  .legacy-quote { font-size: 16px; margin-bottom: 28px; }
  .timeline { margin-bottom: 26px; }
  .tl-year { font-size: 22px; }
  .tl-place { font-size: 12.5px; }
  .tl-sub { font-size: 9.5px; letter-spacing: 0.06em; }
  .journey-img { border-radius: 18px; }

  /* ── Core pillars ── */
  .pillars-grid { gap: 22px; }
  .pillars-title p { max-width: none; padding-top: 18px; }
  .pillar { padding: 24px 22px; }

  /* ── Services bento ── */
  .services .section-head { margin-bottom: 20px; }
  .services-grid { grid-auto-rows: 168px; gap: 10px; }
  .svc-card { border-radius: 16px; }
  .svc-body { padding: 12px 14px 13px; }
  .svc-body h3 { font-size: 16px; }
  .svc-tag { left: 10px; top: 10px; font-size: 8.5px; padding: 3px 7px; }
  .services-grid .svc-card:first-child { grid-row: span 1; }
  .services-grid .svc-card:first-child .svc-body h3 { font-size: 24px; }

  /* ── Gallery: tight 3-up grid, swipeable filter chips ── */
  .gallery-filter {
    flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none;
    margin: 0 -16px 18px; padding: 2px 16px; gap: 8px;
  }
  .filter-btn { flex-shrink: 0; padding: 9px 16px; border-radius: 20px; font-size: 11px; }
  .gallery-grid { --cols: 3; --gap: 4px; }
  .gallery-item { border-radius: 6px; border: 0; }
  .gal-count { top: 5px; right: 5px; gap: 4px; padding: 2px 7px; font-size: 10px; }
  .gal-cap { display: none; }

  /* ── Global network ── */
  .regions-top { gap: 18px; margin-bottom: 26px; }
  .regions-top .regions-stats { gap: 16px; }
  .reg-num { font-size: 34px; }
  .world-map { margin: 0 -16px; width: calc(100% + 32px); }
  .regions-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .region-card { padding: 12px; gap: 10px; border-radius: 12px; }
  .region-flag { width: 32px; height: 32px; }
  .region-card h3 { font-size: 15px; }
  .region-tag { font-size: 8.5px; letter-spacing: 0.1em; }
  .regions-footer { font-size: 10.5px; letter-spacing: 0.14em; line-height: 1.6; }

  /* ── Location ── */
  .loc-grid { gap: 24px; }
  .loc-map { min-height: 260px; border-radius: 18px; order: -1; }
  .loc-cta { display: grid; grid-template-columns: 1fr 1fr; }
  .loc-cta .btn { justify-content: center; padding: 14px 8px; font-size: 11.5px; letter-spacing: 0.1em; border-radius: 12px; }

  /* ── Team: contact-list cards, everyone visible without swiping ── */
  .team { padding: 56px 0; }
  .team-head { margin-bottom: 18px; }
  .team-quote, .team .rail-hint, .tm-cut { display: none; }
  .tm-row {
    grid-template-columns: 1fr; grid-auto-flow: row; grid-auto-columns: auto;
    overflow: visible; margin: 0; padding: 0; gap: 10px;
  }
  .tm {
    aspect-ratio: auto; display: grid; grid-template-columns: 58px 1fr auto;
    column-gap: 12px; row-gap: 1px; align-items: center;
    padding: 12px 12px 12px 12px; border-radius: 16px;
    background: linear-gradient(120deg, rgba(23,96,90,0.35), rgba(11,46,45,0.55) 55%, rgba(5,22,23,0.8));
    border: 1px solid rgba(43,196,182,0.2);
  }
  .tm-lead { border-color: rgba(221,170,69,0.45); background: linear-gradient(120deg, rgba(221,170,69,0.14), rgba(11,46,45,0.6) 55%, rgba(5,22,23,0.85)); }
  .tm-frame {
    position: relative; inset: auto; top: auto; grid-column: 1; grid-row: 1 / 4;
    width: 58px; height: 58px; border-radius: 50%;
    border: 2px solid var(--c-teal-soft); box-shadow: none;
  }
  .tm-lead .tm-frame { border: 2px solid var(--c-gold); box-shadow: 0 0 0 3px rgba(221,170,69,0.12); }
  .tm .tm-frame img, .tm:hover .tm-frame img, .tm:focus-within .tm-frame img { filter: none; transform: none; }
  .tm:hover .tm-frame, .tm:focus-within .tm-frame { box-shadow: none; }
  .tm-info { display: contents; }
  .tm-info h3 { grid-column: 2 / 4; grid-row: 1; font-size: 18px; text-align: left; }
  .tm-role { grid-column: 2 / 4; grid-row: 2; margin: 0; text-align: left; font-size: 9px; letter-spacing: 0.14em; }
  .tm-phone { grid-column: 2; grid-row: 3; margin: 0; padding: 4px 0; font-size: 13px; text-align: left; }
  .tm-links, .tm:hover .tm-links, .tm:focus-within .tm-links {
    grid-column: 3; grid-row: 3; margin: 0; max-height: none; opacity: 1; transform: none; overflow: visible; gap: 6px;
  }
  .tm-links a { width: 34px; height: 34px; font-size: 14px; }
  .tm.is-speaking .tm-frame { border-color: var(--c-gold); }
  .tm-join { margin-top: 14px; padding: 16px; border-radius: 16px; }

  /* ── Footer ── */
  .site-footer { padding-top: 44px; }
  .footer-inner { gap: 28px; padding-bottom: 28px; }
  .footer-brand img { height: 60px; }
  .footer-col a { padding: 8px 0; }
  .footer-col:last-child { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; }
  .footer-col:last-child .footer-head { grid-column: 1 / -1; }
  .footer-bottom .container { flex-direction: column; gap: 6px; text-align: center; }

  /* reveal animation: shorter travel on small screens */
  .card, .gallery-item, .event-item { will-change: auto; }
}

/* small tablets: keep tab bar spacing tidy */
@media (min-width: 560px) and (max-width: 768px) {
  .legacy-cards { grid-auto-columns: 46%; }
  .pillars-cards, .why-grid { grid-auto-columns: 58%; }
  .tm-row { grid-auto-columns: 40%; }
  .hero-media { aspect-ratio: 16 / 12; }
}

/* installed as an app (standalone): hide the browser-only install button */
@media (display-mode: standalone) {
  .nav-install { display: none !important; }
}
