/* ── Site Footer ────────────────────────────────────────────
   Figma node 5354-6889
   Layout: [logo flex-1] | [legal+social  nav+stores]
   ──────────────────────────────────────────────────────── */

.wp-block-yummo-site-footer {
  --c-primary:   var(--wp--preset--color--primary, #5c1a34);
  --c-cream:     var(--wp--preset--color--cream, #f6eddc);
  --c-cream-lt:  var(--wp--preset--color--cream-light, #fffbf3);
  --r-btn:       var(--wp--custom--radius--button, 0.75rem);
  --dur:         var(--wp--custom--transition--dur, .25s);
  --ease:        var(--wp--custom--transition--ease, cubic-bezier(.25,.46,.45,.94));

  background: var(--c-primary);
  /* Figma: p-[72px] = 4.5rem on all sides */
  padding: clamp(2rem, 5vw, 4.5rem);
  padding-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  content-visibility: auto;
  contain-intrinsic-size: auto 400px;
  
  /* Maestro: Контекст контейнера для локальних запитів */
  container-type: inline-size;
  container-name: siteFooter;

  /* ── Main content row ───────────────────────────────────── */
  .footer-content {
    display: flex;
    flex-wrap: wrap; /* Maestro: Intrinsic sizing */
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    width: 100%;
  }

  /* ── Logo (left, flex-1) ────────────────────────────────── */
  .footer-logo {
    flex: 1 1 clamp(17.5rem, 30vw, 100%);
    display: block;

    img {
      /* Maestro: cqw для чуйності відносно контейнера */
      width: clamp(7rem, 20cqw, 17.75rem);
      height: auto;
      display: block;
    }
  }

  /* ── Right menu area (flex-1, two sub-columns) ──────────── */
  .footer-menu {
    flex: 2 1 clamp(20rem, 50vw, 100%);
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: flex-start;
    gap: clamp(2rem, 5cqw, 3.5rem);
  }

  /* ── Sub-column 1: Legal links + Social buttons ─────────── */
  .footer-legal-social {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    flex: 1 1 min(100%, 15rem);
    order: 1;
  }

  .footer-legal {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  /* ── Sub-column 2: Main nav + App stores ────────────────── */
  .footer-main {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 2rem;
    align-items: flex-start;
    flex: 1 1 min(100%, 15rem);
    order: 2;
  }

  .footer-nav {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  /* ── Nav links (shared base) ────────────────────────────── */
  .footer-nav__link {
    display: block;
    padding: 0.5rem 1rem;
    border-radius: 6.25rem;
    color: var(--c-cream);
    font-size: var(--body, 1.125rem);
    font-weight: 500;
    line-height: 1.375rem;
    white-space: nowrap;
    transition: background var(--dur) var(--ease);
    text-decoration: none;
    &:hover {
      background: rgb(255 255 255 / .1);
    }

    /* Bold nav links (Про нас, Блог) */
    &--bold {
      font-size: var(--h4, 1.1875rem);
      font-weight: 700;
      line-height: 1.5rem;
    }
  }

  /* ── Social icon buttons ────────────────────────────────── */
  .footer-social {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .social-btn {
    width: 3rem;
    height: 3rem;
    border-radius: var(--r-btn);
    /* background: rgb(255 255 255 / .1);
    border: 1px solid rgb(255 255 255 / .25); */
    display: grid;
    place-items: center;
    flex-shrink: 0;
    transition: background var(--dur) var(--ease);

    &:hover {
      background: rgb(255 255 255 / .2);
    }

    img {
      width: 1.5rem;
      height: 1.5rem;
    }
  }

  /* ── App store buttons ──────────────────────────────────── */
  .footer-stores {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-left: 1rem;
  }

  /* ── App store / Google Play badge buttons ─────────────── */
  .btn-store {
    position: relative;
    display: block;
    flex: none;
    width: 9rem;
    height: 3rem;
    padding: 0;
    overflow: visible;
    border-radius: 0.75rem;
    background: var(--btn-bg) center / contain no-repeat;
  }

  .btn-store::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--btn-bg-hover) center / contain no-repeat;
    opacity: 0;
    transition: opacity 0.2s var(--ease);
    pointer-events: none;
  }

  .btn-store:hover::before,
  .btn-store:focus-visible::before {
    opacity: 1;
  }

  /* Footer always uses reversed (cream) badges over primary bg */
  .btn-gplay {
    --btn-bg:       url('../../images/btn-google-play-sm-rev.svg');
    --btn-bg-hover: url('../../images/btn-google-play-sm-rev-hover.svg');
  }
  .btn-appstore {
    --btn-bg:       url('../../images/btn-app-store-sm-rev.svg');
    --btn-bg-hover: url('../../images/btn-app-store-sm-rev-hover.svg');
  }

  /* ── Copyright ──────────────────────────────────────────── */
  .footer-copy {
    font-size: var(--body-s);
    line-height: 1.25rem;
    color: var(--c-cream-lt);
    width: 100%;
  }

  /* ── Mobile (Figma 5387:11683) ──────────────────────────────
     Stack: logo → top-nav → stores → legal-nav → social → copy.
     Desktop nests stores under top-nav (.footer-main) and social
     under legal-nav (.footer-legal-social). On mobile we flatten
     those wrappers via `display: contents` and re-order the four
     remaining children with explicit `order` to match Figma. */
  @container siteFooter (max-width: 48rem) {
    .footer-content {
      flex-direction: column;
      align-items: center;
      gap: 1.25rem;             /* gap-[20] logo→menu */
      flex-wrap: nowrap;
    }

    .footer-logo img {
      width: 8.75rem;           /* 140px Figma */
    }

    .footer-menu {
      flex-direction: column;
      align-items: stretch;
      justify-content: flex-start;
      gap: 1.5rem;              /* gap-[24] between menu sections */
      width: 100%;
      flex-wrap: nowrap;
    }

    .footer-main,
    .footer-legal-social {
      display: contents;
    }

    .footer-nav    { order: 1; }
    .footer-stores { order: 2; }
    .footer-legal  { order: 3; }
    .footer-social { order: 4; }

    .footer-nav,
    .footer-legal {
      align-items: stretch;
      width: 100%;
    }

    .footer-nav__link {
      width: 100%;
      text-align: center;
      white-space: normal;
    }

    /* Stores: two flex-1 buttons, native SVG (144×48) stays centered
       inside via `contain`; the cream button bg fills the rest. */
    .footer-stores {
      width: 100%;
      flex-wrap: nowrap;
      padding-inline: 1rem;     /* px-[16] from Figma actions */
      gap: 0.5rem;              /* gap-[8] */
    }

    .btn-store {
      flex: 1 1 0;
      width: auto;
      min-width: 0;
      background-color: var(--c-cream);
    }

    .btn-store::before {
      background-color: var(--c-cream);
    }

    .footer-social {
      width: 100%;
      justify-content: center;
      gap: 0.5rem;
    }

    .footer-copy {
      text-align: center;
    }
  }

  /* ── wp_nav_menu <ul> reset ───────────────────────────── */
  .footer-legal__list,
  .footer-main__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: contents; /* child <li> items participate in parent flex layout */

    li {
      display: contents;
    }
  }
}