/* =========================
   THEME TWEAKS
========================= */

/* Header padding with responsive clamp */
.site-header {
    padding-inline: clamp(1rem, 0.848rem + 0.758vw, 1.5rem);
}

/* Typography wrapping */
/* Balance headings and elements with `.balance` class */
:is(h1, h2, h3, h4, h5, h6),
.balance {
    text-wrap: balance;
}

/* Use pretty wrapping for body text elements */
p,
blockquote,
li {
    text-wrap: pretty;
}

/* Remove bottom margin from final paragraph */
p:last-child:last-of-type {
    margin-bottom: 0px;
}


/* =========================
   UTILITIES
========================= */

/* Line Clamping */
.line-limit-3,
.line-limit-2 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-limit-3 {
    -webkit-line-clamp: 3;
}

.line-limit-2 {
    -webkit-line-clamp: 2;
}

/* Visually Hidden (accessible to screen readers) */
.visually-hidden:not(:focus):not(:active) {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

/* Smooth Transition Utility */
.transition {
    transition: all 0.25s ease-in-out;
}


/* =========================
   GP MENU ACCESSIBILITY TWEAKS
========================= */

#site-navigation ul.sub-menu {
    display: block;
}

#site-navigation li:hover .gp-icon svg {
    transform: rotate(180deg);
}

#site-navigation li:hover .sub-menu {
    visibility: visible;
}


/* =========================
   STRETCH LINK (from Bootstrap)
   Source: https://youtu.be/HBriBrnRlQE?si=DLiSXEiBHt6lw91l
   Note: Only use ONE link per card or this breaks!
========================= */

.stretch-link {
    position: relative;
}

.stretch-link a::after {
    content: '';
    position: absolute;
    inset: 0;
}

.stretch-link a:is(:focus-visible)::after {
    outline: 2px solid;
}

.stretch-link a:is(:hover, :focus) {
    outline: none;
}


/* =========================
   CONTAINER WRAPPER
========================= */

.site-wrapper {
    width: 100%;
    max-width: 1920px;
    margin-inline: auto;
    background: var(--neutral-50);
}

/* =========================
   GENERATEPRESS OVERRIDES
========================= */

/* Remove padding from GeneratePress content containers */
.inside-article {
    padding: 0 !important;
}

/* Ensure full-width sections break out properly */
.full-width-section {
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;
    width: 100vw !important;
}

/* Fix body/html background to prevent top white space */
body, html {
    margin: 0 !important;
    padding: 0 !important;
    background-color: hsl(var(--background)) !important;
}

/* Ensure main content area has no unwanted padding or margin */
.site-main,
main#main {
    padding: 0 !important;
    margin: 0 !important;
}

/* Fix GeneratePress container constraints */
.container {
    max-width: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* =========================
   WPFORMS STYLING
========================= */

/* Style WPForms submit button to match theme */
.wpforms-submit,
input[type="submit"].wpforms-submit,
button.wpforms-submit {
    background-color: hsl(var(--accent)) !important;
    color: hsl(var(--accent-foreground)) !important;
    border: none !important;
    border-radius: var(--radius) !important;
    padding: 0.75rem 2rem !important;
    font-weight: 600 !important;
    font-size: 1rem !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
}

.wpforms-submit:hover,
input[type="submit"].wpforms-submit:hover,
button.wpforms-submit:hover {
    background-color: hsl(var(--accent)/0.9) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
}

.wpforms-submit:focus,
input[type="submit"].wpforms-submit:focus,
button.wpforms-submit:focus {
    outline: none !important;
    box-shadow: 0 0 0 2px hsl(var(--accent)/.2) !important;
}

/* Style WPForms form fields to match theme */
.wpforms-field input[type="email"],
.wpforms-field input[type="tel"],
.wpforms-field input[type="text"],
.wpforms-field textarea {
    background-color: hsl(var(--secondary)) !important;
    border: 1px solid hsl(var(--border)) !important;
    border-radius: var(--radius) !important;
    color: hsl(var(--foreground)) !important;
    padding: 0.75rem !important;
    font-size: 0.875rem !important;
    transition: border-color 0.2s ease !important;
}

.wpforms-field input[type="email"]:focus,
.wpforms-field input[type="tel"]:focus,
.wpforms-field input[type="text"]:focus,
.wpforms-field textarea:focus {
    outline: none !important;
    border-color: hsl(var(--accent)) !important;
    box-shadow: 0 0 0 2px hsl(var(--accent)/.2) !important;
}

/* Style WPForms labels */
.wpforms-field-label {
    color: hsl(var(--foreground)) !important;
    font-weight: 500 !important;
    font-size: 0.875rem !important;
    margin-bottom: 0.5rem !important;
}

/* =========================
   FOOTER STYLING
========================= */

/* Ensure footer is full-width and has no white space */
footer {
    width: 100vw !important;
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Remove any potential white space above footer */
footer::before {
    display: none !important;
}

/* Ensure footer content is properly contained */
footer .max-w-7xl {
    max-width: 80rem !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* =========================
   IMAGE QUALITY IMPROVEMENTS
========================= */

/* Improve image quality for carousel cards */
.projects-carousel img {
    image-rendering: -webkit-optimize-contrast !important;
    image-rendering: auto !important;
    image-rendering: high-quality !important;
    -ms-interpolation-mode: bicubic !important;
    -webkit-backface-visibility: hidden !important;
    backface-visibility: hidden !important;
    -webkit-transform: translateZ(0) !important;
    transform: translateZ(0) !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    filter: contrast(1.1) brightness(1.02) !important;
}

/* Ensure smooth scaling on hover */
.projects-carousel img.group-hover\:scale-105 {
    transition: transform 0.5s ease-out;
    will-change: transform;
}

/* High DPI display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .projects-carousel img {
        image-rendering: -webkit-optimize-contrast !important;
        image-rendering: auto !important;
        image-rendering: high-quality !important;
        -ms-interpolation-mode: bicubic !important;
    }
}

/* Force crisp rendering on all devices */
.projects-carousel {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Prevent image compression artifacts */
.projects-carousel img {
    image-rendering: -webkit-optimize-contrast !important;
    image-rendering: auto !important;
    image-rendering: high-quality !important;
    -ms-interpolation-mode: bicubic !important;
    -webkit-backface-visibility: hidden !important;
    backface-visibility: hidden !important;
    -webkit-transform: translateZ(0) !important;
    transform: translateZ(0) !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    filter: contrast(1.1) brightness(1.02) !important;
    will-change: transform !important;
}
