/* Toyota Tanzania: automotive polish layer.
   Loaded after every original WordPress stylesheet (see src/components/SiteDocument.jsx).
   It only adds motion and finish on top of the theme; the theme's own CSS stays untouched. */

:root {
  --tz-red: #eb0a1e;
  --tz-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --tz-ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}

/* WordPress markup a hero replaces (title box, colour slider, repeated headings); marked at build
   time by scripts/build-heroes.mjs. */
.tz-replaced {
  display: none !important;
}

/* breathing room between a hero's diagonal edge and the page content */
.tz-hero + #main {
  padding-top: 32px;
}

::selection {
  background: var(--tz-red);
  color: #fff;
}

/* ------------------------------------------------------------------ header */

/* Once the header sticks on scroll it reads as glass over the content. */
#header .header-main.stm-fixed {
  /* !important: the theme's generated wpcfto-generate.css paints this header solid white */
  background-color: rgba(255, 255, 255, 0.86) !important;
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  backdrop-filter: saturate(1.6) blur(16px);
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.06),
    0 12px 32px -20px rgba(0, 0, 0, 0.45);
}

/* Max Mega Menu paints its own white bar; let the glass show through it. */
#header .header-main.stm-fixed #mega-menu-wrap-primary,
#header .header-main.stm-fixed #mega-menu-wrap-primary #mega-menu-primary {
  background: transparent !important;
}

/* Top-level menu: a red rule draws in from the left on hover and marks the current section. */
#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > a.mega-menu-link {
  text-decoration: none !important; /* replaces the theme's hover underline */
}

#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > a.mega-menu-link::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 4px;
  height: 2px;
  border-radius: 2px;
  background: var(--tz-red);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 260ms var(--tz-ease-out);
  pointer-events: none;
}

#mega-menu-wrap-primary #mega-menu-primary > li.mega-current-menu-item > a.mega-menu-link::after,
#mega-menu-wrap-primary #mega-menu-primary > li.mega-current-menu-ancestor > a.mega-menu-link::after,
#mega-menu-wrap-primary #mega-menu-primary > li.mega-toggle-on > a.mega-menu-link::after {
  transform: scaleX(1);
  transform-origin: left;
}

@media (hover: hover) and (pointer: fine) {
  #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > a.mega-menu-link:hover::after {
    transform: scaleX(1);
    transform-origin: left;
  }
}

/* ------------------------------------------------------------------ press feedback */

/* The theme forces a background-colour-only transition on buttons with !important;
   add transform to it so presses scale smoothly. */
.stm-button,
.button,
button,
input[type='submit'],
.vc_btn3,
.vp-filter__item a,
.stripeLines a,
#wpfront-scroll-top-container {
  transition:
    background-color 0.3s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    transform 160ms var(--tz-ease-out) !important;
}

.stm-button:active,
.button:active,
button:active,
input[type='submit']:active,
.vc_btn3:active,
.vp-filter__item a:active,
.stripeLines a:active,
#wpfront-scroll-top-container:active {
  transform: scale(0.97);
}

/* ------------------------------------------------------------------ "I want a ..." quick links */

/* The whole tile is the link now, not just its label; a red rule sweeps in underneath. */
.dugmiciRow > .vc_column-inner {
  position: relative;
  transition: background-color 200ms ease;
}

.dugmiciRow > .vc_column-inner::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--tz-red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 320ms var(--tz-ease-out);
  pointer-events: none;
}

.dugmiciRow a::before {
  content: '';
  position: absolute;
  inset: 0;
}

.dugmiciRow a {
  transition: color 200ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .dugmiciRow > .vc_column-inner:hover {
    background-color: #f6f6f7;
  }
  .dugmiciRow > .vc_column-inner:hover::after {
    transform: scaleX(1);
  }
  .dugmiciRow > .vc_column-inner:hover a {
    color: var(--tz-red);
  }
}

/* ------------------------------------------------------------------ vehicle carousel */

.vp-portfolio__item .vp-portfolio__item-img img {
  transition: transform 420ms var(--tz-ease-out);
}

@media (hover: hover) and (pointer: fine) {
  /* the car rolls forward a touch, like it is being presented */
  .vp-portfolio__item:hover .vp-portfolio__item-img img {
    transform: translateY(-6px) scale(1.03);
  }
}

/* ------------------------------------------------------------------ lightbox (variant specs, parts)
   A modal: it stays centred, enters with a slight scale-up and leaves faster than it came. */

.nivo-lightbox-overlay {
  background: rgba(8, 9, 11, 0.72) !important;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  /* closing: quick */
  transition:
    opacity 200ms ease,
    visibility 0s linear 200ms !important;
}

.nivo-lightbox-overlay.nivo-lightbox-open {
  transition:
    opacity 280ms ease,
    visibility 0s !important;
}

.nivo-lightbox-overlay .nivo-lightbox-content {
  opacity: 0;
  transform: translateY(10px) scale(0.96);
  transition:
    transform 200ms var(--tz-ease-out),
    opacity 150ms ease;
}

.nivo-lightbox-overlay.nivo-lightbox-open .nivo-lightbox-content {
  opacity: 1;
  transform: none;
  transition:
    transform 380ms var(--tz-ease-out) 40ms,
    opacity 260ms ease 40ms;
}

.nivo-lightbox-content iframe.nivo-lightbox-item {
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 40px 120px -24px rgba(0, 0, 0, 0.65);
}

/* close: a round button with a drawn cross instead of the theme's small icon */
.nivo-lightbox-theme-default .nivo-lightbox-close {
  width: 44px !important;
  height: 44px !important;
  padding: 0 !important;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14) !important;
  opacity: 1 !important;
  font-size: 0;
  text-indent: 0 !important;
  transition:
    background-color 200ms ease,
    transform 160ms var(--tz-ease-out);
}

.nivo-lightbox-theme-default .nivo-lightbox-close::before,
.nivo-lightbox-theme-default .nivo-lightbox-close::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: #fff;
  transform: translate(-50%, -50%) rotate(45deg);
}

.nivo-lightbox-theme-default .nivo-lightbox-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.nivo-lightbox-theme-default .nivo-lightbox-close:active {
  transform: scale(0.94);
}

@media (hover: hover) and (pointer: fine) {
  .nivo-lightbox-theme-default .nivo-lightbox-close:hover {
    background: var(--tz-red) !important;
  }
}

/* ------------------------------------------------------------------ forms (quotes, test drive, trade-in) */

.nf-form-content input:not([type='button']):not([type='submit']):not([type='checkbox']):not([type='radio']),
.nf-form-content select,
.nf-form-content textarea,
.wpcf7 input:not([type='submit']):not([type='checkbox']):not([type='radio']),
.wpcf7 select,
.wpcf7 textarea {
  border-radius: 8px !important;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    background-color 150ms ease;
}

.nf-form-content input:focus,
.nf-form-content select:focus,
.nf-form-content textarea:focus,
.wpcf7 input:focus,
.wpcf7 select:focus,
.wpcf7 textarea:focus {
  outline: none;
  border-color: var(--tz-red) !important;
  background-color: #fff !important;
  box-shadow: 0 0 0 3px rgba(235, 10, 30, 0.14) !important;
}

/* ------------------------------------------------------------------ scroll-to-top */

@media (hover: hover) and (pointer: fine) {
  #wpfront-scroll-top-container:hover {
    transform: translateY(-2px);
  }
}

/* ------------------------------------------------------------------ scroll reveal
   Classes are added by src/components/ScrollReveal.jsx to sections below the fold. */

.tz-reveal {
  opacity: 0;
  transform: translateY(24px);
}

.tz-reveal.tz-revealed {
  opacity: 1;
  transform: none;
  transition:
    opacity 700ms ease,
    transform 800ms var(--tz-ease-out);
}

/* ------------------------------------------------------------------ keyboard focus */

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--tz-red);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ reduced motion */

@media (prefers-reduced-motion: reduce) {
  .tz-reveal {
    opacity: 1;
    transform: none;
  }
  .vp-portfolio__item:hover .vp-portfolio__item-img img,
  #wpfront-scroll-top-container:hover,
  .nivo-lightbox-overlay .nivo-lightbox-content {
    transform: none;
  }
}
