/* ==========================================================================
   Asherfield — Listing Detail Page
   ========================================================================== */

:root {
  --ash-d-text:    #10231f;
  --ash-d-muted:   #666;
  --ash-d-subtle:  #999;
  --ash-d-border:  #e8e7e0;
  --ash-d-surface: #faf9f5;
  --ash-d-ring:    #10231f;
  --ash-d-green:   #1a6035;
  --ash-d-amber:   #7a4a10;
  --ash-d-red:     #a02020;
  --ash-d-radius:  8px;
}

/* ── Page shell ─────────────────────────────────────────────────────────── */
.ash-detail-page {
  background: #fff;
  padding: 24px 0 60px;
}

.ash-detail-wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Shared button styles ───────────────────────────────────────────────── */
.ash-detail-page .ash-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: 1.5px solid transparent;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.ash-detail-page .ash-btn--primary {
  background: var(--ash-d-ring);
  border-color: var(--ash-d-ring);
  color: #fff;
}

.ash-detail-page .ash-btn--primary:hover {
  background: #1d3d37;
  border-color: #1d3d37;
  color: #fff;
}

.ash-detail-page .ash-btn--ghost {
  background: transparent;
  border-color: var(--ash-d-border);
  color: var(--ash-d-text);
}

.ash-detail-page .ash-btn--ghost:hover {
  background: var(--ash-d-surface);
}

.ash-detail-page .ash-btn--disabled {
  background: #e8e7e0;
  border-color: #e8e7e0;
  color: var(--ash-d-muted);
  cursor: default;
  pointer-events: none;
}

.ash-detail-page .ash-btn--lg {
  padding: 13px 24px;
  font-size: 0.9375rem;
}

.ash-detail-page .ash-btn--small {
  padding: 6px 12px;
  font-size: 0.8125rem;
}

.ash-detail-page .ash-btn--full {
  width: 100%;
}

/* ── Breadcrumb ─────────────────────────────────────────────────────────── */
.ash-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--ash-d-muted);
  margin-bottom: 24px;
}

.ash-breadcrumb__link {
  color: var(--ash-d-muted);
  text-decoration: none;
}

.ash-breadcrumb__link:hover {
  color: var(--ash-d-text);
  text-decoration: underline;
}

.ash-breadcrumb__sep {
  color: var(--ash-d-border);
  font-size: 0.75rem;
}

.ash-breadcrumb__current {
  color: var(--ash-d-text);
  font-weight: 500;
}

/* ── Hero ───────────────────────────────────────────────────────────────── */
.ash-detail-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
  margin-bottom: 48px;
}

/* ── Gallery ────────────────────────────────────────────────────────────── */
.ash-detail-gallery {
  position: sticky;
  top: 24px;
}

.ash-gallery-main {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--ash-d-surface);
  border-radius: var(--ash-d-radius);
  overflow: hidden;
  margin-bottom: 10px;
}

.ash-gallery-main__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.15s;
}

.ash-gallery-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ash-gallery-thumb {
  width: 64px;
  height: 64px;
  border: 2px solid var(--ash-d-border);
  border-radius: 5px;
  overflow: hidden;
  padding: 0;
  background: none;
  cursor: pointer;
  transition: border-color 0.15s;
  flex-shrink: 0;
}

.ash-gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ash-gallery-thumb:hover,
.ash-gallery-thumb.is-active {
  border-color: var(--ash-d-ring);
}

.ash-gallery-empty {
  aspect-ratio: 4 / 3;
  background: var(--ash-d-surface);
  border-radius: var(--ash-d-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ash-d-subtle);
  font-size: 0.875rem;
}

/* ── Info panel ─────────────────────────────────────────────────────────── */
.ash-detail-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ash-detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ash-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.ash-badge--type {
  background: #f0efe8;
  color: #5a5a4a;
}

.ash-badge--avail-available { background: #e6f4ec; color: var(--ash-d-green); }
.ash-badge--avail-pending   { background: #fef6e4; color: var(--ash-d-amber); }
.ash-badge--avail-sold      { background: #f4e6e6; color: var(--ash-d-red); }

.ash-detail-title {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ash-d-text);
  margin: 0;
}

.ash-detail-price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ash-d-text);
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.ash-detail-retail {
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--ash-d-muted);
  text-decoration: line-through;
}

.ash-detail-location {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.875rem;
  color: var(--ash-d-muted);
}

.ash-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.ash-detail-neighborhood {
  color: var(--ash-d-subtle);
}

.ash-detail-excerpt {
  font-size: 0.9375rem;
  color: var(--ash-d-muted);
  line-height: 1.6;
  margin: 0;
}

.ash-detail-cta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 8px;
}

/* ── Description ────────────────────────────────────────────────────────── */
.ash-detail-description {
  border-top: 1px solid var(--ash-d-border);
  padding-top: 40px;
  margin-bottom: 40px;
}

.ash-detail-description h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 16px;
  color: var(--ash-d-text);
}

.ash-detail-description__body {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--ash-d-text);
  max-width: 680px;
}

.ash-detail-description__body p {
  margin: 0 0 1em;
}

/* ── Lower: details + sidebar ───────────────────────────────────────────── */
.ash-detail-lower {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 48px;
  align-items: start;
  border-top: 1px solid var(--ash-d-border);
  padding-top: 40px;
}

/* ── Spec list ──────────────────────────────────────────────────────────── */
.ash-detail-specs h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 20px;
  color: var(--ash-d-text);
}

.ash-spec-list {
  margin: 0 0 28px;
  padding: 0;
}

.ash-spec-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--ash-d-border);
  font-size: 0.875rem;
}

.ash-spec-row:first-child {
  border-top: 1px solid var(--ash-d-border);
}

.ash-spec-row dt {
  color: var(--ash-d-muted);
  font-weight: 500;
}

.ash-spec-row dd {
  margin: 0;
  color: var(--ash-d-text);
}

/* ── Tag groups ─────────────────────────────────────────────────────────── */
.ash-tag-group {
  margin-bottom: 20px;
}

.ash-tag-group__label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ash-d-muted);
  margin-bottom: 8px;
}

.ash-tag-group__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ash-tag {
  display: inline-block;
  padding: 4px 10px;
  background: var(--ash-d-surface);
  border: 1px solid var(--ash-d-border);
  border-radius: 20px;
  font-size: 0.8125rem;
  color: var(--ash-d-text);
}

/* ── Sidebar cards ──────────────────────────────────────────────────────── */
.ash-sidebar-card {
  background: var(--ash-d-surface);
  border: 1px solid var(--ash-d-border);
  border-radius: var(--ash-d-radius);
  padding: 20px;
  margin-bottom: 16px;
}

.ash-sidebar-card h3 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ash-d-muted);
  margin: 0 0 14px;
}

/* Logistics */
.ash-logistics-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 0.875rem;
}

.ash-logistics-list li {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ash-logistics-label {
  font-weight: 500;
  color: var(--ash-d-text);
}

.ash-logistics-sub {
  color: var(--ash-d-muted);
  font-size: 0.8125rem;
}

.ash-logistics-notes {
  color: var(--ash-d-muted);
  font-size: 0.8125rem;
  font-style: italic;
}

/* Seller card */
.ash-seller-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.ash-seller-avatar {
  border-radius: 50%;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  background: var(--ash-d-border);
}

.ash-seller-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--ash-d-text);
}

.ash-seller-since {
  font-size: 0.8rem;
  color: var(--ash-d-muted);
  margin-top: 2px;
}

/* ── Booking slots ──────────────────────────────────────────────────────── */
.ash-detail-slots {
  margin-top: 48px;
  border-top: 1px solid var(--ash-d-border);
  padding-top: 40px;
}

.ash-detail-slots h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 20px;
  color: var(--ash-d-text);
}

.ash-slot-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 640px;
}

.ash-slot-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--ash-d-surface);
  border: 1px solid var(--ash-d-border);
  border-radius: var(--ash-d-radius);
  font-size: 0.875rem;
  flex-wrap: wrap;
}

.ash-slot-time {
  font-weight: 500;
  color: var(--ash-d-text);
  flex: 1 1 auto;
}

.ash-slot-location,
.ash-slot-notes {
  color: var(--ash-d-muted);
  font-size: 0.8125rem;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .ash-detail-hero {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .ash-detail-gallery {
    position: static;
  }

  .ash-detail-lower {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  /* Sidebar moves above specs on mobile */
  .ash-detail-sidebar {
    order: -1;
  }
}

@media (max-width: 600px) {
  .ash-detail-wrap {
    padding: 0 16px;
  }

  .ash-detail-title {
    font-size: 1.375rem;
  }

  .ash-detail-price {
    font-size: 1.25rem;
  }

  .ash-gallery-thumb {
    width: 52px;
    height: 52px;
  }

  .ash-spec-row {
    grid-template-columns: 120px 1fr;
  }

  .ash-slot-item {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ==========================================================================
   Phase 8 — Mobile / UX polish
   ========================================================================== */

/* ── Safe-area insets for notched phones ─────────────────────────────────── */

.ash-detail-page {
  padding-bottom: max(60px, calc(env(safe-area-inset-bottom) + 40px));
}

.ash-detail-wrap {
  padding-left:  max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}

/* ── Touch target floor on CTA buttons ──────────────────────────────────── */

.ash-detail-page .ash-btn {
  min-height: 44px;
}

.ash-detail-page .ash-btn--lg {
  min-height: 52px;
}

/* ── Gallery thumbs: horizontal scroll on small screens ─────────────────── */
/* Prevents wrapping into multiple rows when there are 4+ images.             */

@media (max-width: 600px) {
  .ash-gallery-thumbs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    padding-bottom: 4px; /* room for scrollbar on Android */
    /* Hide scrollbar visually while keeping it functional */
    scrollbar-width: none;
  }

  .ash-gallery-thumbs::-webkit-scrollbar {
    display: none;
  }

  .ash-gallery-thumb {
    scroll-snap-align: start;
    flex-shrink: 0;
  }

  /* Sidebar CTA full-width on mobile */
  .ash-sidebar-card .ash-btn--full {
    min-height: 52px;
    font-size: 1rem;
  }

  /* Slot request button: full width on small screens */
  .ash-slot-item .ash-btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }
}

/* ── Very small screens (≤ 375 px) ──────────────────────────────────────── */

@media (max-width: 375px) {
  .ash-detail-wrap {
    padding: 0 12px;
  }

  .ash-detail-title {
    font-size: 1.25rem;
  }

  .ash-detail-price {
    font-size: 1.125rem;
  }

  .ash-spec-row {
    grid-template-columns: 100px 1fr;
    font-size: 0.8125rem;
  }
}

/* ── focus-visible on gallery thumbnails ────────────────────────────────── */

.ash-gallery-thumb:focus:not(:focus-visible) {
  outline: none;
}

.ash-gallery-thumb:focus-visible {
  outline: 2px solid var(--ash-d-ring);
  outline-offset: 2px;
}

/* ── Reduced motion ──────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .ash-gallery-main__img {
    transition: none;
  }

  .ash-gallery-thumb {
    transition: none;
  }
}

/* ── Inquiry form (Phase 13) ─────────────────────────────────────────────── */

.ash-inquiry-wrap {
  margin-top: 2px;
}

.ash-inquiry-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ash-inquiry-form textarea {
  width: 100%;
  min-height: 96px;
  padding: 12px 14px;
  border: 1.5px solid var(--ash-d-border);
  border-radius: var(--ash-d-radius);
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--ash-d-text);
  background: #fff;
  resize: vertical;
  box-sizing: border-box;
  transition: border-color 0.12s ease;
}

.ash-inquiry-form textarea:focus {
  outline: none;
  border-color: var(--ash-d-ring);
}

.ash-inquiry-status {
  font-size: 0.875rem;
  border-radius: 6px;
  padding: 8px 12px;
}

.ash-inquiry-status--success {
  background: #e6f4ec;
  color: var(--ash-d-green);
}

.ash-inquiry-status--error {
  background: #f4e6e6;
  color: var(--ash-d-red);
}

/* ── Boosted badge (Phase 20) ────────────────────────────────────────────── */

.ash-badge--boosted {
  background: #fdf0eb;
  color: #c96442;
  border: 1px solid #f3c4ae;
  font-weight: 700;
}
