/* ============================================================
   PURPLE EPHRA AGENCIES — SPA OS UI
   Arched dock · Big Header · Seamless Fade · Pure CQW/CQH
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,300&family=Space+Grotesk:wght@400;500;600;700;800&display=swap');

:root {
  --bg:           #0B0515;
  --surface:      rgba(30, 15, 55, 0.45);
  --gold:         #D4AF37;
  --gold-dim:     rgba(212, 175, 55, 0.18);
  --gold-glow:    rgba(212, 175, 55, 0.35);
  --purple-mid:   rgba(58, 14, 92, 0.5);
  --accent:       #8E54E9;
  --text:         #FFFFFF;
  --muted:        #FFFFFF;
  --dock-height:  calc(clamp(90px, 14vh, 120px) + env(safe-area-inset-bottom, 0px));
  --header-height:clamp(80px, 12vh, 120px);

  /* Icon scale cascade following arch curve: home=100%, adj=90%, outer=67% */
  --icon-home:    clamp(36px, 6vw, 50px);
  --icon-adj:     clamp(26px, 4.8vw, 40px);   /* 90% of home */
  --icon-outer:   clamp(20px, 3.8vw, 32px);      /* 67% of home */
  
  --wrap-home:    clamp(72px, 11vw, 96px);
  --wrap-adj:     clamp(54px, 10vw, 86px);     /* 90% of home */
  --wrap-outer:   clamp(40px, 7.4vw, 64px);    /* 67% of home */
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100vw; height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-smooth: always;
}

/* ── Global Hero Background Image ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image: url('purpleephra.png');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  opacity: 0;
  animation: bgCinematicFadeIn 3.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes bgCinematicFadeIn {
  0% {
    opacity: 0;
    transform: scale(1.08);
  }
  100% {
    opacity: 0.18;
    transform: scale(1);
  }
}

/* ── Dark Purple Dimming Overlay (sits on top of image) ── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(11,5,21,0.72) 0%, transparent 70%),
    radial-gradient(ellipse 100% 80% at 50% 50%, rgba(11,5,21,0.55) 0%, transparent 100%),
    radial-gradient(ellipse 60% 40% at 50% 110%, rgba(11,5,21,0.7) 0%, transparent 60%);
  pointer-events: none;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
h1,h2,h3,h4 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

/* ── App Shell ── */
.app-shell {
  width: 100vw;
  height: 100dvh;
  display: grid;
  grid-template-rows: var(--header-height) 1fr;
  overflow: hidden;
  position: relative;
}

/* ── BIG HEADER ── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 10;
  padding: clamp(1rem, 3vh, 2rem) clamp(1.5rem, 5vw, 4rem);
  opacity: 0;
  transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}
.header-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.3rem, 1vh, 0.6rem);
  animation: floatBrand 8s ease-in-out infinite;
}
@keyframes floatBrand {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(5px); }
}
.brand-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 800;
  font-size: clamp(2.5rem, 7vw, 4.5rem);
  letter-spacing: -0.04em;
  color: var(--text);
  text-align: center;
  line-height: 1.0;
}
.brand-tagline {
  font-size: clamp(0.85rem, 1.8vw, 1.2rem);
  font-weight: 500;
  color: var(--gold);
  letter-spacing: 0.02em;
  text-align: center;
  opacity: 0.9;
}

/* ── CONTENT AREA with Seamless Fade Mask ── */
.app-main {
  position: relative;
  z-index: 5;
  overflow-y: auto;
  overflow-x: hidden;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1.5rem, 5vw, 5rem) calc(var(--dock-height) + clamp(1rem, 3vw, 2rem));
  display: flex;
  flex-direction: column;
  /* Seamless fade: top bleeds into header, bottom curved mist into dock */
  -webkit-mask-image: 
    linear-gradient(to bottom, transparent 0%, black 4%, black 100%),
    radial-gradient(150% calc(var(--dock-height) + 120px) at 50% 100%, transparent 0%, transparent 10%, rgba(0,0,0,0.15) 30%, black 65%);
  -webkit-mask-composite: source-in;
  mask-image: 
    linear-gradient(to bottom, transparent 0%, black 4%, black 100%),
    radial-gradient(150% calc(var(--dock-height) + 120px) at 50% 100%, transparent 0%, transparent 10%, rgba(0,0,0,0.15) 30%, black 65%);
  mask-composite: intersect;
  /* Container query context */
  container-type: inline-size;
  container-name: main;
  scroll-behavior: smooth;
  opacity: 0;
  transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}
.app-main::-webkit-scrollbar { display: none; }

/* ── ARCHED FULL-WIDTH BOTTOM DOCK ── */
.arch-dock {
  position: absolute;
  bottom: 0;
  left: 0;
  z-index: 10;
  width: 100vw;
  height: var(--dock-height);
  overflow: visible;
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1), transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}
.arch-svg {
  position: absolute;
  bottom: 0; left: 0;
  width: 100%; height: 100%;
  /* Soft cutout in the center for the Home button/PE logo to shine through */
  -webkit-mask-image: radial-gradient(circle at 50% var(--arch-peak-y, 20%), rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.15) clamp(30px, 5vw, 40px), black clamp(90px, 12vw, 120px));
  mask-image: radial-gradient(circle at 50% var(--arch-peak-y, 20%), rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.15) clamp(30px, 5vw, 40px), black clamp(90px, 12vw, 120px));
}

.dock-items {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;       /* anchor to absolute bottom */
  justify-content: center;
  gap: clamp(0.1rem, 2.5vw, 2rem);
  padding: 0 clamp(0.5rem, 2vw, 2rem);
  padding-bottom: calc(clamp(2px, 0.5vh, 6px) + env(safe-area-inset-bottom, 0px));
  z-index: 2;
  width: 100%;
}

/* Outer items: Portfolio, Contact — smallest (90% of home) */
.dock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end; /* anchor to bottom */
  gap: clamp(2px, 0.5vh, 5px);
  color: var(--muted);
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(0.7rem, 1.3vw, 0.85rem); /* Bigger labels */
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  flex: 1;
  height: 67%;
}
.dock-item:hover { color: var(--text); }
.dock-item.active { color: var(--gold); }

.dock-icon-wrap {
  /* Outer size (default) */
  width: var(--wrap-outer);
  height: var(--wrap-outer);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}
.dock-item.active .dock-icon-wrap {
  background: transparent;
  filter: drop-shadow(0 0 8px var(--gold));
}
.dock-item:not(.dock-home):hover .dock-icon-wrap {
  background: transparent;
  transform: translateY(-3px);
}
.dock-item:not(.dock-home):active .dock-icon-wrap {
  transform: scale(0.85) translateY(2px);
  transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}
.dock-icon {
  /* Outer icon size */
  width: var(--icon-outer);
  height: var(--icon-outer);
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.dock-item.active:not(.dock-home) .dock-icon { stroke-width: 2.5; }

/* Adjacent items: Services, Compliance — 5% bigger than outer */
.dock-item.dock-adj .dock-icon-wrap {
  width: var(--wrap-adj);
  height: var(--wrap-adj);
}
.dock-item.dock-adj .dock-icon {
  width: var(--icon-adj);
  height: var(--icon-adj);
}
.dock-item.dock-adj {
  font-size: clamp(0.75rem, 1.4vw, 0.9rem);
  height: 90%;
}

/* HOME — Elevated center, biggest */
.dock-home {
  flex: 1.5;
  position: relative;
  color: var(--gold);
  justify-content: flex-end;
  height: 100%;
}
.dock-home-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(3px, 0.6vh, 7px);
}
.dock-icon-home {
  width: var(--wrap-home);
  height: var(--wrap-home);
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.dock-home .dock-icon {
  stroke: var(--gold);
  width: var(--icon-home);
  height: var(--icon-home);
  stroke-width: 2.5;
  filter: drop-shadow(0 0 8px var(--gold));
}
.dock-home:hover .dock-icon-home {
  transform: scale(1.1) translateY(-5px);
}
.dock-home:active .dock-icon-home {
  transform: scale(0.9) translateY(0);
  transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}
.dock-home.active .dock-icon-home {
  filter: drop-shadow(0 0 8px var(--gold));
}
.dock-home span {
  font-size: clamp(0.8rem, 1.5vw, 1rem);
  font-weight: 700;
  color: var(--gold);
}

/* ── Glass Cards ── */
.glass-card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: clamp(16px, 3cqw, 32px);
  padding: clamp(1.5rem, 4cqw, 3rem);
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  position: relative;
}
.glass-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212,175,55,0.3), transparent);
  opacity: 0;
  transition: opacity 0.4s ease;
}
.glass-card:hover {
  border-color: rgba(255,255,255,0.12);
  background: rgba(45, 20, 80, 0.6);
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 24px 48px rgba(0,0,0,0.4);
}
.glass-card:hover::before { opacity: 1; }

/* ── Typography ── */
.label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(0.7rem, 1.4cqw, 0.85rem);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  display: block;
  margin-bottom: clamp(0.5rem, 1.5cqw, 1rem);
}
.title-xl {
  font-size: clamp(2.5rem, 9cqw, 7rem);
  line-height: 1.0;
  letter-spacing: -0.04em;
  margin-bottom: clamp(1rem, 3cqw, 2.5rem);
}
.title-lg {
  font-size: clamp(2rem, 6cqw, 5rem);
  letter-spacing: -0.035em;
  margin-bottom: clamp(1.5rem, 4cqw, 3rem);
}
.title-md {
  font-size: clamp(1.15rem, 2.5cqw, 1.9rem);
  margin-bottom: clamp(0.5rem, 1.5cqw, 1rem);
}
.text-body {
  color: var(--muted);
  font-size: clamp(0.95rem, 1.7cqw, 1.25rem);
  line-height: 1.75;
  margin-bottom: clamp(1rem, 3cqw, 2rem);
  font-weight: 500;
  max-width: 70cqw;
}
.text-gold { color: var(--gold); }
.text-sm {
  font-size: clamp(0.75rem, 1.2cqw, 0.95rem);
  color: var(--muted);
}

/* ── Grid ── */
.grid { display: grid; gap: clamp(1rem, 2.5cqw, 2.5rem); grid-template-columns: 1fr; }
@container main (min-width: 540px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
}
@container main (min-width: 800px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

/* ── Tags ── */
.tag {
  display: inline-block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(0.62rem, 1.1cqw, 0.78rem);
  font-weight: 700;
  color: #B28DFF;
  background: rgba(142, 84, 233, 0.1);
  padding: 0.35rem 1rem;
  border-radius: 100px;
  border: 1px solid rgba(142, 84, 233, 0.22);
  margin-right: 0.4rem;
  margin-bottom: 0.4rem;
}
.tag-gold {
  color: var(--gold);
  background: var(--gold-dim);
  border-color: rgba(212,175,55,0.3);
}

/* ── Button ── */
.btn-primary {
  background: var(--gold);
  color: var(--bg);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 800;
  font-size: clamp(0.9rem, 1.6cqw, 1.2rem);
  padding: clamp(0.85rem, 2cqw, 1.25rem) clamp(2rem, 4cqw, 4rem);
  border-radius: 100px;
  display: inline-flex; align-items: center; gap: 0.75rem;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 0 15px var(--gold-dim), inset 0 0 10px rgba(255,255,255,0.4);
}
.btn-primary:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 0 35px var(--gold-glow), 0 10px 25px rgba(212,175,55,0.4), inset 0 0 15px rgba(255,255,255,0.6);
  background: linear-gradient(135deg, var(--gold), #F5DC72);
}

/* ── Views ── */
.view {
  animation: viewIn 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  width: 100%;
  margin: auto auto;
}
@keyframes viewIn {
  0%   { opacity: 0; transform: translateY(clamp(16px, 4cqh, 50px)) scale(0.98); filter: blur(6px); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

/* ── Skeletons ── */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.02) 25%, rgba(255,255,255,0.07) 50%, rgba(255,255,255,0.02) 75%);
  background-size: 200% 100%;
  animation: shimmer 2s ease infinite;
  border-radius: 8px;
}
.skel-label  { height: clamp(0.8rem, 1.5cqw, 1rem); width: 20cqw; margin-bottom: clamp(0.5rem, 1.5cqw, 1rem); }
.skel-title  { height: clamp(2.5rem, 7cqw, 5rem); width: 80cqw; margin-bottom: clamp(1rem, 3cqw, 2rem); }
.skel-body   { height: clamp(1rem, 1.8cqw, 1.3rem); width: 70cqw; margin-bottom: 0.75rem; }
.skel-body-sm{ height: clamp(1rem, 1.8cqw, 1.3rem); width: 50cqw; margin-bottom: clamp(1.5rem, 4cqw, 3rem); }
.skel-card   { height: clamp(180px, 25cqh, 280px); width: 100%; border-radius: clamp(16px, 3cqw, 32px); }

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}


/* ── Cinematic Preloader ── */
.preloader {
  container-type: inline-size;
  position: fixed; inset: 0;
  background: transparent;
  z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding-top: 55vh;
  gap: clamp(1.25rem, 3vh, 2.5rem);
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}
.preloader.hidden { opacity: 0; pointer-events: none; }

/* Text Stage */
.loader-text-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  width: 70cqw;
  max-width: 1200px;
}

/* The single unified row of morph words */
.morph-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  width: max-content;
  gap: clamp(0.4rem, 1.5vw, 1.2rem);
  transition: opacity 0.7s ease, filter 0.7s ease, transform 0.7s ease;
}

/* Each word block */
.morph-word {
  display: flex;
  align-items: baseline;
  overflow: visible;
  max-width: 1000px;
  transition: max-width 0.8s ease, opacity 0.8s ease, filter 0.8s ease, transform 0.8s ease;
}

/* Anchor letter: P, E, A — always visible */
.morph-anchor {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 900;
  font-size: clamp(1.8rem, 5.5vw, 7rem);
  color: var(--gold);
  letter-spacing: -0.02em;
  line-height: 1;
  text-shadow: 0 0 30px var(--gold-glow);
  animation: anchorPulse 1.8s ease-in-out infinite alternate;
  flex-shrink: 0;
}
.morph-word:nth-child(2) .morph-anchor { animation-delay: 0.2s; }
.morph-word:nth-child(3) .morph-anchor { animation-delay: 0.4s; }

@keyframes anchorPulse {
  0%   { text-shadow: 0 0 15px var(--gold-dim); }
  100% { text-shadow: 0 0 55px var(--gold-glow); }
}

/* Suffix letters wrapper */
.morph-suffix {
  display: inline-flex;
  overflow: hidden;
  max-width: 0;
  padding: 1.2em 0;
  margin: -1.2em 0;
  /* Sudden, snappy whip */
  transition: max-width 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1);
}

/* Individual letters */
.morph-suffix span {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 900;
  font-size: clamp(1.8rem, 5.5vw, 7rem);
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1;
  opacity: 0;
  transform: translateX(-15px) scale(0.9);
  filter: blur(4px);
  display: inline-block;
  transition:
    opacity 0.25s ease,
    transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    filter 0.2s ease;
}

/* Expanded state — wrapper opens fast */
.morph-suffix.expanded {
  max-width: 2500px;
}

/* Expanded state — letters slide in fast */
.morph-suffix.expanded span {
  opacity: 1;
  transform: translateX(0) scale(1);
  filter: blur(0);
}

/* Evaporate: container shrinks to slide remaining text to absolute center */
.morph-word.evaporate-container {
  max-width: 0;
  margin-left: 0;
  margin-right: 0;
  transition: max-width 0.6s cubic-bezier(0.1, 0.9, 0.3, 1) 0.1s;
}

/* Individual letters vanish one by one from right to left */
.evaporate-letter {
  opacity: 0 !important;
  transform: translateX(-15px) scale(0.5) !important;
  filter: blur(8px) !important;
  transition: all 0.3s ease !important;
}

/* ── Unified SVG Seekbar ── */
.seekbar-track {
  height: 20px;
  position: relative;
  overflow: visible;
}
.spiral-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  overflow: visible;
  mix-blend-mode: screen;
}
.spiral-canvas path {
  will-change: stroke-dashoffset;
}
.seekbar-comet {
  position: absolute;
  top: 0; left: 0;
  width: clamp(30px, 6vw, 60px);
  height: clamp(6px, 1vw, 8px);
  background: linear-gradient(90deg, transparent, var(--gold), #FFF);
  border-radius: 10px;
  box-shadow:
    0 0 15px var(--gold-glow),
    0 0 30px var(--gold-dim),
    -15px 0 40px rgba(212,175,55,0.4),
    -30px 0 60px rgba(212,175,55,0.2);
  will-change: transform;
  mix-blend-mode: screen;
  transition: opacity 0.15s ease;
  transform-origin: right center;
  pointer-events: none;
}
.seekbar-comet.mini-comet {
  width: clamp(15px, 3vw, 25px);
  height: clamp(3px, 0.5vw, 4px);
  box-shadow:
    0 0 10px var(--gold-glow),
    0 0 20px rgba(212,175,55,0.5),
    -10px 0 30px rgba(212,175,55,0.3);
}

/* ── Flash Overlay ── */
#flash-overlay {
  position: fixed; inset: 0;
  background: #FFF;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
}

/* ── Orb Particles ── */
.orb {
  position: absolute;
  background: var(--gold);
  border-radius: 50%;
  filter: blur(2px);
}

/* ── Comet Confetti Burst ── */
.particle-x {
  position: absolute;
  /* position set entirely by JS */
  animation: curveX var(--dur) linear forwards;
  z-index: 10;
}
.particle-y {
  width: var(--size);
  height: var(--size);
  background: var(--bg-color, var(--gold));
  clip-path: polygon(50% 0%, 100% 30%, 80% 100%, 20% 100%, 0% 30%);
  box-shadow: 0 0 15px var(--bg-color, var(--gold));
  mix-blend-mode: screen;
  will-change: transform, opacity;
  animation: curveY var(--dur) cubic-bezier(0.1, 1, 0.4, 1) forwards;
}

@keyframes curveX {
  to { transform: translateX(var(--tx)) rotate(var(--rot)); }
}
@keyframes curveY {
  to { transform: translateY(var(--ty)) scale(0); opacity: 0; }
}

/* ── Staggered Fade-in Utility Classes ── */
.app-header.fade-in-active,
.app-main.fade-in-active {
  opacity: 1;
}
.arch-dock.fade-in-active {
  opacity: 1;
  transform: translateY(0);
}
