/* NOERA Mobile UX — shared/noera-mobile.css
   Loaded after each page's inline styles. All rules scoped to @media queries
   except the drawer/hamburger component which renders display:none until needed.

   Breakpoints
   ──────────────────────────────────────────
   ≤ 1000px  mobile/tablet — hamburger + drawer
   ≥ 1001px  desktop       — .nav-center, no hamburger
   ──────────────────────────────────────────
*/

/* ===== MOBILE NAVIGATION DRAWER COMPONENT ===== */

.nmenu-btn {
  display: none;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  background: none;
  border: 1px solid #E6EAF0;
  border-radius: 7px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 11px;
  flex-shrink: 0;
}
.nmenu-bar {
  display: block;
  width: 18px;
  height: 1.5px;
  background: #07111F;
  transition: transform 0.2s, opacity 0.2s;
}
.nmenu-btn[aria-expanded="true"] .nmenu-bar:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}
.nmenu-btn[aria-expanded="true"] .nmenu-bar:nth-child(2) {
  opacity: 0;
}
.nmenu-btn[aria-expanded="true"] .nmenu-bar:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

.nmenu-drawer {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
}
.nmenu-drawer.nmenu-open {
  display: block;
}
.nmenu-overlay {
  position: absolute;
  inset: 0;
  background: rgba(7,17,31,0.45);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

/* Panel always anchored to the right — matches the hamburger trigger position.
   The nav uses direction:ltr on all pages, so the hamburger is always on the
   right edge regardless of page language/direction. */
.nmenu-panel {
  position: absolute;
  top: 0;
  right: 0;
  left: auto;
  bottom: 0;
  width: min(320px, 88vw);
  background: #fff;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 0 env(safe-area-inset-bottom);
  box-shadow: -4px 0 32px rgba(7,17,31,0.12);
}
.nmenu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #E6EAF0;
  min-height: 68px;
}
.nmenu-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}
.nmenu-brand img { flex-shrink: 0; }
.nmenu-close {
  min-width: 44px;
  min-height: 44px;
  width: 44px;
  height: 44px;
  background: none;
  border: 1px solid #E6EAF0;
  border-radius: 7px;
  cursor: pointer;
  font-size: 18px;
  color: #59657a;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nmenu-list {
  list-style: none;
  margin: 0;
  padding: 12px 0;
}
.nmenu-link {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 24px;
  font-size: 15px;
  color: #07111F;
  border-bottom: 1px solid #F0F3F7;
  text-decoration: none;
}
.nmenu-link:hover, .nmenu-link:focus {
  background: #F8FAFC;
}
.nmenu-divider {
  height: 1px;
  background: #E6EAF0;
  margin: 8px 0;
}
.nmenu-lang {
  font-size: 13px;
  color: #59657a;
}
.nmenu-access {
  background: #07111F;
  color: #fff !important;
  margin: 12px 16px 0;
  border-radius: 7px;
  min-height: 52px;
  padding: 0 20px;
  font-size: 14px;
  font-weight: 600;
  justify-content: center;
}
.nmenu-access:hover {
  background: #0f1e30;
}

/* Focus styles */
.nmenu-btn:focus-visible,
.nmenu-close:focus-visible,
.nmenu-link:focus-visible {
  outline: 2px solid #4A6CF7;
  outline-offset: 2px;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .nmenu-bar { transition: none; }
  #intro { display: none !important; }
}

/* ===== MOBILE + TABLET (≤ 1000px) ===== */

@media (max-width: 1000px) {

  /* Show hamburger */
  .nmenu-btn { display: flex !important; }

  /* Collapse desktop nav items */
  .nav-center { display: none !important; }
  .nav-right   { display: none !important; }

  /* Nav layout: brand | hamburger */
  .nav {
    grid-template-columns: 1fr 44px !important;
    gap: 12px !important;
  }

  /* Container */
  .container { width: calc(100% - 32px) !important; max-width: 100% !important; }

  /* Prevent horizontal scroll */
  body { overflow-x: hidden !important; }
  html { overflow-x: hidden !important; }

  /* Minimum interactive height for brand link */
  .brand { min-height: 44px !important; }

  /* ---- INTRO — hidden on mobile; page must be immediately accessible ---- */
  #intro { display: none !important; }

  /* ---- SKIP CONTROL ---- */
  .skip {
    font-size: 13px !important;
    padding: 12px 20px !important;
    min-height: 44px !important;
    min-width: 44px !important;
    bottom: 20px !important;
  }

  /* ---- HERO ---- */
  .hero { min-height: auto !important; padding: 32px 0 20px !important; }
  .hero-grid { grid-template-columns: 1fr !important; gap: 24px !important; }
  h1 { font-size: clamp(30px, 8.5vw, 40px) !important; line-height: 1.35 !important; }
  .hero-sub { font-size: 15px !important; max-width: 100% !important; }
  .ctas { flex-direction: column !important; gap: 10px !important; }
  .btn { min-height: 52px !important; width: 100% !important; justify-content: center !important; font-size: 15px !important; }

  /* ---- CAPITAL FLOW PANEL (mobile stacked) ---- */
  /* Panel is now full-width below the hero text at ≤1000px.
     The canvas uses getBoundingClientRect() every frame so it scales
     automatically to whatever width the container gives it.
     Inline-style @media(max-width:640px) already sets height:500px and
     repositions the five asset labels — this block adds nothing extra for
     640-1000px since the panel is wide enough (≥568px) for desktop positions. */

  /* ---- OBSERVATION TICKER ---- */
  .obs { height: auto !important; padding: 10px 0 !important; }
  .obs-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
    font-size: 11px !important;
  }
  .obs-grid .obs-label { grid-column: 1 / -1 !important; margin-bottom: 4px !important; }
  .obs-grid .eyebrow { grid-column: 1 / -1 !important; margin-bottom: 4px !important; }

  /* ---- SECTION MIN-HEIGHTS ---- */
  .hero, .philosophy, #intelligence, .model, .products, .intel-os,
  .research, .manifesto, .conversion,
  .statement, .cta, .section, .surface, .dark {
    min-height: auto !important;
  }

  /* ---- PHILOSOPHY ---- */
  .philosophy { padding: 48px 0 !important; }
  .philosophy blockquote { font-size: clamp(22px, 6vw, 30px) !important; }

  /* ---- SPLIT LAYOUT ---- */
  .split { grid-template-columns: 1fr !important; gap: 32px !important; padding: 48px 0 !important; }

  /* ---- MODEL SECTION ---- */
  .model { padding: 56px 0 !important; }
  .model-grid { grid-template-columns: 1fr !important; gap: 32px !important; }
  .model .title { font-size: clamp(28px, 7vw, 36px) !important; }
  .model-diagram { display: none !important; }

  /* ---- PRODUCTS ---- */
  .products { padding: 48px 0 !important; }
  .cards { grid-template-columns: 1fr !important; }

  /* ---- INTEL OS ---- */
  .intel-os { padding: 48px 0 !important; }
  .intel-os-grid { grid-template-columns: 1fr !important; gap: 32px !important; }
  .stack { grid-template-columns: 1fr !important; gap: 10px !important; }

  /* ---- RESEARCH ---- */
  .research { padding: 48px 0 !important; }
  .papers { grid-template-columns: 1fr !important; }

  /* ---- MANIFESTO ---- */
  .manifesto { min-height: auto !important; padding: 56px 20px !important; }
  .manifesto h2 { font-size: clamp(26px, 7vw, 36px) !important; }

  /* ---- CONVERSION / SECTIONS ---- */
  .conversion { padding: 48px 0 !important; }
  .section { padding: 40px 0 !important; }

  /* ---- TYPOGRAPHY ---- */
  .title { font-size: clamp(26px, 7vw, 34px) !important; }
  .body, .hero-sub { font-size: 15px !important; line-height: 1.75 !important; }
  .eyebrow { font-size: 10px !important; }
  .card p, .module p, .paper p { font-size: 13px !important; }
  .row p { font-size: 13px !important; }
  .asset strong, .asset small, .range span, .demo, .timeline, .flow-title { font-size: 12px !important; }
  footer a, .copy, .ft, .footer-note { font-size: 12px !important; }

  /* ---- TOUCH TARGETS — FOOTER ---- */
  footer a {
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    padding: 6px 0 !important;
    margin: 0 !important;
  }

  /* ---- FOOTER ACCORDION ---- */
  .footer { grid-template-columns: 1fr !important; gap: 0 !important; }
  .footer > div { border-bottom: 1px solid #E6EAF0; }
  .footer > div:first-child { border-bottom: none; padding-bottom: 16px; }

  .nmenu-ft-toggle {
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    min-height: 48px;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.04em;
    color: #7b8798;
    text-transform: uppercase;
  }
  .nmenu-ft-toggle::after {
    content: "\2304";
    font-size: 16px;
    transition: transform 0.2s;
  }
  .nmenu-ft-toggle[aria-expanded="true"]::after {
    transform: rotate(180deg);
  }
  .nmenu-ft-body { display: none; padding-bottom: 8px; }
  .nmenu-ft-body.open { display: block; }

  /* ---- CORPORATE PAGE SPECIFICS ---- */
  .hero h1 { font-size: clamp(28px, 8vw, 40px) !important; line-height: 1.4 !important; }
  .hero p { font-size: 15px !important; }
  .hero { padding: 48px 0 32px !important; }
  .nav-wrap { height: 68px !important; }

  /* ---- PROCESS ---- */
  .process { padding: 16px !important; }

  /* ---- HEAD ROW ---- */
  .head { flex-direction: column !important; gap: 8px !important; align-items: flex-start !important; }

  /* ---- PLATFORM CHIPS ---- */
  .platforms { flex-direction: column !important; }
  .platform-chip { min-height: 44px !important; }

  /* Cards / grids */
  .cards, .stack, .papers, .research-grid, .product-grid, .principles {
    grid-template-columns: 1fr !important;
  }
  .card { min-height: auto !important; }

  /* Corporate split grids */
  .split, .intel-os-grid { grid-template-columns: 1fr !important; gap: 32px !important; }

  /* Corporate section padding */
  .section.surface, .section.dark { padding: 48px 0 !important; }

  /* Statement / CTA sections */
  .statement h2 { font-size: clamp(28px, 7vw, 38px) !important; line-height: 1.4 !important; }
  .cta h2 { font-size: clamp(26px, 7vw, 36px) !important; line-height: 1.4 !important; }
  .btns { flex-direction: column !important; gap: 10px !important; align-items: center !important; }
  .btns .btn { width: 100% !important; justify-content: center !important; }

  /* Hero grid V2 (corporate pages) */
  .hero-grid-v2 { grid-template-columns: 1fr !important; gap: 24px !important; }
  .hero-field { min-height: 260px !important; }

  /* Footer row on downloads/corporate */
  .footer-row { flex-direction: column !important; align-items: flex-start !important; gap: 16px !important; }
}

/* ===== NARROW OVERRIDES ===== */

@media (max-width: 430px) {
  .container { width: calc(100% - 24px) !important; }
  h1 { font-size: clamp(28px, 8vw, 36px) !important; }

  /* ---- CAPITAL FLOW PANEL ≤ 430px ---- */
  /* Panel ~366-398px wide. Reduce height and rescale cards so five labels
     fit without overlapping each other, the center logo, or the summary. */
  .flow-panel { height: 440px !important; }

  .asset { min-width: 82px !important; padding: 7px 8px !important; }
  /* Override the ≤1000px block's 12px blanket rule for these two: */
  .asset strong { font-size: 10px !important; }
  .asset small  { font-size: 9px  !important; margin-top: 3px !important; }

  /* Positions verified non-overlapping at 366px (390px viewport):
       GOLD  42% → 154-236px   ENERGY right:3% → 273-355px  gap 37px
       EQUITIES left:2% → 7-89px              (clear of GOLD)
       BONDS / CRYPTO fixed-pixel bottom avoids overlap with summary */
  .gold     { left: 42% !important; top: 18% !important; }
  .equities { left:  2% !important; top: 34% !important; }
  .energy   { right: 3% !important; top: 38% !important; }
  .bonds    { left:  2% !important; bottom: 145px !important; }
  .crypto   { right: 3% !important; bottom: 145px !important; }

  /* Tighten header / summary / timeline insets */
  .flow-header  { left: 16px !important; right: 16px !important; top: 14px !important; }
  .flow-summary { left: 16px !important; right: 16px !important;
                  bottom: 48px !important; font-size: 11px !important; }
  .timeline     { left: 16px !important; right: 16px !important; bottom: 12px !important; }

  /* ---- CAPITAL FLOW LEGEND — show labels below canvas instead of overlaying ---- */
  .flow-panel .asset { display: none !important; }
  .flow-asset-legend { display: grid !important; }
}

@media (max-width: 320px) {
  .container { width: calc(100% - 20px) !important; }
  h1 { font-size: 26px !important; }
  .hero-sub { font-size: 14px !important; }
  .nmenu-panel { width: 100vw !important; }

  /* ---- CAPITAL FLOW PANEL ≤ 320px ---- */
  /* Panel ~296px wide. Smallest form: shrink cards, center logo, and insets.
     GOLD 40% → 118-192px   ENERGY right:2% → 216-290px   gap 24px ✓ */
  .flow-panel { height: 380px !important; }

  .asset { min-width: 74px !important; padding: 5px 6px !important; }
  .asset strong { font-size: 9.5px !important; }
  .asset small  { font-size: 8.5px !important; margin-top: 2px !important; }

  .gold     { left: 40% !important; top: 15% !important; }
  .equities { left:  1% !important; top: 31% !important; }
  .energy   { right: 2% !important; top: 35% !important; }
  .bonds    { left:  1% !important; bottom: 115px !important; }
  .crypto   { right: 2% !important; bottom: 115px !important; }

  .flow-header  { left: 10px !important; right: 10px !important; top: 10px !important; }
  .flow-title   { font-size: 9px !important; }
  .flow-summary { font-size: 10px !important; left: 10px !important;
                  right: 10px !important; bottom: 40px !important; }
  .timeline     { left: 10px !important; right: 10px !important; bottom: 8px !important; }

  .flow-center     { width: 44px !important; height: 44px !important; }
  .flow-center img { width: 24px !important; height: 24px !important; }
}

/* ===== DESKTOP (≥ 1001px) ===== */

@media (min-width: 1001px) {
  .nmenu-btn    { display: none !important; }
  .nmenu-drawer { display: none !important; }
}

/* At narrow desktop (1001–1100px) the original inline grid (240px 1fr 300px) gives
   1fr ≈ 341px — too narrow for 5 nav links at the full 28px gap.
   Compress gap and font-size so all links fit without clipping or horizontal scroll.
   Above 1100px (1fr ≥ 440px) the original 13px / 28px style fits without help. */
@media (min-width: 1001px) and (max-width: 1100px) {
  .nav-center { gap: 14px !important; font-size: 12px !important; }
}
