/* ============================================================
   MUWAZANA — Brand overrides
   Loaded AFTER style.css. Applies the brand font system, fixes
   the nav (Join Our Team CTA + real wordmark logo), centers the
   landing hero, fades the tape, simplifies the order-book, and
   provides the four-node trading-loop diagram.
   ============================================================ */

/* ---- Type system: Unna / Plus Jakarta -------------------- */
:root {
  --ff-display: 'Unna', 'Times New Roman', Georgia, serif !important;
  --ff-sans:    'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
  --ff-arabic-display: 'Noto Kufi Arabic', 'Tahoma', sans-serif !important;
  --ff-arabic-body:    'Noto Kufi Arabic', 'Tahoma', sans-serif !important;

  /* Tweakable: text selection highlight */
  --selection-bg: #C5F443;
  --selection-fg: #011821;
}

::selection      { background: var(--selection-bg) !important; color: var(--selection-fg) !important; }
::-moz-selection { background: var(--selection-bg) !important; color: var(--selection-fg) !important; }

html, body, p, .body, .body-text, .lede, .pitch-body,
input, button, select, textarea,
.nav-link, .toggle-group button, .stat .l, .stat .prefix, .stat .suffix,
.book-col-head span, .book-foot .lbl, .book-foot .v,
.tape-cell, .clock,
.footer, .footer a, .footer-nav a, .footer-follow .lbl, .footer-bottom,
.portal-search input, .portal-filter, .pitch-quote {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
}

h1, h2, h3, h4, h5,
.h-xl, .h-lg, .h-md, .h-sm,
.display, .hero-h,
.edge-card h4, .outcome h4, .reason h4, .office h4, .value-row h4,
.systems-prose h3,
.career-start-text h2,
.cta-card h2,
.loader-emblem,
.footer-brand span,
.brand-word {
  font-family: 'Unna', 'Times New Roman', Georgia, serif !important;
  font-weight: 400 !important;
  letter-spacing: -0.02em;
}

/* Italic emphasis in display text — Unna Italic */
.display em, .hero-h em, h1 em, h2 em, h3 em {
  font-family: 'Unna', 'Times New Roman', Georgia, serif !important;
  font-style: italic !important;
  font-weight: 400 !important;
}

/* Subheads — Plus Jakarta SemiBold */
.subhead, h5, .h5,
.systems-prose h3,
.edge-card h4, .outcome h4, .reason h4, .office h4, .value-row h4,
.loop-node-label {
  /* keep heading-style serif where appropriate; subheads in card chrome stay sans */
}

/* But: small section subheads inside cards should be sans-semibold per spec */
.edge-card h4,
.outcome h4,
.reason h4,
.office h4,
.value-row h4 {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif !important;
  font-weight: 600 !important;
  letter-spacing: -0.005em;
}

/* CTA card title — Plus Jakarta Sans (overrides the Unna heading rule above) */
.cta-card h2,
.cta-card h2 em {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif !important;
}

/* CTA / Buttons — Plus Jakarta SemiBold */
.btn, .btn-primary, .nav-cta, .cta,
.portal-filter, .toggle-group button,
.career-start a, button {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif !important;
  font-weight: 600 !important;
}

/* Body weight */
body, p, .body, .body-text, .lede, .pitch-body {
  font-weight: 400 !important;
}

/* Eyebrow / overline stays Plus Jakarta SemiBold */
.eyebrow { font-family: 'Plus Jakarta Sans', system-ui, sans-serif !important; font-weight: 600 !important; }

/* Arabic */
[lang="ar"] h1, [lang="ar"] h2, [lang="ar"] h3, [lang="ar"] h4, [lang="ar"] h5,
[lang="ar"] .display, [lang="ar"] .hero-h,
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4, [dir="rtl"] h5 {
  font-family: 'Noto Kufi Arabic', Tahoma, sans-serif !important;
  font-weight: 500 !important;
  letter-spacing: 0;
}

/* ============================================================
   Nav: real wordmark logo + Join Our Team CTA
   ============================================================ */
.brand.brand-img {
  display: inline-flex;
  align-items: center;
  gap: 0;
}
.brand.brand-img .brand-logo {
  height: 26px;
  width: auto;
  display: block;
}
/* Dark variant hidden by default; specificity raised to beat .brand-img .brand-logo */
.brand.brand-img .brand-logo.brand-logo-dark,
.footer-brand-img .brand-logo.brand-logo-dark { display: none; }

/* Theme swap — app.js sets body.dark */
body.dark .brand.brand-img .brand-logo-light,
body.dark .footer-brand-img .brand-logo-light { display: none; }
body.dark .brand.brand-img .brand-logo.brand-logo-dark,
body.dark .footer-brand-img .brand-logo.brand-logo-dark { display: block; }

/* Footer logo */
.footer-brand-img {
  display: inline-flex !important;
  align-items: center !important;
}
.footer-brand-img .brand-logo {
  height: 22px;
  width: auto;
}

/* Top-right area: now houses lang toggle, theme, AND Join Our Team */
.top-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px 10px 20px;
  background: var(--accent, #C5F443);
  color: #011821 !important;
  border-radius: 999px;
  text-decoration: none;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition: transform 180ms cubic-bezier(.2,0,0,1), background 180ms;
  border: 1px solid rgba(1,24,33,0.06);
  line-height: 1;
}
.nav-cta:hover { background: #ECFF9C; transform: translateY(-1px); text-decoration: none; }
.nav-cta .arrow { transition: transform 220ms cubic-bezier(.2,0,0,1); }
.nav-cta:hover .arrow { transform: translateX(3px); }

@media (max-width: 720px) {
  .nav-cta span:not(.arrow) { display: none; }
  .nav-cta { padding: 10px 14px; }
}

/* ============================================================
   Landing — center hero text + fade tape
   ============================================================ */
.hero .container {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
  max-width: 1100px;
}
.hero .hero-h,
.hero .hero-h .line,
.hero .hero-h .line span {
  text-align: left !important;
}
.hero .hero-sub {
  margin-left: 0 !important;
  margin-right: auto !important;
  max-width: 1200px !important;
  text-align: left !important;
}

/* Hero tape: center horizontally, fade borders + chart */
.hero-tape {
  display: flex;
  justify-content: center;
  margin-left: auto !important;
  margin-right: auto !important;
}
.tape-frame.tape-frame--bare,
.hero-tape .tape-frame {
  margin: 0 auto !important;
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.tape-frame.tape-frame--bare .tape-body {
  border: none !important;
  background: transparent !important;
}
/* Fade row separators inside the tape body */
.tape-frame.tape-frame--bare .tape-row,
.tape-frame.tape-frame--bare [class*="row"] {
  border-color: rgba(1,24,33,0.06) !important;
}
[data-theme="dark"] .tape-frame.tape-frame--bare .tape-row,
[data-theme="dark"] .tape-frame.tape-frame--bare [class*="row"] {
  border-color: rgba(255,255,255,0.06) !important;
}
/* Fade the moving line chart */
.tape-frame.tape-frame--bare .tape-overlay,
#tapeOverlay {
  opacity: 0.22 !important;
}

/* ============================================================
   Who We Are — simplified order book
   ============================================================ */
.book.book--bare .book-tabs,
.book.book--bare .book-header,
.book.book--bare .book-disclaimer {
  display: none !important;
}
.book.book--bare {
  padding-top: 16px;
}

/* ============================================================
   What We Do — center stat columns, four-node loop diagram
   (page-head intentionally inherits shared .page-head / .container
   styling so it matches Who We Are / Careers / Portal exactly.)
   ============================================================ */

/* Stats: center vertically + horizontally in each box */
.stats .stat,
.stats-systems .stat,
.stats-hero .stat {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
}
.stats .stat .v,
.stats-systems .stat .v,
.stats-hero .stat .v {
  justify-content: center !important;
  align-items: baseline !important;
  text-align: center !important;
  width: 100%;
}
.stats .stat .l,
.stats-systems .stat .l,
.stats-hero .stat .l {
  text-align: center !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* Systems block — align prose entries with visual edges.
   Scoped to Block 1 only (`:not(.alt)`) so the research-cols
   columns in Block 2 keep their natural height + top alignment. */
.systems-block .systems-grid {
  align-items: stretch !important;
}
.systems-block:not(.alt) .systems-prose.appear.delay-1 {
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  min-height: 540px;
  gap: 24px;
}
.systems-block:not(.alt) .systems-prose.appear.delay-1 > :first-child,
.systems-block:not(.alt) .systems-prose.appear.delay-1 > :first-child + p {
  margin-top: 0;
}
.systems-block:not(.alt) .systems-prose.appear.delay-1 > h3:last-of-type,
.systems-block:not(.alt) .systems-prose.appear.delay-1 > h3:last-of-type + p {
  margin-top: 32px;
}
/* Second heading sits 32px below the paragraph above it */
.systems-block:not(.alt) .systems-prose.appear.delay-1 h3:nth-of-type(2) {
  margin-top: 32px !important;
}

/* ============================================================
   Four-node Trading-System Loop
   ============================================================ */
.loop-board {
  position: relative;
  width: 100%;
  min-height: 540px;
  aspect-ratio: 800 / 540;
  color: var(--fg, #011821);
  background: linear-gradient(180deg, rgba(1,24,33,0.015), rgba(1,24,33,0.0));
  border-radius: 14px;
  overflow: hidden;
}
[data-theme="dark"] .loop-board {
  color: rgba(255,255,255,0.92);
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0));
}

.loop-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: rgba(1,24,33,0.42);
}
[data-theme="dark"] .loop-svg { color: rgba(255,255,255,0.45); }

.loop-edges line {
  stroke: currentColor;
  stroke-linecap: square;
}

.loop-dot {
  filter: drop-shadow(0 0 8px rgba(197, 244, 67, 0.65));
}

/* Nodes — positioned in % over the SVG viewbox (800×540) */
.loop-node {
  position: absolute;
  width: 32%;
  min-width: 200px;
  padding: 18px 20px;
  background: var(--bg, #fff);
  border: 1px solid rgba(1,24,33,0.12);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(1,24,33,0.05), 0 8px 24px rgba(1,24,33,0.06);
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 2;
}
[data-theme="dark"] .loop-node {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.14);
  box-shadow: 0 1px 2px rgba(0,0,0,0.4), 0 12px 28px rgba(0,0,0,0.3);
}

/* Positions match the SVG corner anchors (110, 110, 430, 430) within 800×540 viewbox.
   The 4 nodes sit centered on the loop corners. */
.loop-node--tl { top:  6.5%;  left:  3%;  transform: translateY(-50%); }
.loop-node--tr { top:  6.5%;  right: 3%;  transform: translateY(-50%); }
.loop-node--bl { bottom: 13.5%; left: 3%; transform: translateY(50%); }
.loop-node--br { bottom: 13.5%; right: 3%; transform: translateY(50%); }

.loop-node-step {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--accent, #C5F443);
  background: rgba(1,24,33,0.92);
  border-radius: 6px;
  padding: 6px 9px;
  line-height: 1;
  flex-shrink: 0;
}
[data-theme="dark"] .loop-node-step { background: #C5F443; color: #011821; }

.loop-node-label {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif !important;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
  letter-spacing: -0.005em;
  text-wrap: balance;
}

.loop-watermark {
  position: absolute;
  right: 22px;
  bottom: 46px;
  width: 56px;
  height: auto;
  opacity: 0.10;
  fill: currentColor;
  pointer-events: none;
}
.loop-watermark rect,
.loop-watermark path { fill: currentColor; }

.loop-disclaimer {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: rgba(1,24,33,0.5);
  margin: 0;
  white-space: nowrap;
}
[data-theme="dark"] .loop-disclaimer { color: rgba(255,255,255,0.5); }

/* Hide the old canvas + label layer if any of it leaks through */
.systems-block #infraCanvas,
.systems-block .infra-labels,
.systems-block .infra-board { display: none !important; }

/* ============================================================
   Careers Portal — left filter panel + right results
   ============================================================ */
#portal .portal > .container { max-width: 1200px; }

#portal .portal-toolbar {
  display: grid !important;
  grid-template-columns: 280px 1fr !important;
  gap: 32px !important;
  align-items: start !important;
}

#portal .portal-search {
  grid-column: 1 / 2 !important;
  width: 100% !important;
  margin-bottom: 16px;
}
#portal .portal-filters {
  grid-column: 1 / 2 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 8px !important;
  padding: 18px !important;
  background: rgba(1,24,33,0.02);
  border: 1px solid rgba(1,24,33,0.08);
  border-radius: 12px;
}
[data-theme="dark"] #portal .portal-filters {
  background: rgba(255,255,255,0.02);
  border-color: rgba(255,255,255,0.08);
}

/* Filter group labels (injected via JS below) */
#portal .portal-filters .filter-group-label {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(1,24,33,0.55);
  margin: 4px 0 6px;
}
[data-theme="dark"] #portal .portal-filters .filter-group-label {
  color: rgba(255,255,255,0.55);
}
#portal .portal-filters .filter-group-label:not(:first-child) { margin-top: 16px; }

#portal .portal-filter {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  width: 100% !important;
  text-align: left !important;
  padding: 9px 12px !important;
  border-radius: 8px !important;
  border: 1px solid rgba(1,24,33,0.10) !important;
  background: transparent !important;
  color: inherit !important;
  cursor: pointer;
  transition: background 160ms, border-color 160ms;
}
#portal .portal-filter::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1.5px solid rgba(1,24,33,0.4);
  background: transparent;
  flex-shrink: 0;
  display: inline-block;
  transition: background 160ms, border-color 160ms;
}
[data-theme="dark"] #portal .portal-filter::before { border-color: rgba(255,255,255,0.4); }
#portal .portal-filter.is-active::before {
  background: var(--accent, #C5F443);
  border-color: #011821;
}
#portal .portal-filter.is-active {
  background: rgba(197,244,67,0.10) !important;
  border-color: rgba(1,24,33,0.18) !important;
}
#portal .portal-filter:hover {
  background: rgba(1,24,33,0.04) !important;
}
[data-theme="dark"] #portal .portal-filter:hover { background: rgba(255,255,255,0.04) !important; }

#portal .portal-results {
  grid-column: 2 / 3 !important;
  grid-row: 1 / span 2 !important;
}

@media (max-width: 860px) {
  #portal .portal-toolbar {
    grid-template-columns: 1fr !important;
  }
  #portal .portal-search,
  #portal .portal-filters,
  #portal .portal-results { grid-column: 1 / -1 !important; }
}

/* ============================================================
   Footer logo sizing & misc
   ============================================================ */
.loader-emblem .lp { fill: currentColor; }
