/* 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); }


/* 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;
}


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

/* 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);
}


/* ==========================================================
   Photo banner cards
   The photo bleeds edge-to-edge across the top of the card.
   The title sits on a solid "tab" in the card colour that cuts
   into the photo's bottom-left corner (with a concave fillet),
   so it stays readable on any photo, light or dark.
   ========================================================== */

.service-card {
  --card-pad: 28px;
  --card-bg: #fff;
  --tab-r: 20px;
  background: var(--card-bg);
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: var(--card-pad);
  max-height: none;            /* banner makes cards taller; never clip text */
}

/* special card: solid equivalent of color5 @ 60% over white,
   so the tab colour matches the card exactly */
.service-card.is-special {
  --card-bg: color-mix(in srgb, var(--color5, #1D6E93) 60%, #fff);
  background: var(--card-bg);
}

/* keep the gradient rings above the photo */
.service-card::before,
.service-card::after { z-index: 4; }

.service-banner {
  position: relative;
  margin: calc(var(--card-pad) * -1) calc(var(--card-pad) * -1) 0;
}

.service-media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
}

.service-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  transform: scale(1.02);
  transition: transform .6s cubic-bezier(.2,.7,.2,1), filter .4s ease;
  filter: saturate(.9);
}

/* brand duotone wash */
.service-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg,
    rgb(from var(--color5, #1D6E93) r g b / .55) 0%,
    rgb(from var(--color1, #189369) r g b / .15) 55%,
    transparent 80%);
  mix-blend-mode: multiply;
  transition: opacity .4s ease;
  pointer-events: none;
}

.service-card:hover .service-media img {
  transform: scale(1.08);
  filter: saturate(1.05);
}
.service-card:hover .service-media::after { opacity: .35; }

/* ---- title tab ---- */
.service-card .service-title {
  position: absolute;
  left: 0;
  bottom: -1px;                /* overlap the photo edge by a hair, no seam */
  z-index: 2;
  max-width: calc(100% - 56px);
  margin: 0;
  padding: 16px 22px 6px var(--card-pad);
  background: var(--card-bg);
  border-top-right-radius: var(--tab-r);
  font-size: 1.45rem;
  line-height: 1.2;
  text-wrap: balance;
}

/* gradient accent bar on top of the title */
.service-card .service-title::before {
  content: "";
  display: block;
  width: 36px;
  height: 4px;
  margin-bottom: 10px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--color1, #189369), var(--color5, #1D6E93));
  transition: width .35s ease;
}
.service-card:hover .service-title::before { width: 64px; }
.service-card.is-special .service-title::before { background: #fff; }

/* concave fillet where the tab meets the photo edge */
.service-card .service-title::after {
  content: "";
  position: absolute;
  width: var(--tab-r);
  height: var(--tab-r);
  pointer-events: none;
}
.service-card .service-title::after {
  left: 100%;
  bottom: 0;
  background: radial-gradient(circle at 100% 0,
    transparent calc(var(--tab-r) - .5px), var(--card-bg) var(--tab-r));
}

.service-text {
  position: relative;
  z-index: 1;
  margin: 0;
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.service-text .read-more {
  margin-top: auto;
  align-self: flex-start;
}

/* tags float on the photo as frosted chips */
.service-tags,
.service-card.is-special .service-tags {
  position: absolute;
  top: 14px;
  right: 14px;
  left: auto;
  bottom: auto;
  z-index: 3;
  max-width: calc(100% - 28px);
  justify-content: flex-end;
  margin: 0;
}
.service-tag,
.service-card.is-special .service-tag {
  background: rgba(255,255,255,.8);
  color: #0f172a;
  border-color: rgba(255,255,255,.6);
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
  font-weight: 600;
}

@media (max-width: 768px) {
  .service-card {
    --card-pad: 20px;
    --tab-r: 16px;
    max-height: none;
    min-width: 0;
  }
  .service-media { aspect-ratio: 4 / 3; }   /* more photo on phones */
  .service-card .service-title {
    font-size: 1.25rem;
    max-width: calc(100% - 40px);
    padding-top: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .service-media img,
  .service-card .service-title::before { transition: none; }
  .service-card:hover .service-media img { transform: scale(1.02); }
}

/* special card: rich-text children must not fall back to the grey body colour */
.service-card.is-special .service-desc,
.service-card.is-special .service-desc * {
  color: rgba(255,255,255,.92);
}
