/* =============================================================================
   HEADER.CSS — Jaipur Stone Industries
   Desktop header system: transparent → solid scroll, dropdown + submenu
   ============================================================================= */


/* -----------------------------------------------------------------------------
   DESIGN DECISIONS
   · No backdrop-filter / glassmorphism
   · No height transition (eliminates layout shift risk)
   · Transitions on background-color and border-color only
   · No animated underlines — static active indicator only
   · Dropdowns: CSS :hover triggers, padding bridge eliminates hover gap
   · Restrained opacity fade (180ms) — no sliding, no scaling
   ----------------------------------------------------------------------------- */


/* =============================================================================
   1. HEADER SHELL
   ============================================================================= */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-fixed);
  height: 72px;

  background-color: transparent;
  border-bottom: 1px solid transparent;

  /* Only these two properties transition — nothing else moves */
  transition:
    background-color 320ms ease,
    border-color 320ms ease;
}

/* Scrolled state — JS adds .is-scrolled */
.site-header.is-scrolled {
  background-color: var(--color-bg-primary);
  border-bottom-color: var(--color-border);
}

/* Whenever any dropdown is open over a transparent header,
   the header goes opaque so the dropdown panel sits on a solid surface */
.site-header.has-open-dropdown {
  background-color: var(--color-bg-primary);
  border-bottom-color: var(--color-border);
}


/* =============================================================================
   2. HEADER INNER LAYOUT
   Three-column grid: logo | nav | actions
   ============================================================================= */

.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 100%;
  gap: var(--space-8);
}


/* =============================================================================
   3. LOGO
   ============================================================================= */

.header-logo {
  display: flex;
  align-items: center;
}

.header-logo a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
}

.logo-mark {
  width: 34px;
  height: 34px;
  border-radius: var(--border-radius-sm);
  background-color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-mark span {
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.02em;
  color: var(--color-text-inverse);
  line-height: 1;
}

.logo-wordmark {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.logo-wordmark__primary {
  font-family: var(--font-heading);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-primary);
  line-height: 1;
  transition: color 200ms ease;
}

.logo-wordmark__sub {
  font-size: 9px;
  font-weight: var(--font-weight-medium);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  line-height: 1;
}

.header-logo a:hover .logo-wordmark__primary {
  color: var(--color-accent);
}


/* =============================================================================
   4. PRIMARY NAVIGATION — centered column
   ============================================================================= */

.header-nav {
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-list {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
}


/* =============================================================================
   5. NAV ITEM — base
   ============================================================================= */

.nav-item {
  position: relative;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 var(--space-5);
  height: 72px;                          /* full header height = zero gap above */
  font-family: var(--font-heading);
  font-size: 11.5px;
  font-weight: var(--font-weight-medium);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  position: relative;
  transition: color 180ms ease;
  -webkit-user-select: none;
  user-select: none;
}

.nav-link:hover {
  color: var(--color-text-primary);
}

/* Static active indicator — no animation */
.nav-link.is-active {
  color: var(--color-text-primary);
}

.nav-link.is-active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: var(--space-5);
  right: var(--space-5);
  height: 1px;
  background-color: var(--color-accent);
  /* No transition — appears/disappears instantly with page load */
}


/* =============================================================================
   6. DROPDOWN CARET
   ============================================================================= */

/* CSS-only downward triangle — no rotation animation */
.nav-caret {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-top: 4px solid currentColor;
  opacity: 0.4;
  flex-shrink: 0;
  position: relative;
  top: 1px;
  transition: opacity 180ms ease;
}

.nav-item--has-dropdown:hover .nav-caret {
  opacity: 0.75;
}

/* Indicate dropdown is open (aria/JS class) */
.nav-item--has-dropdown.is-open .nav-caret {
  opacity: 0.75;
}


/* =============================================================================
   7. PRODUCTS DROPDOWN — Level 1
   The padding-top is the hover bridge: it extends the hover area over any
   sub-pixel gap between the header bottom and the panel edge.
   ============================================================================= */

.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  padding-top: 6px;                      /* invisible bridge — hover area */

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 180ms ease,
    visibility 180ms ease;

  z-index: var(--z-dropdown);
}

/* Trigger via CSS :hover — stable, no delay flicker */
.nav-item--has-dropdown:hover > .nav-dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

/* Also support JS-toggled .is-open for keyboard / programmatic control */
.nav-item--has-dropdown.is-open > .nav-dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

/* Visual panel */
.nav-dropdown__panel {
  background-color: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-md);
  padding: 6px 0;
  min-width: 210px;
}

.nav-dropdown__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-dropdown__item {
  position: relative;
}

/* Separator above last item group (optional — can activate with class) */
.nav-dropdown__item--separator {
  border-top: 1px solid var(--color-border);
  margin-top: 4px;
  padding-top: 4px;
}

/* Dropdown link */
.nav-dropdown__link {
  display: flex;
  align-items: center;
  padding: 9px 16px;
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-regular);
  color: var(--color-text-secondary);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    color 150ms ease,
    background-color 150ms ease;
}

.nav-dropdown__link:hover {
  color: var(--color-text-primary);
  background-color: rgba(255, 255, 255, 0.035);
}

/* Item with a submenu: label + right-arrow */
.nav-dropdown__link--has-sub {
  justify-content: space-between;
  gap: var(--space-4);
}

/* Right-pointing arrow for submenu trigger */
.nav-dropdown__sub-arrow {
  display: inline-block;
  width: 0;
  height: 0;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  border-left: 4px solid currentColor;
  opacity: 0.35;
  flex-shrink: 0;
  transition: opacity 150ms ease;
}

.nav-dropdown__item--has-sub:hover .nav-dropdown__sub-arrow,
.nav-dropdown__item--has-sub.is-open .nav-dropdown__sub-arrow {
  opacity: 0.7;
}

/* Highlight the parent item when submenu is open */
.nav-dropdown__item--has-sub:hover > .nav-dropdown__link,
.nav-dropdown__item--has-sub.is-open > .nav-dropdown__link {
  color: var(--color-text-primary);
  background-color: rgba(255, 255, 255, 0.035);
}


/* =============================================================================
   8. GRANITE SUBMENU — Level 2
   padding-left creates the horizontal hover bridge so diagonal mouse movement
   from the Granite row to the submenu panel doesn't close the menu.
   ============================================================================= */

.nav-dropdown__sub {
  position: absolute;
  top: 0;                                /* aligns with parent list item top */
  left: 100%;
  padding-left: 6px;                     /* horizontal bridge */

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 160ms ease,
    visibility 160ms ease;

  z-index: calc(var(--z-dropdown) + 1);
}

.nav-dropdown__item--has-sub:hover > .nav-dropdown__sub,
.nav-dropdown__item--has-sub.is-open > .nav-dropdown__sub {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

/* Visual panel for submenu */
.nav-dropdown__sub-panel {
  background-color: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-md);
  padding: 6px 0;
  min-width: 200px;
}

/* Submenu links reuse .nav-dropdown__link — same spec, different context */


/* =============================================================================
   9. HEADER ACTIONS — right column
   ============================================================================= */

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-4);
}

/* Hamburger — rendered in DOM but hidden; stub for future responsive work */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: var(--space-2);
  cursor: pointer;
  background: none;
  border: none;
  border-radius: var(--border-radius-sm);
}

.nav-toggle__bar {
  display: block;
  width: 22px;
  height: 1.5px;
  background-color: var(--color-text-primary);
  border-radius: 2px;
}


/* =============================================================================
   10. PAGE OFFSET — compensates for fixed header
   ============================================================================= */

.header-offset {
  padding-top: 72px;
}

/* CSS custom property for any component that needs the header height */
:root {
  --header-height: 72px;
}


/* =============================================================================
   11. RESPONSIVE STUB
   Mobile styles intentionally omitted — to be implemented in a future pass.
   The hamburger is present in the DOM, hidden via display:none.
   ============================================================================= */

/* @media (max-width: 1024px) { ... } */
/* @media (max-width: 768px)  { ... } */
