/* =========================================================================
   JapanBuySell — component layer
   Plain CSS that backs the Tailwind utility markup. The Tailwind Play CDN
   (configured in header.php) provides the utilities + design tokens; this file
   defines the named components (.btn, .chip, .field, …) and the JS-driven
   states (overlays, favourites, gallery, grid/list view).
   ========================================================================= */

:root {
  --brand-600: #e8121a;
  --brand-700: #c20d14;
  --brand-50:  #fff1f1;
}

/* ---------- Global polish: smoothing, selection, focus ---------- */
html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
::selection { background: rgba(232,18,26,.16); color: #0f172a; }
/* One consistent, premium keyboard-focus ring (pointer clicks stay clean). */
a:focus-visible, button:focus-visible, [tabindex]:focus-visible, summary:focus-visible {
  outline: 2px solid var(--brand-600);
  outline-offset: 2px;
  border-radius: .5rem;
}
a { transition: color .15s ease; }
img { -webkit-user-drag: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font-weight: 600;
  font-size: .875rem;
  line-height: 1.1;
  letter-spacing: -.005em;
  padding: .625rem 1.05rem;
  border-radius: .75rem;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease, box-shadow .2s ease, transform .2s ease;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary {
  background: var(--brand-600);
  color: #fff;
  box-shadow: 0 1px 2px rgba(15,23,42,.08), 0 6px 16px -4px rgba(232,18,26,.45);
}
.btn-primary:hover { background: var(--brand-700); color: #fff; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(15,23,42,.08), 0 12px 24px -6px rgba(232,18,26,.5); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost { background: #fff; color: #0f172a; box-shadow: inset 0 0 0 1px #e2e8f0; }
.btn-ghost:hover { background: #f8fafc; box-shadow: inset 0 0 0 1px #cbd5e1; }
.btn-sm { padding: .5rem .8rem; font-size: .8125rem; border-radius: .625rem; }
.btn-lg { padding: .85rem 1.35rem; font-size: .95rem; border-radius: .875rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; box-shadow: none; transform: none; }

/* ---------- Chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .5rem .875rem;
  border-radius: 9999px;
  background: #fff;
  box-shadow: inset 0 0 0 1px #e2e8f0;
  color: #334155;
  font-size: .8125rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.chip:hover { background: #f8fafc; }
.chip.active,
.chip[aria-pressed="true"],
.chip:has(input:checked) {
  background: var(--brand-600);
  color: #fff;
  box-shadow: inset 0 0 0 1px var(--brand-600);
}

/* ---------- Form fields ---------- */
.field {
  width: 100%;
  background: #fff;
  color: #0f172a;
  border: 0;
  box-shadow: inset 0 0 0 1px #e2e8f0;
  border-radius: .75rem;
  padding: .6875rem .875rem;
  font-size: .875rem;
  line-height: 1.4;
  transition: box-shadow .15s ease, background-color .15s ease;
  -webkit-appearance: none;
  appearance: none;
}
.field::placeholder { color: #94a3b8; }
.field:hover { box-shadow: inset 0 0 0 1px #cbd5e1; }
.field:focus { outline: none; box-shadow: inset 0 0 0 1px var(--brand-600), 0 0 0 3px rgba(232,18,26,.14); }
select.field {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .625rem center;
  padding-right: 2.25rem;
}

.label {
  display: block;
  font-size: .75rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: .375rem;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .2rem .5rem;
  border-radius: .5rem;
  font-size: .6875rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .01em;
}

/* ---------- Listing cards ---------- */
/* The card lift/shadow is handled by the template's Tailwind hover utilities;
   here we add the premium slow image-zoom the markup can't express on its own. */
.listing-card { position: relative; }
.listing-photo { display: block; overflow: hidden; }
.listing-photo img { transition: transform .5s cubic-bezier(.4,0,.2,1); }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .listing-card:hover .listing-photo img { transform: scale(1.06); }
}

/* List-view layout (toggled on the .results container). */
.results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
@media (min-width: 640px) { .results { gap: 1rem; } }
@media (min-width: 1024px) {
  .results[data-mode="grid"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.results[data-mode="list"] { grid-template-columns: 1fr; gap: .75rem; }
.results[data-mode="list"] .listing-card {
  display: grid;
  grid-template-columns: 34% 1fr;
  align-items: stretch;
}
.results[data-mode="list"] .listing-photo {
  aspect-ratio: auto !important;
  height: 100%;
  min-height: 9rem;
}
@media (min-width: 640px) {
  .results[data-mode="list"] .listing-card { grid-template-columns: 240px 1fr; }
}

/* ---------- Favourite (save) toggle ---------- */
.fav { transition: color .15s ease, transform .15s ease; }
.fav:active { transform: scale(.9); }
.fav.is-saved { color: var(--brand-600); }
.fav.is-saved svg { fill: var(--brand-600); stroke: var(--brand-600); }

/* ---------- Decorative photo placeholders ---------- */
.car-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  background: center / 42% no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffffff'%3E%3Cpath d='M18.92 6.01C18.72 5.42 18.16 5 17.5 5h-11c-.66 0-1.21.42-1.42 1.01L3 12v8c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-1h12v1c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-8l-2.08-5.99zM6.5 16c-.83 0-1.5-.67-1.5-1.5S5.67 13 6.5 13s1.5.67 1.5 1.5S7.33 16 6.5 16zm11 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zM5 11l1.5-4.5h11L19 11H5z'/%3E%3C/svg%3E");
  opacity: .16;
  pointer-events: none;
}
.car-mark.sm::after { background-size: 58%; }

/* Subtle moving gloss; only animates when motion is allowed. */
.sheen::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 38%, rgba(255,255,255,.22) 48%, transparent 58%);
  transform: translateX(-120%);
  pointer-events: none;
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .listing-card:hover .sheen::before,
  [data-gallery-main].sheen::before { animation: jpsSheen 1.1s ease forwards; }
  [data-gallery-main].sheen:hover::before { animation: jpsSheen 1.1s ease forwards; }
}
@keyframes jpsSheen { to { transform: translateX(120%); } }

/* ---------- Utilities the design relies on ---------- */
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }

.mb-nav { margin-bottom: 4.75rem; }
@media (min-width: 1024px) { .mb-nav { margin-bottom: 0; } }

.pb-safe { padding-bottom: env(safe-area-inset-bottom, 0px); }

/* ---------- Overlays (mobile search + filter drawer) ---------- */
.overlay { will-change: opacity; }
.overlay-backdrop { transition: opacity .25s ease; }
.overlay-panel { transition: transform .3s cubic-bezier(.4, 0, .2, 1); }
.overlay.is-open .overlay-backdrop { opacity: 1; }
.overlay.is-open .overlay-panel { transform: translate(0, 0) !important; }
body.jps-no-scroll { overflow: hidden; }

/* ---------- Minimal prose (typography plugin isn't bundled with the CDN) ---------- */
.prose :where(p, ul, ol) { margin: 0 0 1rem; }
.prose :where(h2) { font-size: 1.5rem; font-weight: 800; margin: 1.5rem 0 .75rem; letter-spacing: -.01em; }
.prose :where(h3) { font-size: 1.25rem; font-weight: 700; margin: 1.25rem 0 .5rem; }
.prose :where(ul) { list-style: disc; padding-left: 1.25rem; }
.prose :where(ol) { list-style: decimal; padding-left: 1.25rem; }
.prose :where(a) { color: var(--brand-600); text-decoration: underline; }
.prose :where(img) { border-radius: .75rem; }
.prose :where(strong) { font-weight: 700; color: #0f172a; }

/* WordPress alignment + caption helpers for page/post content. */
.aligncenter { display: block; margin-left: auto; margin-right: auto; }
.alignright { float: right; margin: 0 0 1rem 1.5rem; }
.alignleft { float: left; margin: 0 1.5rem 1rem 0; }
.wp-caption-text { font-size: .8125rem; color: #64748b; margin-top: .375rem; }
