
/* 1. keyframes */
@keyframes fadeUpCard{
  0%  { opacity:0; transform:translateY(22px); }
  100%{ opacity:1; transform:translateY(0);    }
}

/* 2. apply the animation */
.service-card{
  /* existing visual styles remain intact */
  animation:fadeUpCard .7s ease-out both;
}

/* 3. stagger each card slightly */
.service-card:nth-child(1){ animation-delay:.05s; }
.service-card:nth-child(2){ animation-delay:.10s; }
.service-card:nth-child(3){ animation-delay:.15s; }
.service-card:nth-child(4){ animation-delay:.20s; }
.service-card:nth-child(5){ animation-delay:.25s; }
.service-card:nth-child(6){ animation-delay:.30s; }
.service-card:nth-child(7){ animation-delay:.35s; }
.service-card:nth-child(8){ animation-delay:.40s; }


/* 4. (optional) deepen the hover lift a bit to match portfolio feel */
@media(hover:hover){
  .service-card:hover{ transform:translateY(-6px); }
}

/* 5. accessibility – disable motion for users who prefer reduced-motion */
@media (prefers-reduced-motion:reduce){
  .service-card{
    animation:none !important;
    transform:none !important;
  }
}


:root{
  --max-page: 1200px;
  --grid-gap: clamp(.75rem,2vw,1.5rem);
  --clr-dark: #283618;
}

/* ─── HERO ───────────────────────── */
.services-hero{
  background:
    url("/public/images/servic-hero.webp") center/cover no-repeat,
    #2d3a1a; 
  color:#fff; text-align:center;
  position:relative; padding:6rem 1rem 4rem;
}
.services-hero::before{
  content:""; position:absolute; inset:0;
  background:rgba(0,0,0,.55); z-index:0;
}
.services-hero h1,
.services-hero p{ position:relative; z-index:1; }
.services-hero h1{
  font-size:clamp(2rem,5vw,3.2rem);
  margin-bottom:.5rem; text-shadow:2px 2px 4px rgba(0,0,0,.5);
}
.services-hero p{ font-size:clamp(1rem,2.2vw,1.25rem); }

/* ─── SERVICE GRID ──────────────── */
.service-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(260px,1fr));
  gap:var(--grid-gap);
  max-width:var(--max-page); margin:clamp(2rem,6vw,3rem) auto;
  padding:0 clamp(1rem,4vw,2rem);
}
.service-card{
  background:#fff; border-radius:12px; overflow:hidden;
  box-shadow:0 3px 12px rgba(0,0,0,.08);
  display:flex; flex-direction:column;
}
.service-card img{
  width:100%; aspect-ratio:4/3; object-fit:cover;
}
.service-card h2{
  font-size:1.25rem; color:var(--clr-dark);
  margin:1rem 1rem .5rem;
}
.service-card p{ margin:0 1rem 1.25rem; line-height:1.45; }

/* subtle hover on devices that support it */
@media(hover:hover){
  .service-card{ transition:.25s ease; }
  .service-card:hover{ transform:translateY(-4px); }
}

/* ─── MOBILE (≤ 600 px) ─────────── */
@media(max-width:600px){

  .services-hero{ padding:4.5rem 1rem 3rem; }
  .services-hero h1{ font-size:clamp(1.6rem,8vw,2.2rem); }

  .service-grid{
    grid-template-columns:repeat(2, minmax(0,1fr));
    gap:1rem;              /* tighten gap so both fit comfortably */
  }
}
@media (max-width:360px){
  .service-grid{
    grid-template-columns:1fr;
  }
}

/* –––  fade only if user allows motion ––– */
@media (prefers-reduced-motion:no-preference){
  .services-hero{
    opacity:0;                       /* start invisible   */
    transition:opacity .6s ease-out;
  }
  /* becomes visible the moment decode() resolves */
  body.hero-ready .services-hero{ opacity:1; }
}

/* ─── SERVICES-ONLY ACCENTS ─────────────────────────────── */
/* 1. give the cards a tinted top bar */
.service-card::before{
  content:"";
  display:block;
  height:6px;
  background:var(--clr-dark);
}

/* 2. lighten the card shadow so Portfolio feels "heavier" */
.service-card{
  box-shadow:0 2px 8px rgba(0,0,0,.06);
}

/* 3. add a faint background grid behind the whole section */
body.services-page .service-grid{
  position:relative;           /* create stacking context   */
}
body.services-page .service-grid::before{
  content:"";
  position:absolute; inset:0;
  background:
    linear-gradient(transparent 95%, rgba(0,0,0,.03) 95%) 0 0 / 100% 44px,
    linear-gradient(90deg, transparent 95%, rgba(0,0,0,.03) 95%) 0 0 / 44px 100%;
  pointer-events:none;
  z-index:-1;
}

.services-hero{
  overflow:hidden;             
}

/* ---- geometry ---------------------------------------------------- */
.service-card{
  perspective: 1200px;
  aspect-ratio: 4 / 5;      
  min-height: 320px;  
}
.card-inner{
  position:relative;
  width:100%;
  height:100%;
  transition:transform .6s;
  transform-style:preserve-3d;
}
.service-card.flipped .card-inner{
  transform:rotateY(180deg);
}

/* ---- front & back faces ------------------------------------------ */
.card-face{
  position:absolute; 
  inset:0;
  display:flex; 
  flex-direction:column;
  backface-visibility:hidden;
  overflow:hidden;
}
.card-front img{ width:100%; aspect-ratio:4/3; object-fit:cover; }
.card-front h2{ margin:1rem; color:var(--clr-dark); font-size:1.2rem; }

.card-back{
  background:#fff;
  transform:rotateY(180deg);
  justify-content:center; align-items:center;
  text-align:center; padding:1.5rem;
  gap:1rem;
}
.card-back p{ margin:0; line-height:1.45; }
.card-cta{
  display:inline-block; padding:.45rem 1rem;
  background:var(--clr-dark); color:#fff;
  border-radius:6px; text-decoration:none;
  font-size:.9rem; transition:background .25s;
}
.card-cta:hover{ background:#3a4b1e; }

/* ---- accessibility ------------------------------------------------ */
@media (prefers-reduced-motion: reduce){
  .card-inner{ transition:none !important; }
}

/* 1 ▸ responsive grid columns + gap */
@media (max-width: 600px){
  .service-grid{             /* already two columns */
    gap: .75rem;             /* was 1rem → gives each card more room */
  }
}

@media (max-width: 425px){   /* small phones → one column */
  .service-grid{
    grid-template-columns: 1fr;
    gap: .9rem;
  }
}

/* 2 ▸ let short cards shrink naturally */
@media (max-width: 600px){
  .service-card{
    min-height: auto;        /* overrides earlier 320 px rule */
  }
}

/* ========= MOBILE CARD HEIGHT + TEXT TUNE-UP ===================== */
@media (max-width: 600px){

  /* 1 ▸ keep aspect-ratio, but make it shorter than 4/5           */
  .service-card{
    aspect-ratio: 3 / 4;   /* ≈ 75 % of previous height            */
    min-height: auto;      /* don’t force 320 px on narrow phones  */
  }

  /* 2 ▸ slightly smaller fonts so copy fits                      */
  .card-front h2{ font-size: 1rem; }            /* was 1.2rem      */
  .card-back  p { font-size: .9rem; line-height: 1.4; }

  /* 3 ▸ wrap long words (Silicone-seals, ICC-approved, etc.)      */
  .card-front h2,
  .card-back  p{
    overflow-wrap: anywhere;
  }
}
