/*
 * Header sale mega menu (Task 11, CR-024).
 * Desktop: a white panel under the Ink header; the active city tab is Ink
 * text with a violet left bar. Phone: native <details> accordions inside the
 * Ink mobile menu, one per city, holding the same panel body (CR-026). Tokens only, no gradients (docs/brand/COLOUR-SYSTEM.md).
 */

/* ── Desktop triggers ───────────────────────────────────────────────────── */
.mega { display: flex; align-items: center; }
.mega-trigger { display: inline-flex; align-items: center; gap: 6px; }
.mega-trigger__caret { transition: transform var(--sn-transition); }
.mega-trigger[aria-expanded="true"] .mega-trigger__caret { transform: rotate(180deg); }
.chrome-dark .main-nav .mega-trigger[aria-expanded="true"] { text-decoration: underline; text-underline-offset: 6px; }

/* ── Panel ──────────────────────────────────────────────────────────────── */
/* Positioned against .site-header .wrap (position: relative), so it spans the
   page container directly under the header. */
.mega__panel {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 60;
  background: var(--sn-white);
  color: var(--sn-text);
  border: 1px solid var(--sn-border-soft);
  border-top: 0;
  border-radius: 0 0 var(--sn-radius-lg) var(--sn-radius-lg);
  box-shadow: 0 18px 40px rgba(16, 19, 20, 0.16);
}
.mega__panel[hidden] { display: none; }
.mega__inner { display: grid; grid-template-columns: 13rem 1fr; grid-template-rows: 1fr auto; min-height: 18rem; }

/* Side column = the tablist (row 1) + "Other cities" (row 2), which follows
   the panels in the DOM for Tab order. */
.mega__cities,
.mega__inner > .mega__city--all {
  grid-column: 1;
  background: var(--sn-haze);
  border-right: 1px solid var(--sn-border-soft);
}
.mega__cities {
  grid-row: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 0 0;
}
.mega__inner > .mega__city--all { grid-row: 2; padding-bottom: 27px; border-bottom-left-radius: var(--sn-radius-lg); }
.mega__city {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--sn-text-mute-2);
  background: transparent;
  border: 0;
  border-left: 3px solid transparent;
  padding: 11px 20px 11px 17px;
  cursor: pointer;
}
.mega__city:hover { color: var(--sn-ink); }
.mega__city[aria-selected="true"] {
  color: var(--sn-ink);
  font-weight: 700;
  background: var(--sn-white);
  border-left-color: var(--sn-violet);
}
.mega__city--all { margin-top: auto; color: var(--sn-violet); font-weight: 600; }
.mega__city--all:hover { color: var(--sn-violet-hover); text-decoration: underline; }

.mega__city-panel { grid-column: 2; grid-row: 1 / span 2; padding: 22px 28px 26px; min-width: 0; }
.mega__city-panel[hidden] { display: none; }
.mega__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--sn-border-hairline);
}
.mega__title { margin: 0; font-size: 17px; font-weight: 700; color: var(--sn-ink); }
.mega__all { font-size: 14px; font-weight: 600; color: var(--sn-violet); white-space: nowrap; }
.mega__all:hover { color: var(--sn-violet-hover); text-decoration: underline; }

.mega__cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 24px; }
/* Commercial panel with a godown column (CR-028): columns sized to their
   labels at 13px so the four fit one line each at 1280; narrower screens wrap
   (the .main-nav nowrap would otherwise run labels into the next column). */
.mega__cols--4 { grid-template-columns: repeat(4, minmax(0, auto)); justify-content: space-between; gap: 4px 20px; }
.mega__cols--4 .mega__col a { font-size: 13px; white-space: normal; }
.mega__col { list-style: none; margin: 0; padding: 0; }
.mega__col a {
  display: block;
  padding: 6px 0;
  font-size: 14px;
  line-height: 1.35;
  color: var(--sn-text-muted);
}
.mega__col a:hover { color: var(--sn-violet); text-decoration: underline; }

/* The Ink header rules (.chrome-dark .main-nav a / .site-header a:focus-visible)
   would paint panel links white and give them the mint on-Ink ring; the panel
   is a light surface, so it takes the light-theme colours and violet ring. */
.chrome-dark .main-nav .mega__panel a { color: var(--sn-text-muted); text-decoration: none; }
.chrome-dark .main-nav .mega__panel a:hover { color: var(--sn-violet); text-decoration: underline; }
.chrome-dark .main-nav .mega__panel .mega__all,
.chrome-dark .main-nav .mega__panel .mega__city--all { color: var(--sn-violet); }
/* City tabs are links (CR-026), so the panel-link rule above would recolour them. */
.chrome-dark .main-nav .mega__panel .mega__city:not(.mega__city--all) { color: var(--sn-text-mute-2); }
.chrome-dark .main-nav .mega__panel .mega__city:not(.mega__city--all):hover,
.chrome-dark .main-nav .mega__panel .mega__city[aria-selected="true"] { color: var(--sn-ink); text-decoration: none; }
.chrome-dark .site-header .mega__panel a:focus-visible,
.mega__panel button:focus-visible { outline: 2px solid var(--sn-violet); outline-offset: -2px; box-shadow: none; }

/* ── Phone accordions (inside the Ink mobile menu) ─────────────────────── */
.mobile-menu-panel { max-height: calc(100vh - var(--sn-header-height)); overflow-y: auto; }
.mm-acc > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 12px 4px;
  font-weight: 500;
  font-size: 16px;
  cursor: pointer;
  color: var(--sn-text);
  border-bottom: 1px solid var(--sn-border-hairline);
}
.mm-acc > summary::-webkit-details-marker { display: none; }
.mm-acc > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform var(--sn-transition);
}
.mm-acc[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.mm-acc__body { display: flex; flex-direction: column; padding-left: 14px; }
.mm-acc--city > summary { font-size: 15px; }
.mm-acc--group > summary { font-size: 14px; font-weight: 600; }
.mm-acc__body > a { font-size: 15px; }
.mm-acc--group .mm-acc__body > a { font-size: 14px; padding: 10px 4px; }

/* A city's accordion holds the same panel body as the desktop tab (CR-026):
   the summary already names the city, so the heading goes; columns stack. */
.mm-acc--city .mega__head { display: block; margin: 0; padding: 4px 0 0; border: 0; }
.mm-acc--city .mega__title { display: none; }
.mm-acc--city .mega__all { display: block; padding: 10px 4px; font-size: 15px; font-weight: 600; white-space: normal; }
.mm-acc--city .mega__cols { display: block; }
.mm-acc--city .mega__col { list-style: none; margin: 0 0 8px; padding: 0; }
.mm-acc--city .mega__col a { display: block; padding: 10px 4px; font-size: 14px; line-height: 1.35; }

.chrome-dark .mm-acc > summary { color: var(--sn-on-dark); border-bottom-color: var(--sn-on-dark-hairline); }
.chrome-dark .mm-acc--group > summary { color: var(--sn-text-on-ink-muted); }
.chrome-dark .mm-acc[open] > summary { color: var(--sn-white); font-weight: 700; }

/* ── 900–1023px: the nav shows but hover is off; keep the panel on screen ── */
@media (max-width: 1023px) {
  .mega__inner { grid-template-columns: 11rem 1fr; }
  .mega__cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .mega-trigger__caret,
  .mm-acc > summary::after { transition: none; }
}
