/* ============================================================
   Why Choose Premium Homes Group — cream band, white feature cards
   with a green hover state. Shortcode: [premiumhomes_why_choose]

   Colours are driven by CSS custom properties set inline by the
   shortcode (Site Settings → Why Choose), so they track the brand
   palette and can be overridden per slot:
     --ph-why-bg       band background
     --ph-why-heading  heading + card titles (resting)
     --ph-why-text     card body text (resting — black on white cards)
     --ph-why-icon     icon colour (resting)

   Hover colours reuse the Kadence global palette directly (with hex
   fallbacks) so the green card / cream text / visible icon follow the
   Customizer palette automatically.
     --global-palette1  brand dark green  (card hover bg + hover icon)
     --global-palette7  cream             (hover text + icon disc)
   ============================================================ */

.ph-why {
    background: var(--ph-why-bg, #f3ecdd);
    color: var(--ph-why-text, #1c1c1c);
    padding: 72px 24px;
    /* Full-bleed band regardless of the parent container width. */
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    width: auto;
}

/* Absorb-whitespace toggles — pull the band up/down so it butts
   against the neighbouring section instead of leaving the parent
   container's padding visible as a gap. */
.ph-why--absorb-top {
    margin-top: -56px;
}
.ph-why--absorb-bottom {
    margin-bottom: -56px;
}

@media (min-width: 768px) {
    .ph-why--absorb-top    { margin-top: -80px; }
    .ph-why--absorb-bottom { margin-bottom: -80px; }
}

.ph-why__inner {
    max-width: 1200px;
    margin: 0 auto;
}

.ph-why__header {
    text-align: center;
    max-width: 820px;
    margin: 0 auto 48px;
}

.ph-why__heading {
    margin: 0;
    font-size: clamp(28px, 3.4vw, 42px);
    font-weight: 700;
    color: var(--ph-why-heading, #1f241c);
    letter-spacing: 0.01em;
    line-height: 1.15;
}

/* Blinking caret shown while the heading is being typed. The JS adds
   .is-typing during animation and removes it when the last phrase has
   finished, so a single-phrase heading ends up static and caret-free. */
.ph-why__heading--animate.is-typing .ph-why__heading-text::after {
    content: "";
    display: inline-block;
    width: 2px;
    height: 1em;
    margin-left: 2px;
    transform: translateY(0.12em);
    background: currentColor;
    animation: ph-why-caret 1s step-end infinite;
}

@keyframes ph-why-caret {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0; }
}

.ph-why__intro {
    margin: 18px auto 0;
    font-size: 16px;
    line-height: 1.6;
    color: var(--ph-why-text, #1c1c1c);
    max-width: 680px;
}

.ph-why__grid {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
}

@media (min-width: 640px) {
    .ph-why__grid--cols-2,
    .ph-why__grid--cols-3,
    .ph-why__grid--cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .ph-why__grid--cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    .ph-why__grid--cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ---- White feature card ---- */
.ph-why__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 34px 24px;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: background-color 0.28s ease, box-shadow 0.28s ease, transform 0.28s ease;
}

.ph-why__item:hover,
.ph-why__item:focus-within {
    /* Card fills with the brand green on hover. */
    background: var(--global-palette1, #2f3a2a);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
    transform: translateY(-4px);
}

/* ---- Icon disc ---- */
.ph-why__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: var(--global-palette9, #efe7d6); /* soft cream disc */
    color: var(--ph-why-icon, #c4853a);           /* gold icon (resting) */
    margin-bottom: 18px;
    transition: background-color 0.28s ease, color 0.28s ease;
}

/* On hover the disc stays light and the icon turns brand-green, so it
   ADOPTS THE THEME and stays visible instead of vanishing. */
.ph-why__item:hover .ph-why__icon,
.ph-why__item:focus-within .ph-why__icon {
    background: var(--global-palette7, #f6f1e7);
    color: var(--global-palette1, #2f3a2a);
}

.ph-why__icon svg {
    width: 28px;
    height: 28px;
    display: block;
}

/* ---- Card text ---- */
.ph-why__item-title {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 700;
    color: var(--ph-why-heading, #1f241c); /* near-black on white card */
    line-height: 1.3;
    transition: color 0.28s ease;
}

.ph-why__item-body {
    margin: 0;
    font-size: 14px;
    line-height: 1.65;
    color: var(--ph-why-text, #1c1c1c); /* black on white card (resting) */
    transition: color 0.28s ease;
}

/* Hover: white card → green, so the text switches to cream to stay
   readable (this is the "existing colour" from the live section). */
.ph-why__item:hover .ph-why__item-title,
.ph-why__item:focus-within .ph-why__item-title,
.ph-why__item:hover .ph-why__item-body,
.ph-why__item:focus-within .ph-why__item-body {
    color: var(--global-palette7, #f3ecdd);
}

/* Respect users who prefer less motion — keep the colour swap, drop
   the lift/transition. */
@media (prefers-reduced-motion: reduce) {
    .ph-why__item,
    .ph-why__icon,
    .ph-why__item-title,
    .ph-why__item-body {
        transition: none;
    }
    .ph-why__item:hover,
    .ph-why__item:focus-within {
        transform: none;
    }
}
