/**
 * HVCC Theme - Main Stylesheet
 *
 * Custom styles that complement theme.json settings.
 * Most styling is handled via theme.json; this file covers
 * edge cases, animations, and component-specific styles.
 *
 * @package HVCC_Theme
 */

/* ========================================
   Base / Reset
   ======================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

/*
 * Remove all default block margins.
 *
 * WordPress core (block-library/style.css) applies margin-block-start to
 * headings, paragraphs, lists, and other elements inside block layouts.
 * Zero these out globally so spacing is controlled entirely through
 * explicit padding/margin in block attributes and theme.json blockGap.
 */
.wp-block-group > *,
.wp-block-column > *,
.wp-block-columns > *,
.wp-block-cover__inner-container > *,
.entry-content > * {
    margin-block-start: 0;
    margin-block-end: 0;
}

h1, h2, h3, h4, h5, h6,
p, ul, ol, figure, blockquote, pre {
    margin-block-start: 0;
    margin-block-end: 0;
}

img {
    max-width: 100%;
    height: auto;
}

/*
 * Consistent 50px vertical padding on all top-level blocks.
 *
 * Every direct child of <main> (patterns, groups, covers) and
 * post-content containers gets uniform vertical rhythm.
 * Inline padding-top/bottom set in block attributes will be
 * overridden to enforce consistency.
 *
 * Exception: .hvcc-how-it-works uses 110px/100px to give the
 * floating cards generous breathing room over the background.
 */
main > .wp-block-group,
main > .wp-block-cover,
main > .wp-block-columns,
main > .wp-block-query,
#main-content > .wp-block-group,
#main-content > .wp-block-cover,
#main-content > .wp-block-columns,
#main-content > .wp-block-query {
    padding-top: 50px !important;
    padding-bottom: 50px !important;
}

#main-content > .hvcc-how-it-works {
    padding-top: 110px !important;
    padding-bottom: 100px !important;
}

/* ========================================
   Header
   ======================================== */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    transition: box-shadow 0.3s ease;
}

.site-header.is-scrolled {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.hvcc-logo {
    display: flex;
    line-height: 0;
}

.hvcc-logo img {
    display: block;
    width: 70px;
    height: auto;
}

/*
 * Header nav & button color overrides.
 *
 * WordPress core applies `!important` on color utility classes
 * (see wp-includes/css/dist/block-library/style.css). When a navigation block
 * has textColor set, WP adds color rules with `!important`.
 * Our theme.json link colors alone cannot win that specificity war, so we must
 * counter with `!important` here. This is the standard approach in WP block
 * themes — it is not a code smell, it is a necessary countermeasure.
 */
.site-header .wp-block-navigation a,
.site-header .wp-block-navigation .wp-block-navigation-item__content {
    color: var(--wp--preset--color--white) !important;
}

.site-header .wp-block-navigation a:hover {
    color: var(--wp--preset--color--primary) !important;
}

.site-header .is-style-outline .wp-block-button__link {
    color: var(--wp--preset--color--white) !important;
    border-color: var(--wp--preset--color--white) !important;
}

.site-header .is-style-outline .wp-block-button__link:hover {
    color: var(--wp--preset--color--primary) !important;
    border-color: var(--wp--preset--color--primary) !important;
}

/* ========================================
   Buttons
   ======================================== */

.wp-block-button__link {
    transition: all 0.2s ease;
}

/*
 * Force outline button variants to have transparent backgrounds.
 *
 * WordPress core generates numbered variant classes like
 * is-style-outline--1, is-style-outline--2, etc. and applies
 * background-color: white to them. This makes outline buttons
 * blend into white page backgrounds. Override to transparent
 * UNLESS a specific background color has been set via block attributes
 * (indicated by the .has-background class).
 */
.wp-block-button.is-style-outline .wp-block-button__link:not(.has-background),
.wp-block-button[class*="is-style-outline--"] .wp-block-button__link:not(.has-background) {
    background-color: transparent !important;
}

/*
 * Button text color overrides.
 *
 * Same WP core color utility `!important` issue as above.
 * When a button block sets textColor via block attributes, WP generates
 * `.has-<slug>-color` with an inline or utility color — but core rules
 * (with !important) can override it in certain cascade scenarios.
 * These rules ensure the intended color always wins.
 */
.wp-block-button__link.has-white-color {
    color: var(--wp--preset--color--white) !important;
}

.wp-block-button__link.has-primary-color {
    color: var(--wp--preset--color--primary) !important;
}

.wp-block-button__link.has-dark-color {
    color: var(--wp--preset--color--dark) !important;
}

.wp-block-button__link:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.wp-block-button__link:active {
    box-shadow: none;
}

/* Accent button style */
.is-style-hvcc-accent .wp-block-button__link {
    background-color: var(--wp--preset--color--accent);
    color: var(--wp--preset--color--white);
}

.is-style-hvcc-accent .wp-block-button__link:hover {
    background-color: var(--wp--preset--color--accent-dark);
}

/* Outline buttons on primary (orange) backgrounds: fill white on hover */
.has-primary-background-color .is-style-outline .wp-block-button__link:hover {
    background-color: var(--wp--preset--color--white) !important;
    color: var(--wp--preset--color--primary) !important;
    border-color: var(--wp--preset--color--white) !important;
}

/* Rounded button style — disabled (zero border-radius policy) */
.is-style-hvcc-rounded .wp-block-button__link {
    border-radius: 0;
}

/* ========================================
   Cards
   ======================================== */

.is-style-hvcc-card {
    border-radius: 0;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s ease;
}

.is-style-hvcc-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* ========================================
   How It Works — Step Cards
   ======================================== */

/*
 * BEM-styled step cards for the "How It Works" section.
 * Modeled after Chariti Demo 1's 3-card overlay layout.
 * Cards float over a cover block background image with
 * semi-transparent colored backgrounds (0.87 opacity).
 */

/* Ensure columns stretch cards to equal height */
.wp-block-columns:has(.hvcc-step-card) {
    align-items: stretch;
}

.wp-block-columns:has(.hvcc-step-card) > .wp-block-column {
    display: flex;
    padding: 0 18px;
}

/* Base card */
.hvcc-step-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 55px 25px 35px 25px;
    border-radius: 0;
    border: none;
    box-shadow: none;
}

/* Card color variants */
.hvcc-step-card--dark {
    background-color: rgba(56, 56, 56, 0.87);
}

.hvcc-step-card--primary {
    background-color: rgba(232, 135, 14, 0.87);
}

.hvcc-step-card--accent {
    background-color: rgba(46, 125, 50, 0.87);
}

/* Decorative divider line */
.hvcc-step-card__divider {
    width: 24px;
    height: 3px;
    margin-bottom: 5px;
}

.hvcc-step-card__divider--primary {
    background-color: var(--wp--preset--color--primary);
}

.hvcc-step-card__divider--white {
    background-color: var(--wp--preset--color--white);
}

/* Large step number */
.hvcc-step-card__number {
    font-family: var(--wp--preset--font-family--heading);
    font-size: 57px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--wp--preset--color--white);
    margin-bottom: 10px;
}

/* Step title */
.hvcc-step-card__title {
    font-family: var(--wp--preset--font-family--heading);
    font-size: 26px;
    font-weight: 400;
    line-height: 1.3;
    margin-top: 0;
    margin-bottom: 15px;
}

.hvcc-step-card__title--primary {
    color: var(--wp--preset--color--primary);
}

.hvcc-step-card__title--white {
    color: var(--wp--preset--color--white);
}

/* Step description text */
.hvcc-step-card__text {
    font-family: var(--wp--preset--font-family--body);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.85);
    margin-top: auto;
}

/* FadeInUp animation on scroll */
.hvcc-step-card {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.hvcc-step-card.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger animation for each card */
.wp-block-column:nth-child(2) .hvcc-step-card {
    transition-delay: 0.15s;
}

.wp-block-column:nth-child(3) .hvcc-step-card {
    transition-delay: 0.3s;
}

/* ========================================
   Stat Numbers
   ======================================== */

.is-style-hvcc-stat-number {
    font-family: var(--wp--preset--font-family--heading);
    font-weight: 800;
    line-height: 1;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.is-style-hvcc-stat-number.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/*
 * Count-up animation elements.
 *
 * Elements with [data-count-to] display their final value as static
 * text by default (no-JS fallback). When JS runs, it replaces the
 * text content with an animated count from 0 to the target number.
 * The font-family is inherited from the inline styles on the <p>.
 */
[data-count-to] {
    display: inline-block;
    font-variant-numeric: tabular-nums;
}

/* ========================================
   Footer
   ======================================== */

.site-footer a {
    color: var(--wp--preset--color--off-white);
    text-decoration: none;
    transition: color 0.2s ease;
}

.site-footer a:hover {
    color: var(--wp--preset--color--primary);
}

.site-footer .is-style-no-bullets {
    list-style: none;
    padding-left: 0;
}

.site-footer .is-style-no-bullets li {
    margin-bottom: 0.5rem;
}

/* ========================================
   Cover Block Enhancements
   ======================================== */

.wp-block-cover {
    overflow: hidden;
}

/* ========================================
   Our Story Image
   ======================================== */

.hvcc-story-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Ensure the <picture> wrapper fills the column height */
picture:has(.hvcc-story-image) {
    display: block;
    height: 100%;
}

/* ========================================
   Action-Shot Shortcode Image
   ======================================== */

/*
 * Full-width responsive image rendered via [hvcc_action_shot] shortcode.
 * The <picture> element sits inside a zero-padding full-width group block.
 * Ensure the image stretches edge-to-edge with no gaps.
 */
.wp-block-group > picture {
    display: block;
    line-height: 0;
}

.wp-block-group > picture > img {
    display: block;
    width: 100%;
    height: auto;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 781px) {
    /* Stack header buttons on mobile */
    .site-header .wp-block-buttons {
        display: none;
    }

    /* Reduce stat font size on mobile */
    .is-style-hvcc-stat-number,
    .hvcc-stat-number {
        font-size: 2.5rem !important;
    }

    /* Step cards: stack vertically on mobile */
    .wp-block-columns:has(.hvcc-step-card) > .wp-block-column {
        padding: 0;
        margin-bottom: 20px;
    }

    .wp-block-columns:has(.hvcc-step-card) > .wp-block-column:last-child {
        margin-bottom: 0;
    }

    .hvcc-step-card {
        padding: 40px 20px 30px 20px;
    }

    .hvcc-step-card__number {
        font-size: 42px;
    }

    .hvcc-step-card__title {
        font-size: 22px;
    }

    /* Remove stagger delay on mobile (cards stack, not side by side) */
    .wp-block-column:nth-child(2) .hvcc-step-card,
    .wp-block-column:nth-child(3) .hvcc-step-card {
        transition-delay: 0s;
    }
}

/* ========================================
   Accessibility
   ======================================== */

/* Skip link */
.skip-link {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute;
    height: 1px;
    width: 1px;
    overflow: hidden;
    word-wrap: normal;
}

.skip-link:focus {
    clip: auto;
    display: block;
    font-size: 1rem;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
    background-color: var(--wp--preset--color--white);
    color: var(--wp--preset--color--primary);
}

/* Focus visible */
:focus-visible {
    outline: 2px solid var(--wp--preset--color--primary);
    outline-offset: 2px;
}

/* ========================================
   Impact Stats Icons
   ======================================== */

.hvcc-stat-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    width: 80px;
    height: 80px;
    border: 2px solid var(--wp--preset--color--primary);
    border-radius: 50%;
    color: var(--wp--preset--color--primary);
}

.hvcc-stat-icon svg {
    width: 36px;
    height: 36px;
}

/* ========================================
   WPForms Overrides
   ======================================== */

/*
 * Override WPForms default styling to match theme design system.
 * Zero border-radius on all form elements, primary color for buttons.
 */

.wpforms-container .wpforms-form input[type="text"],
.wpforms-container .wpforms-form input[type="email"],
.wpforms-container .wpforms-form input[type="tel"],
.wpforms-container .wpforms-form input[type="url"],
.wpforms-container .wpforms-form input[type="number"],
.wpforms-container .wpforms-form textarea,
.wpforms-container .wpforms-form select {
    border-radius: 0 !important;
}

.wpforms-container .wpforms-form button[type="submit"],
.wpforms-container .wpforms-form .wpforms-submit {
    border-radius: 0 !important;
    background-color: var(--wp--preset--color--primary) !important;
    color: var(--wp--preset--color--white) !important;
    font-family: var(--wp--preset--font-family--heading);
    font-weight: 600;
    padding: 14px 32px;
    line-height: 1;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.wpforms-container .wpforms-form button[type="submit"]:hover,
.wpforms-container .wpforms-form .wpforms-submit:hover {
    background-color: var(--wp--preset--color--primary-dark) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.wpforms-container .wpforms-form .wpforms-field-label {
    font-family: var(--wp--preset--font-family--heading);
    font-weight: 600;
    color: var(--wp--preset--color--dark);
}

.wpforms-container .wpforms-form .wpforms-field-sublabel {
    font-family: var(--wp--preset--font-family--body);
}

/* ========================================
   Print
   ======================================== */

@media print {
    .site-header,
    .site-footer,
    .wp-block-buttons {
        display: none;
    }
}
