/**
 * Xenopz Design System - Global Classes
 * =======================================
 *
 * Reusable component classes for the Xenopz website.
 * These classes are designed to be applied via the WordPress block editor's
 * Additional CSS Classes field or directly in template parts.
 *
 * All classes use design tokens from custom-tokens.css.
 *
 * Requirements: 2.3, 2.4, 1.1
 */

/* =========================================================================
   BUTTONS
   ========================================================================= */

/**
 * .x-btn-primary
 * Primary CTA button — dark teal background, white text, orange glow on hover.
 */
.x-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.75rem;
  background: var(--x-teal-900);
  color: var(--x-white);
  font-family: var(--x-font-body);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.4;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  text-decoration: none;
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.x-btn-primary:hover,
.x-btn-primary:focus-visible {
  box-shadow: 0 0 0 3px var(--x-orange-500);
  transform: translateY(-1px);
  color: var(--x-white);
  text-decoration: none;
}

.x-btn-primary:focus-visible {
  outline: 2px solid var(--x-orange-500);
  outline-offset: 2px;
}

.x-btn-primary:active {
  transform: translateY(0);
}

/**
 * .x-btn-secondary
 * Secondary CTA button — transparent background, teal border, orange hover.
 */
.x-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.75rem;
  background: transparent;
  color: var(--x-teal-900);
  font-family: var(--x-font-body);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.4;
  border: 2px solid var(--x-teal-900);
  border-radius: 16px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.x-btn-secondary:hover,
.x-btn-secondary:focus-visible {
  background: rgba(242, 106, 27, 0.08);
  border-color: var(--x-orange-500);
  color: var(--x-teal-900);
  text-decoration: none;
}

.x-btn-secondary:focus-visible {
  outline: 2px solid var(--x-orange-500);
  outline-offset: 2px;
}

.x-btn-secondary:active {
  background: rgba(242, 106, 27, 0.12);
}

/* =========================================================================
   CARDS
   ========================================================================= */

/**
 * .x-card
 * Base card class — warm card background, border, rounded corners, soft shadow.
 */
.x-card {
  background: var(--x-bg-card);
  border: 2px solid var(--x-border);
  border-radius: var(--x-radius-lg);
  box-shadow: var(--x-shadow-card);
  padding: var(--x-space-md);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.x-card:hover {
  box-shadow: var(--x-shadow-hover);
}

/**
 * .x-card-story
 * Story card variant — large image slot with short title and one-line text.
 * Used for services and homepage story blocks.
 */
.x-card-story {
  display: flex;
  flex-direction: column;
  gap: var(--x-space-sm);
}

.x-card-story img {
  width: 100%;
  height: auto;
  border-radius: var(--x-radius-md);
  object-fit: cover;
  aspect-ratio: 3 / 2;
}

.x-card-story h3,
.x-card-story .x-card-story__title {
  font-family: var(--x-font-heading);
  font-weight: 800;
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
  line-height: 1.2;
  color: var(--x-teal-900);
  margin: 0;
}

.x-card-story p,
.x-card-story .x-card-story__text {
  font-size: 1rem;
  line-height: 1.5;
  color: var(--x-ink);
  margin: 0;
}

/**
 * .x-card-proof
 * Proof/trust card variant — icon slot for governance and trust blocks.
 * Works on both light and dark backgrounds.
 */
.x-card-proof {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--x-space-sm);
  padding: var(--x-space-md);
}

.x-card-proof h4,
.x-card-proof .x-card-proof__title {
  font-family: var(--x-font-heading);
  font-weight: 800;
  font-size: 1.125rem;
  line-height: 1.3;
  color: var(--x-teal-900);
  margin: 0;
}

.x-card-proof p,
.x-card-proof .x-card-proof__text {
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--x-ink);
  margin: 0;
}

/* Proof card on dark backgrounds (.x-section-dark context) */
.x-section-dark .x-card-proof {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--x-teal-700);
}

.x-section-dark .x-card-proof h4,
.x-section-dark .x-card-proof .x-card-proof__title {
  color: var(--x-white);
}

.x-section-dark .x-card-proof p,
.x-section-dark .x-card-proof .x-card-proof__text {
  color: rgba(255, 255, 255, 0.85);
}

/**
 * .x-card-case
 * Case study card variant — thumbnail + challenge/approach/result layout with CTA.
 */
.x-card-case {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--x-space-sm);
}

.x-card-case img {
  width: 100%;
  height: auto;
  border-radius: var(--x-radius-md);
  object-fit: cover;
  aspect-ratio: 16 / 9;
}

.x-card-case h3,
.x-card-case .x-card-case__title {
  font-family: var(--x-font-heading);
  font-weight: 800;
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
  line-height: 1.2;
  color: var(--x-teal-900);
  margin: 0;
}

.x-card-case p,
.x-card-case .x-card-case__text {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--x-ink);
  margin: 0;
}

.x-card-case .x-btn-primary,
.x-card-case .x-btn-secondary {
  align-self: flex-start;
  margin-top: var(--x-space-xs);
}

/* =========================================================================
   SECTIONS
   ========================================================================= */

/**
 * .x-section-warm
 * Section with warm beige background — main page canvas feel.
 */
.x-section-warm {
  background: var(--x-bg-warm);
  padding: var(--x-space-2xl) 0;
}

/**
 * .x-section-soft
 * Section with soft alternating background — visual rhythm between sections.
 */
.x-section-soft {
  background: var(--x-bg-soft);
  padding: var(--x-space-2xl) 0;
}

/**
 * .x-section-dark
 * Dark teal section — trust blocks, footer-like panels, governance content.
 */
.x-section-dark {
  background: var(--x-teal-900);
  color: var(--x-white);
  padding: var(--x-space-2xl) 0;
}

.x-section-dark h2,
.x-section-dark h3,
.x-section-dark h4 {
  color: var(--x-white);
}

.x-section-dark p {
  color: rgba(255, 255, 255, 0.85);
}

.x-section-dark a {
  color: var(--x-orange-500);
}

.x-section-dark a:hover {
  color: var(--x-orange-700);
}

/* =========================================================================
   LAYOUT
   ========================================================================= */

/**
 * .x-container
 * Content width constraint — max 1200px, centered, responsive padding.
 */
.x-container {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--x-space-md);
  padding-right: var(--x-space-md);
  width: 100%;
}

/* Tighter padding on smaller screens */
@media (max-width: 767px) {
  .x-container {
    padding-left: var(--x-space-sm);
    padding-right: var(--x-space-sm);
  }
}

/* =========================================================================
   ICON STICKER
   ========================================================================= */

/**
 * .x-icon-sticker
 * Icon wrapper — 64x64, teal border, rounded, centered content.
 * Used for process steps, card icons, and trust block icons.
 */
.x-icon-sticker {
  width: 64px;
  height: 64px;
  min-width: 64px;
  min-height: 64px;
  border: 2px solid var(--x-teal-700);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--x-bg-card);
  box-shadow: 0 2px 8px rgba(7, 59, 68, 0.06);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.x-icon-sticker:hover {
  border-color: var(--x-orange-500);
  box-shadow: 0 2px 12px rgba(242, 106, 27, 0.15);
}

.x-icon-sticker img,
.x-icon-sticker svg {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

/* Icon sticker on dark backgrounds */
.x-section-dark .x-icon-sticker {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--x-teal-700);
}

.x-section-dark .x-icon-sticker:hover {
  border-color: var(--x-orange-500);
}


/* =========================================================================
   WORDPRESS BLOCK BUTTON — WRAPPER-TO-LINK PASS-THROUGH
   ========================================================================= */

/**
 * WordPress wraps buttons in .wp-block-button > .wp-block-button__link.
 * These rules ensure hover/focus states apply to the actual clickable <a> element.
 */

.wp-block-button.x-btn-primary .wp-block-button__link {
  background: var(--x-teal-900);
  color: var(--x-white);
  font-family: var(--x-font-body);
  font-weight: 600;
  font-size: 1rem;
  border: none;
  border-radius: 16px;
  padding: 0.875rem 1.75rem;
  text-decoration: none;
  transition: box-shadow 0.2s, transform 0.15s;
}

.wp-block-button.x-btn-primary .wp-block-button__link:hover,
.wp-block-button.x-btn-primary .wp-block-button__link:focus-visible {
  box-shadow: 0 0 0 3px var(--x-orange-500);
  transform: translateY(-1px);
}

.wp-block-button.x-btn-secondary .wp-block-button__link {
  background: transparent;
  color: var(--x-teal-900);
  font-family: var(--x-font-body);
  font-weight: 600;
  font-size: 1rem;
  border: 2px solid var(--x-teal-900);
  border-radius: 16px;
  padding: 0.875rem 1.75rem;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
}

.wp-block-button.x-btn-secondary .wp-block-button__link:hover,
.wp-block-button.x-btn-secondary .wp-block-button__link:focus-visible {
  background: rgba(242, 106, 27, 0.08);
  border-color: var(--x-orange-500);
}


/* =========================================================================
   IMAGE SCALING — Ensure images fit within their containers
   ========================================================================= */

/**
 * Prevent images from overflowing columns/groups.
 * Images scale down to fit the available width while maintaining aspect ratio.
 */
.wp-block-image img,
.wp-block-column img,
.x-hero-image img,
.x-card img,
.x-card-story img,
.x-card-case img {
  max-width: 100%;
  height: auto;
  object-fit: contain;
}
