@use '../globals/variables' as *;
@use '../globals/mixins' as *;
@use '../globals/typography' as *;

footer[role="contentinfo"] {
  background-color: var(--footer-background);

  // same color dark / light mode
  color: var(--footer-text-color);

  // Layout
  .inner-container {
    @include inner-container;
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-areas:
    "top-first     top-second    top-third"
    "bottom-first  bottom-first  top-third"
    "bottom-second bottom-second bottom-second";
    gap: var(--gutter);
    background-repeat: no-repeat;
    background-position: top right;
    font-size: var(--footer-font-size);
    line-height: 140%;
    padding: var(--gutter) 0;
    @media #{$media-mobile} {
      grid-template-areas:
        "top-first"
        "top-second"
        "top-third"
        "bottom-first"
        "bottom-second"

    }
  }

  .footer--top-first {
    grid-area: top-first;
  }

  .footer-top-second {
    grid-area: top-second;
  }

  .footer-top-third {
    grid-area: top-third;
  }

  .footer-bottom-first {
    grid-area: bottom-first;
  }

  .footer-bottom-second {
    grid-area: bottom-second;
  }

  a {
    color: var(--footer-link-color);
  }

  // Config pages
  .field--name-field-title {
    @include font-footer-heading;
  }
}

.to-top {
  a {
    position: absolute;
    bottom: calc(var(--gutter) * 3);
    right: 0;
    height: 42px;
    width: 42px;
    scroll-behavior: smooth;
    background-color: white;
    background-image: url('/themes/custom/skrymten/assets/images/trfk-icons/pointed-arrow-blue-up.svg');
    background-repeat: no-repeat;
    background-position: 50% ;
    border-radius: 21px;
    text-indent: -10000000px;
  }
}

.footer-bottom-first, .footer-bottom-second {
  ul {
    @media #{$media-mobile} {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      grid-gap: var(--gutter);
    }
  }
  .menu {
    padding: 0;
    margin: var(--2x-gutter) 0;
    li {
      display: inline-block;
      margin-right: var(--gutter);
    }
  }
}

.footer-bottom-first {
  // SOME menu
  .menu {
    a {
      text-decoration: none;
    }
    li {
      --icon-size: 28px;
      height: var(--icon-size);
      line-height: var(--icon-size);
      padding-left: 36px;
      background-image: var(--some-facebook-icon);
      background-size: var(--icon-size);
      background-repeat: no-repeat;
      background-position: 0 50% ;
      &.linkedin {
        background-image: var(--some-linkedin-icon);
      }
      &.youtube {
        background-image: var(--some-youtube-icon);
      }
      &.instagram {
        background-image: var(--some-instagram-icon);
      }
    }
  }
}

.footer-bottom-second {
  .menu {
    @media #{$media-mobile} {
      grid-template-columns: 1fr;
      grid-gap: var(--2x-gutter);
    }
    li {
      @media #{$media-mobile} {
        display: block;
      }
    }
  }
}

// Per-site footer illustrations.
$footer-illustrations: (
  'vgs-aafjord': 'footer-aafjord',
  'vgs-byaasen': 'footer-illustration', // no dedicated svg yet
  'vgs-charlottenlund': 'footer-charlottenlund',
  'vgs-cissiklein': 'footer-cissiklein',
  'vgs-fosen': 'footer-fosen',
  'vgs-gauldal': 'footer-gauldal',
  'vgs-grong': 'footer-grong',
  'vgs-gurikunna': 'footer-gurikunna',
  'vgs-heimdal': 'footer-heimdal',
  'vgs-inderoy': 'footer-inderoy',
  'vgs-johanbojer': 'footer-johanbojer',
  'vgs-kyrksaterora': 'footer-kyrksaterora',
  'vgs-levanger': 'footer-levanger',
  'vgs-maere': 'footer-maere',
  'vgs-malvik': 'footer-malvik',
  'vgs-melhus': 'footer-melhus',
  'vgs-meraaker': 'footer-meraker',
  'vgs-nettskolen': 'footer-nettskole',
  'vgs-olavduun': 'footer-olavduun',
  'vgs-olevig': 'footer-olevig',
  'vgs-oppdal': 'footer-oppdal',
  'vgs-orkland': 'footer-orkland',
  'vgs-roros': 'footer-roros',
  'vgs-selbu': 'footer-selbu',
  'vgs-skjetlein': 'footer-skjetlein',
  'vgs-sommerchild': 'footer-sommerchild',
  'vgs-steinkjer': 'footer-steinkjer',
  'vgs-strinda': 'footer-strinda',
  'vgs-thorastorm': 'footer-thorastorm',
  'vgs-thyf': 'footer-illustration', // no dedicated svg yet
  'vgs-tiller': 'footer-tiller',
  'vgs-trondelagsmotet': 'footer-illustration', // no dedicated svg yet
  'vgs-trondheim': 'footer-trondheimkatedralskole',
  'vgs-trondheim-voksenopp': 'footer-trondheimvoksenopplaring',
  'vgs-verdal': 'footer-verdal',
  'vgs-ytrenamdal': 'footer-ytrenamdal',
);

@each $site, $image in $footer-illustrations {
  .site-id-#{$site} {
    footer[role="contentinfo"] {
      .footer-top-third {
        background-image: url('/themes/custom/skrymten/assets/images/#{$image}.svg');
        background-repeat: no-repeat;
        background-position: top right;
        min-height: 400px;
        min-width: 360px;
      }
    }
  }
}

.site-id-main, .site-id-vgs-thyf {
  footer[role="contentinfo"] {
    background-image: url('/themes/custom/skrymten/assets/images/footer-illustration.svg');
    background-repeat: no-repeat;
    background-position: top right;
    .footer-top-third {
      background-image: none;
      min-height: initial;
    }
  }
}

.site-id-vgs-thyf {
  footer[role="contentinfo"] {
    background-image: url('/themes/custom/skrymten/assets/images/footer-illustration-lighter.svg');
  }
}
