/**
 * Semantic layout and component utilities.
 * Inline styles from the static export remain on page bodies during migration;
 * this layer adds shared responsive fixes and reusable classes.
 */

.sm-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 44px);
}

.sm-sidebar-layout {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: clamp(44px, 5.5vw, 76px) clamp(20px, 4vw, 44px) clamp(56px, 7vw, 92px);
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: start;
}

.sm-grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
  gap: clamp(24px, 3vw, 44px);
}

.sm-eyebrow {
  margin: 0 0 14px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #B84A00;
}

.sm-heading-xl {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(30px, 3.4vw, 44px);
  line-height: 1.1;
  letter-spacing: -0.022em;
  color: var(--color-navy);
}

.sm-btn-primary {
  display: inline-block;
  background: var(--color-orange);
  color: var(--color-navy);
  font-size: 16px;
  font-weight: 600;
  padding: 16px 28px;
  border-radius: var(--radius-pill);
  border: 0;
  cursor: pointer;
  font-family: var(--font-body);
  text-decoration: none;
}

.sm-btn-primary:hover {
  background: var(--color-orange-hover);
  color: var(--color-navy);
}

.sm-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  color: var(--color-navy);
}

@media (max-width: 1023px) {
  .sm-sidebar-layout {
    grid-template-columns: 1fr !important;
  }
  .sm-sidebar-layout aside {
    position: static !important;
    top: auto !important;
  }
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--color-orange);
  outline-offset: 2px;
}

/* Fixed header: chrome wrappers hold position:fixed headers only */
[data-chrome="desktop"],
[data-chrome="mobile"] {
  height: 0;
  overflow: visible;
}

.sm-header-spacer {
  height: var(--header-height, 78px);
}

.sm-header-bar {
  box-sizing: border-box;
}

.sm-mobile-menu-toggle__line {
  display: block;
  width: 100%;
  height: 1.5px;
  background: #fff;
  border-radius: 1px;
}

@media (max-width: 1119px) {
  :root {
    --header-height: calc(80px + env(safe-area-inset-top, 0px));
  }

  [data-chrome="mobile"] > header {
    padding-top: env(safe-area-inset-top, 0px);
  }

  [data-chrome="mobile"] .sm-header-bar,
  [data-chrome="mobile"] header > div[style*="height: 78px"] {
    height: auto !important;
    min-height: 80px;
    padding-top: 18px !important;
    padding-bottom: 18px !important;
    align-items: center;
  }
}

/* Dark hero pages: pull first section under spacer so no white gap shows */
.sm-header-spacer + section#top,
.sm-header-spacer + section[style*="background: #06061C"],
.sm-header-spacer + article > section.sm-hero-dark {
  margin-top: calc(-1 * var(--header-height, 78px));
}

@media (max-width: 1119px) {
  .sm-header-spacer + section[style*="background: #06061C"] > div[style*="max-width: 1280px"],
  .sm-header-spacer + article > section.sm-hero-dark > div[style*="max-width: 1280px"] {
    padding-top: calc(var(--header-height, 78px) + clamp(40px, 5vw, 64px)) !important;
  }

  .sm-header-spacer + section#top > div[style*="max-width: 1280px"] {
    padding-top: calc(var(--header-height, 78px) + clamp(52px, 6.5vw, 92px)) !important;
  }
}

html {
  scroll-padding-top: var(--header-height, 78px);
}

@media (max-width: 1023px) {
  [style*="position: sticky"][style*="top: 118px"],
  [style*="position: sticky"][style*="top:118px"] {
    position: static !important;
    top: auto !important;
  }

  div[style*="align-items: start"][style*="minmax(300px, 1fr)"],
  div[style*="align-items: start"][style*="minmax(320px, 1fr)"] {
    grid-template-columns: 1fr !important;
    gap: clamp(32px, 5vw, 56px) !important;
  }
}

.sm-hero-stats > div,
.sm-feature-grid > [data-reveal] {
  min-width: 0;
}

@media (max-width: 900px) {
  .sm-hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .sm-hero-stats > div {
    padding: 28px clamp(16px, 3vw, 24px) 28px 0 !important;
    border-right: 1px solid rgba(255, 255, 255, 0.14) !important;
  }

  .sm-hero-stats > div:nth-child(2n) {
    padding: 28px 0 28px clamp(16px, 3vw, 24px) !important;
    border-right: none !important;
  }

  .sm-hero-stats > div:nth-child(n + 3) {
    border-top: 1px solid rgba(255, 255, 255, 0.14) !important;
  }

  .sm-feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .sm-feature-grid > [data-reveal] {
    padding: 36px clamp(16px, 3vw, 24px) 36px 0 !important;
    border-right: 1px solid #E4E2DA !important;
    border-bottom: none !important;
  }

  .sm-feature-grid > [data-reveal]:nth-child(2n) {
    padding: 36px 0 36px clamp(16px, 3vw, 24px) !important;
    border-right: none !important;
  }

  .sm-feature-grid > [data-reveal]:nth-child(n + 3) {
    border-top: 1px solid #E4E2DA !important;
  }
}

@media (max-width: 640px) {
  .sm-hero-stats {
    grid-template-columns: 1fr !important;
  }

  .sm-hero-stats > div,
  .sm-hero-stats > div:nth-child(2n) {
    padding: 28px 0 !important;
    border-right: none !important;
    border-top: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14) !important;
  }

  .sm-hero-stats > div:nth-child(n + 3) {
    border-top: none !important;
  }

  .sm-hero-stats > div:last-child {
    border-bottom: none !important;
  }

  .sm-feature-grid {
    grid-template-columns: 1fr !important;
  }

  .sm-feature-grid > [data-reveal],
  .sm-feature-grid > [data-reveal]:nth-child(2n) {
    padding: 32px 0 !important;
    border-right: none !important;
    border-top: none !important;
    border-bottom: 1px solid #E4E2DA !important;
  }

  .sm-feature-grid > [data-reveal]:nth-child(n + 3) {
    border-top: none !important;
  }

  .sm-feature-grid > [data-reveal]:last-child {
    border-bottom: none !important;
  }
}

.sm-step-grid > * {
  min-width: 0;
}

.sm-step-grid--dark {
  --sm-step-divider: rgba(255, 255, 255, 0.14);
}

.sm-step-grid--light {
  --sm-step-divider: #E4E2DA;
}

@media (max-width: 900px) {
  .sm-step-grid {
    grid-template-columns: 1fr !important;
  }

  .sm-step-grid > * {
    padding: 32px 0 !important;
    border-right: none !important;
    border-bottom: 1px solid var(--sm-step-divider, #E4E2DA) !important;
  }

  .sm-step-grid > *:last-child {
    border-bottom: none !important;
    padding-bottom: 0 !important;
  }

  [style*="grid-template-columns: 96px 1fr"],
  [style*="grid-template-columns:96px 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
}

.sm-featured-media {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  --sm-focal: 50% 42%;
}

.sm-featured-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: cover;
  object-position: var(--sm-focal);
  display: block;
}

/* Case study hero overlaps dark header — avoid light border bleed at rounded corners */
.sm-project-hero-media {
  margin-top: clamp(-32px, -3vw, -20px);
  max-height: 520px;
  border-radius: 20px;
  background: #06061c;
  box-shadow: 0 30px 70px rgba(6, 6, 28, 0.14);
}

.sm-project-hero-media img {
  border-radius: inherit;
}

/* Blog archive featured post: 1536×1024 (3:2) crop, capped display width */
.sm-blog-featured-link {
  grid-template-columns: minmax(280px, 520px) minmax(0, 1fr) !important;
  align-items: center !important;
}

@media (max-width: 767px) {
  .sm-blog-featured-link {
    grid-template-columns: 1fr !important;
  }
}

.admin-bar [data-chrome="desktop"] > header,
.admin-bar [data-chrome="mobile"] > header {
  top: 32px;
}

@media screen and (max-width: 782px) {
  .admin-bar [data-chrome="desktop"] > header,
  .admin-bar [data-chrome="mobile"] > header {
    top: 46px;
  }
}

.sm-site-logo {
  min-width: 120px;
  min-height: 30px;
}

.sm-back-to-top {
  position: fixed;
  right: clamp(16px, 3vw, 28px);
  bottom: clamp(16px, 3vw, 28px);
  z-index: 35;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background: #10104A;
  color: #fff;
  box-shadow: 0 12px 32px rgba(6, 6, 28, 0.28);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease, background 0.18s ease, color 0.18s ease;
}

.sm-back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.sm-back-to-top:hover {
  background: #FF6600;
  color: #10104A;
}

.sm-back-to-top:focus-visible {
  outline: 2px solid #FF6600;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .sm-back-to-top {
    transition: opacity 0.01s ease, visibility 0.01s ease, background 0.18s ease, color 0.18s ease;
    transform: none;
  }

  .sm-back-to-top.is-visible {
    transform: none;
  }
}
