/* ════════════════════════════════════════════════════════════════════
 *  SOT Network — shared megamenu
 *  ------------------------------------------------------------------
 *  This stylesheet ports the sotcoin.oftimor.com megamenu design into
 *  the stot-main theme so EVERY SOT-family site (stays, services,
 *  students, sotcoin, etc.) renders identical chrome from one place.
 *
 *  Class compatibility:
 *    - sotcoin-website plugin uses `.soc-megamenu*` (its own prefix)
 *    - stot-main theme walker uses `.stot-megamenu*`
 *  This file styles BOTH so a site can opt into either markup.
 *
 *  Token palette (matches sotcoin source):
 *    --soc-ocean       #0A4D6E   primary brand
 *    --soc-ocean-deep  #063349   hover / dark text
 *    --soc-ocean-soft  #D3E3EC   borders / hover backgrounds
 *    --soc-ocean-wash  #EAF2F7   panel base tint
 *    --soc-forest      #1F5A36   secondary accent
 * ════════════════════════════════════════════════════════════════════ */

:root {
  --soc-ocean:        #0A4D6E;
  --soc-ocean-deep:   #063349;
  --soc-ocean-soft:   #D3E3EC;
  --soc-ocean-wash:   #EAF2F7;
  --soc-forest:       #1F5A36;
  --soc-mm-panel-bg:  linear-gradient(180deg, #F4F9FC 0%, #E3EEF4 100%);
  --soc-mm-panel-shadow: 0 18px 40px rgba(6, 51, 73, 0.18);
  --soc-mm-text:      #1a2530;
  --soc-mm-muted:     #5b6a76;
  --soc-mm-radius:    12px;
  --soc-mm-font:      "Inter Tight", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
                      Roboto, Helvetica, Arial, sans-serif;
}

/* ============================================================
 *  Top-level NAV bar — sotcoin trigger pill style
 *  Applied to .stot-nav (theme) AND .soc-megamenu (plugin) so
 *  both sites share the row layout.
 * ============================================================ */
.stot-nav,
.soc-megamenu {
  position: relative; /* positioning context for the absolute panels */
}

/* The walker wraps each parent in `<li><details><summary>`. We don't
   restyle the summary — the theme's .stot-nav a rule already gives us
   the right pill chrome. */

/* ============================================================
 *  HARD OVERRIDE — kill the <li>-level positioning context
 *  ------------------------------------------------------------
 *  main.css ships `.stot-nav-has-dd { position: relative }` so that
 *  the SIMPLE single-column dropdown (.stot-nav-dd__list) sits under
 *  the trigger pill. That makes the <li> the positioning context,
 *  which traps the megamenu's `position: absolute; left: 0; right: 0`
 *  at the width of one trigger pill — the exact symptom we're seeing
 *  (panel only as wide as "Stays", columns stacking vertically).
 *
 *  For items with .stot-nav-has-mega the megamenu MUST escape the
 *  <li> and span the full .stot-nav row. Force `position: static` on
 *  the <li>, and on the inner <details>, so `.stot-nav` becomes the
 *  nearest positioned ancestor. !important is used because main.css
 *  may load AFTER sot-megamenu.css in some bundles.
 * ============================================================ */
li.stot-nav-has-mega,
li.stot-nav-has-dd.stot-nav-has-mega,
li.menu-item-has-children.stot-nav-has-mega {
  position: static !important;
}
.stot-nav-has-mega > .stot-nav-dd,
.stot-nav-has-mega > details.stot-nav-dd {
  position: static !important;
}

/* ============================================================
 *  Panel — hidden by default, shown on hover/focus-within
 *  Replaces every visual property of the old card-style panel.
 * ============================================================ */
.stot-megamenu,
.soc-megamenu__panel {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 999;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  /* 16 px outer padding acts as a hover-bridge — empty whitespace
     INSIDE the panel that catches the cursor as it traverses from
     trigger to dropdown, so the open state survives the move. */
  padding: 16px;
  background: transparent;
  border: 0;
  box-shadow: none;
  /* Delay-out: visibility flips AFTER opacity has finished fading
     (giving the cursor ~250 ms to re-establish hover). On open,
     visibility flips instantly. */
  transition: opacity 0.18s ease, visibility 0s linear 0.25s;
  transform: none;
}

/* Open state — triggered by hover, focus-within, OR [open] details */
.stot-nav-has-dd:hover                 > .stot-nav-dd > .stot-megamenu,
.stot-nav-has-dd:focus-within          > .stot-nav-dd > .stot-megamenu,
.stot-nav-has-dd                       > .stot-nav-dd[open] > .stot-megamenu,
li.menu-item-has-children:hover        > .stot-nav-dd > .stot-megamenu,
li.menu-item-has-children:focus-within > .stot-nav-dd > .stot-megamenu,
.soc-megamenu__item--has-panel:hover         .soc-megamenu__panel,
.soc-megamenu__item--has-panel:focus-within  .soc-megamenu__panel {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.18s ease, visibility 0s linear 0s;
}

/* ============================================================
 *  Panel-inner — the actual paper card with content
 *  Constrained to 1280 px shell width, centred in the full-bleed
 *  panel above. THIS is where the gradient / shadow / radius live.
 * ============================================================ */
.stot-megamenu__inner,
.soc-megamenu__panel-inner {
  max-width: 1280px;
  margin: 0 auto;
  background: var(--soc-mm-panel-bg);
  border-radius: var(--soc-mm-radius);
  box-shadow: var(--soc-mm-panel-shadow);
  border: 1px solid var(--soc-ocean-soft);
  padding: 28px 32px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 28px 32px;
  font-family: var(--soc-mm-font);
  width: 100%;
}

/* ============================================================
 *  Column
 * ============================================================ */
.stot-megamenu__col,
.soc-megamenu__col {
  min-width: 0;
  text-align: left; /* override theme's centered top-row text-align */
}

.stot-megamenu__col-heading,
.soc-megamenu__col-title {
  margin: 0 0 12px;
  padding: 0;
  border: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--soc-ocean);
  font-family: var(--soc-mm-font);
  text-align: left;
  line-height: 1.3;
}

/* ============================================================
 *  Column list — vertical stack of links
 *  The theme's .stot-nav ul rule sets `display: flex; flex-wrap:
 *  wrap; justify-content: space-between` which propagates into
 *  the nested list. We override every flex axis explicitly to
 *  guarantee a vertical column.
 * ============================================================ */
.stot-megamenu .stot-megamenu__list,
.stot-megamenu__panel .stot-megamenu__list,
.stot-megamenu__list,
.soc-megamenu .soc-megamenu__col-list,
.soc-megamenu__panel .soc-megamenu__col-list {
  list-style: none;
  margin: 0;
  padding: 0;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 2px;
  text-align: left;
  width: 100%;
}

.stot-megamenu__list li,
.soc-megamenu__col-list li,
.stot-megamenu__item {
  display: block;
  list-style: none;
  margin: 0;
  padding: 0;
  padding-left: 0;
  width: 100%;
  flex: 0 0 auto;
  float: none;
  text-align: left;
}

/* ============================================================
 *  Links — pure text rows, ocean-soft hover
 * ============================================================ */
.stot-megamenu .stot-megamenu__list a,
.stot-megamenu__list a,
.soc-megamenu .soc-megamenu__col-list a,
.soc-megamenu__col-list a,
.stot-megamenu__link {
  display: block;
  padding: 6px 8px;
  margin: 0 -8px;
  border-radius: 6px;
  font-family: var(--soc-mm-font);
  font-size: 14px;
  font-weight: 400;
  color: var(--soc-mm-text);
  text-decoration: none;
  line-height: 1.4;
  white-space: normal; /* theme sets nowrap on .stot-nav a — allow wrap here */
  transition: color 0.15s ease, background-color 0.15s ease;
  text-align: left;
  border-left: 0;
}

.stot-megamenu__list a:hover,
.stot-megamenu__list a:focus-visible,
.soc-megamenu__col-list a:hover,
.soc-megamenu__col-list a:focus-visible,
.stot-megamenu__link:hover,
.stot-megamenu__link:focus-visible {
  color: var(--soc-ocean);
  background-color: var(--soc-ocean-soft);
  text-decoration: none;
  outline: none;
  transform: none;
}

/* Hide per-item icons inside megamenu lists — the design is pure text */
.stot-megamenu__list .stot-nav__icon,
.stot-megamenu__list .stot-megamenu__icon,
.stot-megamenu__list svg:first-child,
.soc-megamenu__col-list svg {
  display: none !important;
}

/* ============================================================
 *  Caret on the parent summary — small diagonal arrow that
 *  flips when the megamenu is open (sotcoin pattern).
 *  Theme uses an SVG caret — we don't touch the SVG, we rotate
 *  it via the existing .stot-nav-dd[open] .stot-nav-dd__caret
 *  rule (which lives elsewhere in main.css).
 * ============================================================ */

/* ============================================================
 *  Mobile — let the theme's hamburger drawer handle it.
 *  The drawer is at ≤ 760 px; sotcoin uses 960 px. We use 760 to
 *  match the stays theme's existing breakpoint.
 * ============================================================ */
@media (max-width: 760px) {
  .stot-megamenu,
  .soc-megamenu__panel {
    /* Inside the drawer, the panel renders as a flush vertical stack —
       no card, no shadow, no positioning. The drawer itself is the
       containing surface. */
    position: static;
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    padding: 0.25rem 0;
    transform: none;
  }
  .stot-megamenu__inner,
  .soc-megamenu__panel-inner {
    background: transparent;
    box-shadow: none;
    border: 0;
    border-radius: 0;
    padding: 0;
    grid-template-columns: 1fr;
    gap: 0.85rem;
    max-width: none;
  }
  .stot-megamenu__col,
  .soc-megamenu__col {
    padding-top: 0.5rem;
    border-top: 1px solid var(--soc-ocean-soft);
  }
  .stot-megamenu__col:first-child,
  .soc-megamenu__col:first-child {
    border-top: 0;
    padding-top: 0;
  }
  .stot-megamenu__col-heading,
  .soc-megamenu__col-title {
    margin-bottom: 0.4rem;
  }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .stot-megamenu,
  .soc-megamenu__panel,
  .stot-megamenu__list a,
  .soc-megamenu__col-list a {
    transition: none !important;
  }
}
