/* INXO header: all the header rules in one file (layout, menu, dropdowns, mobile drawer, language links, account / cart).
   They depend on WordPress's Navigation block and WooCommerce's account / cart blocks, so after an update of either, this is the file to check.
   Loaded after style.css (see functions.php). Font: Josefin Sans, normal weight. */

/* ---- header, two rows (desktop): row 1 = logo on the left, language + account + cart on the right; row 2 = the menu.
   The whole header stays sticky at the top (style.css). Below 1280px the menu is the hamburger. ---- */
.inxo-header { justify-content:flex-start !important; align-items:center; column-gap:.35rem !important; row-gap:0 !important; background:#000; color:#fff; }
.inxo-header { padding: 10px 20px !important; }
.inxo-header, .inxo-header * { font-family:var(--inxo-head); }
.inxo-header a { color:#fff; text-decoration:none; }
.inxo-header a:hover { color:var(--inxo-red); }
.inxo-header > * { order:2; }
.inxo-header > .inxo-logo { order:0; padding-bottom: 2px; }
.inxo-header .inxo-logo img { width:115px !important; height:auto; } /* 20% smaller than the 144px set in the pattern */
.inxo-header > .wp-block-navigation { order:3; }

/* ---- menu typography ---- */
.inxo-header .wp-block-navigation { font-size:.85rem; font-weight:400; text-transform:uppercase; letter-spacing:.08em; }

.inxo-header .wp-block-woocommerce-customer-account, .inxo-header .wp-block-woocommerce-mini-cart, .inxo-header .wc-block-mini-cart { margin:0; }
/* No outline after a mouse/touch press (the parent theme outlines every :focus, which left a white box around the cart); keyboard focus keeps its ring */
.inxo-header :focus:not(:focus-visible), .inxo-header :active { outline:none !important; box-shadow:none; }
/* Menu items (<li tabindex="-1">) get focus from WordPress's own script when a submenu opens, which counts as :focus-visible and drew a blue box around "About". Never outline them; the top-level links show the red underline instead (see the underline accent below). */
.inxo-header .wp-block-navigation li:focus, .inxo-header .wp-block-navigation li:focus-visible,
.inxo-header .wp-block-navigation__responsive-container:not(.is-menu-open) :focus-visible { outline:none !important; box-shadow:none; }

/* ---- menu typography / sheet colour ---- */

/* Mobile / tablet menu: a black drawer sliding in from the left (380px; full width on phones) over the dimmed page; accordion submenus.
   Tapping the dimmed area closes it (header-menu.js). */
.inxo-header .wp-block-navigation__responsive-container.is-menu-open { --navigation-layout-justification-setting:stretch; --navigation-layout-justification:flex-start; background:rgba(0,0,0,.6); color:#fff; padding:0; top:var(--inxo-overlay-top, 80px); }
/* the block carries the class has-black-background-color (an !important preset): override it so the area beside the drawer shows the page, dimmed */
.inxo-header .wp-block-navigation__responsive-container.is-menu-open.has-black-background-color { background-color:rgba(0,0,0,.6) !important; }
.inxo-header .is-menu-open .wp-block-navigation__responsive-close { width:100%; max-width:none; margin:0; height:100%; box-sizing:border-box; }
.inxo-header .is-menu-open .wp-block-navigation__responsive-dialog { width:min(380px, 100%); max-width:none; margin:0; height:100%; background:#000; box-shadow:14px 0 40px rgba(0,0,0,.5); animation:inxo-drawer-in .26s ease; }
@keyframes inxo-drawer-in { from { transform:translateX(-28px); opacity:0; } to { transform:none; opacity:1; } }
@media (prefers-reduced-motion: reduce) { .inxo-header .is-menu-open .wp-block-navigation__responsive-dialog { animation:none; } }
@media (max-width: 600px) { .inxo-header .is-menu-open .wp-block-navigation__responsive-dialog { width:100%; box-shadow:none; } }
.inxo-header .is-menu-open .wp-block-navigation__responsive-container-content { width:100%; max-width:none; margin:0; height:100%; padding:24px var(--wp--preset--spacing--30) 48px !important; scroll-padding-top:24px; box-sizing:border-box; align-items:stretch !important; justify-content:flex-start !important; overflow-y:auto; padding-top: 5px !important }
.inxo-header .is-menu-open .wp-block-navigation__responsive-container-close { display:none; }
.inxo-header .is-menu-open .wp-block-navigation__container { display:flex; flex-direction:column; width:100%; align-items:stretch !important; justify-content:flex-start !important; gap:0 !important; text-align:left; }
/* each row = link | chevron, with the submenu underneath */
.inxo-header .is-menu-open .wp-block-navigation-item { display:grid !important; grid-template-columns:minmax(0, 1fr) auto; align-items:stretch; width:100%; margin:0; }
.inxo-header .is-menu-open .wp-block-navigation-item__content { grid-column:1; display:block; width:auto; padding:.7rem 1rem !important; text-align:left; color:#fff; border:0; border-radius:0; transition:background-color .15s, color .15s; }
/* hover: a square highlight over the whole row (label + chevron), only while the pointer is on that row's own label or chevron */
.inxo-header .is-menu-open .wp-block-navigation-item__content:hover,
.inxo-header .is-menu-open .wp-block-navigation-item:has(> .wp-block-navigation__submenu-icon:hover) > .wp-block-navigation-item__content,
.inxo-header .is-menu-open .wp-block-navigation__submenu-icon:hover,
.inxo-header .is-menu-open .wp-block-navigation-item:has(> .wp-block-navigation-item__content:hover) > .wp-block-navigation__submenu-icon { background:#161616; border-radius:0; }
.inxo-header .is-menu-open .wp-block-navigation-item__content:focus:not(:focus-visible) { outline:none; }
.inxo-header .is-menu-open .wp-block-navigation-item__content:focus-visible { outline:2px solid var(--inxo-red); outline-offset:-2px; }
.inxo-header .is-menu-open .current-menu-item > .wp-block-navigation-item__content { color:var(--inxo-red); }
/* chevron button = tap target at the right end of the row */
.inxo-header .is-menu-open .wp-block-navigation__submenu-icon { grid-column:2; grid-row:1; display:flex !important; align-items:center; justify-content:center; align-self:stretch; width:52px; height:auto; margin:0 !important; padding:0; color:#9a9a9f; border:0; border-radius:0; background:none; pointer-events:auto; transition:background-color .15s, color .15s; }
.inxo-header .is-menu-open .wp-block-navigation__submenu-icon svg { display:none; }
.inxo-header .is-menu-open .wp-block-navigation__submenu-icon::before { content:""; display:block; width:26px; height:26px; background-color:currentColor; transition:transform .2s;
	-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
	mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat; }
.inxo-header .is-menu-open .inxo-open > .wp-block-navigation__submenu-icon { color:#fff; }
.inxo-header .is-menu-open .inxo-open > .wp-block-navigation__submenu-icon::before { transform:rotate(180deg); }
/* submenus: collapsed until opened, indented, softer type */
.inxo-header .is-menu-open .wp-block-navigation__submenu-container { grid-column:1 / -1; grid-row:2; display:none; position:static !important; width:auto !important; min-width:0 !important; height:auto; overflow:visible; visibility:visible; opacity:1; transform:none; background:transparent !important; border:0; box-shadow:none; padding:0 !important; margin:0; }
.inxo-header .is-menu-open .inxo-open > .wp-block-navigation__submenu-container { display:flex; flex-direction:column; align-items:stretch; }
.inxo-header .is-menu-open .wp-block-navigation__submenu-container .wp-block-navigation-item__content { padding:.55rem 1rem .55rem 2rem !important; font-size:.9rem; letter-spacing:.03em; text-transform:none; color:#c9c9cc; }
.inxo-header .is-menu-open .wp-block-navigation__submenu-container .wp-block-navigation__submenu-icon { color:#777; }
/* 3rd level: indented a further 1.5rem than the 2nd level, with a thin guide line on the left, so the levels can be told apart */
.inxo-header .is-menu-open .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container { border-left:1px solid #2a2a2a !important; margin-left:2rem !important; }
.inxo-header .is-menu-open .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container .wp-block-navigation-item__content { padding-left:1.5rem !important; font-size:.85rem; color:#b3b3b8; }

/* ---- language links (繁 / 简): always in the top row next to account and cart, so the copies inside the menu are hidden ---- */
.inxo-header > .inxo-lang { order:1; display:flex; align-items:center; gap:.9rem; margin-left:auto; margin-right:1rem; padding:0 .5rem; padding-bottom: 7px; }
.inxo-lang :is(a, span) { font-size:1rem; font-weight:400; line-height:1; position:relative; top:1.8px; } /* the 繁 / 简 glyphs sit about 2px high in their line box: nudged to line up with the account and cart icons */
.inxo-header .wp-block-navigation-item:has(> a[href*="tr.inxo.org.my"]), .inxo-header .wp-block-navigation-item:has(> a[href*="si.inxo.org.my"]) { display:none !important; }
.inxo-header > .wp-block-woocommerce-customer-account,
.inxo-header > .wp-block-woocommerce-mini-cart { padding-bottom: 7px; }
:where(.wp-block-woocommerce-customer-account .wc-block-customer-account__link), :where(.wp-block-woocommerce-customer-account.wc-block-customer-account--has-dropdown .wc-block-customer-account__toggle) { padding-top: 0.3rem; }

@media (min-width: 1280px) {
	.inxo-header > .inxo-logo { order:0;}
	.inxo-header > .wp-block-navigation { flex:0 0 100%; margin-left:0; padding-top:10px; border-top:1px solid #222; }
	/* row 2 is centred (core right-aligns this menu) */
	.inxo-header > nav.wp-block-navigation,
	.inxo-header > nav.wp-block-navigation .wp-block-navigation__responsive-container-content,
	.inxo-header > nav.wp-block-navigation .wp-block-navigation__container { justify-content:center; --navigation-layout-justification-setting:center; }

	.inxo-header > .inxo-logo,
	.inxo-header > .inxo-lang { padding-bottom: 15px; }
	.inxo-header > .wp-block-woocommerce-customer-account,
	.inxo-header > .wp-block-woocommerce-mini-cart { padding-bottom: 12px; }
}

/* Menu button turns into a close icon while the menu is open */
.inxo-header .wp-block-navigation__responsive-container-open { position:relative; width:40px; height:40px; align-items:center; justify-content:center; padding-bottom:0px; }
.inxo-header .wp-block-navigation__responsive-container-open:focus:not(:focus-visible) { outline:none; }
html.has-modal-open .inxo-header .wp-block-navigation__responsive-container-open svg { opacity:0; }
html.has-modal-open .inxo-header .wp-block-navigation__responsive-container-open::before,
html.has-modal-open .inxo-header .wp-block-navigation__responsive-container-open::after { content:""; position:absolute; left:50%; top:calc(50% - 5px); width:20px; height:2px; background:currentColor; transform:translate(-50%, -50%) rotate(45deg); }
html.has-modal-open .inxo-header .wp-block-navigation__responsive-container-open::after { transform:translate(-50%, -50%) rotate(-45deg); }

/* Hamburger menu below 1280px (WordPress hardcodes 600px; the full menu needs about 1250px to fit on one row).
   To change the switch point, change 1279px here and 1280px in the dropdown block below. */
@media (max-width: 1280px) {
	.inxo-header .wp-block-navigation__responsive-container-open { height: 30px; padding-bottom:8px; }
	.inxo-header .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) { display:none; }
	.inxo-header .wp-block-navigation__responsive-container-open:not(.always-shown) { display:flex; }
	.inxo-header > .wp-block-navigation { margin-left:0; }
}

/* Modern dropdown menus (desktop). Mobile overlay keeps the simple stacked list. */
@media (min-width: 1280px) {
	.inxo-header .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__submenu-container {
		background:#0b0b0b !important; color:#fff; min-width:250px; padding:8px !important;
		border:1px solid #2a2a2a; border-radius:12px; box-shadow:0 18px 40px rgba(0,0,0,.45);
		text-transform:none; letter-spacing:0; font-size:.9rem; line-height:1.5;
		margin-top:10px; transform:translateY(8px); transition:opacity .2s ease, transform .2s ease, visibility .2s;
	}
	/* invisible bridge so the menu doesn't close while moving the mouse down to it */
	.inxo-header .wp-block-navigation__responsive-container:not(.is-menu-open) .has-child > .wp-block-navigation__submenu-container::before { content:""; position:absolute; left:0; right:0; top:-12px; height:12px; }
	/* 2nd -> 3rd level: the bridge sits on the left side of the fly-out (the band above would hide core's side bridge and the menu vanished when the mouse crossed the gap) */
	.inxo-header .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__submenu-container .has-child > .wp-block-navigation__submenu-container::before { left:auto; right:100%; width:14px; top:0; height:100%; }
	.inxo-header .wp-block-navigation .has-child:not(.open-on-click):hover > .wp-block-navigation__submenu-container,
	.inxo-header .wp-block-navigation .has-child:not(.open-on-click):focus-within > .wp-block-navigation__submenu-container,
	.inxo-header .wp-block-navigation .has-child .wp-block-navigation-submenu__toggle[aria-expanded="true"] ~ .wp-block-navigation__submenu-container { transform:translateY(0); }
	/* first-level dropdowns open from the item's left edge towards the right (core right-aligns them when the menu is right-aligned); the last item stays right-aligned so it cannot run off the screen */
	.inxo-header .wp-block-navigation__responsive-container-content > .wp-block-navigation__container > .has-child:not(:last-child) > .wp-block-navigation__submenu-container { left:0 !important; right:auto !important; }
	/* third level flies out to the side */
	.inxo-header .wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container { top:-9px; left:100% !important; right:auto !important; margin-top:0; margin-left:6px; margin-right:0; transform:translateX(8px); } /* always open to the right (core opens it to the left when the menu is right-aligned) */
	.inxo-header .wp-block-navigation .wp-block-navigation__submenu-container .has-child:hover > .wp-block-navigation__submenu-container,
	.inxo-header .wp-block-navigation .wp-block-navigation__submenu-container .has-child:focus-within > .wp-block-navigation__submenu-container { transform:translateX(0); }
	.inxo-header .wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-item__content { display:block; padding:.6rem .9rem; border-radius:8px; color:#d7d7db; transition:background .15s, color .15s; }
	.inxo-header .wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-item__content:hover,
	.inxo-header .wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-item:focus-within > .wp-block-navigation-item__content { background:#1d1d1f; color:#fff; }
	.inxo-header .wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-item { width:100%; }
	/* arrow on items that have a submenu */
	.inxo-header .wp-block-navigation .wp-block-navigation__submenu-icon { margin-left:6px; transition:transform .2s; }
	.inxo-header .wp-block-navigation .wp-block-navigation__submenu-icon svg { width:10px; height:10px; stroke:currentColor; margin-top:0; }
	.inxo-header .wp-block-navigation .wp-block-navigation__responsive-container-content > .wp-block-navigation__container > .has-child > .wp-block-navigation__submenu-icon { align-self:center; position:relative; top:-2px; }
	/* arrows inside dropdowns point right: core already turns the icon, so do not rotate the button as well */
	.inxo-header .wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation__submenu-icon { margin-left:auto; transform:none !important; }

	/* top-level item underline accent */
	.inxo-header .wp-block-navigation__responsive-container-content > .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content { position:relative; padding:.4rem 0; }
	.inxo-header .wp-block-navigation__responsive-container-content > .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content::after { content:""; position:absolute; left:0; bottom:0; width:0; height:2px; background:var(--inxo-red); transition:width .2s; }
	.inxo-header .wp-block-navigation__responsive-container-content > .wp-block-navigation__container > .wp-block-navigation-item:hover > .wp-block-navigation-item__content::after,
	.inxo-header .wp-block-navigation__responsive-container-content > .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content:focus-visible::after { width:100%; }
}

/* Dropdown parents are labels, not links (mobile-menu.js stops the click): no pointer hand on them */
.inxo-header .has-child > .wp-block-navigation-item__content { cursor:default; }

/* ---- header icons: spacing + cart counter ---- */
/* less room between the account icon and the cart than between the language links and the account icon */
.inxo-header > .wp-block-woocommerce-customer-account { margin-left:0; }
.inxo-header > .wp-block-woocommerce-mini-cart { margin-left:calc(-.5rem - 1px); }
/* cart counter: small red dot with a white number (WooCommerce sets white/black inline, hence !important) */
.inxo-header .wc-block-mini-cart__badge { background-color:var(--inxo-red) !important; color:#fff !important; min-width:16px; height:16px; padding:0 4px; box-sizing:border-box; border-radius:8px; font-size:10px !important; font-weight:600; line-height:16px; letter-spacing:0; text-align:center; padding-top: 3px; }

/* ---- logout icon (logged-in users): last in the row, after the cart ---- */
.inxo-header > .inxo-logout { display:flex; align-items:center; margin:0; padding:0 0 7px; } /* same bottom padding as the account and cart icons (7px; 12px on the desktop menu row) so all icons sit on one line */
@media (min-width: 1280px) { .inxo-header > .inxo-logout { padding-bottom:12px; } }
.inxo-logout a { display:flex; align-items:center; justify-content:center; width:26px; height:26px; color:#fff; text-decoration:none; transition:color .15s; }
.inxo-logout svg { width:20px; height:20px; stroke-width:1.9; }
.inxo-logout a:hover, .inxo-logout a:focus-visible { color:var(--inxo-red); outline:0; }
/* very narrow phones: the header row is full, so the logout icon is hidden (Log out is still in My Account) */
@media (max-width:420px) { .inxo-header > .inxo-logout { display:none; } }

/* No box around the cart icon: closing the drawer hands focus back to it, which drew the browser's blue :focus-visible ring */
.inxo-header .wc-block-mini-cart__button:focus, .inxo-header .wc-block-mini-cart__button:focus-visible { outline:none !important; box-shadow:none !important; }
.inxo-header > .wp-block-woocommerce-mini-cart .wc-block-mini-cart__button { position:relative; top:-1px; } /* the cart glyph sits 1px lower than the account and logout glyphs */

/* 繁 / 简: not clickable for now (the Chinese versions are not ready) */
.inxo-lang .is-off { cursor:default; opacity:.55; user-select:none; }
.inxo-header .wp-block-navigation-item > a:is([href*="tr.inxo.org.my"], [href*="si.inxo.org.my"]) { pointer-events:none; }
