/* =============================================================================
   CAR360 — Design Tokens & Header Styles
   main.css · car360-child theme
   ============================================================================= */

/* ─── 1. Design Tokens (CSS Custom Properties) ─────────────────────────────── */
:root {
  /* Brand colours */
  --clr-primary:       #E8311A;   /* CAR360 red — main CTA, accents             */
  --clr-primary-dark:  #C0200C;   /* Hover / pressed state                      */
  --clr-primary-light: #FF5A42;   /* Subtle tints, icon fills                   */

  --clr-neutral-900:   #0F1117;   /* Near-black — headings, body text            */
  --clr-neutral-700:   #2D3142;   /* Nav links, secondary text                  */
  --clr-neutral-400:   #7A7F94;   /* Muted / placeholder text                   */
  --clr-neutral-100:   #F4F6FA;   /* Off-white backgrounds                      */
  --clr-white:         #FFFFFF;

  /* Header specific */
  --header-bg:         var(--clr-white);
  --header-height:     72px;
  --header-shadow:     0 1px 0 var(--border-light, #E8E2E0);
  --header-z:          1000;

  /* Typography */
  --font-sans:         'Manrope', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-display:      'Sora', var(--font-sans);

  --text-xs:   0.75rem;   /* 12px */
  --text-sm:   0.875rem;  /* 14px */
  --text-base: 1rem;      /* 16px */
  --text-lg:   1.125rem;  /* 18px */

  --fw-regular: 400;
  --fw-medium:  500;
  --fw-semibold:600;
  --fw-bold:    700;

  /* Spacing scale */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-12: 3rem;

  /* Radii */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-full:9999px;

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

  /* Layout */
  --container-max: 1280px;
  --container-pad: var(--space-6);
}

/* ─── 2. Global Reset Helpers ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  color: var(--clr-neutral-900);
  margin: 0;
  padding-top: var(--header-height); /* offset for sticky header */
}

/* WordPress admin bar is 32px tall (20px on mobile).
   Push the sticky header down so it sits below the bar. */
.admin-bar .site-header {
  top: 32px;
}
.admin-bar body {
  padding-top: calc(var(--header-height) + 32px);
}

@media screen and (max-width: 782px) {
  .admin-bar .site-header {
    top: 46px;
  }
  .admin-bar body {
    padding-top: calc(var(--header-height) + 46px);
  }
}

/* Mobile nav drawer — extra top padding when admin bar is visible
   so content doesn't start behind the bar (drawer uses inset:0) */
@media (max-width: 768px) {
  .admin-bar .site-header__nav {
    padding-top: calc(var(--space-12) + 32px);
  }
}
@media screen and (max-width: 782px) {
  .admin-bar .site-header__nav {
    padding-top: calc(var(--space-12) + 46px);
  }
}

/* ─── 3. Skip Link (a11y) ───────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  padding: var(--space-2) var(--space-4);
  background: var(--clr-primary);
  color: var(--clr-white);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  z-index: calc(var(--header-z) + 1);
  transition: top var(--transition-fast);
}
.skip-link:focus { top: var(--space-2); }

/* ─── 4. Header Shell ───────────────────────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-light, #FFFFFF);
  box-shadow: var(--header-shadow);
  z-index: var(--header-z);
  transition: box-shadow var(--transition-base),
              background var(--transition-base),
              backdrop-filter var(--transition-base);
}

/* Scrolled state — stronger shadow + subtle blur */
.site-header.is-scrolled {
  box-shadow: 0 4px 24px rgba(0, 0, 0, .08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, .97);
}

.site-header__inner {
  display: flex;
  align-items: center;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-pad);
  height: 100%;
  gap: 0;
}

/* ─── 5. Brand / Logo ───────────────────────────────────────────────────────── */
.site-header__brand {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

/* WordPress custom logo wrapper */
.site-header__brand .custom-logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.site-header__brand .custom-logo {
  height: 44px;       /* control logo height — width auto-scales */
  width: auto;
  max-width: 160px;
  object-fit: contain;
  display: block;
}

/* Text fallback when no logo image is set */
.site-header__site-name {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: var(--clr-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.site-header__site-name:hover { color: var(--clr-primary-dark); }

/* Desktop: hide mobile-only elements */
.mobile-cta { display: none !important; }
.site-header__nav-header,
.site-header__nav-footer,
.site-header__nav-phone { display: none; }

/* Burger icon swap — close icon hidden until nav is open */
.site-header__burger .icon-close { display: none; }
.site-header__burger[aria-expanded="true"] .icon-menu { display: none; }
.site-header__burger[aria-expanded="true"] .icon-close { display: block; }

/* ─── 6. Primary Navigation ─────────────────────────────────────────────────── */
.site-header__nav {
  flex: 1;
  display: flex;
  align-items: center;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-menu li { position: relative; }

.nav-menu > li > a {
  display: block;
  position: relative;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--clr-neutral-700);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--transition-base);
}

/* Underline pseudo-element — slides in left→right on hover */
.nav-menu > li > a::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: var(--space-3);
  right: var(--space-3);
  height: 2px;
  background: var(--clr-primary);
  border-radius: var(--radius-full);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--transition-base);
}

.nav-menu > li > a:hover,
.nav-menu > li.current-menu-item > a,
.nav-menu > li.current-menu-ancestor > a {
  color: var(--clr-primary);
}

.nav-menu > li > a:hover::after,
.nav-menu > li.current-menu-item > a::after,
.nav-menu > li.current-menu-ancestor > a::after {
  transform: scaleX(1);
}

/* Dropdown sub-menu */
.nav-menu .sub-menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  min-width: 200px;
  background: var(--clr-white);
  border-radius: var(--radius-md);
  list-style: none;
  padding: var(--space-2) 0;
  margin: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity var(--transition-base),
              transform var(--transition-base);
  z-index: 10;
}

.nav-menu li:hover > .sub-menu,
.nav-menu li:focus-within > .sub-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.nav-menu .sub-menu a {
  padding: var(--space-2) var(--space-4);
  border-radius: 0;
  font-size: var(--text-sm);
  color: var(--clr-neutral-700);
  transition: color var(--transition-fast), background var(--transition-fast);
}
.nav-menu .sub-menu a:hover {
  color: var(--clr-primary);
  background: rgba(232, 49, 26, 0.05);
}
.nav-menu .sub-menu a::after { display: none; }

/* Dropdown caret */
.nav-menu > li.menu-item-has-children > a {
  padding-right: calc(var(--space-3) + 20px);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 0 24 24' width='24'%3E%3Cpath d='M8.12 9.29 12 13.17l3.88-3.88c.39-.39 1.02-.39 1.41 0 .39.39.39 1.02 0 1.41l-4.59 4.59c-.39.39-1.02.39-1.41 0L6.7 10.7c-.39-.39-.39-1.02 0-1.41.39-.38 1.03-.39 1.42 0z' fill='%232D3142'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right calc(var(--space-3) - 4px) center;
  background-size: 20px 20px;
  transition: color var(--transition-base), background-image var(--transition-fast);
}
.nav-menu > li.menu-item-has-children:hover > a,
.nav-menu > li.menu-item-has-children.current-menu-ancestor > a {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 0 24 24' width='24'%3E%3Cpath d='M8.12 9.29 12 13.17l3.88-3.88c.39-.39 1.02-.39 1.41 0 .39.39.39 1.02 0 1.41l-4.59 4.59c-.39.39-1.02.39-1.41 0L6.7 10.7c-.39-.39-.39-1.02 0-1.41.39-.38 1.03-.39 1.42 0z' fill='%23EC3D23'/%3E%3C/svg%3E");
}

/* ─── 7. Actions Bar (phone + CTA + burger) ─────────────────────────────────── */
.site-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-shrink: 0;
  margin-left: auto;
}

/* Phone link */
.site-header__phone {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1.5px solid var(--border-light, #E8E2E0);
  background: transparent;
  font-family: var(--font-sans);
  font-size: .875rem;
  font-weight: 600;
  color: var(--clr-neutral-900);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: .01em;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}
.site-header__phone:hover {
  color: var(--clr-primary);
  border-color: var(--clr-primary);
  background: rgba(232, 49, 26, .04);
}
.site-header__phone-icon {
  flex-shrink: 0;
  color: var(--clr-primary);
  width: 16px;
  height: 16px;
}

/* CTA button */
.btn-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 20px;
  background: var(--clr-primary);
  color: var(--clr-white) !important;
  font-family: var(--font-sans);
  font-size: .875rem;
  font-weight: 700;
  text-decoration: none;
  border-radius: 8px;
  white-space: nowrap;
  letter-spacing: .01em;
  transition: background var(--transition-fast), transform var(--transition-fast);
}
.btn-cta:hover {
  background: var(--clr-primary-dark);
  transform: translateY(-1px);
}
.btn-cta:active { transform: translateY(0); }
.btn-cta:focus { outline: none; }
.btn-cta:focus-visible { outline: 2px solid var(--clr-primary); outline-offset: 3px; }

/* ─── 8. Hamburger Button ───────────────────────────────────────────────────── */
.site-header__burger {
  display: none;
  width: 40px;
  height: 40px;
  padding: var(--space-2);
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
  color: var(--clr-neutral-700);
}
.site-header__burger:hover { background: var(--clr-neutral-100); }
.site-header__burger:focus { outline: none; }
.site-header__burger:focus-visible { outline: 2px solid var(--clr-primary); outline-offset: 2px; }
.site-header__burger svg { display: block; fill: var(--clr-neutral-700); pointer-events: none; }

/* ─── 9. Responsive — Tablet / Mobile ──────────────────────────────────────── */

@media (max-width: 900px) {
  .site-header__phone-number { display: none; }
}

@media (max-width: 768px) {
  :root { --header-height: 60px; }

  .site-header__burger {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .site-header__phone,
  .site-header__cta { display: none; }

  /* ── Drawer — slides in from right, dark ── */
  .site-header__nav {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 100vw);
    background: #181412;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 300ms cubic-bezier(.4, 0, .2, 1);
    z-index: calc(var(--header-z) + 1);
    box-shadow: -8px 0 40px rgba(0,0,0,.35);
  }

  .site-header__nav.is-open {
    transform: translateX(0);
  }

  /* Backdrop */
  .site-header__nav.is-open::before {
    content: '';
    position: fixed;
    inset: 0;
    right: min(320px, 100vw);
    background: rgba(0,0,0,.5);
    z-index: -1;
  }

  /* ── Drawer header ── */
  .site-header__nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
  }

  .site-header__nav-brand {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: -.01em;
  }

  .site-header__nav-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255,255,255,.08);
    border: none;
    cursor: pointer;
    color: rgba(255,255,255,.7);
    transition: background var(--transition-fast), color var(--transition-fast);
    flex-shrink: 0;
  }
  .site-header__nav-close:hover {
    background: rgba(255,255,255,.15);
    color: #fff;
  }
  .site-header__nav-close svg { display: block; pointer-events: none; }

  /* ── Nav links ── */
  .nav-menu {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
    padding: 12px 16px;
    flex: 1;
  }

  .nav-menu > li > a {
    display: flex;
    align-items: center;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    padding: 13px 16px;
    width: 100%;
    text-align: left;
    color: rgba(255,255,255,.75);
    border-radius: 10px;
    transition: background var(--transition-fast), color var(--transition-fast);
  }

  .nav-menu > li > a:hover {
    color: #fff;
    background: rgba(255,255,255,.07);
  }

  .nav-menu > li.current-menu-item > a,
  .nav-menu > li.current-menu-ancestor > a {
    color: #fff;
    background: rgba(232, 49, 26, .18);
  }

  /* No underline in drawer */
  .nav-menu > li > a::after { display: none; }

  /* Sub-menu */
  .nav-menu .sub-menu {
    position: static;
    opacity: 1;
    pointer-events: auto;
    transform: none;
    box-shadow: none;
    border: none;
    background: transparent;
    padding: 2px 0 6px 12px;
    margin: 0;
  }

  .nav-menu .sub-menu a {
    font-size: .875rem;
    font-weight: 500;
    color: rgba(255,255,255,.5);
    padding: 9px 16px;
    border-radius: 8px;
    border-left: 2px solid rgba(232, 49, 26, .4);
  }
  .nav-menu .sub-menu a:hover {
    color: #fff;
    background: rgba(255,255,255,.06);
  }

  /* Hide dropdown caret on mobile */
  .nav-menu > li.menu-item-has-children > a {
    background-image: none;
    padding-right: 16px;
  }

  /* ── Drawer footer: phone + CTA ── */
  .site-header__nav-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px 24px 32px;
    border-top: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
  }

  .mobile-cta {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 44px;
    border-radius: 10px;
    font-size: .95rem;
  }

  .site-header__nav-phone {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 16px;
    border-radius: 10px;
    border: 1.5px solid rgba(255,255,255,.12);
    color: rgba(255,255,255,.65);
    font-family: var(--font-sans);
    font-size: .875rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color var(--transition-fast), color var(--transition-fast);
  }
  .site-header__nav-phone:hover {
    border-color: rgba(255,255,255,.3);
    color: #fff;
  }
  .site-header__nav-phone svg { color: var(--clr-primary); flex-shrink: 0; }
}

/* ─── Contact Form 7 — CAR360 Style ────────────────────────────────────────── */

.wpcf7 .row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}

.wpcf7 .form-group.col-md-12 {
  grid-column: 1 / -1;
}

@media (max-width: 640px) {
  .wpcf7 .row { grid-template-columns: 1fr; }
  .wpcf7 .form-group.col-md-12 { grid-column: 1; }
}

/* Field wrapper */
.wpcf7 .form-group p {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}

.wpcf7 .mb-3 {
  margin-bottom: 20px;
}

/* Label */
.wpcf7 label {
  font-family: var(--font-body, 'Manrope', sans-serif);
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-muted, #767676);
  text-transform: uppercase;
  letter-spacing: .10em;
  margin-bottom: 5px;
  display: block;
}

/* Inputs & textarea */
.wpcf7 .wpcf7-form-control-wrap {
  display: block;
}

.wpcf7 .form-control,
.wpcf7 input[type="text"],
.wpcf7 input[type="email"],
.wpcf7 input[type="tel"],
.wpcf7 textarea {
  width: 100%;
  background: var(--bg-light-alt, #FAF7F6);
  border: 1.5px solid transparent;
  border-radius: 12px;
  padding: 14px 18px;
  font-family: var(--font-body, 'Manrope', sans-serif);
  font-size: .94rem;
  color: var(--text-body, #4A4A4A);
  outline: none;
  transition: border-color 0.20s, background 0.20s, box-shadow 0.20s;
  appearance: none;
  box-sizing: border-box;
  line-height: 1.5;
}

.wpcf7 .form-control:hover,
.wpcf7 input[type="text"]:hover,
.wpcf7 input[type="email"]:hover,
.wpcf7 input[type="tel"]:hover,
.wpcf7 textarea:hover {
  border-color: var(--border-light, #E8E2E0);
  background: #fff;
}

.wpcf7 .form-control:focus,
.wpcf7 input[type="text"]:focus,
.wpcf7 input[type="email"]:focus,
.wpcf7 input[type="tel"]:focus,
.wpcf7 textarea:focus {
  border-color: var(--brand-500, #EC3D23);
  background: #fff;
  box-shadow: 0 0 0 4px var(--brand-50, #FEEEEA);
}

.wpcf7 .form-control::placeholder,
.wpcf7 input::placeholder,
.wpcf7 textarea::placeholder {
  color: #C4BDB9;
}

.wpcf7 textarea.form-control,
.wpcf7 textarea {
  resize: vertical;
  min-height: 160px;
  line-height: 1.65;
}

/* Submit row */
.wpcf7 .col-md-12.form-btn {
  margin-top: 8px;
}

.wpcf7 .col-md-12.form-btn p {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.wpcf7 input[type="submit"],
.wpcf7 .wpcf7-submit {
  background: var(--brand-500, #EC3D23);
  color: #fff;
  border: none;
  border-radius: var(--radius-full, 9999px);
  padding: 14px 40px;
  font-family: var(--font-body, 'Manrope', sans-serif);
  font-size: .94rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s, transform 0.18s, box-shadow 0.18s;
  appearance: none;
  width: auto;
  letter-spacing: .02em;
}

.wpcf7 input[type="submit"]:hover,
.wpcf7 .wpcf7-submit:hover {
  background: var(--brand-600, #C92F1A);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(236, 61, 35, 0.30);
}

.wpcf7 input[type="submit"]:active {
  transform: translateY(0);
  box-shadow: none;
}

/* Spinner */
.wpcf7-spinner {
  vertical-align: middle;
  margin: 0;
}

/* Validation */
.wpcf7 .wpcf7-not-valid {
  border-color: var(--brand-500, #EC3D23) !important;
  background: #fff !important;
  box-shadow: 0 0 0 4px var(--brand-50, #FEEEEA) !important;
}

.wpcf7 .wpcf7-not-valid-tip {
  font-family: var(--font-body, 'Manrope', sans-serif);
  font-size: .74rem;
  color: var(--brand-500, #EC3D23);
  margin-top: 6px;
  display: block;
}

/* Response messages */
.wpcf7 .wpcf7-response-output {
  font-family: var(--font-body, 'Manrope', sans-serif);
  font-size: .86rem;
  border-radius: 12px;
  padding: 14px 20px;
  margin-top: 20px;
  border: none !important;
  grid-column: 1 / -1;
}

.wpcf7 .wpcf7-mail-sent-ok {
  background: #f0fdf4;
  color: #166534;
}

.wpcf7 .wpcf7-mail-sent-ng,
.wpcf7 .wpcf7-aborted,
.wpcf7 .wpcf7-spam-blocked,
.wpcf7 .wpcf7-validation-errors {
  background: var(--brand-50, #FEEEEA);
  color: var(--brand-700, #A12414);
}

/* Admin bar offset for mobile drawer */
@media (max-width: 768px) {
  .admin-bar .site-header__nav {
    top: calc(var(--header-height) + 32px);
  }
}
@media screen and (max-width: 768px) and (max-width: 782px) {
  .admin-bar .site-header__nav {
    top: calc(var(--header-height) + 46px);
  }
}
