/**
 * Stacking Cards for WordPress - Stylesheet
 * High-performance sticky stacking cards powered by pure CSS.
 * Architectural Blueprint Edition: White background with black technical grid & 0px sharp corners.
 */

/* ==========================================================================
   Base Layout
   ========================================================================== */

.process-wrapper {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: var(--sc-gap, 48px);
  align-items: start;
  position: relative;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.process-wrapper *,
.process-wrapper *::before,
.process-wrapper *::after {
  box-sizing: border-box;
}

/* ==========================================================================
   Layout Option: Cards on Left, Text/Heading on Right
   ========================================================================== */

.process-wrapper.layout-cards-left {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
}

.process-wrapper.layout-cards-left .process-left {
  order: 2;
}

.process-wrapper.layout-cards-left .stacking-cards-container {
  order: 1;
}

/* ==========================================================================
   Left Column (Sticky Header Section)
   ========================================================================== */

.process-left {
  position: -webkit-sticky !important;
  position: sticky !important;
  top: 50vh !important;
  transform: translateY(-50%) !important;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.process-tagline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--sc-accent, #18181b);
  margin-bottom: 14px;
}

.process-tagline::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: var(--sc-accent, #18181b);
}

.process-heading {
  font-size: clamp(2rem, 3.5vw, 2.75rem);
  font-weight: 800;
  line-height: 1.15;
  color: #09090b;
  margin: 0 0 18px 0;
  letter-spacing: -0.025em;
}

.process-heading .highlight {
  color: var(--sc-accent, #18181b);
  display: inline;
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 2px;
}

.process-description {
  font-size: 1.05rem;
  line-height: 1.65;
  color: #52525b;
  margin: 0;
}

.process-description p {
  margin: 0 0 1em 0;
  line-height: inherit;
}

.process-description p:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   Right Column (Stacking Cards Container & Cards)
   ========================================================================== */

.stacking-cards-container {
  display: flex;
  flex-direction: column;
  gap: var(--sc-gap, 32px);
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.stacking-cards-spacer {
  display: block;
  width: 100%;
  height: var(--sc-padding-bottom, 300px);
  pointer-events: none;
  flex-shrink: 0;
}

/* ==========================================================================
   Architectural Blueprint Card Display
   - White background with black technical millimeter grid
   - 0px border radius (strictly no rounded corners)
   - Sharp, technical borders with authentic CAD drafting aesthetics
   ========================================================================== */

.stacking-card {
  position: -webkit-sticky !important;
  position: sticky !important;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 260px;
  max-height: calc(100dvh - 120px);
  box-sizing: border-box;

  /* 100% Solid plain white background, strictly NO transparency */
  background: #ffffff !important;
  background-color: #ffffff !important;
  background-image: none !important;
  opacity: 1 !important;

  /* Strictly NO rounded borders */
  border-radius: 0px !important;
  -webkit-border-radius: 0px !important;
  -moz-border-radius: 0px !important;

  /* Crisp technical drafting borders */
  border: 1px solid var(--sc-border-color, #18181b) !important;
  outline: none;
  padding: 0 !important;
  overflow: hidden;
  box-shadow: 
    inset 0 0 0 1px rgba(0, 0, 0, 0.04),
    0 4px 6px -1px rgba(0, 0, 0, 0.05),
    0 16px 24px -6px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), box-shadow 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.stacking-card:hover {
  box-shadow: 
    inset 0 0 0 1px rgba(0, 0, 0, 0.08),
    0 10px 25px -3px rgba(0, 0, 0, 0.12),
    0 24px 36px -8px rgba(0, 0, 0, 0.14);
}

/* Symmetrical Card Tab Header - Technical Blueprint Spec Bar */
.stacking-card .card-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  height: auto !important;
  min-height: 48px !important;
  max-height: none !important;
  padding: 14px 22px !important;
  gap: 16px !important;
  margin: 0 !important;
  border-bottom: 1px solid var(--sc-border-color, #18181b) !important;
  border-radius: 0px !important;
  background: #ffffff !important;
  background-color: #ffffff !important;
  opacity: 1 !important;
  position: relative !important;
  box-sizing: border-box !important;
  flex-shrink: 0 !important;
  overflow: visible !important;
}

/* Technical Corner Markings */
.stacking-card .card-header::after {
  content: "+";
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  color: rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.stacking-card .card-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.4 !important;
  color: var(--sc-title-color, #18181b);
  margin: 0 !important;
  padding: 0 !important;
  height: auto !important;
  max-height: none !important;
  letter-spacing: -0.015em;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  overflow-wrap: break-word !important;
  word-wrap: break-word !important;
}

.stacking-card .card-index {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--sc-accent, #18181b);
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  line-height: 1 !important;
  padding: 4px 8px !important;
  background: rgba(0, 0, 0, 0.04) !important;
  border: 1px solid rgba(0, 0, 0, 0.25) !important;
  border-radius: 0px !important;
  letter-spacing: 0.06em;
  flex-shrink: 0 !important;
  align-self: center !important;
}

/* Card Body & Content Flow */
.stacking-card .card-body {
  padding: 22px 24px 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1 1 auto;
  min-height: 0; /* Crucial for internal flex scrolling without vertical overflow */
  overflow-y: auto; /* Guarantees content is never clipped if text is tall */
  box-sizing: border-box;
  background: #ffffff !important;
  background-color: #ffffff !important;
  opacity: 1 !important;
}

.stacking-card > .card-text {
  padding: 22px 24px 24px;
}

.stacking-card .card-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--sc-text-color, #27272a);
  margin: 0;
  flex-grow: 1;
}

.stacking-card .card-text p {
  margin: 0 0 0.85em 0;
  line-height: inherit;
}

.stacking-card .card-text p:last-child {
  margin-bottom: 0;
}

/* Card Footer & Architectural CTA Button */
.stacking-card .card-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px dashed rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.card-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 22px;
  background-color: var(--sc-accent, #18181b);
  color: #ffffff !important;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none !important;
  border-radius: 0px !important; /* Strictly 0 border radius per user request */
  border: 1px solid var(--sc-accent, #18181b);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.32, 0.72, 0, 1);
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.card-button:hover {
  background-color: #1f3141 !important;
  border-color: #1f3141 !important;
  color: #ffffff !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px -2px rgba(31, 49, 65, 0.35);
}

.card-button .btn-arrow {
  transition: transform 0.2s cubic-bezier(0.32, 0.72, 0, 1);
  display: inline-block;
}

.card-button:hover .btn-arrow {
  transform: translateX(4px);
}

/* ==========================================================================
   Horizontal Scroll Layout Mode
   Solves the issue where title takes space on top and hides bottom content:
   1. The title section is laid out as a compact top banner.
   2. Cards scroll horizontally side-by-side with smooth snap.
   3. Card heights are constrained to fit 100% within the screenview.
   ========================================================================== */

.process-wrapper.layout-horizontal {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
}

.process-wrapper.layout-horizontal .process-left {
  position: static !important;
  top: auto !important;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(280px, 1.2fr) minmax(240px, 1fr);
  gap: 32px;
  align-items: end;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  margin-bottom: 8px;
}

.process-wrapper.layout-horizontal .process-left .process-heading {
  font-size: clamp(1.6rem, 2.5vw, 2.25rem);
  margin: 0;
  line-height: 1.2;
}

.process-wrapper.layout-horizontal .process-left .process-tagline {
  margin-bottom: 8px;
}

.process-wrapper.layout-horizontal .process-left .process-description {
  font-size: 0.95rem;
  line-height: 1.55;
  margin: 0;
}

.process-wrapper.layout-horizontal .stacking-cards-container {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  gap: 24px;
  padding: 8px 4px 20px;
  margin: 0 -4px;
  width: calc(100% + 8px);
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.25) transparent;
}

.process-wrapper.layout-horizontal .stacking-cards-container::-webkit-scrollbar {
  height: 6px;
}

.process-wrapper.layout-horizontal .stacking-cards-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.04);
}

.process-wrapper.layout-horizontal .stacking-cards-container::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 0px;
}

.process-wrapper.layout-horizontal .stacking-cards-container::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.45);
}

.process-wrapper.layout-horizontal .stacking-card {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  z-index: auto !important;
  flex: 0 0 clamp(280px, 32vw, 360px) !important;
  scroll-snap-align: start;
  min-height: 250px;
  max-height: calc(100dvh - 240px); /* Fits comfortably in screenview alongside the top title */
}

.process-wrapper.layout-horizontal .stacking-cards-spacer {
  display: none !important;
}

/* ==========================================================================
   Screenview Adaptations (Height Constraints for Short / Laptop Screens)
   Ensures the bottom of card content is always visible regardless of screen height
   ========================================================================== */

@media (min-width: 851px) and (max-height: 820px) {
  .stacking-card {
    min-height: 220px;
    max-height: calc(100dvh - 120px);
  }

  .stacking-card .card-header {
    height: auto;
    min-height: 42px;
    padding: 10px 20px;
    gap: 12px;
  }

  .stacking-card .card-body {
    padding: 16px 20px 18px;
  }

  .card-button {
    padding: 8px 18px;
    font-size: 0.8125rem;
  }

  .process-wrapper.layout-horizontal .stacking-card {
    max-height: calc(100dvh - 190px);
  }
}

@media (min-width: 851px) and (max-height: 680px) {
  .process-heading {
    font-size: 1.6rem;
    margin-bottom: 8px;
  }

  .stacking-card {
    min-height: 190px;
    max-height: calc(100dvh - 80px);
  }

  .stacking-card .card-header {
    height: auto;
    min-height: 38px;
    padding: 8px 16px;
    gap: 10px;
  }

  .stacking-card .card-title {
    font-size: 1rem;
    line-height: 1.3;
  }

  .stacking-card .card-body {
    padding: 12px 16px 14px;
  }

  .stacking-card .card-text {
    font-size: 0.875rem;
  }

  .stacking-card .card-footer {
    padding-top: 10px;
  }

  .process-wrapper.layout-horizontal .stacking-card {
    max-height: calc(100dvh - 160px);
  }
}

/* ==========================================================================
   Responsive Breakpoints for Tablets & Mobile Devices
   ========================================================================== */

@media (max-width: 850px) {
  .process-wrapper,
  .process-wrapper.layout-cards-left {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow-x: clip !important;
    gap: 32px;
  }

  .process-wrapper.layout-cards-left .process-left {
    order: 1 !important;
  }

  .process-wrapper.layout-cards-left .stacking-cards-container {
    order: 2 !important;
  }

  .process-wrapper.layout-horizontal .process-left {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px;
  }

  .process-left {
    position: static !important;
    top: auto !important;
    transform: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden;
  }

  .stacking-cards-container {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    padding-bottom: 0 !important;
    gap: 20px !important;
    margin: 0 !important;
  }

  .stacking-cards-spacer {
    display: none !important;
  }

  .stacking-card {
    position: static !important;
    top: auto !important;
    transform: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    max-height: none !important;
    min-height: auto !important;
    margin: 0 !important;
    overflow: hidden !important;
  }

  /* Mobile Card Header & Multi-Line Title Responsiveness */
  .stacking-card .card-header {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    height: auto !important;
    min-height: 48px !important;
    max-height: none !important;
    padding: 14px 18px !important;
    gap: 12px !important;
    align-items: center !important;
    overflow: hidden !important;
  }

  .stacking-card .card-title {
    font-size: 1.05rem !important;
    line-height: 1.4 !important;
    height: auto !important;
    max-height: none !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
  }

  .stacking-card .card-index {
    font-size: 0.8125rem !important;
    padding: 3px 8px !important;
    flex-shrink: 0 !important;
    align-self: center !important;
    white-space: nowrap !important;
  }

  .stacking-card .card-body {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    padding: 20px 18px 22px !important;
    overflow-y: visible !important;
    overflow-x: hidden !important;
  }

  .stacking-card .card-text {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    font-size: 0.925rem;
    line-height: 1.55;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
  }

  .stacking-card .card-text ul,
  .stacking-card .card-text ol {
    margin: 0.5em 0 1em 0;
    padding-left: 20px;
    box-sizing: border-box;
    max-width: 100%;
  }

  .stacking-card .card-text li {
    margin-bottom: 0.4em;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
  }

  .process-wrapper.layout-horizontal .stacking-cards-container {
    padding-bottom: 16px !important;
  }

  .process-wrapper.layout-horizontal .stacking-card {
    flex: 0 0 85vw !important;
    max-height: calc(100dvh - 220px);
  }
}

/* Small Mobile Screens (Phones) */
@media (max-width: 480px) {
  .process-wrapper,
  .process-wrapper.layout-cards-left {
    gap: 20px;
  }

  .process-heading {
    font-size: 1.6rem;
    line-height: 1.2;
    margin-bottom: 12px;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .process-description {
    font-size: 0.925rem;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .stacking-cards-container {
    gap: 16px !important;
  }

  .stacking-card .card-header {
    height: auto !important;
    min-height: 46px !important;
    max-height: none !important;
    padding: 12px 14px !important;
    gap: 10px !important;
    align-items: center !important;
    overflow: hidden !important;
  }

  .stacking-card .card-header::after {
    display: none !important;
  }

  .stacking-card .card-title {
    font-size: 0.95rem !important;
    line-height: 1.35 !important;
    height: auto !important;
    max-height: none !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  .stacking-card .card-index {
    font-size: 0.75rem !important;
    padding: 2px 6px !important;
    flex-shrink: 0 !important;
    align-self: center !important;
  }

  .stacking-card .card-body {
    padding: 16px 14px 18px !important;
  }

  .stacking-card .card-text {
    font-size: 0.875rem;
    line-height: 1.5;
  }

  .card-button {
    padding: 8px 16px;
    font-size: 0.8125rem;
    max-width: 100%;
    box-sizing: border-box;
  }
}

/* ==========================================================================
   Dynamic Table of Contents (TOC) - Category Filter
   Architectural Blueprint Spec Bar for Services Navigation
   Strictly preserves card styling, colors, and typography.
   ========================================================================== */

.sc-dynamic-toc {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 26px;
  width: 100%;
  box-sizing: border-box;
  opacity: 1;
  transform: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Screenview emphasis */
.process-wrapper.is-in-screenview .sc-dynamic-toc {
  opacity: 1;
  transform: none;
}

/* Indicative hint text telling user they can switch categories */
.sc-toc-header {
  display: flex;
  align-items: center;
  width: 100%;
}

.sc-toc-hint {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #71717a;
  line-height: 1.3;
}

.sc-toc-hint-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  background-color: var(--sc-accent, #18181b);
  flex-shrink: 0;
}

/* Strictly 1-line pill track */
.sc-toc-pill-track {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 6px !important;
  align-items: stretch;
  width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.sc-toc-pill-track::-webkit-scrollbar {
  display: none;
}

/* Evenly distributed 1-line buttons */
.sc-toc-btn {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  padding: 9px 8px !important;
  border: 1px solid var(--sc-border-color, #18181b);
  border-radius: 0px !important;
  background: #ffffff;
  color: var(--sc-title-color, #18181b);
  font-family: inherit;
  font-size: clamp(0.6875rem, 0.9vw, 0.775rem) !important;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em !important;
  white-space: nowrap !important;
  cursor: pointer;
  outline: none;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  box-sizing: border-box;
  user-select: none;
}

.sc-toc-btn:hover:not(.is-active) {
  background: #f4f4f5;
  border-color: var(--sc-accent, #18181b);
  transform: translateY(-1px);
}

.sc-toc-btn:focus-visible {
  outline: 2px solid var(--sc-accent, #18181b);
  outline-offset: 2px;
}

.sc-toc-btn.is-active,
.sc-toc-btn[aria-selected="true"] {
  background: var(--sc-accent, #18181b) !important;
  color: #ffffff !important;
  border-color: var(--sc-accent, #18181b) !important;
  box-shadow: 0 4px 14px -2px rgba(24, 24, 27, 0.25);
  pointer-events: default;
}

.sc-toc-label {
  white-space: nowrap !important;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sc-toc-count {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 2px 5px;
  border: 1px solid currentColor;
  border-radius: 0px !important;
  line-height: 1;
  opacity: 0.75;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.sc-toc-btn.is-active .sc-toc-count,
.sc-toc-btn[aria-selected="true"] .sc-toc-count {
  opacity: 1;
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.15);
}

/* Category card visibility rule */
.stacking-card.sc-card-hidden {
  display: none !important;
}

/* Sticky TOC on mobile for constant accessible screenview */
@media (max-width: 850px) {
  .process-wrapper .sc-dynamic-toc {
    position: -webkit-sticky;
    position: sticky;
    top: 12px;
    z-index: 40;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 10px 0;
    margin-top: 16px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(24, 24, 27, 0.12);
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .sc-toc-pill-track {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: none;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .sc-toc-pill-track::-webkit-scrollbar {
    display: none;
  }

  .sc-toc-btn {
    flex: 1 0 auto !important;
    padding: 8px 10px !important;
    font-size: 0.72rem !important;
    box-sizing: border-box !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sc-dynamic-toc,
  .sc-toc-btn {
    transition: none !important;
    transform: none !important;
  }
}


