/* ============================================================
   PPC Gems — Homepage redesign styles
   File: css/home.css  (loaded on the homepage only, after style.css)
   Editorial scroll story: channel hero, photo plates, sticky "Why" story.
   ============================================================ */

html { scroll-padding-top: 5rem; }
.hero { isolation: isolate; }

/* ---------- Hero: channel card ---------- */
.hero-right { position: relative; isolation: isolate; justify-content: center; }
.hero-right::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 8% 2% 7% 4%;
  border-radius: 48% 52% 44% 56%;
  background:
    radial-gradient(ellipse at 60% 38%, rgba(190,30,45,.085), transparent 57%),
    radial-gradient(ellipse at 48% 68%, rgba(109,132,116,.11), transparent 62%);
  filter: blur(3px);
  transform: rotate(-5deg);
}

.hero-photo-card {
  position: relative;
  display: block;
  width: min(100%, 680px);
  margin: 0 auto;
  overflow: hidden;
  aspect-ratio: 1.12 / 1;
  border: 1px solid rgba(28,28,26,.08);
  border-radius: 10px;
  background: #eee8de;
  box-shadow: 0 32px 90px rgba(28,28,26,.16);
}
.hero-photo-card::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(255,255,255,.5);
  pointer-events: none;
}
.channel-art {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 24%, #fffdf8 0%, #f4efe6 59%, #e8e0d5 100%);
}
.channel-links { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.channel-links path { fill: none; stroke: #bbae9d; stroke-width: 1.1; stroke-dasharray: 3 7; opacity: .8; }

.channel-screen {
  position: absolute;
  z-index: 1;
  left: 22%; top: 7%;
  width: 56%; height: 49%;
  padding: 0 0 13px;
  border: 1px solid #d9d0c3;
  border-radius: 15px;
  background: linear-gradient(145deg, #fffdf9, #f5f0e7);
  box-shadow: 0 18px 42px #47382820;
  transform: perspective(900px) rotateX(2deg);
}
.channel-screen__chrome {
  height: 29px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  border-radius: 15px 15px 0 0;
  background: #eee8de;
}
.channel-screen__chrome i { width: 5px; height: 5px; border-radius: 50%; background: #c2b8aa; }
.channel-screen__chrome i:first-child { background: #be1e2d; }
.channel-screen__chrome span { height: 5px; width: 30%; margin-left: auto; border-radius: 4px; background: #d6cdbf; }
.channel-screen__body { padding: 20px 18px; }
.channel-screen__metric { display: grid; gap: 7px; margin-bottom: 18px; }
.channel-screen__metric b { height: 9px; width: 44%; border-radius: 5px; background: #686a61; }
.channel-screen__metric i { height: 5px; width: 26%; border-radius: 4px; background: #cfc6b9; }
.channel-screen__chart {
  height: 83px;
  border-bottom: 1px solid #e3ddd3;
  background: repeating-linear-gradient(to bottom, transparent 0 20px, #e8e2d9 21px);
}
.channel-screen__chart svg { width: 100%; height: 100%; overflow: visible; }
.channel-screen__chart path { fill: none; stroke: #be1e2d; stroke-width: 3; stroke-linecap: round; }
.channel-screen__base {
  position: absolute;
  bottom: -13px; left: -4%;
  width: 108%; height: 13px;
  border-radius: 0 0 8px 8px;
  background: linear-gradient(#d4cabc, #bfb3a2);
  clip-path: polygon(4% 0, 96% 0, 100% 100%, 0 100%);
}

/* Logo cards are links to each service page */
.channel-logo-grid {
  position: absolute;
  z-index: 2;
  left: 8%; right: 8%; bottom: 10%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.channel-logo-card {
  height: 74px;
  min-width: 0;
  display: grid;
  place-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(205,194,179,.65);
  border-radius: 9px;
  background: rgba(255,253,249,.95);
  box-shadow: 0 8px 20px rgba(46,38,28,.08);
  text-decoration: none;
  transition: transform .35s cubic-bezier(.2,.7,.2,1), box-shadow .35s ease, border-color .35s ease;
}
.channel-logo-card--microsoft { overflow: hidden; }
.channel-logo-card:hover,
.channel-logo-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 12px 26px rgba(46,38,28,.12);
  border-color: rgba(190,30,45,.35);
}
.channel-logo-card img {
  display: block;
  width: 100%;
  height: 54px;
  max-width: 100%;
  object-fit: contain;
  object-position: center;
  mix-blend-mode: multiply;
}
.channel-logo-card--microsoft img { max-width: none; transform: scale(1.65); transform-origin: center; }
/* Text fallback when a logo file has not been uploaded yet */
.channel-logo-name {
  font: 600 .82rem/1.2 var(--font-sans, 'Outfit', sans-serif);
  color: var(--charcoal);
  text-align: center;
  letter-spacing: -.01em;
}

/* ---------- Scroll progress bar ---------- */
body::after {
  content: "";
  position: fixed;
  z-index: 9999;
  left: 0; top: 0;
  width: 100%; height: 3px;
  background: linear-gradient(90deg, var(--red), #d8a07e);
  transform: scaleX(var(--scroll-progress, 0));
  transform-origin: left;
  pointer-events: none;
}

/* ---------- Story photo plates ---------- */
.story-photo {
  position: relative;
  overflow: hidden;
  margin: clamp(2.5rem, 6vw, 5rem) auto;
  width: min(100%, 1160px);
  height: clamp(270px, 46vw, 590px);
  border-radius: 8px;
  background: #e9e4db;
  isolation: isolate;
  box-shadow: 0 32px 90px rgba(28,28,26,.14);
}
.story-photo img {
  display: block;
  width: 100%;
  height: 120%;
  position: absolute;
  top: -10%; left: 0;
  object-fit: cover;
  transform: scale(1.025) translate3d(0, var(--photo-y, 0px), 0);
}
/* The clip-in reveal only applies once JS is running, so photos never stay hidden */
.scroll-motion-ready .story-photo:not(.story-photo--why) {
  clip-path: inset(8% 7% 8% 7% round 10px);
  transition: clip-path 1.15s cubic-bezier(.2,.75,.2,1), box-shadow .8s ease;
}
.scroll-motion-ready .story-photo:not(.story-photo--why) img {
  transform: scale(1.15) translate3d(0, var(--photo-y, 0px), 0);
  transition: transform 1.3s cubic-bezier(.2,.75,.2,1), filter .8s ease;
  filter: saturate(.84);
}
.scroll-motion-ready .story-photo.is-visible:not(.story-photo--why) {
  clip-path: inset(0 round 8px);
  box-shadow: 0 32px 90px rgba(28,28,26,.17);
}
.scroll-motion-ready .story-photo.is-visible:not(.story-photo--why) img {
  transform: scale(1.025) translate3d(0, var(--photo-y, 0px), 0);
  filter: saturate(1);
}
.story-photo__frame {
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(255,255,255,.52);
  z-index: 2;
  pointer-events: none;
}

.story-photo--services   { height: clamp(240px, 38vw, 470px); }
.story-photo--industries { height: clamp(240px, 34vw, 440px); }
.story-photo--reviews    { width: min(100%, 1000px); height: clamp(230px, 28vw, 360px); }
.story-photo--contact    { width: 100%; height: clamp(210px, 25vw, 330px); margin: 0 0 1.75rem; }

/* ---------- "Why PPC Gems": sticky photo + scrolling cards ---------- */
#why .why-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(300px, .92fr);
  align-items: start;
  gap: clamp(2.5rem, 6vw, 6.5rem);
}
.story-photo--why {
  position: sticky;
  top: calc(var(--nav-h) + 28px);
  grid-column: 1;
  grid-row: 1 / span 6;
  height: min(67vh, 650px);
  min-height: 420px;
  margin: 0;
  clip-path: inset(0 round 8px);
}
.story-photo--why img {
  transform: scale(var(--story-scale, 1.12)) translate3d(var(--story-pan, 0px), var(--story-y, 0px), 0);
  transition: transform .85s cubic-bezier(.2,.75,.25,1), filter .75s ease;
}
#why .why-card {
  grid-column: 2;
  align-self: start;
  margin: 0 0 clamp(4rem, 11vh, 8rem);
  padding: clamp(1.25rem, 2.4vw, 2rem);
  border-left: 1px solid rgba(28,28,26,.13);
  transition: opacity .55s ease, border-color .55s ease, background .55s ease,
              transform .7s cubic-bezier(.2,.7,.2,1), box-shadow .55s ease;
}
/* Dim inactive cards only when the scroll script is running (full opacity without JS) */
.scroll-motion-ready #why .why-card { opacity: .56; }
.scroll-motion-ready #why .why-card.is-story-active {
  opacity: 1;
  transform: translateX(8px);
  border-left: 3px solid var(--red);
  background: rgba(253,252,249,.75);
  box-shadow: 0 18px 42px rgba(28,28,26,.06);
}

/* ---------- Entrance + hover motion ---------- */
.hero-left > * { animation: home-copy-arrive .72s cubic-bezier(.2,.75,.25,1) both; }
.hero-left > *:nth-child(2) { animation-delay: .08s; }
.hero-left > *:nth-child(3) { animation-delay: .16s; }
.hero-left .btn-group { animation-delay: .24s; }
.hero-stats { animation: home-copy-arrive .7s .32s both; }

.service-row, .why-card, .svc-card, .review-card, .cta-band {
  transition: transform .4s cubic-bezier(.2,.7,.2,1), box-shadow .4s ease, border-color .3s ease;
}
.service-row:hover, .why-card:hover, .svc-card:hover, .review-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 34px rgba(28,28,26,.075);
  border-color: rgba(190,30,45,.24);
}
.btn { transition: transform .22s ease, box-shadow .22s ease, background-color .22s ease; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(28,28,26,.13); }

.scroll-motion-ready .scroll-reveal {
  opacity: 0;
  transform: translateY(26px);
  filter: blur(3px);
  transition: opacity .75s ease, transform .8s cubic-bezier(.2,.7,.2,1), filter .8s ease;
  transition-delay: var(--reveal-delay, 0ms);
}
.scroll-motion-ready .scroll-reveal.is-visible { opacity: 1; transform: none; filter: none; }

@keyframes home-copy-arrive {
  from { opacity: 0; transform: translateY(15px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  body::after { display: none; }
  .scroll-motion-ready .scroll-reveal { opacity: 1; transform: none; filter: none; }
  .story-photo--why { position: relative; top: auto; height: 430px; }
  .scroll-motion-ready #why .why-card { opacity: 1; }
}

/* ---------- Mobile ---------- */
@media (max-width: 820px) {
  #why .why-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .story-photo--why {
    position: sticky;
    top: calc(var(--nav-h) + 8px);
    grid-column: 1;
    grid-row: 1;
    z-index: 2;
    height: min(47vh, 440px);
    min-height: 280px;
    margin-bottom: 1rem;
  }
  #why .why-card { grid-column: 1; margin-bottom: 1.5rem; padding: 1.1rem; background: rgba(253,252,249,.87); }
  .story-photo--contact { margin-top: 1rem; }
  .channel-screen { left: 15%; width: 70%; height: 43%; top: 6%; }
  .channel-screen__body { padding: 10px; }
  .channel-screen__chart { height: 55px; }
  .channel-logo-grid { left: 5%; right: 5%; bottom: 7%; gap: 6px; }
  .channel-logo-card { height: 58px; padding: 6px; }
  .channel-logo-card img { height: 44px; }
  .channel-logo-card--microsoft img { transform: scale(1.55); }
  .channel-logo-name { font-size: .7rem; }
}
