/* SMA Method — global reset, typography, header, footer */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  /* clip (not hidden) keeps horizontal overflow contained without
     turning html/body into a scroll container, which would stop
     position: sticky from working on the header. */
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--paper-text);
  background-color: var(--cream);
}

img,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration: underline;
}

.site-header a:hover {
  text-decoration: none;
}

.site-header :focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 2px;
}

.site-footer :focus-visible {
  outline: 2px solid var(--paper-text);
  outline-offset: 2px;
}

:focus-visible {
  outline: 2px solid var(--paper-text);
  outline-offset: 2px;
}

body:not(.page-home) .site-main {
  padding: var(--space-8) var(--space-4);
  max-width: 56rem;
  margin-inline: auto;
}

.page-placeholder {
  font-family: var(--font-body);
  color: var(--paper-text);
  opacity: 0.85;
}

.page-title {
  margin: 0 0 var(--space-4);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.75rem, 2vw + 1rem, 2.5rem);
  line-height: 1.2;
  color: var(--paper-text);
}

.page-placeholder code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* ----- Sticky header ----- */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--header-z);
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 80px;
  padding: var(--space-2) var(--space-4);
  background-color: var(--black);
  background-image: url("../images/header-bg-texture.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: var(--white);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.site-header__brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 0;
}

.site-header__brand img {
  display: block;
  height: auto;
  max-height: 43px;
  width: auto;
}

.site-header__end {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  row-gap: var(--space-2);
}

.site-header__nav {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

.site-header__nav a {
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--menu-text-inactive);
  text-decoration: none;
  white-space: nowrap;
}

/* Default matches Figma inactive nav; hover matches hover variant (full white) */
.site-header__nav a:hover {
  color: var(--white);
}

.site-header__nav a[aria-current="page"] {
  color: var(--white);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.22em;
  text-decoration-color: rgba(255, 255, 255, 0.45);
}

.site-header__pipe {
  display: block;
  width: 1px;
  height: 0.95em;
  align-self: center;
  background-color: rgba(255, 255, 255, 0.22);
  flex-shrink: 0;
}

.site-header__tools {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

.site-header__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--menu-text-inactive);
  cursor: pointer;
  text-decoration: none;
}

.site-header__icon:hover {
  color: var(--white);
}

.site-header__icon svg {
  width: 20px;
  height: 20px;
}

.site-header__icon svg path[fill="none"] {
  fill: none;
}

.site-header__icon svg path:not([fill="none"]) {
  fill: currentColor;
}

/* ----- Mobile nav toggle (hamburger) ----- */
.site-header__nav-toggle {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.site-header__burger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-left: auto;
  color: var(--white);
  cursor: pointer;
  flex-shrink: 0;
}

.site-header__burger-bars,
.site-header__burger-bars::before,
.site-header__burger-bars::after {
  content: "";
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.site-header__burger-bars {
  position: relative;
}

.site-header__burger-bars::before {
  position: absolute;
  left: 0;
  top: -7px;
}

.site-header__burger-bars::after {
  position: absolute;
  left: 0;
  top: 7px;
}

.site-header__nav-toggle:focus-visible + .site-header__burger {
  outline: 2px solid var(--white);
  outline-offset: 2px;
}

@media (max-width: 767px) {
  .site-header {
    min-height: 64px;
    padding-inline: var(--space-3);
    flex-wrap: nowrap;
  }

  .site-header__burger {
    display: inline-flex;
  }

  .site-header__end {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    padding: var(--space-1) var(--space-3) var(--space-3);
    background: #0a0a0a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 18px 30px rgba(0, 0, 0, 0.35);
    display: none;
  }

  .site-header:has(.site-header__nav-toggle:checked) .site-header__end {
    display: flex;
  }

  .site-header__nav {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    width: 100%;
    overflow: visible;
    mask-image: none;
  }

  .site-header__nav a {
    padding: 14px 2px;
    font-size: 1.0625rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .site-header__pipe {
    display: none;
  }

  .site-header__tools {
    justify-content: flex-start;
    gap: var(--space-2);
    padding-top: var(--space-2);
  }

  .site-header:has(.site-header__nav-toggle:checked) .site-header__burger-bars {
    background: transparent;
  }

  .site-header:has(.site-header__nav-toggle:checked) .site-header__burger-bars::before {
    transform: translateY(7px) rotate(45deg);
  }

  .site-header:has(.site-header__nav-toggle:checked) .site-header__burger-bars::after {
    transform: translateY(-7px) rotate(-45deg);
  }
}

/* Fallback for browsers without :has() — show nav as a simple wrapped row */
@supports not (selector(:has(*))) {
  @media (max-width: 767px) {
    .site-header__burger {
      display: none;
    }
    .site-header__end {
      position: static;
      display: flex;
      flex-direction: row;
      flex-wrap: wrap;
      width: 100%;
      padding: 0;
      background: transparent;
      box-shadow: none;
      border: 0;
    }
    .site-header__nav {
      flex-direction: row;
      flex-wrap: wrap;
    }
    .site-header__nav a {
      border-bottom: 0;
      padding: 4px 0;
    }
    .site-header__pipe {
      display: block;
    }
  }
}

/* ----- Header --on-hero modifier -----
   Single source of truth. Reusable across any page where the
   header sits inside a dark band (homepage hero, demos hero,
   paper header band). Page CSS should not override these.
   Pages that need a different background for the header element
   itself (e.g. paper's textured band) can do so with a more
   specific selector like body.page-paper .site-header. */
.site-header--on-hero {
  position: relative;
  top: auto;
  z-index: 2;
  flex-shrink: 0;
  align-self: stretch;
  min-height: 85px;
  background-color: transparent;
  background-image: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

@media (max-width: 767px) {
  .site-header--on-hero {
    min-height: 64px;
  }
}

/* ----- Footer (Figma: white bar, dark copy, legal + nav + social) ----- */
.site-footer {
  width: 100%;
  padding: var(--space-4) var(--space-4);
  background-color: var(--white);
  color: rgba(26, 26, 26, 0.75);
  font-size: 0.875rem;
  border-top: 1px solid rgba(0, 0, 0, 0.12);
}

.site-footer__inner {
  max-width: 90rem;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

@media (min-width: 768px) {
  .site-footer__inner {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
  }
}

.site-footer__meta {
  margin: 0;
  line-height: 1.5;
}

.site-footer__copyright {
  margin-right: 0.35em;
}

.site-footer__meta a {
  color: rgba(26, 26, 26, 0.75);
  text-decoration: none;
}

.site-footer__meta a:hover {
  color: var(--paper-text);
  text-decoration: underline;
}

.site-footer__right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-4);
}

@media (min-width: 768px) {
  .site-footer__right {
    flex-shrink: 0;
    margin-left: auto;
    justify-content: flex-end;
  }
}

.site-footer__nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25em 0.35em;
}

.site-footer__nav a {
  color: rgba(26, 26, 26, 0.85);
  text-decoration: none;
  font-weight: 500;
}

.site-footer__nav a:hover {
  color: var(--paper-text);
  text-decoration: underline;
}

.site-footer__social {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-2);
}

.site-footer__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--paper-text);
  line-height: 0;
}

.site-footer__icon:hover {
  color: var(--black);
}

.site-footer__icon svg {
  display: block;
  width: 20px;
  height: 20px;
}

.site-footer__icon svg path[fill="none"] {
  stroke: currentColor;
}

.site-footer__sep {
  opacity: 0.55;
  user-select: none;
}


/* ----- Shared CTA buttons ----- */
.demo-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 22px;
  font-family: var(--font-jumbo);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.03em;
  border-radius: 14px;
  text-decoration: none;
  transition: transform 180ms ease, background-color 180ms ease, border-color 180ms ease, color 180ms ease;
  cursor: pointer;
}

.demo-cta:hover {
  text-decoration: none;
}

.demo-cta--primary {
  background-color: #111;
  color: #ffffff;
  border: 1.5px solid #111;
}

.demo-cta--primary:hover {
  background-color: #ffffff;
  color: #111111;
  border-color: #111111;
  transform: translateY(-1px);
}

.demo-cta--secondary {
  background-color: #ffffff;
  color: #111;
  border: 1.5px solid #111;
}

.demo-cta--secondary:hover {
  background-color: #111;
  color: #ffffff;
  transform: translateY(-1px);
}

.demo-cta--on-dark {
  background-color: #ffffff;
  color: #111111;
  border: 1.5px solid #ffffff;
}

.demo-cta--on-dark:hover {
  background-color: transparent;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.9);
  transform: translateY(-1px);
}

.demo-cta:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}
