/**
 * Components — Reusable UI elements
 * Header, footer, navigation, buttons, cards, accordion, forms
 * BEM naming: .block__element--modifier
 */

/* ═══════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.75rem 1.5rem;
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: var(--weight-semibold);
  text-decoration: none;
  border: var(--border-width) solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color var(--transition-fast),
              color var(--transition-fast),
              border-color var(--transition-fast),
              transform var(--transition-fast);
  min-height: 44px;
  min-width: 44px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Primary CTA — Walnut bg + Cream text (12.77:1 contrast) */
.btn--primary {
  background-color: var(--color-cta-bg);
  color: var(--color-cta-text);
  border-color: var(--color-cta-bg);
}

.btn--primary:hover {
  background-color: var(--color-copper);
  border-color: var(--color-copper);
  color: var(--color-walnut);
}

/* Secondary — Outline style */
.btn--secondary {
  background-color: transparent;
  color: var(--color-walnut);
  border-color: var(--color-walnut);
}

.btn--secondary:hover {
  background-color: var(--color-walnut);
  color: var(--color-cream);
}

/* Call/Text action buttons */
.btn--call,
.btn--text {
  background-color: var(--color-cedar);
  color: var(--color-cream);
  border-color: var(--color-cedar);
}

.btn--call:hover,
.btn--text:hover {
  background-color: #3d5a36;
  border-color: #3d5a36;
  color: var(--color-cream);
}

/* Small button variant */
.btn--sm {
  padding: 0.5rem 1rem;
  font-size: var(--text-small);
}

/* Large button variant */
.btn--lg {
  padding: 1rem 2rem;
  font-size: 1.125rem;
}

/* Full width on mobile */
.btn--block {
  width: 100%;
}

@media (min-width: 768px) {
  .btn--block {
    width: auto;
  }
}

/* ═══════════════════════════════════════════
   HEADER & NAVIGATION
   ═══════════════════════════════════════════ */

.header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background-color: var(--color-walnut);
  color: var(--color-cream);
  box-shadow: var(--shadow-md);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--gutter);
  max-width: var(--max-width);
  margin-inline: auto;
}

.header__logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  color: var(--color-cream);
}

.header__logo-text {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: var(--weight-bold);
  line-height: 1.2;
}

.header__logo-text span {
  display: block;
  font-family: var(--font-body);
  font-size: var(--text-caption);
  font-weight: var(--weight-regular);
  color: var(--color-copper);
  letter-spacing: 0.05em;
}

.header__phone {
  display: none;
  align-items: center;
  gap: var(--space-xs);
  color: var(--color-copper);
  text-decoration: none;
  font-weight: var(--weight-semibold);
  font-size: var(--text-small);
}

.header__phone:hover {
  color: var(--color-cream);
}

@media (min-width: 768px) {
  .header__phone {
    display: flex;
  }
}

/* Desktop nav */
.nav {
  display: none;
}

.nav__list {
  display: flex;
  gap: var(--space-lg);
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav__link {
  color: var(--color-cream);
  text-decoration: none;
  font-weight: var(--weight-medium);
  font-size: var(--text-small);
  padding: var(--space-xs) 0;
  border-bottom: 2px solid transparent;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}

.nav__link:hover,
.nav__link--active {
  color: var(--color-copper);
  border-bottom-color: var(--color-copper);
}

@media (min-width: 1024px) {
  .nav {
    display: block;
  }
}

/* Hamburger menu button */
.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
  min-height: 44px;
  min-width: 44px;
}

.nav-toggle__bar {
  width: 24px;
  height: 2px;
  background-color: var(--color-cream);
  transition: transform var(--transition-base), opacity var(--transition-base);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (min-width: 1024px) {
  .nav-toggle {
    display: none;
  }
}

/* Mobile nav overlay */
.mobile-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: var(--color-walnut);
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  padding: var(--space-3xl) var(--gutter) var(--space-xl);
  transform: translateX(100%);
  transition: transform var(--transition-base);
}

.mobile-nav[aria-hidden="false"] {
  transform: translateX(0);
}

.mobile-nav__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mobile-nav__link {
  display: block;
  color: var(--color-cream);
  text-decoration: none;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  padding: var(--space-md) 0;
  border-bottom: 1px solid rgba(245, 240, 232, 0.15);
  transition: color var(--transition-fast), padding-left var(--transition-fast);
}

.mobile-nav__link:hover,
.mobile-nav__link--active {
  color: var(--color-copper);
  padding-left: var(--space-sm);
}

.mobile-nav__close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: none;
  border: none;
  color: var(--color-cream);
  font-size: 1.5rem;
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-nav__cta {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* ═══════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════ */

.footer {
  background-color: var(--color-walnut);
  color: var(--color-cream);
  padding: var(--space-2xl) var(--gutter) var(--space-lg);
}

.footer__inner {
  max-width: var(--max-width);
  margin-inline: auto;
  display: grid;
  gap: var(--space-xl);
}

.footer__brand {
  max-width: 300px;
}

.footer__brand-name {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  margin-bottom: var(--space-sm);
}

.footer__brand-tagline {
  font-size: var(--text-small);
  color: var(--color-parchment);
  margin-bottom: var(--space-md);
}

.footer__veteran-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  background-color: rgba(245, 240, 232, 0.1);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: var(--text-caption);
  color: var(--color-copper);
}

.footer__heading {
  font-family: var(--font-body);
  font-size: var(--text-small);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-copper);
  margin-bottom: var(--space-md);
}

.footer__links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer__links li {
  margin-bottom: var(--space-sm);
}

.footer__links a {
  color: var(--color-parchment);
  text-decoration: none;
  font-size: var(--text-small);
  transition: color var(--transition-fast);
}

.footer__links a:hover {
  color: var(--color-copper);
}

.footer__contact-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  font-size: var(--text-small);
  color: var(--color-parchment);
}

.footer__contact-item a {
  color: var(--color-parchment);
  text-decoration: none;
}

.footer__contact-item a:hover {
  color: var(--color-copper);
}

.footer__bottom {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-top: var(--space-lg);
  margin-top: var(--space-lg);
  border-top: 1px solid rgba(245, 240, 232, 0.15);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  font-size: var(--text-caption);
  color: var(--color-steel);
}

.footer__bottom a {
  color: var(--color-steel);
  text-decoration: none;
}

.footer__bottom a:hover {
  color: var(--color-copper);
}

@media (min-width: 768px) {
  .footer__inner {
    grid-template-columns: 1.5fr 1fr 1fr;
  }

  .footer__bottom {
    flex-direction: row;
    justify-content: space-between;
  }
}

/* ═══════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════ */

.card {
  background-color: var(--color-cream);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card__icon {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-md);
  color: var(--color-copper);
}

.card__title {
  font-family: var(--font-heading);
  font-size: var(--text-h4);
  color: var(--color-heading);
  margin-bottom: var(--space-sm);
}

.card__text {
  font-size: var(--text-small);
  color: var(--color-text);
  margin-bottom: var(--space-md);
}

.card__link {
  font-size: var(--text-small);
  font-weight: var(--weight-semibold);
  color: var(--color-copper);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}

.card__link:hover {
  color: var(--color-terracotta);
}

/* ═══════════════════════════════════════════
   ACCORDION (FAQ)
   ═══════════════════════════════════════════ */

.accordion {
  border-top: 1px solid var(--color-parchment);
}

.accordion__item {
  border-bottom: 1px solid var(--color-parchment);
}

.accordion__trigger {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: var(--weight-semibold);
  color: var(--color-heading);
  text-align: left;
  min-height: 44px;
}

.accordion__trigger:hover {
  color: var(--color-copper);
}

.accordion__trigger:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

.accordion__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  transition: transform var(--transition-base);
  color: var(--color-copper);
}

.accordion__trigger[aria-expanded="true"] .accordion__icon {
  transform: rotate(180deg);
}

.accordion__content {
  overflow: hidden;
  max-height: 0;
  transition: max-height var(--transition-base);
}

.accordion__content[aria-hidden="false"] {
  max-height: 500px;
}

.accordion__body {
  padding-bottom: var(--space-lg);
  font-size: var(--text-small);
  color: var(--color-text);
  line-height: 1.7;
}

/* ═══════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════ */

.form__group {
  margin-bottom: var(--space-lg);
}

.form__label {
  display: block;
  font-weight: var(--weight-semibold);
  color: var(--color-heading);
  margin-bottom: var(--space-xs);
  font-size: var(--text-small);
}

.form__label--required::after {
  content: ' *';
  color: var(--color-error);
}

.form__input,
.form__select,
.form__textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-body);
  font-size: var(--text-body);
  color: var(--color-text);
  background-color: #fff;
  border: var(--border-width) solid var(--color-parchment);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  min-height: 44px;
}

.form__input:focus,
.form__select:focus,
.form__textarea:focus {
  outline: none;
  border-color: var(--color-copper);
  box-shadow: 0 0 0 3px rgba(184, 115, 51, 0.15);
}

.form__input--error,
.form__select--error,
.form__textarea--error {
  border-color: var(--color-error);
}

.form__error {
  display: none;
  font-size: var(--text-caption);
  color: var(--color-error);
  margin-top: var(--space-xs);
}

.form__error--visible {
  display: block;
}

.form__textarea {
  min-height: 120px;
  resize: vertical;
}

.form__hint {
  font-size: var(--text-caption);
  color: var(--color-leather);
  margin-top: var(--space-xs);
}

/* Honeypot field — hidden from humans */
.form__honeypot {
  position: absolute;
  left: -9999px;
  opacity: 0;
  height: 0;
  width: 0;
  overflow: hidden;
}

/* ═══════════════════════════════════════════
   TESTIMONIAL
   ═══════════════════════════════════════════ */

.testimonial {
  text-align: center;
  padding: var(--space-xl) var(--space-md);
}

.testimonial__quote {
  font-family: var(--font-heading);
  font-size: var(--text-h3);
  font-style: italic;
  color: var(--color-cream);
  margin-bottom: var(--space-md);
  position: relative;
}

.testimonial__quote::before {
  content: '\201C';
  font-size: 4rem;
  color: var(--color-copper);
  position: absolute;
  top: -1.5rem;
  left: 50%;
  transform: translateX(-50%);
  line-height: 1;
}

.testimonial__author {
  font-size: var(--text-small);
  color: var(--color-parchment);
  font-weight: var(--weight-semibold);
}

.testimonial__location {
  font-size: var(--text-caption);
  color: var(--color-steel);
}

/* ═══════════════════════════════════════════
   STATS COUNTER
   ═══════════════════════════════════════════ */

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  text-align: center;
}

.stat__number {
  font-family: var(--font-heading);
  font-size: var(--text-h2);
  color: var(--color-copper);
  line-height: 1;
  margin-bottom: var(--space-xs);
}

.stat__label {
  font-size: var(--text-caption);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text);
}

@media (min-width: 768px) {
  .stats {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ═══════════════════════════════════════════
   STEPS (How It Works)
   ═══════════════════════════════════════════ */

.steps {
  display: grid;
  gap: var(--space-lg);
  counter-reset: step;
}

.step {
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
  counter-increment: step;
}

.step__number {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: var(--color-walnut);
  color: var(--color-cream);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
  font-size: 1.25rem;
}

.step__title {
  font-weight: var(--weight-semibold);
  color: var(--color-heading);
  margin-bottom: var(--space-xs);
}

.step__text {
  font-size: var(--text-small);
  color: var(--color-text);
}

@media (min-width: 768px) {
  .steps {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .steps {
    grid-template-columns: repeat(4, 1fr);
  }

  .step {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }
}

/* ═══════════════════════════════════════════
   GALLERY / BEFORE-AFTER
   ═══════════════════════════════════════════ */

.gallery-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

@media (min-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.gallery-item {
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.gallery-item:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.gallery-item__images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  position: relative;
}

.gallery-item__images::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 100%;
  background-color: var(--color-copper);
}

.gallery-item__label {
  position: absolute;
  bottom: var(--space-sm);
  padding: 2px var(--space-sm);
  font-size: var(--text-caption);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-cream);
  background-color: rgba(59, 36, 21, 0.8);
  border-radius: var(--radius-sm);
}

.gallery-item__label--before {
  left: var(--space-sm);
}

.gallery-item__label--after {
  right: var(--space-sm);
}

.gallery-item__info {
  padding: var(--space-md);
  background-color: var(--color-cream);
}

.gallery-item__title {
  font-weight: var(--weight-semibold);
  color: var(--color-heading);
  margin-bottom: var(--space-xs);
}

.gallery-item__category {
  font-size: var(--text-caption);
  color: var(--color-leather);
}

/* Gallery filter tabs */
.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
  justify-content: center;
}

.gallery-filter {
  padding: var(--space-sm) var(--space-md);
  background: none;
  border: var(--border-width) solid var(--color-parchment);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: var(--text-small);
  font-weight: var(--weight-medium);
  color: var(--color-text);
  transition: all var(--transition-fast);
  min-height: 44px;
}

.gallery-filter:hover,
.gallery-filter--active {
  background-color: var(--color-walnut);
  color: var(--color-cream);
  border-color: var(--color-walnut);
}

/* ═══════════════════════════════════════════
   LIGHTBOX MODAL
   ═══════════════════════════════════════════ */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background-color: rgba(59, 36, 21, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.lightbox--open {
  opacity: 1;
  visibility: visible;
}

.lightbox__close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: none;
  border: none;
  color: var(--color-cream);
  font-size: 2rem;
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox__img {
  max-width: 90vw;
  max-height: 80vh;
  border-radius: var(--radius-md);
}

.lightbox__caption {
  position: absolute;
  bottom: var(--space-lg);
  left: 50%;
  transform: translateX(-50%);
  color: var(--color-cream);
  font-size: var(--text-small);
  text-align: center;
}

/* ═══════════════════════════════════════════
   STICKY MOBILE CTA
   ═══════════════════════════════════════════ */

.sticky-cta {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-sticky);
  background-color: var(--color-walnut);
  padding: var(--space-sm) var(--gutter);
  display: flex;
  gap: var(--space-sm);
  box-shadow: 0 -4px 12px rgba(59, 36, 21, 0.2);
}

.sticky-cta .btn {
  flex: 1;
  font-size: var(--text-small);
}

@media (min-width: 1024px) {
  .sticky-cta {
    display: none;
  }
}

/* ═══════════════════════════════════════════
   DECORATIVE ELEMENTS (Craftsman-inspired)
   ═══════════════════════════════════════════ */

.divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-xl) 0;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background-color: var(--color-parchment);
}

.divider__diamond {
  width: 10px;
  height: 10px;
  background-color: var(--color-copper);
  transform: rotate(45deg);
  flex-shrink: 0;
}

/* Wood grain texture overlay */
.texture-wood {
  position: relative;
}

.texture-wood::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 2px,
    rgba(245, 240, 232, 0.03) 2px,
    rgba(245, 240, 232, 0.03) 4px
  );
  pointer-events: none;
}

/* ═══════════════════════════════════════════
   TOAST / ALERT MESSAGES
   ═══════════════════════════════════════════ */

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  font-weight: var(--weight-semibold);
  font-size: var(--text-small);
  z-index: var(--z-toast);
  opacity: 0;
  transition: transform var(--transition-base), opacity var(--transition-base);
  max-width: 90vw;
}

.toast--visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast--success {
  background-color: var(--color-cedar);
  color: var(--color-cream);
}

.toast--error {
  background-color: var(--color-error);
  color: #fff;
}
