/*
 Theme Name:   Pro Child - Metal America
 Theme URI:    https://metalamerica.com
 Description:  Metal America child theme for Pro theme
 Author:       Metal America
 Author URI:   https://metalamerica.com
 Template:     pro
 Version:      1.0.0
 Text Domain:  pro-child
*/

/* ==========================================================================
   METAL AMERICA - COMPLETE GLOBAL CSS
   ========================================================================== */

/* ==========================================================================
   0. WP ADMIN BAR OFFSET (for fixed topbar + nav)
   ========================================================================== */

/* Topbar offset when admin bar present */
body.admin-bar .ma-topbar {
    top: 32px;
}

/* Nav offset: 45px (topbar) + 32px (admin bar) = 77px */
body.admin-bar .ma-nav {
    top: 77px;
}
body.admin-bar .ma-nav--hidden {
    transform: translateY(calc(-100% - 77px));
}

@media screen and (max-width: 782px) {
    body.admin-bar .ma-topbar {
        top: 46px;
    }
    body.admin-bar .ma-nav {
        top: 91px; /* 45px topbar + 46px admin bar */
    }
    body.admin-bar .ma-nav--hidden {
        transform: translateY(calc(-100% - 91px));
    }
}

/* ==========================================================================
   1. CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   ========================================================================== */

:root {
  /* Primary Brand */
  --color-primary: #1a365d;
  --color-primary-dark: #0d1f3c;
  --color-primary-light: #2c4a7c;

  /* Secondary/Accent */
  --color-secondary: #e53e3e;
  --color-secondary-dark: #c53030;
  --color-secondary-light: #fc8181;

  /* Neutrals */
  --color-white: #ffffff;
  --color-black: #000000;
  --color-gray-50: #fafafa;
  --color-gray-100: #f5f5f5;
  --color-gray-200: #e5e5e5;
  --color-gray-300: #d4d4d4;
  --color-gray-400: #a3a3a3;
  --color-gray-500: #737373;
  --color-gray-600: #525252;
  --color-gray-700: #404040;
  --color-gray-800: #262626;
  --color-gray-900: #1a1a1a;

  /* Typography */
  --font-primary: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Font Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  /* Font Weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* Section Padding */
  --section-padding-sm: 3rem;
  --section-padding-md: 5rem;
  --section-padding-lg: 7.5rem;

  /* Container */
  --container-max: 1200px;
  --container-padding: 1.5rem;

  /* Border Radius */
  --radius-sm: 0.125rem;
  --radius-md: 0.25rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;
}

/* ==========================================================================
   2. BASE STYLES
   ========================================================================== */

body {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--color-gray-900);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-bold);
  line-height: 1.25;
  color: var(--color-gray-900);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-dark);
}

/* ==========================================================================
   3. BUTTONS
   ========================================================================== */

.btn,
.x-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.875rem 2rem;
  font-family: var(--font-primary);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  line-height: 1;
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
}

.btn-primary,
.x-btn.btn-primary {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-white);
}

.btn-primary:hover {
  background-color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: var(--color-white);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background-color: transparent;
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-secondary:hover {
  background-color: var(--color-primary);
  color: var(--color-white);
}

.btn-white {
  background-color: var(--color-white);
  border-color: var(--color-white);
  color: var(--color-primary);
}

.btn-white:hover {
  background-color: var(--color-gray-100);
  color: var(--color-primary-dark);
}

.btn-ghost {
  background-color: transparent;
  border-color: var(--color-white);
  color: var(--color-white);
}

.btn-ghost:hover {
  background-color: var(--color-white);
  color: var(--color-primary);
}

.btn-lg {
  padding: 1.125rem 2.5rem;
  font-size: var(--text-lg);
}

.btn-sm {
  padding: 0.625rem 1.25rem;
  font-size: var(--text-sm);
}

/* ==========================================================================
   4. FORMS
   ========================================================================== */

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
textarea,
select,
.gform_wrapper input[type="text"],
.gform_wrapper input[type="email"],
.gform_wrapper input[type="tel"],
.gform_wrapper textarea,
.gform_wrapper select {
  display: block;
  width: 100%;
  padding: 0.875rem 1rem;
  font-family: var(--font-primary);
  font-size: var(--text-base);
  color: var(--color-gray-900);
  background-color: var(--color-white);
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.1);
}

.gform_wrapper input[type="submit"],
.gform_wrapper .gform_button {
  background-color: var(--color-primary);
  border: 2px solid var(--color-primary);
  color: var(--color-white);
  padding: 1rem 2rem;
  font-weight: var(--font-semibold);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
}

.gform_wrapper input[type="submit"]:hover {
  background-color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

/* ==========================================================================
   5. SECTIONS
   ========================================================================== */

.section {
  padding: var(--section-padding-md) 0;
}

.section-light {
  background-color: var(--color-gray-100);
}

.section-dark {
  background-color: var(--color-primary);
  color: var(--color-white);
}

.section-dark h1,
.section-dark h2,
.section-dark h3,
.section-dark h4 {
  color: var(--color-white);
}

/* ==========================================================================
   6. PRODUCT CARD
   ========================================================================== */

.product-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.product-card__image {
  position: relative;
  aspect-ratio: 16 / 9;
  background-color: var(--color-gray-100);
  overflow: hidden;
}

.product-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.product-card:hover .product-card__image img {
  transform: scale(1.05);
}

.product-card__content {
  padding: var(--space-5) var(--space-6);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-card__title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-2);
}

.product-card__description {
  font-size: var(--text-sm);
  color: var(--color-gray-600);
  margin-bottom: var(--space-4);
  flex: 1;
}

.product-card__link {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-primary);
}

.product-card__link:hover {
  color: var(--color-primary-dark);
}

/* ==========================================================================
   7. FEATURE CALLOUT
   ========================================================================== */

.feature-callout {
  text-align: center;
  padding: var(--space-8);
}

.feature-callout__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-gray-100);
  border-radius: var(--radius-full);
  color: var(--color-primary);
}

.feature-callout__title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-3);
}

.feature-callout__text {
  font-size: var(--text-sm);
  color: var(--color-gray-600);
}

/* ==========================================================================
   8. SPEC TABLE
   ========================================================================== */

.spec-table {
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.spec-table__header {
  background: var(--color-primary);
  color: var(--color-white);
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
}

.spec-table__row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--color-gray-200);
}

.spec-table__row:nth-child(even) {
  background: var(--color-gray-50);
}

.spec-table__label {
  color: var(--color-gray-600);
}

.spec-table__value {
  font-weight: var(--font-semibold);
}

/* ==========================================================================
   9. CTA SECTION
   ========================================================================== */

.cta-section {
  background: var(--color-primary);
  padding: var(--section-padding-md) 0;
  text-align: center;
}

.cta-section__title {
  font-size: var(--text-4xl);
  color: var(--color-white);
  margin-bottom: var(--space-4);
}

.cta-section__text {
  font-size: var(--text-lg);
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: var(--space-8);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* ==========================================================================
   10. GALLERY
   ========================================================================== */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
}

.gallery-item {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.gallery-item:hover img {
  transform: scale(1.1);
}

/* ==========================================================================
   11. COLOR SWATCH
   ========================================================================== */

.color-swatch {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.color-swatch__preview {
  aspect-ratio: 1;
  background-size: cover;
  background-position: center;
}

.color-swatch__info {
  padding: var(--space-4);
  text-align: center;
}

.color-swatch__name {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
}

/* ==========================================================================
   12. HERO SECTION
   ========================================================================== */

.hero {
  position: relative;
  min-height: 600px;
  display: flex;
  align-items: center;
  background-size: cover;
  background-position: center;
  padding: var(--section-padding-lg) 0;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(26, 54, 93, 0.9), rgba(26, 54, 93, 0.6));
}

.hero__content {
  position: relative;
  z-index: 1;
  max-width: 650px;
}

.hero__title {
  font-size: var(--text-5xl);
  color: var(--color-white);
  margin-bottom: var(--space-4);
}

.hero__subtitle {
  font-size: var(--text-xl);
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: var(--space-8);
}

/* ==========================================================================
   13. TRUST BAR
   ========================================================================== */

.trust-bar {
  background: var(--color-white);
  padding: var(--space-10) 0;
  border-bottom: 1px solid var(--color-gray-200);
}

.stat-item {
  text-align: center;
}

.stat-item__number {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  color: var(--color-primary);
  margin-bottom: var(--space-2);
}

.stat-item__label {
  font-size: var(--text-sm);
  color: var(--color-gray-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ==========================================================================
   14. PRODUCT FILTER
   ========================================================================== */

.product-filter {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: center;
  margin-bottom: var(--space-10);
}

.filter-btn {
  padding: var(--space-3) var(--space-5);
  background: var(--color-white);
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-gray-700);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.filter-btn.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-white);
}

/* ==========================================================================
   15. PRODUCT GRID
   ========================================================================== */

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-8);
}

/* ==========================================================================
   16. HEADER STYLES
   ========================================================================== */

/* Top bar height variable */
:root {
  --top-bar-height: 40px;
}

/* Push main navigation below top bar */
.x-bar-container:nth-child(2),
.x-bar[data-x-bar="2"] {
  margin-top: var(--top-bar-height) !important;
}

/* When both bars are fixed, stack them properly */
.x-bar-outer .x-bar:not(:first-child) {
  top: var(--top-bar-height) !important;
}

/* Alternative: if using absolute positioning */
body:not(.x-bar-is-scrolled) .x-bar-space {
  padding-top: calc(var(--top-bar-height) + 70px);
}

/* Logo in nav - sizing and visibility */
.x-bar .x-brand img,
.x-bar .x-image img {
  max-height: 50px;
  width: auto;
  display: block !important;
  visibility: visible !important;
}

/* Hide text logo if image is present */
.x-brand.has-image .x-brand-text {
  display: none;
}

/* Ensure sticky header accounts for top bar */
.x-bar-fixed.is-scrolled {
  box-shadow: var(--shadow-md);
}

/* Main nav bar positioning when not scrolled */
.x-masthead .x-bar:nth-of-type(2) {
  position: relative;
  top: 0;
}

/* ==========================================================================
   17. FOOTER STYLES
   ========================================================================== */

.footer-main {
  background: var(--color-gray-900);
  padding: var(--section-padding-md) 0;
  color: var(--color-white);
}

.footer-heading {
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-5);
}

.footer-links a {
  color: rgba(255, 255, 255, 0.8);
  font-size: var(--text-sm);
}

.footer-links a:hover {
  color: var(--color-white);
}

.footer-social a {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  color: var(--color-white);
  transition: background var(--transition-fast);
}

.footer-social a:hover {
  background: var(--color-primary);
}

/* ==========================================================================
   18. UTILITIES
   ========================================================================== */

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

.text-center { text-align: center; }
.text-white { color: var(--color-white); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-8 { margin-bottom: var(--space-8); }

/* ==========================================================================
   19. FROST/GLASS BUTTON FIX
   ========================================================================== */

/* Frost effect buttons - ensure white text */
.x-btn[class*="frost"],
.x-btn.btn-frost,
.x-anchor[class*="frost"],
[class*="frost"] .x-btn,
[class*="frost"] .x-anchor,
.x-btn[style*="backdrop-filter"],
[data-x-effect*="frost"] .x-btn,
[data-x-effect*="frost"] .x-anchor,
.e-btn[class*="frost"],
.is-style-frost,
.x-bar .x-btn[style*="rgba"],
.x-bar .x-anchor.x-btn {
  color: var(--color-white) !important;
}

.x-btn[class*="frost"]:hover,
.x-btn.btn-frost:hover,
.x-anchor[class*="frost"]:hover,
[class*="frost"] .x-btn:hover,
.x-bar .x-btn[style*="rgba"]:hover,
.x-bar .x-anchor.x-btn:hover {
  color: var(--color-white) !important;
}

/* ==========================================================================
   20. NAVIGATION DROPDOWN STYLES
   ========================================================================== */

/* Nav dropdown - white text on dark background */
.ma-nav__dropdown a,
.ma-nav__dropdown-link,
.ma-nav__dropdown-item a,
.ma-nav .ma-nav__dropdown a,
.ma-nav .ma-nav__dropdown-link,
#ma-nav .ma-nav__dropdown a,
section .ma-nav__dropdown a,
div .ma-nav__dropdown-link {
  color: #ffffff !important;
}

.ma-nav__dropdown a:hover,
.ma-nav__dropdown-link:hover,
.ma-nav .ma-nav__dropdown a:hover,
.ma-nav .ma-nav__dropdown-link:hover {
  color: #ffffff !important;
  background: rgba(255,255,255,0.1) !important;
}

/* ==========================================================================
   21. FULL WIDTH OVERRIDES (Pro/Cornerstone)
   ========================================================================== */

/* Remove default container padding/margins from Pro theme */
.x-main,
.x-main-full,
.x-container,
.x-container-fluid,
#cs-content,
.cs-content,
.x-site,
.x-layout,
.x-layout-single,
.x-section,
.x-row,
.x-column,
.e-section,
.e-row,
.e-column,
[data-x-element="section"],
[data-x-element="row"],
[data-x-element="column"] {
  max-width: 100% !important;
  width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Cornerstone builder specific overrides */
.cs-layout-content,
.x-bar-content,
.x-section > .x-container,
.e-section > .x-container {
  max-width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* Override any body margins */
body.x-v7,
body.x-pro,
body.cs-active {
  margin: 0 !important;
  padding: 0 !important;
}

/* Main content area - full width */
.x-site > .x-main,
.x-layout-content,
#content,
.site-content {
  max-width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* ==========================================================================
   21. RESPONSIVE
   ========================================================================== */

@media (max-width: 980px) {
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }

  .hero { min-height: 500px; }
  .hero__title { font-size: var(--text-4xl); }

  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 767px) {
  :root {
    --section-padding-md: 3rem;
    --container-padding: 1rem;
  }

  h1 { font-size: var(--text-2xl); }
  h2 { font-size: var(--text-xl); }

  .hero__title { font-size: var(--text-3xl); }
  .cta-section__title { font-size: var(--text-2xl); }

  .product-grid { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: 1fr; }

  .btn { padding: 0.75rem 1.5rem; }
}
