/* ================================================================
   PAGE BLOCKS - Styles for the page builder block system.
   These complement the existing article-block styles in styles.css.
   ================================================================ */

/* ---- Shared ---- */
.page-block {
  width: 100%;
}

.page-section-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-align: center;
  color: var(--primary-dark, rgb(0, 44, 53));
}

.page-section-subtitle {
  font-size: 1.1rem;
  color: var(--gray-600, #4b5563);
  max-width: 640px;
  margin: 0 auto 2rem;
  text-align: center;
  line-height: 1.7;
}

/* ---- Page loading ---- */
.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color, #e0e0e0);
  border-top-color: var(--primary-blue, rgb(0, 142, 201));
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ---- Hero block ---- */
.page-hero {
  position: relative;
  min-height: 500px;
  display: flex;
  align-items: center;
  overflow: hidden;
  color: #fff;
}

.page-hero--full {
  height: 100vh;
  min-height: 650px;
}

.page-hero__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.page-hero__bg img,
.page-hero__bg video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.page-hero__bg-fallback {
  position: absolute;
  inset: 0;
  z-index: -1;
}

.page-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0, 44, 53, 0.55) 0%, rgba(0, 44, 53, 0.50) 100%);
  z-index: 1;
}

.page-hero__overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(80% 120% at 90% 100%, rgba(0, 142, 201, 0.2), transparent 60%);
}

.page-hero__content {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 4rem 0;
  width: 100%;
}

.page-hero__text {
  flex: 1;
}

.page-hero__text h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 1rem;
  color: white;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.page-hero__subtitle {
  font-size: clamp(1rem, 2vw, 1.35rem);
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.3);
  margin-bottom: 1.5rem;
  max-width: 560px;
}

.page-hero__ctas {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-hero__ctas .btn-primary {
  background: var(--primary-blue);
  box-shadow: 0 4px 20px rgba(0, 142, 201, 0.4);
}

.page-hero__ctas .btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(10px);
  color: white;
}

.page-hero__product {
  flex: 0 0 auto;
  max-width: 350px;
}

.page-hero__product img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 8px 32px rgba(0,0,0,0.3));
}

/* ---- Hero product slider ---- */
.hero-slider {
  position: relative;
}

.hero-slider__track {
  position: relative;
  width: 100%;
  min-height: 250px;
}

.hero-slider__slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

.hero-slider__slide.active {
  opacity: 1;
  position: relative;
  pointer-events: auto;
}

.hero-slider__dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.hero-slider__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.5);
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s;
}

.hero-slider__dot:hover {
  border-color: white;
}

.hero-slider__dot.active {
  background: white;
  border-color: white;
}

/* ---- CTA Banner block ---- */
.page-cta-banner {
  padding: 4rem 0;
  text-align: center;
}

.page-cta-banner h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--primary-dark, rgb(0, 44, 53));
}

.page-cta-banner p {
  max-width: 700px;
  margin: 0 auto 2rem;
  color: var(--gray-600, #4b5563);
  font-size: 1.1rem;
  line-height: 1.7;
}

/* ---- Link Cards block ---- */
.page-link-cards {
  padding: 4rem 0;
}

.page-link-cards__grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), 1fr);
  gap: 1.5rem;
}

.page-link-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem 1.5rem;
  background: var(--surface, #fff);
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: var(--radius-lg, 6px);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, box-shadow 0.2s;
}

.page-link-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.page-link-card__icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: rgba(0, 142, 201, 0.1);
  color: var(--primary-blue, rgb(0, 142, 201));
  margin-bottom: 1rem;
}

.page-link-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.page-link-card p {
  font-size: 0.875rem;
  color: var(--gray-600, #4b5563);
  margin: 0;
  line-height: 1.6;
}

/* ---- Features grid ---- */
.page-features {
  padding: 4rem 0;
}

.page-features__grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), 1fr);
  gap: 2rem;
}

.page-features__item {
  text-align: center;
  padding: 1.5rem;
}

.page-features--cards .page-features__item {
  background: var(--surface, #fff);
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: var(--radius-lg, 6px);
  transition: box-shadow 0.2s, transform 0.2s;
}

.page-features--cards .page-features__item:hover {
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

.page-features__icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: rgba(0, 142, 201, 0.1);
  color: var(--primary-blue, rgb(0, 142, 201));
  margin-bottom: 0.75rem;
}

.page-features__icon--success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success, rgb(16, 185, 129));
}

.page-features__icon--warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning, rgb(245, 158, 11));
}

.page-features__item h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.page-features__item p {
  font-size: 0.9rem;
  color: var(--gray-600, #4b5563);
  margin: 0;
  line-height: 1.6;
}

/* ---- Stats block ---- */
.page-stats {
  padding: 3rem 0;
  background: var(--surface-color, #f5f5f5);
}

.page-stats__grid {
  display: flex;
  justify-content: center;
  gap: 3rem;
  flex-wrap: wrap;
}

.page-stats__item {
  text-align: center;
}

.page-stats__number {
  display: block;
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary-blue, rgb(0, 142, 201));
  line-height: 1.2;
}

.page-stats__label {
  font-size: 0.9rem;
  opacity: 0.7;
}

/* ---- Timeline ---- */
.page-timeline {
  padding: 4rem 0;
}

.page-timeline__track {
  position: relative;
  padding-left: 2.5rem;
  border-left: 2px solid var(--border-color, #e0e0e0);
  margin-left: 1rem;
}

.page-timeline__entry {
  position: relative;
  padding-bottom: 2rem;
}

.page-timeline__entry:last-child {
  padding-bottom: 0;
}

.page-timeline__marker {
  position: absolute;
  left: -2.85rem;
  top: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-blue, rgb(0, 142, 201));
  border: 3px solid var(--bg-color, #fff);
}

.page-timeline__year {
  position: absolute;
  left: 28px;
  top: -2px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary-blue, rgb(0, 142, 201));
  white-space: nowrap;
}

.page-timeline__content {
  padding-left: 3rem;
}

.page-timeline__content h3 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}

.page-timeline__content p {
  margin: 0;
  font-size: 0.9rem;
  opacity: 0.75;
}

/* ---- Certifications ---- */
.page-certs {
  padding: 4rem 0;
  background: var(--surface-color, #f5f5f5);
}

.page-certs__grid {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.page-certs__badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-color, #e0e0e0);
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
}

.page-certs__badge i {
  font-size: 1.25rem;
  color: var(--primary-blue, rgb(0, 142, 201));
}

/* ---- Icon cards ---- */
.page-icon-cards {
  padding: 4rem 0;
}

.page-icon-cards__grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), 1fr);
  gap: 1.5rem;
}

.page-icon-card {
  display: block;
  padding: 2rem;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-color, #e0e0e0);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s, transform 0.2s;
}

a.page-icon-card:hover {
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

.page-icon-card__icon {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--primary-blue, rgb(0, 142, 201));
}

.page-icon-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.page-icon-card p {
  margin: 0;
  font-size: 0.9rem;
  opacity: 0.75;
}

/* ---- Functional block placeholder ---- */
.page-functional-block {
  min-height: 100px;
}

.page-functional-block[data-block-type="slot_machine"] {
  background: var(--gray-100);
  padding: 4rem 0;
}

/* ---- Contact / Quote form styles (mirrored from contact.html, quote.html) ---- */
body:not(.home-page) .page-functional-block .contact-form-section.section,
.page-functional-block section.section.contact-form-section { padding-top: 5rem !important; padding-bottom: 3rem !important; }
.contact-form-section .contact-grid,
.quote-form-section .quote-main-grid {
  display: grid;
  gap: 3rem;
  align-items: start;
}
.contact-form-section .contact-grid {
  grid-template-columns: 1fr 1fr;
}
.quote-form-section .quote-main-grid {
  grid-template-columns: 1.5fr 2fr;
}

.contact-form-section .form-group,
.quote-form-section .form-group {
  margin-bottom: 1.25rem;
}

.contact-form-section .form-label,
.quote-form-section .form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: var(--gray-700);
}

.contact-form-section .form-input,
.contact-form-section .form-select,
.contact-form-section .form-textarea,
.quote-form-section .form-input,
.quote-form-section .form-select,
.quote-form-section .form-textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md, 8px);
  font-size: 0.9375rem;
  font-family: 'Geologica', sans-serif;
  transition: border-color 0.2s;
  background: var(--input-bg, #fff);
  color: var(--text-color, #1f2937);
}

.contact-form-section .form-input:focus,
.contact-form-section .form-select:focus,
.contact-form-section .form-textarea:focus,
.quote-form-section .form-input:focus,
.quote-form-section .form-select:focus,
.quote-form-section .form-textarea:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(0, 142, 201, 0.1);
}

.contact-form-section .form-textarea,
.quote-form-section .form-textarea {
  resize: vertical;
  min-height: 120px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.contact-info-card {
  background: var(--card-bg, #fff);
  border-radius: var(--radius-lg, 12px);
  padding: 1.5rem;
  border: 1px solid var(--gray-200, #e5e7eb);
  margin-bottom: 1.5rem;
}
.contact-info-card h4 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--primary-dark);
}
.contact-info-item {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: flex-start;
}
.contact-info-item:last-child { margin-bottom: 0; }
.contact-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md, 8px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 142, 201, 0.1);
  flex-shrink: 0;
}
.contact-icon svg,
.contact-icon i {
  width: 20px;
  height: 20px;
  color: var(--primary-blue);
}

.form-success {
  text-align: center;
  padding: 3rem 1rem;
}
.form-success h3 {
  color: var(--success, #10b981);
  margin-bottom: 0.5rem;
}

/* Custom modal (for form submissions) */
.custom-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 10000;
  opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s;
}
.custom-modal-overlay.active { opacity: 1; visibility: visible; }
.custom-modal {
  background: white; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  max-width: 500px; width: 90%; padding: 2rem; transform: scale(0.9) translateY(20px); transition: transform 0.3s;
}
.custom-modal-overlay.active .custom-modal { transform: scale(1) translateY(0); }
.custom-modal-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.custom-modal-icon { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0; }
.custom-modal-icon.success { background: #10b981; color: white; }
.custom-modal-icon.error { background: #ef4444; color: white; }
.custom-modal-title { font-size: 1.5rem; font-weight: 700; color: #1f2937; margin: 0; }
.custom-modal-content { color: #6b7280; line-height: 1.6; margin-bottom: 1.5rem; }
.custom-modal-inquiry { background: #f3f4f6; padding: 1rem; border-radius: 8px; margin-bottom: 1.5rem; font-family: monospace; color: #374151; font-weight: 600; }
.custom-modal-button { width: 100%; padding: 0.875rem 1.5rem; background: var(--primary-blue, #1e3a8a); color: white; border: none; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; }
.custom-modal-button:hover { filter: brightness(1.1); }
.custom-modal-button.error { background: #dc2626; }
.custom-modal-button.error:hover { background: #b91c1c; }

@media (max-width: 768px) {
  .contact-form-section .contact-grid,
  .quote-form-section .quote-main-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .form-row-2 { grid-template-columns: 1fr; }
}

/* ---- Error state ---- */
.page-error {
  min-height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .page-hero {
    min-height: 400px;
  }

  .page-hero--full {
    height: auto;
    min-height: 550px;
    padding-top: 90px;
    padding-bottom: 60px;
  }

  .page-hero__content {
    flex-direction: column;
    text-align: center;
    padding: 3rem 0;
  }

  .page-hero__ctas {
    justify-content: center;
  }

  .page-hero__product {
    max-width: 200px;
  }

  .page-features__grid,
  .page-icon-cards__grid,
  .page-link-cards__grid {
    grid-template-columns: 1fr;
  }

  .page-stats__grid {
    gap: 1.5rem;
  }

  .page-section-title {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .page-hero__text h1 {
    font-size: 1.75rem;
  }
}

/* ---- Articles Carousel Block ---- */
.article-card {
  display: block;
  text-decoration: none;
  height: 100%;
}

.article-category {
  background: var(--primary-blue);
  color: white;
  padding: 0.375rem 0.75rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-block;
  margin-bottom: 1rem;
  text-transform: uppercase;
}

.article-category.installation { background: var(--success); }
.article-category.maintenance { background: var(--warning); }
.article-category.selection { background: var(--primary-dark); }
.article-category.history { background: #7c5c3e; }

.article-card h3 {
  color: var(--primary-dark);
  font-size: 1.125rem;
  margin-bottom: 0.75rem;
  transition: color var(--transition-base);
}

.article-card:hover h3 {
  color: var(--primary-blue);
}

.article-excerpt {
  color: var(--gray-600);
  font-size: 0.875rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.article-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--gray-500);
  padding-top: 1rem;
  border-top: 1px solid var(--gray-200);
}

.article-meta svg {
  width: 14px;
  height: 14px;
  margin-right: 0.25rem;
}

.category-section {
  margin-bottom: 4rem;
}

.category-section h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 1.5rem;
  text-transform: uppercase;
}

/* ---- FAQ Accordion ---- */
.faq-item {
  margin-bottom: 1rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md, 8px);
  overflow: hidden;
  transition: box-shadow var(--transition-base, 0.25s ease);
}
.faq-item:hover { box-shadow: var(--shadow-md); }
.faq-question {
  padding: 1.25rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface, white);
  transition: background var(--transition-base, 0.25s ease);
  user-select: none;
}
.faq-question:hover { background: var(--gray-50, #f9fafb); }
.faq-question h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--primary-dark);
  flex: 1;
}
.faq-icon {
  width: 24px;
  height: 24px;
  color: var(--primary-blue);
  transition: transform var(--transition-base, 0.25s ease);
  flex-shrink: 0;
  margin-left: 1rem;
}
.faq-item.open .faq-icon { transform: rotate(180deg); }
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}
.faq-item.open .faq-answer {
  max-height: 1000px;
  transition: max-height 0.5s ease-in;
}
.faq-answer-content {
  padding: 0 1.25rem 1.25rem 1.25rem;
  color: var(--gray-700);
  line-height: 1.7;
}
.faq-answer-content p { margin-bottom: 0.75rem; }
.faq-answer-content ul, .faq-answer-content ol { margin: 0.75rem 0; padding-left: 1.5rem; }
.faq-answer-content li { margin-bottom: 0.5rem; }
@media (max-width: 768px) {
  .faq-question h3 { font-size: 1rem; }
}

.carousel-container {
  position: relative;
}

.carousel-container::before,
.carousel-container::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 80px;
  z-index: 5;
  pointer-events: none;
}

.carousel-container::before {
  left: 0;
  background: linear-gradient(to right, var(--surface, #fff), transparent);
}

.carousel-container::after {
  right: 0;
  background: linear-gradient(to left, var(--surface, #fff), transparent);
}

.carousel-track {
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0.5rem 0;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

.carousel-slide {
  flex: 0 0 calc(25% - 1rem);
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: white;
  border: 2px solid var(--primary-blue);
  color: var(--primary-blue);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-nav i {
  font-size: 1.5rem;
  line-height: 1;
}

.carousel-nav:hover:not(:disabled) {
  background: var(--primary-blue);
  color: white;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}

.carousel-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.carousel-prev { left: -70px; }
.carousel-next { right: -70px; }

@media (max-width: 1024px) {
  .carousel-slide {
    flex: 0 0 calc(33.333% - 1rem);
  }
}

@media (max-width: 768px) {
  .carousel-slide {
    flex: 0 0 calc(100% - 1rem);
  }

  .carousel-nav {
    display: none;
  }
}

@media (min-width: 769px) {
  .category-section {
    overflow: visible;
  }
}
