/* ============================================================
 * CIPHER GROUP — ANIMATIONS LIBRARY
 * Drop-in CSS for the Cipher Group homepage and service pages.
 * Targets Stripe Press / Mercury motion quality — restrained,
 * intentional, every frame earns its place.
 * ============================================================ */

/* -----------------------------------------------------------
 * CIPHER WHEEL HERO
 * Outer ring rotates slowly clockwise.
 * Inner ring rotates counter-clockwise (decoder-wheel feel).
 * 4 cardinal ticks pulse in clockwise sequence (signal arrival).
 * On page load, the entire mark draws itself in via stroke-dashoffset.
 * ----------------------------------------------------------- */

.cipher-mark-hero {
  width: 360px;
  height: 360px;
  display: block;
}

/* Draw-in on page load */
@keyframes cipher-stroke-draw {
  0%   { stroke-dashoffset: 250; opacity: 0; }
  10%  { opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 1; }
}

.cipher-mark-hero .ring-outer,
.cipher-mark-hero .ring-inner {
  stroke-dasharray: 250;
  stroke-dashoffset: 250;
  animation: cipher-stroke-draw 1.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.cipher-mark-hero .ring-outer { animation-delay: 0s; }
.cipher-mark-hero .ring-inner { animation-delay: 0.4s; }

.cipher-mark-hero .tick {
  opacity: 0;
  animation: tick-fade-in 0.4s ease-out forwards,
             tick-pulse 4s ease-in-out infinite;
}
.cipher-mark-hero .tick.t-top    { animation-delay: 1.4s, 1.4s; }
.cipher-mark-hero .tick.t-right  { animation-delay: 1.6s, 2.4s; }
.cipher-mark-hero .tick.t-bottom { animation-delay: 1.8s, 3.4s; }
.cipher-mark-hero .tick.t-left   { animation-delay: 2.0s, 4.4s; }

@keyframes tick-fade-in {
  0%   { opacity: 0; transform: scale(0.6); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes tick-pulse {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 1; }
}

/* Continuous rotation of rings — kicks in after draw-in finishes */
@keyframes ring-rotate-cw {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes ring-rotate-ccw {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(-360deg); }
}

.cipher-mark-hero .ring-outer-rotator {
  transform-origin: 50px 50px;
  animation: ring-rotate-cw 60s linear infinite;
  animation-delay: 2.5s;
}
.cipher-mark-hero .ring-inner-rotator {
  transform-origin: 50px 50px;
  animation: ring-rotate-ccw 90s linear infinite;
  animation-delay: 2.5s;
}

/* -----------------------------------------------------------
 * SCROLL FADE-IN
 * Apply .reveal to any element. Add .reveal--in via JS when it
 * intersects the viewport (Intersection Observer pattern).
 * ----------------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.reveal--in {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}
.reveal-stagger.reveal--in > *:nth-child(1) { transition-delay: 0s; opacity: 1; transform: translateY(0); }
.reveal-stagger.reveal--in > *:nth-child(2) { transition-delay: 0.08s; opacity: 1; transform: translateY(0); }
.reveal-stagger.reveal--in > *:nth-child(3) { transition-delay: 0.16s; opacity: 1; transform: translateY(0); }
.reveal-stagger.reveal--in > *:nth-child(4) { transition-delay: 0.24s; opacity: 1; transform: translateY(0); }
.reveal-stagger.reveal--in > *:nth-child(5) { transition-delay: 0.32s; opacity: 1; transform: translateY(0); }
.reveal-stagger.reveal--in > *:nth-child(6) { transition-delay: 0.40s; opacity: 1; transform: translateY(0); }

/* -----------------------------------------------------------
 * BIG NUMBERS — count-up on scroll
 * JS attaches to elements with class="counter" and data-target="78.1"
 * Uses CSS transition on a CSS variable to animate; JS toggles --val.
 * ----------------------------------------------------------- */

.counter {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* Subtle scale-in for the number band entries */
.number-cell {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 1s cubic-bezier(0.2, 0.8, 0.2, 1),
              transform 1s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.number-band.reveal--in .number-cell {
  opacity: 1;
  transform: scale(1);
}
.number-band.reveal--in .number-cell:nth-child(2) { transition-delay: 0.1s; }
.number-band.reveal--in .number-cell:nth-child(3) { transition-delay: 0.2s; }
.number-band.reveal--in .number-cell:nth-child(4) { transition-delay: 0.3s; }

/* -----------------------------------------------------------
 * SERVICE CARD HOVER LIFT
 * Restrained. Card lifts 4px, brass underline grows.
 * ----------------------------------------------------------- */

.service-card {
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
              box-shadow 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.service-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(26, 26, 26, 0.10);
}

/* Brass underline expansion on card title */
.service-card .underline {
  position: relative;
  display: inline-block;
}
.service-card .underline::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 24px;
  height: 1px;
  background: #B8924E;
  transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.service-card:hover .underline::after {
  width: 100%;
}

/* -----------------------------------------------------------
 * STICKY CTA BAR — slides up from bottom after hero passes
 * ----------------------------------------------------------- */

.sticky-cta {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #1A1A1A;
  color: #EFE7D6;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transform: translateY(100%);
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 50;
  border-top: 1px solid rgba(184, 146, 78, 0.4);
}
.sticky-cta.is-visible {
  transform: translateY(0);
}

/* -----------------------------------------------------------
 * NAV — solid background + slight shadow on scroll
 * ----------------------------------------------------------- */

nav {
  background: #EFE7D6;
  transition: box-shadow 0.3s ease, background 0.3s ease;
}
nav.is-scrolled {
  box-shadow: 0 4px 24px rgba(26, 26, 26, 0.06);
  border-bottom: 1px solid rgba(26, 26, 26, 0.10);
}

/* -----------------------------------------------------------
 * EDITORIAL QUOTE — subtle scale-in
 * ----------------------------------------------------------- */

.editorial-quote {
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 1.2s cubic-bezier(0.2, 0.8, 0.2, 1),
              transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.editorial-quote.reveal--in {
  opacity: 1;
  transform: scale(1);
}

/* -----------------------------------------------------------
 * PAGE TURN (between sections — Stripe Press feel)
 * Apply to section dividers; subtle horizontal slide-in
 * ----------------------------------------------------------- */

.section-divider {
  height: 1px;
  background: linear-gradient(to right, transparent, #B8924E, transparent);
  width: 0%;
  margin: 0 auto;
  transition: width 1.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.section-divider.reveal--in {
  width: 60%;
}

/* -----------------------------------------------------------
 * REDUCED MOTION — respect user preference
 * ----------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .cipher-mark-hero .ring-outer,
  .cipher-mark-hero .ring-inner {
    animation: none;
    stroke-dashoffset: 0;
  }
  .cipher-mark-hero .tick {
    animation: none;
    opacity: 1;
  }
  .cipher-mark-hero .ring-outer-rotator,
  .cipher-mark-hero .ring-inner-rotator {
    animation: none;
  }
  .reveal, .reveal-stagger > *, .number-cell, .editorial-quote {
    opacity: 1;
    transform: none;
  }
  .section-divider {
    opacity: 1;
    width: 60%;
  }
  .sticky-cta {
    transition: none;
  }
}

/* -----------------------------------------------------------
 * VIDEO INTEGRATIONS — hero bg, founder figure, footer strip
 * ----------------------------------------------------------- */

.hero-video-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.18;
  z-index: 0;
  pointer-events: none;
}
.hero-content { position: relative; z-index: 1; }

.founder-video-figure {
  max-width: 720px;
  margin: 48px auto;
}
.founder-video {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 2px;
  display: block;
}
.founder-video-figure figcaption {
  font-family: 'JetBrains Mono', 'Courier', monospace;
  font-size: 10px;
  letter-spacing: 1.6px;
  color: #B8924E;
  text-align: center;
  margin-top: 12px;
  text-transform: uppercase;
}

.footer-cinematic {
  position: relative;
  height: 280px;
  overflow: hidden;
}
.footer-video-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.55;
  z-index: 0;
}
.footer-cinematic-overlay {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(to bottom, rgba(26,26,26,0.0), rgba(26,26,26,0.6));
  color: #EFE7D6;
  padding: 0 24px;
  text-align: center;
}
.footer-cinematic .eyebrow {
  font-family: 'JetBrains Mono', 'Courier', monospace;
  font-size: 11px;
  letter-spacing: 3px;
  color: #B8924E;
  margin-bottom: 12px;
  text-transform: uppercase;
}
.footer-cinematic .tagline {
  font-family: 'Fraunces', 'Times', serif;
  font-size: 28px;
  font-style: italic;
  font-weight: 500;
  line-height: 1.25;
  max-width: 720px;
}

@media (max-width: 768px) {
  .founder-video-figure { margin: 32px auto; }
  .footer-cinematic { height: 220px; }
  .footer-cinematic .tagline { font-size: 22px; }
}
@media (max-width: 480px) {
  .footer-cinematic { height: 180px; }
  .footer-cinematic .tagline { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-video-bg,
  .footer-video-bg { display: none; }
  .founder-video { display: none; }
  .founder-video-figure { display: none; }
}

/* -----------------------------------------------------------
 * MOBILE MENU (added 2026-10-22)
 * ----------------------------------------------------------- */
.nav-burger{display:none;width:44px;height:44px;border:0;background:transparent;cursor:pointer;position:relative;flex:none}
.nav-burger span,.nav-burger::before,.nav-burger::after{content:"";position:absolute;left:11px;right:11px;height:1.5px;background:#1A1A1A;transition:transform .3s,opacity .3s}
.nav-burger::before{top:15px}.nav-burger span{top:21px}.nav-burger::after{top:27px}
body.menu-open .nav-burger::before{transform:translateY(6px) rotate(45deg)}
body.menu-open .nav-burger span{opacity:0}
body.menu-open .nav-burger::after{transform:translateY(-6px) rotate(-45deg)}
.mobile-menu{position:fixed;inset:0;z-index:39;background:#EFE7D6;padding:96px 28px 40px;display:flex;flex-direction:column;gap:6px;opacity:0;pointer-events:none;transition:opacity .3s}
.mobile-menu a{font-family:'Fraunces',Georgia,serif;font-size:32px;color:#1A1A1A;padding:8px 0;border-bottom:1px solid rgba(26,26,26,0.1)}
.mobile-menu a.mm-cta{margin-top:24px;border:0;background:#6B2828;color:#EFE7D6;font-family:'Inter',system-ui,sans-serif;font-size:15px;font-weight:500;text-align:center;padding:16px;border-radius:2px}
body.menu-open .mobile-menu{opacity:1;pointer-events:auto}
body.menu-open{overflow:hidden}
@media (max-width:880px){
  .nav-burger{display:block}
  nav.site-nav .nav-cta{display:none}
}
.footer-place{display:block;color:rgba(239,231,214,0.7);font-size:14px;margin-bottom:10px}
@media (max-width:880px){ .hero-video-bg{opacity:0.08} }

/* -----------------------------------------------------------
 * MOBILE QA FIXES (2026-10-22)
 * ----------------------------------------------------------- */
@media (max-width:880px){
  nav.site-nav .lockup{padding:8px 0;min-height:44px}
  .footer-col a,.footer-place{padding:10px 0;margin-bottom:0 !important;min-height:44px;display:flex;align-items:center}
  .proof-link{display:inline-block;padding:12px 0}
  .mono,.kicker,.pk,.po,.pd,.facts dt,.proof-facts dt,.bio-photo figcaption,.founder-photo-figure figcaption,.footer-col h4,.footer-bottom,.laurel small,.number-cell .cap,.badge{font-size:11px !important}
  .ec-form input{font-size:16px}
  .faq-item summary{padding-top:20px;padding-bottom:20px}
}
.sticky-cta .btn{white-space:nowrap;flex:none}
@media (max-width:480px){ .sticky-cta .sticky-msg{font-size:14px;line-height:1.3} .sticky-cta{gap:12px} }
