/* Surface, line and marker tokens mirror the map popup card in map.css so the two
   widgets read as one product. Keep both files in step when either theme moves. */
:root {
  color-scheme: light;
  --ink: #18201d;
  --muted: #5a665f;
  --support: #3f4b45;
  --line: rgba(24, 32, 29, 0.14);
  --surface: #fff;
  --surface-hover: #f8fbf8;
  --media-surface: #dfe5df;
  --media-gradient: linear-gradient(135deg, rgba(37, 111, 87, 0.14), rgba(217, 111, 50, 0.08));
  --accent: #256f57;
  --accent-hover: #1f5e4a;
  --accent-2: #d96f32;
  --focus: rgba(37, 111, 87, 0.42);
  --danger: #7f1d1d;
  --danger-line: rgba(185, 28, 28, 0.28);
  --marker-body: #fff;
  --marker-border: rgba(0, 0, 0, 0.08);
  --marker-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  --card-shadow:
    0 1px 2px rgba(17, 24, 39, 0.06),
    0 6px 16px rgba(17, 24, 39, 0.1);
  --card-shadow-hover:
    0 2px 4px rgba(17, 24, 39, 0.07),
    0 12px 24px rgba(17, 24, 39, 0.16);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="clear"] {
  --ink: #1c2d27;
  --muted: #607169;
  --support: #384a43;
  --line: rgba(34, 65, 53, 0.2);
  --surface: #f4f8f1;
  --surface-hover: #eef5ea;
  --media-surface: #dce6dc;
  --media-gradient: linear-gradient(135deg, rgba(37, 111, 87, 0.16), rgba(217, 111, 50, 0.1));
  --marker-body: #f4f8f1;
  --marker-border: rgba(34, 65, 53, 0.18);
  --marker-shadow: 0 2px 6px rgba(26, 55, 43, 0.2);
  --card-shadow:
    0 1px 2px rgba(26, 55, 43, 0.07),
    0 6px 16px rgba(26, 55, 43, 0.12);
  --card-shadow-hover:
    0 2px 4px rgba(26, 55, 43, 0.08),
    0 12px 24px rgba(26, 55, 43, 0.18);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  min-width: 0;
  margin: 0;
}

body {
  overflow: hidden;
  color: var(--ink);
  background: transparent;
}

button {
  font: inherit;
}

.carousel-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 1152px;
  min-width: 0;
  height: 350px;
  margin: 0 auto;
  padding: 8px 16px 6px;
}

.carousel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
}

.carousel-brand {
  display: inline-flex;
  align-items: center;
  width: 96px;
  height: 28px;
  border-radius: 6px;
}

.carousel-brand:focus-visible,
.carousel-control:focus-visible,
.carousel-card-hitbox:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.carousel-brand img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left center;
}

.carousel-controls {
  display: flex;
  gap: 6px;
}

.carousel-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
}

.carousel-control:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--card-shadow-hover);
}

.carousel-control:disabled {
  cursor: default;
  opacity: 0.36;
}

.carousel-control svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.carousel-message {
  align-self: start;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: var(--surface);
  font-size: 13px;
  line-height: 1.4;
}

.carousel-error {
  color: var(--danger);
  border-color: var(--danger-line);
}

.carousel-error button {
  margin-left: 8px;
  padding: 4px 9px;
  border: 1px solid var(--danger-line);
  border-radius: 999px;
  color: var(--danger);
  background: var(--surface);
  cursor: pointer;
}

.carousel-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 268px;
  gap: 16px;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0 14px;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}

.carousel-rail::-webkit-scrollbar {
  display: none;
}

.carousel-card {
  min-width: 0;
  height: 278px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--card-shadow);
  scroll-snap-align: start;
  transition:
    background-color 180ms ease,
    box-shadow 220ms ease,
    transform 220ms ease;
}

.carousel-card-hitbox {
  display: grid;
  grid-template-rows: 168px minmax(0, 1fr);
  gap: 9px;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

.carousel-card:hover,
.carousel-card:focus-within {
  background: var(--surface-hover);
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
}

/* The media sits inside the card padding, the way the map popup insets its
   thumbnail, so the photo reads as mounted rather than as the card's top edge. */
.carousel-card-media {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 10px;
  background: var(--media-surface);
}

.carousel-card-media.is-empty {
  background: var(--media-gradient), var(--media-surface);
}

.carousel-card-media::after {
  content: "";
  position: absolute;
  inset: -18% -85%;
  z-index: 1;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.26) 50%, transparent 60%);
  opacity: 0;
  transform: translateX(-48%);
  transition:
    opacity 220ms ease,
    transform 560ms cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.carousel-card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.carousel-card:hover .carousel-card-media img,
.carousel-card:focus-within .carousel-card-media img {
  transform: scale(1.035);
}

.carousel-card:hover .carousel-card-media::after,
.carousel-card:focus-within .carousel-card-media::after {
  opacity: 1;
  transform: translateX(48%);
}

.carousel-card-body {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 0 2px;
}

.carousel-card-meta,
.carousel-card-title,
.carousel-card-rating,
.carousel-card-details,
.carousel-card-price {
  margin: 0;
}

.carousel-card-header {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-height: 12px;
}

/* Same eyebrow treatment as .rw-popup-meta on the map card. */
.carousel-card-meta {
  overflow: hidden;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.carousel-card-rating {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.2;
  white-space: nowrap;
}

.carousel-card-title {
  display: -webkit-box;
  overflow: hidden;
  min-width: 0;
  margin-top: 5px;
  font-size: 14px;
  font-weight: 760;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* Pinned to the foot of the body so short titles do not leave a gap below. */
.carousel-card-details {
  overflow: hidden;
  margin-top: auto;
  padding-top: 4px;
  color: var(--support);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The map's price marker body, minus the tail that pins it to a coordinate. */
.carousel-card-price {
  position: absolute;
  z-index: 2;
  bottom: 8px;
  left: 8px;
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  max-width: calc(100% - 16px);
  height: 28px;
  padding: 0 11px;
  border: 1px solid var(--marker-border);
  border-radius: 999px;
  color: var(--ink);
  background: var(--marker-body);
  box-shadow: var(--marker-shadow);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.carousel-card-price-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 520px) {
  .carousel-shell {
    padding-inline: 12px;
  }

  .carousel-rail {
    grid-auto-columns: min(280px, calc(100% - 48px));
    gap: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .carousel-rail {
    scroll-behavior: auto;
  }

  .carousel-card,
  .carousel-control,
  .carousel-card-media img,
  .carousel-card-media::after {
    transition: none;
  }

  .carousel-card:hover,
  .carousel-card:focus-within {
    transform: none;
  }

  .carousel-card:hover .carousel-card-media img,
  .carousel-card:focus-within .carousel-card-media img {
    transform: none;
  }

  .carousel-card:hover .carousel-card-media::after,
  .carousel-card:focus-within .carousel-card-media::after {
    opacity: 0;
  }
}
