/**
 * Components - xTools.com
 *
 * Reusable UI components: buttons, cards, forms, etc.
 * Matched to Figma source of truth.
 */

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25em; /* preserve the space when a wordmark <span> splits the label */
  padding: 16px 24px;
  font-family: var(--font-secondary);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--border-radius-pill);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Primary Button */
.btn-primary {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-text-inverse);
}

.btn-primary:hover {
  background-color: var(--color-primary-hover);
  color: var(--color-text-inverse);
  text-decoration: none;
}

/* Secondary/Outline Button */
.btn-secondary {
  padding: 11px 20px;
  font-size: var(--font-size-base);
  letter-spacing: -0.08px;
  background-color: var(--color-white);
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}

.btn-secondary:hover {
  background-color: var(--color-primary);
  color: var(--color-text-inverse);
  text-decoration: none;
}

/* White outline button (for dark backgrounds) */
.btn-outline-white {
  background-color: transparent;
  color: var(--color-white);
  border-color: var(--color-white);
}

.btn-outline-white:hover {
  background-color: var(--color-white);
  color: var(--color-primary);
  text-decoration: none;
}

/* Solid white button (dark text) — used on dark sections, e.g. Download PDF, Subscribe */
.btn-white {
  background-color: var(--color-white);
  color: var(--color-primary);
  border-color: var(--color-white);
}

.btn-white:hover {
  background-color: var(--color-bg-alt);
  color: var(--color-primary);
  text-decoration: none;
}

/* Button sizes */
.btn-sm {
  padding: 8px 16px;
  font-size: var(--font-size-sm);
}

.btn-lg {
  padding: 18px 32px;
  font-size: var(--font-size-md);
}

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

.card {
  background-color: var(--color-white);
  border-radius: var(--border-radius-md);
  overflow: hidden;
}

.card-bordered {
  border: 1px solid var(--color-border);
}

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

.card-image {
  width: 100%;
  height: auto;
  display: block;
}

.card-body {
  padding: var(--spacing-6);
}

.card-title {
  font-family: var(--font-primary);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--spacing-3);
}

.card-text {
  color: var(--color-text-light);
  margin-bottom: var(--spacing-4);
}

/* Blog card style from Figma */
.card-blog {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card-blog .card-image {
  height: 280px;
  object-fit: cover;
  background-color: var(--color-bg-alt);
}

.card-blog .card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-blog .card-title {
  font-size: var(--font-size-lg);
  line-height: var(--line-height-tight);
}

.card-blog .card-text {
  font-size: var(--font-size-sm);
  flex: 1;
}

/* Author info */
.card-author {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  margin-top: auto;
}

.card-author-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--border-radius-full);
  background-color: var(--color-bg-alt);
}

.card-author-name {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

.card-author-date {
  font-size: var(--font-size-xs);
  color: var(--color-text-subtle);
}

/* About page "democratize" cards — borderless, centred, icon on top. */
.about-card {
  text-align: center;
}

.about-card-icon {
  display: inline-block;
  width: 38px;
  height: 38px;
  box-sizing: content-box;
  padding: 12px;
  margin-bottom: var(--spacing-4);
  border: 1px solid var(--color-divider);
  border-radius: var(--border-radius-md);
}

.about-card-title {
  font-family: var(--font-primary);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--spacing-3);
}

.about-card-text {
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
  line-height: var(--line-height-relaxed);
}

/* Sector-page "benefits" columns — icon square on top, borderless, left-aligned. */
.benefit-icon {
  display: inline-block;
  width: 38px;
  height: 38px;
  box-sizing: content-box;
  padding: 12px;
  margin-bottom: var(--spacing-5);
  border: 1px solid var(--color-divider);
  border-radius: var(--border-radius-md);
}

.benefit-title {
  font-family: var(--font-primary);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--spacing-3);
}

.benefit-text {
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
  line-height: var(--line-height-relaxed);
  margin-bottom: var(--spacing-4);
}

.benefit-text:last-child {
  margin-bottom: 0;
}

/* ========================================
   FORMS
   ======================================== */

.form-group {
  margin-bottom: var(--spacing-4);
}

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  margin-bottom: var(--spacing-2);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font-secondary);
  font-size: var(--font-size-base);
  color: var(--color-text);
  background-color: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  transition: border-color var(--transition-fast);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--color-primary);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--color-text-muted);
}

/* A field the server rejected (e.g. a free email) — flagged until corrected. */
.form-input[aria-invalid="true"],
.form-textarea[aria-invalid="true"] {
  border-color: var(--color-error);
}

.form-input[aria-invalid="true"]:focus,
.form-textarea[aria-invalid="true"]:focus {
  border-color: var(--color-error);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

/* Newsletter form - Figma footer style */
.form-newsletter {
  display: flex;
  gap: var(--spacing-3);
}

.form-newsletter .form-input {
  flex: 1;
  background-color: transparent;
  border-color: var(--color-border-light);
  color: var(--color-text-inverse);
}

.form-newsletter .form-input::placeholder {
  color: rgb(255 255 255 / 60%);
}

@media (width <= 767px) {
  .form-newsletter {
    flex-direction: column;
  }
}

/* ========================================
   FEATURE BLOCKS
   ======================================== */

.feature {
  text-align: left;
}

.feature-icon {
  width: 48px;
  height: 48px;
  margin-bottom: var(--spacing-4);
}

.feature-title {
  font-family: var(--font-primary);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--spacing-2);
}

.feature-text {
  color: var(--color-text-light);
  font-size: var(--font-size-sm);
}

/* Product-page hero: text on the left, video/illustration on the right. */
.solution-hero {
  text-align: left;
  padding-top: var(--spacing-16);
  padding-bottom: var(--spacing-16);
}

.solution-hero .container {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: var(--spacing-12);
  align-items: center;
}

.solution-hero .hero-content {
  max-width: none;
  margin: 0;
}

.solution-hero .hero-title {
  font-family: var(--font-brand);
  font-size: 64px;
  font-weight: var(--font-weight-regular);
  letter-spacing: -0.01em;
}

/* Sector pages reuse the 2-col hero but the title is a sentence (Cairo),
   preceded by a small brand eyebrow ("xTools CCOES"). */
.sector-hero .hero-title {
  font-family: var(--font-primary);
}

.sector-eyebrow {
  display: block;
  font-family: var(--font-brand);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  margin-bottom: var(--spacing-4);
}

@media (width <= 767px) {
  .solution-hero .container {
    grid-template-columns: 1fr;
    gap: var(--spacing-8);
  }

  .solution-hero .hero-title {
    font-size: var(--font-size-4xl);
  }
}

.solution-hero-media {
  margin-top: var(--spacing-10);
}

.solution-hero .solution-hero-media {
  margin-top: 0;
}

.solution-hero-media .illustration {
  width: 100%;
  max-width: 620px;
}

/* Real YouTube embed in the product hero (matches live). */
.solution-video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  background: var(--color-black);
}

.solution-video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.solution-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--spacing-12) var(--spacing-10);
}

/* Each feature stacks vertically: bordered icon square, title, then text. */
.solution-feature-row {
  display: block;
}

.solution-feature-icon {
  width: 38px;
  height: 38px;
  box-sizing: content-box;
  padding: 12px;
  border: 1px solid var(--color-divider);
  border-radius: 8px;
  margin-bottom: var(--spacing-5);
}

.solution-feature-copy {
  min-width: 0;
}

.solution-feature-title {
  font-family: var(--font-primary);
  font-size: 24px;
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  margin-bottom: var(--spacing-3);
}

.solution-feature-text {
  margin: 0;
  color: var(--color-text-light);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
}

.solution-benefits .split {
  gap: var(--spacing-10);
  align-items: center;
}

.solution-benefits .split-content h2 {
  font-family: var(--font-primary);
  font-size: 48px;
  font-weight: var(--font-weight-regular);
  letter-spacing: -0.01em;
  margin-bottom: var(--spacing-4);
}

.solution-benefits .split-image {
  display: flex;
  justify-content: center;
}

.solution-benefits .split-image .illustration {
  width: 100%;
  max-width: 580px;
}

.solution-benefits .split-content p {
  margin-bottom: 0;
  color: var(--color-text-light);
}

/* ========================================
   SECTION HEADERS
   ======================================== */

.section-header {
  text-align: center;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: var(--spacing-12);
}

/* Left-aligned section header (product/feature pages). */
.section-header-left {
  text-align: left;
  max-width: 620px;
  margin-left: 0;
  margin-right: 0;
}

.section-label {
  display: inline-block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.48px;
  color: #333;
  margin-bottom: var(--spacing-3);
}

.section-title {
  font-family: var(--font-primary);
  font-size: 52px;
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.01em;
  margin-bottom: var(--spacing-4);
}

.section-subtitle {
  font-size: var(--font-size-base);
  color: var(--color-text-light);
}

/* ========================================
   CTA BLOCKS
   ======================================== */

.cta {
  text-align: center;
  padding: var(--spacing-16) var(--spacing-4);
}

.cta-title {
  font-family: var(--font-primary);
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.01em;
  color: var(--color-text);
  margin-bottom: var(--spacing-6);
}

/* The dark band is a contained, rounded card (not full-bleed), with a faint
   concentric-arc decoration emanating from opposite corners — matching live. */
.cta-dark {
  color: var(--color-text-inverse);
}

.cta-dark .container {
  background-color: var(--color-black);
  background-image: url("/images/decor/home-download-illustration.svg");
  background-repeat: no-repeat;
  background-position: bottom center;
  background-size: contain;
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-16) var(--spacing-8);
  overflow: hidden;
}

.cta-dark .cta-title,
.cta-dark .hero-subtitle,
.cta-dark p,
.cta-dark a {
  color: var(--color-text-inverse);
}

/* Live constrains the copy column to 560px (so the description wraps to 2 lines)
   and renders the subtext a touch heavier (medium) than the default body text. */
.cta-dark .hero-subtitle {
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
  font-weight: var(--font-weight-medium);
}

.streamline-section {
  padding-top: var(--spacing-10);
  padding-bottom: var(--spacing-8);
}

.streamline-shell {
  gap: var(--spacing-10);
}

.streamline-copy {
  max-width: 420px;
}

.streamline-copy .section-title,
.streamline-copy .section-subtitle {
  text-align: left;
}

.streamline-illustration {
  display: flex;
  justify-content: center;
}

.streamline-illustration .illustration {
  width: 100%;
  max-width: 821px;
}

.get-started-section {
  padding-top: var(--spacing-8);
  padding-bottom: var(--spacing-8);
}

.cta-stack {
  padding-top: var(--spacing-8);
  padding-bottom: var(--spacing-8);
}

/* "Get Started with xTools" sits on one centred line, with the brand
   wordmark rendered in the xTools font. */
.get-started-titles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: var(--spacing-3);
  margin-bottom: var(--spacing-6);
}

.get-started-titles .cta-title {
  margin-bottom: 0;
  line-height: 1.05;
}

.get-started-lead {
  font-size: 64px;
  font-weight: var(--font-weight-semibold);
}

.get-started-brand {
  font-family: var(--font-brand);
  font-size: 66px;
  font-weight: var(--font-weight-regular);
}

@media (width <= 767px) {
  .solution-hero-media {
    margin-top: var(--spacing-8);
  }

  .solution-feature-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-6);
  }

  .solution-feature-title {
    font-size: var(--font-size-base);
  }

  .solution-benefits .split {
    gap: var(--spacing-4);
  }

  .solution-benefits .split-content h2 {
    font-size: var(--font-size-2xl);
  }

  .streamline-copy .section-title,
  .streamline-copy .section-subtitle {
    text-align: center;
  }

  .streamline-illustration .illustration {
    max-width: 100%;
  }

  .streamline-shell {
    grid-template-columns: 1fr;
  }

  .get-started-lead {
    font-size: var(--font-size-4xl);
  }

  .get-started-brand {
    font-size: var(--font-size-4xl);
  }
}

/* ========================================
   BADGES & TAGS
   ======================================== */

.badge {
  display: inline-block;
  padding: 4px 12px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  border-radius: var(--border-radius-full);
  background-color: var(--color-bg-alt);
  color: var(--color-text);
}

.badge-primary {
  background-color: var(--color-primary);
  color: var(--color-text-inverse);
}

/* ========================================
   IMAGES & ILLUSTRATIONS
   ======================================== */

.img-fluid {
  max-width: 100%;
  height: auto;
}

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

.illustration {
  max-width: 100%;
  height: auto;
}

/* ========================================
   DIVIDERS
   ======================================== */

.divider {
  height: 1px;
  background-color: var(--color-border);
  border: none;
  margin: var(--spacing-8) 0;
}

.divider-dark {
  background-color: rgb(255 255 255 / 10%);
}

/* ========================================
   TEXT UTILITIES
   ======================================== */

.text-inverse {
  color: rgb(255 255 255 / 80%);
}

.text-muted {
  color: var(--color-text-subtle);
}

.small {
  font-size: var(--font-size-sm);
}

.lead {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-relaxed);
  margin-bottom: var(--spacing-4);
}

/* CTA buttons row */
.cta-buttons {
  display: flex;
  gap: var(--spacing-4);
  justify-content: center;
  flex-wrap: wrap;
}

/* Legal pages (privacy / terms) — simple long-form document. */
.legal-title {
  font-size: 40px;
  margin-bottom: var(--spacing-6);
}

.legal-content h2 {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-regular);
  margin-top: var(--spacing-10);
  margin-bottom: var(--spacing-4);
}

.legal-content p {
  line-height: var(--line-height-relaxed);
  color: var(--color-text-light);
  margin-bottom: var(--spacing-4);
}

/* Contact page styles — form fills the left, the info column is pinned to the
   right edge of the container (aligning with the nav CTA), matching live. */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--spacing-16);
  align-items: start;
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-8);
}

.contact-info-item {
  display: flex;
  gap: var(--spacing-4);
  align-items: flex-start;
}

.contact-info-icon {
  width: 28px;
  height: 28px;
  box-sizing: content-box;
  flex-shrink: 0;
  padding: var(--spacing-3);
  border: 1px solid var(--color-divider);
  border-radius: var(--border-radius-md);
}

.contact-info-title {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--spacing-1);
}

.contact-info-desc {
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
  margin-bottom: var(--spacing-2);
}

.contact-link {
  color: var(--color-primary);
  text-decoration: none;
  font-size: var(--font-size-base);
}

.contact-link:hover {
  text-decoration: underline;
}

@media (width <= 767px) {
  .contact-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-10);
  }
}

/* ========================================
   SOLUTION BLOCKS (shared: home + sector pages)
   ======================================== */

.solution-title {
  font-family: var(--font-brand);
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-regular);
  letter-spacing: -0.01em;
  margin-bottom: var(--spacing-4);
}

/* Each solution block is a 2-col grid: illustration in one column, and the
   content + its feature grid stacked in the other — matching live (where the
   feature points sit under the Discover button, not full-width below).
   Blocks alternate the illustration side (zigzag). The section-header is the
   container's first child, so the 2nd/4th blocks land on odd nth-child (3, 5). */
.solution-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-8) var(--spacing-12);
  align-items: center;
}

.solution-block .split {
  display: contents;
}

.solution-block .split-image {
  grid-column: 1;
  grid-row: 1 / span 2;
  display: flex;
  justify-content: center;
}

.solution-block .split-content {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
}

.solution-block .feature-grid {
  grid-column: 2;
  grid-row: 2;
  gap: var(--spacing-5) var(--spacing-8);
  margin-top: 0;
  align-self: start;
}

/* Reversed blocks (xImages, xCustom): illustration on the right. */
.solution-block:nth-child(odd) .split-image {
  grid-column: 2;
}

.solution-block:nth-child(odd) .split-content,
.solution-block:nth-child(odd) .feature-grid {
  grid-column: 1;
}

.solution-desc {
  font-size: var(--font-size-base);
  color: var(--color-text-light);
  line-height: var(--line-height-relaxed);
  margin-bottom: var(--spacing-6);
}

.solution-block .split-image .illustration {
  width: 100%;
  max-width: 580px;
}

.solution-block .feature {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--spacing-3);
  align-items: center;
}

.solution-block .feature-icon {
  width: 30px;
  height: 30px;
  margin-bottom: 0;
  box-sizing: content-box;
  padding: var(--spacing-3);
  background-color: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-md);
}

.solution-block .feature-title {
  margin: 0;
  font-family: var(--font-secondary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-relaxed);
}

@media (width <= 767px) {
  .solution-title {
    font-size: var(--font-size-2xl);
  }

  .solution-block {
    grid-template-columns: 1fr;
  }

  .solution-block .split-image,
  .solution-block .split-content,
  .solution-block .feature-grid,
  .solution-block:nth-child(odd) .split-image,
  .solution-block:nth-child(odd) .split-content,
  .solution-block:nth-child(odd) .feature-grid {
    grid-column: 1;
    grid-row: auto;
  }

  .solution-block .feature {
    align-items: flex-start;
  }

  .solution-block .feature-grid {
    gap: var(--spacing-4);
  }
}

