/* Services section */
.services {
  background: #fff;
  padding: 72px 0;
}

.services .container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 20px;
}

.services-title {
  font-family: 'Roboto', sans-serif;
  font-weight: 900;
  font-size: 2.75rem;
  text-align: center;
  margin: 0 0 40px 0;
}

.services-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  justify-content: center;
}

/* Base card (keep your original dimensions) */
.service-card {
  flex: 1 1 45%;         /* your width */
  max-width: 560px;      /* your cap */
  min-width: 280px;      /* your min */
  background: #fff;
  border: 1px solid transparent;   /* keep overall size; hide default line */
  border-radius: 14px;             /* consistent radius */
  box-shadow: 0 8px 24px rgba(0,0,0,.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px;
  transition: transform 0.2s ease;
  position: relative;    /* for gradient ring pseudos */
  z-index: 0;
}

/* Permanent 2px gradient border with matching radius */
.service-card::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 2px; /* 2px border */
  border-radius: inherit;
  background: linear-gradient(90deg, var(--color5), var(--color1));
  /* punch the middle out so only the ring shows */
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  z-index: 0;
  opacity: 1;
}

/* Hover: animated conic overlay (same radius), subtle by default */
@property --angle {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

.service-card::after {
  content: "";
  position: absolute;
  inset: 0;
  padding: 2px;
  border-radius: inherit;
  background: conic-gradient(
    from var(--angle),
    var(--color1),
    var(--color2),
    var(--color3),
    var(--color4),
    var(--color5),
    var(--color1)
  );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  z-index: 0;
  opacity: 0; /* only on hover */
  transition: opacity .3s ease-in-out;
}

.service-card:hover {
  transform: translateY(-4px);
}
.service-card:hover::after {
  opacity: 1;
  animation: spin-colors 3s linear infinite;
}

@keyframes spin-colors { to { --angle: 360deg; } }

@media (prefers-reduced-motion: reduce) {
  .service-card:hover::after { animation: none; }
}

/* Inner content (unchanged) */
.service-text {
  flex: 1;
  margin-right: 16px;
}

.service-text h3 {
  font-family: 'Roboto', sans-serif;
  font-weight: 800;
  font-size: 1.6rem;
  margin: 0 0 10px 0;
  color: #0f172a;
}

.service-text p {
  margin: 0 0 18px 0;
  color: #64748b;
  line-height: 1.6;
}

.read-more {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--accent, #16a34a);
  text-decoration: none;
  font-weight: 700;
}
.read-more .arrow { transition: transform .2s ease; }
.read-more:hover .arrow { transform: translateX(4px); }

.service-media img {
  width: 100px;
  height: auto;
  flex-shrink: 0;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,.08));
}

/* Price styles (unchanged) */
.service-price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  margin-top: 16px;
  margin-bottom: 16px;
}
.service-price .price-prefix {
  font-weight: 800;
  letter-spacing: .02em;
  color: var(--color5);
}
.service-price .price-main,
.service-price .price-new {
  font-weight: 900;
  font-size: clamp(1.25rem, 1.4vw + 1rem, 1.8rem);
  line-height: 1;
  color: var(--text-color-dark, #000);
}
.service-price .price-old {
  font-size: clamp(1.05rem, 1vw + .8rem, 1.35rem);
  color: #9aa1a8;
}
.service-price .price-old s {
  text-decoration-thickness: 2px;
  text-decoration-color: #b6bfc8;
}

/* Description clamp (unchanged) */
.service-desc {
  margin: 0 0 14px 0;
  color: #64748b;
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Expandable variant (unchanged behavior) */
.service-card {
  cursor: pointer;
  transition:
    transform .2s ease,
    box-shadow .2s ease,
    max-height .28s ease;
  max-height: 520px;
  will-change: transform, max-height;
}

.service-card.is-expanded {
  flex: 1 1 100%;
  max-width: 100%;
  max-height: 2000px;
  box-shadow: 0 12px 28px rgba(0,0,0,.08);
}

.service-card.is-expanded .service-desc {
  -webkit-line-clamp: unset;
  display: block;
  overflow: visible;
}

.service-card.is-expanded .service-media img {
  width: min(160px, 24vw);
}

/* Responsive (keep your original) */
@media (max-width: 768px) {
  .service-card {
    max-height: 580px;
    flex: 1 1 100%;
    flex-direction: column;
    text-align: left;
  }
  .service-media {
    margin-top: 16px;
    text-align: left;
  }
  .service-media img {
    width: 140px;
  }
}

/* Show full (truncated) HTML instead of 3-line clamp */
.service-desc {
  display: block;           /* cancel -webkit-box from earlier */
  -webkit-line-clamp: unset;
  -webkit-box-orient: initial;
  overflow: hidden;         /* just in case */
}

/* Read more button using brand color (color5) */
.btn-read {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 2px solid var(--color5, #1D6E93);
  background: transparent;
  color: var(--color5, #1D6E93);
  font-weight: 700;
  text-decoration: none;
  transition: background .15s ease, color .15s ease, transform .1s ease;
}
.btn-read:hover {
  background: var(--color5, #1D6E93);
  color: #fff;
}
.btn-read:active { transform: translateY(1px); }
.btn-read .arrow { transition: transform .2s ease; }
.btn-read:hover .arrow { transform: translateX(4px); }

/* Prevent text from blowing out of the flex card on iOS Safari */
.service-text {
  min-width: 0;                 /* allow flex child to shrink */
}

/* Keep long words/URLs inside the card */
.service-desc {
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}

/* If the rich HTML contains media, keep it responsive */
.service-desc img,
.service-desc video,
.service-desc iframe {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Stop content from visually spilling past the card edges */
.service-card {
  overflow: hidden;             /* clip when not expanded */
}

/* When expanded, you can allow overflow if desired */
.service-card.is-expanded {
  overflow: visible;
}

.services .service-card { position: relative; }

.service-tags {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 65%;
  justify-content: flex-end;
}

.service-tag {
  font-size: 12px;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 9999px;
  background: #f1f3f5;
  color: #2b2b2b;
  border: 1px solid rgba(0,0,0,.08);
  white-space: nowrap;
}

@media (max-width: 680px) {
  .service-tags {
    position: static;       /* avoid overlap on small screens */
    margin-top: 8px;
    justify-content: flex-start;
  }
}


/* Fallback first, then modern rgb(from …) */
.service-card.is-special {
  background-color: var(--color5);
  background-color: rgb(from var(--color5) r g b / 0.6);
  color: #fff; /* light text for contrast */
}

/* Make inner text inherit the light color */
.service-card.is-special .service-title,
.service-card.is-special .service-desc,
.service-card.is-special .service-price,
.service-card.is-special .price-prefix,
.service-card.is-special .price-old s,
.service-card.is-special .price-main,
.service-card.is-special .price-new {
  color: inherit;
}

/* Read-more button/link on dark bg */
.service-card.is-special .btn-read {
  border: 1px solid rgba(255,255,255,.6);
  color: #fff;
  background: transparent;
}
.service-card.is-special .btn-read:hover {
  border-color: rgba(255,255,255,.9);
  background: rgba(255,255,255,.12);
}
.service-card.is-special .btn-read .arrow { color: inherit; }

/* Optional: tags look good on dark card */
.service-card.is-special .service-tag {
  background: rgba(255,255,255,.15);
  color: #fff;
  border-color: rgba(255,255,255,.25);
}
