:root {
  --white: #EDEDED;
  --black: #171717;
  --gray: #444444;
  --red: #DA0037;
  --fp-animation-duration: 60s;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  color: var(--white);
  background-color: #171717;
  height: 100svh;
  display: flex;
  flex-direction: column;
}

/*Typography Start*/

p {
  font-size: 1.2rem;
}

a {
  color: rgba(237, 237, 237, .7);
  text-decoration: none;

  &:hover {
    color: var(--white);
  }
}

.a-content {
  position: relative;
  color: rgba(237, 237, 237, .7);
  text-decoration: none;
  font-size: calc(1.2rem - 1px);
  font-weight: bold;
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  background: linear-gradient(to right, var(--white), var(--white) 50%, rgba(237, 237, 237, .7) 50%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-size: 200% 100%;
  background-position: 100%;
  transition: background-position 500ms ease;


  &::after {
    content: '';
    width: 0px;
    height: 1px;
    display: block;
    background: var(--white);
    transition: 500ms;
  }

  &:hover {
    background-position: 0 100%;

    &::after {
      width: 100%;
    }
  }
}

h3 {
  font-size: 2rem;
  font-weight: 600;
}

.rekisteri-ja-tietosuojaseloste p {
  margin-left: 1rem;
}

/*Typography End*/

.dark-gradient {
  background: var(--black);
  background: linear-gradient(0deg, rgba(23,23,23,0) 0%, rgba(23,23,23,0.2) 10%, rgba(23,23,23,1) 100%);
  transition: all 0.5s;
}

/*Hero Images & Content On Front Page Start*/

.hero {
  display: grid;
  position: relative;
  overflow: hidden;
}

.hero-bg {
  grid-row: 1;
  grid-column: 1;
  display: none;
  position: relative;
  z-index: 0;

  & .pictures {
    display: grid;
    height: 100svh;
    width: 100svw;
    place-items: center;
    overflow: hidden;
  }

  & img {
    grid-row: 1;
    grid-column: 1;
    object-fit: cover;
    height: 100svh;
    width: 100%;
    position: relative;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-bg img:nth-child(1) {
    animation: first-pic var(--fp-animation-duration) linear infinite;
  }

  .hero-bg img:nth-child(2) {
    animation: second-pic var(--fp-animation-duration) linear infinite;
  }

  .hero-bg img:nth-child(3) {
    animation: third-pic var(--fp-animation-duration) linear infinite;
  }

  /*Hero Animations*/

  @keyframes first-pic {
    0% {
      opacity: 0;
      transform: scale(1.3);
    }
    3%, 30.33% {
      opacity: 1;
    }
    33.33%, 100% {
      opacity: 0;
      transform: scale(1);
    }
  }

  @keyframes second-pic {
    0%, 33.33% {
      opacity: 0;
      transform: scale(1.3);
    }
    36.33%, 63.66% {
      opacity: 1;
    }
    66.66%, 100% {
      opacity: 0;
      transform: scale(1);
    }
  }

  @keyframes third-pic {
    0%, 66.66% {
      opacity: 0;
      transform: scale(1.3);
    }
    69.66%, 97% {
      opacity: 1;
    }
    100% {
      opacity: 0;
      transform: scale(1);
    }
  }

  /*Hero Animations*/
}

.hero-content {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  height: 100svh;
  position: absolute;
  top: 0;
  z-index: 0;
  background-color: rgba(23,23,23,0.5);

  & h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
    text-shadow: 5px 5px 5px #333;
  }

  & p {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 2rem;
    text-shadow: 5px 5px 5px #333;
  }

  & .btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--white);
    color: #171717;
    border: 2px solid var(--red);
    font-weight: 800;
    text-decoration: none;
    border-radius: 15px;
    transition: all 0.2s ease-in-out;
  
    &:hover {
      background-color: var(--gray);
      color: var(--white);
      box-shadow: 0 0 15px #333;
      scale: 1.1;
    }
  }
}

.hero-text {
  padding: 5rem 0;
  width: 100%;
}

/*Hero Images & Content On Front Page End*/

.page-content {
  position: relative;
  grid-row: 1;
  grid-column: 1;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
}

/*Top Navbar Start*/

.navbar {
  margin-top: 0;
  z-index: 1;
}

.navbar-bg {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  background-image: linear-gradient(135deg, #1a1a1a 25%, transparent 25%), 
                    linear-gradient(225deg, #1a1a1a 25%, transparent 25%), 
                    linear-gradient(45deg, #1a1a1a 25%, transparent 25%), 
                    linear-gradient(315deg, #1a1a1a 25%, transparent 25%);
  background-size: 20px 20px;
  background-position: 10px 10px, 10px 10px, 0px 0px, 0px 0px;
}

.navbar:has(.collapsing, .show) {
  background-color: var(--black);
}

[data-target="#navbarCollapse"] {
  position: relative;
  z-index: 999;
}

.navbar-brand {
  height: 80px;
  width: 107px;
  filter: drop-shadow(0 0 0.2rem var(--white));
  transition: all 0.2s ease-in-out;

  &::after {
    content: none;
  }

  &:hover {
    filter: drop-shadow(0 0 0.4rem var(--white));
    scale: 1.05;
  }
}
  
#navbarCollapse li > a {
  font-size: 1rem;
  letter-spacing: 1px;
  color: rgba(237, 237, 237, .5);
  font-weight: 400;
  position: relative;
  z-index: 1;
  text-decoration: none;

  &:hover {
    color: var(--white);
  }
}

#navbarCollapse li > a.active {
  color: var(--white);
}

.hamburger {
  padding: 15px 15px;
  display: inline-block;
  cursor: pointer;
  transition-property: opacity, filter;
  transition-duration: 0.15s;
  transition-timing-function: linear;
  font: inherit;
  color: inherit;
  text-transform: none;
  background-color: transparent;
  border: 0;
  margin: 0;
  overflow: visible;

  &:hover {
    opacity: 0.7;
  }
  & .is-active:hover {
    opacity: 0.7;
  }
}

.hamburger-box {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 24px;
}

.hamburger-inner {
  display: block;
  top: 50%;
  margin-top: -2px;

  &::before, &::after {
    display: block;
    content: "";
  }

  &::before {
    top: -10px;
  }

  &::after {
    bottom: -10px;
  }
}

.hamburger-inner, .hamburger-inner::before, .hamburger-inner::after {
  width: 40px;
  height: 4px;
  background-color: var(--white);
  border-radius: 4px;
  position: absolute;
  transition-property: transform;
  transition-duration: 0.15s;
  transition-timing-function: ease; 
}

.hamburger--spring .hamburger-inner {
  top: 2px;
  transition: background-color 0s 0.13s linear; 
}
.hamburger--spring .hamburger-inner::before {
    top: 10px;
    transition: top 0.1s 0.2s cubic-bezier(0.33333, 0.66667, 0.66667, 1), transform 0.13s cubic-bezier(0.55, 0.055, 0.675, 0.19); 
}
.hamburger--spring .hamburger-inner::after {
    top: 20px;
    transition: top 0.2s 0.2s cubic-bezier(0.33333, 0.66667, 0.66667, 1), transform 0.13s cubic-bezier(0.55, 0.055, 0.675, 0.19); 
}

.hamburger--spring.is-active .hamburger-inner {
  transition-delay: 0.22s;
  background-color: transparent !important; 
}

.hamburger--spring.is-active .hamburger-inner::before {
  top: 0;
  transition: top 0.1s 0.15s cubic-bezier(0.33333, 0, 0.66667, 0.33333), transform 0.13s 0.22s cubic-bezier(0.215, 0.61, 0.355, 1);
  transform: translate3d(0, 10px, 0) rotate(45deg); 
}

.hamburger--spring.is-active .hamburger-inner::after {
  top: 0;
  transition: top 0.2s cubic-bezier(0.33333, 0, 0.66667, 0.33333), transform 0.13s 0.22s cubic-bezier(0.215, 0.61, 0.355, 1);
  transform: translate3d(0, 10px, 0) rotate(-45deg); 
}

/*Top Navbar End*/

main {
  display: flex;
  flex: 1;
  justify-content: center;
}

/*Palvelut Start*/

.palvelut-row {
  background-color: var(--white);

  & div {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--black);

    & > h3 {
      margin-top: 1rem;
    }

    & > img {
      max-width: 250px;
      border-radius: 50%;
      z-index: 2;
      margin-top: 1rem;
      margin-bottom: 1rem;
    }

    & a {
      position: relative;
      color: var(--gray);
      text-decoration: none;
      display: inline-block;
      overflow: hidden;
      vertical-align: top;
      background: linear-gradient(to right, var(--black), var(--black) 50%, var(--gray) 50%);
      background-clip: text;
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-size: 200% 100%;
      background-position: 100%;
      transition: background-position 500ms ease;

      &::after {
        content: '';
        width: 0px;
        height: 1px;
        display: block;
        background: var(--black);
        transition: 500ms;
      }

      &:hover {
        background-position: 0 100%;

        &::after {
          width: 100%;
        }
      }
    }
  }
  & div:nth-child(2n) {
    background-color: var(--black);
    background-image: url("../media/images/palvelut/palvelut-back-575.svg");
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
  }
}

.bg-left {
  border-radius: 20%;
}

.bg-right {
  border-radius: 20%;
}

/*Palvelut End*/

/*Gallery Start*/

@media (prefers-reduced-motion: no-preference) {
  .img-container > .col {
    transform: scale(.8);
    opacity: 0;
    animation: fade-in linear forwards;
    animation-timeline: view();
    animation-range: 0px 200px;
  }

  @keyframes fade-in {
    to {
      transform: scale(1);
      opacity: 1;
    }
  }
}

.thumb {
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease-out;
  background-color: black;
  border-radius: 10px;
  box-shadow: 0 0 15px rgba(0,0,0,1);

  &:hover {
    transform: scale(1.1);
    z-index: 10;
  }
}

#gallery img {
  background-color: transparent;
  object-fit: contain;
  max-width: 100%;
}

.modal-dialog {
  max-width: 100%;
  max-height: 100%;
  justify-content: center;
  margin: 0 0.5rem;
}

.fade {
  background-color: rgba(0,0,0,0.9);
}

.modal-content {
  background-color: rgba(255,255,255,0);
  border: none;
}

.modal-header {
  border: none;
  padding: 0 1rem;
}

.modal-body {
  display: grid;
  height: 100%;
  padding: 0;
}

.modal-footer {
  border: none;
  padding: 0 1rem;
}

.carousel-class {
  height: 100%;
  width: 100%;
}

.carousel-control-prev,
.carousel-control-next {
  height: 100%;
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
  width: 3rem;
  height: 3rem;
  filter: none !important;
}

.carousel-inner {
  height: 100%;
}

.carousel-item {
  text-align: center;
}

.carousel-item img {
  max-height: 50svh;
  margin: auto;
}

.car-title {
  margin-top: 1rem;
  margin-bottom: 2rem;
  width: 100%;
}

.car-desc {
  margin-top: 1rem;
  width: 100%;
}

.btn-close {
  z-index: 99;
  font-size: 2rem;

  &:hover {
    color: #595959;
  }

  &:focus {
    outline: none;
    box-shadow: none;
  }
}

/*Gallery End*/

/*Contact Page Start*/

.contact-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1rem;

  & p {
    margin: .6rem;
  }
}

.contact-image {
  margin-top: 1rem;
  max-width: 250px;
  margin-bottom: 1rem;
}

.contact-sm-p {
  font-size: .8rem;
  text-align: center;
}

/* Form */

.form-hr {
  border-top: 2px solid rgba(255, 255, 255, 0.1);
}

.form-control {
  outline: 0;

  &::placeholder {
    color: var(--gray);
  }
}

.editable {
  width: 100%;
  min-height: 50px;
  padding: 10px;
  box-sizing: border-box;
  overflow-wrap: break-word; /* Handle long words */
}

.error-container {
  min-height: 1.8rem;
  max-width: 460px;
}

.error-message {
  color: red;
  font-size: 0.9em;
  line-height: 1.8rem;
  padding-left: .5rem;
  visibility: hidden; /* Initially hidden */
  opacity: 0;         /* Fully transparent */
  transition: visibility 0s, opacity 0.5s ease-in-out; /* Smooth fade-in effect */
}

.error-message.show {
  visibility: visible; /* Make it visible */
  opacity: 1;          /* Fully visible */
}

.error-highlight {
  border-color: red;
  box-shadow: 0 0 5px rgba(255, 0, 0, 0.5);
}

.contact-button {
  display: inline-block;
  padding: 10px 20px;
  margin-bottom: 2rem;
  background-color: var(--white);
  color: #171717;
  border: 2px solid var(--red);
  font-weight: 800;
  text-decoration: none;
  border-radius: 15px;
  transition: all 0.2s ease-in-out;
  
  &:hover {
    background-color: var(--gray);
    color: var(--white);
    box-shadow: 0 0 15px #333;
    scale: 1.1;
  }
}

/*Contact Page End*/

/*Footer Start*/

footer p {
  font-size: 1rem;
}

footer .a-content {
  font-size: calc(1rem - 1px);
}

.footer-content {
  display: none;
  padding-top: 1rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  border-top: 2px solid rgba(255, 255, 255, 0.1);
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  background-image: linear-gradient(135deg, #121212 25%, transparent 25%), 
                    linear-gradient(225deg, #121212 25%, transparent 25%), 
                    linear-gradient(45deg, #121212 25%, transparent 25%), 
                    linear-gradient(315deg, #121212 25%, transparent 25%);
  background-size: 20px 20px;
  background-position: 10px 10px, 10px 10px, 0px 0px, 0px 0px;
}

.footer-margin {
  margin-bottom: 1rem;
}

.copyright-hr {
  margin-bottom: 0;
}

.copyright p {
  margin-top: .5rem;
  margin-bottom: .2rem;
  font-size: .8rem;
}

/*Footer End*/

/*404 Start*/

.nelnolnel-logo {
  max-width: 350px;
  -webkit-transform: scaleY(-1);
  transform: scaleY(-1);
}

/*404 End*/

/*Media Queries Start */

/*No media query for `xs` since this is the default in Bootstrap*/

@media (min-width: 360px) { 
  .carousel-item img {
    max-height: 60svh;
  }

  .contact-image {
    max-width: 350px;
  }

  .palvelut-row > img {
    max-width: 250px;
  }
}

/*Small devices (landscape phones, 576px and up)*/
@media (min-width: 576px) {
  .carousel-item img {
    max-height: 65svh;
  }

  .palvelut-row > img {
    max-width: 250px;
  }

  .footer-margin {
    margin-bottom: 0rem;
  }
}

/*Medium devices (tablets, 768px and up)*/
@media (min-width: 768px) {
  #navbarCollapse li:not(:last-of-type) {
    margin-right: 1rem;
  }

  .collapse.in {
    display: block !important;
    padding: 0;
    clear: both;
  }

  .main-header .navbar {
    float: none;
    width: 100%;
    padding-left: 0;
    padding-right: 0;
    text-align: center;
  }

  .main-header .navbar-nav li .nav-link {
    text-align: center;
    padding: 20px 15px;
    border-radius: 0px;
  }

  #navbarCollapse li > a::before {
    position: absolute;
    content: "";
    width: calc(100% - 1px);
    height: 1px;
    background: #fff;
    bottom: 0px;
    left: 0;

    -webkit-transform: scale(0, 1);
    -ms-transform: scale(0, 1);
    transform: scale(0, 1);
    -webkit-transform-origin: right center;
    -ms-transform-origin: right center;
    transform-origin: right center;
    z-index: -1;

    -webkit-transition: transform 0.5s ease;
    transition: transform 0.5s ease;
  }
  
  #navbarCollapse li > a:hover::before,
  #navbarCollapse li > a.active::before {
    -webkit-transform: scale(1, 1);
    -ms-transform: scale(1, 1);
    transform: scale(1, 1);
    -webkit-transform-origin: left center;
    -ms-transform-origin: left center;
    transform-origin: left center;
  }

  .hamburger {
    display: none;
  }

  .hero-content h1 {
    font-size: 4rem;
  }

  .palvelut-row {
    height: 400px;

    & div > img {
      max-width: 300px;
    }

    & div:nth-child(2n) {
      background-image: none;
      background-color: transparent;
    }
  }

  .bg-left {
    background-image: url("../media/images/palvelut/palvelut-back-800-left.svg");
    background-position: 100%;
    align-self: flex-end;
    border-radius: 0 20% 20% 0;
  }
  
  .bg-right {
    background-image: url("../media/images/palvelut/palvelut-back-800-right.svg");
    border-radius: 20% 0 0 20%;
  }
  
  .contact-image {
    max-width: 400px;
    margin-top: 0;
  }

  .error-container {
    max-width: 1600px;
  }
}

/*Large devices (desktops, 992px and up)*/
@media (min-width: 992px) {
  .carousel-item img {
    max-height: 80svh;
  }

  .palvelut-row div > img {
    max-width: 350px;
  }

  .bg-left {
    background-image: url("../media/images/palvelut/palvelut-back-960-left.svg");
    background-position: 100%;
  }
  
  .bg-right {
    background-image: url("../media/images/palvelut/palvelut-back-960-right.svg");
  }
}

/*X-Large devices (large desktops, 1200px and up)*/
@media (min-width: 1200px) {
  .bg-left {
    background-image: url("../media/images/palvelut/palvelut-back-1140-left.svg");
    background-position: 100%;
  }
  
  .bg-right {
    background-image: url("../media/images/palvelut/palvelut-back-1140-right.svg");
  }
}

/*XX-Large devices (larger desktops, 1400px and up)*/
@media (min-width: 1400px) {
  .bg-left {
    background-image: url("../media/images/palvelut/palvelut-back-1320-left.svg");
    background-position: 100%;
  }
  
  .bg-right {
    background-image: url("../media/images/palvelut/palvelut-back-1320-right.svg");
  }
}

/*Media Queries End */