/*
Services Page - Wheelock Design System
*/

:root {
  --gutter: clamp(20px, 5vw, 72px);
  --r: 14px;
}

/* =====================================
   HERO — inverted hero-panel (mirrors About)
===================================== */

.services-hero.hero-panel {
  min-height: calc(100vh - 110px);
  position: relative;
  overflow: hidden;
  background-image: url("../images/bk2.jpg");
  background-size: cover;
  background-position: center;
  color: white;
}

.services-hero .hero-panel-content {
  position: absolute;
  top: 0;
  right: 0;
  left: auto;
  width: 40%;
  min-width: 480px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  text-align: right;
  background: rgba(47, 93, 78, .88);
  padding: 0 5%;
  transform: translateX(100%);
  animation: heroPanelSlideInRight .7s ease forwards;
  z-index: 2;
}

@keyframes heroPanelSlideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.services-hero .hero-panel-content h1,
.services-hero .hero-panel-content p {
  opacity: 0;
  animation: heroPanelTextIn .6s ease forwards;
}

.services-hero .hero-panel-content h1 {
  animation-delay: .8s;
}

.services-hero .hero-panel-content p {
  animation-delay: 1.2s;
}

@keyframes heroPanelTextIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.services-hero h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(38px, 5vw, 62px);
  line-height: 1.15;
  letter-spacing: 0.5px;
  color: #FFFFFF;
  margin: 0 0 18px;
  max-width: 14ch;
}

.services-hero h1 .gold-word {
  color: var(--gold);
}

.services-hero p {
  max-width: 46ch;
  color: rgba(255, 255, 255, 0.85);
  font-size: clamp(17px, 1.4vw, 20px);
  line-height: 1.7;
}

/* =====================================
   SERVICES GRID
===================================== */

.services-section {
  max-width: 1360px;
  margin: 0 auto;
  padding: clamp(32px, 4vw, 52px) var(--gutter) clamp(56px, 7vw, 96px);
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(6, 1fr);
}

/* ---- cards ---- */

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--darkgreen);
  color: #FFFFFF;
  border-radius: var(--r);
  padding: 26px 26px 22px;
  overflow: hidden;
  border: 1px solid transparent;
  transition: transform .3s cubic-bezier(.2, .7, .3, 1), background .3s ease, border-color .3s ease;
  text-decoration: none;
  cursor: pointer;
}

.card:hover,
.card:focus-visible {
  transform: translateY(-4px);
  background: var(--green-hover);
  border-color: var(--green);
}

.card--lead {
  grid-column: span 3;
  background: var(--darkgreen);
  min-height: 330px;
}

.card--lead:hover {
  background: #2B4E42;
}

.card--half {
  grid-column: span 3;
}

.card--third {
  grid-column: span 2;
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.card .num {
  font-family: var(--util);
  font-size: 11px;
  color: var(--gold);
  letter-spacing: .1em;
}

.tag {
  font-family: var(--util);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold-lift);
  border: 1px solid var(--green);
  border-radius: 99px;
  padding: 5px 11px;
}

.card-icon {
  width: 40px;
  height: 40px;
  margin: 12px 0 8px;
  color: var(--gold);
  display: block;
}

.card-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.card h3 {
  font-size: 22px;
  color: #FFFFFF;
  margin: 0 0 10px;
  font-family: var(--display);
  font-weight: 400;
}

.card--lead h3 {
  font-size: clamp(26px, 2.4vw, 34px);
  margin-top: 4px;
}

.card ul {
  list-style: none;
  margin: 0;
  padding: 0;
  color: #C2D3CB;
  font-size: 14px;
  line-height: 1.9;
}

.card--lead ul {
  font-size: 15px;
}

.card ul li::before {
  content: "—";
  color: var(--gold);
  margin-right: 9px;
}

.more {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gold-lift);
}

.more .arw {
  transition: transform .22s ease;
}

.card:hover .more .arw {
  transform: translateX(4px);
}

/* ---- trace graphs - animate on hover ---- */

.trace {
  width: 100%;
  height: 64px;
  margin-top: 18px;
  display: block;
  overflow: visible;
}

.card--lead .trace {
  height: 96px;
}

.trace path,
.trace line,
.trace circle {
  vector-effect: non-scaling-stroke;
}

.trace .plot {
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: var(--len, 1000);
  stroke-dashoffset: var(--len, 1000);
  transition: stroke-dashoffset 1.5s cubic-bezier(.5, 0, .2, 1), stroke .3s ease;
}

.card:hover .trace .plot {
  stroke-dashoffset: 0;
}

.trace .axis {
  stroke: var(--green);
  stroke-width: 1;
  stroke-dasharray: 2 5;
}

.trace .mark {
  fill: var(--gold-lift);
  opacity: 0;
  transition: opacity .3s ease;
}

.card:hover .trace .mark {
  transition-delay: 1.2s;
  opacity: 1;
}

/* ---- CTA card - BEIGE BACKGROUND ---- */

.card--cta {
  background: #F5F0E8 !important;
  color: var(--text);
  border: 1px solid var(--cream-2);
  grid-column: span 2;
  justify-content: center;
}

.card--cta:hover {
  background: #F5F0E8 !important;
  border-color: #DCD2B4;
  transform: translateY(-4px);
}

.card--cta h3 {
  color: var(--darkgreen);
  font-size: 22px;
  margin: 0 0 8px;
  font-family: var(--display);
  font-weight: 400;
}

.card--cta p {
  color: var(--text-mute);
  font-size: 14px;
  margin-bottom: 18px;
}

.card--cta .btn {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 8px;
  background: var(--gold);
  color: #FFFFFF;
  text-decoration: none;
  padding: 12px 24px;
  font-weight: 600;
  border-radius: 3px;
  transition: .3s ease;
  border: 1px solid var(--gold);
  font-family: var(--body);
  font-size: 13px;
  letter-spacing: 0.06em;
  margin-top: 0;
}

.card--cta .btn:hover {
  background: var(--gold-dark);
  border-color: var(--gold-dark);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(201, 166, 103, 0.3);
}

.card--cta .btn .btn-arrow {
  display: inline-block;
  margin-left: 8px;
  transition: transform .3s ease;
}

.card--cta .btn:hover .btn-arrow {
  transform: translateX(4px);
}

/* =====================================
   BUTTONS - Global
===================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  padding: 12px 22px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.btn-gold {
  background: var(--gold);
  color: #2A200A;
}

.btn-gold:hover {
  background: var(--gold-lift);
}

.btn .arw {
  transition: transform .2s ease;
}

.btn:hover .arw {
  transform: translateX(3px);
}

/* =====================================
   SCROLL REVEAL for tiles
===================================== */

.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s cubic-bezier(0.2, 0.7, 0.3, 1), transform 0.7s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delays */
.reveal:nth-child(1) { transition-delay: 0.05s; }
.reveal:nth-child(2) { transition-delay: 0.1s; }
.reveal:nth-child(3) { transition-delay: 0.15s; }
.reveal:nth-child(4) { transition-delay: 0.2s; }
.reveal:nth-child(5) { transition-delay: 0.25s; }
.reveal:nth-child(6) { transition-delay: 0.3s; }
.reveal:nth-child(7) { transition-delay: 0.35s; }

/* =====================================
   DETAIL OVERLAY - FULL SCREEN
===================================== */

.service-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.service-overlay.active {
  display: flex;
}

.service-overlay-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: backdropFadeIn 0.4s ease forwards;
}

@keyframes backdropFadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

.service-overlay-inner {
  position: relative;
  max-width: 1400px;
  width: 100%;
  max-height: 90vh;
  background: #ffffff;
  border-radius: 12px;
  padding: 3rem;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
  overflow-y: auto;
  animation: overlaySlideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  transform-origin: center;
}

@keyframes overlaySlideUp {
  0% {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.service-overlay-close {
  position: sticky;
  top: 0;
  float: right;
  z-index: 31;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(47, 93, 78, .15);
  background: white;
  color: var(--darkgreen);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .3s ease, color .3s ease, transform .3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  margin-bottom: 1rem;
}

.service-overlay-close:hover {
  background: var(--darkgreen);
  color: white;
  transform: rotate(90deg);
}

.service-detail {
  display: none;
  clear: both;
}

.service-detail.active {
  display: block;
  animation: detailFadeIn 0.5s ease forwards;
}

@keyframes detailFadeIn {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- layout: image + content as one balanced unit ---- */

.service-detail-grid {
  display: flex;
  align-items: flex-start;
  gap: 3rem;
}

.service-detail-media {
  flex: 0 0 380px;
  position: sticky;
  top: 0;
}

.service-detail-media img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--cream-2);
}

.service-detail-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* eyebrow now sits with the heading inside the content column,
   so eyebrow → heading → copy reads as a single block next to the image */
.service-detail .eyebrow {
  font-family: var(--util);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 14px;
  display: block;
}

.service-detail h2 {
  color: var(--darkgreen);
  font-size: 34px;
  line-height: 1.3;
  margin: 0 0 20px;
  font-family: var(--display);
  font-weight: 400;
}

.service-detail .gold-text {
  color: var(--gold);
}

.service-detail p {
  color: var(--text);
  line-height: 1.8;
  margin: 0 0 18px;
  font-size: 1.05rem;
}

.service-detail p:last-of-type {
  margin-bottom: 26px;
}

.service-detail-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.service-detail-chips li {
  position: relative;
  padding: 8px 16px 8px 30px;
  background: var(--cream);
  border: 1px solid rgba(47, 93, 78, .15);
  border-radius: 30px;
  font-size: 13.5px;
  color: var(--darkgreen);
  line-height: 1.4;
}

.service-detail-chips li::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
  transform: translateY(-50%);
}

/* ---- CTA gets its own footer row, separated from the copy above ---- */

.service-detail-cta {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--cream-2);
}

.service-detail .btn-gold {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--gold);
  color: #2A200A;
  padding: 14px 32px;
  border-radius: 6px;
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.06em;
  transition: background .3s ease, transform .3s ease, box-shadow .3s ease;
}

.service-detail .btn-gold:hover {
  background: var(--gold-lift);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(201, 166, 103, 0.3);
}

.service-detail .btn-gold .arw {
  transition: transform .3s ease;
}

.service-detail .btn-gold:hover .arw {
  transform: translateX(4px);
}

/* =====================================
   FIXED SVG TRACE - PREVENT CUTOFF
===================================== */

.card .trace {
  width: 100%;
  max-width: 100%;
  display: block;
  margin-top: 0.75rem;
  overflow: visible;
}

.card .trace .axis {
  stroke: var(--green);
  stroke-width: 1;
}

.card .trace .plot {
  stroke: var(--gold);
  stroke-width: 2;
  fill: none;
}

.card .trace .mark {
  fill: var(--gold-lift);
}

/* =====================================
   RESPONSIVE
===================================== */

@media (max-width: 1080px) {
  .card--lead,
  .card--half {
    grid-column: span 6;
  }
  .card--third,
  .card--cta {
    grid-column: span 3;
  }

  .service-overlay-inner {
    max-width: 900px;
  }

  .service-detail-media {
    flex: 0 0 280px;
  }

  .service-detail-grid {
    gap: 2rem;
  }
}

@media (max-width: 900px) {
  .services-hero .hero-panel-content {
    width: 100%;
    min-width: 0;
    right: 0;
    left: 0;
    align-items: flex-start;
    text-align: left;
    padding: 0 25px;
  }
}

@media (max-width: 680px) {
  .card--third,
  .card--cta {
    grid-column: span 6;
  }
  
  .service-overlay {
    padding: 0.5rem;
    align-items: flex-end;
  }
  
  .service-overlay-inner {
    padding: 1.5rem;
    max-height: 95vh;
    border-radius: 12px 12px 0 0;
    max-width: 100%;
    animation: overlaySlideUpMobile 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  }
  
  @keyframes overlaySlideUpMobile {
    0% {
      opacity: 0;
      transform: translateY(30px);
    }
    100% {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .service-detail-grid {
    flex-direction: column;
    gap: 1.5rem;
  }

  .service-detail-media {
    flex: none;
    position: static;
    width: 100%;
  }

  .service-detail-media img {
    aspect-ratio: 16 / 9;
  }
  
  .service-detail h2 {
    font-size: 26px;
  }
  
  .service-detail p {
    font-size: 0.95rem;
  }
  
  .service-detail-chips li {
    font-size: 0.8rem;
    padding: 0.4rem 1rem 0.4rem 2rem;
  }

  .service-detail-cta {
    margin-top: 22px;
    padding-top: 20px;
  }
  
  .service-overlay-close {
    width: 36px;
    height: 36px;
    font-size: 20px;
  }
}

@media (max-width: 768px) {
  .services-hero.hero-panel {
    min-height: calc(90vh - 90px);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
  
  .trace .plot {
    stroke-dashoffset: 0;
  }
  
  .trace .mark {
    opacity: 1;
  }
  
  .service-overlay:not(.active) {
    display: none;
  }
}

/* Long lists (e.g. Equine Contamination Screen) flow into two columns */
.card ul.card-list--cols {
  columns: 2;
  column-gap: 28px;
}

.card ul.card-list--cols li {
  break-inside: avoid;
}

@media (max-width: 420px) {
  .card ul.card-list--cols {
    columns: 1;
  }
}
