/* Smooth scrolling and anchor positioning */
html {
  scroll-behavior: smooth;
}

section[id] {
  scroll-margin-top: 20px;
}

section.content-section {
  padding-top: 2rem;
  margin-top: 0;
}

/* About section specific styling */
#about {
  scroll-margin-top: 0;
  padding-top: 3rem;
}

/* Portfolio section specific styling */
#portfolio {
  scroll-margin-top: 0;
}

/* Language Dropdown Styles */
.dropdown {
  position: fixed;
  top: 15px;
  left: 15px;
  width: 44px;
  height: 34px;
  z-index: 1000;
}

.dropbtn {
  padding: 5px;
  cursor: pointer;
  position: relative;
  z-index: 1;
  background: url('https://icons.iconarchive.com/icons/fatcow/farm-fresh/16/flag-usa-icon.png')
    no-repeat left center;
  padding-left: 25px;
  width: 40px;
}

.dropdown-content {
  display: none;
  position: absolute;
  width: 60px;
  z-index: 2;
}

.dropbtn::after {
  background: rgba(0, 0, 0, 0)
    url('https://cdn3.iconfinder.com/data/icons/google-material-design-icons/48/ic_keyboard_arrow_down_48px-16.png')
    no-repeat scroll center center;
  content: '';
  height: 16px;
  position: absolute;
  left: 45px;
  top: 10px;
  width: 16px;
  z-index: 3;
}

.dropdown-content a:first-child {
  background: url('http://icons.iconarchive.com/icons/custom-icon-design/flag-3/16/Russia-Flag-icon.png')
    no-repeat left center;
}

.dropdown-content a:last-child {
  background: url('https://icons.iconarchive.com/icons/fatcow/farm-fresh/16/flag-usa-icon.png')
    no-repeat left center;
}

.dropdown-content a {
  color: black;
  padding: 2px 0 2px 25px;
  text-decoration: none;
  display: block;
}

.dropdown-content a:hover {
  background-color: #0606061c;
}

.dropdown:hover .dropdown-content {
  display: block;
}

@media (max-width: 600px) {
  .dropdown {
    top: 10px;
    left: 10px;
  }
}

/* Mobile and tablet menu toggle optimization */
@media (max-width: 767px) {
  .menu-toggle {
    background: transparent !important;
    color: rgba(0, 0, 0, 0.6) !important;
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
  }

  .menu-toggle:hover {
    background: transparent !important;
    color: rgba(0, 0, 0, 0.8) !important;
  }
}

@media (min-width: 768px) and (max-width: 1199px) {
  .menu-toggle {
    background: transparent !important;
    color: rgba(0, 0, 0, 0.6) !important;
    width: 60px;
    height: 60px;
    font-size: 1.6rem;
  }

  .menu-toggle:hover {
    background: transparent !important;
    color: rgba(0, 0, 0, 0.8) !important;
  }
}

/* Custom CSS Variables */
:root {
  --bs-primary: #1d809f;
  --bs-body-font-family: 'PT Sans', sans-serif;
}

/* Scroll to Top Button */
.scroll-to-top {
  position: fixed;
  right: 15px;
  bottom: 15px;
  display: none;
  width: 50px;
  height: 50px;
  text-align: center;
  color: #fff;
  background: rgba(52, 58, 64, 0.5);
  line-height: 50px;
}

.scroll-to-top:focus,
.scroll-to-top:hover {
  color: #fff;
}

.scroll-to-top:hover {
  background: #343a40;
}

.scroll-to-top i {
  font-weight: 800;
}

/* Sidebar Navigation */
#sidebar-wrapper {
  position: fixed;
  z-index: 2;
  right: 0;
  width: 250px;
  height: 100%;
  transition: all 0.4s ease 0s;
  transform: translateX(250px);
  background: #1d809f;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-nav {
  position: absolute;
  top: 0;
  width: 250px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sidebar-nav li.sidebar-nav-item a {
  display: block;
  text-decoration: none;
  color: #fff;
  padding: 15px;
}

.sidebar-nav li a:hover {
  text-decoration: none;
  color: #fff;
  background: rgba(255, 255, 255, 0.2);
}

.sidebar-nav li a:active,
.sidebar-nav li a:focus {
  text-decoration: none;
}

.sidebar-nav > .sidebar-brand {
  font-size: 1.2rem;
  background: rgba(52, 58, 64, 0.1);
  height: 80px;
  line-height: 50px;
  padding-top: 15px;
  padding-bottom: 15px;
  padding-left: 15px;
}

.sidebar-nav > .sidebar-brand a {
  color: #fff;
  text-decoration: none;
}

.sidebar-nav > .sidebar-brand a:hover {
  color: #fff;
  background: none;
}

#sidebar-wrapper.active {
  right: 250px;
  width: 250px;
  transition: all 0.4s ease 0s;
}

/* Menu Toggle Button */
.menu-toggle {
  position: fixed;
  right: 15px;
  top: 15px;
  width: 50px;
  height: 50px;
  text-align: center;
  color: #fff;
  background: rgba(52, 58, 64, 0.5);
  line-height: 50px;
  z-index: 999;
}

.menu-toggle:focus,
.menu-toggle:hover {
  color: #fff;
}

.menu-toggle:hover {
  background: #343a40;
}

/* Mobile and tablet menu toggle optimization */
@media (max-width: 767px) {
  .menu-toggle {
    background: transparent !important;
    color: rgba(0, 0, 0, 0.6) !important;
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
  }

  .menu-toggle:hover {
    background: transparent !important;
    color: rgba(0, 0, 0, 0.8) !important;
  }
}

@media (min-width: 768px) and (max-width: 1199px) {
  .menu-toggle {
    background: transparent !important;
    color: rgba(0, 0, 0, 0.6) !important;
    width: 60px;
    height: 60px;
    font-size: 1.6rem;
  }

  .menu-toggle:hover {
    background: transparent !important;
    color: rgba(0, 0, 0, 0.8) !important;
  }
}

/* Button Styles */
.btn-xl {
  padding: 1.25rem 2.5rem;
}

/* Callout Section */
.callout {
  padding: 3rem 0 8rem 0;
  background: linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.1) 0%,
      rgba(255, 255, 255, 0.1) 100%
    ),
    url('../background/bg-callout4.2.png');
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
}

.callout h3.serv {
  font-weight: bold;
  margin-bottom: 20px;
  padding-top: 20px;
  color: inherit;
  font-size: 32px;
}

/* Portfolio section heading */
h3.port {
  font-weight: bold;
  margin-bottom: 20px;
  padding-top: 20px;
  color: inherit;
  font-size: 32px;
}

@media (max-width: 767px) {
  h3.port {
    margin-bottom: 15px;
    padding-top: 15px;
    font-size: 24px;
  }
}

/* Section headings - unified style */
#about h2 {
  font-weight: bold;
  font-size: 32px;
}

@media (max-width: 767px) {
  #about h2 {
    font-size: 24px;
  }
}

/* Footer */
footer.footer {
  padding-top: 5rem;
  padding-bottom: 5rem;
}

footer.footer .social-link {
  display: block;
  text-decoration: none;
  height: 4rem;
  width: 4rem;
  line-height: 4.3rem;
  font-size: 1.5rem;
  background-color: #1d809f;
  transition: background-color 0.15s ease-in-out;
  box-shadow: 0 3px 3px 0 rgba(0, 0, 0, 0.1);
}

footer.footer .social-link:hover {
  background-color: #155d74;
  text-decoration: none;
}

/* Masthead */
.masthead {
  min-height: 100vh;
  position: relative;
  display: table;
  width: 100%;
  height: auto;
  padding-top: 8rem;
  padding-bottom: 8rem;
  background: linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.1) 0%,
      rgba(255, 255, 255, 0.1) 100%
    ),
    url('../background/bg-masthead4.jpg');
  background-position: top center;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
}

.masthead h1,
.masthead .h1 {
  font-size: 4rem;
  margin: 0;
  padding: 0;
}

@media (min-width: 992px) {
  .masthead {
    height: 100vh;
  }
  .masthead h1,
  .masthead .h1 {
    font-size: 5.5rem;
  }
}

/* Portfolio Items */
.portfolio-item {
  display: block;
  position: relative;
  overflow: hidden;
  max-width: 530px;
  margin: auto auto rem;
}

.portfolio-item .caption {
  display: flex;
  height: 100%;
  width: 100%;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0.4) 50%,
    rgba(0, 0, 0, 0.6) 100%
  );
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 1;
}

.portfolio-item .caption .caption-content {
  color: #fff;
  margin: auto 2rem 2rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.portfolio-item .caption .caption-content h2,
.portfolio-item .caption .caption-content .h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  font-weight: 600;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}

.portfolio-item .caption .caption-content p {
  font-weight: 400;
  font-size: 1.2rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

@media (min-width: 992px) {
  .portfolio-item {
    max-width: none;
    margin: 0;
  }
  .portfolio-item .caption {
    transition: background 0.7s, -webkit-clip-path 0.25s ease-out;
    transition: clip-path 0.25s ease-out, background 0.7s;
    transition: clip-path 0.25s ease-out, background 0.7s,
      -webkit-clip-path 0.25s ease-out;
    -webkit-clip-path: inset(0px);
    clip-path: inset(0px);
  }
  .portfolio-item .caption .caption-content {
    transition: opacity 0.25s;
    margin-left: 5rem;
    margin-right: 5rem;
    margin-bottom: 5rem;
  }
  .portfolio-item img {
    transition: -webkit-clip-path 0.25s ease-out;
    transition: clip-path 0.25s ease-out;
    transition: clip-path 0.25s ease-out, -webkit-clip-path 0.25s ease-out;
    -webkit-clip-path: inset(-1px);
    clip-path: inset(-1px);
  }
  .portfolio-item:hover img {
    -webkit-clip-path: inset(2rem);
    clip-path: inset(2rem);
  }
  .portfolio-item:hover .caption {
    background: rgba(29, 128, 159, 0.95);
    -webkit-clip-path: inset(2rem);
    clip-path: inset(2rem);
  }
}

/* Mobile styles for better readability */
@media (max-width: 991px) {
  .portfolio-item .caption .caption-content {
    margin: auto 1.5rem 1.5rem;
  }

  .portfolio-item .caption .caption-content h2,
  .portfolio-item .caption .caption-content .h2 {
    font-size: 0.7rem;
  }

  .portfolio-item .caption .caption-content p {
    font-size: 1rem;
  }
}

/* Service Icons */
.service-icon {
  background-color: #fff;
  color: #1d809f;
  height: 7rem;
  width: 7rem;
  display: block;
  line-height: 7.5rem;
  font-size: 2.25rem;
  box-shadow: 0 3px 3px 0 rgba(0, 0, 0, 0.1);
}

/* Services Section */
.content-section {
  padding: 5rem 0;
}

.content-section.bg-primary {
  background-color: #1d809f !important;
}

/* Text Faded */
.text-faded {
  color: rgba(255, 255, 255, 0.7);
}

/* Testimonials */
.testimonials-clean {
  color: #212529;
  background-color: #1d809f;
  padding: 2rem 0;
}

.testimonials-clean p {
  color: #7d8285;
}

.testimonials-clean p1 {
  color: #ecb807;
  text-align: center;
}

.testimonials-clean h2 {
  font-weight: bold;
  margin-bottom: 15px;
  padding-top: 10px;
  color: inherit;
  font-size: 32px;
}

@media (max-width: 767px) {
  .testimonials-clean h2 {
    margin-bottom: 15px;
    padding-top: 10px;
    font-size: 24px;
  }
}

.testimonials-clean .intro {
  font-size: 16px;
  max-width: 500px;
  margin: 0 auto;
}

.testimonials-clean .intro p {
  margin-bottom: 0;
}

.testimonials-clean .people {
  padding: 20px 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.testimonials-clean .row.people {
  justify-content: center;
}

.testimonials-clean .item {
  margin-bottom: 32px;
}

@media (min-width: 768px) {
  .testimonials-clean .item {
    height: 220px;
  }
}

.testimonials-clean .item .box {
  padding: 30px;
  background-color: #fff;
  position: relative;
  border-radius: 12px;
}

.testimonials-clean .item .box:after {
  content: '';
  position: absolute;
  left: 30px;
  bottom: -24px;
  width: 0;
  height: 0;
  border: 15px solid transparent;
  border-width: 12px 15px;
  border-top-color: #fff;
}

.testimonials-clean .item .author {
  margin-top: 30px;
  padding-left: 25px;
}

.testimonials-clean .item .name {
  font-weight: bold;
  margin-bottom: 2px;
  color: inherit;
  font-size: 24px;
}

.testimonials-clean .item .title {
  font-size: 16px;
  color: #9da9ae;
}

.testimonials-clean .item .description {
  font-size: 16px;
  margin-bottom: 0;
}

.testimonials-clean .item img {
  max-width: 130px;
  float: left;
  margin-right: 12px;
  margin-top: -5px;
}

/* Articles Cards */
article {
  --img-scale: 1.001;
  --title-color: black;
  --link-icon-translate: -20px;
  --link-icon-opacity: 0;
  position: relative;
  border-radius: 16px;
  box-shadow: none;
  background: #fff;
  transform-origin: center;
  transition: all 0.4s ease-in-out;
  overflow: hidden;
}

article a::after {
  position: absolute;
  inset-block: 0;
  inset-inline: 0;
  cursor: pointer;
  content: '';
}

article h2 {
  margin: 0 0 18px 0;
  font-family: 'PT Sans Narrow', sans-serif;
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--title-color);
  transition: color 0.3s ease-out;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

figure {
  margin: 0;
  padding: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

article img {
  max-width: 100%;
  transform-origin: center;
  transform: scale(var(--img-scale));
  transition: transform 0.4s ease-in-out;
}

.article-body {
  padding: 24px;
}

article a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: #28666e;
}

article a:focus {
  outline: 1px dotted #28666e;
}

article a .icon {
  min-width: 24px;
  width: 24px;
  height: 24px;
  margin-left: 5px;
  transform: translateX(var(--link-icon-translate));
  opacity: var(--link-icon-opacity);
  transition: all 0.3s;
}

article:has(:hover, :focus) {
  --img-scale: 1.1;
  --title-color: #28666e;
  --link-icon-translate: 0;
  --link-icon-opacity: 1;
  box-shadow: rgba(0, 0, 0, 0.16) 0px 10px 36px 0px,
    rgba(0, 0, 0, 0.06) 0px 0px 0px 1px;
}

/* Articles Grid */
.articles {
  display: grid;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: 24px;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

@media screen and (max-width: 960px) {
  article {
    container: card/inline-size;
  }
  .article-body p {
    display: none;
  }
  article h2 {
    font-size: 1.5rem;
  }
}

@container card (min-width: 380px) {
  .article-wrapper {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 16px;
  }
  .article-body {
    padding-left: 0;
  }
  figure {
    width: 100%;
    height: 100%;
    overflow: hidden;
  }
  figure img {
    height: 100%;
    aspect-ratio: 1;
    object-fit: cover;
  }
}

/* Screen Reader Only */
.sr-only:not(:focus):not(:active) {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

/* Mobile and tablet dropdown optimization */
@media (max-width: 767px) {
  /* Hide dropdown content on mobile, show only simple button */
  .dropdown-content {
    display: none !important;
  }

  .dropdown:hover .dropdown-content {
    display: none !important;
  }

  .dropdown {
    position: absolute;
    top: 20px;
    left: 15px;
    z-index: 999;
    width: 44px;
    height: 34px;
  }

  /* Make dropdown button simpler on mobile - flag icon */
  .dropbtn {
    padding: 0;
    width: 44px;
    height: 34px;
    border: 2px solid rgba(29, 128, 159, 0.5);
    border-radius: 6px;
    background: url('https://icons.iconarchive.com/icons/fatcow/farm-fresh/16/flag-usa-icon.png')
      no-repeat center;
    background-size: cover;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: none;
    text-indent: -9999px;
    overflow: hidden;
  }

  .dropbtn:hover {
    transform: none;
    box-shadow: none;
    border-color: rgba(29, 128, 159, 0.8);
  }

  .dropbtn::after {
    display: none;
  }
}

@media (min-width: 768px) and (max-width: 1199px) {
  /* Hide dropdown content on tablets, show only simple button */
  .dropdown-content {
    display: none !important;
  }

  .dropdown:hover .dropdown-content {
    display: none !important;
  }

  .dropdown {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 999;
    width: 44px;
    height: 34px;
  }

  /* Make dropdown button simpler on tablets - flag icon */
  .dropbtn {
    padding: 0;
    width: 44px;
    height: 34px;
    border: 2px solid rgba(29, 128, 159, 0.5);
    border-radius: 6px;
    background: url('https://icons.iconarchive.com/icons/fatcow/farm-fresh/16/flag-usa-icon.png')
      no-repeat center;
    background-size: cover;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: none;
    text-indent: -9999px;
    overflow: hidden;
  }

  .dropbtn:hover {
    transform: none;
    box-shadow: none;
    border-color: rgba(29, 128, 159, 0.8);
  }

  .dropbtn::after {
    display: none;
  }
}

/* Desktop dropdown should remain as-is */
@media (min-width: 1200px) {
  .dropdown {
    position: fixed;
    top: 15px;
    left: 15px;
    width: 44px;
    height: 34px;
    z-index: 1000;
  }

  .dropbtn {
    padding: 5px;
    cursor: pointer;
    position: relative;
    z-index: 1;
    background: url('https://icons.iconarchive.com/icons/fatcow/farm-fresh/16/flag-usa-icon.png')
      no-repeat left center;
    padding-left: 25px;
    width: 40px;
  }

  .dropbtn::after {
    background: rgba(0, 0, 0, 0)
      url('https://cdn3.iconfinder.com/data/icons/google-material-design-icons/48/ic_keyboard_arrow_down_48px-16.png')
      no-repeat scroll center center;
    content: '';
    height: 16px;
    position: absolute;
    left: 45px;
    top: 10px;
    width: 16px;
    z-index: 3;
    display: block;
  }
}

/* Menu toggle button for mobile and tablet */
@media (max-width: 767px) {
  .menu-toggle {
    background: transparent !important;
    color: rgba(0, 0, 0, 0.6) !important;
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    line-height: 60px;
  }

  .menu-toggle:hover {
    background: transparent !important;
    color: rgba(0, 0, 0, 0.8) !important;
  }

  /* Fix image overflow in About section */
  #about img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    margin: 0 auto;
  }
}

@media (min-width: 768px) and (max-width: 1199px) {
  .menu-toggle {
    background: transparent !important;
    color: rgba(0, 0, 0, 0.6) !important;
    width: 60px;
    height: 60px;
    font-size: 1.6rem;
    line-height: 60px;
  }

  .menu-toggle:hover {
    background: transparent !important;
    color: rgba(0, 0, 0, 0.8) !important;
  }

  /* Fix image overflow in About section */
  #about img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    margin: 0 auto;
  }
}

/* Diplomas section card styling */
#diplomas .col-lg-10 {
  background: rgba(15, 109, 124, 0.03) !important;
  border-radius: 20px;
  padding: 36px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

#diplomas {
  padding-top: 48px !important;
  padding-bottom: 48px !important;
}

@media (max-width: 767px) {
  #diplomas .col-lg-10 {
    padding: 22px !important;
    border-radius: 16px;
  }

  #diplomas {
    padding-top: 40px !important;
    padding-bottom: 40px !important;
  }

  /* Education page header - add more space on mobile */
  #page-top header.content-section {
    padding-top: 5rem !important;
  }
}
