/* =====================================================================
   Dawayr — app-like layer for phones and small tablets
   Bottom tab bar, bottom sheets, swipe carousels, press feedback,
   auto-hiding header, scroll reveals and page transitions.
   ===================================================================== */

:root { --tabbar-h: 64px; --ease-out: cubic-bezier(.2, .8, .2, 1); --ease-spring: cubic-bezier(.32, 1.25, .5, 1); }

/* ===== Page transitions (supported browsers fade/slide between pages) ===== */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out .18s ease both; }
::view-transition-new(root) { animation: vt-in .32s var(--ease-out) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(14px); } }
.tabbar { view-transition-name: tabbar; }
.hdr { view-transition-name: site-header; }
::view-transition-old(tabbar), ::view-transition-new(tabbar), ::view-transition-old(site-header), ::view-transition-new(site-header) { animation: none; }
@media (prefers-reduced-motion: reduce) { ::view-transition-old(root), ::view-transition-new(root) { animation: none; } }

/* ===== Scroll reveal (classes added by dawayr.js, so content never hides without JS) ===== */
.rv { opacity: 0; transform: translateY(18px); transition: opacity .55s var(--ease-out), transform .55s var(--ease-out); transition-delay: calc(var(--rv-i, 0) * 60ms); }
.rv.rv-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .rv { opacity: 1; transform: none; transition: none; } }

/* ===== Tab bar ===== */
.tabbar, .sheet { display: none; }

@media (max-width: 860px) {
  html { -webkit-tap-highlight-color: transparent; }
  body.has-tabbar { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }

  .tabbar {
    position: fixed; inset-inline: 10px; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 60;
    height: var(--tabbar-h); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center;
    padding: 0 6px; border-radius: 22px;
    background: rgba(255, 255, 255, .86); border: 1px solid rgba(220, 227, 227, .9);
    -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px);
    box-shadow: 0 18px 40px -18px rgba(12, 44, 49, .45);
    transition: transform .35s var(--ease-out);
  }
  .tabbar__item { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 100%; color: #7A8789; font-size: 10.5px; font-weight: 600; transition: color .2s ease, transform .15s ease; }
  .tabbar__item .i { width: 22px; height: 22px; transition: transform .25s var(--ease-spring); }
  .tabbar__item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar__item.is-active { color: var(--brand); }
  .tabbar__item.is-active .i { transform: translateY(-1px) scale(1.08); }
  .tabbar__item.is-active::after { content: ""; position: absolute; top: 6px; width: 4px; height: 4px; border-radius: 50%; background: var(--brand); }
  .tabbar__fab {
    justify-self: center; width: 54px; height: 54px; margin-top: -26px; border-radius: 18px; border: 0;
    display: grid; place-items: center; color: #fff;
    background: linear-gradient(145deg, #3FA3A6, var(--brand) 55%, #0A4A51);
    box-shadow: 0 0 0 5px var(--paper, #F3F7F6), 0 14px 26px -10px rgba(14, 94, 102, .8);
    transition: transform .2s var(--ease-spring), box-shadow .2s ease;
  }
  .tabbar__fab .i { width: 26px; height: 26px; transition: transform .3s var(--ease-spring); }
  .tabbar__fab[aria-expanded="true"] .i { transform: rotate(45deg); }

  /* Service pages: price and "start" live in a compact bar that replaces the tab bar while reading */
  body.has-tabbar .s-sticky { display: none; }

  /* The tab bar replaces the footer on phones */
  body.has-tabbar .ftr { display: none; }
  body.has-tabbar main > :last-child { margin-bottom: 8px; }

  /* Auto-hiding header */
  .hdr { transition: transform .3s var(--ease-out), background-color .25s ease; }
  body.hdr-hidden .hdr { transform: translateY(-100%); }

  /* ===== Bottom sheets ===== */
  .sheet { display: block; position: fixed; inset: 0; z-index: 80; pointer-events: none; }
  .sheet__backdrop { position: absolute; inset: 0; background: rgba(7, 28, 31, .45); opacity: 0; transition: opacity .3s ease; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
  .sheet__panel {
    position: absolute; inset-inline: 0; bottom: 0; max-height: 88vh; overflow-y: auto; overscroll-behavior: contain;
    padding: 10px 18px calc(20px + env(safe-area-inset-bottom)); border-radius: 26px 26px 0 0; background: #fff;
    transform: translateY(105%); transition: transform .42s var(--ease-out); box-shadow: 0 -20px 60px -20px rgba(12, 44, 49, .4);
  }
  .sheet.is-open { pointer-events: auto; }
  .sheet.is-open .sheet__backdrop { opacity: 1; }
  .sheet.is-open .sheet__panel { transform: translateY(var(--drag, 0px)); }
  .sheet.is-dragging .sheet__panel { transition: none; }
  .sheet__handle { width: 42px; height: 5px; border-radius: 99px; background: #DCE3E3; margin: 2px auto 14px; touch-action: none; }
  .sheet__head strong { display: block; font-size: 20px; color: var(--text); }
  .sheet__head span { display: block; margin-top: 4px; font-size: 13.5px; color: var(--text-2); }
  .sheet__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
  .sheet__option { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 10px 14px; border-radius: 18px; background: #F3F7F6; border: 1px solid #E6ECEC; font-size: 14px; font-weight: 600; color: var(--text); text-align: center; }
  .sheet__option .art { width: 100%; max-width: 150px; }
  .sheet.is-open .sheet__option { animation: sheet-pop .45s var(--ease-spring) both; }
  .sheet.is-open .sheet__option:nth-child(2) { animation-delay: .04s; }
  .sheet.is-open .sheet__option:nth-child(3) { animation-delay: .08s; }
  .sheet.is-open .sheet__option:nth-child(4) { animation-delay: .12s; }
  @keyframes sheet-pop { from { opacity: 0; transform: translateY(14px) scale(.96); } }
  .sheet__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
  .sheet__action { display: flex; align-items: center; justify-content: center; gap: 8px; height: 50px; border-radius: 14px; background: var(--brand); color: #fff; font-size: 14.5px; font-weight: 600; }
  .sheet__action .i { width: 19px; height: 19px; }
  .sheet__action--wa { background: #E8F7EE; color: #15803D; }
  body.sheet-open { overflow: hidden; }

  /* The menu becomes a dark bottom sheet */
  .drawer {
    inset: auto 0 0 0 !important; top: auto !important; height: auto; max-height: 90vh; overflow-y: auto; overscroll-behavior: contain;
    border-radius: 26px 26px 0 0; padding-bottom: calc(18px + env(safe-area-inset-bottom));
    transform: translateY(105%) !important; opacity: 1 !important; visibility: hidden;
    transition: transform .42s var(--ease-out), visibility 0s linear .42s !important;
  }
  .drawer.is-open { transform: none !important; visibility: visible; transition: transform .42s var(--ease-out), visibility 0s !important; }
  .drawer::before { content: ""; display: block; width: 42px; height: 5px; border-radius: 99px; background: rgba(255, 255, 255, .25); margin: 10px auto 0; }
  .drawer__top { height: 56px; }
  .drawer__link { padding: 14px 0; font-size: 17px; }
  .drawer__cta { padding-top: 20px; }
  body.no-scroll::after { content: ""; position: fixed; inset: 0; z-index: 69; background: rgba(7, 28, 31, .45); animation: fade-in .3s ease both; }
  @keyframes fade-in { from { opacity: 0; } }

  /* ===== Swipe carousels ===== */
  .svc-cards, .h-blog, .s-related, .p-team, .post-grid--3 {
    display: flex !important; gap: 12px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
    margin-inline: -16px; padding: 4px 16px 18px; scroll-padding-inline: 16px; scrollbar-width: none;
  }
  .svc-cards::-webkit-scrollbar, .h-blog::-webkit-scrollbar, .s-related::-webkit-scrollbar, .p-team::-webkit-scrollbar, .post-grid--3::-webkit-scrollbar { display: none; }
  .svc-cards > *, .h-blog > .h-blog__feature, .h-blog__list > *, .s-related > *, .p-team > *, .post-grid--3 > * { flex: 0 0 82%; scroll-snap-align: start; }
  .h-blog__list { display: contents; }
  .h-blog__item { grid-template-columns: minmax(0, 1fr); align-content: start; padding: 0; background: #fff; border: 1px solid var(--paper-line); overflow: hidden; }
  .h-blog__thumb { aspect-ratio: 16 / 10; border-radius: 0; }
  .h-blog__item-body { padding: 4px 16px 18px; }
  .h-blog__body { padding: 20px; }
  .p-team > * { flex-basis: 62%; }
  .carousel-dots { display: flex; justify-content: center; gap: 6px; margin-top: 2px; }
  .carousel-dots button { width: 7px; height: 7px; padding: 0; border: 0; border-radius: 99px; background: #C5D2D2; transition: width .3s var(--ease-out), background-color .3s ease; }
  .carousel-dots button.is-active { width: 22px; background: var(--brand); }

  /* ===== Press feedback ===== */
  :is(.btn, .svc-card, .h-blog__feature, .h-blog__item, .p-row, .h-price, .cta-x__tile, .s-related a, .h-start__list a, .sheet__option, .sheet__action, .tabbar__item, .post-card, .faq__q, .drawer__link, .channel, .p-ledger a) {
    transition-property: transform, background-color, border-color, box-shadow, color, opacity;
  }
  :is(.btn, .svc-card, .h-blog__feature, .h-blog__item, .p-row, .h-price, .cta-x__tile, .s-related a, .h-start__list a, .sheet__option, .sheet__action, .post-card, .p-ledger a):active { transform: scale(.97); transition-duration: .08s; }
  .tabbar__item:active { transform: scale(.88); }
  .tabbar__fab:active { transform: scale(.9); }

  /* ===== Tighter, app-like spacing ===== */
  .h-sec { padding: 56px 0; }
  .h-head { margin-bottom: 28px; }
  .h-head h2, .h-steps__intro h2, .h-product h2, .h-reach h2, .p-story h2 { font-size: 28px; }
  .p-hero { padding: calc(var(--header-h) + 20px) 0 40px; }
  .s-hero { padding: calc(var(--header-h) + 20px) 0 40px; }
  .p-hero h1, .s-hero h1 { font-size: 32px; }
  .h-hero { padding: calc(var(--header-h) + 24px) 0 40px; }
  .h-hero__actions .btn--dark { flex: 1 1 auto; justify-content: center; }
  .h-start__list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .h-start__list a { justify-content: center; padding: 0 8px; font-size: 13.5px; height: 44px; min-width: 0; }
  .h-trust__list { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
  .h-trust__list::-webkit-scrollbar { display: none; }
  html[dir="ltr"] .h-kicker { font-size: 10.5px; letter-spacing: .2em; }
  .h-hero__actions { gap: 14px 20px; }
  .h-facts { gap: 6px 14px; }
  .h-facts span + span::before { margin-inline-end: 8px; }
  .cta-x { padding: 40px 0 24px; }
  .cta-x__tile { padding: 14px; border-radius: 16px; }
  .ftr { padding-top: 48px; }
}
