.marketing {
  --marketing-card-bg: var(--gray-800);
  --marketing-footer-text: var(--gray-400);

  margin: 0;
  font-family: system-ui, sans-serif;
  font-size: 16px;
  background: #111;
  color: #fff;
  line-height: 1.2;
  -webkit-font-smoothing: antialiased;

  & h1,
  & h2,
  & h3 {
    font-family: Georgia, serif;
    font-weight: 300;
    text-wrap: balance;
  }

  & h1,
  & h2,
  & h3,
  & p {
    text-wrap: balance;
  }
}

.marketing-container {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Tito header (top white bar) */
.tito-header {
  background: #fff;
  color: #111;
  border-bottom: 1px solid #bcd8fb;
  padding: 0.5rem 1rem;

  & .marketing-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100px;
    flex-wrap: wrap;

    @media (width < 768px) {
      height: auto;
      padding-top: 1rem;
      padding-bottom: 1rem;
    }
  }
}

.tito-header-left {
  display: flex;
  align-items: center;
  gap: 2.5rem;

  & > a {
    display: flex;
    align-items: center;
  }

  & > a svg {
    width: auto;
    height: 26px;
    fill: #0279ff;
  }
}

.tito-header-nav {
  display: flex;
  align-items: center;
  gap: 2.5rem;

  & a,
  & button {
    text-decoration: none;
    color: #157dfb;
    font-size: 1rem;
    font-weight: 600;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: inherit;

    &:hover {
      color: #0b5fcc;
    }

    &:focus-visible {
      outline: 2px solid #157dfb;
      outline-offset: 2px;
    }
  }

  @media (width < 768px) {
    display: none;
  }
}

.tito-header-badge {
  display: inline-block;
  background: hotpink;
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border-radius: 1rem;
  vertical-align: middle;
  margin-right: 0.25rem;
}

.tito-header-right {
  @media (width < 768px) {
    display: none;
  }

  & a {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #157dfb;
    color: #fff;
    border-radius: 0.1875rem;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;

    &:hover {
      background: #0b5fcc;
      color: #fff;
    }

    &:focus-visible {
      outline: 2px solid #157dfb;
      outline-offset: 2px;
    }
  }
}

.tito-nav-toggle {
  display: none;
}

.tito-nav-hamburger {
  display: none;
  cursor: pointer;
  color: #157dfb;
  line-height: 1;

  @media (width < 768px) {
    display: block;
  }
}

.tito-header-mobile-nav {
  display: none;
  flex-direction: column;
  width: 100%;
  gap: 1.5rem;
  padding: 1.5rem 0 0.5rem;

  & a,
  & button {
    text-decoration: none;
    color: #157dfb;
    font-size: 1.125rem;
    font-weight: 600;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
  }
}

.tito-header-mobile-cta {
  display: block;
  padding: 0.75rem 1.5rem;
  background: #157dfb;
  color: #fff !important;
  border-radius: 0.1875rem;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
}

.tito-nav-toggle:checked ~ .tito-header-mobile-nav {
  @media (width < 768px) {
    display: flex;
  }
}

/* CSS-only Products dropdown */
.tito-header-dropdown {
  position: relative;

  & button {
    display: flex;
    align-items: center;
    gap: 0.375rem;
  }

  & button::after {
    content: "";
    display: inline-block;
    width: 0.4rem;
    height: 0.4rem;
    border-right: 2px solid currentcolor;
    border-bottom: 2px solid currentcolor;
    transform: rotate(45deg);
    margin-top: -0.125rem;
  }
}

.tito-header-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: -0.75rem;
  margin-top: 0.75rem;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 0.5rem;
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.1);
  min-width: 18rem;
  padding: 0.5rem;
  z-index: 100;

  & a {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    color: #111 !important;
    font-weight: 500 !important;

    &:hover {
      background: #f5f5f5;
      color: #111 !important;
    }
  }

  & .tito-header-dropdown-logo {
    margin-bottom: 0.25rem;
  }

  & .tito-header-dropdown-logo svg {
    height: 22px;
    width: auto;
    fill: currentcolor;
  }

  & .tito-header-dropdown-desc {
    font-size: 0.8125rem;
    color: #666;
    font-weight: 400;
  }
}

.tito-header-dropdown:hover .tito-header-dropdown-menu,
.tito-header-dropdown:focus-within .tito-header-dropdown-menu {
  display: block;
}

/* IO nav (secondary dark bar) */
.io-nav {
  background: #111;
  color: #fff;

  & .marketing-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 5rem;

    @media (width < 768px) {
      flex-direction: column;
      height: auto;
      padding-top: 1.25rem;
      padding-bottom: 1.25rem;
      gap: 1rem;
    }
  }
}

.io-nav-brand {
  display: flex;
  align-items: center;

  & a {
    display: flex;
    align-items: center;
  }

  & svg {
    width: auto;
    height: 28px;
    fill: #fff;
  }
}

.io-nav-links {
  display: flex;
  align-items: center;
  gap: 2.5rem;

  & a {
    text-decoration: none;
    color: rgb(255 255 255 / 0.7);
    font-size: 1rem;
    font-weight: 500;

    &:hover {
      color: #fff;
    }

    &:focus-visible {
      outline: 2px solid rgb(255 255 255 / 0.5);
      outline-offset: 2px;
    }
  }

  & .io-nav-btn,
  & .io-nav-dashboard {
    padding: 0.5rem 1rem;
    border: 1px solid rgb(255 255 255 / 0.25);
    border-radius: 0.25rem;
    color: #fff;

    &:hover {
      border-color: rgb(255 255 255 / 0.5);
    }
  }

  & .io-nav-dashboard {
    margin-left: auto;
  }

  @media (width < 768px) {
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;

    & .io-nav-dashboard {
      margin-left: 0;
    }
  }
}

/* Hero */
.marketing-hero {
  margin: 3rem auto;
  text-align: center;

  @media (width >= 768px) {
    margin: 20vh auto;
  }

  & h1 {
    font-size: 2rem;
    line-height: 1.2;
    margin-bottom: 1.5rem;

    @media (width >= 768px) {
      font-size: 3rem;
    }
  }
}

.marketing-hero-subtitle {
  font-size: 1.125rem;
  color: #d2d2d2;
  max-width: 55ch;
  margin: 0 auto 2rem;

  @media (width >= 768px) {
    font-size: 1.5rem;
  }
}

/* Page-level decorative background images */
.marketing .bg-io {
  opacity: 0.4;
  position: fixed;
  top: 20vh;
  z-index: -1;
  pointer-events: none;
}

.marketing .squiggle {
  opacity: 0.2;
  position: absolute;
  right: 20vw;
  top: 35vh;
  z-index: -1;
  pointer-events: none;
}

.marketing .line {
  opacity: 0.2;
  position: absolute;
  left: 0;
  top: 70vh;
  z-index: -1;
  pointer-events: none;
}

.marketing .hash {
  opacity: 0.2;
  position: absolute;
  right: 20vw;
  top: 350vh;
  z-index: -1;
  pointer-events: none;
}

/* Sections */
.marketing-section {
  margin: 3rem auto;
  text-align: center;

  @media (width >= 768px) {
    margin: 8rem auto;
  }

  & h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;

    @media (width >= 768px) {
      font-size: 2.625rem;
    }
  }

  & > .marketing-container > p {
    font-size: 1.125rem;
    color: #d2d2d2;
    max-width: 55ch;
    margin: 0 auto 2rem;

    @media (width >= 768px) {
      font-size: 1.5rem;
    }
  }

  & > .marketing-container > img {
    display: block;
    max-width: 100%;
    margin-top: 2rem;
    border-radius: 0.5rem;
  }
}

/* Essentials (3-column cards) */
.marketing-essentials-grid {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  list-style: none;
  margin: 3rem 0 0;
  padding: 0;

  @media (width >= 768px) {
    flex-direction: row;
    gap: 1rem;
  }

  & li {
    background: #d2d2d2;
    color: #111;
    border-radius: 0.25rem;
    flex: 1;
    padding: 1.5rem;
    text-align: left;
  }

  & h3 {
    font-size: 2rem;
    margin: 0 0 0.5rem;
  }

  & p {
    font-size: 1.25rem;
    color: #111;
    margin: 0;
  }
}

/* Details list (inline tags) */
.marketing-details-list {
  align-items: center;
  display: flex;
  flex-flow: column wrap;
  font-size: 1.125rem;
  font-weight: 600;
  gap: 0 2px;
  justify-content: center;
  list-style: none;
  margin: 0;
  padding: 0;

  @media (width >= 768px) {
    flex-direction: row;
    font-size: 1.5rem;
  }

  & li:nth-child(even) {
    color: #8e8e8e;
  }
}

/* Partners / social proof */
.marketing-partners-logos {
  align-items: center;
  display: flex;
  gap: 2rem;
  justify-content: space-between;
  list-style: none;
  margin: 3rem auto;
  max-width: 700px;
  padding: 0;

  & img {
    display: block;
    max-width: 100%;
    max-height: 40px;
  }

  @media (width < 640px) {
    flex-direction: column;
    gap: 1.5rem;
  }
}

.marketing-partners-link {
  text-align: center;

  & a {
    color: white;
    text-decoration: none;

    &:hover {
      text-decoration: underline;
    }
  }
}

/* CTA section */
.marketing-cta-actions {
  & form.marketing-contact-form {
    margin-top: 3rem;
  }

  & a {
    color: var(--blue-600);
    text-decoration: none;
    font-weight: 600;

    &:hover {
      text-decoration: underline;
    }
  }
}

/* Footer */
.marketing-footer {
  border-top: 1px solid #222;
  padding: 3rem 0 2rem;
  color: var(--marketing-footer-text);
}

.marketing-footer-grid {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;

  @media (width < 640px) {
    flex-direction: column;
    gap: 2rem;
  }
}

.marketing-footer-brand {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  color: var(--gray-300);

  & p {
    margin: 0;

    & + p {
      margin-top: 0.5rem;
    }
  }
}

.marketing-footer-columns {
  display: flex;
  gap: 3rem;

  @media (width < 640px) {
    flex-direction: column;
    gap: 2rem;
  }
}

.marketing-footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;

  & h4 {
    color: var(--gray-300);
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 0.25rem;
  }

  & a {
    color: var(--marketing-footer-text);
    text-decoration: none;
    font-size: 0.875rem;

    &:hover {
      color: var(--gray-200);
    }

    &:focus-visible {
      outline: 2px solid rgb(255 255 255 / 0.5);
      outline-offset: 2px;
    }
  }
}

.marketing-footer-bottom {
  text-align: center;
  padding-top: 1.5rem;
  border-top: 1px solid var(--gray-800);
}

.marketing-footer-company {
  font-size: 0.75rem;
  color: var(--gray-600);
  margin-bottom: 0.25rem;
}

.marketing-footer-copyright {
  font-size: 0.8125rem;
  color: var(--gray-600);
}

/* Active nav link */
.io-nav-links a.active {
  color: #fff;
}

/* Case studies */
.case-study {
  display: flex;
  gap: 3rem;
  text-align: left;
  padding: 3rem;
  background: var(--marketing-card-bg);
  border-radius: 0.5rem;
  margin-bottom: 2rem;

  @media (width < 768px) {
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
  }
}

.case-study-logo {
  flex-shrink: 0;
  width: 120px;
  display: flex;
  align-items: flex-start;

  & img {
    max-width: 100%;
    max-height: 60px;
  }

  @media (width < 768px) {
    width: auto;

    & img {
      max-height: 40px;
    }
  }
}

.case-study-content {
  & h2 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;

    @media (width >= 768px) {
      font-size: 2rem;
    }
  }

  & h3 {
    font-size: 1rem;
    color: #d2d2d2;
    font-family: system-ui, sans-serif;
    font-weight: 500;
    margin-bottom: 1rem;
  }

  & p {
    font-size: 1rem;
    line-height: 1.6;
    color: #d2d2d2;
    margin: 0 0 1rem;
  }

  & blockquote {
    margin: 1.5rem 0 0;
    padding-left: 1.5rem;
    border-left: 3px solid var(--blue-600);
  }

  & blockquote p {
    font-size: 1.125rem;
    font-style: italic;
    color: #fff;
    margin-bottom: 0.5rem;
  }

  & blockquote cite {
    font-style: normal;
    font-size: 0.875rem;
    color: #999;
  }
}

/* Beta badge (reused from docs) */
.marketing .docs-beta-badge {
  display: inline-block;
  font-size: 0.5625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.0625rem 0.25rem;
  border-radius: 0.1875rem;
  background: var(--purple-900);
  color: var(--purple-300);
  vertical-align: middle;
}
