/* ==========================================================================
   KeepIt — shared UI layer (loaded last on every page)
   1. One header/navbar for the whole site  2. Motion  3. Hero space demo
   ========================================================================== */

/* ---------- 1. Header & navbar ---------- */
.header {
  position: sticky; top: 0; z-index: 100;
  padding: 0;
  background: rgba(15, 23, 42, 0.82);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-color, #334155);
  transition: background-color .25s ease, box-shadow .25s ease;
}
.header.scrolled { background: rgba(15, 23, 42, 0.94); box-shadow: 0 8px 28px rgba(0, 0, 0, .35); }
.header-container {
  max-width: 1200px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  transition: padding .25s ease;
}
.header.scrolled .header-container { padding-top: 8px; padding-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none !important; flex-shrink: 0; }
.brand-logo {
  display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex-shrink: 0;
  background: linear-gradient(135deg, #6366f1, #818cf8); color: #fff; border-radius: 8px;
  box-shadow: 0 2px 10px rgba(99, 102, 241, .45); transition: transform .3s cubic-bezier(.34,1.56,.64,1);
}
.brand:hover .brand-logo { transform: rotate(-8deg) scale(1.08); }
.brand-title { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; color: var(--text-primary, #f8fafc); }

.nav-menu { display: flex; align-items: center; gap: 6px; }
.nav-menu a:not(.btn-header) {
  position: relative; padding: 8px 12px; border-radius: 8px;
  color: var(--text-secondary, #94a3b8); font-size: 14px; font-weight: 500; white-space: nowrap; text-decoration: none;
  transition: color .15s ease, background-color .15s ease;
}
.nav-menu a:not(.btn-header)::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 3px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, #6366f1, #a5b4fc); transform: scaleX(0); transform-origin: left; transition: transform .25s ease;
}
.nav-menu a:not(.btn-header):hover { color: var(--text-primary, #f8fafc); text-decoration: none; }
.nav-menu a:not(.btn-header):hover::after,
.nav-menu a.active::after { transform: scaleX(1); }
.nav-menu a.active { color: var(--text-primary, #f8fafc); font-weight: 600; }
.nav-menu .btn-header {
  margin-left: 8px; padding: 8px 16px; border-radius: 8px; border: 0; color: #fff !important;
  background: linear-gradient(135deg, #6366f1, #4f46e5); box-shadow: 0 2px 10px rgba(99, 102, 241, .35);
  font-size: 13.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; text-decoration: none !important;
  transition: transform .15s ease, box-shadow .15s ease;
}
.nav-menu .btn-header:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(99, 102, 241, .5); }

.nav-toggle {
  display: none; align-items: center; justify-content: center; width: 40px; height: 40px; flex-shrink: 0;
  background: transparent; border: 1px solid var(--border-color, #334155); border-radius: 10px;
  color: var(--text-primary, #f8fafc); cursor: pointer; transition: background-color .15s ease, border-color .15s ease;
}
.nav-toggle:hover { background: rgba(99, 102, 241, .12); border-color: #6366f1; }
.nav-toggle svg { width: 20px; height: 20px; }
.nav-toggle .icon-close { display: none; }
.nav-toggle.open .icon-menu { display: none; }
.nav-toggle.open .icon-close { display: block; }
.nav-toggle:focus-visible, .nav-menu a:focus-visible, .brand:focus-visible { outline: 2px solid #818cf8; outline-offset: 2px; }

@media (max-width: 900px) {
  .header-container { padding: 10px 16px; }
  .nav-toggle { display: inline-flex; }
  .nav-menu {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 99;
    display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 10px 16px 18px;
    max-height: calc(100vh - 70px); overflow-y: auto;
    background: #0d1426;
    border-bottom: 1px solid var(--border-color, #334155); box-shadow: 0 22px 40px rgba(0, 0, 0, .5);
    opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(-10px);
    transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s;
  }
  .nav-menu.open { opacity: 1; visibility: visible; pointer-events: auto; transform: none; transition-delay: 0s; }
  .nav-menu a:not(.btn-header) { padding: 13px 14px; font-size: 16px; }
  .nav-menu a:not(.btn-header)::after { left: 14px; right: auto; width: 24px; bottom: 7px; }
  .nav-menu .btn-header { margin: 10px 0 0; justify-content: center; padding: 13px 16px; font-size: 15px; }
  .nav-menu.open a { animation: navItemIn .3s ease both; }
  .nav-menu.open a:nth-child(2) { animation-delay: .03s; } .nav-menu.open a:nth-child(3) { animation-delay: .06s; }
  .nav-menu.open a:nth-child(4) { animation-delay: .09s; } .nav-menu.open a:nth-child(5) { animation-delay: .12s; }
  .nav-menu.open a:nth-child(6) { animation-delay: .15s; } .nav-menu.open a:nth-child(7) { animation-delay: .18s; }
}
@keyframes navItemIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }

/* ---------- 2. Motion ---------- */
html.js-motion .reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1); transition-delay: var(--d, 0ms); will-change: opacity, transform; }
html.js-motion .reveal.in { opacity: 1; transform: none; will-change: auto; }

/* hero: slow aurora behind the headline */
.hero-section { position: relative; isolation: isolate; }
.hero-section::before, .hero-section::after {
  content: ""; position: absolute; z-index: -1; pointer-events: none; border-radius: 50%; filter: blur(70px); opacity: .55;
}
.hero-section::before { width: 420px; height: 420px; left: 6%; top: -40px; background: radial-gradient(circle, rgba(99,102,241,.55), transparent 65%); animation: auroraA 16s ease-in-out infinite alternate; }
.hero-section::after { width: 360px; height: 360px; right: 6%; top: 40px; background: radial-gradient(circle, rgba(245,158,11,.28), transparent 65%); animation: auroraB 19s ease-in-out infinite alternate; }
@keyframes auroraA { to { transform: translate(60px, 40px) scale(1.15); } }
@keyframes auroraB { to { transform: translate(-70px, 30px) scale(1.1); } }

.hero-title { background-size: 220% auto; animation: titleShift 9s ease-in-out infinite alternate; }
@keyframes titleShift { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }

.btn-cta-primary { position: relative; overflow: hidden; }
.btn-cta-primary::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.28), transparent); transform: skewX(-20deg); transition: left .6s ease;
}
.btn-cta-primary:hover::after { left: 130%; }
.btn-cta-primary:hover { transform: translateY(-2px); }

.hero-offer, .pricing-offer { animation: offerGlow 3.2s ease-in-out infinite; }
@keyframes offerGlow { 0%,100% { box-shadow: 0 0 0 0 rgba(245,158,11,0); } 50% { box-shadow: 0 0 22px 2px rgba(245,158,11,.28); } }
.offer-card { animation: offerCard 6s ease-in-out infinite; }
@keyframes offerCard { 0%,100% { box-shadow: 0 0 30px rgba(245,158,11,.08); } 50% { box-shadow: 0 0 52px rgba(245,158,11,.2); } }

.feature-card, .step-card, .pricing-card, .post-card, .help-card { transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease; }
.step-card:hover, .post-card:hover, .help-card:hover { transform: translateY(-4px); border-color: rgba(99,102,241,.5); box-shadow: 0 14px 32px rgba(0,0,0,.35); }
.feature-icon { display: inline-block; transition: transform .35s cubic-bezier(.34,1.56,.64,1); }
.feature-card:hover .feature-icon { transform: translateY(-4px) scale(1.12) rotate(-4deg); }
.step-card .step-num { transition: transform .3s cubic-bezier(.34,1.56,.64,1); }
.step-card:hover .step-num { transform: scale(1.15); }
.faq-section details { transition: border-color .2s ease, background-color .2s ease; }
.faq-section details[open] { border-color: rgba(99,102,241,.5); }
.faq-section details[open] > p { animation: faqIn .35s ease both; }
@keyframes faqIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- Reduced motion / print ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  html.js-motion .reveal { opacity: 1; transform: none; }
}
@media print { html.js-motion .reveal { opacity: 1 !important; transform: none !important; } }
