/**
 * Procedure Finder Quiz
 * Clean, effortless, Typeform-inspired design
 * Philosophy: Full screen, big type, minimal chrome, maximum delight
 */

/* ============================================
   VARIABLES
   ============================================ */
:root {
  --pf-pink: #ed5d9e;
  --pf-pink-hover: #e04d8e;
  --pf-text: #3d3633;
  --pf-text-light: #6b5f5b;
  --pf-bg: #faf8f5;
  --pf-white: #ffffff;
  --pf-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --pf-ease-out: cubic-bezier(0, 0, 0.2, 1);
}

/* ============================================
   TRIGGER BUTTON - Match original site buttons
   Inherits .link-a > * block display for full width
   ============================================ */
.link-a [data-procedure-finder] {
  /* Override the huge inherited font-size from .link-a (2.4-3.2em) */
  font-size: 27px !important;
  font-family: 'Urbanist', system-ui, sans-serif !important;
  font-weight: 600 !important;
  letter-spacing: 0.02em !important;
  line-height: 1.4 !important;
  /* Keep the original block display and full-width behavior */
  display: block !important;
  width: 100% !important;
  padding: 18px 24px !important;
  /* Colors */
  background: #ed398a !important;
  border: 1px solid #ed398a !important;
  color: #fff !important;
  border-radius: 6px !important;
  box-shadow: 0 2px 8px rgba(237, 57, 138, 0.25) !important;
  /* Touch optimization */
  cursor: pointer !important;
  touch-action: manipulation !important;
  -webkit-tap-highlight-color: transparent !important;
  text-align: center !important;
}

.link-a [data-procedure-finder]:hover {
  background: #d62f7a !important;
  border-color: #d62f7a !important;
  box-shadow: 0 4px 12px rgba(237, 57, 138, 0.35) !important;
}

.link-a [data-procedure-finder]:active {
  transform: scale(0.98) !important;
}

.link-a [data-procedure-finder] sup {
  font-size: 0.5em !important;
  vertical-align: super !important;
  line-height: 0 !important;
}

/* Mobile - slightly smaller text */
@media (max-width: 768px) {
  .link-a [data-procedure-finder] {
    font-size: 19px !important;
    padding: 16px 20px !important;
  }
}

/* ============================================
   MODAL - FULL SCREEN TAKEOVER
   ============================================ */
.pf-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--pf-bg);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--pf-ease), visibility 0s 0.3s;
}

.pf-modal.active {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s var(--pf-ease), visibility 0s;
}

/* Backdrop - subtle */
.pf-modal__backdrop {
  display: none;
}

/* Container - full viewport */
.pf-modal__container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  height: 100dvh;
}

/* ============================================
   HEADER - Minimal, clear
   ============================================ */
.pf-modal__header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
}

/* Progress bar - thin line at very top */
.pf-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(61, 54, 51, 0.1);
}

.pf-progress__bar {
  height: 100%;
  background: var(--pf-pink);
  transition: width 0.4s var(--pf-ease-out);
  border-radius: 0 2px 2px 0;
}

/* Close button - always visible, top right */
.pf-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s ease;
  z-index: 10;
}

.pf-modal__close:hover {
  background: rgba(61, 54, 51, 0.08);
}

.pf-modal__close svg {
  width: 24px;
  height: 24px;
  stroke: var(--pf-text);
  stroke-width: 2;
}

/* ============================================
   CONTENT - Centered, spacious
   ============================================ */
.pf-modal__content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 24px 100px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Question wrapper */
.pf-question-wrapper {
  width: 100%;
  max-width: 600px;
  text-align: center;
}

/* Question text - BIG and bold */
.pf-question {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 400;
  line-height: 1.25;
  color: var(--pf-text);
  margin: 0 0 48px;
  opacity: 0;
  transform: translateY(10px);
  animation: pf-appear 0.4s var(--pf-ease-out) forwards;
}

@keyframes pf-appear {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   OPTIONS - Large, easy to tap
   ============================================ */
.pf-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 2-column layout for many options on desktop */
@media (min-width: 600px) {
  .pf-options.pf-options--grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
}

.pf-option {
  padding: 20px 24px;
  background: var(--pf-white);
  border: 2px solid rgba(61, 54, 51, 0.12);
  border-radius: 12px;
  font-family: 'Urbanist', system-ui, sans-serif;
  font-size: 18px;
  font-weight: 500;
  color: var(--pf-text);
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  opacity: 0;
  transform: translateY(8px);
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Mobile touch optimization */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* Stagger animation */
.pf-option:nth-child(1) { animation: pf-appear 0.3s var(--pf-ease-out) 0.05s forwards; }
.pf-option:nth-child(2) { animation: pf-appear 0.3s var(--pf-ease-out) 0.1s forwards; }
.pf-option:nth-child(3) { animation: pf-appear 0.3s var(--pf-ease-out) 0.15s forwards; }
.pf-option:nth-child(4) { animation: pf-appear 0.3s var(--pf-ease-out) 0.2s forwards; }
.pf-option:nth-child(5) { animation: pf-appear 0.3s var(--pf-ease-out) 0.25s forwards; }
.pf-option:nth-child(6) { animation: pf-appear 0.3s var(--pf-ease-out) 0.3s forwards; }
.pf-option:nth-child(7) { animation: pf-appear 0.3s var(--pf-ease-out) 0.35s forwards; }

.pf-option:hover {
  border-color: var(--pf-pink);
  background: #fff;
  color: var(--pf-text);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(237, 93, 158, 0.15);
}

.pf-option:active {
  transform: scale(0.98);
  border-color: var(--pf-pink);
  background: #fff;
}

/* Touch devices - show active state instead of hover */
@media (hover: none) {
  .pf-option:active {
    border-color: var(--pf-pink);
    box-shadow: 0 4px 12px rgba(237, 93, 158, 0.15);
  }
}

/* ============================================
   FOOTER - Back button
   ============================================ */
.pf-modal__footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px 24px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}

.pf-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  font-family: 'Urbanist', system-ui, sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--pf-text-light);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.pf-back.visible {
  opacity: 1;
  visibility: visible;
}

.pf-back:hover {
  color: var(--pf-text);
}

.pf-back svg {
  width: 20px;
  height: 20px;
}

/* ============================================
   RESULTS - Clean and focused
   ============================================ */
.pf-result {
  width: 100%;
  max-width: 500px;
  text-align: center;
  padding: 20px;
}

.pf-result__intro {
  font-family: 'Urbanist', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pf-pink);
  margin: 0 0 8px;
  opacity: 0;
  animation: pf-appear 0.4s var(--pf-ease-out) 0.1s forwards;
}

.pf-result__recommend {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 20px;
  color: var(--pf-text-light);
  margin: 0 0 32px;
  opacity: 0;
  animation: pf-appear 0.4s var(--pf-ease-out) 0.15s forwards;
}

/* Image - Circular to match logo */
.pf-result__image {
  width: 200px;
  height: 200px;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto 32px;
  background: rgba(61, 54, 51, 0.05);
  box-shadow: 0 4px 20px rgba(61, 54, 51, 0.12);
  opacity: 0;
  transform: scale(0.96);
  animation: pf-scale-in 0.5s var(--pf-ease-out) 0.2s forwards;
}

@keyframes pf-scale-in {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.pf-result__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pf-result__image-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(237, 93, 158, 0.1), rgba(196, 114, 126, 0.1));
}

.pf-result__image-fallback svg {
  width: 48px;
  height: 48px;
  stroke: var(--pf-pink);
  opacity: 0.5;
}

/* Procedure info */
.pf-result__name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(28px, 5vw, 36px);
  font-weight: 500;
  color: var(--pf-text);
  margin: 0 0 8px;
  opacity: 0;
  animation: pf-appear 0.4s var(--pf-ease-out) 0.3s forwards;
}

.pf-result__subtitle {
  font-family: 'Urbanist', system-ui, sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--pf-pink);
  margin: 0 0 16px;
  opacity: 0;
  animation: pf-appear 0.4s var(--pf-ease-out) 0.35s forwards;
}

.pf-result__description {
  font-family: 'Urbanist', system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--pf-text-light);
  margin: 0 0 40px;
  opacity: 0;
  animation: pf-appear 0.4s var(--pf-ease-out) 0.4s forwards;
}

/* CTAs */
.pf-result__ctas {
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  animation: pf-appear 0.4s var(--pf-ease-out) 0.5s forwards;
}

.pf-result__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 28px;
  border-radius: 12px;
  font-family: 'Urbanist', system-ui, sans-serif;
  font-size: 17px;
  font-weight: 600;
  text-decoration: none !important;
  transition: all 0.2s ease;
  min-height: 56px;
}

.pf-result__cta:hover,
.pf-result__cta:focus,
.pf-result__cta:active {
  text-decoration: none !important;
}

/* Primary - Pink solid */
.pf-result__cta--primary {
  background: var(--pf-pink);
  color: #fff !important;
  border: none;
}

.pf-result__cta--primary:hover {
  background: var(--pf-pink-hover);
  transform: translateY(-1px);
}

/* Secondary - Outline */
.pf-result__cta--secondary {
  background: transparent;
  color: var(--pf-text) !important;
  border: 2px solid rgba(61, 54, 51, 0.2);
}

.pf-result__cta--secondary:hover {
  border-color: var(--pf-pink);
  color: var(--pf-pink) !important;
}

.pf-result__cta svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.pf-result__cta--primary svg {
  stroke: #fff;
}

.pf-result__cta--secondary svg {
  stroke: currentColor;
}

/* Restart */
.pf-result__restart {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  padding: 12px;
  background: transparent;
  border: none;
  font-family: 'Urbanist', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--pf-text-light);
  cursor: pointer;
  opacity: 0;
  animation: pf-appear 0.4s var(--pf-ease-out) 0.6s forwards;
}

.pf-result__restart:hover {
  color: var(--pf-pink);
}

.pf-result__restart svg {
  width: 16px;
  height: 16px;
}

/* ============================================
   LOADING
   ============================================ */
.pf-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.pf-loading__spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(237, 93, 158, 0.2);
  border-top-color: var(--pf-pink);
  border-radius: 50%;
  animation: pf-spin 0.8s linear infinite;
}

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

/* ============================================
   TRANSITIONS
   ============================================ */
.pf-question-wrapper.exit-forward {
  animation: pf-exit-left 0.25s var(--pf-ease) forwards;
}

.pf-question-wrapper.exit-backward {
  animation: pf-exit-right 0.25s var(--pf-ease) forwards;
}

@keyframes pf-exit-left {
  to { opacity: 0; transform: translateX(-30px); }
}

@keyframes pf-exit-right {
  to { opacity: 0; transform: translateX(30px); }
}

/* ============================================
   SCROLL LOCK
   ============================================ */
body.pf-modal-open {
  overflow: hidden;
}

/* ============================================
   SCREEN READER
   ============================================ */
.pf-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  .pf-question,
  .pf-option,
  .pf-result__intro,
  .pf-result__recommend,
  .pf-result__image,
  .pf-result__name,
  .pf-result__subtitle,
  .pf-result__description,
  .pf-result__ctas,
  .pf-result__restart {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ============================================
   MOBILE TWEAKS
   ============================================ */
@media (max-width: 599px) {
  .pf-modal__content {
    padding: 60px 16px 80px;
    align-items: flex-start;
    padding-top: 70px;
  }

  .pf-question {
    font-size: 24px;
    margin-bottom: 28px;
  }

  .pf-option {
    padding: 16px 18px;
    font-size: 15px;
    min-height: 50px;
  }

  /* Result screen - compact for mobile */
  .pf-result {
    padding: 12px;
  }

  .pf-result__intro {
    font-size: 12px;
    margin-bottom: 4px;
  }

  .pf-result__recommend {
    font-size: 16px;
    margin-bottom: 20px;
  }

  .pf-result__image {
    width: 140px;
    height: 140px;
    margin-bottom: 20px;
  }

  .pf-result__name {
    font-size: 24px;
    margin-bottom: 4px;
  }

  .pf-result__subtitle {
    font-size: 14px;
    margin-bottom: 12px;
  }

  .pf-result__description {
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 24px;
  }

  .pf-result__ctas {
    gap: 10px;
  }

  .pf-result__cta {
    padding: 14px 20px;
    font-size: 15px;
    min-height: 50px;
  }

  .pf-result__restart {
    margin-top: 16px;
    font-size: 14px;
  }
}

/* ============================================
   LARGE DESKTOP
   ============================================ */
@media (min-width: 1200px) {
  .pf-question {
    font-size: 48px;
  }

  .pf-option {
    padding: 24px 32px;
    font-size: 20px;
  }
}
