/* =====================================================================
   MetaX.Academy — Estate additions (MX-NAV-SPEC v2026.10.1)
   Loaded AFTER /css/style.css. Adds/overrides only the v2026.10.1 layer:
   fluid 9-item nav, 1180px breakpoint, .mm-hub, .mx-pagestamp,
   .mx-exitpair, .mx-related, .mx-demo, .ul-word, markdown prose,
   hub cards, search modal, and the reduced-motion block.
   ===================================================================== */

/* =====================================================================
   NAV GEOMETRY — authoritative v2026.10.1 layer (supersedes style.css nav)
   Mobile → desktop switch at 1180px. Fluid item scale. The utility cluster
   NEVER disappears: below 1280px it collapses to glyph-only (still tappable).
   ===================================================================== */

/* Mobile band: 0–1179.98px — hamburger only, mega + utility hidden. */
@media (max-width: 1179.98px) {
  .nav-links.mega { display: none !important; }
  .nav-utility    { display: none !important; }
  .nav-toggle     { display: inline-flex !important; }
}
/* Desktop band: 1180px+ — mega + utility shown, hamburger hidden. */
@media (min-width: 1180px) {
  .nav-links.mega { display: flex !important; }
  .nav-utility    { display: flex !important; }
  .nav-toggle     { display: none !important; }
}

.nav-inner { gap: 8px; }
.nav-links.mega { gap: clamp(1px, 0.4vw, 8px); }
.mm-top { font-size: clamp(0.74rem, 0.5vw + 0.42rem, 0.86rem); padding: 9px clamp(5px, 0.6vw, 10px) !important; }

/* Utility cluster — keep every action reachable at every desktop width.
   Verify is NEVER display:none (that was the "hidden items" bug); below
   1280px it and Search shrink to glyph-only via .ul-word hiding. */
.nav-utility { flex: 0 0 auto; gap: 4px; }
.util-link { display: inline-flex !important; align-items: center; gap: 6px; }
.util-link.util-verify { display: inline-flex !important; }
@media (max-width: 1279.98px) {
  .nav-utility .util-link .ul-word,
  .nav-search-btn .nsb-label,
  .nav-search-btn .ul-word { display: none; }
  .nav-search-btn kbd { display: none; }
  .util-link { padding: 8px 10px; }               /* keep ≥40px glyph target */
}

/* Touch-target floor (§6.5) */
.nav-toggle { min-height: 44px; min-width: 44px; }
.btn { padding: 15px 26px; }

/* ---------- Brand lockup: never more than two tidy lines ---------- */
.brand { flex: 0 0 auto; min-width: 0; align-items: center; }
.brand .name {
  display: inline-flex; flex-direction: column; line-height: 1.05;
  white-space: nowrap;                              /* "MetaX.Academy" never wraps */
}
.brand .name > .brand-title { white-space: nowrap; }
.brand .ver {
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 15ch; font-size: 0.58rem; letter-spacing: 0.12em; margin-top: 1px;
}
@media (max-width: 400px) { .brand .ver { display: none; } }  /* tiny phones: drop the stamp */

/* ---------- Group-heading hub links (§3) ---------- */
.mm-hub { color: inherit; text-decoration: none; }
.mm-hub:hover { color: var(--cyan); text-decoration: underline; text-underline-offset: 3px; }
.mm-m-hub { color: var(--cyan) !important; font-weight: 600; }

/* ---------- Demo provenance strip (§6.4) ---------- */
.mx-demo {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  max-width: var(--maxw); margin: 12px auto; padding: 12px 18px;
  background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--gold); border-radius: var(--radius-sm);
  font-size: 0.85rem; color: var(--muted);
}
.mx-demo strong { color: var(--text); }
.mx-demo a { color: var(--cyan); text-decoration: none; margin-left: auto; }
.mx-demo a:hover { text-decoration: underline; }
.mx-demo-x { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 8px; cursor: pointer; padding: 4px 9px; min-height: 32px; }
.mx-demo-x:hover { color: var(--text); border-color: var(--line-strong); }

/* ---------- Page stamp (§6.1) ---------- */
.mx-pagestamp {
  display: inline-flex; flex-wrap: wrap; gap: 8px 10px; align-items: center;
  margin-top: 18px; font-family: var(--font); font-size: 0.78rem; color: var(--dim);
  letter-spacing: 0.02em;
}
.mx-pagestamp a { color: var(--cyan); text-decoration: none; }
.mx-pagestamp a:hover { text-decoration: underline; }

/* ---------- Detail-page prose ---------- */
.mx-doc-hero h1 { max-width: 20ch; }
.mx-sec { padding-top: 8px; }
.mx-sec h3 { font-family: var(--font); font-size: 1.15rem; margin: 22px 0 8px; color: var(--text); }
.mx-sec h4 { font-family: var(--font); font-size: 0.95rem; margin: 16px 0 6px; color: var(--cyan); }
.mx-sec p { color: var(--muted); margin-bottom: 14px; max-width: 74ch; }
.mx-sec ul, .mx-sec ol { color: var(--muted); margin: 0 0 16px 1.2em; max-width: 74ch; }
.mx-sec li { margin-bottom: 8px; }
.mx-sec code { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 0.85em; background: rgba(140,160,255,0.1); padding: 2px 6px; border-radius: 6px; color: var(--cyan); }
.mx-quote {
  margin: 0 0 18px; padding: 14px 20px; border-left: 3px solid var(--violet);
  background: var(--panel); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text); font-style: italic; max-width: 74ch;
}
.mx-table-wrap { overflow-x: auto; margin: 0 0 18px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.mx-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.mx-table th, .mx-table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.mx-table th { font-family: var(--font); color: var(--cyan); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; }
.mx-table td { color: var(--muted); }
.mx-table tr:last-child td { border-bottom: none; }

/* ---------- Related lattice (§6.2) ---------- */
.mx-related { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; }
.mx-rel-title { font-family: var(--font); font-size: 1.05rem; margin-bottom: 18px; }
.mx-rel-grid { display: grid; gap: 22px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .mx-rel-grid { grid-template-columns: repeat(2, 1fr); } }
.mx-rel-col h4 { font-family: var(--font); font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--cyan); margin-bottom: 10px; }
.mx-rel-col ul { list-style: none; margin: 0; }
.mx-rel-col li { margin-bottom: 7px; }
.mx-rel-col a { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.mx-rel-col a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Hub cards ---------- */
.mx-hub-hero { position: relative; }
.mx-hub-cards .mx-hub-card h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mx-hub-card .card-link { margin-top: auto; }

/* ---------- Search modal ---------- */
.search-modal { position: fixed; inset: 0; z-index: 1000; display: none; }
.search-modal[aria-hidden="false"] { display: block; }
.search-backdrop { position: absolute; inset: 0; background: rgba(3,4,12,0.72); backdrop-filter: blur(4px); }
.search-box {
  position: relative; max-width: 640px; margin: 8vh auto 0; background: var(--panel-solid);
  border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 40px 90px -30px rgba(0,0,0,0.8);
}
.search-top { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.search-top > span { color: var(--dim); font-size: 1.1rem; }
.search-top input { flex: 1; background: none; border: none; color: var(--text); font-size: 1rem; font-family: var(--font-body); outline: none; min-height: 44px; }
.search-top button { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; min-height: 44px; min-width: 44px; }
.search-results { max-height: 56vh; overflow-y: auto; padding: 6px; }
.search-hit { display: grid; grid-template-columns: 96px 1fr; gap: 4px 12px; padding: 10px 12px; border-radius: 10px; text-decoration: none; }
.search-hit:hover { background: rgba(140,160,255,0.08); }
.sh-cat { font-family: var(--font); font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--cyan); align-self: center; }
.sh-title { color: var(--text); font-weight: 600; font-size: 0.92rem; }
.sh-url { grid-column: 2; color: var(--dim); font-size: 0.76rem; font-family: ui-monospace, monospace; }
.search-empty { padding: 24px; color: var(--muted); text-align: center; }
.search-foot { padding: 12px 16px; border-top: 1px solid var(--line); font-size: 0.8rem; color: var(--dim); }
.search-foot a { color: var(--cyan); text-decoration: none; }

/* ---------- Mobile menu hub links + accordion ---------- */
.mm-m-group .mm-m-panel { display: none; }
.mm-m-group.open .mm-m-panel { display: block; }
.mm-m-caret { float: right; transition: transform 0.2s; }
.mm-m-group.open .mm-m-caret { transform: rotate(180deg); }

/* ---------- Footer 4-col (§8.1) ---------- */
.footer-grid { display: grid; gap: 30px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .footer-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 800px) { .footer-grid { grid-template-columns: 1.4fr repeat(4, 1fr); } }
.foot-brand p { color: var(--muted); font-size: 0.88rem; margin-top: 10px; max-width: 34ch; }

/* ---------- Inline search box (search page hero) ---------- */
.search-inline { margin-top: 22px; max-width: 520px; }
.search-inline input {
  width: 100%; background: var(--panel-solid); border: 1px solid var(--line-strong);
  color: var(--text); font-size: 1rem; font-family: var(--font-body);
  padding: 14px 18px; border-radius: var(--radius-sm); outline: none; min-height: 48px;
}
.search-inline input:focus { border-color: var(--cyan); }

/* ---------- Pillar / hub card count line ---------- */
.mx-pillar-count { color: var(--dim); font-size: 0.78rem; font-family: var(--font); letter-spacing: 0.03em; margin-top: 6px; }
.mx-pillar-card .card-link { margin-top: auto; }

/* ---------- 404 ---------- */
.mx-404-glyph { font-size: clamp(3.5rem, 12vw, 7rem); background: var(--grad-text); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* ---------- Search / sitemap page ---------- */
.route-pillar { margin-bottom: 34px; }
.route-pillar h2 { font-family: var(--font); margin-bottom: 14px; }
.route-list { display: grid; gap: 6px 20px; grid-template-columns: 1fr; }
@media (min-width: 680px) { .route-list { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .route-list { grid-template-columns: repeat(3, 1fr); } }
.route-list a { color: var(--muted); text-decoration: none; font-size: 0.88rem; padding: 5px 8px; border-radius: 8px; }
.route-list a:hover { color: var(--text); background: rgba(140,160,255,0.08); }
.route-list a.is-hub { color: var(--text); font-weight: 600; }

/* ---------- Reduced motion (§6.5 — suppress all ambient animation) ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .cosmos::after, .marquee-track, .hero-orbit, .img-slot::after { animation: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* =====================================================================
   NAV REPAIR LAYER — audit 2026-09-25 (see SITE_MAP.md §Navigation)
   Overrides style.css nav rules without editing that file.
   ===================================================================== */

/* ---- A11y helpers ---- */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 1100; padding: 10px 16px; border-radius: 10px;
  background: var(--panel-solid, #0c0e1e); color: var(--text); border: 2px solid var(--cyan); text-decoration: none; font-weight: 600; }
.skip-link:focus { top: 10px; }
#main-content:focus { outline: none; }
.nav a:focus-visible, .nav button:focus-visible, .mm-more-drawer a:focus-visible, .mm-more-drawer button:focus-visible,
.mobile-menu a:focus-visible, .mobile-menu button:focus-visible {
  outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 8px;
}
[hidden] { display: none !important; }

/* ---- Row geometry: the header row can never be wider than the viewport.
   Before: .nav-inner was 1200px max with no shrink; tabs (up to 1050px) +
   utility (392px) overflowed by 138–365px at 1280–1920px, pushing Search and
   Sign-in off-screen ("menu items are hidden"). Now: mega flexes and clips
   nothing (fit() in chrome.js folds tabs into More instead). ---- */
@media (min-width: 1180px) {
  .nav .nav-inner { max-width: min(1640px, 100%); flex-wrap: nowrap; }
  .nav-links.mega { flex: 1 1 auto; min-width: 0; justify-content: center; }
  .nav-utility { flex: 0 0 auto; }
}

/* Tab buttons: style.css styled .mm-top as a link; reset button chrome. */
.mm-top { background: none; border: 0; cursor: pointer; font-family: inherit; line-height: 1.2; }
/* Inline status badges inside the tab cost 70–110px each; they always appear
   inside the panel, so the tab shows a compact dot instead (never vanishes). */
.mm-top > .mm-badge { display: none; }
.mm-top > .mm-badge + .mm-caret::before { content: ""; }

/* Panels open ONLY via .open (managed by JS on hover, focus, click and tap)
   so aria-expanded always matches what is on screen. */
.mm-item.has-panel:hover .mm-panel { opacity: 0; visibility: hidden; pointer-events: none; transform: translateX(-50%) translateY(6px); }
.mm-item.open .mm-panel,
.mm-item.has-panel.open:hover .mm-panel { opacity: 1; visibility: visible; pointer-events: auto; transform: translateX(-50%) translateY(0); }
.mm-item.has-panel:hover .mm-caret { transform: none; }
.mm-item.open .mm-caret { transform: rotate(180deg); }

/* Panel: pinned to the viewport, never clipped left/right, never taller than
   the viewport (Method has 40 links; at 800px it ran 300px below the fold). */
.mm-panel { position: fixed; top: 66px; left: 0; width: 100%; transform: none !important; }
.mm-item.open .mm-panel { transform: none !important; }
.mm-panel-wrap { max-height: calc(100dvh - 76px); overflow-y: auto; overscroll-behavior: contain; }
.mm-panel-inner { max-width: min(1440px, 100%); grid-template-columns: minmax(180px, 240px) minmax(0, 1fr); }
.mm-cols { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
@media (min-width: 1200px) { .mm-cols { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); } }
.mm-group { min-width: 0; }
.mm-group a { overflow-wrap: anywhere; }

/* ---- Active cascade: three distinct levels, never colour alone ---- */
/* L1 pillar tab: bold + gradient underline (underline already in style.css) */
.mm-top.active, .mm-top[aria-current] { color: var(--text); font-weight: 700; }
.mm-more-top.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 1px; height: 2px; border-radius: 2px; background: var(--grad-aurora); }
/* L2 group heading: bold, underlined, marker glyph */
.mm-hub.is-current { color: var(--text); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.mm-hub.is-current::before { content: "\25B8\00a0"; }
.mm-group.is-current { border-left: 2px solid var(--line-strong); padding-left: 10px; margin-left: -12px; }
/* L3 leaf: filled background + left rule + weight */
.mm-group a.is-current, .mm-more-drawer a.is-current {
  color: var(--text); font-weight: 700; background: rgba(140,160,255,0.14);
  box-shadow: inset 3px 0 0 var(--cyan); padding-left: 12px;
}
.mm-intro-cta.is-current { text-decoration: underline; }

/* ---- "More" trigger + drawer ---- */
.mm-more { position: relative; flex: 0 0 auto; }
.mm-more-drawer {
  position: fixed; top: 66px; right: 0; bottom: 0; z-index: 210;
  width: min(760px, 100vw); overflow-y: auto; overscroll-behavior: contain;
  background: rgba(8,10,22,0.99); border-left: 1px solid var(--line-strong);
  box-shadow: -30px 0 80px -30px rgba(0,0,0,0.9); padding: 0 0 30px;
}
.mm-more-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; background: rgba(8,10,22,0.99); border-bottom: 1px solid var(--line); font-family: var(--font); font-weight: 700; }
.mm-more-close { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 8px; min-width: 40px; min-height: 40px; cursor: pointer; }
.mm-more-pillar { padding: 18px 22px 6px; border-bottom: 1px solid var(--line); }
.mm-more-label { font-family: var(--font); font-size: 1rem; margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }
.mm-more-label.is-current::before { content: "\25B8"; color: var(--cyan); }
.mm-more-inner { display: block; padding: 0; max-width: none; }
.mm-more-inner .mm-intro { border-right: 0; padding-right: 0; margin-bottom: 14px; }
.mm-more-inner .mm-intro-label { display: none; }
.mm-more-inner .mm-cols { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
@media (max-width: 1179.98px) { .mm-more, .mm-more-drawer { display: none !important; } }

/* ---- Utility cluster: every item always rendered; words collapse, never the item.
   Before: style.css had `.util-link.util-verify{display:none}` ≤1280px and
   estate.css hid .ul-word ≤1279.98px — Verify survived only via !important. ---- */
@media (min-width: 1180px) and (max-width: 1679.98px) {
  .nav-utility .util-link .ul-word, .nav-search-btn .nsb-label, .nav-search-btn kbd { display: none; }
  .util-link, .nav-search-btn { min-width: 40px; min-height: 40px; justify-content: center; padding: 8px 10px; }
}

/* ---- Mobile accordion ---- */
.mobile-menu { max-height: calc(100dvh - 66px); overflow-y: auto; }
.mobile-menu.open { display: flex; }
/* Before: .mm-m-panel had max-height:900px + overflow:hidden → License (40
   links, 1872px) cut off 20 links with no way to reach them. Now: no cap;
   the outer menu scrolls and only one pillar is open at a time. */
.mm-m-group .mm-m-panel, .mm-m-group.open .mm-m-panel { max-height: none; overflow: visible; }
.mm-m-group.open .mm-m-panel:not([hidden]) { display: block; }
.mm-m-toggle { min-height: 48px; }
.mm-m-sub, .mm-m-hub { min-height: 40px; display: flex; align-items: center; }
.mm-m-hub.is-current, .mm-m-sub.is-current { color: var(--text) !important; font-weight: 700; }
.mm-m-sub.is-current { border-left-color: var(--cyan); background: rgba(140,160,255,0.12); }
.mm-m-hub.is-current::before { content: "\25B8\00a0"; }
.mm-m-toggle.active { font-weight: 700; }
.mm-m-toggle.active::before { content: "\25B8\00a0"; }
.mm-m-sec { margin-bottom: 6px; }

/* ---- Ultra-narrow (≤360px): keep brand + hamburger on one row ---- */
@media (max-width: 360px) { .brand .name { font-size: 0.95rem; } .nav-inner { padding: 0 12px; } }

/* ---- Utility bar below 1180px: icon-only in the header, never display:none.
   Before: `.nav-utility{display:none!important}` for 0–1179.98px, so Start
   Here / Verify / Search existed only inside the closed hamburger.
   Now: 421–1179px → all four as 44px icons; ≤420px → Start + Search as icons,
   Verify + Sign in move to the overflow state (first row of the hamburger). */
@media (max-width: 1179.98px) {
  .nav-utility { display: flex !important; gap: 2px; margin-left: auto; margin-right: 6px; }
  .nav-utility .ul-word, .nav-search-btn .nsb-label, .nav-search-btn kbd { display: none !important; }
  .nav-utility .util-link, .nav-utility .nav-search-btn { min-width: 44px; min-height: 44px; padding: 0; justify-content: center; border-radius: 12px; }
  .nav-utility .util-link.util-start, .nav-utility .util-link.util-verify { border-width: 1px; }
}
@media (max-width: 420px) {
  .nav-utility .util-link.util-verify, .nav-utility .util-link.util-auth { display: none !important; } /* overflow → hamburger row 1 */
  .mm-mobile-util a[href*="verify"], .mm-mobile-util a[href*="auth."] { order: -1; border-color: var(--emerald); }
}

/* ---- Comfortable tab size (the "More" threshold is defined by this) ----
   A tab never renders below 0.9rem text / 10px side padding. The earlier fluid
   clamp shrank tabs to ~12.6px text at 1180px to force all nine in; now tabs
   keep this size and chrome.js fit() folds the overflow into "More". */
@media (min-width: 1180px) {
  .mm-top { font-size: 0.9rem !important; padding: 10px 10px !important; }
  .nav-links.mega { gap: 4px; }
}
/* 320px: brand + 2 icons + hamburger must fit (was 12px over). */
@media (max-width: 360px) {
  .brand { gap: 6px; }
  .brand .mark { width: 30px; height: 30px; }
  .nav-utility { margin-right: 2px; }
  .nav-utility .util-link, .nav-utility .nav-search-btn { min-width: 40px; min-height: 44px; }
  .nav-toggle { min-width: 44px; width: 44px; }
}
@media (min-width: 1180px) { .mm-item, .mm-more { flex: 0 0 auto; } }
