/* ==========================================================================
   HomeConcept2 — mobile-first homepage concept (scoped to .hc2)
   Built to a hand-drawn sketch: compact hero > search > popular makes >
   quick chips > latest cars > why. Uses the shared design tokens; never
   touches the live Home page. RTL-safe via logical properties.
   ========================================================================== */

.hc2 { --hc2-gap: var(--space-5); }

/* Softer primary blue — concept pages only. The live site keeps the original
   electric blue (#0534ff); here we drop saturation/intensity so buttons, links
   and icons read calmer. Scoped to body.hc2-page so it covers the header too. */
body.hc2-page {
  --color-primary:       #2F539B;
  --color-primary-hover: #25427C;
  --color-primary-soft:  #EAEEF6;
  --color-focus-ring:    rgba(47, 83, 155, 0.3);
}

/* (The bigger hamburger + hidden "Menu" label that this concept used to define
   are now the shared default in layout.css, so every page matches.) */

.hc2-container {
  display: flex;
  flex-direction: column;
  gap: var(--hc2-gap);
  padding-block: 0 var(--space-7);
}

/* ── 1 ▸ Full-bleed hero banner (edge-to-edge image, text over it) ──────── */
.hc2-hero {
  position: relative;
  display: flex;
  align-items: flex-start;
  min-height: 160px;
  padding-block: var(--space-4) var(--space-6);
  overflow: hidden;
  color: var(--color-text-on-primary);
  background-image: var(--hc2-hero-image);
  background-size: cover;
  background-position: center;
}
.hc2-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(3, 14, 48, 0.20) 0%, rgba(3, 14, 48, 0.62) 100%);
}
.hc2-hero__inner { position: relative; z-index: 1; }
.hc2-hero__text { max-width: 22ch; }
.hc2-hero__title {
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}
.hc2-hero__sub {
  margin: var(--space-1) 0 0;
  font-size: var(--fs-sm);
  opacity: 0.95;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}

/* ── 2 ▸ Compact search (overlaps the bottom of the hero) ──────────────── */
.hc2-search {
  position: relative;
  z-index: 2;
  margin-top: -22px;
  margin-inline: calc(-1 * var(--space-4));
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-gray-light);
  border-inline: 0;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -4px 20px rgba(26, 35, 48, 0.10);
}
.hc2-field { display: flex; flex-direction: column; gap: var(--space-1); }
.hc2-field__label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--color-text-muted);
}

/* dropdowns */
.hc2-dd { position: relative; }
.hc2-dd__trigger {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 48px;
  padding-inline: var(--space-3);
  background: var(--color-gray-soft);
  border: 1px solid var(--color-gray-light);
  border-radius: var(--radius);
  color: var(--color-text);
  font: inherit;
  font-size: var(--fs-base);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.hc2-dd__trigger:hover { border-color: var(--color-text-faint); }
.hc2-dd__trigger:focus-visible { outline: 3px solid var(--color-focus-ring); outline-offset: 1px; }
.hc2-dd__trigger:disabled { opacity: 0.55; cursor: not-allowed; }
.hc2-dd__icon { width: 20px; height: 20px; color: var(--color-text-muted); flex: none; }
.hc2-dd__text { flex: 1; text-align: start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hc2-dd__text.is-placeholder { color: var(--color-text-muted); }
.hc2-dd__chev { width: 18px; height: 18px; color: var(--color-text-muted); flex: none; }

/* Search + Sell side by side */
.hc2-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}
.hc2-actions .btn { min-height: 50px; gap: var(--space-2); }

/* Concept 3 variant: stack the Sell button directly under the Search button. */
.hc2--stack-actions .hc2-actions { grid-template-columns: 1fr; }
.hc2-btn-search svg { width: 20px; height: 20px; }
.hc2-btn-sell { text-decoration: none; }
.hc2-btn-sell__plus { font-weight: var(--fw-bold); font-size: 1.15em; line-height: 1; }

/* Concept 4 variant: Sell lifted into its own card; lone Search fills its row. */
.hc2--sell-section .hc2-actions { grid-template-columns: 1fr; }

/* ── Sell-your-car band (Concept 4 & 5) ────────────────────────────────── */
/* No card — content sits directly in the section, on a soft brand-blue band
   so it stands out a little from the white page (not grey). */
.hc2-sell {
  margin-inline: calc(-1 * var(--space-4));
  padding: var(--space-5) var(--space-4);
  border-block: 1px solid var(--color-primary-soft);
  background: var(--color-primary-soft);
}
/* Sell band sits directly under the search panel — close the container gap so
   they butt together, and drop the doubled-up top rule. */
.hc2-search + .hc2-sell {
  margin-top: calc(-1 * var(--hc2-gap));
  border-top: 0;
}
.hc2-sell__title { margin: 0; font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--color-text); }
.hc2-sell__sub { margin: 0; color: var(--color-text-muted); font-size: var(--fs-sm); font-weight: var(--fw-regular); }
.hc2-sell__points {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}
.hc2-sell__point { display: flex; align-items: center; gap: var(--space-2); font-size: var(--fs-sm); font-weight: var(--fw-regular); color: var(--color-text-muted); }
.hc2-sell__point svg { width: 20px; height: 20px; flex: none; color: var(--color-primary); }
.hc2-sell__cta { width: 100%; min-height: 50px; gap: var(--space-2); margin-top: var(--space-1); text-decoration: none; border-color: rgba(47, 83, 155, 0.3); }
.hc2-sell__cta .hc2-btn-sell__plus { font-weight: var(--fw-bold); font-size: 1.15em; line-height: 1; }

/* More filters */
.hc2-morerow { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.hc2-reset {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: none;
  border: 0;
  color: var(--color-text-muted);
  font: inherit;
  font-weight: var(--fw-medium);
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.hc2-reset:hover { color: var(--color-text); }
.hc2-reset:hover svg { transform: rotate(-45deg); }
.hc2-reset:focus-visible { outline: 3px solid var(--color-focus-ring); outline-offset: 1px; }
.hc2-reset svg { width: 16px; height: 16px; transition: transform var(--transition); }
.hc2-more {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: none;
  border: 0;
  color: var(--color-primary);
  font: inherit;
  font-weight: var(--fw-medium);
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.hc2-more:hover { background: none; color: var(--color-primary-hover); }
.hc2-more:hover svg { transform: scale(1.05); }
.hc2-more:focus-visible { outline: 3px solid var(--color-focus-ring); outline-offset: 1px; }
.hc2-more svg { width: 18px; height: 18px; transition: transform var(--transition); }
.hc2-more__count {
  min-width: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
  color: var(--color-text-on-primary);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  line-height: 20px;
  text-align: center;
}

/* ── shared block heads ────────────────────────────────────────────────── */
.hc2-block { display: flex; flex-direction: column; gap: var(--space-3); }
.hc2-block__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); }
.hc2-block__title { margin: 0; font-size: var(--fs-md); font-weight: var(--fw-bold); }
.hc2-viewall, .hc2-empty .hc2-viewall {
  color: var(--color-primary);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  text-decoration: none;
}
.hc2-viewall:hover { text-decoration: underline; }

/* ── 4 ▸ Quick chips (horizontal scroll) ───────────────────────────────── */
.hc2-chips {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  scrollbar-width: none;
  padding-block: var(--space-1);
}
.hc2-chips::-webkit-scrollbar { display: none; }
.hc2-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 40px;
  padding: 0 var(--space-3) 0 var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  border: 1px solid var(--color-gray-light);
  color: var(--color-text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  text-decoration: none;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.hc2-chip__icon { width: 16px; height: 16px; color: var(--color-primary); flex: none; }
.hc2-chip:hover {
  background: var(--color-gray-soft);
  border-color: var(--color-text-faint);
  box-shadow: var(--shadow);
}

/* ── 5 ▸ Latest cars ───────────────────────────────────────────────────── */
.hc2-cars {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}
.hc2-empty { color: var(--color-text-muted); font-size: var(--fs-sm); }

/* ── 6 ▸ Why FindMotos (small) ─────────────────────────────────────────── */
.hc2-why { gap: var(--space-3); }
.hc2-why__title { text-align: center; }
.hc2-why__list {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}
.hc2-why__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius);
  background: var(--color-gray-soft);
  text-align: center;
  font-size: var(--fs-sm);
}
.hc2-why__item svg { width: 24px; height: 24px; color: var(--color-primary); }

/* ── More Filters: bottom sheet (mobile) ───────────────────────────────── */
.hc2-drawer {
  position: fixed;
  inset: 0;
  z-index: var(--z-sheet);
  display: flex;
  align-items: flex-end;
  background: rgba(26, 35, 48, 0.45);
  animation: hc2BackdropIn 0.28s ease both;
  /* Lift the sheet above the on-screen keyboard (see keyboard-inset.js). */
  padding-bottom: var(--kb-inset, 0px);
}
.hc2-drawer[hidden] { display: none; }
.hc2-drawer__panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 88vh;
  /* Never taller than the space left above the keyboard. */
  max-height: min(88dvh, calc(100dvh - var(--kb-inset, 0px)));
  background: var(--color-surface);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow-lg);
  will-change: transform;
  animation: hc2SheetUp 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes hc2BackdropIn { from { background-color: rgba(26, 35, 48, 0); } to { background-color: rgba(26, 35, 48, 0.45); } }
@keyframes hc2SheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes hc2DrawerInRight { from { transform: translateX(24px); opacity: 0.6; } to { transform: translateX(0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .hc2-drawer, .hc2-drawer__panel { animation: none !important; }
}
.hc2-drawer__head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-gray-light);
}
.hc2-drawer__head h3 { margin: 0; flex: 1; font-size: var(--fs-md); }
.hc2-drawer__clear {
  background: none; border: 0; color: var(--color-primary);
  font: inherit; font-weight: var(--fw-medium); cursor: pointer;
}
.hc2-drawer__x {
  display: grid; place-items: center;
  width: 36px; height: 36px;
  background: var(--color-gray-soft); border: 0; border-radius: var(--radius);
  color: var(--color-text); cursor: pointer;
}
.hc2-drawer__x svg { width: 18px; height: 18px; }
.hc2-drawer__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-4);
  overflow-y: auto;
}
.hc2-fgroup { display: flex; flex-direction: column; gap: var(--space-3); }
.hc2-fgroup h4 { margin: 0; font-size: var(--fs-sm); color: var(--color-text-muted); font-weight: var(--fw-medium); }
.hc2-fchips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.hc2-fchip {
  min-height: 40px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--color-gray-soft);
  border: 1px solid var(--color-gray-light);
  color: var(--color-text);
  font: inherit; font-size: var(--fs-sm);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.hc2-fchip:hover { border-color: var(--color-text-faint); }
.hc2-fchip.is-active {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
  color: var(--color-primary);
  font-weight: var(--fw-medium);
}
.hc2-frow { display: flex; align-items: center; gap: var(--space-3); }
.hc2-fselect { flex: 1; min-height: 44px; }
.hc2-frow__sep { color: var(--color-text-muted); font-size: var(--fs-sm); }
.hc2-drawer__foot {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--space-3);
  padding: var(--space-4);
  border-top: 1px solid var(--color-gray-light);
}

/* ── Make / Model searchable picker (reuses the .hc2-drawer bottom sheet) ── */
/* Pin the picker panel to a stable height. Without this, the panel is sized to
   its content and bottom-anchored (align-items:flex-end), so filtering the list
   as you type shrinks the panel and drags the search box downward — a jumpy
   feel. Fixing the height keeps the head + search box still; the list takes the
   remaining space and scrolls internally instead. */
.hc2-picker .hc2-drawer__panel {
  height: min(88dvh, calc(100dvh - var(--kb-inset, 0px)));
}
.hc2-picker__search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-4) var(--space-4) 0;
  padding-inline: var(--space-3);
  min-height: 44px;
  background: var(--color-gray-soft);
  border: 1px solid var(--color-gray-light);
  border-radius: var(--radius);
}
.hc2-picker__search:focus-within { border-color: var(--color-primary); }
.hc2-picker__search svg { width: 18px; height: 18px; color: var(--color-text-muted); flex: none; }
.hc2-picker__search input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: none;
  font: inherit;
  font-size: var(--fs-base);
  color: var(--color-text);
}
.hc2-picker__list {
  list-style: none;
  margin: 0;
  padding: var(--space-2) var(--space-2) var(--space-4);
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.hc2-picker__item {
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: var(--fs-base);
  cursor: pointer;
}
.hc2-picker__item:hover { background: var(--color-gray-soft); }
.hc2-picker__item:focus-visible { outline: 3px solid var(--color-focus-ring); outline-offset: -2px; }
.hc2-picker__item.is-active {
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-weight: var(--fw-medium);
}
.hc2-picker__item.is-empty { color: var(--color-text-muted); cursor: default; }
.hc2-picker__item.is-empty:hover { background: none; }

/* ── Tablet (768–1023) ─────────────────────────────────────────────────── */
@media (min-width: 768px) {
  .hc2-hero { min-height: 220px; }
  .hc2-hero__title { font-size: var(--fs-xl); }
  .hc2-search {
    margin-top: -32px;
    margin-inline: 0;
    border-inline: 1px solid var(--color-gray-light);
    border-radius: 22px 22px var(--radius) var(--radius);
  }
  .hc2-sell { margin-inline: 0; padding-inline: 0; }
  .hc2-cars { grid-template-columns: 1fr 1fr; }
}

/* ── Desktop (1024+) — wider banner, centered search panel ─────────────── */
@media (min-width: 1024px) {
  .hc2-hero {
    min-height: 320px;
    padding-block: var(--space-6) var(--space-8);
  }
  .hc2-hero__title { font-size: var(--fs-2xl); }
  .hc2-hero__sub { font-size: var(--fs-md); }

  .hc2-container { padding-block: 0 var(--space-9); }

  /* search becomes a wide horizontal panel overlapping the banner */
  .hc2-search {
    margin-top: -48px;
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    grid-template-areas:
      "make   model  actions"
      "more   more   more";
    gap: var(--space-4);
    align-items: end;
    padding: var(--space-5);
  }
  .hc2-search > .hc2-field:nth-of-type(1) { grid-area: make; }
  .hc2-search > .hc2-field:nth-of-type(2) { grid-area: model; }
  .hc2-actions { grid-area: actions; grid-template-columns: auto auto; }
  .hc2-morerow { grid-area: more; justify-content: flex-start; }

  .hc2-search + .hc2-sell {
    margin-top: 0;
    border-top: 1px solid rgba(47, 83, 155, 0.14);
  }

  .hc2-sell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: var(--space-5);
    padding: var(--space-4) var(--space-5);
    border: 1px solid rgba(47, 83, 155, 0.14);
    border-radius: var(--radius);
    background: #F7F9FD;
  }
  .hc2-sell__points {
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-top: var(--space-2);
  }
  .hc2-sell__cta {
    width: auto;
    min-width: 180px;
    margin-top: 0;
    align-self: center;
  }

  .hc2-cars { grid-template-columns: repeat(3, 1fr); }
  .hc2-why__list { max-width: 720px; margin-inline: auto; }
}

@media (min-width: 1024px) {
  /* More Filters becomes a compact desktop popover; mobile keeps the sheet. */
  .hc2-drawer {
    align-items: flex-start;
    justify-content: flex-start;
    background: transparent;
    animation: none;
    padding-bottom: 0;
  }
  .hc2-drawer__panel {
    position: fixed;
    top: var(--hc2-filter-top, var(--space-7));
    left: var(--hc2-filter-left, var(--space-4));
    width: var(--hc2-filter-width, 640px);
    max-width: calc(100vw - (var(--space-4) * 2));
    max-height: min(620px, calc(100vh - var(--hc2-filter-top, var(--space-7)) - var(--space-4)));
    border: 1px solid var(--color-gray-light);
    border-radius: var(--radius);
    box-shadow: 0 14px 36px rgba(26, 35, 48, 0.16);
    animation: hc2DropdownIn 0.14s ease both;
  }
  .hc2-drawer__head {
    padding: var(--space-3) var(--space-4);
  }
  .hc2-drawer__body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: var(--space-4);
    padding: var(--space-4);
  }
  .hc2-drawer__foot {
    grid-template-columns: auto auto;
    justify-content: flex-end;
    padding: var(--space-3) var(--space-4);
  }
  .hc2-fgroup {
    gap: var(--space-2);
  }
  .hc2-fchip {
    min-height: 36px;
  }

  .hc2-picker {
    background: transparent;
    animation: none;
    pointer-events: none;
    padding-bottom: 0;
  }
  .hc2-picker .hc2-drawer__panel {
    position: fixed;
    top: var(--hc2-picker-top, 0);
    left: var(--hc2-picker-left, 0);
    width: var(--hc2-picker-width, 320px);
    max-width: min(420px, calc(100vw - (var(--space-4) * 2)));
    height: auto;
    max-height: 360px;
    border: 1px solid var(--color-gray-light);
    border-radius: var(--radius);
    box-shadow: 0 12px 32px rgba(26, 35, 48, 0.16);
    pointer-events: auto;
    animation: hc2DropdownIn 0.14s ease both;
  }
  .hc2-picker .hc2-drawer__head { display: none; }
  .hc2-picker__search {
    margin: var(--space-2);
    min-height: 40px;
    background: var(--color-surface);
  }
  .hc2-picker__list {
    max-height: 290px;
    padding: 0 var(--space-2) var(--space-2);
  }
  .hc2-picker__item {
    padding: var(--space-2) var(--space-3);
    font-size: var(--fs-sm);
  }
}

@keyframes hc2DropdownIn { from { transform: translateY(-4px); opacity: 0.75; } to { transform: translateY(0); opacity: 1; } }
