/**
 * Oracle-style off-canvas drilldown nav — styling (v4)
 * -----------------------------------------------------------------------
 * Every level (2, 3, 4...) now behaves identically: clicking an item with
 * children slides its children out as a new column immediately to the
 * right of the one that owns it. This is achieved with a *chain* of
 * `position: absolute; left: 100%` panels — each panel is positioned
 * relative to its own immediate parent column, so the offsets cascade
 * automatically no matter how many levels deep you go. No per-level pixel
 * math needed.
 *
 * Important: overflow (scrolling) lives on the INNER *-list element
 * (the <ul>), never on the outer *-panel/column wrapper. If you put
 * overflow on the wrapper, it becomes a clipping context for its own
 * positioned descendants and swallows the next column — this was the
 * bug from an earlier version.
 *
 * An item with children is a single link (see oracle-nav.js and the
 * walker) — first click opens its panel, a second click (once already
 * open) navigates normally. Long labels truncate with an ellipsis
 * (`.oracle-item-text`) rather than wrapping.
 *
 * Wide vs. narrow (single-column + Back button) is decided by JS based
 * on the viewport width — see WIDE_MIN_WIDTH in oracle-nav.js.
 * -----------------------------------------------------------------------
 */

:root {
	--oracle-primary-width: 220px;
	--oracle-col-width: 245px;
	--oracle-drawer-max-width: 1380px; /* plain px number — read directly by oracle-nav.js */
	--oracle-drawer-vw-fraction: 0.94; /* plain number (no unit) — read directly by oracle-nav.js */
	--oracle-drawer-width: min(var(--oracle-drawer-max-width), calc(var(--oracle-drawer-vw-fraction) * 100vw));
	--oracle-accent: #c74634; /* swap for your brand colour */
	--oracle-panel-alt-bg: #f6f6f6; /* grey used on columns 2, 4, 6... */
	--sb-track-color: #ccd6dd;
	--sb-thumb-color: #5c7f92;
	--sb-size: 8px;
}

.oracle-accordion-list::-webkit-scrollbar {
  width: var(--sb-size);
}

.oracle-accordion-list::-webkit-scrollbar-track {
  background: var(--sb-track-color);
  border-radius: 2px;
}

.oracle-accordion-list::-webkit-scrollbar-thumb {
  background: var(--sb-thumb-color);
  border-radius: 2px;
}

@supports not selector(::-webkit-scrollbar) {
  .oracle-accordion-list {
      scrollbar-color: var(--sb-thumb-color)
                     var(--sb-track-color);
  }
}



/* ---- Hamburger button (always visible) --------------------------------- */

.oracle-hamburger {
	display: inline-flex;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
}

.oracle-hamburger span {
	display: block;
	width: 24px;
	height: 2px;
	margin: 0 auto;
	background: currentColor;
	transition: transform 0.2s ease, opacity 0.2s ease;
}

.oracle-hamburger[aria-expanded="true"] span:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}
.oracle-hamburger[aria-expanded="true"] span:nth-child(2) {
	opacity: 0;
}
.oracle-hamburger[aria-expanded="true"] span:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

/* ---- Backdrop -------------------------------------------------------- */

.oracle-drawer-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(20, 20, 20, 0.45);
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s;
	z-index: 1045;
}

.oracle-drawer-backdrop.is-open {
	opacity: 1;
	visibility: visible;
}

/* ---- Drawer shell ------------------------------------------------------ */

.oracle-drawer {
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
	width: var(--oracle-drawer-width);
	background: #fff;
	box-shadow: 12px 0 32px rgba(0, 0, 0, 0.18);
	transform: translateX(-100%);
	transition: transform 0.28s ease, width 0.22s ease;
	z-index: 1050;
	display: flex;
	flex-direction: column;
}

.oracle-drawer.is-open {
	transform: translateX(0);
}

html.oracle-drawer-lock-scroll,
html.oracle-drawer-lock-scroll body {
	overflow: hidden;
}

.oracle-drawer-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1rem 1.25rem;
	border-bottom: 1px solid #eee;
	flex: 0 0 auto;
}

.oracle-drawer-close {
	border: 0;
	background: transparent;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
}

/* ---- Column row (scrolls horizontally in wide mode if needed) --------- */

/* No overflow here deliberately: oracle-nav.js now resizes the drawer
   itself (see updateDrawerWidth) to exactly fit the columns that are
   currently open, so there's normally nothing to scroll — and having
   overflow set here was fighting the drawer's own width transition,
   causing a visible shift while both animated at once. If you push the
   max depth/width high enough to exceed the drawer's max-width cap,
   the extra columns will clip rather than scroll; widen
   --oracle-drawer-width's cap in that case instead of re-adding
   overflow here. */
.oracle-drawer-body {
	position: relative;
	flex: 1 1 auto;
}

/* Column 1: primary list. Wrapped in its own positioned, non-scrolling
   box so column 2 has a clean anchor to offset from (see header.php
   snippet in the README — the wrap div is `.oracle-drawer-col1`). */
.oracle-drawer-col1 {
	position: relative;
	width: var(--oracle-primary-width);
	height: 100%;
}

.oracle-drawer-primary {
	height: 100%;
	overflow-y: auto;
	list-style: none;
	margin: 0;
	padding: 0.5rem 0;
}

.oracle-drawer-tab-link {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.75rem 1.25rem;
	color: inherit;
	text-decoration: none;
	font-weight: 600;
}
 
.oracle-item-text {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.oracle-drawer-tab.is-active > .oracle-drawer-tab-link {
	color: var(--oracle-accent);
	background: #faf5f4;
}

.oracle-caret {
	width: 0.55em;
	height: 0.55em;
	flex: 0 0 auto;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(-45deg);
	transition: transform 0.2s ease;
}
 
.oracle-drawer-tab-link[aria-expanded="true"] .oracle-caret,
.oracle-accordion-link[aria-expanded="true"] .oracle-caret {
	transform: rotate(45deg);
}

/* ---- Columns 2, 3, 4... (both the "first flyout" and every nested
   accordion level now share this exact same treatment) ------------------ */

.oracle-drawer-panel,
.oracle-accordion-panel {
	position: absolute;
	top: 0;
	left: 100%;
	width: var(--oracle-col-width);
	height: 100%;
	/* background set per-column below, alternating white/grey */
	border-left: 1px solid #eee;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.18s ease;
	display: flex;
	flex-direction: column;
}

/* Column 2 — opened directly from a primary (top-level) item. */
.oracle-drawer-panel {
	background: var(--oracle-panel-alt-bg);
}

/* Column 3 — opened from a level-2 item, which lives inside column 2. */
.oracle-accordion-item[data-level="2"] > .oracle-accordion-panel {
	background: #fff;
}

/* Column 4 — opened from a level-3 item, which lives inside column 3. */
.oracle-accordion-item[data-level="3"] > .oracle-accordion-panel {
	background: var(--oracle-panel-alt-bg);
}
 
/* Column 5 — opened from a level-4 item, which lives inside column 4. */
.oracle-accordion-item[data-level="4"] > .oracle-accordion-panel {
	background: #fff;
}
 
/* Column 6 — opened from a level-5 item, which lives inside column 5. */
.oracle-accordion-item[data-level="5"] > .oracle-accordion-panel {
	background: var(--oracle-panel-alt-bg);
}
 
/* Fallback for anything deeper than the levels enumerated above, so a
   panel never silently renders with no background (transparent) instead
   of just repeating the last colour — extend the pattern above instead
   of relying on this if you go past 6 levels. */
.oracle-accordion-panel {
	background: var(--oracle-panel-alt-bg);
}
 
.oracle-drawer-tab.is-active > .oracle-drawer-panel,
.oracle-accordion-item.is-active > .oracle-accordion-panel {
	opacity: 1;
	visibility: visible;
}

.oracle-drawer-panel-list,
.oracle-accordion-list {
	flex: 1 1 auto;
	min-height: 0; /* required for the flex child to actually scroll */
	overflow-y: auto;
	list-style: none;
	margin: 0;
	padding: 0.5rem 0 2rem;
}
 
.oracle-accordion-item {
	border-bottom: 1px solid #f2f2f2;
}
 
.oracle-accordion-link {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.65rem 1.25rem;
	color: inherit;
	text-decoration: none;
}
 
.oracle-accordion-item.is-active {
	background: #faf9f8;
}
 
.oracle-accordion-item.is-active > .oracle-accordion-link {
	color: var(--oracle-accent);
}
 
.oracle-accordion-item[data-level="1"] > .oracle-accordion-link {
	font-weight: 600;
}

.oracle-accordion-item[data-level="1"] > .oracle-accordion-link {
	font-weight: 600;
}
 
/* Auto-generated "<Parent> Overview" link, always the first row of a
   panel — see overview_item_html() in class-oracle-nav-walker.php. Uses
   a left accent border (not a background fill) so it stays visible
   regardless of whether this particular column is on the white or grey
   side of the alternating column backgrounds above. */
.oracle-overview-item {
	border-bottom: 1px solid #e9e9e9;
	border-left: 3px solid var(--oracle-accent);
}
 
.oracle-overview-link {
	font-weight: 700;
	color: var(--oracle-accent);
	padding-left: calc(1.25rem - 3px);
}
 
/* ---- Back button (narrow / single-column mode only) -------------------- */
 
.oracle-drawer-back {
	display: none; /* shown only on the panel JS marks as the narrow active column */
	flex: 0 0 auto;
	align-items: center;
	gap: 0.5rem;
	width: 100%;
	padding: 0.75rem 1.25rem;
	border: 0;
	border-bottom: 1px solid #eee;
	background: transparent;
	font-weight: 600;
	cursor: pointer;
}
 
.oracle-back-arrow {
	width: 0.55em;
	height: 0.55em;
	border-left: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
}
 
/* ---- Search panel (see worldautosteel_search_menu() in functions.php) --- */
 
.oracle-drawer-search-inner {
	padding: 1.25rem;
}
 
.oracle-drawer-search-inner .searchform .input-group {
	display: flex;
	width: 100%;
}
 
.oracle-drawer-search-inner .searchform .form-control {
	flex: 1 1 auto;
	min-width: 0;
}
 
/* Search has no real destination page, so it's the one item that stays
   a single full-width toggle button rather than a link (see
   worldautosteel_search_menu() in search-menu.php) — this class isn't
   used by regular nav items any more. */
.oracle-drawer-tab-toggle {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	width: 100%;
	padding: 0.75rem 1.25rem;
	border: 0;
	background: transparent;
	color: inherit;
	font-weight: 600;
	text-align: left;
	cursor: pointer;
}
 
.oracle-drawer-tab-toggle .fa {
	width: 1em;
}
 
.oracle-drawer-tab.is-active > .oracle-drawer-tab-toggle {
	color: var(--oracle-accent);
}
 
/* ---- Narrow-mode state, applied/removed by JS -------------------------- */
 
/* Hides every column except the deepest currently-open one.
   Deliberately NOT using opacity here: opacity compounds through
   descendants regardless of position, so an opacity:0 ancestor would
   also fade out the deepest column's position:fixed override below it,
   even though that column explicitly sets its own visibility:visible.
   Visibility alone doesn't have that problem — a descendant's explicit
   visibility always wins over an inherited value. */
.oracle-col-hide {
	visibility: hidden !important;
	pointer-events: none !important;
}
 
/* The single column shown in narrow mode: JS overrides its position
   with an inline style (fixed, matched to the drawer body's own
   on-screen box) so it renders full-width regardless of how deep it
   is nested in the DOM — the nested `left: 100%` chain above is only
   meant for wide mode. */
.oracle-narrow-active-col {
	border-left: 0;
	/* pointer-events is inherited, so without this the deepest column
	   silently inherits pointer-events:none from whichever ancestor
	   (.oracle-drawer-col1 or an intermediate panel) .oracle-col-hide
	   was applied to above it in the DOM — even though it's the one
	   actually shown on screen. */
	pointer-events: auto;
}
 
.oracle-narrow-active-col > .oracle-drawer-back {
	display: flex;
}