/* ============================================================
   Aparto — components.css
   Every reusable interface element. Tokens only: no hex
   literals, no !important, no page-specific composition.
   ============================================================ */

/* ---------------- Buttons ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px; /* touch target floor */
  padding: 13px 26px;
  border: 1.5px solid transparent;
  border-radius: var(--radius-pill);
  font-size: var(--step--1);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease,
    color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--white);
  color: var(--bg);
}
.btn-primary:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.btn-outline {
  background: transparent;
  border-color: rgba(243, 239, 231, 0.35);
  color: var(--ink);
}
.btn-outline:hover {
  border-color: var(--ink);
  background: rgba(243, 239, 231, 0.06);
}

.btn-light {
  background: var(--ivory-text);
  color: var(--bg);
}
.btn-light:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.btn-sm {
  min-height: 40px;
  padding: 10px 18px;
  font-size: var(--step--1);
}

/* ---------------- Card ---------------- */

.card {
  display: flex;
  flex-direction: column;
  background: var(--veil-card);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.3s var(--ease), box-shadow 0.3s ease;
}
.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-card-hover);
}

/* The fixed ratio reserves layout space before the image decodes.
   Removing it reintroduces cumulative layout shift on every card. */
.card-media {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}
.card:hover .card-media img {
  transform: scale(1.045);
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: var(--space-5) var(--space-5) var(--space-6);
}
.card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
}
.card-top h3 {
  font-size: var(--step-2);
}
.card-loc {
  margin-top: var(--space-1);
  color: var(--muted);
  font-size: var(--step--1);
}
.card-blurb {
  margin-top: var(--space-3);
  color: var(--muted);
  line-height: var(--leading-loose);
}
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-5);
}
.card-actions .btn {
  flex: 1 1 auto;
}

/* ---------------- Rating ---------------- */

.rating {
  flex-shrink: 0;
  font-size: var(--step--1);
  font-weight: 600;
  white-space: nowrap;
}
.rating small {
  color: var(--muted);
  font-weight: 400;
}
.rating-line {
  margin-top: var(--space-3);
  color: var(--muted);
  font-size: var(--step--1);
}

/* ---------------- Chips & specs ---------------- */

.chips,
.specs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.chips li {
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
  font-size: var(--step--1);
  color: var(--ink);
}
.specs {
  gap: var(--space-4);
  margin-top: var(--space-4);
  color: var(--muted);
  font-size: var(--step--1);
}
.specs li + li::before {
  content: "·";
  margin-right: var(--space-4);
  color: var(--dot);
}

/* ---------------- Amenities ---------------- */

.amenities {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2) var(--space-5);
  margin-top: var(--space-5);
  color: var(--muted);
  font-size: var(--step--1);
}
@media (min-width: 560px) {
  .amenities {
    grid-template-columns: 1fr 1fr;
  }
}
.amenities li {
  position: relative;
  padding-left: var(--space-4);
}
.amenities li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--dot);
}

/* ---------------- Host row ---------------- */

.host {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}
.host:hover {
  background: rgba(255, 255, 255, 0.08);
}
.host-avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--ivory-text);
  color: var(--bg);
  font-weight: 600;
}
.host-meta {
  display: flex;
  flex-direction: column;
}
.host-meta span {
  color: var(--muted);
  font-size: var(--step--1);
}

/* ---------------- Accordion (native details/summary) ---------------- */

.accordion details {
  border-bottom: 1px solid var(--hairline);
}
.accordion summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 44px;
  padding-block: var(--space-5);
  font-size: var(--step-1);
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}
.accordion summary::-webkit-details-marker {
  display: none; /* Safari draws its own triangle otherwise */
}
.accordion summary::after {
  content: "";
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.3s var(--ease);
}
.accordion details[open] summary::after {
  transform: rotate(-135deg) translateY(-2px);
}
/* Animating grid rows works where height:auto cannot. */
.accordion-panel {
  display: grid;
  grid-template-rows: 1fr;
  color: var(--muted);
  line-height: var(--leading-loose);
}
.accordion-panel > div {
  min-height: 0;
  overflow: hidden;
  padding-bottom: var(--space-5);
}

/* ---------------- Reduced motion ---------------- */

@media (prefers-reduced-motion: reduce) {
  .btn,
  .card,
  .card-media img,
  .host,
  .accordion summary::after {
    transition: none;
  }
  .btn:hover,
  .card:hover {
    transform: none;
  }
  .card:hover .card-media img {
    transform: none;
  }
}
