/* ═══════════════════════════════════════════════
   SERASMAC v2 — Premium Refinements
   Hand-authored final composition, hierarchy and overflow pass.
   Loaded last so it can refine shared primitives without duplicating them.
   ═══════════════════════════════════════════════ */

/* ── Global resilience ── */
.sm-body,
.sm-body main,
.sm-container,
.sm-section,
.sm-page-hero,
.sm-hero,
.sm-hero__grid,
.sm-hero__content,
.sm-hero__visual,
.sm-ops-panel,
.sm-ecosystem,
.sm-final-cta,
.sm-form-page,
.sm-grid > *,
.sm-guides-grid > * {
  min-width: 0;
}

.sm-body img,
.sm-body svg,
.sm-body video,
.sm-body canvas,
.sm-body iframe {
  max-width: 100%;
}

.sm-body h1,
.sm-body h2,
.sm-body h3,
.sm-body h4,
.sm-body p,
.sm-body a,
.sm-body span,
.sm-body dd {
  overflow-wrap: anywhere;
}

.sm-page-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(circle at 82% 18%, rgba(12,110,115,0.08), transparent 30%),
    linear-gradient(180deg, rgba(255,255,255,0.62), rgba(245,242,234,0.96));
}

.sm-page-hero::after {
  content: '';
  position: absolute;
  z-index: -1;
  left: 50%;
  bottom: 0;
  width: min(92vw, var(--sm-container-main));
  height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, var(--sm-line-strong), transparent);
}

.sm-page-hero__title {
  max-width: 900px;
  text-wrap: balance;
}

.sm-page-hero__subtitle {
  max-width: 760px;
  text-wrap: pretty;
}

.sm-page-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sm-space-3);
  margin-top: var(--sm-space-8);
}

.sm-section-header {
  max-width: 760px;
  margin-bottom: clamp(2rem, 4vw, 3.5rem);
}

.sm-section-header h2 {
  margin-top: var(--sm-space-3);
  font-size: clamp(2rem, 3.8vw, 3.25rem);
  line-height: 1.08;
  text-wrap: balance;
}

.sm-section-header > p:last-child {
  margin-top: var(--sm-space-4);
  color: var(--sm-ink-muted);
  font-size: var(--sm-text-md);
  line-height: var(--sm-leading-relaxed);
}

/* ── Shared premium CTA panel ── */
.sm-final-cta {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
  overflow: hidden;
  padding: clamp(2rem, 5vw, 4.5rem);
  color: var(--sm-ink-inverse);
  background:
    radial-gradient(circle at 88% 12%, rgba(210,167,125,0.24), transparent 28%),
    radial-gradient(circle at 8% 100%, rgba(23,139,140,0.18), transparent 34%),
    linear-gradient(135deg, var(--sm-navy-deep), var(--sm-navy));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--sm-radius-xl);
  box-shadow: var(--sm-shadow-xl);
  text-align: left;
}

.sm-final-cta::after {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 18px;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: calc(var(--sm-radius-xl) - 7px);
  pointer-events: none;
}

.sm-final-cta__title {
  max-width: 780px;
  margin: var(--sm-space-3) 0 var(--sm-space-4);
  color: #fff;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1.06;
  text-wrap: balance;
}

.sm-final-cta__desc {
  max-width: 680px;
  margin: 0;
  color: rgba(255,255,255,0.7);
  font-size: var(--sm-text-md);
  line-height: var(--sm-leading-relaxed);
}

.sm-final-cta__actions {
  display: grid;
  gap: var(--sm-space-3);
  align-content: center;
}

.sm-final-cta .sm-btn--outline {
  color: #fff;
  border-color: rgba(255,255,255,0.34);
}

.sm-final-cta .sm-btn--outline:hover {
  color: var(--sm-navy-deep);
  background: #fff;
  border-color: #fff;
}

/* ── Evidence-led guide hub ── */
.sm-guide-proof {
  margin-top: clamp(-2rem, -3vw, -1rem);
}

.sm-guide-proof__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  background: rgba(255,255,255,0.78);
  border: 1px solid var(--sm-line);
  border-radius: var(--sm-radius-xl);
  box-shadow: var(--sm-shadow-md);
  backdrop-filter: blur(12px);
}

.sm-guide-proof__item {
  display: grid;
  gap: var(--sm-space-2);
  padding: clamp(1.25rem, 2.5vw, 2rem);
  border-right: 1px solid var(--sm-line);
}

.sm-guide-proof__item:last-child { border-right: 0; }

.sm-guide-proof__value {
  color: var(--sm-ink);
  font-family: var(--sm-font-display);
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  font-weight: 600;
  line-height: 1;
}

.sm-guide-proof__label {
  color: var(--sm-ink-muted);
  font-size: var(--sm-text-xs);
  font-weight: 700;
  letter-spacing: var(--sm-tracking-wide);
  line-height: 1.5;
  text-transform: uppercase;
}

.sm-guide-featured {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(240px, 0.55fr);
  min-height: 440px;
  overflow: hidden;
  color: var(--sm-ink-inverse);
  background:
    linear-gradient(90deg, rgba(9,30,37,0.98), rgba(16,44,53,0.9)),
    var(--sm-navy-deep);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--sm-radius-xl);
  box-shadow: var(--sm-shadow-xl);
  text-decoration: none;
}

.sm-guide-featured::before {
  content: '';
  position: absolute;
  z-index: -1;
  top: -160px;
  right: -90px;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 40%, rgba(210,167,125,0.34), transparent 38%),
    repeating-radial-gradient(circle at center, rgba(255,255,255,0.09) 0 1px, transparent 1px 22px);
  opacity: 0.8;
}

.sm-guide-featured::after {
  content: '';
  position: absolute;
  inset: 20px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: calc(var(--sm-radius-xl) - 7px);
  pointer-events: none;
}

.sm-guide-featured:hover { color: var(--sm-ink-inverse); }

.sm-guide-featured__body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(2rem, 6vw, 5.5rem);
}

.sm-guide-featured__body .sm-badge {
  align-self: flex-start;
  color: #d9f2ee;
  background: rgba(23,139,140,0.22);
  border: 1px solid rgba(99,203,198,0.24);
}

.sm-guide-featured__title {
  max-width: 760px;
  margin: var(--sm-space-5) 0 var(--sm-space-4);
  color: #fff;
  font-size: clamp(2.25rem, 5vw, 4.75rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.sm-guide-featured__desc {
  max-width: 680px;
  color: rgba(255,255,255,0.68);
  font-size: var(--sm-text-md);
  line-height: var(--sm-leading-relaxed);
}

.sm-guide-featured__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sm-space-3) var(--sm-space-5);
  margin: var(--sm-space-6) 0;
  color: rgba(255,255,255,0.64);
  font-size: var(--sm-text-xs);
}

.sm-guide-featured__meta > span {
  display: inline-flex;
  align-items: center;
  gap: var(--sm-space-2);
}

.sm-guide-featured__meta .sm-icon {
  width: 16px;
  height: 16px;
  color: var(--sm-copper-soft);
}

.sm-guide-featured__body > .sm-btn {
  align-self: flex-start;
  margin-top: auto;
}

.sm-guide-featured__aside {
  position: relative;
  display: grid;
  align-content: end;
  gap: 1px;
  padding: clamp(2rem, 4vw, 3.5rem);
  background: rgba(255,255,255,0.035);
  border-left: 1px solid rgba(255,255,255,0.1);
}

.sm-guide-featured__stat {
  display: grid;
  gap: var(--sm-space-2);
  padding: var(--sm-space-6) 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sm-guide-featured__stat:last-child { border-bottom: 0; }

.sm-guide-featured__stat-num {
  color: #fff;
  font-family: var(--sm-font-display);
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1;
}

.sm-guide-featured__stat-label {
  color: rgba(255,255,255,0.48);
  font-size: var(--sm-text-xs);
  font-weight: 700;
  letter-spacing: var(--sm-tracking-wider);
  text-transform: uppercase;
}

.sm-guide-topics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--sm-line);
  border-radius: var(--sm-radius-xl);
  background: var(--sm-surface);
  box-shadow: var(--sm-shadow-sm);
}

.sm-guide-topic-card {
  appearance: none;
  display: grid;
  align-content: start;
  gap: var(--sm-space-3);
  min-height: 210px;
  padding: var(--sm-space-6) var(--sm-space-5);
  color: var(--sm-ink);
  background: transparent;
  border: 0;
  border-right: 1px solid var(--sm-line);
  cursor: pointer;
  text-align: left;
  transition:
    color var(--sm-duration-normal) var(--sm-ease-out),
    background var(--sm-duration-normal) var(--sm-ease-out),
    transform var(--sm-duration-normal) var(--sm-ease-out);
}

.sm-guide-topic-card:last-child { border-right: 0; }

.sm-guide-topic-card:hover,
.sm-guide-topic-card:focus-visible {
  color: #fff;
  background: var(--sm-navy);
  transform: translateY(-3px);
}

.sm-guide-topic-card__icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--sm-teal);
  background: rgba(12,110,115,0.08);
  border: 1px solid rgba(12,110,115,0.16);
  border-radius: var(--sm-radius-lg);
}

.sm-guide-topic-card:hover .sm-guide-topic-card__icon,
.sm-guide-topic-card:focus-visible .sm-guide-topic-card__icon {
  color: var(--sm-copper-soft);
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.12);
}

.sm-guide-topic-card__icon .sm-icon { width: 21px; height: 21px; }

.sm-guide-topic-card__label {
  font-family: var(--sm-font-display);
  font-size: var(--sm-text-md);
  font-weight: 600;
  line-height: var(--sm-leading-snug);
}

.sm-guide-topic-card__desc {
  color: var(--sm-ink-muted);
  font-size: var(--sm-text-xs);
  line-height: 1.65;
}

.sm-guide-topic-card:hover .sm-guide-topic-card__desc,
.sm-guide-topic-card:focus-visible .sm-guide-topic-card__desc {
  color: rgba(255,255,255,0.64);
}

.sm-guide-search {
  position: sticky;
  z-index: 4;
  top: 88px;
  display: flex;
  align-items: center;
  gap: var(--sm-space-3);
  max-width: 760px;
  margin: 0 auto clamp(2rem, 5vw, 4rem);
  padding: var(--sm-space-3);
  background: rgba(245,242,234,0.88);
  border: 1px solid var(--sm-line);
  border-radius: var(--sm-radius-xl);
  box-shadow: var(--sm-shadow-md);
  backdrop-filter: blur(18px);
}

.sm-guide-search__input-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: var(--sm-space-3);
  flex: 1;
  min-width: 0;
  padding: 0 var(--sm-space-3);
}

.sm-guide-search__input-wrap .sm-icon {
  width: 20px;
  height: 20px;
  color: var(--sm-teal);
}

.sm-guide-search__input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  color: var(--sm-ink);
  background: transparent;
  border: 0;
  outline: 0;
  font: 600 var(--sm-text-base)/1.4 var(--sm-font-body);
}

.sm-guide-search__input::placeholder { color: var(--sm-ink-muted); font-weight: 500; }

.sm-guide-search__clear {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  color: var(--sm-ink-muted);
  background: var(--sm-surface);
  border: 1px solid var(--sm-line);
  border-radius: 999px;
  cursor: pointer;
}

.sm-guide-search__clear .sm-icon { width: 16px; height: 16px; }

.sm-guides-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--sm-space-6);
}

.sm-guide-card {
  grid-column: span 6;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 390px;
  overflow: hidden;
  padding: clamp(1.5rem, 3vw, 2.25rem);
  background: linear-gradient(160deg, #fff, rgba(249,247,242,0.9));
  border: 1px solid var(--sm-line);
  border-radius: var(--sm-radius-xl);
  box-shadow: var(--sm-shadow-xs);
  transition:
    transform var(--sm-duration-normal) var(--sm-ease-out),
    border-color var(--sm-duration-normal) var(--sm-ease-out),
    box-shadow var(--sm-duration-normal) var(--sm-ease-out);
}

.sm-guide-card:nth-child(5n + 1) { grid-column: span 7; }
.sm-guide-card:nth-child(5n + 2) { grid-column: span 5; }

.sm-guide-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 120px;
  height: 120px;
  background: linear-gradient(135deg, transparent 50%, rgba(12,110,115,0.06) 50%);
  pointer-events: none;
}

.sm-guide-card:hover {
  transform: translateY(-5px);
  border-color: rgba(12,110,115,0.38);
  box-shadow: var(--sm-shadow-lg);
}

.sm-guide-card__head {
  position: relative;
  z-index: 1;
}

.sm-guide-card__title {
  margin: var(--sm-space-5) 0 var(--sm-space-3);
  font-size: clamp(1.65rem, 2.6vw, 2.35rem);
  line-height: 1.08;
  letter-spacing: var(--sm-tracking-tight);
  text-wrap: balance;
}

.sm-guide-card__title a { color: var(--sm-ink); }
.sm-guide-card__title a::after { content: ''; position: absolute; inset: 0; }

.sm-guide-card__desc {
  max-width: 64ch;
  color: var(--sm-ink-muted);
  font-size: var(--sm-text-sm);
  line-height: var(--sm-leading-relaxed);
}

.sm-guide-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sm-space-2) var(--sm-space-4);
  margin-top: auto;
  padding-top: var(--sm-space-8);
  color: var(--sm-ink-muted);
  font-size: var(--sm-text-xs);
}

.sm-guide-card__meta-item {
  display: inline-flex;
  align-items: center;
  gap: var(--sm-space-2);
}

.sm-guide-card__meta-item .sm-icon { width: 14px; height: 14px; color: var(--sm-teal); }

.sm-guide-card__magnet {
  width: 100%;
  margin-top: var(--sm-space-2);
  padding: var(--sm-space-3);
  color: var(--sm-copper);
  background: rgba(168,108,61,0.07);
  border: 1px solid rgba(168,108,61,0.15);
  border-radius: var(--sm-radius-md);
}

.sm-guide-card__foot {
  position: relative;
  z-index: 2;
  margin-top: var(--sm-space-6);
}

.sm-guide-no-results {
  padding: var(--sm-space-16) var(--sm-space-6);
  text-align: center;
}

.sm-guide-no-results__inner {
  display: grid;
  justify-items: center;
  gap: var(--sm-space-4);
  max-width: 440px;
  margin-inline: auto;
  color: var(--sm-ink-muted);
}

.sm-guide-no-results__inner > .sm-icon {
  width: 42px;
  height: 42px;
  color: var(--sm-teal);
}

/* ── Mobile overflow and composition fixes ── */
@media (max-width: 1080px) {
  .sm-guide-proof__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm-guide-proof__item:nth-child(2) { border-right: 0; }
  .sm-guide-proof__item:nth-child(-n+2) { border-bottom: 1px solid var(--sm-line); }
  .sm-guide-topics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sm-guide-topic-card:nth-child(3n) { border-right: 0; }
  .sm-guide-topic-card:nth-child(-n+3) { border-bottom: 1px solid var(--sm-line); }
}

@media (max-width: 820px) {
  .sm-final-cta,
  .sm-guide-featured {
    grid-template-columns: 1fr;
  }

  .sm-guide-featured__aside {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid rgba(255,255,255,0.1);
    border-left: 0;
  }

  .sm-guide-featured__stat { border-right: 1px solid rgba(255,255,255,0.1); border-bottom: 0; }
  .sm-guide-featured__stat:last-child { border-right: 0; }
  .sm-guide-card,
  .sm-guide-card:nth-child(5n + 1),
  .sm-guide-card:nth-child(5n + 2) { grid-column: span 12; }
}

@media (max-width: 640px) {
  .sm-page-hero__actions,
  .sm-page-hero__actions .sm-btn,
  .sm-final-cta__actions,
  .sm-final-cta__actions .sm-btn {
    width: 100%;
  }

  .sm-page-hero__actions,
  .sm-final-cta__actions { flex-direction: column; }

  .sm-guide-proof__grid,
  .sm-guide-topics { grid-template-columns: 1fr; }

  .sm-guide-proof__item,
  .sm-guide-proof__item:nth-child(2),
  .sm-guide-proof__item:nth-child(-n+2),
  .sm-guide-topic-card,
  .sm-guide-topic-card:nth-child(3n),
  .sm-guide-topic-card:nth-child(-n+3) {
    border-right: 0;
    border-bottom: 1px solid var(--sm-line);
  }

  .sm-guide-proof__item:last-child,
  .sm-guide-topic-card:last-child { border-bottom: 0; }

  .sm-guide-topic-card { min-height: 0; }
  .sm-guide-search { top: 68px; border-radius: var(--sm-radius-lg); }
  .sm-guide-featured__body { padding: var(--sm-space-8) var(--sm-space-6); }
  .sm-guide-featured__aside { padding: var(--sm-space-5) var(--sm-space-6); }
  .sm-guide-featured__title { font-size: clamp(2.15rem, 12vw, 3.25rem); }
  .sm-guide-featured__meta { display: grid; }
  .sm-guide-card { min-height: 0; padding: var(--sm-space-6); }

  .sm-ops-panel,
  .sm-ops-panel__rail,
  .sm-ops-cells,
  .sm-ops-evidence,
  .sm-ecosystem__grid,
  .sm-ecosystem__list,
  .sm-process,
  .sm-process__grid {
    max-width: 100%;
  }

  .sm-ops-evidence { flex-wrap: wrap; }
  .sm-ops-doc { max-width: 100%; white-space: normal; }
  .sm-ecosystem__tag { max-width: 100%; white-space: normal; }
}