/* ============================================================
   eVehicle — NX HOMEPAGE
   Sections of page-templates/template-home.php. Product card and
   carousel styles live in nx-core.css (they work on any page).
   The legacy common.css is NOT loaded on the homepage (speed), so
   this file carries the small base reset the page needs.
   ============================================================ */

/* ── Base (replaces common.css on this page) ── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--nx-font); font-size: 16px; line-height: 1.6;
  color: var(--nx-text); background: var(--nx-bg);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
h1, h2, h3, h4, h5, h6, p, figure, blockquote { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg, video { max-width: 100%; }
img { display: block; height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; margin: 0; }
button { cursor: pointer; }

/* Legacy bits still used on this page (back-to-top + toasts from common.js) */
.back-to-top {
  position: fixed; right: 20px; bottom: 20px; z-index: 900;
  width: 46px; height: 46px; border-radius: 999px; display: grid; place-items: center;
  background: var(--nx-ink); color: var(--nx-emerald); border: 1px solid var(--nx-line-dark);
  box-shadow: var(--nx-shadow); opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: opacity .3s, transform .3s var(--nx-ease), visibility .3s;
}
.back-to-top.show { opacity: 1; visibility: visible; transform: none; }
.ev-toast-container {
  position: fixed; left: 50%; bottom: 24px; z-index: 9999; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
}
.ev-toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 14px;
  background: var(--nx-ink); color: #fff; font: 600 .86rem var(--nx-font); box-shadow: var(--nx-shadow-lg);
  pointer-events: auto;
}
.ev-toast a { color: var(--nx-emerald); text-decoration: underline; }
.ev-toast-icon { color: var(--nx-emerald); }

.nx-homepage { background: var(--nx-bg); overflow-x: clip; }

/* ============================================================
   HERO — centred, text-only (fast LCP), vehicle types at the bottom
   ============================================================ */
.nx-hero {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column;
  min-height: 100vh; min-height: 100svh;
  padding-top: var(--header-height, 108px);
  color: var(--nx-on-dark);
  background:
    radial-gradient(60% 55% at 50% 0%, rgba(0, 200, 150, .30), transparent 70%),
    radial-gradient(45% 45% at 100% 100%, rgba(0, 200, 150, .12), transparent 70%),
    radial-gradient(40% 40% at 0% 90%, rgba(125, 255, 214, .07), transparent 70%),
    var(--nx-ink);
}
.nx-hero::before { /* static grid, faded out towards the edges */
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(125, 255, 214, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(125, 255, 214, .07) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 38%, #000 15%, transparent 72%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 38%, #000 15%, transparent 72%);
}
.nx-hero-in {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding-block: clamp(24px, 5vh, 64px);
}
.nx-hero-eyebrow {
  display: inline-flex; align-items: center; gap: 10px; max-width: 100%;
  padding: 8px 16px 8px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12);
  font: 500 .82rem/1.35 var(--nx-font); color: var(--nx-on-dark);
}
.nx-dot { position: relative; width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; background: var(--nx-emerald); box-shadow: 0 0 0 4px rgba(0, 200, 150, .18); }
.nx-hero-title {
  max-width: 14ch; margin: 22px auto 18px;
  font: 800 clamp(2.5rem, 7vw, 5.8rem)/.98 var(--nx-font-display);
  letter-spacing: -.05em; color: #fff; text-wrap: balance;
}
.nx-hero-title em {
  font-style: normal;
  background: linear-gradient(95deg, #7dffd6 0%, #00c896 50%, #d9ff4a 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}
.nx-hero-sub {
  max-width: 56ch; margin: 0 auto; color: var(--nx-on-dark-muted);
  font: 400 clamp(.98rem, 1.3vw, 1.14rem)/1.65 var(--nx-font);
}
.nx-hero-search {
  display: flex; align-items: center; gap: 10px; width: 100%; max-width: 600px; margin: 28px auto 0;
  padding: 7px 7px 7px 22px; border-radius: 999px;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16);
  transition: border-color .25s, box-shadow .25s;
}
.nx-hero-search:focus-within { border-color: rgba(0, 200, 150, .75); box-shadow: 0 0 0 6px rgba(0, 200, 150, .15); }
.nx-hero-search > i { color: var(--nx-emerald); }
.nx-hero-search input {
  flex: 1; min-width: 0; height: 46px; border: 0; outline: 0; background: none;
  color: #fff; font: 500 1rem var(--nx-font);
}
.nx-hero-search input::placeholder { color: rgba(234, 244, 240, .55); }
.nx-hero-search input::-webkit-search-cancel-button { display: none; }
.nx-hero-cta { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 22px; }

/* ── Vehicle-type carousel ── */
.nx-vt { position: relative; padding-bottom: clamp(16px, 3vh, 30px); }
.nx-vt-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px;
  font: 600 .72rem/1 var(--nx-font); letter-spacing: .16em; text-transform: uppercase; color: var(--nx-on-dark-muted);
}
.nx-vt-hint { display: none; letter-spacing: .08em; }
.nx-vt-track {
  display: flex; gap: 12px; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none;
  padding: 6px max(16px, calc((100% - var(--nx-container)) / 2 + 24px)) 8px;
  scroll-padding-inline: max(16px, calc((100% - var(--nx-container)) / 2 + 24px));
}
.nx-vt-track::-webkit-scrollbar { display: none; }
.nx-vt-track > li { flex: 0 0 auto; scroll-snap-align: start; }
.nx-vt-track > li:first-child { margin-left: auto; }  /* centred when everything fits */
.nx-vt-track > li:last-child  { margin-right: auto; }
.nx-vt-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 156px; padding: 16px 12px 14px; border-radius: 20px; text-align: center; color: #fff;
  background: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02));
  border: 1px solid rgba(255, 255, 255, .1);
  transition: transform .35s var(--nx-ease), background .3s, border-color .3s;
}
.nx-vt-card::before { /* gradient ring on hover */
  content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, #7dffd6, rgba(0, 200, 150, 0) 45%, rgba(0, 200, 150, 0) 60%, #00c896);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity .3s;
}
.nx-vt-card:hover { transform: translateY(-4px); color: #fff; background: linear-gradient(180deg, rgba(0, 200, 150, .18), rgba(0, 200, 150, .04)); }
.nx-vt-card:hover::before, .nx-vt-card:focus-visible::before { opacity: 1; }
.nx-vt-art { display: grid; place-items: center; width: 100%; height: 50px; color: var(--nx-emerald); }
.nx-vt-svg { width: 76px; height: 48px; overflow: visible; transition: transform .45s var(--nx-ease); }
.nx-vt-card:hover .nx-vt-svg { transform: translateX(5px); }
.nx-vt-name { font: 700 .98rem/1.2 var(--nx-font-display); letter-spacing: -.01em; }
.nx-vt-count { font: 500 .74rem/1.2 var(--nx-font); color: var(--nx-on-dark-muted); }

@media (max-width: 600px) {
  .nx-hero-in { padding-block: 18px; }
  .nx-hero-eyebrow { font-size: .74rem; padding: 6px 12px 6px 10px; }
  .nx-hero-title { margin: 16px auto 12px; font-size: clamp(2.3rem, 11.5vw, 3.2rem); }
  .nx-hero-sub { font-size: .95rem; line-height: 1.55; }
  .nx-hero-search { margin-top: 20px; padding-left: 16px; }
  .nx-hero-search input { height: 42px; font-size: .95rem; }
  .nx-hero-cta { width: 100%; gap: 10px; margin-top: 14px; }
  .nx-hero-cta .nx-btn { flex: 1 1 0; height: 46px; padding: 0 12px; font-size: .9rem; }
  .nx-vt-hint { display: inline-flex; align-items: center; gap: 6px; }
  .nx-vt-card { width: 116px; padding: 12px 8px 10px; border-radius: 16px; gap: 4px; }
  .nx-vt-art { height: 38px; }
  .nx-vt-svg { width: 58px; height: 36px; }
  .nx-vt-name { font-size: .86rem; }
  .nx-vt-count { font-size: .68rem; }
}
/* Short phones: keep the vehicle carousel inside the first screen. */
@media (max-width: 600px) and (max-height: 720px) {
  .nx-hero-cta { display: none; }
  .nx-hero-sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}

/* ============================================================
   TRUST STRIP
   ============================================================ */
.nx-trust { background: var(--nx-surface); border-bottom: 1px solid var(--nx-line); }
.nx-trust-list { display: grid; grid-template-columns: repeat(4, 1fr); }
.nx-trust-list li { display: flex; align-items: center; gap: 12px; padding: 20px 18px; }
.nx-trust-list li + li { border-left: 1px solid var(--nx-line); }
.nx-trust-ico {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0; display: grid; place-items: center;
  background: #e5f8f0; color: var(--nx-emerald-700);
}
.nx-trust-list strong { display: block; font: 600 .9rem/1.3 var(--nx-font); color: var(--nx-text); }
.nx-trust-list small { display: block; margin-top: 2px; font: 400 .78rem/1.4 var(--nx-font); color: var(--nx-muted); }
@media (max-width: 1024px) {
  .nx-trust-list { grid-template-columns: repeat(2, 1fr); }
  .nx-trust-list li:nth-child(3) { border-left: 0; }
  .nx-trust-list li:nth-child(n+3) { border-top: 1px solid var(--nx-line); }
}
@media (max-width: 600px) {
  .nx-trust-list { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .nx-trust-list::-webkit-scrollbar { display: none; }
  .nx-trust-list li { flex: 0 0 80%; scroll-snap-align: start; border-top: 0 !important; }
  .nx-trust-list li:nth-child(3) { border-left: 1px solid var(--nx-line); }
}

/* ============================================================
   SHOP BY CATEGORY
   ============================================================ */
.nx-cats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.nx-cats > li { min-width: 0; }
.nx-cat {
  position: relative; isolation: isolate; overflow: hidden; height: 100%;
  display: flex; align-items: center; gap: 16px; padding: 20px 20px 20px 18px;
  border-radius: 20px; background: var(--nx-surface); border: 1px solid var(--nx-line);
  transition: transform .4s var(--nx-ease), box-shadow .4s var(--nx-ease), border-color .3s;
}
.nx-cat::after {
  content: ''; position: absolute; z-index: -1; right: -60px; bottom: -80px; width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 200, 150, .2), transparent 70%); opacity: 0; transition: opacity .4s;
}
.nx-cat:hover { transform: translateY(-4px); box-shadow: var(--nx-shadow); border-color: rgba(0, 165, 124, .45); }
.nx-cat:hover::after { opacity: 1; }
.nx-cat-ico {
  width: 60px; height: 60px; flex-shrink: 0; overflow: hidden; border-radius: 18px;
  display: grid; place-items: center; font-size: 1.35rem;
  background: linear-gradient(145deg, #ecfaf5, #d3f2e5); color: var(--nx-emerald-700);
  transition: transform .45s var(--nx-ease), background .3s, color .3s;
}
.nx-cat-ico img { width: 100%; height: 100%; object-fit: cover; }
.nx-cat:hover .nx-cat-ico { transform: rotate(-6deg); background: var(--nx-ink); color: var(--nx-emerald); }
.nx-cat-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.nx-cat-name { font: 700 1.02rem/1.25 var(--nx-font-display); letter-spacing: -.02em; color: var(--nx-text); }
.nx-cat-count { font: 500 .8rem/1.2 var(--nx-font); color: var(--nx-muted); }
.nx-cat-go {
  margin-left: auto; flex-shrink: 0; width: 34px; height: 34px; border-radius: 999px;
  display: grid; place-items: center; font-size: .78rem; color: var(--nx-text);
  border: 1px solid var(--nx-line); transition: all .35s var(--nx-ease);
}
.nx-cat:hover .nx-cat-go { background: var(--nx-emerald); border-color: transparent; color: var(--nx-ink); transform: rotate(-45deg); }
.nx-cat-badge { position: absolute; top: 10px; right: 10px; height: 22px; padding: 0 8px; font-size: .6rem; }
@media (max-width: 1024px) { .nx-cats { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px)  { .nx-cats { grid-template-columns: repeat(2, 1fr); gap: 12px; } }
@media (max-width: 480px) {
  .nx-cat { flex-direction: column; align-items: flex-start; gap: 12px; padding: 16px; }
  .nx-cat-ico { width: 50px; height: 50px; border-radius: 15px; font-size: 1.15rem; }
  .nx-cat-name { font-size: .95rem; }
  .nx-cat-go { display: none; }
}

/* ============================================================
   PRODUCT CAROUSELS (wrapper spacing; carousel styles in nx-core.css)
   ============================================================ */
.nx-carousels { padding-bottom: clamp(56px, 8vw, 96px); }
.nx-carousels > p:empty { display: none; }
.nx-cats-section { padding-bottom: 0; }

/* ============================================================
   BLOG
   ============================================================ */
.nx-blog-section { padding-top: 0; }
.nx-blog { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.nx-post {
  display: flex; flex-direction: column; overflow: hidden; border-radius: 22px;
  background: var(--nx-surface); border: 1px solid var(--nx-line); color: var(--nx-text);
  transition: transform .4s var(--nx-ease), box-shadow .4s var(--nx-ease);
}
.nx-post:hover { transform: translateY(-5px); box-shadow: var(--nx-shadow-lg); color: var(--nx-text); }
.nx-post-thumb {
  display: grid; place-items: center; aspect-ratio: 16 / 10; overflow: hidden;
  background: linear-gradient(150deg, var(--nx-ink-3), #0d6b51); color: var(--nx-emerald); font-size: 1.6rem;
}
.nx-post-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--nx-ease); }
.nx-post:hover .nx-post-thumb img { transform: scale(1.05); }
.nx-post-body { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px 22px; }
.nx-post-tag {
  align-self: flex-start; display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px;
  background: #e5f8f0; color: var(--nx-emerald-700); font: 700 .66rem var(--nx-font); letter-spacing: .08em; text-transform: uppercase;
}
.nx-post-title {
  font: 700 1.06rem/1.35 var(--nx-font-display); letter-spacing: -.015em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.nx-post-meta { font: 500 .8rem var(--nx-font); color: var(--nx-muted); }
@media (max-width: 1024px) {
  .nx-blog { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding-bottom: 8px; }
  .nx-blog::-webkit-scrollbar { display: none; }
  .nx-post { flex: 0 0 min(80%, 360px); scroll-snap-align: start; }
}

/* ============================================================
   FAQ
   ============================================================ */
.nx-faq-section { padding-top: 0; }
.nx-faq { display: grid; grid-template-columns: .85fr 1.15fr; gap: clamp(28px, 5vw, 72px); align-items: start; }
.nx-faq-head { position: sticky; top: calc(var(--header-height, 108px) + 24px); }
.nx-faq-cta { margin-top: 22px; }
.nx-faq-list { border-top: 1px solid var(--nx-line); }
.nx-faq-item { border-bottom: 1px solid var(--nx-line); }
.nx-faq-item summary {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 22px 4px; cursor: pointer; list-style: none;
  font: 600 1.05rem/1.4 var(--nx-font-display); letter-spacing: -.015em; color: var(--nx-text);
}
.nx-faq-item summary::-webkit-details-marker { display: none; }
.nx-faq-item summary:hover { color: var(--nx-emerald-700); }
.nx-plus { position: relative; width: 34px; height: 34px; flex-shrink: 0; border-radius: 999px; border: 1px solid var(--nx-line); transition: transform .4s var(--nx-ease), background .3s; }
.nx-plus::before, .nx-plus::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 12px; height: 1.5px; border-radius: 2px;
  background: currentColor; transform: translate(-50%, -50%);
}
.nx-plus::after { transform: translate(-50%, -50%) rotate(90deg); transition: transform .4s var(--nx-ease); }
.nx-faq-item[open] .nx-plus { background: var(--nx-ink); border-color: var(--nx-ink); color: #fff; transform: rotate(180deg); }
.nx-faq-item[open] .nx-plus::after { transform: translate(-50%, -50%) rotate(0deg); }
.nx-faq-body { padding: 0 56px 22px 4px; color: var(--nx-muted); font: 400 1rem/1.7 var(--nx-font); }
.nx-faq-body p { margin: 0 0 10px; }
@media (max-width: 1024px) { .nx-faq { grid-template-columns: 1fr; } .nx-faq-head { position: static; } .nx-faq-body { padding-right: 4px; } }

/* ============================================================
   NEWSLETTER
   ============================================================ */
.nx-news-section { padding-top: 0; }
.nx-news {
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; grid-template-columns: 1.15fr 1fr; gap: clamp(24px, 4vw, 56px); align-items: center;
  padding: clamp(32px, 6vw, 72px); border-radius: var(--nx-r-xl); color: #fff;
  background: radial-gradient(70% 90% at 100% 100%, rgba(0, 200, 150, .32), transparent 65%), var(--nx-ink);
}
.nx-news-form {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 7px; border-radius: 999px;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16);
}
.nx-news-form:focus-within { border-color: rgba(0, 200, 150, .75); box-shadow: 0 0 0 6px rgba(0, 200, 150, .15); }
.nx-news-form input {
  flex: 1; min-width: 0; height: 50px; padding: 0 16px; border: 0; outline: 0; background: none; color: #fff; font: 500 1rem var(--nx-font);
}
.nx-news-form input::placeholder { color: rgba(234, 244, 240, .5); }
.nx-news-msg { flex-basis: 100%; margin: 0; padding: 0 16px; font: 500 .88rem var(--nx-font); color: var(--nx-emerald); }
.nx-news-msg:empty { display: none; }
.nx-news-msg.is-error { color: #fca5a5; }
@media (max-width: 768px) {
  .nx-news { grid-template-columns: 1fr; }
  .nx-news-form { border-radius: 22px; }
  .nx-news-form .nx-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .nx-vt-track { scroll-behavior: auto; }
}

/* ── Rendering performance: skip layout/paint of below-the-fold sections
      until they come near the viewport (sizes are remembered after first render). */
.nx-carousels > .nx-pcarousel:not(:first-child),
.nx-blog-section, .nx-faq-section, .nx-news-section {
  content-visibility: auto;
  contain-intrinsic-size: auto 640px;
}
