/* ubertex/public/assets/css/header.css */

/* 0. Font Rubik, modern & friendly */
header,
.nav-links,
.dropdown-menu {
  font-family: 'Rubik', sans-serif;
  font-weight: 500;
}

/* Util: visually hidden (jika diperlukan di tempat lain) */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* 1. Header dasar & sticky */
header {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: saturate(180%) blur(10px);
  transition: background .3s, padding .3s, box-shadow .3s;
  z-index: 1000;
  padding: 10px 0;
}
header.scrolled {
  padding: 5px 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* 2. Container flex */
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
}

/* 3. Logo */
.logo img {
  max-height: 45px; width: auto;
}

/* 4. Nav links */
nav { position: relative; }
.nav-links {
  list-style: none;
  display: flex; align-items: center;
  margin: 0; padding: 0;
}
.nav-links li {
  margin: 0 15px; position: relative;
}
.nav-links li a {
  display: block; padding: 8px 5px;
  font-size: .95rem; color: var(--dark);
  text-decoration: none;
  transition: color .2s ease;
}
/* underline animasi default */
.nav-links li a::after {
  content: '';
  position: absolute; left: 0; bottom: -2px;
  width: 0; height: 2px;
  background: var(--primary);
  transition: width .3s ease;
}
.nav-links li a:hover {
  color: var(--primary);
}
.nav-links li a:hover::after {
  width: 100%;
}

/* 5. Dropdown desktop */
.dropdown .dropdown-icon {
  margin-left: 6px;
  fill: none; stroke: currentColor;
  transition: transform .3s ease;
}
.dropdown:hover .dropdown-icon {
  transform: rotate(180deg);
}
.dropdown-menu {
  list-style: none; margin: 0; padding: 8px 0;
  position: absolute; top: 100%; left: 0;
  background: #fff; box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  opacity: 0; visibility: hidden; transition: opacity .2s ease;
  min-width: 160px; border-radius: 6px; z-index: 10;
}
.dropdown:hover .dropdown-menu {
  opacity: 1; visibility: visible;
}
.dropdown-menu li { margin: 0; }
.dropdown-menu li a {
  display: block; padding: 10px 20px;
  font-size: .9rem; color: var(--dark);
  text-decoration: none; transition: color .2s ease;
}
/* underline sub-nav */
.dropdown-menu li a::after {
  content: '';
  position: absolute; left: 20px; bottom: 4px;
  width: 0; height: 2px;
  background: var(--primary);
  transition: width .3s ease;
}
.dropdown-menu li a:hover {
  color: var(--primary);
}
.dropdown-menu li a:hover::after {
  width: calc(100% - 40px);
}

/* 6. Contact button styling */
.nav-links li.contact-btn a {
  display: inline-block;
  padding: 0.5em 1.25em;
  background-color: #000;  /* hitam solid */
  color: #fff;             /* teks putih */
  border: none;
  border-radius: 2rem;
  text-decoration: none;
  font-weight: 500;
}
.nav-links li.contact-btn a::after {
  display: none;           /* hilangkan underline effect */
}
.nav-links li.contact-btn a:hover {
  background-color: #000;  /* tetap hitam */
  color: #fff;             /* tetap putih */
}

/* 7. Hamburger (A11Y) */
.hamburger {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;

  display: none;           /* tampilkan hanya di mobile */
  flex-direction: column;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  z-index: 1100;

  /* A11Y: min tap size */
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;

  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  outline-offset: 3px;
}
.hamburger:focus-visible {
  outline: 3px solid var(--accent, #E6A57E);
}
.hamburger .bar {
  width: 25px; height: 3px; background: var(--dark);
  border-radius: 2px; transition: transform .3s, opacity .3s, background .3s;
}
.hamburger .bar + .bar { margin-top: 4px; }

/* transform jadi "X" saat aria-expanded=true */
.hamburger[aria-expanded="true"] .bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.hamburger[aria-expanded="true"] .bar:nth-child(2) {
  opacity: 0;
}
.hamburger[aria-expanded="true"] .bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* 8. Mobile responsive */
@media (max-width: 768px) {
  .hamburger { display: inline-flex; }

  .nav-links {
    position: fixed; top:0; right:0; bottom:0;
    width:240px; height:100vh; padding-top:100px;
    display:flex; flex-direction:column; background:#fff;
    transform:translateX(100%); transition:transform .3s ease;
    z-index:1050; align-items:flex-start;
    /* Ketika tertutup, tetap tak fokus/dibaca (dibantu JS inert/aria-hidden) */
  }
  .nav-links.open { transform:translateX(0); }

  .nav-links li { margin:15px 20px; width:100%; }
  .nav-links li a {
    width:100%; text-align:left; padding-left:0; color:var(--dark);
  }
  .nav-links li.contact-btn a {
    margin-top: 1rem;
    width: auto;
    background-color: #000; /* tetap hitam */
    color: #fff;            /* tetap putih */
  }

  .dropdown .dropdown-menu {
    position: static; opacity:1; visibility:visible;
    box-shadow:none; padding-left:15px; display:none; width:100%;
  }
  .dropdown .dropdown-menu.open { display:block; }
}

/* 9. Desktop-only transparent → solid on scroll */
@media (min-width: 769px) {
  /* awal transparan */
  header { background: transparent; backdrop-filter: none; }
  header .nav-links > li > a { color: #fff; }
  header .dropdown-menu li a { color: var(--dark); }

  /* saat scroll: solid header */
  header.scrolled {
    background: rgba(255,255,255,0.95);
    backdrop-filter: saturate(180%) blur(10px);
  }
  /* teks menu biasa jadi gelap */
  header.scrolled .nav-links li a {
    color: var(--dark);
  }
  /* tapi contact button tetap putih teks & hitam bg */
  header.scrolled .nav-links li.contact-btn a {
    background-color: #000 !important;
    color: #fff !important;
  }
}

/* ==================================================
   Override: always-solid header (hanya di detail page)
   ================================================== */
header.always-solid {
  /* pakai styling scrolled, tanpa perlu scroll */
  background: rgba(255,255,255,0.95) !important;
  backdrop-filter: saturate(180%) blur(10px) !important;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  padding: 5px 0; /* kalau mau lebih compact seperti .scrolled */
}
header.always-solid .nav-links li a {
  color: var(--dark) !important;
}
header.always-solid .dropdown-menu li a {
  color: var(--dark) !important;
}
header.always-solid .nav-links li.contact-btn a {
  background-color: #000 !important;
  color: #fff     !important;
}
