/**
 * Shared layout helpers + i18n text containment for non-English.
 */

/* --- Hero copy: tighter vertical rhythm (all languages; overrides later inline <style> in body) --- */
.hero-features-container:has(.hero-line) {
  margin-bottom: 1.35rem !important;
}

.hero-line {
  margin-bottom: 0.42rem !important;
  line-height: 1.45 !important;
}

.hero-line.lead {
  margin-bottom: 0.65rem !important;
}

.hero-line.highlight {
  margin-top: 0.65rem !important;
}

html:not([lang="en"]) {
  overflow-x: clip;
}

html:not([lang="en"]) body {
  overflow-x: clip;
}

/* --- Landing hero (index, gallery, etc.) — non-English: clamps + overflow only --- */
html:not([lang="en"]) .hero-features-container:has(.hero-line) {
  max-height: min(42vh, 360px);
  overflow: hidden;
  box-sizing: border-box;
}

html:not([lang="en"]) .hero-line {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

html:not([lang="en"]) .hero-line.lead {
  -webkit-line-clamp: 4;
}

html:not([lang="en"]) .hero-line:not(.tagline):not(.highlight):not(.lead) {
  -webkit-line-clamp: 3;
}

html:not([lang="en"]) .hero-line.highlight {
  -webkit-line-clamp: 3;
}

html:not([lang="en"]) .hero-line.tagline {
  -webkit-line-clamp: 2;
}

html:not([lang="en"]) .partner-synergy {
  align-items: flex-start;
  max-height: 140px;
  overflow: hidden;
}

html:not([lang="en"]) .partner-info {
  min-width: 0;
}

html:not([lang="en"]) .btn-partner {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* --- Section titles --- */
html:not([lang="en"]) .section-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}

/* --- Header CTA (long translations) --- */
html:not([lang="en"]) .header-actions .btn-main {
  max-width: min(280px, 42vw);
  text-align: center;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  white-space: normal;
}

html:not([lang="en"]) .header-sponsor-link .sponsor-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  max-width: min(200px, 28vw);
}

/* --- Modal: process / algorithms grids --- */
html:not([lang="en"]) .feature-item h3 {
  min-width: 0;
  align-items: flex-start;
  justify-content: center;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

html:not([lang="en"]) .feature-item p {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
  overflow: hidden;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

html:not([lang="en"]) .algo-card {
  min-height: 80px;
  max-height: 118px;
  overflow: hidden;
  justify-content: flex-start;
}

html:not([lang="en"]) .algo-card h4 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

html:not([lang="en"]) .algo-card p {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

html:not([lang="en"]) .treatment-card {
  max-height: 118px;
  overflow: hidden;
}

html:not([lang="en"]) .treatment-card h4 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}

html:not([lang="en"]) .treatment-card p {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}

/* --- Algorithm detail pages --- */
html:not([lang="en"]) .content-header h1 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  overflow-wrap: anywhere;
}

html:not([lang="en"]) .algo-badge {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  max-width: 100%;
  overflow-wrap: anywhere;
}

html:not([lang="en"]) .info-item {
  overflow: hidden;
}

html:not([lang="en"]) .info-item strong {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  overflow-wrap: anywhere;
}

html:not([lang="en"]) .info-item span {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
  overflow: hidden;
  overflow-wrap: anywhere;
}

html:not([lang="en"]) .cta-box p {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  overflow: hidden;
  overflow-wrap: anywhere;
}
