/* =========================================================
   HOMEPAGE: SERVICE CARDS AND BRAND CAROUSEL
   Issue #44 approved designs:
   - Service Cards: Premium Editorial Variant B
   - Brand Carousel: v5 (design-review/brand-carousel-logos-v5.html)
   Rules are those of the approved prototype; only the page-shell rules the
   prototype needed (body, .container, headings) are left to style.css.
   Markup: index.php. Behaviour: assets/js/home.js. Logo data: includes/brand-logos.php.
   ========================================================= */

/* ===== Tokens used by the approved Service Cards and Brand Carousel (existing palette values) ===== */
:root {
  --c-brand-900: #162842;           /* existing --navy: panel, headings, focus ring */
  --c-accent-500: #c89b3c;          /* existing --gold (brand accent; not used by the service card) */
  --c-text: #17253a;
  --c-text-muted: #52647c;
  --c-surface: #ffffff;
  --c-surface-soft: #f4f7fb;        /* existing --soft: services section */
  --c-border: #dce4ee;
  --c-on-dark: #ffffff;
  --c-on-dark-muted: rgba(255, 255, 255, 0.82);
  --sh-card: 0 8px 24px rgba(22, 40, 66, 0.08);
  --sh-card-hover: 0 16px 36px rgba(22, 40, 66, 0.13);
  --r-md: 18px;
  --dur-card: 200ms;
  --ease-standard: cubic-bezier(0.2, 0, 0.2, 1);
  --focus-width: 3px;
  --focus-offset: 4px;
}

/* ===== Service card grid ===== */
.svc-grid { list-style: none; margin: 44px 0 0; padding: 0; display: grid; gap: 24px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.svc-grid > li { display: flex; min-width: 0; }

/* ===== Service card (Variant B - Premium Editorial) ===== */
.svc-card {
  /* Geometry measured from the Variant B reference, relative to the card width */
  --svc-slant: 30cqi;               /* the panel's top edge drops 30% of the card width */
  container-type: inline-size;
  position: relative;               /* containing block of the stretched link */
  display: flex;
  width: 100%;
  border-radius: var(--r-md);
  transition: transform var(--dur-card) var(--ease-standard);
}
.svc-card__frame {
  display: grid;
  grid-template-areas: "media" "body";
  grid-template-rows: auto 1fr;
  width: 100%;
  overflow: hidden;
  border-radius: var(--r-md);
  background: var(--c-brand-900);
  box-shadow: var(--sh-card);
  transition: box-shadow var(--dur-card) var(--ease-standard);
}
.svc-card__media { grid-area: media; margin: 0; background: var(--c-surface-soft); }
.svc-card__media img { display: block; width: 100%; height: auto; aspect-ratio: 14 / 15; object-fit: cover; }
/* Navy panel: overlaps the photo with a slanted top edge (drawn as a background so nothing clips the link) */
.svc-card__body {
  grid-area: body;
  z-index: 1;
  margin-top: calc(-1 * var(--svc-slant));
  padding: 15cqi 11cqi 9cqi;
  display: flex;
  flex-direction: column;
  color: var(--c-on-dark);
  background:
    linear-gradient(to top right, var(--c-brand-900) calc(50% - 0.5px), transparent calc(50% + 0.5px)) top left / 100% var(--svc-slant) no-repeat,
    /* the solid fill starts 1px early so sub-pixel slant heights never leave a seam */
    linear-gradient(var(--c-brand-900), var(--c-brand-900)) left calc(var(--svc-slant) - 1px) / 100% calc(100% - var(--svc-slant) + 1px) no-repeat;
}
.svc-card__icon { width: clamp(38px, 16cqi, 56px); height: auto; margin: 0 0 clamp(10px, 4cqi, 16px) -3px; color: var(--c-on-dark); flex: none; }
/* 700, not 800/900: on Windows the Arial fallback renders 800+ as Arial Black */
.svc-card__title { margin: 0 0 8px; font-size: clamp(1.25rem, 9cqi, 1.75rem); line-height: 1.2; letter-spacing: -0.01em; font-weight: 700; color: var(--c-on-dark); }
.svc-card__link { color: var(--c-on-dark); text-decoration: none; }
.svc-card__link::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-md); }   /* whole card is the link */
.svc-card__text { margin: 0; font-size: clamp(1rem, 6.4cqi, 1.1875rem); line-height: 1.45; color: var(--c-on-dark-muted); }

/* Keyboard focus: one ring around the whole card (navy: 14.8:1; gold would be under 3:1 on this background) */
.svc-card__link:focus-visible { outline: var(--focus-width) solid var(--c-brand-900); outline-offset: var(--focus-offset); }
@supports selector(:has(*)) {
  .svc-card:has(.svc-card__link:focus-visible) { outline: var(--focus-width) solid var(--c-brand-900); outline-offset: var(--focus-offset); }
  .svc-card__link:focus-visible { outline: none; }
}

/* Hover: the card eases toward the visitor - lift, a 1% scale and a softer, deeper shadow; no outline.
   Fine pointers only, so touch screens never keep a stuck hover. */
@media (hover: hover) and (pointer: fine) {
  .svc-card:hover { transform: translateY(-4px) scale(1.01); }
  .svc-card:hover .svc-card__frame { box-shadow: var(--sh-card-hover); }
}
/* Press: settle back, no bounce or scale */
.svc-card:active { transform: none; }
.svc-card:active .svc-card__frame { box-shadow: var(--sh-card); }

@media (prefers-reduced-motion: reduce) {
  .svc-card, .svc-card__frame { transition: none; }
  .svc-card:hover { transform: none; }
}

/* ===== Static tile: a service without its own page (not clickable, visibly different) ===== */
.svc-tile { display: flex; flex-direction: column; justify-content: center; width: 100%; padding: 32px 28px; border: 1px solid var(--c-border); border-radius: var(--r-md); background: var(--c-surface); color: var(--c-text); }
.svc-tile .svc-card__icon { color: var(--c-brand-900); width: 40px; margin-bottom: 16px; }
.svc-tile h3 { margin: 0 0 8px; font-size: 1.25rem; line-height: 1.25; color: var(--c-brand-900); }
.svc-tile p { margin: 0; font-size: 1rem; color: var(--c-text-muted); }

/* ===== Responsive ===== */
@media (max-width: 1099px) { .svc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  .services { padding: 58px 0; }
  .svc-grid { grid-template-columns: 1fr; gap: 20px; }
  /* Option M1: stacked, first four shown, then the existing "Show more services" button */
  .svc-grid[data-mobile="stack"]:not(.is-expanded) > li:nth-child(n + 5) { display: none; }
  /* Option M2: one swipe row with the next card peeking in */
  .svc-grid[data-mobile="swipe"] { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 80%; overflow-x: auto; scroll-snap-type: x mandatory; padding: 8px 4vw 18px; margin-left: -4vw; margin-right: -4vw; scroll-padding-left: 4vw; gap: 16px; }
  .svc-grid[data-mobile="swipe"] > li { scroll-snap-align: start; }
}
.show-more { display: none; }
@media (max-width: 560px) {
  .svc-grid[data-mobile="stack"] + .show-more { display: flex; margin: 22px auto 0; padding: 12px 18px; min-height: 44px; border-radius: 999px; border: 1px solid rgba(15, 23, 42, 0.16); background: var(--c-surface); color: var(--c-text); font: 700 1rem Arial, sans-serif; }
}
/* The existing "Need Appliance Repair Today?" call button (id services-call-button) stays below the grid */
.svc-grid ~ #services-call-button { margin-top: 40px; }


/* ===== Brand carousel (v5) ===== */
:root {
  --c-on-dark-muted: rgba(255, 255, 255, 0.82);
  --c-on-dark-subtle: rgba(255, 255, 255, 0.62);
  --c-on-dark-line: rgba(255, 255, 255, 0.14);
  --track-bg: #ffffff;                 /* the one light track */
  --slot-h: 96px;                      /* stable slot height (track height) */
  --brand-logo-h: 40px;                      /* logo box height; per-brand optical tweak via data "scale" */
  --brand-logo-max-w: 176px;                 /* wide wordmarks are contained, never stretched */
  --slot-pad: 30px;                    /* space either side of each logo */
}
.brands { background: var(--c-brand-900); color: var(--c-on-dark); padding: 84px 0 72px; overflow: hidden; }
.brands__eyebrow { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 0 0 14px; font-size: 0.82rem; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--c-on-dark-muted); }
.brands__eyebrow::before, .brands__eyebrow::after { content: ""; width: 44px; height: 2px; background: var(--c-accent-500); }
.brands h2 { margin: 0 0 14px; text-align: center; font-size: clamp(1.9rem, 3.4vw, 3rem); line-height: 1.15; letter-spacing: -0.03em; font-weight: 700; color: var(--c-on-dark); }
.brands__lead { max-width: 760px; margin: 0 auto; text-align: center; font-size: 1.12rem; color: var(--c-on-dark-muted); }
.brands__note { margin: 26px 0 0; text-align: center; font-size: 0.82rem; color: var(--c-on-dark-subtle); }

/* One unified light track */
.brand-track { --marquee-duration: 140s; position: relative; margin-top: 40px; }
.brand-track__viewport { overflow: hidden; border-radius: 16px; background: var(--track-bg); }
.brand-track__rail { display: flex; width: max-content; }
.brand-track__set { display: flex; align-items: center; margin: 0; padding: 0; list-style: none; }
.brand-track__set > li { flex: none; }

/* Logo slot: stable height, flexible width from the logo's own aspect ratio */
.logo-slot { display: flex; align-items: center; justify-content: center; height: var(--slot-h); padding: 0 var(--slot-pad); color: inherit; text-decoration: none; }
.logo-slot img { display: block; height: calc(var(--brand-logo-h) * var(--logo-scale, 1)); width: auto; max-width: var(--brand-logo-max-w); object-fit: contain; }
/* Real logos: width set per brand (CSS display only), height from the file's aspect ratio; never stretched, filtered or cropped */
.logo-slot img[style*="--dw"] { width: calc(var(--dw) * var(--logo-size, 1) * 1px); height: auto; max-width: none; }
/* Optional optical offset for logos whose file centres the artwork off its visual centre (display only) */
.logo-slot img[style*="--dy"] { transform: translateY(calc(var(--dy) * var(--logo-size, 1) * 1px)); }

/* Without JavaScript the logos wrap inside the track: see the <noscript> style in index.php */

/* FUTURE (inactive until links exist): only a.logo-slot gets the approved Service Card hover */
a.logo-slot { border-radius: 12px; transition: transform var(--dur-card) var(--ease-standard), box-shadow var(--dur-card) var(--ease-standard); }
@media (hover: hover) and (pointer: fine) {
  a.logo-slot:hover { transform: translateY(-4px) scale(1.01); box-shadow: 0 14px 30px rgba(22, 40, 66, 0.14); }
}
a.logo-slot:focus-visible { outline: 3px solid var(--c-brand-900); outline-offset: -6px; }
@media (prefers-reduced-motion: reduce) { a.logo-slot { transition: none; } a.logo-slot:hover { transform: none; } }

/* Pause / Play */
.brand-track__controls { display: flex; justify-content: flex-end; margin-top: 12px; }
.brand-track__toggle { display: none; align-items: center; gap: 8px; min-height: 32px; padding: 4px 12px; border: 1px solid var(--c-on-dark-line); border-radius: 999px; background: transparent; color: var(--c-on-dark-subtle); font: 600 0.8rem Arial, sans-serif; cursor: pointer; }
.brand-track__toggle:hover { color: var(--c-on-dark); border-color: var(--c-on-dark-subtle); }
.brand-track__toggle:focus-visible { outline: 3px solid var(--c-on-dark); outline-offset: 2px; }
.brand-track__toggle svg { width: 12px; height: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Desktop, fine pointer, motion allowed: continuous marquee */
@media (min-width: 768px) and (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .brand-track.is-ready .brand-track__rail { animation: brand-marquee var(--marquee-duration) linear infinite; }
  /* Temporary pauses only while the pointer or keyboard focus is on the logo track itself (not on the Pause/Play control);
     .is-paused is the visitor's explicit choice and is never overridden by hover or focus */
  .brand-track__viewport:hover .brand-track__rail, .brand-track__viewport:focus-within .brand-track__rail,
  .brand-track.is-paused .brand-track__rail, .brand-track.is-offscreen .brand-track__rail { animation-play-state: paused; }
  .brand-track.is-ready .brand-track__toggle { display: inline-flex; }
}
@keyframes brand-marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media not all and (min-width: 768px) and (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .brand-track__set[aria-hidden="true"] { display: none; }
}
/* Reduced motion (desktop): every logo visible, wrapping inside the same track */
@media (min-width: 768px) and (hover: hover) and (pointer: fine) and (prefers-reduced-motion: reduce) {
  .brand-track__rail { width: auto; }
  .brand-track__set { flex-wrap: wrap; justify-content: center; padding: 8px 0; }
  .logo-slot { height: 80px; }
}
/* Touch / narrow: native horizontal scroll, next logo position peeks in */
@media (max-width: 767px), (hover: none), (pointer: coarse) {
  .brands { padding: 60px 0 54px; }
  .brand-track { --slot-h: 80px; --brand-logo-h: 34px; --brand-logo-max-w: 150px; --slot-pad: 22px; --logo-size: 0.78; margin-top: 28px; }
  .brand-track__viewport { overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: none; }
  .brand-track__viewport::-webkit-scrollbar { display: none; }
  .brand-track__set > li { scroll-snap-align: start; }
}

/* Homepage structure (D3, approved): hero coverage line, areas, trust strip, policy figures, About, case section. */
/* One vertical rhythm for every content section. */
.home-main .section { padding: 72px 0; }

/* 1. Hero: the text block and the banner read as one unit. */
.home-main .hero-sales { padding: 60px 0 44px; }
.home-main .hero-sales .hero-actions { margin-top: 24px; }
.home-coverage { margin: 18px auto 0; max-width: 760px; font-size: 0.96rem; font-weight: 600; color: var(--muted); }
.home-coverage a { color: var(--navy); text-decoration: underline; text-underline-offset: 3px; }

/* Shared editorial split: heading column left, content right. */
.home-split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 64px; align-items: start; }
.home-split h2 { font-size: clamp(1.75rem, 2.7vw, 2.45rem); margin-bottom: 16px; }
.home-text { margin: 0 0 14px; font-size: 1.06rem; color: var(--muted); }
.home-split .area-call-note { margin-top: 18px; }

/* 3. Service areas: a calm two-column list instead of 16 shadowed cards; all names visible. */
.home-areas__list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 28px; margin: 6px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.home-areas__list li { display: flex; align-items: center; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--line); font-weight: 700; color: var(--navy); }
.home-areas__list li::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.home-areas__list li.is-more { color: var(--muted); font-weight: 600; }
.home-areas__list li.is-more::before { background: var(--line); }

/* 4. Compact trust strip: three facts, hairline dividers, no cards. */
.home-trust { background: var(--soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 34px 0; }
.home-trust__list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; }
.home-trust__list li { display: flex; gap: 14px; align-items: flex-start; padding: 2px 30px; }
.home-trust__list li + li { border-left: 1px solid var(--line); }
.home-trust__list li:first-child { padding-left: 0; }
.home-trust__list svg { flex: none; width: 26px; height: 26px; margin-top: 2px; color: var(--navy); }
.home-trust__title { margin: 0; font-weight: 800; color: var(--navy); line-height: 1.35; }
.home-trust__text { margin: 2px 0 0; font-size: 0.94rem; color: var(--muted); line-height: 1.45; }

/* 6. Policy: the $100 fee and the 90-day warranty as two key figures, the estimate as one row below. */
.home-policy__keys { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.home-policy__key { padding: 22px 22px 20px; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.home-policy__figure { margin: 0 0 4px; font-size: clamp(2rem, 3vw, 2.5rem); font-weight: 800; line-height: 1.1; letter-spacing: -0.03em; color: var(--navy); }
.home-policy__key h3 { margin: 0 0 8px; font-size: 1.05rem; }
.home-policy__key p:last-child { margin: 0; color: var(--muted); font-size: 0.97rem; }
.home-policy__list { margin: 4px 0 0; border-top: 1px solid var(--line); }
.home-policy__list > div { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 24px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.home-policy__list dt { font-weight: 800; color: var(--navy); }
.home-policy__list dd { margin: 0; color: var(--muted); }
.home-policy__note { margin: 16px 0 0; font-size: 0.92rem; color: var(--muted); }
.home-policy__note a { color: var(--navy); text-decoration: underline; text-underline-offset: 3px; }

/* 7. Problems: the offer box keeps its two CTAs (and ids) without the repeated heading and fee text. */
.home-main .problems .eyebrow, .home-main .problems h2 { text-align: center; }
.home-main .problems .lead { text-align: center; }
.home-main .problems a.problem-item { border: 1px solid var(--line); box-shadow: none; }
.home-main .problems .mobile-show-more-btn { margin-left: auto; margin-right: auto; }
.home-problems-cta { margin-top: 30px; text-align: center; }
.home-problems-cta p { margin: 0; font-weight: 700; color: var(--navy); }
.home-problems-cta .actions { justify-content: center; margin-top: 16px; }

/* 9. About: no stock image; heading left, two short paragraphs and the existing Call Now button right. */
.home-about .home-text { color: var(--text); font-size: 1.08rem; }
.home-about .btn { margin-top: 8px; }

/* 10. Real Repair Cases reuse the service-page Repair Cases block (repair-cases.css). */
.home-main .rc-service-cases .eyebrow, .home-main .rc-service-cases h2 { text-align: center; }

@media (max-width: 900px) {
  .home-split { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .home-trust__list { grid-template-columns: minmax(0, 1fr); }
  .home-trust__list li, .home-trust__list li:first-child { padding: 13px 0; }
  .home-trust__list li + li { border-left: 0; border-top: 1px solid var(--line); }
}

@media (max-width: 700px) {
  .home-main .section { padding: 48px 0; }
  .home-main .hero-sales { padding: 36px 0 30px; }
  .home-coverage { font-size: 0.9rem; }
  .home-coverage__cities { display: none; }
  .home-main .problems .mobile-show-more-btn { display: flex !important; width: fit-content; }
  .home-areas__list { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; }
  .home-areas__list li { padding: 11px 0; font-size: 0.95rem; }
  /* First eight (priority) cities visible; the rest stay in the HTML behind "View All Service Areas". */
  .home-areas__list.mobile-collapsible > li:nth-child(n + 5) { display: flex; }
  .home-areas__list.mobile-collapsible:not(.is-expanded) > li:nth-child(n + 9) { display: none; }
  .home-areas .mobile-show-more-btn { margin: 18px 0 0; }
  .home-policy__keys { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .home-policy__key { padding: 18px 18px 16px; }
  .home-problems-cta .actions .btn { width: 100%; }
  .home-trust { padding: 12px 0; }
  .home-trust__list svg { width: 22px; height: 22px; }
  .home-trust__text { font-size: 0.9rem; }
  .home-policy__list > div { grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 15px 0; }
}
