/* =========================================================
   NAVIGATION.CSS
   Interaction layer for the top bar: hover states and the
   "קטלוג" mega-menu. Loads AFTER header.css and overrides the
   few rules there that this replaces (the old flat hover and
   the two-piece active underline).

   The whole language: one 1.5px brand rule -- blue 70 / red 30,
   red always on the physical right -- that sweeps out from the
   centre of whatever the pointer is on, and settles permanently
   under the page you are actually on. Nothing moves, nothing
   grows, nothing changes colour abruptly. Every transition is
   on transform or opacity only, so it stays smooth.
   ========================================================= */

:root {
  --nav-blue: #005E8E;
  --nav-red: #CC2F3A;
  --nav-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* the shared rule, as a background image so a single element
   carries both segments. `to left` starts at the physical
   right, so red sits on the right at every direction. */
.nav-rule-bg {
  background-image: linear-gradient(to left,
    var(--nav-red) 0 30%, var(--nav-blue) 30% 100%);
}

/* ---------------------------------------------------------
   1 — TOP BAR LINKS
   --------------------------------------------------------- */
.site-navigation__link,
.site-navigation__trigger {
  position: relative;
  color: var(--color-text);
  transition: color 240ms var(--nav-ease);
}
/* header.css turns the link blue on hover; the rule below does
   the work instead, so the text only deepens to black. */
.site-navigation__link:hover,
.site-navigation__trigger:hover,
.site-navigation__item--open .site-navigation__trigger {
  color: #000000;
}

/* The bar itself must own a stacking context, or the panel --
   however high its z-index -- paints under the hero section
   below it, which is position:relative and comes later. */
.site-header { position: relative; z-index: 50; }

/* header.css draws the active state as two separate coloured
   pseudo-elements. They are retired here at the same specificity
   it used, otherwise its `.is-active::after` keeps winning. */
.site-navigation__link::before,
.site-navigation__link.is-active::before { content: none; }

.site-navigation__link::after,
.site-navigation__link.is-active::after,
.site-navigation__trigger::after {
  content: "";
  position: absolute;
  /* header.css pins its active underline with `right` + a % width.
     Those are cleared FIRST -- `inset-inline` writes to left/right,
     so a later `right: auto` would undo it and collapse the rule. */
  right: auto;
  left: auto;
  width: auto;
  inset-inline: 0;
  bottom: -17px;
  height: 1.5px;
  background-color: transparent;
  background-image: linear-gradient(to left,
    var(--nav-red) 0 30%, var(--nav-blue) 30% 100%);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 420ms var(--nav-ease);
  pointer-events: none;
}
.site-navigation__link:hover::after,
.site-navigation__link:focus-visible::after,
.site-navigation__trigger:hover::after,
.site-navigation__trigger:focus-visible::after,
.site-navigation__item--open .site-navigation__trigger::after,
.site-navigation__link.is-active::after,
.site-navigation__trigger.is-active::after {
  transform: scaleX(1);
}

/* "מאמרים" HAS NO PAGE YET -- so it is hidden, not greyed out.

   It was already not a link: it is a <span>, so it is not
   focusable and not clickable, and a screen reader never
   announced it as something to follow. What it still did was
   occupy a slot in the main navigation that promises content
   that is not there.

   Hiding the LIST ITEM rather than the span is deliberate: the
   nav row has a 56px gap between items, so hiding only the
   span would leave a 56px hole where the word used to be.

   :has() is already relied on elsewhere in this project, and
   this degrades safely -- a browser that does not support it
   simply shows the word again, exactly as today. To bring the
   item back when the articles page exists, delete this one
   rule and the class from the markup.

   The muted-ink rule below is kept so that the styling is
   still correct if the item is ever un-hidden; its #B4B2AE
   fails contrast, which is why it must not come back as
   visible non-link text. */
.site-navigation__item:has(.site-navigation__link--soon) {
  display: none;
}

.site-navigation__link--soon {
  color: #B4B2AE;
  cursor: default;
  pointer-events: none;
}
.site-navigation__link--soon::after { content: none; }

/* the trigger is a real <button>, so it needs the link's own
   type reset before it can look identical to its neighbours. */
.site-navigation__trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: var(--space-1) 0;
  border: 0;
  background: none;
  font-family: var(--font-hebrew);
  font-weight: var(--font-weight-light);
  font-size: var(--font-size-nav);
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}
.site-navigation__trigger:focus-visible {
  outline: 1px solid var(--nav-blue);
  outline-offset: 4px;
}
.site-navigation__chevron {
  width: 5px;
  height: 5px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform 300ms var(--nav-ease);
}
.site-navigation__item--open .site-navigation__chevron {
  transform: rotate(225deg) translate(-1px, -1px);
}

.language-switcher { transition: color 240ms var(--nav-ease); }
.language-switcher:hover { color: #000000; }

/* ---------------------------------------------------------
   2 — THE CATALOG MENU
   A full-width panel hanging under the bar, its inner column
   capped at the site's own 1140. Categories on the physical
   right, that category's products to their left.
   --------------------------------------------------------- */
/* MOTION ONLY -- nothing below changes this panel's layout,
   size, spacing, type, colour, rules, hovers, content, links or
   order. The surface opens with a clip-path instead of the 8px
   slide it used to have, which is what keeps it from ever
   shifting anything: clip-path has no effect on layout.

   The inset is negative on three sides on purpose. clip-path
   clips the BOX SHADOW too, and `inset(0 0 0 0)` would have cut
   this panel's `0 16px 34px` shadow off entirely -- a change to
   the design, not the motion. -70px on the sides and the bottom
   leaves the shadow fully outside the clip once the panel is
   open, while the top stays at 0 so the surface still unrolls
   from the header's own edge. */
.catalog-menu {
  position: absolute;
  inset-inline: 0;
  top: 100%;
  z-index: 60;
  background-color: #FAFAFA;
  border-block-start: 1px solid rgba(0, 94, 142, 0.12);
  box-shadow: 0 16px 34px rgba(20, 18, 16, 0.07);
  opacity: 0;
  clip-path: inset(0 -70px 100% -70px);
  /* closing: a little faster than opening */
  transition:
    opacity 270ms var(--nav-ease),
    clip-path 270ms var(--nav-ease),
    visibility 0s linear 270ms;
  visibility: hidden;
}

.site-header--menu-open .catalog-menu {
  opacity: 1;
  clip-path: inset(0 -70px -70px -70px);
  visibility: visible;
  transition:
    opacity 400ms var(--nav-ease),
    clip-path 400ms var(--nav-ease),
    visibility 0s;
}

/* ---------------------------------------------------------
   THE CONTENTS SETTLING IN
   Only while the panel is OPENING. js/navigation.js adds
   .is-opening for the length of the sequence and takes it off
   again, so switching category later never replays any of
   this. The animations are `backwards` and have finished by
   then, so losing the class changes nothing on screen.

   Fades only: the panel itself carries the one small 4px move
   (below), and stacking a second one on its children would
   have read as four separate things arriving instead of one
   menu coming into focus.
   --------------------------------------------------------- */
@keyframes cm-fade { from { opacity: 0; } to { opacity: 1; } }

.catalog-menu.is-opening .catalog-menu__aside {
  animation: cm-fade 300ms var(--nav-ease) 120ms backwards;
}

.catalog-menu.is-opening .catalog-menu__panel.is-current .catalog-menu__panel-head {
  animation: cm-fade 300ms var(--nav-ease) 170ms backwards;
}

.catalog-menu.is-opening .catalog-menu__panel.is-current .catalog-menu__products {
  animation: cm-fade 300ms var(--nav-ease) 220ms backwards;
}

.catalog-menu.is-opening .catalog-menu__panel.is-current .catalog-menu__all {
  animation: cm-fade 300ms var(--nav-ease) 270ms backwards;
}

/* ---------------------------------------------------------
   SWITCHING CATEGORY
   Only the panel area changes; the menu is never closed and
   reopened. This runs by itself with nothing added to the
   script: a panel goes from display:none to display:block when
   it becomes current, and that restarts its animation. 200ms,
   which is short enough to move between categories without the
   interface feeling as though it is holding the pointer up.
   --------------------------------------------------------- */
@keyframes cm-swap {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.catalog-menu__panel.is-current {
  animation: cm-swap 200ms var(--nav-ease) backwards;
}

/* keyboard users and anyone with motion turned down get the
   panel without any of it. */
@media (prefers-reduced-motion: reduce) {
  .catalog-menu {
    transition-duration: 1ms;
    clip-path: none;
  }
  .site-header--menu-open .catalog-menu {
    transition-duration: 1ms;
    clip-path: none;
  }
  .catalog-menu.is-opening .catalog-menu__aside,
  .catalog-menu.is-opening .catalog-menu__panel.is-current .catalog-menu__panel-head,
  .catalog-menu.is-opening .catalog-menu__panel.is-current .catalog-menu__products,
  .catalog-menu.is-opening .catalog-menu__panel.is-current .catalog-menu__all,
  .catalog-menu__panel.is-current {
    animation: none;
  }
}

.catalog-menu__inner {
  display: flex;
  align-items: stretch;
  gap: 0;
  width: 100%;
  max-width: var(--page-max-width);
  margin-inline: auto;
  padding-block: 38px 42px;
}

/* -- categories (physical right: first child in an RTL row) -- */
.catalog-menu__aside {
  flex: none;
  width: 312px;
  padding-inline-end: 34px;
  border-inline-end: 1px solid #E6E3DF;
}
.catalog-menu__title {
  margin: 0 0 4px;
  font-family: var(--font-english);
  font-weight: var(--font-weight-regular);
  font-size: 8px;
  letter-spacing: 0.2em;
  color: #5A5A5A;   /* was #A1A1A1 -- 2.58:1 */
  text-align: start;
}
.catalog-menu__cat-list { list-style: none; margin: 0; padding: 0; }

.catalog-menu__cat {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 11px 14px 11px 10px;   /* physical: room for the rule on the right */
  color: #3C3C3C;
  text-decoration: none;
  transition: color 220ms var(--nav-ease), background-color 220ms var(--nav-ease);
}
/* the same rule, this time standing on its inline start and
   growing downward rather than sideways. */
.catalog-menu__cat::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 8px;
  bottom: 8px;
  width: 1.5px;
  background-image: linear-gradient(to bottom,
    var(--nav-blue) 0 70%, var(--nav-red) 70% 100%);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 300ms var(--nav-ease);
}
.catalog-menu__cat:hover,
.catalog-menu__cat:focus-visible,
.catalog-menu__cat.is-current {
  color: #000000;
  background-color: #FFFFFF;
  outline: none;
}
.catalog-menu__cat:hover::before,
.catalog-menu__cat:focus-visible::before,
.catalog-menu__cat.is-current::before { transform: scaleY(1); }

.catalog-menu__cat-num {
  flex: none;
  width: 20px;
  font-family: var(--font-hebrew);
  font-weight: var(--font-weight-light);
  font-size: 11px;
  color: #5A5A5A;   /* was #A1A1A1 -- 2.58:1 */
  direction: ltr;
  text-align: right;
}
.catalog-menu__cat-name {
  flex: 1;
  min-width: 0;
  font-family: var(--font-hebrew);
  font-weight: var(--font-weight-light);
  font-size: 14px;
  line-height: 20px;
}
.catalog-menu__cat-count {
  flex: none;
  font-family: var(--font-english);
  font-size: 11px;
  color: #5A5A5A;   /* was #B4B2AE -- 2.12:1 */
  direction: ltr;
}

/* -- products panel (physical left) -- */
.catalog-menu__panels {
  flex: 1;
  min-width: 0;
  padding-inline-start: 34px;
}
.catalog-menu__panel { display: none; }
.catalog-menu__panel.is-current { display: block; }
/* With no JS every panel is simply shown one under the other,
   so the whole catalogue is still reachable and crawlable. */
.no-js .catalog-menu__panel { display: block; margin-block-end: 26px; }

.catalog-menu__panel-head { margin-block-end: 16px; }
.catalog-menu__panel-title {
  margin: 0;
  font-family: var(--font-hebrew);
  font-weight: var(--font-weight-light);
  font-size: 19px;
  line-height: 26px;
  color: #000000;
  text-align: start;
}
.catalog-menu__panel-sub {
  margin: 2px 0 0;
  font-family: var(--font-english);
  font-weight: var(--font-weight-light);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: #5A5A5A;   /* was #9A9A9A -- 2.81:1 */
  direction: ltr;
  text-align: right;   /* the element carries ltr, so pin it physically */
}

.catalog-menu__products {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 30px;
  margin: 0;
  padding: 0;
}
.catalog-menu__product {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 8px 0;
  color: #3C3C3C;
  text-decoration: none;
}
.catalog-menu__product::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: 2px;
  height: 1px;
  background-color: rgba(0, 94, 142, 0.35);
  transform: scaleX(0);
  transform-origin: right;     /* physical: the rule opens from the right, with the reading */
  transition: transform 340ms var(--nav-ease);
}
.catalog-menu__product:hover::after,
.catalog-menu__product:focus-visible::after { transform: scaleX(1); }
.catalog-menu__product:hover .catalog-menu__product-code,
.catalog-menu__product:focus-visible .catalog-menu__product-code { color: var(--nav-blue); }
.catalog-menu__product:focus-visible { outline: none; }

.catalog-menu__product-code {
  flex: none;
  width: 92px;
  font-family: var(--font-english);
  font-weight: var(--font-weight-regular);
  font-size: 13px;
  color: #000000;
  direction: ltr;
  text-align: right;
  transition: color 220ms var(--nav-ease);
}
.catalog-menu__product-desc {
  flex: 1;
  min-width: 0;
  font-family: var(--font-hebrew);
  font-weight: var(--font-weight-light);
  font-size: 12.5px;
  line-height: 18px;
  color: #5A5A5A;   /* was #8A8A8A -- 3.45:1 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.catalog-menu__all {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-block-start: 22px;
  font-family: var(--font-hebrew);
  font-weight: var(--font-weight-light);
  font-size: 13px;
  color: #3C3C3C;
  text-decoration: none;
  transition: color 220ms var(--nav-ease);
}
.catalog-menu__all svg {
  width: 26px;
  height: 7px;
  transition: transform 340ms var(--nav-ease);
}
.catalog-menu__all:hover { color: var(--nav-blue); }
.catalog-menu__all:hover svg { transform: translateX(-7px); }   /* physical: travels with the arrow */

/* Below the frame width the panel would crowd; it drops to a
   single stacked list instead of the two-pane layout. */
@media (max-width: 1139px) {
  .catalog-menu__inner { padding-inline: 32px; }
}
@media (max-width: 900px) {
  .catalog-menu__inner { flex-direction: column; gap: 24px; }
  .catalog-menu__aside { width: auto; padding-inline-end: 0; border-inline-end: 0; }
  .catalog-menu__panels { padding-inline-start: 0; }
  .catalog-menu__products { grid-template-columns: minmax(0, 1fr); }
}
