/* Each desktop AI service row has five equally sized cards. */
#mm-tuotteet .pgrid,
.ph__copy > .pgrid.tx-idx,
:is(#tuotteet, #tekoaly) .prods,
#ratkaisut .oa-ai {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(16px, 2vw, 28px);
  width: 100%;
  margin-inline: 0;
}

:is(#tuotteet, #tekoaly) .prods {
  margin-block: 0;
}

:is(#tuotteet, #tekoaly) .prods .pr {
  min-height: 0;
  padding: 0;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: start;
}

:is(#tuotteet, #tekoaly) .prods .pr__arch {
  width: 100%;
  padding-top: 9%;
  aspect-ratio: 1 / .92;
}

#mm-tuotteet .pgrid {
  align-content: start;
}

.mob__tuo {
  gap: 16px;
}

.mob__pa {
  padding-top: 9%;
}

.mob__desc {
  color: #D9D5CC;
  font-size: 14px;
  line-height: 1.4;
  text-wrap: pretty;
}

.oa-ai--custom .oa-ai__a {
  container-type: inline-size;
  background: var(--white);
  box-shadow: inset 0 0 0 var(--lw) var(--line);
  padding-top: 9%;
}

.oa-ai--custom .oa-ai__a .rw {
  color: #18191B;
  font-size: clamp(14px, 12cqi, 34px);
}

.oa-ai--custom .oa-ai__a .rw span {
  color: inherit;
  font-size: inherit;
  line-height: inherit;
}

:is(.pc--custom .pc__arch, .pr--custom .pr__arch, .mob__p--custom .mob__pa) {
  container-type: inline-size;
}

:is(.pc--custom .pc__arch, .pr--custom .pr__arch, .mob__p--custom .mob__pa) .rw {
  font-size: clamp(14px, 12cqi, 34px);
}

body[data-sivu="tuotteet"] .ph--plain:has(.pc--custom:focus-visible),
#ratkaisut:has(.oa-ai--custom:focus-visible) {
  --ink: #FAF7F1;
  --ink2: #E9E4DA;
  --muted: #B5B2AA;
  --line: #3A3B3E;
  background-color: #18191B;
  color: var(--ink);
}

@media (hover: hover) {
  body[data-sivu="tuotteet"] .ph--plain:has(.pc--custom:hover),
  #ratkaisut:has(.oa-ai--custom:hover) {
    --ink: #FAF7F1;
    --ink2: #E9E4DA;
    --muted: #B5B2AA;
    --line: #3A3B3E;
    background-color: #18191B;
    color: var(--ink);
  }
}

@media (min-width: 1440px) {
  #mm-tuotteet .mega__in {
    grid-template-columns: clamp(204px, 22%, 310px) minmax(0, 1fr);
    gap: clamp(24px, 3vw, 56px);
  }

  #mm-tuotteet .mega__btn {
    width: fit-content;
    white-space: nowrap;
  }
}

@media (max-width: 1180px) {
  /* Keep the next card visible and the scrolling inside the content column. */
  .ph__copy > .pgrid.tx-idx,
  :is(#tuotteet, #tekoaly) .prods,
  #ratkaisut .oa-ai {
    display: flex;
    gap: clamp(16px, 3vw, 24px);
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 4px;
    scrollbar-width: none;
    margin-inline: 0;
    padding: 8px 4px 14px;
  }

  /* Keep the website AI cards on the text edge with room for the focus outline. */
  #tekoaly .prods {
    margin-inline: -4px;
  }

  .ph__copy > .pgrid.tx-idx::-webkit-scrollbar,
  :is(#tuotteet, #tekoaly) .prods::-webkit-scrollbar,
  #ratkaisut .oa-ai::-webkit-scrollbar {
    display: none;
  }

  .ph__copy > .pgrid.tx-idx > li,
  :is(#tuotteet, #tekoaly) .prods > li,
  #ratkaisut .oa-ai > li {
    flex: 0 0 42%;
    min-width: 0;
    scroll-snap-align: start;
  }
}

@media (max-width: 760px) {
  /* Match the full-bleed card padding so the first snap point stays at scroll start. */
  #tekoaly .prods[data-mk] {
    scroll-padding-inline: var(--pad);
  }

  /* The earlier mobile design uses full-bleed scrolling for this list. */
  #ratkaisut .oa-ai {
    margin-inline: 0 !important;
    padding: 8px 4px 14px !important;
    scroll-padding-inline: 4px;
  }
}

@media (max-width: 640px) {
  .ph__copy > .pgrid.tx-idx > li,
  :is(#tuotteet, #tekoaly) .prods > li,
  #ratkaisut .oa-ai > li {
    flex-basis: 78%;
  }

  .pgrid.tx-idx .pc__arch {
    aspect-ratio: 1 / .92;
    padding-top: 9%;
  }
}

@media (max-width: 760px) {
  #alueet .oi__t::after {
    content: "";
    display: inline-block;
    width: .82em;
    height: .56em;
    margin-inline-start: .35em;
    background: currentColor;
    -webkit-mask: var(--arw) center / contain no-repeat;
    mask: var(--arw) center / contain no-repeat;
  }

  .tm .tm__ctas,
  #toimintamalli .tm__ctas {
    gap: 0 16px;
  }

  #toimintamalli .tm__ctas a {
    min-height: 44px;
    margin-block: 0;
  }

  /* Link hit areas retain a minimum of 44px while the visible gap contracts. */
  :is(.pe .pe__c, .oa-cta .oa-pe p, .an__ct),
  [data-sl-section-layout] .oa-cta .oa-pe p {
    gap: 0;
  }

  :is(.pe .pe__c, .oa-cta .oa-pe p, .an__ct, .yap2__c) a:is([href^="tel:"], [href^="mailto:"]),
  .yx .yx__tel {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    max-width: 100%;
    margin-block: 0;
    overflow-wrap: anywhere;
  }

  .yx .yx__tel:not(.yx__mail) {
    margin-top: 12px;
  }

  #milloin .sit > li {
    padding-block: 24px;
    margin-block: 0;
  }
}

#hae .cv__av {
  --portrait: clamp(80px, 7vw, 112px);
  inline-size: var(--portrait);
  block-size: var(--portrait);
  box-sizing: border-box;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--ink);
  justify-self: start;
  align-self: end;
}

#hae .cv__av img {
  inline-size: 100%;
  block-size: 100%;
  border-radius: 50%;
  object-fit: cover;
}

/* Product demo email uses the same light foreground as its existing hover style. */
body[data-tuote] #yhteys a.btn[href^="mailto:"] {
  color: var(--white);
}

body[data-tuote] #yhteys a.btn[href^="mailto:"]:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 3px;
}

/* Keep the entire footer wordmark inside its reserved space at the end of the page. */
body[data-tuote]:where(:not([data-tuote="santtu"])) .kn-ft .ft__giant {
  transform: none;
  margin-block-end: 8px;
}

body[data-tuote] .kn-ft .ft__giant .wm {
  max-inline-size: 100%;
}

/* Leave room below the wordmark for Sirkku’s fixed, 58 px chat launcher. */
@media (max-width: 600px) {
  body[data-tuote="sirkku"] .kn-ft .ft__giant {
    margin-block-end: 82px;
  }
}

/* Keep product controls easy to hit while preserving the drawn logo and send icon. */
body[data-tuote].kn :is(.hd__logo, .kn-ft__logo) {
  position: relative;
}

body[data-tuote].kn :is(.hd__logo, .kn-ft__logo)::before {
  content: "";
  position: absolute;
  inset: -8px 0;
}

body[data-tuote].kn .kn-ft__logo::before {
  inset-block: -2px;
}

body[data-tuote].kn .lang a {
  min-inline-size: 44px;
  min-block-size: 44px;
}

body[data-tuote].kn .kc__chips button {
  min-block-size: 44px;
}

body[data-tuote].kn button.kc__send:not(.sh--basic *)::before {
  content: "";
  position: absolute;
  inset: -2px;
}
