/* Nav dropdowns as one morphing surface (navfx.js) */
.links.nm > .item { position: static; }
.links.nm .drop { top: calc(100% + 18px); inset-inline-start: auto; left: 0; z-index: 2; background: transparent; border-color: transparent; box-shadow: none; transform: none; }
.links.nm .item.open .drop { transform: none; }

.nm-bg { position: absolute; z-index: 1; top: calc(100% + 18px); left: 0; width: 0; height: 0; border-radius: 22px; background: #fff; border: 1px solid var(--line);
  box-shadow: 0 30px 60px -28px rgba(7,26,51,.38), 0 2px 6px -2px rgba(7,26,51,.08); pointer-events: none; opacity: 0;
  transition: transform 460ms var(--ease-out), width 460ms var(--ease-out), height 460ms var(--ease-out), opacity 220ms var(--ease-out); }
.nm-bg.on { opacity: 1; }
.nm-caret { position: absolute; top: -7px; left: 0; width: 14px; height: 14px; background: #fff; border-top: 1px solid var(--line); border-left: 1px solid var(--line); border-radius: 3px 0 0 0;
  transition: transform 460ms var(--ease-out); }
/* hover bridge so the pointer can cross the gap to the panel */
.links.nm .item.open::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 22px; }
.links.nm .item { position: relative; }
.links.nm .item:has(.drop) { position: static; }

.nm-scrim { position: fixed; inset: 0; z-index: 40; background: rgba(7,26,51,.16); opacity: 0; pointer-events: none; transition: opacity 360ms var(--ease-out); }
.nm-scrim.on { opacity: 1; }
@media (hover: none) { .nm-scrim { display: none; } }

/* glide highlight */
.links.nm .drop a { position: relative; z-index: 1; background: transparent !important; }
.nm-hl { position: absolute; z-index: 0; left: 0; top: 0; width: 0; height: 0; border-radius: 12px; background: var(--tint); opacity: 0; pointer-events: none;
  transition: transform 360ms var(--ease-out), width 360ms var(--ease-out), height 360ms var(--ease-out), opacity 200ms; }
.nm-hl.on { opacity: 1; }

/* icon rows */
.drop.nm-list { min-width: 300px; padding: 10px; }
.drop.nm-list a { justify-content: flex-start; gap: 12px; padding: 9px 12px 9px 9px; }
[dir="rtl"] .drop.nm-list a { padding: 9px 9px 9px 12px; }
.nm-ic { width: 36px; height: 36px; flex: none; border-radius: 11px; display: grid; place-items: center; background: var(--tint); color: var(--navy); transition: background 300ms var(--ease-out), color 300ms, transform 400ms var(--ease-out); }
.nm-ic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.drop.nm-list a:hover .nm-ic, .drop.nm-list a:focus-visible .nm-ic { background: var(--navy); color: #fff; transform: rotate(-6deg) scale(1.05); }
.nm-lbl { flex: 1; }
.nm-go { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--navy); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transform: translateX(-8px); transition: opacity 250ms, transform 400ms var(--ease-out); }
[dir="rtl"] .nm-go { transform: scaleX(-1) translateX(-8px); }
.drop.nm-list a:hover .nm-go, .drop.nm-list a:focus-visible .nm-go { opacity: 1; transform: none; }
[dir="rtl"] .drop.nm-list a:hover .nm-go, [dir="rtl"] .drop.nm-list a:focus-visible .nm-go { transform: scaleX(-1); }

/* Specialties: list + live preview */
.links.nm .drop.mega { width: 860px; grid-template-columns: 1fr 1fr 260px; padding: 14px; }
.links.nm .drop.mega .all { grid-column: 1 / 3; }
.nm-prev { grid-column: 3; grid-row: 1 / span 7; display: flex; flex-direction: column; gap: 12px; padding-inline-start: 6px; }
.nm-ph { position: relative; flex: 1; min-height: 220px; border-radius: 16px; overflow: hidden; background: var(--tint); }
.nm-ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.nm-ph::after { content: ""; position: absolute; inset: 0; z-index: 3; background: linear-gradient(to top, rgba(7,26,51,.45), transparent 50%); pointer-events: none; }
.nm-cap b { display: block; font-size: 17px; color: var(--navy); line-height: 1.25; }
.nm-cap small { font-size: 13px; color: var(--muted); }
.links.nm .drop.mega a small { transition: color 250ms; }
.links.nm .drop.mega a:hover small { color: var(--blue); }

@media (max-width: 1240px) { .links.nm .drop.mega { width: 640px; grid-template-columns: 1fr 1fr; } .nm-prev { display: none; } }
@media (prefers-reduced-motion: reduce) { .nm-bg, .nm-caret, .nm-hl { transition: none; } }
html.rm .nm-bg, html.rm .nm-caret, html.rm .nm-hl { transition: none; }

/* ═══ Phone menu ═══ */
.menu.mm { padding-bottom: 120px; gap: 0; }
.menu.mm::before { content: ""; position: fixed; inset: auto 0 0 0; height: 60%; background: url("assets/footer-pattern.webp") right bottom / 520px auto no-repeat; opacity: .35; pointer-events: none; }
.menu.mm .big { position: relative; width: 100%; display: flex; align-items: center; gap: 14px; text-align: start; font: inherit; font-size: 30px; font-weight: 700; color: #fff; background: none; border: 0; border-bottom: 1px solid rgba(255,255,255,.12); padding: 14px 0; cursor: pointer;
  opacity: 0; transform: translateY(18px); transition: opacity 400ms var(--ease-out), transform 400ms var(--ease-out), color 300ms; }
.menu-open .menu.mm .big { opacity: 1; transform: none; transition-delay: calc(260ms + var(--i) * 55ms), calc(260ms + var(--i) * 55ms), 0ms; }
.menu.mm .big > span:not(.mm-n):not(.mm-faces) { flex: 1; }
.mm-n { font-size: 12px; font-weight: 700; letter-spacing: .1em; color: var(--sky); width: 22px; font-variant-numeric: tabular-nums; }
.mm-chev { width: 20px; height: 20px; opacity: .7; transition: transform 460ms var(--ease-out); }
.mm-acc[aria-expanded="true"] .mm-chev { transform: rotate(180deg); }
.menu.mm.has-open .big:not([aria-expanded="true"]) { color: rgba(255,255,255,.45); }
.mm-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 560ms var(--ease-surface); }
.mm-panel.open { grid-template-rows: 1fr; }
.mm-in { overflow: hidden; min-height: 0; }
.mm-panel.open .mm-in { padding: 14px 0 18px; }
/* centre strip */
.mm-strip { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); scrollbar-width: none; overscroll-behavior-x: contain; }
.mm-strip::-webkit-scrollbar { display: none; }
.mm-card { flex: none; width: 46vw; max-width: 200px; scroll-snap-align: start; color: #fff; opacity: 0; transform: translateX(28px); }
[dir="rtl"] .mm-card { transform: translateX(-28px); }
.mm-panel.open .mm-card { opacity: 1; transform: none; transition: opacity 500ms var(--ease-out), transform 600ms var(--ease-out); transition-delay: calc(140ms + var(--j) * 45ms); }
.mm-card .ph { display: block; aspect-ratio: 4 / 3; border-radius: 16px; overflow: hidden; background: rgba(255,255,255,.08); margin-bottom: 8px; }
.mm-card img { width: 100%; height: 100%; object-fit: cover; transition: transform 600ms var(--ease-out); }
.mm-card:active img { transform: scale(1.06); }
.mm-card b { display: block; font-size: 15px; line-height: 1.25; }
.mm-card small { font-size: 12px; color: rgba(255,255,255,.6); }
/* rows */
.mm-rows { display: grid; gap: 4px; }
.mm-row { display: flex; align-items: center; gap: 14px; padding: 10px 6px; border-radius: 14px; color: #fff; font-size: 17px; font-weight: 500; opacity: 0; transform: translateY(10px); }
.mm-panel.open .mm-row { opacity: 1; transform: none; transition: opacity 420ms var(--ease-out), transform 520ms var(--ease-out), background 200ms; transition-delay: calc(120ms + var(--j) * 40ms), calc(120ms + var(--j) * 40ms), 0ms; }
.mm-row:active { background: rgba(255,255,255,.08); }
.mm-row .nm-ic { background: rgba(255,255,255,.1); color: #fff; }
.mm-all { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; color: var(--sky); font-weight: 700; font-size: 15px; }
.mm-all svg { width: 16px; height: 16px; }
[dir="rtl"] .mm-all svg { transform: scaleX(-1); }
/* Doctors face stack */
.mm-faces { display: inline-flex; margin-inline-end: 6px; }
.mm-faces i { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; border: 2px solid var(--navy); background: #e8ebf0; margin-inline-start: -10px; opacity: 0; transform: scale(.6); }
.mm-faces i:first-child { margin-inline-start: 0; }
.mm-faces img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 8%; }
.menu-open .mm-faces i { opacity: 1; transform: none; transition: opacity 400ms var(--ease-out), transform 520ms var(--ease-out); transition-delay: calc(520ms + var(--j) * 70ms); }
/* thumb dock */
.mm-dock { position: fixed; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 2; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 8px; border-radius: 22px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  opacity: 0; transform: translateY(30px); transition: opacity 400ms var(--ease-out), transform 520ms var(--ease-out); }
.menu-open .mm-dock { opacity: 1; transform: none; transition-delay: 420ms; }
.mm-d { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border: 0; border-radius: 14px; background: none; color: #fff; font: inherit; font-size: 12px; font-weight: 600; }
.mm-d svg { width: 20px; height: 20px; }
.mm-d:active { background: rgba(255,255,255,.1); }
.mm-d.mm-book { background: #fff; color: var(--navy); }
@media (prefers-reduced-motion: reduce) { .mm-panel { transition: none; } .mm-card, .mm-row, .mm-faces i { opacity: 1 !important; transform: none !important; transition: none !important; } }
html.rm .mm-panel { transition: none; }
html.rm .mm-card, html.rm .mm-row, html.rm .mm-faces i { opacity: 1 !important; transform: none !important; transition: none !important; }
.mm-strip { scroll-padding-inline: var(--gutter); }

/* Specialties mega, as on kch.sa: Specialised Centres | Common specialties | live preview */
.links.nm .drop.mega { width: 1060px; grid-template-columns: 1fr 1fr 230px 250px; grid-auto-rows: min-content; }
.nm-h { margin: 4px 12px 6px; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--blue); }
[dir="rtl"] .nm-h { letter-spacing: 0; font-size: 12.5px; }
.links.nm .drop.mega > .nm-hc { grid-column: 1 / 3; grid-row: 1; }
.nm-common { grid-column: 3; grid-row: 1 / span 8; display: flex; flex-direction: column; gap: 0; padding-inline-start: 10px; border-inline-start: 1px solid var(--line-2); }
.nm-common a { padding: 8px 10px !important; font-size: 14px !important; }
.nm-common .nm-viewall { margin-top: auto; font-weight: 700 !important; color: var(--blue) !important; }
.links.nm .drop.mega .nm-prev { grid-column: 4; grid-row: 1 / span 8; }
@media (max-width: 1240px) { .links.nm .drop.mega { width: 760px; grid-template-columns: 1fr 1fr 220px; } }

/* rows: typographic, no icon tiles: a sky index, the label, a hairline that grows, an arrow */
.drop.nm-list a { gap: 14px; padding: 11px 14px; }
.nm-n { width: 22px; flex: none; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; color: var(--sky); font-variant-numeric: tabular-nums; transition: color 300ms; }
.drop.nm-list a:hover .nm-n, .drop.nm-list a:focus-visible .nm-n { color: var(--blue); }
.drop.nm-list .nm-lbl { position: relative; }
.drop.nm-list .nm-lbl::after { content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 1.5px; background: var(--navy); transform: scaleX(0); transform-origin: 0 50%; transition: transform 420ms var(--ease-out); }
[dir="rtl"] .drop.nm-list .nm-lbl::after { transform-origin: 100% 50%; }
.drop.nm-list a:hover .nm-lbl::after, .drop.nm-list a:focus-visible .nm-lbl::after { transform: scaleX(1); }
.mm-row .nm-n { color: var(--sky); font-size: 12px; }
