/**
 * CSS Variables
 * Centralized theme variables for
 * standardizing card styles, layout spacing,
 * background, and step-by-step layout.
 */
:root {
  /* Card */
  --card-bg: #fff;
  --card-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.05);
  --card-radius: 0.5rem;

  /* Landing Page */
  --landing-gap: 1.5rem;
  --landing-gap-mobile: 1rem;
  --landing-mb: 2rem;
  --landing-mb-mobile: 1rem;
  --page-width: min(100%, 96.875rem); /* 1550px */

  /* Thumbnails */
  --thumbnail-padding: 1.5rem;
  --thumbnail-radius: 0.5rem;

  /* Footer */
  --footer-border: 0.75rem solid #ffc107;
  --footer-bg: #000;
  --footer-color: #fff;
  --footer-gap: 0.75rem;
  --footer-social-icon-size: 1.25rem;
  --footer-social-icon-height: 1.5rem;
  --footer-social-gap: 0.75rem;

  /* Swiper */
  --swiper-slide-mb: 1.25rem;
  --swiper-pagination-active: #ffb71b;

  /* Forms */
  --form-width: 30rem;
  --form-height: 10rem;

  /* Badges */
  --badge-mr: 0.3125rem;

  /* Workflow CTA */
  --workflow-cta-mt: 2.5rem;
  --workflow-cta-mb: 2rem;
  --workflow-cta-padding: 1.5rem 2rem;
  --workflow-cta-bg: #ececec;
  --workflow-cta-radius: 1.5rem;
  --workflow-cta-gap: 2rem;
  --workflow-cta-icon-size: 3rem;
  --workflow-cta-icon-gap: 0.625rem;

  /* Workflow CTA Button */
  --workflow-cta-btn-h: 2.5rem;
  --workflow-cta-btn-maxw: 17.5rem;
  --workflow-cta-btn-padding: 0.5rem 1rem;
  --workflow-cta-btn-bg: #fff;
  --workflow-cta-btn-color: #000;
  --workflow-cta-btn-radius: 0.25rem;
  --workflow-cta-btn-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.2);
  --workflow-cta-btn-hover-bg: #ececec;

  /* Stars */
  --star-text-color: #353535;
}

/**
 * Dark Theme Variables
 */
html[data-theme="dark"] {
  --card-bg: #1e1e1e;
  --card-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.5);
  --footer-bg: #121212;
  --footer-color: #fff;
  --workflow-cta-bg: #353535;
  --workflow-cta-btn-bg: #000;
  --workflow-cta-btn-color: #fff;
  --workflow-cta-btn-border: 1px solid #353535;
  --workflow-cta-btn-hover-bg: #ccc;
  --star-text-color: #ececec;
}

/**
 * Card Styles
 */
.testimonial-card {
  background: var(--card-bg);
  box-shadow: var(--card-shadow);
  border-radius: var(--card-radius);
  height: 100%;
}

/**
 * Landing Page Layout
 */
.projects-landingpage,
.blogs-landingpage {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--landing-gap);
  margin-bottom: var(--landing-mb);
}

@media (max-width: 1200px) {
  .projects-landingpage,
  .blogs-landingpage {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--landing-gap-mobile);
  }
}

.bd-page-width {
  max-width: var(--page-width) !important;
}

/**
 * Thumbnails
 */
.project-lp-thumbnail {
  padding: var(--thumbnail-padding);
  border-radius: var(--thumbnail-radius);
}

.project-card .sd-card {
  padding: var(--thumbnail-padding);
}

/**
 * Footer
 */
.bd-footer {
  border-top: var(--footer-border);
  width: 100%;
  color: var(--footer-color);
  background-color: var(--footer-bg);
}

.footer-left h4,
.footer-right h4 {
  color: var(--footer-color);
}

.bd-footer a {
  color: var(--footer-color);
}

.footer-ansys-logo {
  width: 6.34375rem; /* 101.5px */
  object-fit: contain;
}

.carousel {
  background-color: var(--footer-bg) !important;
}

/**
 * Footer Links
 */
.external-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  gap: 0.5rem;
}

.external-link .link-text {
  display: inline-block;
  width: 7.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.external-link i {
  font-size: 0.85rem;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: var(--footer-gap);
  justify-content: flex-end;
  width: 100%;
}

/**
 * Swiper (Project Carousel)
 */
.swiper-wrapper {
  display: flex;
  align-items: stretch !important;
}

.swiper-slide {
  display: flex;
  height: auto !important;
}

.swiper-slide .project-card {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  overflow: hidden;
  margin-bottom: var(--swiper-slide-mb);
}

.swiper-pagination {
  position: initial !important;
}

/**
 * General Overrides
 */
.bd-header-article {
  display: none !important;
}

.bd-main .bd-content {
  display: flex !important;
  height: 100% !important;
  justify-content: center !important;
}

.bd-main .bd-content .bd-article-container {
  width: 100% !important;
}

.center {
  margin: 0 auto !important;
}

#hero-image {
  transition: opacity 0.5s ease-in-out;
  opacity: 1;
}

.fade-out {
  opacity: 0;
}

.fade-in {
  opacity: 1;
}

/**
 * Contact Us
 */
.mb-3 .form-control {
  width: var(--form-width);
}

textarea.form-control {
  height: var(--form-height);
}

.swiper-pagination-clickable .swiper-pagination-bullet-active {
  background: var(--swiper-pagination-active) !important;
}

/**
 * Footer Social Icons
 */
.footer-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-end;
  width: 100%;
}

.footer-right .social-icons {
  display: flex;
  gap: 0.5rem;
}

.footer-right .social-icons .icon {
  display: inline-block;
  width: var(--footer-social-icon-size);
  height: var(--footer-social-icon-height);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  transition: background-image 0.2s;
}

.footer-right .social-icons .icon-youtube {
  background-image: url(https://www.ansys.com/etc.clientlibs/ansysincprogram/clientlibs/clientlib-site/resources/images/icon-youtube-white.png);
  width: 1.8125rem; /* Already in rem */
}

.footer-right .social-icons .icon-youtube:hover {
  background-image: url(https://www.ansys.com/etc.clientlibs/ansysincprogram/clientlibs/clientlib-site/resources/images/icon-youtube-color.png);
}

.footer-right .social-icons .icon-facebook {
  background-image: url(https://www.ansys.com/etc.clientlibs/ansysincprogram/clientlibs/clientlib-site/resources/images/icon-facebook-white.png);
}

.footer-right .social-icons .icon-facebook:hover {
  background-image: url(https://www.ansys.com/etc.clientlibs/ansysincprogram/clientlibs/clientlib-site/resources/images/icon-facebook-color.png);
}

.footer-right .social-icons .icon-linkedin {
  background-image: url(https://www.ansys.com/etc.clientlibs/ansysincprogram/clientlibs/clientlib-site/resources/images/icon-linkedin-white.png);
}

.footer-right .social-icons .icon-linkedin:hover {
  background-image: url(https://www.ansys.com/etc.clientlibs/ansysincprogram/clientlibs/clientlib-site/resources/images/icon-linkedin-color.png);
}

.footer-right .social-icons .icon-github {
  background: none;
  font-size: 1.375rem;
  color: #fff;
}

.footer-right .social-icons .icon-github:hover {
  color: #000;
}

/**
 * Features Section
 */
.step .icon {
  background: var(--workflow-cta-bg);
  color: var(--workflow-cta-btn-color);
}

.sd-badge {
  margin-right: var(--badge-mr);
}

@media (max-width: 600px) {
  .blog-meta-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.2rem;
  }
}

/**
 * PyAnsys Landing Page
 */
.workflow-cta {
  margin: var(--workflow-cta-mt) 0 var(--workflow-cta-mb) 0;
  padding: var(--workflow-cta-padding);
  background: var(--workflow-cta-bg);
  border-radius: var(--workflow-cta-radius);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--workflow-cta-gap);
}

.workflow-cta-left {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  flex: 1;
  min-width: 18.75rem;
}

.workflow-cta-icon {
  margin-top: 0.2rem;
  display: flex;
  width: var(--workflow-cta-icon-size);
  height: var(--workflow-cta-icon-size);
  justify-content: center;
  align-items: center;
  gap: var(--workflow-cta-icon-gap);
  aspect-ratio: 1/1;
  background: var(--workflow-cta-btn-bg);
}

.workflow-cta-title {
  margin: 0 0 0.5rem 0;
}

.workflow-cta-btn-container {
  align-self: flex-start;
}

.workflow-cta-btn {
  display: flex;
  height: var(--workflow-cta-btn-h);
  max-width: var(--workflow-cta-btn-maxw);
  padding: var(--workflow-cta-btn-padding);
  justify-content: center;
  align-items: center;
  background: var(--workflow-cta-btn-bg);
  color: var(--workflow-cta-btn-color) !important;
  border-radius: var(--workflow-cta-btn-radius);
  box-shadow: var(--workflow-cta-btn-shadow);
  border-color: var(--workflow-cta-btn-bg);
  text-decoration: none;
}

.workflow-cta-btn:hover {
  background: var(--workflow-cta-btn-hover-bg) !important;
}

/**
 * Hero Section
 */
.hero-section {
  padding: 2rem 0 1.5rem;
  margin-bottom: 0.5rem;
}

.hero-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: #615655;
  max-width: 44rem;
  line-height: 1.6;
  margin: 0;
}

html[data-theme="dark"] .hero-subtitle {
  color: #b0b0b0;
}

/**
 * Status Badge
 */
.status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}

.status-stable {
  background: #d4edda;
  color: #155724;
}

.status-alpha {
  background: #fff3cd;
  color: #856404;
}

.status-beta {
  background: #cce5ff;
  color: #004085;
}

html[data-theme="dark"] .status-stable {
  background: #1a3a24;
  color: #7ed99e;
}

html[data-theme="dark"] .status-alpha {
  background: #3a2f00;
  color: #ffc107;
}

html[data-theme="dark"] .status-beta {
  background: #003366;
  color: #7fbfff;
}

/**
 * Card Header Row (title + status badge)
 */
.card-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.card-header-row .sd-card-title {
  margin: 0;
}

/**
 * Card Feedback Buttons
 */
.card-feedback-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.card-feedback-btn {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 0.25rem;
  border: 1px solid #d0d0d0;
  background: transparent;
  color: #353535 !important;
  text-decoration: none !important;
  transition: background 0.15s, border-color 0.15s;
}

.card-feedback-btn:hover {
  background: #f0f0f0;
  border-color: #aaa;
}

html[data-theme="dark"] .card-feedback-btn {
  border-color: #444;
  color: #ececec !important;
}

html[data-theme="dark"] .card-feedback-btn:hover {
  background: #2a2a2a;
  border-color: #666;
}

/**
 * GitHub Stars
 */
.star-starcount-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  vertical-align: middle;
}

/**
 * Project Card Star Badge
 */
.project-star-badge {
  color: #615655;
  position: absolute;
  top: 0.75rem; /* Already in rem */
  right: 1rem; /* Already in rem */
  background: #f7f7f7;
  box-shadow:
    0 0.0625rem 0.125rem 0 rgba(0, 0, 0, 0.08),
    0 0.125rem 0.25rem 0 rgba(0, 0, 0, 0.12); /* 1px = 0.0625rem, 2px = 0.125rem, 4px = 0.25rem */
  border-radius: 0.5rem; /* Already in rem */
  display: flex;
  align-items: center;
  gap: 0.125rem; /* Already in rem */
  z-index: 2;
  padding: 0 0.25rem; /* Already in rem */
}

.project-star-count {
  font-weight: 600;
}
/* Override ansys-sphinx-theme PR #943: the theme hides the primary sidebar when
   there are no nav <li> items (hidden toctree). Force it to show on the index page. */
#pst-primary-sidebar.bd-sidebar-primary:not(:has(nav.bd-links li)):not(
    :has(.ast-sidebar-widget)
  ) {
  display: flex;
}

/**
 * Features Section
 */
#features {
  margin: 3rem 0 2rem 0;
  padding: 2rem 0;
}

#features h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 2rem;
  text-align: center;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin: 0;
}

.feature-card {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

/**
 * Mermaid diagrams
 */
.mermaid svg,
.mermaid-svg {
  width: 100% !important;
  max-width: none !important;
  height: auto !important;
}

.mermaid {
  overflow-x: auto !important;
}

.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
}

html[data-theme="dark"] .feature-card:hover {
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.3);
}

.feature-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
}

.feature-card p {
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0;
  color: #615655;
}

html[data-theme="dark"] .feature-card p {
  color: #b0b0b0;
}

/**
 * Getting Started Section
 */
#getting-started {
  margin: 2rem 0 3rem 0;
  padding: 2rem;
  background: var(--workflow-cta-bg);
  border-radius: var(--workflow-cta-radius);
}

#getting-started h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.getting-started-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.75rem 0;
}

.getting-started-content h3:first-child {
  margin-top: 0;
}

.getting-started-content p {
  margin: 0 0 0.75rem 0;
  font-size: 0.95rem;
}

.getting-started-content pre {
  background: #f5f5f5;
  border-radius: var(--card-radius);
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.4;
}

html[data-theme="dark"] .getting-started-content pre {
  background: #2a2a2a;
  color: #e0e0e0;
}

.getting-started-content code {
  font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
  word-break: break-word;
}

/**
 * Responsive Design
 */
@media (max-width: 768px) {
  .workflow-cta {
    flex-direction: column;
    gap: 1rem;
  }

  .workflow-cta-btn-container {
    width: 100%;
  }

  .workflow-cta-btn {
    max-width: 100%;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  #features h2,
  #getting-started h2 {
    font-size: 1.5rem;
  }

  #getting-started {
    padding: 1.5rem;
  }
}
