/* Marble Capital — shared hand-written CSS.
   Anything Tailwind utilities can't express cleanly lives here:
   panel gradients, the geometric motif, button/badge/card variants,
   the allocation bar, the marquee, and the hero's Ken Burns / fade-up keyframes.
   Loaded on every page after the Tailwind CDN + inline config. */

:root {
  --navy-950: #070C1E;
  --navy-900: #0B1330;
  --navy-700: #142355;
  --navy-400: #5E60A0;
  --navy-200: #C4CBE4;
  --navy-100: #E3E7F3;
  --navy-50:  #F2F4FA;
  --orange-700: #B8600A;
  --orange-500: #F5941F;
  --orange-300: #F0B65E;
  --orange-100: #FFE8CE;
  --paper: #FAFAF8;
}

/* ---------- Base ---------- */
body { font-family: 'Inter', sans-serif; }
h1, h2, h3, .font-display { font-family: 'Fraunces', serif; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
body { background: var(--paper); }

/* Visible focus ring on every interactive element — never suppressed. */
:focus-visible {
  outline: 2px solid var(--orange-500);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 100;
  background: #fff;
  color: var(--navy-900);
  padding: 0.65rem 1.1rem;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.875rem;
  transition: top 0.15s ease;
  box-shadow: 0 4px 14px rgba(7, 12, 30, 0.18);
}
.skip-link:focus {
  top: 1rem;
}

/* ---------- Prose width rule ---------- */
.prose-narrow { max-width: 65ch; }

/* ---------- Dark panel gradient ---------- */
.marble-panel {
  background: linear-gradient(160deg, var(--navy-950) 0%, var(--navy-900) 55%, var(--navy-950) 100%);
}

/* Hero scrim: strong at the reading edge (left), fading toward the detail (right). */
.hero-scrim {
  background: linear-gradient(100deg,
    rgba(7, 12, 30, 0.94) 0%,
    rgba(7, 12, 30, 0.80) 32%,
    rgba(7, 12, 30, 0.42) 62%,
    rgba(7, 12, 30, 0.12) 100%);
}

/* ---------- Geometric motif ----------
   Eight-point star lattice (two overlapping squares, one rotated 45deg) at ~7% opacity.
   Applied as a repeating background layer over dark navy panels — texture, not decoration. */
.geo-motif {
  position: relative;
  isolation: isolate;
}
.geo-motif::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.07;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23FFFFFF' stroke-width='1'%3E%3Crect x='30' y='30' width='60' height='60'/%3E%3Crect x='30' y='30' width='60' height='60' transform='rotate(45 60 60)'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 120px 120px;
}
.geo-motif > * { position: relative; z-index: 1; }

/* ---------- Buttons ----------
   One shape — a full pill — for every CTA. Weight/fill signal hierarchy, not shape.
   Rule: .btn-primary and .btn-on-dark-primary never appear twice in the same view. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.75rem;
  border-radius: 9999px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1;
  white-space: nowrap;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }
.btn[disabled]:hover { background: var(--orange-500); }

/* Light-surface buttons */
.btn-primary {
  background: var(--navy-700);
  color: #fff;
}
.btn-primary:hover { background: var(--navy-900); }

.btn-outline {
  background: transparent;
  color: var(--navy-700);
  border: 1.5px solid var(--navy-700);
}
.btn-outline:hover { background: var(--navy-50); }

/* Dark-panel buttons */
.btn-on-dark-primary {
  background: var(--orange-500);
  color: var(--navy-950);
}
.btn-on-dark-primary:hover { background: var(--orange-300); }

.btn-on-dark-outline {
  background: transparent;
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.65);
}
.btn-on-dark-outline:hover { background: rgba(255, 255, 255, 0.1); }

/* ---------- Cards & panels ---------- */
.card-standard {
  background: #fff;
  border: 1px solid var(--navy-100);
  border-radius: 18px;
}
.card-featured {
  background: var(--navy-900);
  color: #fff;
  border-radius: 18px;
}
.card-frosted {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 18px;
  color: #fff;
}

/* Dashed photo placeholder — kept until real photography replaces it. */
.photo-slot {
  border: 1.5px dashed var(--navy-200);
  border-radius: 18px;
  background: var(--navy-50);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--navy-400);
  font-size: 0.875rem;
  padding: 1.5rem;
}

/* ---------- Icon chips ----------
   Line icons, 24x24, inside a soft circular chip. Rotates 45deg on hover — the
   one consistent micro-interaction, used on every "learn more" / card link. */
.icon-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  background: var(--navy-50);
  color: var(--navy-700);
  flex-shrink: 0;
  transition: transform 0.2s ease, background-color 0.2s ease;
}
.icon-chip--on-dark {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
a:hover .icon-chip,
a:focus-visible .icon-chip,
button:hover .icon-chip,
button:focus-visible .icon-chip {
  transform: rotate(45deg);
}
@media (prefers-reduced-motion: reduce) {
  a:hover .icon-chip, a:focus-visible .icon-chip,
  button:hover .icon-chip, button:focus-visible .icon-chip { transform: none; }
}

/* ---------- Risk badges ----------
   Ascending fill weight, light to dark navy, as risk falls: Aggressive keeps the
   one permitted orange badge fill; Moderate and Conservative step through navy. */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge-aggressive { background: var(--orange-100); color: var(--orange-700); }
.badge-moderate    { background: var(--navy-100); color: var(--navy-700); }
.badge-conservative{ background: var(--navy-700); color: #fff; }

/* Eyebrow label */
.eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--orange-700);
}
.eyebrow--on-dark { color: var(--orange-500); }

/* ---------- Allocation bar ----------
   Three-segment bar: Commodities / Equities / Fixed Income. Used on every
   portfolio, the mutual funds page, and the Asset Management comparison table.
   Never a pie chart — this has to scale down to a table row. */
.allocation-bar {
  display: flex;
  width: 100%;
  height: 0.5rem;
  border-radius: 9999px;
  overflow: hidden;
  background: var(--navy-100);
}
.allocation-bar__segment--commodities { background: var(--orange-300); }
.allocation-bar__segment--equities    { background: var(--navy-700); }
.allocation-bar__segment--fixed-income{ background: var(--navy-200); }

.allocation-legend { display: flex; align-items: center; gap: 1.25rem; font-size: 0.8125rem; color: var(--navy-400); }
.allocation-legend__dot { width: 0.55rem; height: 0.55rem; border-radius: 9999px; display: inline-block; margin-right: 0.4rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 250, 248, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--navy-100);
}

/* Desktop mega-menu: opens on hover and on keyboard focus-within. */
.mega-menu {
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  pointer-events: none;
}
.nav-item:hover .mega-menu,
.nav-item:focus-within .mega-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

/* Mobile accordion */
.mobile-submenu { display: none; }
.mobile-submenu.is-open { display: block; }
.accordion-trigger[aria-expanded="true"] .accordion-chevron { transform: rotate(180deg); }
.accordion-chevron { transition: transform 0.18s ease; }

/* ---------- Reading progress bar ----------
   A thin, brand-coloured strip across the very top of the viewport that
   fills as the visitor scrolls down the page. Sits above the sticky header. */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--orange-500), var(--orange-300));
  z-index: 70;
  transition: width 0.1s linear;
}
@media (prefers-reduced-motion: reduce) {
  #scroll-progress { transition: none; }
}

/* ---------- Back to top ---------- */
#back-to-top {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 55;
  width: 3rem;
  height: 3rem;
  border-radius: 9999px;
  background: var(--navy-700);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px -8px rgba(7, 12, 30, 0.45);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s, background-color 0.2s ease;
}
#back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
#back-to-top:hover { background: var(--navy-900); }
@media (prefers-reduced-motion: reduce) {
  #back-to-top { transition: opacity 0.01s ease, visibility 0.01s; }
}

/* ---------- Site search ----------
   A full-width panel that drops down from beneath the sticky header,
   toggled by the search icon in the nav button group. */
.site-search-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  background: #fff;
  border-bottom: 1px solid var(--navy-100);
  box-shadow: 0 16px 32px -16px rgba(7, 12, 30, 0.25);
  z-index: 49;
}
.site-search-result {
  display: block;
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
  color: var(--navy-900);
}
.site-search-result:hover,
.site-search-result:focus-visible {
  background: var(--navy-50);
}
.site-search-result .site-search-result__meta {
  color: var(--navy-400);
  font-size: 0.8125rem;
}

/* ---------- Partner marquee ----------
   Auto-scrolls continuously; pauses on hover or keyboard focus (WCAG 2.2.2). */
.marquee {
  overflow: hidden;
  position: relative;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee__track {
  display: flex;
  width: max-content;
  gap: 3.5rem;
  align-items: center;
  animation: marquee-scroll 32s linear infinite;
}
.marquee:hover .marquee__track,
.marquee:focus-within .marquee__track {
  animation-play-state: paused;
}
@keyframes marquee-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ---------- Hero motion ---------- */
.hero-photo {
  animation: hero-kenburns 24s ease-in-out infinite alternate;
}
@keyframes hero-kenburns {
  from { transform: scale(1.0); }
  to   { transform: scale(1.08); }
}

/* ---------- Hero background slider ----------
   Four photos crossfade in a slow 24s cycle (6s each), each also drifting into a
   gentle Ken Burns zoom during its own visible window (delay keeps zoom + fade in
   sync per slide). The .hero-scrim gradient sits above this, unchanged. */
.hero-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  animation: hero-slide-cycle 24s infinite, hero-slide-zoom 24s infinite;
  animation-timing-function: ease-in-out, linear;
}
.hero-slide:nth-child(2) { animation-delay: 6s, 6s; }
.hero-slide:nth-child(3) { animation-delay: 12s, 12s; }
.hero-slide:nth-child(4) { animation-delay: 18s, 18s; }

@keyframes hero-slide-cycle {
  0%    { opacity: 0; }
  3%    { opacity: 1; }
  22.5% { opacity: 1; }
  27%   { opacity: 0; }
  100%  { opacity: 0; }
}
@keyframes hero-slide-zoom {
  0%   { transform: scale(1.0); }
  100% { transform: scale(1.08); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-slide { animation: none; opacity: 0; transform: none; }
  .hero-slide:first-child { opacity: 1; }
}

/* ---------- Hero video slider (Home page) ----------
   Three looping background videos crossfade in turn, cycled by site.js via
   the .is-active class. The first video always paints immediately (its
   poster image covers the load gap); the other two fade in on their turn. */
.hero-video-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.hero-video-slide.is-active { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .hero-video-slide { transition: none; }
}

.fade-up {
  opacity: 0;
  transform: translateY(14px);
  animation: fade-up 0.6s ease forwards;
}
@keyframes fade-up {
  to { opacity: 1; transform: translateY(0); }
}
.fade-up-1 { animation-delay: 0.1s; }
.fade-up-2 { animation-delay: 0.2s; }
.fade-up-3 { animation-delay: 0.3s; }
.fade-up-4 { animation-delay: 0.4s; }

/* Every animation resolves to its end state under reduced motion — no exceptions. */
@media (prefers-reduced-motion: reduce) {
  .hero-photo { animation: none; transform: scale(1); }
  .fade-up, .fade-up-1, .fade-up-2, .fade-up-3, .fade-up-4 {
    animation: none; opacity: 1; transform: none;
  }
  .marquee__track { animation: none; }
}

/* ---------- Scroll reveal (Home page) ----------
   Sections/grids fade up into view as the visitor scrolls, driven by the
   IntersectionObserver in site.js via the .reveal / .reveal-group hooks.
   .reveal-group staggers its direct children. Resolves instantly, with no
   animation, under reduced motion. */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-group > * {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal-group.is-visible > * { opacity: 1; transform: translateY(0); }
.reveal-group.is-visible > *:nth-child(1) { transition-delay: 0s;    }
.reveal-group.is-visible > *:nth-child(2) { transition-delay: 0.09s; }
.reveal-group.is-visible > *:nth-child(3) { transition-delay: 0.18s; }
.reveal-group.is-visible > *:nth-child(4) { transition-delay: 0.27s; }
.reveal-group.is-visible > *:nth-child(5) { transition-delay: 0.36s; }
.reveal-group.is-visible > *:nth-child(6) { transition-delay: 0.45s; }
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal-group > * { opacity: 1; transform: none; transition: none; }
}

/* ---------- YTD performance bars (Home page) ----------
   Replaces the old static chart image. Widths are set by assets/js/api.js
   from the live pricing feed (falling back to the same figures already
   quoted elsewhere on the site if the feed is unreachable) and animate in
   once the chart scrolls into view. */
.ytd-bar-track {
  height: 0.625rem;
  border-radius: 9999px;
  background: var(--navy-100);
  overflow: hidden;
}
.ytd-bar-fill {
  display: block;
  height: 100%;
  border-radius: 9999px;
  width: 0%;
  background: linear-gradient(90deg, var(--orange-300), var(--orange-500));
  transition: width 1s cubic-bezier(0.22, 0.9, 0.3, 1);
}
@media (prefers-reduced-motion: reduce) {
  .ytd-bar-fill { transition: none; }
}

/* ---------- Profile teasers (team / board bio cards) ----------
   Every bio is a different length, but the visible teaser before "Read full
   profile" is clamped to the same number of lines and reserves that same
   space even when a bio is short — so every card in a row/grid lines up and
   the toggle always sits in the same place. The rest of the bio only shows
   once a visitor opens it. */
.profile-teaser {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.6em;
}
/* Narrow multi-column cards (management-team.html's 4-up grid). */
.profile-teaser--grid {
  -webkit-line-clamp: 5;
  min-height: 8em;
}
/* Wide single-column cards (shariah-board.html's photo + bio rows). */
.profile-teaser--wide {
  -webkit-line-clamp: 2;
  min-height: 3.2em;
}
