/**
 * @file
 * Footer component styles for Barrio Red Aprende
 * Approach 1: Single shell with gradient + pseudo-element side rails + cream card + GOV.CO bar
 *
 * Structure:
 * - Shell with white strip (26px) → education red gradient
 * - Pseudo-element side rails in education red
 * - Cream card with rounded top corners and shadow
 * - Top block: navigation columns + Colombia Aprende logo
 * - Yellow decorative bar
 * - Middle block: institutional info + Educación logo
 * - GOV.CO bottom bar with cobalt background and yellow divider
 *
 * Uses BEM methodology and --ra- CSS custom properties
 */

/* ==========================================================================
   Site Footer Base
   ========================================================================== */

.site-footer {
  margin-top: auto; /* Push footer to bottom if using flexbox layout */
  font-family: var(--ra-font-body, 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
}

/* ==========================================================================
   Shell with Gradient Background and Side Rails
   ========================================================================== */

.site-footer__shell {
  position: relative;
  /* Background: 26px white strip transitioning to education red */
  background: linear-gradient(
    to bottom,
    var(--ra-color-white) 0,
    var(--ra-color-white) 180px,
    var(--ra-color-education) 26px,
    var(--ra-color-education) 100%
  );
  padding: 0;
}

/* Side rails using pseudo-element */
.site-footer__shell::before {
  content: '';
  position: absolute;
  top: 180px;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--ra-color-education); /* #B43737 */
  z-index: 0;
}

/* ==========================================================================
   Cream Card Container
   ========================================================================== */

.site-footer__card {
  position: relative;
  z-index: 1;
  background-color: var(--ra-color-corn-silk); /* #FFFAE8 */
  border-radius: 20px 20px 0 0;
  border: solid 0.1rem var(--ra-color-tropical-blue);
  /* Softer, more subtle separation like the reference */
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
  margin: 26px auto 0;
  max-width: 100%;
  /* Add side margins to show the red rails */
  margin-left: 5%;
  margin-right: 5%;
}

/* ==========================================================================
   Top Block - Navigation Columns + Colombia Aprende Logo
   ========================================================================== */

.site-footer__top {
  background-color: var(--ra-color-corn-silk, #FFFAE8);
  padding: 3rem 1rem;
  border-radius: 20px 20px 0 0;
}

.footer-mega__grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2rem;
}

.footer-mega__column {
  min-width: 0; /* Prevent grid blowout */
}

.footer-mega__column--logo {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-mega__column--narrow {
  grid-column: span 1;
}

.footer-mega__intro {
  margin: 0;
  font-size: 0.875rem;
  color: var(--ra-color-matterhorn); /* #4C4C4C */
  font-weight: bold;
  line-height: 1.4;
}

/* Logo Colombia Aprende */
.footer-logo {
  display: inline-block;
  transition: opacity 0.2s ease;
}

.footer-logo:hover,
.footer-logo:focus {
  opacity: 0.8;
  outline: 2px solid var(--ra-color-cobalt);
  outline-offset: 4px;
  border-radius: 4px;
}

.footer-logo__image {
  display: block;
  height: auto;
  max-width: 160px;
}

/* Footer Menus */
.footer-menu__heading {
  margin: 0 0 1rem 0;
  padding: 0;
}

.footer-menu__title {
  /* Reset button styles */
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  width: 100%;
  text-align: left;
  font-family: inherit;
  cursor: default;

  /* Original styles */
  font-size: 1rem;
  font-weight: 700;
  color: var(--ra-color-cobalt, #0943B5);
  line-height: 1.4;
}

.footer-menu__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-menu__item {
  margin-bottom: 0.75rem;
}

.footer-menu__item:last-child {
  margin-bottom: 0;
}

.footer-menu__link {
  display: inline-block;
  color: var(--ra-color-cobalt); /* #0943B5 */
  text-decoration: none;
  font-size: 0.875rem;
  line-height: 1.5;
  transition: color 0.2s ease, text-decoration 0.2s ease;
  position: relative;
}

.footer-menu__link:hover {
  color: var(--ra-color-havelock-blue, #4672C8);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-menu__link:focus {
  color: var(--ra-color-cobalt, #0943B5);
  text-decoration: underline;
  text-underline-offset: 3px;
  outline: none;
}

.footer-menu__link:active {
  color: var(--ra-color-blue-dark, #062E6F);
}

.footer-menu__link:focus-visible {
  outline: 2px solid var(--ra-color-cobalt);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ==========================================================================
   Yellow Decorative Bar
   ========================================================================== */

.site-footer__decorative-bar {
  height: 4px;
  width: 30px;
  background-color: var(--ra-color-sunglow); /* #FECC2F */
  margin: 0 auto;
  border-radius: 2px;
}

/* ==========================================================================
   Middle Block - Institutional Info + Educación Logo
   ========================================================================== */

.site-footer__middle {
  background-color: var(--ra-color-white, #FFFFFF);
  padding: 3rem 0 2rem;
}

.footer-institutional{
  padding: 0 1rem;
}

.footer-institutional__grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3rem;
  align-items: start;
  margin-bottom: 2rem;
}

.footer-institutional__title {
  margin: 0 0 1.25rem 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ra-color-blue-dark); /* #004884 */
  line-height: 1.3;
}

.footer-institutional__content {
  max-width: 70ch;
}

.footer-institutional__text {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--ra-color-matterhorn); /* #4C4C4C */
}

.footer-institutional__text:last-child {
  margin-bottom: 0;
}

.footer-institutional__link {
  color: var(--ra-color-cobalt); /* #0943B5 */
  text-decoration: none;
  transition: color 0.2s ease, text-decoration 0.2s ease;
}

.footer-institutional__link:hover {
  color: var(--ra-color-havelock-blue, #4672C8);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-institutional__link:focus {
  color: var(--ra-color-cobalt, #0943B5);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-institutional__link:active {
  color: var(--ra-color-blue-dark, #062E6F);
}

.footer-institutional__link:focus-visible {
  outline: 2px solid var(--ra-color-cobalt);
  outline-offset: 2px;
  border-radius: 2px;
}

.footer-institutional__logo {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.footer-institutional__logo-image {
  display: block;
  height: auto;
  max-width: 200px;
}

/* Redes Sociales */
.footer-social {
  padding: 0.5rem 0; /* reduced padding */
  border-top: none;
  border-bottom: none;
}

.footer-social__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  list-style: none;
  padding: 0;
  margin: 0;
  align-items: center;
}

.footer-social__item {
  display: inline-flex;
  align-items: center;
}

/* Show social icon + handle inline (icon left, text right) like the reference */
.footer-social__link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ra-color-cobalt); /* #0943B5 */
  background-color: transparent;
  border: none;
  padding: 0.125rem 0.25rem;
  border-radius: 4px;
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease, transform 0.12s ease;
}

.footer-social__link svg {
  width: 18px;
  height: 18px;
}

.footer-social__link span {
  font-size: 0.875rem;
  line-height: 1;
  color: var(--ra-color-cobalt);
}

.footer-social__link:hover,
.footer-social__link:focus {
  background-color: transparent;
  color: var(--ra-color-havelock-blue, #4672C8);
  transform: none;
}

/* Enlaces Legales */
.footer-legal {
  padding-top: 1.5rem;
}

.footer-legal__list {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-legal__item {
  display: inline-block;
}

.footer-legal__link {
  color: var(--ra-color-cobalt); /* #0943B5 */
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s ease, text-decoration 0.2s ease;
}

.footer-legal__link:hover {
  color: var(--ra-color-havelock-blue, #4672C8);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-legal__link:focus {
  color: var(--ra-color-cobalt, #0943B5);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-legal__link:active {
  color: var(--ra-color-blue-dark, #062E6F);
}

.footer-legal__link:focus-visible {
  outline: 2px solid var(--ra-color-cobalt);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ==========================================================================
   GOV.CO Bottom Bar with Cobalt Background and Yellow Divider
   ========================================================================== */

.site-footer__bottom {
  background-color: var(--ra-color-cobalt); /* #0943B5 */
  padding: 0.5rem 0;
}

.footer-govco__content {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
}

.footer-govco__logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.footer-govco__logo-link:hover,
.footer-govco__logo-link:focus {
  opacity: 0.95;
}

.footer-govco__divider {
  color: var(--ra-color-white);
  font-size: 1.5rem;
  line-height: 1;
  font-weight: 300;
}

.footer-govco__logo-link:focus-visible {
  outline: 2px solid var(--ra-color-white);
  outline-offset: 4px;
  border-radius: 4px;
}

.footer-govco__logo-image {
  display: block;
  height: auto;
  max-width: 120px;
}

.footer-govco__seal {
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer-govco__seal-image {
  display: block;
  height: auto;
  max-width: 48px;
}

/* ==========================================================================
   Accessibility Utilities
   ========================================================================== */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

/* Tablet: <992px - Reduce to 2 columns */
@media (max-width: 991.98px) {
  .site-footer__card {
    margin-left: 3%;
    margin-right: 3%;
  }

  .site-footer__top {
    padding: 2.5rem 0 1.5rem;
  }

  .footer-mega__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem 1.5rem;
  }

  .footer-mega__column--logo {
    grid-column: 1 / -1; /* Full width for logo */
  }

  .site-footer__middle {
    padding: 1.5rem 0 2.5rem;
  }

  .footer-institutional__grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .footer-institutional__logo {
    justify-content: flex-start;
  }

  .footer-institutional__logo-image {
    max-width: 140px;
  }
}

/* Mobile: <768px - Stack to 1 column */
@media (max-width: 767.98px) {
  .site-footer__card {
    margin-left: 2%;
    margin-right: 2%;
    border-radius: 12px 12px 0 0;
  }

  .site-footer__top {
    padding: 2rem 0 1.5rem;
  }

  .footer-mega__grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .footer-mega__column--logo {
    grid-column: 1;
  }

  /* Accordion functionality on mobile */
  .footer-menu__title--accordion {
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    position: relative;
    padding-right: 2rem;
  }

  .footer-menu__title--accordion::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%) rotate(0deg);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid var(--ra-color-cobalt, #0943B5);
    transition: transform 0.3s ease;
  }

  .footer-menu__title--accordion.footer-menu__title--collapsed::after {
    transform: translateY(-50%) rotate(-90deg);
  }

  .footer-menu__title--accordion:hover,
  .footer-menu__title--accordion:focus {
    color: var(--ra-color-havelock-blue, #4672C8);
  }

  .footer-menu__title--accordion:focus-visible {
    outline: 2px solid var(--ra-color-cobalt);
    outline-offset: 2px;
    border-radius: 4px;
  }

  .site-footer__middle {
    padding: 1.5rem 0 2rem;
  }

  .footer-institutional__grid {
    gap: 1.5rem;
  }

  .footer-institutional__title {
    font-size: 1.125rem;
  }

  .footer-institutional__text {
    font-size: 0.8125rem;
  }

  .footer-social {
    padding: 1.25rem 0;
  }

  .footer-social__list {
    gap: 0.75rem;
  }

  .footer-social__link {
    /* Keep inline display for mobile, adjust size */
    width: auto;
    height: auto;
    padding: 0.25rem 0.5rem;
  }

  .footer-social__link span {
    font-size: 0.75rem;
  }

  .footer-legal {
    padding-top: 1.25rem;
  }

  .footer-legal__list {
    flex-direction: column;
    gap: 0.75rem;
  }

  .site-footer__bottom {
    padding: 1.25rem 0;
  }

  .footer-govco__content {
    flex-direction: row;
    gap: 1rem;
  }

  .footer-govco__logo-image {
    width: 100px;
    height: auto;
  }

  .footer-govco__divider {
    height: 32px;
  }

  .footer-govco__colombia-image {
    width: 60px;
    height: auto;
  }
}

/* Small mobile: <576px */
@media (max-width: 575.98px) {
  .site-footer__card {
    margin-left: 1%;
    margin-right: 1%;
  }

  .site-footer__top {
    padding: 1.5rem 0 1.25rem;
  }

  .footer-mega__grid {
    gap: 1.5rem;
  }

  .footer-menu__title {
    font-size: 0.9375rem;
  }

  .footer-menu__link {
    font-size: 0.8125rem;
  }

  .site-footer__middle {
    padding: 1.25rem 0 1.5rem;
  }

  .footer-institutional__title {
    font-size: 1rem;
  }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
  .site-footer__shell {
    background: white;
  }

  .site-footer__shell::before {
    display: none;
  }

  .site-footer__bottom {
    background-color: transparent;
    color: var(--ra-color-black);
  }

  .footer-social,
  .footer-govco__divider {
    display: none;
  }
}
