/* =============================================================================
   Page Blocks CSS
   All block types for the Page Builder feature.
   Classes use pb- prefix. Accent color via --page-accent (falls back to --pico-primary).
   ============================================================================= */

:root {
  --pb-accent: var(--page-accent, var(--pico-primary));
  --pb-border-radius: var(--pico-border-radius, 0.375rem);
  --pb-spacing: 2rem;
  --pb-content-max-width: 800px;
}

/* =============================================================================
   HERO BLOCK
   ============================================================================= */

.pb-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  background-color: var(--pico-card-background-color, #1a1a2e);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: 3rem 0;
  text-align: center;
  position: relative;
}

.pb-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 0;
  pointer-events: none;
}

.pb-hero-inner,
.pb-hero-content {
  position: relative;
  z-index: 1;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem var(--pb-spacing);
}

.pb-hero-title {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  color: #fff;
}

.pb-hero-subtitle {
  font-size: 1.2rem;
  font-weight: 400;
  opacity: 0.9;
  margin-bottom: 2rem;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  color: rgba(255, 255, 255, 0.9);
}

.pb-hero-cta {
  display: inline-block;
  padding: 0.85rem 2.5rem;
  background-color: var(--pb-accent);
  color: #fff !important;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.3px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.pb-hero-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  color: #fff !important;
  filter: brightness(1.15);
}

/* =============================================================================
   TEXT BLOCK
   ============================================================================= */

.pb-text {
  max-width: var(--pb-content-max-width);
  margin: 0 auto;
  padding: var(--pb-spacing) var(--pb-spacing);
}

.pb-text-content {
  line-height: 1.7;
}

.pb-text-content p {
  margin-bottom: 1.25em;
}

.pb-text-content p:last-child {
  margin-bottom: 0;
}

.pb-text-content h1,
.pb-text-content h2,
.pb-text-content h3,
.pb-text-content h4,
.pb-text-content h5,
.pb-text-content h6 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

.pb-text-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--pb-border-radius);
}

.pb-text-content pre,
.pb-text-content code {
  font-family: var(--pico-font-family-monospace, monospace);
}

.pb-text-content pre {
  overflow-x: auto;
  padding: 1rem;
  border-radius: var(--pb-border-radius);
  background-color: var(--pico-card-background-color, #1e1e2e);
}

.pb-text-content blockquote {
  border-left: 4px solid var(--pb-accent);
  padding-left: 1rem;
  margin-left: 0;
  opacity: 0.85;
  font-style: italic;
}

/* =============================================================================
   FEATURES BLOCK
   ============================================================================= */

.pb-features {
  padding: var(--pb-spacing);
  max-width: 1100px;
  margin: 0 auto;
}

.pb-features-grid {
  display: grid;
  gap: 1.5rem;
}

.pb-features-cols-2 { grid-template-columns: repeat(2, 1fr); }
.pb-features-cols-3 { grid-template-columns: repeat(3, 1fr); }
.pb-features-cols-4 { grid-template-columns: repeat(4, 1fr); }

.pb-feature-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.5rem 1rem;
  border: 1px solid var(--pico-card-border-color, rgba(255, 255, 255, 0.1));
  border-radius: var(--pb-border-radius);
  background-color: var(--pico-card-background-color, transparent);
  transition: box-shadow 0.2s ease;
}

.pb-feature-item:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.pb-feature-icon {
  font-size: 2rem;
  color: var(--pb-accent);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
}

.pb-feature-icon svg {
  width: 2rem;
  height: 2rem;
  color: var(--pb-accent);
  stroke: var(--pb-accent);
}

.pb-feature-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.pb-feature-desc {
  font-size: 0.9rem;
  opacity: 0.8;
  line-height: 1.5;
  margin: 0;
}

/* =============================================================================
   GALLERY BLOCK
   ============================================================================= */

.pb-gallery {
  padding: var(--pb-spacing);
  max-width: 1100px;
  margin: 0 auto;
}

.pb-gallery-grid {
  display: grid;
  gap: 1rem;
}

.pb-gallery-cols-2 { grid-template-columns: repeat(2, 1fr); }
.pb-gallery-cols-3 { grid-template-columns: repeat(3, 1fr); }
.pb-gallery-cols-4 { grid-template-columns: repeat(4, 1fr); }

.pb-gallery-item {
  cursor: pointer;
  overflow: hidden;
  border-radius: var(--pb-border-radius);
  background-color: var(--pico-card-background-color, #111);
  margin: 0;
}

.pb-gallery-item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  transition: transform 0.2s ease;
}

.pb-gallery-item:hover img {
  transform: scale(1.05);
}

.pb-gallery-item-image {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--pb-border-radius) var(--pb-border-radius) 0 0;
}

.pb-gallery-item:not(:has(.pb-gallery-caption)) .pb-gallery-item-image {
  border-radius: var(--pb-border-radius);
}

.pb-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.pb-gallery-item:hover img {
  transform: scale(1.05);
}

.pb-gallery-caption {
  font-size: 0.8rem;
  padding: 0.4rem 0.6rem;
  opacity: 0.7;
  text-align: center;
  line-height: 1.4;
}

/* =============================================================================
   CTA BLOCK
   ============================================================================= */

.pb-cta {
  text-align: center;
  padding: 3rem var(--pb-spacing);
}

.pb-cta-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.pb-cta-subtitle {
  font-size: 1rem;
  opacity: 0.8;
  margin-bottom: 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.pb-cta-button {
  display: inline-block;
  padding: 0.875rem 2.5rem;
  background-color: var(--pb-accent);
  color: #fff !important;
  text-decoration: none;
  border-radius: var(--pb-border-radius);
  font-weight: 600;
  font-size: 1.1rem;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.pb-cta-button:hover {
  opacity: 0.85;
  transform: translateY(-1px);
  color: #fff !important;
}

/* =============================================================================
   APP STORE BLOCK
   ============================================================================= */

.pb-appstore {
  text-align: center;
  padding: var(--pb-spacing);
}

.pb-appstore-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.pb-appstore-subtitle {
  font-size: 1rem;
  opacity: 0.75;
  margin-bottom: 1.5rem;
}

.pb-appstore-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.pb-appstore-badge {
  display: inline-block;
  max-height: 60px;
  width: auto;
  transition: opacity 0.2s ease;
}

.pb-appstore-badge img {
  max-height: 60px;
  width: auto;
  display: block;
}

.pb-appstore-badge:hover {
  opacity: 0.8;
}

/* =============================================================================
   VIDEO BLOCK
   ============================================================================= */

.pb-video {
  padding: var(--pb-spacing);
  max-width: var(--pb-content-max-width);
  margin: 0 auto;
}

.pb-video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
  border-radius: var(--pb-border-radius);
  background-color: #000;
}

.pb-video-container iframe,
.pb-video-container video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.pb-video-caption {
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.7;
  margin-top: 0.75rem;
}

/* =============================================================================
   TESTIMONIAL BLOCK
   ============================================================================= */

.pb-testimonial {
  max-width: 700px;
  margin: 0 auto;
  padding: var(--pb-spacing);
  text-align: center;
}

.pb-testimonial-quote {
  font-size: 1.25rem;
  font-style: italic;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  position: relative;
  padding: 0 1rem;
}

.pb-testimonial-quote::before {
  content: '\201C';
  font-size: 4rem;
  color: var(--pb-accent);
  position: absolute;
  top: -1rem;
  left: -0.5rem;
  line-height: 1;
  opacity: 0.6;
  font-style: normal;
}

.pb-testimonial-quote::after {
  content: '\201D';
  font-size: 4rem;
  color: var(--pb-accent);
  position: absolute;
  bottom: -2rem;
  right: -0.5rem;
  line-height: 1;
  opacity: 0.6;
  font-style: normal;
}

.pb-testimonial-author {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 2rem;
}

.pb-testimonial-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.pb-testimonial-author-info {
  text-align: left;
}

.pb-testimonial-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0;
  line-height: 1.3;
}

.pb-testimonial-role {
  font-size: 0.8rem;
  opacity: 0.7;
  margin: 0;
  line-height: 1.3;
}

/* =============================================================================
   DIVIDER BLOCK
   ============================================================================= */

.pb-divider {
  padding: 1rem var(--pb-spacing);
}

.pb-divider-line {
  border: none;
  border-top: 1px solid var(--pico-muted-border-color, rgba(255, 255, 255, 0.15));
  margin: 0;
}

.pb-divider-dots {
  text-align: center;
  letter-spacing: 0.5em;
  color: var(--pico-muted-color, #666);
  font-size: 1.2rem;
  user-select: none;
}

.pb-divider-space {
  min-height: 2rem;
  display: block;
}

/* =============================================================================
   FAQ BLOCK
   ============================================================================= */

.pb-faq {
  max-width: var(--pb-content-max-width);
  margin: 0 auto;
  padding: var(--pb-spacing);
}

.pb-faq-item {
  border-bottom: 1px solid var(--pico-muted-border-color, rgba(255, 255, 255, 0.15));
}

.pb-faq-item:first-of-type {
  border-top: 1px solid var(--pico-muted-border-color, rgba(255, 255, 255, 0.15));
}

.pb-faq-item summary {
  padding: 1rem 0.5rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.15s ease;
  border-radius: var(--pb-border-radius);
  user-select: none;
}

.pb-faq-item summary:hover {
  background-color: var(--pico-card-background-color, rgba(255, 255, 255, 0.05));
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

/* Hide default marker */
.pb-faq-item summary::-webkit-details-marker {
  display: none;
}

.pb-faq-item summary::after {
  content: '+';
  font-size: 1.25rem;
  font-weight: 300;
  color: var(--pb-accent);
  flex-shrink: 0;
  transition: transform 0.2s ease;
  line-height: 1;
}

.pb-faq-item[open] summary::after {
  transform: rotate(45deg);
}

.pb-faq-answer {
  padding: 0.25rem 0.75rem 1rem;
  font-size: 0.95rem;
  line-height: 1.65;
  opacity: 0.85;
}

.pb-faq-answer p:last-child {
  margin-bottom: 0;
}

/* =============================================================================
   LIGHTBOX
   ============================================================================= */

.pb-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background-color: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 1rem;
}

.pb-lightbox[hidden] {
  display: none;
}

.pb-lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--pb-border-radius);
  cursor: default;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.pb-lightbox-caption {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.85rem;
  text-align: center;
  max-width: 80vw;
  pointer-events: none;
}

.pb-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  color: rgba(255, 255, 255, 0.75);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0.25rem;
  transition: color 0.15s ease;
}

.pb-lightbox-close:hover {
  color: #fff;
}

/* =============================================================================
   IMAGE + TEXT BLOCK
   ============================================================================= */

.pb-imagetext {
  padding: var(--pb-spacing);
  max-width: var(--pb-content-max-width);
  margin: 0 auto;
}

.pb-imagetext-img {
  border-radius: var(--pb-border-radius);
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
}

/* Full width layout */
.pb-imagetext-full .pb-imagetext-img {
  margin-bottom: 1rem;
}

/* Split layout (image left / image right) */
.pb-imagetext-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
}

.pb-imagetext-split .pb-imagetext-img {
  max-height: 400px;
  object-fit: cover;
}

.pb-imagetext-image-right .pb-imagetext-img {
  order: 2;
}

.pb-imagetext-image-right .pb-imagetext-text {
  order: 1;
}

/* Float layouts */
.pb-imagetext-float-left .pb-imagetext-img {
  float: left;
  margin: 0 1.5rem 1rem 0;
}

.pb-imagetext-float-right .pb-imagetext-img {
  float: right;
  margin: 0 0 1rem 1.5rem;
}

/* Float image sizes */
.pb-imagetext-size-small .pb-imagetext-img { width: 30%; }
.pb-imagetext-size-medium .pb-imagetext-img { width: 45%; }
.pb-imagetext-size-large .pb-imagetext-img { width: 60%; }

/* Text in image+text blocks */
.pb-imagetext-text {
  font-size: 1rem;
  line-height: 1.7;
}

/* =============================================================================
   RESPONSIVE BREAKPOINTS
   ============================================================================= */

/* Mobile: < 768px */
@media (max-width: 768px) {
  .pb-features-grid,
  .pb-gallery {
    grid-template-columns: 1fr !important;
  }

  .pb-imagetext-split {
    grid-template-columns: 1fr !important;
  }

  .pb-imagetext-split .pb-imagetext-img,
  .pb-imagetext-split .pb-imagetext-text {
    order: unset !important;
  }

  .pb-imagetext-float-left .pb-imagetext-img,
  .pb-imagetext-float-right .pb-imagetext-img {
    float: none !important;
    width: 100% !important;
    margin: 0 0 1rem 0 !important;
  }

  .pb-hero {
    min-height: 300px;
    padding: 2rem 0;
  }

  .pb-hero-title {
    font-size: 1.8rem;
  }

  .pb-hero-subtitle {
    font-size: 1rem;
  }

  .pb-hero-inner {
    padding: 1.5rem 1rem;
  }

  .pb-cta {
    padding: 2rem 1rem;
  }

  .pb-cta-title {
    font-size: 1.4rem;
  }

  .pb-text,
  .pb-video,
  .pb-faq,
  .pb-testimonial {
    padding: 1.25rem 1rem;
  }

  .pb-features,
  .pb-gallery {
    padding: 1rem;
  }

  .pb-testimonial-quote {
    font-size: 1.05rem;
  }

  .pb-testimonial-quote::before,
  .pb-testimonial-quote::after {
    font-size: 3rem;
  }
}

/* Tablet: 769px – 1024px */
@media (min-width: 769px) and (max-width: 1024px) {
  .pb-features-grid,
  .pb-gallery {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .pb-hero-title {
    font-size: 2rem;
  }
}

/* =============================================================================
   DARK / LIGHT THEME ADJUSTMENTS
   ============================================================================= */

/* Ensure hero title is readable in both themes when no background image */
@media (prefers-color-scheme: light) {
  .pb-hero:not([style*="background-image"]) .pb-hero-title,
  .pb-hero:not([style*="background-image"]) .pb-hero-subtitle {
    text-shadow: none;
  }
}
