/* ============================================================
   Mike's Trailers — Custom CSS (supplements Tailwind CDN)
   ============================================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@600;700;800&family=Inter:wght@400;500;600&display=swap');

/* ---- CSS Variables ---- */
:root {
  --primary:   #1e40af;
  --accent:    #ea580c;
  --bg:        #f9fafb;
  --dark:      #111827;
  --muted:     #6b7280;
  --border:    #e5e7eb;
  --primary-light: #dbeafe;
  --accent-light:  #fff7ed;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--dark);
  background: #fff;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 {
  font-family: 'Poppins', system-ui, sans-serif;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

/* ---- Grain texture overlay ---- */
.grain::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  opacity: 0.5;
  z-index: 1;
}

/* ---- Depth / Shadow system ---- */
.shadow-brand {
  box-shadow: 0 4px 6px -1px rgba(30, 64, 175, 0.08),
              0 2px 4px -1px rgba(30, 64, 175, 0.04);
}
.shadow-brand-lg {
  box-shadow: 0 10px 25px -5px rgba(30, 64, 175, 0.12),
              0 4px 10px -2px rgba(30, 64, 175, 0.06);
}
.shadow-brand-hover {
  box-shadow: 0 20px 40px -10px rgba(30, 64, 175, 0.18),
              0 8px 16px -4px rgba(30, 64, 175, 0.08);
}

/* ---- Buttons ---- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent);
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 0.9375rem;
  padding: 0.75rem 1.75rem;
  border-radius: 0.5rem;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.35);
  white-space: nowrap;
}
.btn-primary:hover {
  background: #c2410c;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(234, 88, 12, 0.45);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  color: var(--primary);
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 0.9375rem;
  padding: 0.75rem 1.75rem;
  border-radius: 0.5rem;
  border: 2px solid var(--primary);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, transform 0.15s;
  white-space: nowrap;
}
.btn-secondary:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-1px);
}
.btn-secondary:active { transform: translateY(0); }
.btn-secondary:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

.btn-white {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #fff;
  color: var(--primary);
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 0.9375rem;
  padding: 0.75rem 1.75rem;
  border-radius: 0.5rem;
  border: 2px solid #fff;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, transform 0.15s;
  white-space: nowrap;
}
.btn-white:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
}

/* ---- Cards ---- */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 1rem;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover {
  transform: translateY(-4px);
}
.card:hover { box-shadow: 0 20px 40px -10px rgba(30,64,175,0.14), 0 8px 16px -4px rgba(30,64,175,0.07); }

/* ---- Navigation ---- */
#main-nav {
  transition: box-shadow 0.25s, background 0.25s;
}
#main-nav.scrolled {
  box-shadow: 0 4px 20px rgba(30, 64, 175, 0.1);
}

.nav-link {
  position: relative;
  font-weight: 500;
  color: var(--dark);
  text-decoration: none;
  padding: 0.25rem 0;
  transition: color 0.2s;
}
.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 0.2s;
}
.nav-link:hover { color: var(--primary); }
.nav-link:hover::after { transform: scaleX(1); }
.nav-link.active { color: var(--primary); font-weight: 600; }
.nav-link.active::after { transform: scaleX(1); }

/* Mobile menu */
#mobile-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.25s ease;
  opacity: 0;
}
#mobile-menu.open {
  max-height: 500px;
  opacity: 1;
}

/* ---- Hero Carousel ---- */
.carousel-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.8s ease;
}
.carousel-slide.active { opacity: 1; }

.carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  border: 2px solid rgba(255,255,255,0.6);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.carousel-dot.active {
  background: #fff;
  transform: scale(1.3);
}

/* ---- Section styles ---- */
.section-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.875rem;
  border-radius: 2rem;
  margin-bottom: 0.75rem;
}

/* ---- Service/Parts category cards ---- */
.service-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 2rem;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.service-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: 0 16px 32px -8px rgba(30,64,175,0.12);
}

.service-icon {
  width: 56px;
  height: 56px;
  border-radius: 0.875rem;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  transition: background 0.2s;
}
.service-card:hover .service-icon {
  background: var(--primary);
}
.service-card:hover .service-icon svg {
  color: #fff !important;
}

/* ---- Accordion (parts page) ---- */
.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.accordion-header:hover { background: var(--bg); }
.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.25s ease;
}
.accordion-body.open {
  max-height: 600px;
}
.accordion-chevron {
  transition: transform 0.3s;
}
.accordion-header[aria-expanded="true"] .accordion-chevron {
  transform: rotate(180deg);
}

/* ---- Form styles ---- */
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  color: var(--dark);
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.12);
}
.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}
.form-input.success,
.form-textarea.success {
  border-color: #16a34a;
}
.form-error {
  color: #dc2626;
  font-size: 0.8125rem;
  margin-top: 0.25rem;
  display: none;
}
.form-error.visible { display: block; }

.form-label {
  display: block;
  font-weight: 500;
  font-size: 0.9375rem;
  margin-bottom: 0.375rem;
  color: var(--dark);
}
.form-label .req { color: var(--accent); margin-left: 2px; }

/* ---- Product card (sales page) ---- */
.product-card img {
  transition: transform 0.4s ease;
}
.product-card:hover img {
  transform: scale(1.04);
}

/* ---- CTA band ---- */
.cta-band {
  background: linear-gradient(135deg, var(--primary) 0%, #1e3a8a 60%, #1e40af 100%);
  position: relative;
  overflow: hidden;
}
.cta-band::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 80% 50%, rgba(234,88,12,0.18) 0%, transparent 70%);
}

/* ---- Utility ---- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section-py { padding-top: 5rem; padding-bottom: 5rem; }

@media (max-width: 768px) {
  .section-py { padding-top: 3.5rem; padding-bottom: 3.5rem; }
}

/* ---- Spinner ---- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Top bar ---- */
#top-bar {
  background: var(--primary);
  color: #fff;
  font-size: 0.8125rem;
}

/* ---- Page hero (non-home pages) ---- */
.page-hero {
  background: linear-gradient(135deg, var(--primary) 0%, #1d4ed8 100%);
  padding: 4rem 0 3.5rem;
  position: relative;
  overflow: hidden;
}
.page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 20% 80%, rgba(234,88,12,0.15) 0%, transparent 60%);
}

/* ---- Parts tag ---- */
.parts-tag {
  display: inline-block;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8125rem;
  padding: 0.2rem 0.625rem;
  border-radius: 0.25rem;
  margin: 0.2rem;
}

/* ---- Hours table ---- */
.hours-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9375rem;
}
.hours-row:last-child { border-bottom: none; }
.hours-today {
  background: var(--primary-light);
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  margin: -0.5rem -0.75rem;
}

/* ---- Map container ---- */
.map-container {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 1rem;
  border: 1px solid var(--border);
}
.map-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---- Focus visible outlines (accessibility) ---- */
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}
