.head1
{
    margin: 0;
    align-items: center;
    display: flex;
    gap: 15px;
    background: linear-gradient(180deg, #ffffff 0%, #f8f8f8 100%);
    padding: 2px 0;
    z-index: 1000;
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15), 0 2px 6px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.08);
    height: 120px;
    justify-content: space-between;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    width: 100%;
    box-sizing: border-box;
}
.head1 * { line-height: 1; }
main, .page-content, #content {
  padding-top: 0px; /* set to your header's height */
}

#logo
{
    display: block;    
    width: 400px !important;     
    height: 400px !important;
    cursor: pointer;
    margin-left: 8px;
    object-fit: contain;
    flex-shrink: 0;
    max-width: 200px;
    max-height: 1505px;
    min-width: 120px;
    min-height: 60px;
}
button
{
  border: none;
  background: transparent;
  display: inline-block;
  padding: 0;
}
.navbar
{
    position: relative;
}
.navbar > ul,
#primary-menu
{
    list-style-type: none;
    font-size: 17px;
    gap: 40px;
    text-align: right;
    overflow: visible;
    display: flex;
    justify-content: flex-end;
    padding: 0;
    margin: 0;
    padding-right: 12px;
    flex-wrap: nowrap;
    align-items: center;
    margin-left: auto;
}
.navbar a
{
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
    color: black;
    border-bottom: 1px solid transparent;
    padding: 3px 6px;
    font-family: 'Calibri', sans-serif;
    transition: all 0.3s ease;
    font-size: 19px;
}
.navbar a:hover
{
    border-bottom-color: brown;
    color: brown;   
}

.navbar a.current-page
{
    border-bottom-color: brown;
    color: brown;
}
#primary-menu > li {
  white-space: nowrap;    
  align-items: center;
}


@media (max-width: 768px){
  .head1{
    height: auto;
    padding: 6px 0;
    gap: 8px;
    flex-wrap: wrap;
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
  }
  #logo{
    width: 140px !important;
    height: auto !important;
    max-width: 140px;
    min-width: 80px !important;
    min-height: 0 !important;
  }
  .navbar{ position: relative; }
  #primary-menu{
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    height: 100dvh;
    min-height: -webkit-fill-available;
    width: min(72vw, 300px);
    background: #ffffff;
    box-shadow: -6px 0 20px rgba(0,0,0,.15);
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 0;
    z-index: 5001;
    transform: translateX(100%);
    transition: transform .28s ease;
    overflow-y: auto;
    pointer-events: auto;
    touch-action: manipulation;
  }
  .mobile-menu{ list-style: none; margin: 0; padding: 0; }
  .mobile-menu li{ margin: 0; padding: 0; }
  .mobile-menu a{ 
    display: block; 
    padding: 16px 18px; 
    text-decoration: none; 
    color: #000; 
    border-bottom: 1px solid #e0e0e0;
    text-align: left;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
    z-index: 5002;
    touch-action: manipulation;
  }
  .mobile-menu a.current-page{ 
    color: #b33a32; 
    font-weight: 600; 
  }
  .menu-close-btn{
    margin-top: 120px;
    text-align: center;
    padding-top: 60px;
  }
  .close-menu{
    background: #fff;
    border: 2px solid #e0e0e0;
    font-size: 24px;
    color: #666;
    padding: 0;
    cursor: pointer;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  }
  .close-menu:hover{
    color: #b33a32;
    border-color: #b33a32;
    transform: scale(1.1);
  }
  html.nav-open #primary-menu{ transform: translateX(0%); }
  .menu-backdrop{
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity .28s ease, visibility .28s ease;
    z-index: 4000;
    pointer-events: none;
    /* Don't cover the menu area - only left side */
    clip-path: polygon(0 0, calc(100% - min(72vw, 300px)) 0, calc(100% - min(72vw, 300px)) 100%, 0 100%);
  }
  html.nav-open .menu-backdrop{
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
  }
  .head1{ position: relative; }
  #primary-menu > li {
    white-space: normal;
    width: 100%;
  }
  .navbar a{
    font-size: 16px;
    padding: 6px 4px;
  }
}

@media (max-width: 480px){
  #primary-menu{ gap: 10px; }
  .navbar a{ font-size: 15px; }
}

/* hamburger button */
.menu-toggle{
  display: none;
  width: 48px;
  height: 42px;
  margin-right: 10px;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(0,0,0,.12);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: box-shadow .2s ease, transform .2s ease;
  font-size: 28px;
  color: #222;
  font-weight: 900;
  font-family: Arial, sans-serif;
}
@media (max-width: 900px){
  .menu-toggle{ display: inline-flex; margin-left: auto; }
}

/* focus styles */
.menu-toggle:focus-visible,
.navbar a:focus-visible{
  outline: 3px solid #b33a32;
  outline-offset: 2px;
}

/* menu toggle when open */
.head1.open .menu-toggle{ 
  color: #b33a32; 
  border-color: #b33a32; 
}

/* sticky header shadow when scrolled */
.head1.scrolled{ box-shadow: 0 6px 20px rgba(0,0,0,0.2), 0 3px 10px rgba(0,0,0,0.15), 0 1px 4px rgba(0,0,0,0.1); }


/* =====================================================================
   TRAINING VERTICAL FLYOUT DROPDOWN (dosh.gov.my style)
   Level 1: categories drop down below "Training"
   Level 2: sub-items fly out to the right on hover
   ===================================================================== */

.has-dd { position: relative; }

.has-dd .nav-trigger {
  font-family: 'Calibri', sans-serif;
  font-size: 19px;
  font-weight: bold;
  color: #000;
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  cursor: pointer;
  padding: 3px 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
  transition: all 0.3s ease;
}
.has-dd .nav-trigger:hover,
.has-dd:hover .nav-trigger,
.has-dd.is-open .nav-trigger,
.has-dd .nav-trigger.current-page {
  color: brown;
  border-bottom-color: brown;
}
.has-dd .nav-chevron {
  width: 11px;
  height: 7px;
  transition: transform .25s ease;
}
.has-dd.is-open .nav-chevron,
.has-dd:hover .nav-chevron { transform: rotate(180deg); }

/* Shared menu panel styling — always vertical stack */
.dd-menu {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  background: #ececec;
  border: 1px solid #c8c8c8;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  min-width: 240px;
  display: block;
  flex-direction: column;
}
.dd-menu > li {
  margin: 0;
  padding: 0;
  position: relative;
  display: block;
  width: 100%;
  white-space: normal;
}

/* Level 1 — vertical list drops below Training */
.dd-level-1 {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  width: max-content;
  min-width: 180px;
  max-width: 180px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
  z-index: 5000;
  pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
  .has-dd:hover > .dd-level-1,
  .has-dd:focus-within > .dd-level-1 {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
  }
}
.has-dd.is-open > .dd-level-1 {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

/* Category row (level 1 item with submenu) */
.dd-parent {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: 'Calibri', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #111;
  text-align: left;
  line-height: 1.3;
  white-space: normal;
  transition: background .12s ease;
}
.dd-parent-label {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  flex: 1 1 auto;
}
.dd-parent-arrow {
  flex: 0 0 auto;
  font-size: 20px;
  line-height: 1;
  color: #333;
  font-weight: 400;
}

/* Active / hover underline on category (like DOSH "Peraturan") */
.dd-has-sub:hover > .dd-parent .dd-parent-label,
.dd-has-sub.is-active > .dd-parent .dd-parent-label {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.dd-has-sub:hover > .dd-parent,
.dd-has-sub.is-active > .dd-parent {
  background: #f5f5f5;
}

.dd-soon {
  display: inline-block;
  font-style: normal;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
  color: #92400e;
  background: #fff3d6;
  border: 1px solid #f5c97a;
  padding: 2px 5px;
  border-radius: 3px;
  vertical-align: middle;
  line-height: 1;
  text-decoration: none !important;
}

/* Level 2 & 3 — fly out to the right (vertical list inside) */
.dd-level-2,
.dd-level-3 {
  position: absolute;
  left: 100%;
  top: 0;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-4px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s ease;
  z-index: 5001;
  pointer-events: none;
}
.dd-level-2 {
  width: 200px;
  min-width: 200px;
  max-width: 200px;
}
.dd-level-3 {
  width: 250px;
  min-width: 250px;
  max-width: 250px;
  z-index: 5002;
}
@media (hover: hover) and (pointer: fine) {
  .dd-has-sub:hover > .dd-level-2,
  .dd-has-sub:hover > .dd-level-3 {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    pointer-events: auto;
  }
}
.dd-has-sub.is-active > .dd-level-2,
.dd-has-sub.is-active > .dd-level-3 {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
}

/* Level 2 & 3 links — bold, full course names */
.dd-level-2 a,
.dd-level-3 a {
  display: block;
  padding: 14px 20px;
  font-family: 'Calibri', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #111;
  text-decoration: none;
  line-height: 1.45;
  white-space: normal;
  text-align: left;
  border-bottom: 0 !important;
  transition: background .12s ease, color .12s ease;
}
.dd-level-2 a:hover,
.dd-level-3 a:hover {
  background: #f5f5f5;
  color: brown;
}
.dd-level-2 a.is-disabled,
.dd-level-3 a.is-disabled,
.dd-soon-item {
  display: block;
  padding: 14px 20px;
  font-family: 'Calibri', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #888;
  font-style: italic;
  cursor: not-allowed;
  text-align: center;
}

/* ---- Mobile (≤900px): nested accordion inside drawer ---- */
@media (max-width: 900px) {
  .has-dd {
    position: relative;
    width: 100%;
  }

  .has-dd .nav-trigger {
    display: flex;
    width: 100%;
    text-align: left;
    padding: 16px 18px;
    font-size: 16px;
    font-weight: 600;
    color: #000;
    border: 0;
    border-bottom: 1px solid #e0e0e0;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    transition: color .2s ease, border-color .2s ease;
  }
  .has-dd .nav-trigger.current-page { color: #b33a32; }
  .has-dd.is-open > .nav-trigger {
    color: #b33a32;
    border-top: 3px solid #b33a32;
    border-bottom: 3px solid #b33a32;
    background: #fff;
  }
  .has-dd .nav-chevron {
    width: 12px;
    height: 8px;
    flex-shrink: 0;
    color: #888;
    transition: transform .25s ease, color .2s ease;
  }
  .has-dd.is-open > .nav-trigger .nav-chevron {
    transform: rotate(180deg);
    color: #b33a32;
  }

  /* Reset desktop flyout positioning so submenu flows in the drawer */
  .has-dd .dd-level-1,
  .has-dd .dd-level-2,
  .has-dd .dd-level-3 {
    position: static !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: none !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    box-shadow: none !important;
  }

  /* Level 2 — categories (Competency, CEP, …) */
  .has-dd:not(.is-open) > .dd-level-1 {
    display: none;
  }
  .has-dd.is-open > .dd-level-1 {
    display: block;
    border: 0;
    background: #f5f5f5;
    padding: 0;
    margin: 0;
  }

  .dd-parent {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 14px 28px;
    font-size: 15px;
    font-weight: 600;
    white-space: normal;
    border-bottom: 1px solid #ddd;
    box-sizing: border-box;
    text-align: left;
    color: #111;
    background: transparent;
  }
  .dd-parent-arrow {
    font-size: 18px;
    color: #666;
    transition: transform .25s ease, color .2s ease;
    flex-shrink: 0;
  }
  .dd-has-sub.is-expanded > .dd-parent {
    background: #ececec;
    color: #b33a32;
  }
  .dd-has-sub.is-expanded > .dd-parent .dd-parent-label {
    text-decoration: none;
  }
  .dd-has-sub.is-expanded > .dd-parent .dd-parent-arrow {
    transform: rotate(90deg);
    color: #b33a32;
  }

  /* Level 3 — nested sub-menus & course links */
  .dd-has-sub:not(.is-expanded) > .dd-level-2,
  .dd-has-sub:not(.is-expanded) > .dd-level-3 {
    display: none;
  }
  .dd-has-sub.is-expanded > .dd-level-2,
  .dd-has-sub.is-expanded > .dd-level-3 {
    display: block;
    border-top: 1px solid #d8d8d8;
    padding: 0;
    margin: 0;
  }
  .dd-has-sub.is-expanded > .dd-level-2 {
    background: #ebebeb;
  }
  .dd-has-sub.is-expanded > .dd-level-3 {
    background: #e3e3e3;
  }

  /* Level 3 — nested sub-categories (e.g. Boiler Related under CEP) */
  .dd-level-2 > .dd-has-sub > .dd-parent {
    padding: 15px 18px 15px 40px;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    background: #e8e8e8;
    border-bottom: 1px solid #d0d0d0;
  }
  .dd-level-2 > .dd-has-sub.is-expanded > .dd-parent {
    background: #dedede;
    color: #b33a32;
  }

  /* Level 3 — direct course links (e.g. under Competency) */
  .dd-level-2 > li > a {
    padding: 14px 18px 14px 44px;
    font-size: 15px;
    font-weight: 600;
    color: #444;
    background: #f0f0f0;
    border-bottom: 1px solid #ddd;
    display: block;
    text-decoration: none;
    line-height: 1.4;
  }

  /* Level 4 — deepest course links (inside dd-level-3) */
  .dd-level-3 a,
  .dd-level-3 .dd-soon-item {
    padding: 15px 18px 15px 52px;
    font-size: 15px;
    font-weight: 600;
    color: #444;
    background: #f5f5f5;
    border-bottom: 1px solid #d5d5d5;
    display: block;
    text-decoration: none;
    line-height: 1.45;
  }
  .dd-level-3 .dd-soon-item {
    padding-left: 18px;
    padding-right: 18px;
    text-align: center;
    color: #777;
    font-style: italic;
  }
}
