/* ==========================================================================
   Majorney — brand mark effects + loading screen
   Shared by index.html and climb.html. Loaded AFTER the page's own stylesheet
   so it can build on .nav-brand without either page needing to know about it.
   Colours are written with var() fallbacks because the two pages define their
   palettes under slightly different names.
   ========================================================================== */

:root {
  --brand-gold: var(--gold, #d4af6a);
  --brand-gold-bright: var(--gold-bright, #f0cf8e);
}

/* ==========================================================================
   1. The logo effect
   The mark is a circular image, so the effect is built from two rings around
   it: a slow conic aura that orbits on its own, and a sheen that sweeps
   across the glass on hover. Idle stays quiet — it's a nav logo, not a
   centrepiece — and the brighter half only happens on hover.
   ========================================================================== */

.brand-mark {
  position: relative;
  display: inline-flex;
  flex: none;
  border-radius: 50%;
  isolation: isolate;
}

/* Orbiting gold aura, blurred out past the edge of the mark. */
.brand-mark::before {
  content: "";
  position: absolute;
  inset: -5px;
  z-index: -1;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    rgba(212, 175, 106, 0) 0deg,
    var(--brand-gold-bright) 70deg,
    rgba(212, 175, 106, 0.18) 150deg,
    rgba(212, 175, 106, 0) 210deg,
    var(--brand-gold) 300deg,
    rgba(212, 175, 106, 0) 360deg
  );
  filter: blur(5px);
  opacity: 0.5;
  animation: brand-orbit 7s linear infinite;
  transition: opacity 0.35s ease, filter 0.35s ease;
}

/* Sheen — parked off the top-right corner until hover walks it across. */
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  background: linear-gradient(
    118deg,
    transparent 34%,
    rgba(255, 255, 255, 0.5) 47%,
    rgba(240, 207, 142, 0.42) 55%,
    transparent 70%
  );
  background-size: 260% 260%;
  background-position: 150% 50%;
  opacity: 0;
}

.brand-mark img {
  position: relative;
  z-index: 1;
  border-radius: 50%;
  filter: drop-shadow(0 0 5px rgba(212, 175, 106, 0.28));
  animation: brand-breathe 4.6s ease-in-out infinite;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), filter 0.35s ease;
}

/* Hover lives on the whole brand link, so hovering the wordmark lights the
   mark too — they read as one object. */
.nav-brand:hover .brand-mark::before,
a:hover > .brand-mark::before {
  opacity: 1;
  filter: blur(7px);
  animation-duration: 2.6s;
}

.nav-brand:hover .brand-mark::after,
a:hover > .brand-mark::after {
  animation: brand-sheen 0.85s ease-out;
}

.nav-brand:hover .brand-mark img,
a:hover > .brand-mark img {
  transform: scale(1.09) rotate(-6deg);
  filter: drop-shadow(0 0 12px rgba(240, 207, 142, 0.55));
  animation-play-state: paused;
}

@keyframes brand-orbit {
  to { transform: rotate(360deg); }
}

@keyframes brand-breathe {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(212, 175, 106, 0.22)); }
  50%      { filter: drop-shadow(0 0 10px rgba(212, 175, 106, 0.45)); }
}

@keyframes brand-sheen {
  0%   { opacity: 0;   background-position: 150% 50%; }
  18%  { opacity: 1; }
  100% { opacity: 0;   background-position: -60% 50%; }
}

/* ==========================================================================
   2. Loading screen
   Covers the page until window.load (loader.js pulls it). It is visible by
   default in CSS so there's no flash of unstyled page before the script runs;
   the <noscript> block in each page hides it when scripts are off.
   ========================================================================== */

body.is-loading {
  overflow: hidden;
}

.loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(60% 50% at 50% 44%, rgba(212, 175, 106, 0.09), transparent 70%),
    #000;
  transition: opacity 0.7s ease, visibility 0.7s ease;
}

/* loader.js adds this once the page is ready. */
.loader.is-done {
  opacity: 0;
  visibility: hidden;
}

.loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  padding: 0 24px;
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.5s ease;
}

.loader.is-done .loader-inner {
  transform: translateY(-14px) scale(0.97);
  opacity: 0;
}

/* --- the spinning mark ---------------------------------------------------- */

.loader-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 148px;
  height: 148px;
}

.loader-mark img {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  filter: drop-shadow(0 0 18px rgba(212, 175, 106, 0.4));
  /* Eased rather than linear, so each turn lands like a coin settling
     instead of reading as a generic spinner. */
  animation: loader-spin 2.6s cubic-bezier(0.62, 0.05, 0.32, 0.98) infinite;
}

/* Two open arcs orbiting the mark in opposite directions. */
.loader-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid transparent;
  border-top-color: var(--brand-gold-bright);
  border-right-color: rgba(212, 175, 106, 0.22);
  animation: loader-spin 1.15s linear infinite;
}

.loader-ring-outer {
  inset: 0;
  border-width: 1px;
  border-top-color: rgba(240, 207, 142, 0.55);
  border-left-color: rgba(212, 175, 106, 0.14);
  animation-duration: 2.9s;
  animation-direction: reverse;
}

.loader-ring-inner {
  inset: 22px;
}

/* Soft pool of light under the whole thing. */
.loader-mark::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 175, 106, 0.2), transparent 68%);
  animation: loader-pulse 2.6s ease-in-out infinite;
}

/* --- wordmark + progress -------------------------------------------------- */

.loader-word {
  font-family: var(--font-brand, "IBM Plex Serif", Georgia, serif);
  font-size: 20px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fff;
}

.loader-sub {
  margin-top: -14px;
  font-family: var(--font-sans, "Inter", system-ui, sans-serif);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--brand-gold);
  opacity: 0.75;
}

.loader-bar {
  position: relative;
  width: 148px;
  height: 2px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.loader-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 42%;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--brand-gold-bright), transparent);
  animation: loader-sweep 1.5s ease-in-out infinite;
}

@keyframes loader-spin {
  to { transform: rotate(360deg); }
}

@keyframes loader-pulse {
  0%, 100% { opacity: 0.45; transform: scale(0.94); }
  50%      { opacity: 1;    transform: scale(1.06); }
}

@keyframes loader-sweep {
  0%   { left: -45%; }
  100% { left: 100%; }
}

@media (max-width: 520px) {
  .loader-mark { width: 124px; height: 124px; }
  .loader-mark img { width: 70px; height: 70px; }
  .loader-ring-inner { inset: 18px; }
}

/* ==========================================================================
   3. Reduced motion — keep the look, drop the spinning
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .brand-mark::before,
  .brand-mark img,
  .loader-mark img,
  .loader-ring,
  .loader-mark::after,
  .loader-bar i {
    animation: none !important;
  }

  .brand-mark::before { opacity: 0.75; }
  .loader-bar i { width: 100%; opacity: 0.6; }

  .nav-brand:hover .brand-mark img,
  a:hover > .brand-mark img {
    transform: scale(1.05);
  }
}
