.services {
  --panel-gutter: clamp(24px, 4vw, 68px);
  --panel-padding-block: clamp(38px, 4.2vw, 72px);
  --heading-gap: clamp(34px, 3.6vw, 60px);
  padding: clamp(52px, 7vw, 118px) var(--edge);
  background: #999 url('./assets/services-field.webp') center / cover no-repeat;
}

.services-panel {
  overflow: clip;
  padding: var(--panel-padding-block) var(--panel-gutter);
  background: #f7f7f7;
}

.services-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 12px clamp(16px, 2.7vw, 40px);
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--heading-gap);
}
.services-heading .meeting-button { margin-inline-start: auto; }
#services-title {
  margin: 0;
  margin-block-end: -.14em;
  font-size: var(--section-title-size);
  font-weight: 550;
  line-height: 1;
  letter-spacing: -.065em;
}
@supports (text-box: trim-end cap alphabetic) {
  #services-title { text-box: trim-end cap alphabetic; margin-block-end: 0; }
}
/* The Polish title ends below the baseline at the descender of “g”. */
#services-title:lang(pl) { padding-block-end: .2em; }

.services-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}
.services-grid::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: var(--rule-on-light) right / 1px 100% no-repeat,
              var(--rule-on-light) bottom / 100% 1px no-repeat;
}

.service-item {
  position: relative;
  min-width: 0;
  padding: clamp(22px, 2.4vw, 38px);
  background-image: var(--rule-on-light), var(--rule-on-light);
  background-size: 100% 1px, 1px 100%;
  background-repeat: no-repeat;
  transition: background-color .2s;
}

/* Mark T and cross junctions. The grid's four outer corners stay flush. */
.service-item::before, .service-item::after {
  position: absolute;
  z-index: 2;
  width: 7px;
  height: 7px;
  pointer-events: none;
  background: linear-gradient(#666, #666) center / 7px 1px no-repeat,
              linear-gradient(#666, #666) center / 1px 7px no-repeat;
}
.service-item:not(:first-child)::before { content: ''; left: -3px; top: -3px; }

/* Finish the right and bottom edges only where a row or column divider meets them. */
.service-item::after { left: -3px; bottom: -3px; }
@media (width > 1000px) {
  .service-item:nth-child(3n):not(:last-child)::after { content: ''; left: auto; right: -3px; bottom: -4px; }
  .service-item:nth-last-child(-n + 3):not(:nth-child(3n + 1))::after { content: ''; }
}
@media (650px < width <= 1000px) {
  .service-item:nth-child(2n):not(:last-child)::after { content: ''; left: auto; right: -3px; bottom: -4px; }
  .service-item:last-child:nth-child(2n)::after { content: ''; }
}
@media (width <= 650px) {
  .service-item:not(:last-child)::after { content: ''; left: auto; right: -3px; bottom: -4px; }
}

.service-tags {
  display: flex;
  flex-wrap: wrap;
  align-content: start;
  gap: 5px;
  list-style: none;
  margin: 0 0 clamp(18px, 1.7vw, 26px);
  padding: 0;
}
.service-tag, .service-tags li:not(.service-tag-pair), .service-tag-pair > span {
  align-self: start;
  padding: 4px 8px;
  background: #eaeaea;
  border-radius: 5px;
  color: #414141;
  font-size: .8125rem;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
}
.service-tag-pair {
  display: inline-flex;
  align-self: start;
  gap: inherit;
}
.service-tags .service-tag-add {
  display: inline-flex;
  align-items: center;
  gap: .35em;
  background: transparent;
  color: #565656;
  box-shadow: inset 0 0 0 1px #c9c9c9;
}
.tag-plus {
  flex: none;
  width: 1em;
  height: 1em;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: linear-gradient(currentColor, currentColor) center / 7px 1px no-repeat,
              linear-gradient(currentColor, currentColor) center / 1px 7px no-repeat;
}
@supports (grid-template-rows: subgrid) {
  .service-item {
    display: grid;
    grid-row: span 2;
    grid-template-rows: subgrid;
  }
}
.service-copy h3 {
  display: inline;
  margin: 0;
  font-size: clamp(22px, 1.8vw, 30px);
  font-weight: 550;
  line-height: 1.16;
  letter-spacing: -.045em;
  overflow-wrap: anywhere;
}
.service-copy p {
  margin: 11px 0 0;
  max-width: 34ch;
  color: #515151;
  font-size: 1rem;
  line-height: 1.55;
}

@media (hover: hover) and (pointer: fine) {
  .service-item:hover { background-color: rgb(0 0 0 / 3%); }
  .services .service-tags :is(li:not(.service-tag-pair), .service-tag-pair > span) {
    background-image: linear-gradient(112deg, transparent 38%, rgb(255 255 255 / 85%) 50%, transparent 62%);
    background-size: 300% 100%;
    background-position: 100% 50%;
    transition: background-position .42s ease-out, background-color .2s, box-shadow .2s;
  }
  .services .service-tags :is(li:not(.service-tag-pair), .service-tag-pair > span):hover {
    background-position: 0% 50%;
    background-color: #fcfcfc;
    box-shadow: inset 0 0 0 1px #aaa;
  }
  .service-copy h3, .education-card h3 {
    background: linear-gradient(currentColor, currentColor) left calc(100% - .075em) / 0% 1px no-repeat;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
    transition: background-size .24s ease-out;
  }
  .service-item:hover .service-copy h3, .education-tile:hover h3, .education-tile:focus-visible h3 { background-size: 100% 1px; }
}
@media (prefers-reduced-motion: reduce) {
  .service-item, .service-copy h3,
  .services .service-tags :is(li:not(.service-tag-pair), .service-tag-pair > span) { transition: none; }
}
@media (max-width: 1000px) {
  .services-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 650px) {
  .services {
    padding-block: 32px;
    --panel-gutter: clamp(19px, 5vw, 30px);
    --panel-padding-block: 32px;
    --heading-gap: 28px;
  }
  .services-grid { grid-template-columns: 1fr; }
  .service-item { display: block; grid-row: auto; padding: 22px 16px; }
  .service-tags { margin-bottom: 14px; }
  .service-copy p { margin-top: 7px; }
}
@media (max-width: 430px) {
  .services-heading { column-gap: 8px; }
  #services-title { font-size: clamp(2rem, 10.1vw, 2.75rem); }
}

.service-copy h3 a { color: inherit; text-decoration: none; }
.service-copy h3 a::after { content: ''; position: absolute; inset: 0; }
.service-item .service-tags { position: relative; z-index: 1; }
.service-copy h3 a:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
