/* Site footer — solid navy block with menu columns, grant logos row, legal bar.
   Typography per Figma 693:7842. */

.rw-footer {
  background: #0B132C;
  color: #fff;
  margin-top: auto;
  position: relative;
  z-index: 1;
}

/* Override the minimal .site-footer rule from global-styles.css */
.site-footer { display: none; }

.rw-footer__inner {
  position: relative;
  z-index: 1;
  padding-block: 3.75rem;
  padding-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* ===== Top block: brand | 4 columns ===== */
.rw-footer__top {
  display: grid;
  grid-template-columns: minmax(13.75rem, 16.25rem) 1fr;
  gap: 4.75rem;
  align-items: flex-start;
}

.rw-footer__brand {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}
.rw-footer__logo { display: inline-block; line-height: 0; }
/* Shared logo file with header — invert to white on the dark footer bg. */
.rw-footer__logo img { display: block; height: 2.6875rem; width: auto; max-width: 100%; filter: brightness(0) invert(1); }

.rw-footer__cta.rw-btn { align-self: flex-start; }

.rw-footer__cols {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}
.rw-footer__col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Eyebrow label — Red Hat Mono Medium 14/14, tracking 0.04em, uppercase, 40% opacity. */
.rw-footer__label {
  font-family: var(--rw-font-mono);
  font-weight: 500;
  font-size: var(--rw-caption-size);
  line-height: var(--rw-caption-line);
  letter-spacing: var(--rw-caption-tracking);
  text-transform: uppercase;
  color: #fff;
  opacity: 0.4;
  margin: 0 0 1.5rem;
}
.rw-footer__col > .rw-footer__label:not(:first-child),
.rw-footer__col > .rw-footer__group:not(:first-child) > .rw-footer__label { margin-top: 2rem; }

/* Accordion shell — only acts as accordion on mobile. On desktop the <details>
   element is flattened (display: contents) so summary + menu lay out exactly
   like the legacy <p>+<ul> pair. */
.rw-footer__group > summary { display: block; list-style: none; cursor: pointer; }
.rw-footer__group > summary::-webkit-details-marker { display: none; }
.rw-footer__group > summary::marker { content: ''; }

/* Specificity bump so the base .rw-footer__social { display: flex } rule below
   doesn't override and reveal the mobile-only social list on desktop. */
.rw-footer__social.rw-footer__social--mobile { display: none; }

/* Menu + contact link lists. */
.rw-footer__menu,
.rw-footer__contact {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.rw-footer__menu a,
.rw-footer__contact a,
.rw-footer__legal a {
  color: #fff;
  text-decoration: none;
  font-family: var(--rw-font-text);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.5rem;
  letter-spacing: -0.012em;
  position: relative;
  display: inline-block;
}
.rw-footer__menu a:hover,
.rw-footer__contact a:hover,
.rw-footer__legal a:hover { opacity: 1; }

/* Animated underline (matches header megamenu links). Line grows from left on
   hover-in, retreats off to the right on hover-out. */
.rw-footer__menu a::after,
.rw-footer__contact a::after,
.rw-footer__legal a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform .4s ease;
}
.rw-footer__menu a:hover::after,
.rw-footer__contact a:hover::after,
.rw-footer__legal a:hover::after {
  transform: scaleX(1);
  transform-origin: left center;
}

.rw-footer__address {
  margin: 1rem 0 0;
  font-family: var(--rw-font-text);
  font-style: normal;
  font-weight: 400;
  font-size: 0.875rem;
  line-height: 1.5rem;
  color: #FFFFFFCC;
  letter-spacing: -0.012em;
}

/* ===== Grants section: glass app box (left) + partner logos (right) ===== */
.rw-footer__grants {
  margin-top: 10rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
}
.rw-footer__app {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 17.5rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1.168px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  backdrop-filter: blur(58.4px);
  -webkit-backdrop-filter: blur(58.4px);
}
.rw-footer__app-title {
  margin: 0;
  font-family: var(--rw-font-text);
  font-weight: 700;
  font-size: 1.125rem;
  line-height: 1.75rem;
  color: #fff;
  letter-spacing: -0.012em;
}
.rw-footer__app-link {
  font-family: var(--rw-font-text);
  font-weight: 600;
  font-size: 1rem;
  line-height: 0.875rem;
  color: #fff;
  text-decoration: none;
  position: relative;
  display: inline-block;
  align-self: flex-start;
}
.rw-footer__app-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(1);
  transform-origin: left center;
  transition: transform .4s ease;
}
.rw-footer__app-link:hover { color: #fff; opacity: 1; }
.rw-footer__app-link:hover::after {
  transform: scaleX(0);
  transform-origin: right center;
}
.rw-footer__app-desc {
  margin: 0;
  font-family: var(--rw-font-text);
  font-weight: 400;
  font-size: 1.125rem;
  line-height: 1.5rem;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: -0.016em;
}
.rw-footer__logos {
  display: flex;
  align-items: center;
  gap: 3rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.rw-footer__logo-grant {
  display: block;
  object-fit: contain;
  max-width: 100%;
}
.rw-footer__logo-grant--eu { width: 200px; height: 32px; }
.rw-footer__logo-grant--ti { width: 174px; height: 64px; }

/* ===== Bottom bar ===== */
.rw-footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-family: var(--rw-font-text);
  font-size: 0.875rem;
  line-height: 1.5rem;
  color: rgba(255, 255, 255, 0.8);
  letter-spacing: -0.012em;
}
.rw-footer__legal {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
}
.rw-footer__legal span { color: #fff; }
.rw-footer__legal a { font-size: 0.875rem; }

/* Social icons — doubled sizes per user request. */
.rw-footer__social {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1rem;
}
.rw-footer__social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--rw-radius-sm);
}
.rw-footer__social a:hover { background: rgba(255, 255, 255, 0.08); opacity: 1; }
/* Per-icon sizes set via inline width/height attrs on each <img>. object-fit keeps contain. */
.rw-footer__social img { display: block; object-fit: contain; }

/* ===== Decorative bottom gradient image — editor uploads to assets/images/footer-gradient.png.
   Sits at section level (inside .rw-footer, outside .rw-footer__inner) and paints behind content. ===== */
.rw-footer__gradient {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
  z-index: -1;
}
.rw-footer__gradient img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: fill;
}

/* ===== Responsive ===== */

/* Desktop ≥769px: flatten the <details> wrapper so its summary + menu render
   inline with the surrounding column, exactly like the legacy <p>+<ul> markup.
   This also short-circuits UA hiding of the menu when [open] is absent. */
@media (min-width: 769px) {
  .rw-footer__group { display: contents; }
  /* Summary acts as a plain label; users can't collapse the panel. */
  .rw-footer__group > summary { cursor: default; pointer-events: none; }
  /* Force panel visible regardless of [open] state in case the UA still hides
     non-summary children when the <details> element is display:contents. */
  .rw-footer__group > .rw-footer__menu { display: flex !important; }

}

@media (max-width: 1023px) {
  .rw-footer__top {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
  .rw-footer__cols {
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem 1.5rem;
  }
}

/* Mobile ≤768px — Figma node 1009:15462. Brand row, accordion link sections,
   contact block, horizontally-scrolling grants strip, slim legal bar. */
@media (max-width: 768px) {
  .rw-footer__inner {
    padding-block: 6rem 2.5rem;
    gap: 0;
    min-height: 0;
  }

  /* Brand row: logo left, CTA right. */
  .rw-footer__top { gap: 4.5rem; }
  .rw-footer__brand {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
  }
  .rw-footer__brand .rw-footer__logo img { height: 2.25rem; max-width: 180px; }
  .rw-footer__cta.rw-btn { align-self: center; }

  .rw-footer__cols {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .rw-footer__col { gap: 0; }
  /* Don't compound margins between stacked accordion labels — each row owns its
     own dashed separator. Override the desktop ":not(:first-child)" rule. */
  .rw-footer__col > .rw-footer__group:not(:first-child) > .rw-footer__label { margin-top: 0; }
  .rw-footer__col--contact { margin-top: 4.5rem; }

  /* Accordion rows — 54px, dashed bottom border, chevron right. */
  .rw-footer__group { display: block; border-bottom: 1px dashed #e8e8e9; }
  .rw-footer__group > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 3.375rem;
    padding-block: 1.5rem;
    margin: 0;
    cursor: pointer;
    opacity: 1;
    font-family: var(--rw-font-text);
    font-weight: 500;
    font-size: 0.75rem;
    line-height: 0.75rem;
    letter-spacing: -0.01em;
    text-transform: none;
    color: #fff;
  }
  .rw-footer__group > summary > span:first-child { display: inline-block; }

  .rw-footer__chevron {
    display: inline-block;
    width: 0.625rem;
    height: 0.375rem;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>") no-repeat center / contain;
    mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>") no-repeat center / contain;
    transition: transform 200ms ease;
  }
  .rw-footer__group[open] > summary > .rw-footer__chevron { transform: rotate(180deg); }

  .rw-footer__group > .rw-footer__menu {
    padding: 0 0 1.5rem;
    gap: 0.75rem;
  }

  /* Contact column — eyebrow + text + mobile social inline + grey address. */
  .rw-footer__col--contact > .rw-footer__label { margin-bottom: 1rem; }
  .rw-footer__contact { gap: 0.5rem; margin-bottom: 1rem; }
  .rw-footer__address {
    margin-top: 1rem;
    color: #81858d;
    font-size: 1rem;
  }

  /* Mobile social — labels visible, icon to the right. Hide desktop variant. */
  .rw-footer__social.rw-footer__social--desktop { display: none; }
  .rw-footer__social.rw-footer__social--mobile {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
  }
  .rw-footer__social--mobile a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    width: auto;
    height: auto;
    color: #fff;
    text-decoration: none;
    font-family: var(--rw-font-text);
    font-size: 1rem;
    line-height: 1.5rem;
    letter-spacing: -0.012em;
  }
  .rw-footer__social--mobile img {
    display: block;
    width: 1.25rem;
    height: 1.25rem;
    object-fit: contain;
  }

  /* Grants stack: glass app box first, then partner logos row (all 4 visible). */
  .rw-footer__grants {
    flex-direction: column;
    align-items: stretch;
    gap: 4.5rem;
    margin-top: 4.5rem;
  }
  .rw-footer__app { width: 100%; gap: 1rem; margin-top: 72px; }
  .rw-footer__app-title { font-size: 1rem; line-height: 1.5rem; }
  .rw-footer__app-desc { font-size: 1rem; line-height: 1.5rem; }
  .rw-footer__logos {
    width: 100%;
    gap: 1.5rem;
    justify-content: space-between;
  }
  .rw-footer__logo-grant--eu { width: 163px; height: 26px; }
  .rw-footer__logo-grant--ti { width: 130px; height: 48px; }

  /* Bottom bar — Privacy · Terms (left) │ © 2026 RoboTwin (right) on one line. */
  .rw-footer__bottom {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-top: 1.5rem;
    font-size: 0.75rem;
    line-height: 1.5;
    color: #81858d;
  }
  .rw-footer__legal {
    flex: 1;
    flex-wrap: nowrap;
    gap: 0.25rem;
    font-size: 0.875rem;
  }
  .rw-footer__legal a { font-size: 0.875rem; color: #81858d; }
  .rw-footer__legal span {
    margin-left: auto;
    order: 2;
    color: #fff;
  }
}
