html,
body {
  overflow-x: hidden;
}

input,
textarea,
button,
select,
a {
  -webkit-tap-highlight-color: transparent;
}

.header {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  padding: 15px 0;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  transition: all 0.3s ease;
  position: fixed;
}

.header.hide {
  transform: translateY(-100%);
}

.header-container {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 20px;
}

.header.scrolled {
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.logo {
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.logo:hover {
  transform: translateY(-2px);
}

.logo img {
  max-width: 200px;
  height: auto;
  display: block;
}

.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 30px;
  height: 30px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
}

.hamburger-line {
  width: 100%;
  height: 3px;
  background-color: var(--color-meta);
  border-radius: 2px;
  transition: all 0.3s ease;
  transform-origin: center;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(7px, 7px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
  justify-content: space-evenly;
}

.search-container {
  position: relative;
  flex: 1;
  max-width: 550px;
  margin: 0 20px;
}

.search-bar {
  width: 100%;
  padding: 12px 50px 12px 20px;
  border: 2px solid transparent;
  border-radius: 25px;
  background-color: transparent;
  background-image: linear-gradient(white, white), linear-gradient(135deg, var(--color-yellow-2), var(--color-yellow-3));
  background-origin: border-box;
  background-clip: padding-box, border-box;
  color: var(--color-meta);
  font-size: 16px;
  font-family: "Montserrat", sans-serif;
  box-shadow: 0 4px 15px var(--accent-2-03);
  transition: all 0.3s ease;
}

.search-bar::placeholder {
  color: var(--color-meta);
}

.search-bar:focus {
  outline: none;
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(251, 191, 36, 0.4);
}

.search-btn {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--color-meta);
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

@media (hover: hover) {
  .search-btn:hover {
    transform: translateY(-50%) scale(1.1);
    color: var(--color-teal-strong);
  }

  .search-btn:active {
    transform: translateY(-50%) scale(0.95);
    color: var(--color-teal-strong);
    transition: all 0.1s ease;
  }
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 30px;
  flex-wrap: nowrap;
}

.nav-link {
  text-decoration: none;
  color: var(--color-meta);
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
  white-space: nowrap;
}

@media (hover: hover) {
  .nav-link:hover {
    color: var(--color-teal-strong);
    transform: translateY(-1px);
  }

  .nav-link:hover::after {
    width: 100%;
  }
}

.nav-link:active {
  color: #11998e;
  transform: translateY(0);
  transition: all 0.1s ease;
}

.nav-link::after {
  content: "";
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -5px;
  left: 50%;
  background: var(--color-teal-strong);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.social-links {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 45px;
  height: 45px;
  color: var(--color-meta);
  border-radius: 50%;
  border: 0px solid transparent;
  background-color: transparent;
  transition: all 0.3s ease;
  text-decoration: none;
  font-size: 20px;
}

@media (hover: hover) {
  .social-link:hover {
    color: white;
    border-color: transparent;
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  }

  .social-link.facebook:hover {
    background-color: var(--color-teal-strong);
  }

  .social-link.instagram:hover {
    background: var(--color-teal-strong);
  }
}

.social-link:active {
  color: #11998e;
  transform: translateY(0);
  transition: all 0.1s ease;
}

.theme-toggle {
  display: flex;
  align-items: center;
}

.theme-btn {
  background: none;
  border: none;
  color: inherit;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: background-color 0.3s ease;
  color: var(--color-meta);
}

.theme-btn:active {
  transform: translateY(3px);
  transition: all 0.1s ease;
}

@media (hover: hover) {
  .theme-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
  }
}

body.dark-theme .header {
  background: linear-gradient(135deg, var(--color-bg-dark-start), var(--color-bg-dark-mid));
  border-bottom: 1px solid rgba(167, 201, 87, 0.3);
}

body.dark-theme .header.scrolled {
  background: rgba(28, 31, 36, 0.98);
}

body.dark-theme .search-bar {
  /* use darker inner fill but keep a subtle yellow border gradient */
  color: var(--color-surface);
  background-color: var(--color-bg-dark-mid);
  /* two-layer background: first is inner fill, second is border gradient */
  background-image: linear-gradient(var(--color-bg-dark-mid), var(--color-bg-dark-mid)),
                    linear-gradient(135deg, var(--color-yellow-2), var(--color-yellow-3));
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
  border: 1px solid transparent;
}

/* focused state: stronger yellow border and glow */
body.dark-theme .search-bar:focus,
body.dark-theme .search-bar:focus-visible {
  outline: none;
  border-color: var(--color-yellow-2);
  box-shadow: 0 6px 30px rgba(251, 191, 36, 0.28), 0 0 0 3px rgba(251,191,36,0.08);
}

/* placeholder color in dark theme */
body.dark-theme .search-bar::placeholder {
  color: var(--color-muted-2);
  opacity: 1; /* ensure visibility across browsers */
}

/* default search icon color in dark theme */
body.dark-theme .search-btn {
  color: var(--color-muted-2);
}

@media (hover: hover) {
  body.dark-theme .search-btn:hover {
    color: var(--color-teal-strong-2);
  }
}

body.dark-theme .nav-link,
body.dark-theme .social-link,
body.dark-theme .theme-btn {
  color: var(--color-surface);
}

@media (hover: hover) {
  body.dark-theme .nav-link:hover {
    color: #2decdc;
  }
}

body.dark-theme .nav-link:active {
  color: #2decdc;
}

@media (hover: hover) {
  body.dark-theme .social-link:hover {
    color: white;
  }

  body.dark-theme .theme-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
  }
}

body.dark-theme .social-link:active {
  color: #2decdc;
}

body.dark-theme .hamburger-line {
  background-color: var(--color-surface);
}

@media (max-width: 1024px) {
  .logo:hover {
    transform: none;
  }

  .header-container {
    padding: 0 15px;
  }

  .search-btn:active {
    transition: color 0.1s ease;
    color: #11998e;
  }

  .search-container {
    max-width: 400px;
    margin: 0 15px;
  }

  .nav-links {
    gap: 20px;
  }

  .social-link {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

}

@media (max-width: 768px) {
  .header {
    padding: 10px 0;
  }

  .header-container {
    padding: 0 15px;
  }

  .logo img {
    max-width: 120px;
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .header-right {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: 30px;
    padding: 80px 20px 20px;
    transition: right 0.3s ease;
    overflow-y: auto;
  }

  .header-right.mobile-open {
    right: 0;
  }

  .search-container {
    width: 100%;
    max-width: none;
    margin: 0;
    order: 1;
    flex: 0;
  }

  .nav-links {
    flex-direction: column;
    gap: 25px;
    order: 2;
    width: 100%;
    text-align: center;
  }

  .nav-link {
    font-size: 18px;
    padding: 10px 0;
    display: block;
  }

  .social-links {
    order: 3;
    gap: 15px;
    margin-top: 20px;
  }

  .social-link {
    width: 50px;
    height: 50px;
    font-size: 22px;
  }

  body.dark-theme .header-right {
    background: rgba(28, 31, 36, 0.98);
  }

  body.dark-theme .theme-btn:active {
    transition: color 0.1s ease;
    color: #2decdc;
  }

  .theme-btn:active {
    transition: color 0.1s ease;
    color: #2decdc;
  }
}

@media (max-width: 480px) {
  .header-container {
    padding: 0 10px;
  }

  .logo img {
    max-width: 100px;
  }

  .search-bar {
    font-size: 14px;
    padding: 10px 45px 10px 15px;
  }

  .search-btn {
    right: 12px;
    font-size: 16px;
  }

  .nav-link {
    font-size: 16px;
  }

  .social-link {
    width: 45px;
    height: 45px;
    font-size: 20px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .header-right {
    padding: 60px 20px 20px;
    gap: 20px;
  }

  .nav-links {
    gap: 15px;
  }

  .nav-link {
    font-size: 16px;
    padding: 8px 0;
  }
}

@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
  .logo img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

@media (prefers-reduced-motion: reduce) {

  .header,
  .logo,
  .search-bar,
  .search-btn,
  .nav-link,
  .social-link,
  .theme-btn,
  .mobile-menu-toggle,
  .hamburger-line,
  .header-right {
    transition: none;
  }

  #theme-icon.active-animation {
    animation: none;
  }
}

.logo a:focus-visible,
.search-btn:focus-visible,
.nav-link:focus-visible,
.social-link:focus-visible,
.theme-btn:focus-visible,
.mobile-menu-toggle:focus-visible {
  outline: 2px solid var(--color-accent-2);
  outline-offset: 5px;
  border-radius: 4px;
}

@media print {
  .header {
    position: static;
    background: white;
    box-shadow: none;
    padding: 10px 0;
  }

  .mobile-menu-toggle,
  .social-links {
    display: none;
  }
}