/*
 * ============================================================
 *  POLISH KIT  —  CSS-only enhancement toolkit for WordPress
 *  Full-Site Editing block themes.
 *
 *  Every effect is opt-in via a `pp-` prefixed class.
 *  Nothing activates unless the class is added to a block
 *  in the Site Editor.
 *
 *  All motion respects @media (prefers-reduced-motion: reduce).
 *  Scroll animations use native CSS scroll-driven animations
 *  with a visible-by-default fallback.
 *
 *  No plugins. No jQuery. No CDN. No build step. Plain CSS.
 * ============================================================
 *
 *  CLASS REFERENCE
 *  ---------------
 *  pp-sticky           Sticky header with scroll-aware shadow
 *  pp-btn              Button hover enhancements (scale, shadow, darken)
 *  pp-lift             Card hover lift (translateY + shadow)
 *  (global)            Smooth scroll (html scroll-behavior: smooth)
 *  pp-reveal           Fade/slide-up on scroll (scroll-driven animation)
 *  pp-faq              FAQ accordion styling for <details> blocks
 *  pp-lightbox         Lightbox overlay styling for core Image block
 *  pp-menu             Mobile menu slide-in for Navigation block overlay
 *  pp-divider-gradient Gradient section divider bar
 *  pp-divider-shape    SVG wave/curve section divider
 *
 * ============================================================
 */


/* =============================================================
   CORE  —  do not delete
   Shared custom properties, resets, and base helpers.
   ============================================================= */

:root {
  /* Timing */
  --pp-duration-fast: 0.2s;
  --pp-duration-normal: 0.3s;
  --pp-ease: ease;

  /* Shadows */
  --pp-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --pp-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
  --pp-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.16);

  /* Divider defaults */
  --pp-gradient-start: #e8594f;
  --pp-gradient-end: #4a90d9;
  --pp-divider-height: 4px;
  --pp-shape-fill: #f5f5f5;
  --pp-shape-height: 60px;
}

/* ===== END CORE ===== */


/* ===== EFFECT: pp-sticky (Sticky header with scroll-aware shadow) — START ===== */

.pp-sticky {
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: none;
  transition: box-shadow var(--pp-duration-normal) var(--pp-ease);
}

/*
 * Scroll-driven animation: shadow fades in as the element
 * enters the sticky state (i.e. when the page has scrolled).
 */
@supports (animation-timeline: scroll()) {
  @keyframes pp-sticky-shadow {
    0% {
      box-shadow: none;
    }
    5%, 100% {
      box-shadow: var(--pp-shadow-md);
    }
  }

  .pp-sticky {
    animation: pp-sticky-shadow linear both;
    animation-timeline: scroll(nearest block);
    animation-range: 0px 80px;
  }
}

/* Fallback: if scroll-driven animations are not supported,
   show a subtle always-on shadow so the header is still distinct. */
@supports not (animation-timeline: scroll()) {
  .pp-sticky {
    box-shadow: var(--pp-shadow-sm);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pp-sticky {
    animation: none;
    transition: none;
    box-shadow: var(--pp-shadow-sm);
  }
}

/* ===== EFFECT: pp-sticky — END ===== */


/* ===== EFFECT: pp-btn (Button hover enhancements) — START ===== */

.pp-btn {
  --pp-btn-bg: currentColor;
  display: inline-block;
  transition:
    background-color var(--pp-duration-fast) var(--pp-ease),
    box-shadow var(--pp-duration-fast) var(--pp-ease),
    transform var(--pp-duration-fast) var(--pp-ease),
    filter var(--pp-duration-fast) var(--pp-ease);
}

@media (hover: hover) {
  .pp-btn:hover {
    filter: brightness(0.88);
    transform: scale(1.05);
    box-shadow: var(--pp-shadow-md);
  }
}

.pp-btn:active {
  transform: scale(0.98);
  box-shadow: var(--pp-shadow-sm);
}

.pp-btn:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .pp-btn {
    transition: none;
  }
  .pp-btn:hover {
    transform: none;
  }
}

/* ===== EFFECT: pp-btn — END ===== */


/* ===== EFFECT: pp-lift (Card hover lift) — START ===== */

.pp-lift {
  transition:
    transform var(--pp-duration-normal) var(--pp-ease),
    box-shadow var(--pp-duration-normal) var(--pp-ease);
}

@media (hover: hover) {
  .pp-lift:hover {
    transform: translateY(-6px);
    box-shadow: var(--pp-shadow-lg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pp-lift {
    transition: none;
  }
  .pp-lift:hover {
    transform: none;
  }
}

/* ===== EFFECT: pp-lift — END ===== */


/* ===== EFFECT: Smooth scroll (global) — START ===== */

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* ===== EFFECT: Smooth scroll — END ===== */


/* ===== EFFECT: pp-reveal (Fade/slide-up on scroll) — START ===== */

/*
 * Default / fallback: element is fully visible.
 * Browsers that don't support scroll-driven animations
 * never hide the content.
 */
.pp-reveal {
  opacity: 1;
  transform: none;
}

@supports (animation-timeline: view()) {
  @keyframes pp-reveal-in {
    from {
      opacity: 0;
      transform: translateY(30px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .pp-reveal {
    opacity: 0;
    transform: translateY(30px);
    animation: pp-reveal-in linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pp-reveal {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
}

/* ===== EFFECT: pp-reveal — END ===== */


/* ===== EFFECT: pp-faq (FAQ accordion for <details>) — START ===== */

.pp-faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  cursor: pointer;
  list-style: none;
  font-weight: 600;
}

/* Remove default marker in all browsers */
.pp-faq summary::-webkit-details-marker {
  display: none;
}

.pp-faq summary::marker {
  content: "";
}

/* Chevron via ::after pseudo-element */
.pp-faq summary::after {
  content: "\25B6"; /* right-pointing triangle */
  display: inline-block;
  flex-shrink: 0;
  margin-left: 1rem;
  font-size: 0.75em;
  transition: transform var(--pp-duration-normal) var(--pp-ease);
  transform: rotate(0deg);
}

.pp-faq[open] > summary::after {
  transform: rotate(90deg);
}

/*
 * Grid-row trick for smooth open/close.
 * The content wrapper is the element directly after <summary>.
 */
.pp-faq .pp-faq-content {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--pp-duration-normal) var(--pp-ease);
}

.pp-faq[open] > .pp-faq-content {
  grid-template-rows: 1fr;
}

.pp-faq .pp-faq-content > * {
  overflow: hidden;
}

/*
 * Fallback for when content is NOT wrapped in .pp-faq-content
 * (just a plain <details>). The content simply appears.
 */
.pp-faq > *:not(summary) {
  padding: 0.75rem 0.5rem;
}

/* Reduced motion: instant show, no rotation */
@media (prefers-reduced-motion: reduce) {
  .pp-faq summary::after {
    transition: none;
  }

  .pp-faq .pp-faq-content {
    transition: none;
  }
}

/* ===== EFFECT: pp-faq — END ===== */


/* ===== EFFECT: pp-lightbox (Image block lightbox styling) — START ===== */

.pp-lightbox .wp-lightbox-overlay {
  animation: pp-lightbox-fade-in var(--pp-duration-normal) var(--pp-ease) both;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

@keyframes pp-lightbox-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Close button */
.pp-lightbox .wp-lightbox-overlay .close-button,
.pp-lightbox .wp-lightbox-overlay button[aria-label="Close"] {
  appearance: none;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  border-radius: 50%;
  color: #fff;
  width: 40px;
  height: 40px;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background-color var(--pp-duration-fast) var(--pp-ease),
    transform var(--pp-duration-fast) var(--pp-ease);
}

.pp-lightbox .wp-lightbox-overlay .close-button:hover,
.pp-lightbox .wp-lightbox-overlay button[aria-label="Close"]:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: scale(1.1);
}

@media (prefers-reduced-motion: reduce) {
  .pp-lightbox .wp-lightbox-overlay {
    animation: none;
  }

  .pp-lightbox .wp-lightbox-overlay .close-button,
  .pp-lightbox .wp-lightbox-overlay button[aria-label="Close"] {
    transition: none;
  }
}

/* ===== EFFECT: pp-lightbox — END ===== */


/* ===== EFFECT: pp-menu (Mobile menu slide-in) — START ===== */

/*
 * Target the Navigation block's responsive overlay container.
 * WordPress adds .has-modal-open when the menu is toggled open.
 */
.pp-menu .wp-block-navigation__responsive-container {
  transform: translateX(100%);
  transition: transform var(--pp-duration-normal) var(--pp-ease);
  visibility: hidden;
}

.pp-menu .wp-block-navigation__responsive-container.has-modal-open {
  transform: translateX(0);
  visibility: visible;
}

@media (prefers-reduced-motion: reduce) {
  .pp-menu .wp-block-navigation__responsive-container {
    transition: none;
    transform: none;
  }

  .pp-menu .wp-block-navigation__responsive-container.has-modal-open {
    transform: none;
  }
}

/*
 * On desktop viewports where the nav is fully visible,
 * remove the slide transform so the menu displays normally.
 */
@media (min-width: 782px) {
  .pp-menu .wp-block-navigation__responsive-container {
    transform: none;
    visibility: visible;
  }
}

/* ===== EFFECT: pp-menu — END ===== */


/* ===== EFFECT: pp-divider-gradient (Gradient section divider) — START ===== */

.pp-divider-gradient {
  position: relative;
}

.pp-divider-gradient::before {
  content: "";
  display: block;
  width: 100%;
  height: var(--pp-divider-height);
  background: linear-gradient(
    90deg,
    var(--pp-gradient-start),
    var(--pp-gradient-end)
  );
  border-radius: 2px;
}

/* ===== EFFECT: pp-divider-gradient — END ===== */


/* ===== EFFECT: pp-divider-shape (SVG wave section divider) — START ===== */

.pp-divider-shape {
  position: relative;
}

.pp-divider-shape::before {
  content: "";
  display: block;
  width: 100%;
  height: var(--pp-shape-height);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M0,60 C200,120 400,0 600,60 C800,120 1000,0 1200,60 L1200,120 L0,120 Z' fill='%23f5f5f5'/%3E%3C/svg%3E");
  background-size: 100% 100%;
  background-repeat: no-repeat;
}

/*
 * Override the SVG fill color via a CSS custom property.
 * Because inline data-URI SVGs can't read CSS vars directly,
 * we layer a color overlay using background-color + mix-blend-mode
 * as a best-effort approach, but the most reliable way is to
 * update the data URI. The default is #f5f5f5 (light grey).
 *
 * To change the fill color, replace the hex value in the
 * data URI above (encoded as %23 + hex without #).
 * For example, %23ffffff = white, %230a0a0a = near-black.
 */

/* ===== EFFECT: pp-divider-shape — END ===== */
