/* Language Selector */
.language-selector {
  display: flex;
  align-items: center;
}

#language-switcher {
  background: var(--color-surface);
  border-radius: 8px;
  border: 2px solid var(--color-primary);
  color: var(--color-text);
  cursor: pointer;
  font-family: var(--font-family-primary);
  font-weight: 600;
  min-height: 44px;
  padding: 0.5rem 1rem;
}

#language-switcher:hover,
#language-switcher:focus {
  background: var(--color-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

#language-switcher option {
  background: var(--color-surface);
  color: var(--color-text);
}

/* Theme toggle button */
#theme-toggle {
  align-items: center;
  background: var(--color-surface);
  border-radius: 50%;
  border: 2px solid var(--color-primary);
  cursor: pointer;
  display: flex;
  height: 44px;
  justify-content: center;
  overflow: hidden;
  /* position: sticky; */
  right: 1rem;
  bottom: 1rem;
  transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
  width: 44px;
  flex-shrink: no-shrink;

  &:hover {
    background: var(--color-primary);
    box-shadow: var(--shadow-sm);
  }

  .theme-icon {
    width: 22px;
    height: 22px;
    color: var(--color-text);
    position: absolute;
    transition: opacity 0.3s, transform 0.3s;

    &.sun {
      opacity: 1;
      transform: rotate(0deg);
    }

    &.moon {
      opacity: 0;
      transform: rotate(-90deg);
    }
  }

  /* Dark mode states */
  [data-theme="dark"] & {
    .sun { opacity: 0; transform: rotate(90deg); }
    .moon { opacity: 1; transform: rotate(0deg); }
  }

  &:hover .theme-icon {
    color: white;
  }
}

/* Back-to-top button */
#back-to-top {
  position: sticky;
  bottom: 1rem;
  right: 1rem;
  width: 44px;
  height: 44px;
  background: var(--color-primary);
  border: 2px solid var(--color-primary);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.3s cubic-bezier(0.25, 0.1, 0.25, 1),
              transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1),
              box-shadow 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
  z-index: 1000;
  box-shadow: var(--shadow-sm);
  align-self: flex-end; /* Align to right within #contact flex container */
  margin-left: auto;   /* Push to right edge */
}

#back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

#back-to-top:hover,
#back-to-top:focus {
  box-shadow:
    var(--shadow-sm),
    var(--shadow-md),
    0 12px 32px rgba(250, 127, 0, 0.2);
  transform: translateY(-2px);
  background: var(--color-accent);
  border-color: var(--color-accent);
}

#back-to-top:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

#back-to-top svg {
  width: 24px;
  height: 24px;
  color: white;
  transition: transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

#back-to-top:hover svg {
  transform: translateY(-2px);
}

/* Header styles */
#top-header {
  background: rgba(var(--color-surface), 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-secondary);
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .5rem;
  gap: .5rem;
  position: sticky;
  top: 0px;
  z-index: 2;
  will-change: transform, box-shadow;

  &.scrolled {
    box-shadow: var(--shadow-md);
  }

  .logo-plus-text {
    display: flex;
    flex-direction: row;
    align-items: center;
  }

  img.logo {
    width: 60px;
    height: 60px;
    height: auto;
    object-fit: contain;
  }

  .logo-wrapper {
    width: 60px;
    height: 60px;
    height: auto;
  }

  #nav-toggle {
    display: none;
    color: var(--color-text);
    border: 2px solid var(--color-primary);
    background-color: transparent;
    padding: 0.3rem;
    font-size: 2rem;
    line-height: 1;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);

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

  .header-nav {
    ul {
      display: flex;
      flex-direction: row;
      gap: 1rem;
      align-items: center;

      a {
        text-decoration: none;
        color: var(--color-text);
        font-family: var(--font-family-primary);
        font-weight: 600;
        text-transform: uppercase;
        transition: color 0.3s;

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

@media (max-width: 650px) {
  #top-header {
    #nav-toggle {
      display: block;
    }

    .header-nav {
      display: none;
      position: absolute;
      flex-direction: column;
      align-items: stretch;
      top: 100%;
      left: 0;
      width: 100%;
      background-color: var(--color-surface);
      box-shadow: var(--shadow-md);
      transform: translateY(-10px);
      opacity: 0;
      transition: opacity 1s cubic-bezier(0.25, 0.1, 0.25, 1);

      &.open {
        display: flex;
        transform: translateY(0);
        opacity: 1;
        transition: opacity 1s cubic-bezier(0.25, 0.1, 0.25, 1);
      }

      ul {
        flex-direction: column;
        gap: .5rem;
        padding: 1rem 0;

        li {
          width: 100%;
          text-align: center;
        }

        a {
          font-size: 1rem;
          padding: 0.75rem 1rem;
          min-height: 44px;
          display: flex;
          align-items: center;
          justify-content: end;
          transition: all 0.2s ease;
          border-radius: 8px;

          &:hover,
          &:focus {
            background: rgba(250, 127, 0, 0.1);
            color: var(--color-primary);
          }
        }
      }
    }
  }
}

@media (max-width: 380px) {
  #top-header {
    .logo-wrapper {
      width: 50px;
      height: 50px;
    }
    img.logo {
      width: 50px;
      height: 50px;
    }
    .logo-text {
      display: none;
    }
  }
}

/* Banner / Hero */
.banner {
  display: inherit;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  padding: 1rem;
  position: relative;
  overflow: hidden;

  img.logo {
    width: clamp(150px, 30vw, 300px);
    height: clamp(150px, 30vw, 300px);
    height: auto;
    object-fit: contain;
    animation: logoReveal 2s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
    opacity: 0;
    transform: scale(0.95);
  }

  .logo-wrapper {
    width: clamp(150px, 30vw, 300px);
    height: clamp(150px, 30vw, 300px);
    height: auto;
  }

  h1.logo-text {
    animation: logoReveal 2s cubic-bezier(0.25, 0.1, 0.25, 1) 0.2s forwards;
    opacity: 0;
    transform: scale(0.95);
  }

  .tagline {
    color: var(--color-primary);
    text-transform: uppercase;
    font-family: var(--font-family-primary);
    font-weight: 600;
    letter-spacing: 0.1em;
    animation: fadeUp 0.8s cubic-bezier(0.25, 0.1, 0.25, 1) 0.4s forwards;
    opacity: 0;
    text-align: center;
  }
}

/* Main container with decorative blobs */
#main {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(250, 127, 0, 0.08) 0%, transparent 60%);

  /* Decorative blob backgrounds */
  &::before {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(250, 127, 0, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    z-index: -1;
    animation: blobFloat 20s ease-in-out infinite;
    pointer-events: none;
  }

  &::after {
    content: '';
    position: absolute;
    bottom: -10%;
    left: -15%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(250, 127, 0, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    z-index: -1;
    animation: blobFloat 25s ease-in-out infinite reverse;
    pointer-events: none;
  }
}

/* Services section */
#services {
  .service-list {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 1rem;
    perspective: 1000px; /* Enable 3D space for cards */

    li {
      max-width: 400px;
      min-height: 280px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      text-align: center;
      border: 1px solid var(--color-secondary);
      border-radius: 12px;
      padding: 1.5rem;
      gap: 0.75rem;
      background: var(--color-surface);
      transform-style: preserve-3d;
      transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1),
                  box-shadow 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);

      &:hover {
        transform: rotateX(4deg) rotateY(4deg) translateY(-8px);
        box-shadow:
          var(--shadow-lg),
          0 20px 60px rgba(250, 127, 0, 0.15),
          0 30px 80px rgba(250, 127, 0, 0.1);
        border-color: var(--color-primary);
      }

      h4 {
        margin: 0;
        font-size: 1.25rem;
        transform: translateZ(10px) rotateX(-4deg) rotateY(-4deg); /* Float above + counter-rotation for readability */
      }

      p {
        font-size: 1rem;
        line-height: 1.6;
        color: var(--color-text-muted);
        transform: translateZ(10px) rotateX(-4deg) rotateY(-4deg); /* Float above + counter-rotation for readability */
      }

      /* Stagger animation delays */
      &:nth-child(1) { animation-delay: 0.1s; }
      &:nth-child(2) { animation-delay: 0.2s; }
      &:nth-child(3) { animation-delay: 0.3s; }
      &:nth-child(4) { animation-delay: 0.4s; }
      &:nth-child(5) { animation-delay: 0.5s; }
      &:nth-child(6) { animation-delay: 0.6s; }

      .service-icon {
        width: 48px;
        height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
        border-radius: 12px;
        margin-bottom: 0.5rem;
        box-shadow: var(--shadow-sm);
        transition: transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);

        svg {
          width: 28px;
          height: 28px;
          color: white;
        }
      }
    }
  }
}

@media (max-width: 768px) {

  #services .service-list {
    gap: 1rem;

    li {
      min-width: 100%;
      max-width: 100%;
      min-height: auto;
    }
  }
}

/* Contact section */
#contact {
  position: relative;
  padding-bottom: 5rem; /* Space for sticky back-to-top button */

  .digital, .physical {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
  }

  .contact-item a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;

  }

  .contact-icon,
  .location-icon,
  .phone-icon {
    width: 28px;
    height: 28px;
    color: var(--color-primary);
    transition: transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1),
    color 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
  }

  .contact-item a:hover .contact-icon,
  .office a:hover .phone-icon,
  .office a:hover .location-icon {
    transform: scale(1.1);
    color: var(--color-accent);
  }

  .location-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 0.5rem;
  }

  .phone-icon {
    width: 24px;
    height: 24px;
  }

  .office a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
  }

  .office {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border: 1px solid var(--color-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    font-family: var(--font-family-primary);

    .address-text {
      font-family: var(--font-family-primary);
    }
  }

  /* Office contact buttons */
  .office-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
  }

  .contact-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background-color: var(--color-background);
    border: 1px solid var(--color-secondary);
    border-radius: 8px;
    color: var(--color-text);
    font-family: var(--font-family-primary);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
    min-height: 44px;
    min-width: 44px;
  }

  .contact-btn:hover,
  .contact-btn:focus-visible {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
    outline: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(250, 127, 0, 0.3);
  }

  .contact-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(250, 127, 0, 0.2);
  }

  .contact-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
  }

  .contact-btn:hover svg,
  .contact-btn:focus-visible svg {
    transform: scale(1.1);
  }

  .btn-icon {
    color: var(--color-accent);
  }

  .contact-btn:hover .btn-icon,
  .contact-btn:focus-visible .btn-icon {
    color: white;
  }
}

/* Blockquote styling */
blockquote {
  font-family: var(--font-family-primary);
  position: relative;
  margin: 2rem 0;
  padding: 1.5rem 2rem;
  border-left: 4px solid var(--color-primary);
  background: var(--color-surface);
  border-radius: 0 8px 8px 0;
  box-shadow: var(--shadow-sm);
  color: var(--color-text);
  font-size: 1.25rem;
  line-height: 1.7;
}

blockquote::before {
  content: '';
  position: absolute;
  top: 1.5rem;
  left: -12px;
  width: 20px;
  height: 20px;
  background: var(--color-primary);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  opacity: 0.8;
}

@media (max-width: 768px) {
  blockquote {
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    font-size: 1.125rem;
  }

  blockquote::before {
    width: 16px;
    height: 16px;
    top: 1rem;
    left: -10px;
  }
}

[data-theme="dark"] blockquote {
  border-left-color: var(--color-accent);
}

[data-theme="dark"] blockquote::before {
  background: var(--color-accent);
}

/* Footer */
footer {
  background-color: var(--color-surface);
  border-top: 1px solid var(--color-secondary);
  box-shadow: var(--shadow-sm);
  color: var(--color-text);
  padding: 1rem;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* Custom scroll effects */
.scroll-effect {
  scroll-behavior: smooth;
  transition: scroll-behavior 0.3s;
}

/* Scroll-triggered animations */
.service-list li,
section p,
section h2,
section h3 {
  transition: transform 0.8s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.service-list li.in-view,
section p.in-view,
section h2.in-view,
section h3.in-view {
  transform: translateY(0);
}
