/* ==========================================================================
   Footer - Puunjalostusinsinöörit
   ==========================================================================
   Footer layout with logo, contact info, social links, and navigation.
   Requires brand.css to be loaded first for CSS variables.
   ========================================================================== */

footer.primary {
  position: relative;
  /* Overrides the legacy plain "footer" rule in app.css, which still sets
     the old tapetti_footer_3.png as a background-image - that pattern is
     replaced by the ::before strip below, not stacked behind it. */
  background-image: none;
  background-color: var(--color-primary);
  color: var(--color-white);
  padding-top: 6rem;
  padding-bottom: var(--spacing-2xl);
}

/* Decorative strip above the footer content. PI_viivat_16-9_sini.png is a
   large pattern image, not a pre-cropped strip - scaled down so a few
   copies tile across the width (more of the pattern visible), then
   clipped to a thin band by the strip's fixed height. */
footer.primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 80px;
  background-image: url(../img/PI_viivat_16-9_sini.png);
  background-position: top center;
  background-repeat: repeat-x;
  background-size: 40% auto;
  pointer-events: none;
}

footer.primary section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

@media screen and (max-width: 50em) {
  footer.primary section {
    padding: 0 var(--container-padding-mobile);
  }
}

footer.primary h3,
footer.primary h4 {
  color: var(--color-white);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--spacing-sm);
}

footer.primary p {
  margin-bottom: var(--spacing-xs);
}

footer.primary a:not(.btn) {
  color: var(--color-white);
}

footer.primary hr {
  border-color: rgba(255, 255, 255, 0.2);
  margin: var(--spacing-xl) 0;
}


/* ==========================================================================
   MAIN FOOTER ROW (Logo, Contact, Social)
   ========================================================================== */

.footer-main {
  display: flex;
  flex-wrap: wrap;
  row-gap: var(--spacing-xl);
}

.footer-main::before,
.footer-main::after {
  display: none !important;
  content: none !important;
}

@media screen and (min-width: 50em) {
  .footer-main {
    flex-wrap: wrap;
  }

  .footer-main > div[class*="columns"] {
    width: auto !important;
    max-width: none !important;
    flex-basis: 0 !important;
    flex-grow: 1 !important;
  }

  .footer-main > .footer-logo-col {
    flex: 1 1 100% !important;
    max-width: 100% !important;
    margin-bottom: var(--spacing-lg);
  }
}

@media screen and (min-width: 64em) {
  .footer-main {
    flex-wrap: nowrap;
  }

  .footer-main > .footer-logo-col {
    flex-basis: 0 !important;
    max-width: none !important;
    margin-bottom: 0;
  }
}

/* Logo column */
.footer-logo-col {
  flex: 0 0 auto;
}

.footer-logo-col img {
  max-width: 271px;
  height: auto;
  width: 100%;
}

/* Contact info column */
.footer-contact-col {
  flex: 1 1 auto;
}

/* Social column */
.footer-social-col {
  flex: 0 0 auto;
}

.footer-social-col h3 {
  margin-bottom: var(--spacing-sm);
}

/* CTA column */
.footer-cta-col {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.footer-cta-col .btn {
  margin: 0;
  text-align: center;
}

/* Exception: the footer background is dark blue, so a dark-blue-family
   button (solid or 20% tint) would be invisible against it. Render those
   as white outline buttons instead - full-strength outline for dark blue,
   a fainter outline for its 20% tint. */
.footer-cta-col .btn--primary {
  background-color: transparent;
  border-color: var(--color-white);
  color: var(--color-white);
}

.footer-cta-col .btn--primary:hover,
.footer-cta-col .btn--primary:focus {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: var(--color-white);
  color: var(--color-white);
}

.footer-cta-col .btn--primary-light {
  background-color: transparent;
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--color-white);
}

.footer-cta-col .btn--primary-light:hover,
.footer-cta-col .btn--primary-light:focus {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.35);
  color: var(--color-white);
}

.footer-social-col .some-contact {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  gap: var(--spacing-sm);
}

.footer-social-col .some-contact li {
  margin: 0;
  padding: 0;
}

.footer-social-col .some-contact a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 2px solid rgba(255, 255, 255, 1);
  border-radius: var(--border-radius);
  font-size: var(--font-size-lg);
  transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.footer-social-col .some-contact a:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--color-white);
}


/* ==========================================================================
   FOOTER NAVIGATION ROW
   ========================================================================== */

.footer-nav-row {
  margin-top: var(--spacing-md);
  text-align: center;
}

@media screen and (min-width: 50em) {
  .footer-nav-row {
    text-align: left;
  }
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--spacing-md) var(--spacing-xl);
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links > li {
  position: relative;
}

.footer-links > li > a {
  font-weight: var(--font-weight-bold);
  text-decoration: none;
  border-right: 1px solid rgba(255, 255, 255, 0.25);
  padding-right: 1rem;
}

.footer-links > li:last-child > a {
  border-right: 0;
  padding-right: 0;
}

.footer-links > li > a:hover {
  text-decoration: underline;
}

/* Hide dropdown submenus in footer nav */
.footer-links ul {
  display: none;
}

/* Secondary footer links row (from footer_links page reference) */
.footer-links--secondary {
  margin-top: var(--spacing-md);
  gap: var(--spacing-sm) var(--spacing-md);
}

.footer-links--secondary > li > a {
  font-size: 0.875rem;
  font-weight: var(--font-weight-normal);
}


/* ==========================================================================
   FOOTER COPYRIGHT
   ========================================================================== */

.footer-text {
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-md);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.footer-text p {
  margin: 0;
  font-size: 0.875rem;
  font-weight: var(--font-weight-normal);
  color: rgba(255, 255, 255, 0.7);
}

.footer-text a {
  color: rgba(255, 255, 255, 0.7);
}


/* ==========================================================================
   MOBILE STYLES
   ========================================================================== */

@media screen and (max-width: 50em) {
  .footer-main {
    flex-direction: column;
    text-align: center;
  }

  .footer-logo-col {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .footer-contact-col {
    flex: 1 1 auto;
  }

  .footer-social-col {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .footer-social-col .some-contact {
    justify-content: center;
  }

  .footer-cta-col {
    align-items: center;
  }

  .footer-cta-col .btn {
    width: 100%;
    max-width: 280px;
  }

  .footer-links {
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
  }
}
