/*
 * namirial-drawer.css - DS Drawer (Namirial design system v2) for the language
 * switcher (LEGACYPORTAL-4757). Loaded by WEB-INF/template.xhtml (private topbar)
 * and index.xhtml (public landing) after the other namirial stylesheets.
 *
 * Chrome per the DS Drawer spec: 400px panel (100vw under 640px),
 * background-secondary surface, default component border, radius-xl on the two
 * inner (left) corners, layout shadow, DS h5 heading with a soft divider and the
 * blanket behind. Items follow the side-navigation selected pattern (2px vertical
 * bar, SemiBold text) and the selectable-item hover background.
 *
 * Tokens: every design-system value that has an --nds-* token uses it with the
 * current v2 value as fallback (the blanket --nds-blanket and the soft divider
 * --nds-surface-300 included). Only the drawer radii (24px and 10px) have no
 * token yet and stay as literals here.
 */

/* ---------------------------------------------------------------- Panel chrome */

/* Flex column: title as fixed header, rows in the scrollable body. The body
   prefix raises the rule above the theme's "body .ui-widget-content"
   background/border. */
body .ui-sidebar.nds-language-drawer {
  display: flex;
  flex-direction: column;
  width: 400px;
  max-width: 100vw;
  padding: 0;
  box-sizing: border-box;
  overflow-y: auto;
  font-family: var(--nds-font-family, "Noto Sans", system-ui, sans-serif);
  background: var(--nds-bg-page, #fafaf7); /* background-secondary (surface-100) */
  border: 1px solid var(--nds-border-default, #d6d9b9);
  border-radius: 24px 0 0 24px; /* DS radius-xl on the two inner corners */
  box-shadow: var(--nds-shadow-layout, 4px 4px 16px 0 rgba(9, 9, 8, 0.15));
}

@media (max-width: 640px) {
  body .ui-sidebar.nds-language-drawer {
    width: 100vw;
  }
}

/* Blanket behind the drawer: PrimeFaces appends the mask to the body. The rgba
   already carries the DS alpha (basic-900 at 70%), so the theme's opacity: 0.8
   must be reset to 1. */
body .ui-widget-overlay.ui-sidebar-mask {
  background-color: var(--nds-blanket, rgba(9, 9, 8, 0.7));
  opacity: 1;
}

/* Close icon: absolute (floats are ignored inside the flex panel), muted
   foreground, selectable-item hover background. */
body .ui-sidebar.nds-language-drawer .ui-sidebar-close {
  position: absolute;
  top: 22px;
  right: 24px;
  float: none;
  padding: 0;
  width: 32px;
  height: 32px;
  box-sizing: border-box;
  line-height: 32px;
  text-align: center;
  border-radius: var(--nds-radius-xs, 8px);
  color: var(--nds-text-muted, #62625f);
  z-index: 2; /* above the sticky h2, which follows it in the DOM and would otherwise intercept its clicks */
}

/* Close icon: Lucide "x" drawn as a CSS mask (same technique as
   namirial-icons.css), replacing the ui-icon-closethick Material glyph.
   20px, as the old 1em glyph in the 32px hit area; currentColor so it
   follows the muted/hover foreground set above. */
body .ui-sidebar.nds-language-drawer .ui-sidebar-close .ui-icon {
  width: 20px;
  height: 20px;
  vertical-align: middle;
  background-color: currentColor !important;
  -webkit-mask: url("/javax.faces.resource/images/icons/lucide-x.svg.xhtml?ln=namirial&v=20261201233332") center / 20px 20px no-repeat;
  mask: url("/javax.faces.resource/images/icons/lucide-x.svg.xhtml?ln=namirial&v=20261201233332") center / 20px 20px no-repeat;
  font-size: 0; /* hides the Material ligature text */
}
body .ui-sidebar.nds-language-drawer .ui-sidebar-close .ui-icon:before {
  content: none !important; /* suppresses the theme's closethick :before glyph */
}

body .ui-sidebar.nds-language-drawer .ui-sidebar-close:hover,
body .ui-sidebar.nds-language-drawer .ui-sidebar-close:focus {
  background-color: var(--nds-sidenav-hover-bg, #d6d9b9);
  color: var(--nds-text-default, #090908);
}

body .ui-sidebar.nds-language-drawer .ui-sidebar-close:focus-visible {
  outline: 2px solid var(--nds-focus-700, #055882);
  outline-offset: 2px;
}

/* Header: sticky title row with the soft divider, centred title. The equal side
   padding keeps the text clear of the close icon; the top-left radius mirrors the panel corner
   while the header is the topmost child. DS h5: 20px SemiBold, 1.3 leading. */
body .ui-sidebar.nds-language-drawer h2 {
  position: sticky;
  top: 0;
  z-index: 1;
  flex: 0 0 auto;
  margin: 0;
  padding: 24px 64px 16px 64px; /* symmetric: the title is centred like the eIDAW drawer, clear of the close icon */
  box-sizing: border-box;
  text-align: center;
  background: var(--nds-bg-page, #fafaf7);
  font-size: 20px;
  line-height: 1.3;
  font-weight: 600;
  color: var(--nds-text-default, #090908);
  border-bottom: 1px solid var(--nds-surface-300, #e1e1de); /* dividers and subtle outlines */
  border-radius: 24px 0 0 0;
}

/* ---------------------------------------------------------------- Drawer items */

/* 48px rows, paragraph-m text; the link itself is the row. */
body .ui-sidebar.nds-language-drawer .nds-drawer-item {
  display: flex;
  align-items: center;
  justify-content: center; /* centred labels, as in the eIDAW language drawer */
  flex: 0 0 auto;
  height: 48px;
  padding: 0 24px;
  box-sizing: border-box;
  font-size: 16px;
  font-weight: 400;
  color: var(--nds-text-default, #090908);
  text-decoration: none;
}

body .ui-sidebar.nds-language-drawer .nds-drawer-item:hover {
  background-color: var(--nds-sidenav-hover-bg, #d6d9b9);
  color: var(--nds-text-default, #090908);
  text-decoration: none;
}

body .ui-sidebar.nds-language-drawer .nds-drawer-item:focus-visible {
  outline: 2px solid var(--nds-focus-700, #055882);
  outline-offset: 2px;
}

/* Selected language: side-navigation pattern - neutral-50 background, 2px
   accent-900 vertical bar (inset, so the row stays 48px), SemiBold text. */
body .ui-sidebar.nds-language-drawer .nds-drawer-item-selected,
body .ui-sidebar.nds-language-drawer .nds-drawer-item-selected:hover {
  background-color: var(--nds-sidenav-selected-bg, #eff1db);
  color: var(--nds-text-default, #090908);
  font-weight: 600;
  box-shadow: inset var(--nds-sidenav-indicator-width, 2px) 0 0 var(--nds-sidenav-indicator, #0e2c00);
}

/* ---------------------------------------------------------------- Triggers */

/* Public landing: ghost button with globe icon + label. The private topbar
   trigger is an ordinary .topbar-items > li > a and reuses the existing topbar
   rules (40x40 icon button on desktop, label on small screens). */
button.nds-language-trigger {
  font-family: var(--nds-font-family, "Noto Sans", system-ui, sans-serif);
  font-size: 16px;
  font-weight: 400;
  color: var(--nds-text-default, #090908);
  background: transparent;
  border: 0;
  height: 40px;
  padding: 0 8px;
  border-radius: 10px; /* DS radius sm at md size */
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-sizing: border-box;
}

button.nds-language-trigger i.nds-icon {
  flex: 0 0 auto; /* the .nds-icon default is the 20px mask box */
}

button.nds-language-trigger:hover {
  background-color: var(--nds-bg-subtle, #eff1db);
  color: var(--nds-text-default, #090908);
}

button.nds-language-trigger:focus-visible {
  outline: 2px solid var(--nds-focus-700, #055882);
  outline-offset: 2px;
}

/* The landing navbar and mobile dropdown metrics of the trigger live with the
   other #menu items in ultima-layout/css/layout-namirial-tsp.css. */
