/* PharmComplyAI - Custom Styles */

/* Smooth scroll with fixed header offset */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 100px;
  color-scheme: light;
}

/* DM Serif Display - homepage hero H1 only */
.hero-h1 {
  font-family: 'DM Serif Display', serif;
}

/* Category labels */
.label-caps {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Hero dashboard image treatment */
.hero-dashboard {
  border-radius: 12px;
  box-shadow:
    0 4px 6px -1px rgba(10, 37, 64, 0.06),
    0 20px 40px -8px rgba(10, 37, 64, 0.12),
    0 0 0 1px rgba(226, 232, 240, 0.8);
}
@media (min-width: 1024px) {
  .hero-dashboard {
    width: 120%;
  }
}

/* Stat bar dividers */
.stat-divider::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 40px;
  width: 1px;
  background: #E2E8F0;
}
.stat-divider:last-child::after {
  display: none;
}

/* Feature card hover */
.feature-card {
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.feature-card:hover {
  box-shadow: 0 8px 24px -4px rgba(10, 37, 64, 0.1);
  transform: translateY(-2px);
}

/* 3-layer connector line */
.layer-connector {
  position: relative;
}
.layer-connector::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -24px;
  width: 24px;
  height: 2px;
  background: linear-gradient(to right, #E2E8F0, #0D9488);
}

/* Mobile lightbox */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  cursor: zoom-out;
  padding: 16px;
}
.lightbox-overlay.active {
  opacity: 1;
  visibility: visible;
}
.lightbox-overlay img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  transition: background 0.2s ease;
  z-index: 1;
}
.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
}
.hero-dashboard img,
.feature-card img,
.lightbox-trigger {
  cursor: zoom-in;
}

/* Mobile nav overlay */
.mobile-nav-overlay {
  background-color: #fff;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.3s ease, visibility 0.3s ease;
}
.mobile-nav-overlay.active {
  transform: translateX(0);
  visibility: visible;
}

/* Main content min-height to keep footer at bottom */
main {
  min-height: calc(100vh - 180px);
}

/* Keyboard focus indicator */
*:focus-visible {
  outline: 2px solid #0F766E;
  outline-offset: 2px;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 100;
  padding: 8px 16px;
  background: #0F766E;
  color: white;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus {
  top: 16px;
}

/* FAQ accordion */
details summary {
  cursor: pointer;
  list-style: none;
}
details summary::-webkit-details-marker {
  display: none;
}
details summary::marker {
  display: none;
}
details[open] .faq-icon {
  transform: rotate(45deg);
}
.faq-icon {
  transition: transform 0.2s ease;
}

/* ===========================
   Animation System
   =========================== */

/* Scroll-triggered fade up — scoped to .js so content is visible without JS */
.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 600ms cubic-bezier(0.25, 0.1, 0.25, 1),
              transform 600ms cubic-bezier(0.25, 0.1, 0.25, 1);
}
.js .reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Hero load animation (descendant selector — content nested 2-3 levels deep) */
.js .hero-animate [data-hero] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 600ms cubic-bezier(0.25, 0.1, 0.25, 1),
              transform 600ms cubic-bezier(0.25, 0.1, 0.25, 1);
}
.js .hero-animate.hero-visible [data-hero] {
  opacity: 1;
  transform: translateY(0);
}

/* Hero image: includes scale */
.js .hero-animate [data-hero-image] {
  opacity: 0;
  transform: translateY(30px) scale(0.98);
  transition: opacity 800ms cubic-bezier(0.25, 0.1, 0.25, 1),
              transform 800ms cubic-bezier(0.25, 0.1, 0.25, 1);
}
.js .hero-animate.hero-visible [data-hero-image] {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Staggered group children */
.js .reveal-group .reveal-child {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 600ms cubic-bezier(0.25, 0.1, 0.25, 1),
              transform 600ms cubic-bezier(0.25, 0.1, 0.25, 1);
}
.js .reveal-group.visible .reveal-child {
  opacity: 1;
  transform: translateY(0);
}

/* Post-reveal: fast transition for hover interactivity */
.revealed {
  transition: transform 200ms ease, box-shadow 200ms ease;
}

/* Card hover enhancement */
.card-hover:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px -4px rgba(10, 37, 64, 0.12);
}

/* Founding Member CTA pulse glow (V1) */
@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(13, 148, 136, 0.4);
  }
  50% {
    box-shadow: 0 0 16px 4px rgba(13, 148, 136, 0.2);
  }
}
.cta-pulse {
  animation: pulse-glow 3s ease-in-out infinite;
}

/* Sticky mobile CTA bar (V2) — layout reservation via body:has(), see docs/lessons.md */
:root {
  --sticky-cta-height: 48px;
}
.sticky-mobile-cta {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--sticky-cta-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: #0F766E; /* teal-700 — WCAG AA 5.02:1 white on teal (lesson #6) */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  transform: translateY(100%);
  transition: transform 300ms ease;
  will-change: transform;
  box-shadow: 0 -4px 12px -4px rgba(0, 0, 0, 0.15);
}
.sticky-mobile-cta.visible {
  transform: translateY(0);
}
body:has(.sticky-mobile-cta.visible) {
  padding-bottom: calc(var(--sticky-cta-height) + env(safe-area-inset-bottom, 0px));
  transition: padding-bottom 300ms ease;
}
@media (min-width: 1024px) {
  .sticky-mobile-cta {
    display: none !important;
  }
  body:has(.sticky-mobile-cta.visible) {
    padding-bottom: 0;
  }
}

/* Featured pricing card elevation (V4) */
@media (min-width: 1024px) {
  .pricing-card-featured {
    transform: scale(1.03);
    box-shadow: 0 12px 40px -8px rgba(13, 148, 136, 0.15);
  }
}

/* Feature screenshot hover zoom (V5) */
@media (min-width: 1024px) {
  .feature-screenshot {
    transition: transform 300ms ease, box-shadow 300ms ease;
  }
  .feature-screenshot:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 32px -4px rgba(10, 37, 64, 0.12);
  }
}

/* Feature progress dots (V6) */
.progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #CBD5E1;
  transition: background 300ms ease, transform 300ms ease;
}
.progress-dot.active {
  background: #0D9488;
  transform: scale(1.5);
}
.progress-line {
  width: 2px;
  height: 32px;
  background: #E2E8F0;
  margin: 4px auto;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html {
    scroll-behavior: auto;
  }
  .reveal,
  .hero-animate [data-hero],
  .hero-animate [data-hero-image],
  .reveal-group .reveal-child {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .cta-pulse {
    animation: none !important;
  }
  .sticky-mobile-cta {
    transition: none !important;
  }
  .feature-screenshot,
  .feature-screenshot:hover {
    transform: none !important;
    transition: none !important;
  }
  .progress-dot {
    transition: none !important;
  }
  .card-hover:hover {
    transform: none;
  }
}

/* Print styles */
@media print {
  header,
  footer,
  .lightbox-overlay,
  .mobile-nav-overlay,
  .skip-link {
    display: none !important;
  }
  main {
    min-height: auto;
  }
  .reveal,
  .reveal-group .reveal-child,
  .hero-animate [data-hero],
  .hero-animate [data-hero-image] {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* =========================
   Legal Pages
   ========================= */
.legal-toc-sidebar {
  position: sticky;
  top: 100px;
  align-self: start;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}

.legal-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.legal-toc-link {
  display: block;
  padding: 0.375rem 0.75rem;
  border-left: 2px solid transparent;
  line-height: 1.4;
  transition: color 0.15s, border-color 0.15s;
}

.legal-toc-link:hover {
  color: #334155; /* slate-700 */
}

.legal-toc-mobile-select {
  width: 100%;
  font-size: 1rem; /* 16px — prevents iOS Safari auto-zoom */
  padding: 0.625rem 2.25rem 0.625rem 0.875rem;
  border: 1px solid #0D9488; /* teal-600 */
  border-radius: 0.5rem;
  background-color: white;
  color: #334155;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%230D9488' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='4 6 8 10 12 6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
}

.legal-toc-mobile-select:focus {
  outline: none;
  border-color: #0F766E; /* teal-700 */
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

/* Legal-page print rules — extend the main print block above */
@media print {
  .legal-toc-sidebar,
  .legal-toc-mobile {
    display: none !important;
  }
  .legal-content-grid {
    display: block !important;
  }
  .legal-content {
    max-width: 100% !important;
    font-size: 11pt !important;
    line-height: 1.5 !important;
    color: #000 !important;
  }
  .legal-content h1 {
    font-size: 18pt !important;
  }
  .legal-content h2 {
    font-size: 14pt !important;
    page-break-after: avoid !important;
  }
  .legal-content h3 {
    font-size: 12pt !important;
    page-break-after: avoid !important;
  }
  .legal-content p {
    orphans: 3 !important;
    widows: 3 !important;
  }
  .legal-content a[href^="/"]::after {
    content: " (pharmcomplyai.com" attr(href) ")" !important;
    font-size: 9pt !important;
    color: #666 !important;
  }
  .legal-callout {
    background: none !important;
    border-left: 2px solid #000 !important;
    padding-left: 12px !important;
  }
}
