/*
 * The shared resource card (storefront redesign T06, design decisions 16 and 23). Colours are tokens from
 * cce-theme.css; this file writes no hex colour (utesting/tests/ThemeTemplatesScanTest.php).
 *
 * Card anatomy: a picture frame (the cover; its title is the tooltip, with no caption), an optional strip of up to
 * three more thumbnails with a "+N" tile, one line with the type pill and the price, and the Preview button when asked.
 */

.cce-rescard {
  background: var(--cce-surface);
  border: 1px solid var(--cce-line);
  border-radius: var(--cce-radius-card);
  box-shadow: var(--cce-shadow-card);
  overflow: hidden;
}

.cce-rescard-frame {
  position: relative;
  padding: 10px 10px 0;
  background: var(--cce-surface);
}

/* The cover sits in Heather's rounded green frame (owner, 2026-11-19), on the card and in a row. */
.cce-rescard-cover {
  display: block;
  height: 200px;
  overflow: hidden;
  background: var(--cce-surface);
  border: 5px solid var(--cce-thumb-frame);
  border-radius: 12px;
}

.cce-rescard-cover:focus-visible {
  outline: 3px solid var(--cce-primary);
  outline-offset: -3px;
}

.cce-rescard-strip {
  display: flex;
  align-items: stretch;
  gap: 6px;
  padding: 8px 10px 0;
}

.cce-rescard-thumb {
  flex: 1 1 0;
  min-width: 0;
  height: 44px;
  overflow: hidden;
  border: 1px solid var(--cce-line-strong);
  border-radius: 6px;
}

.cce-rescard-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cce-rescard-more {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 0.5rem;
  border-radius: 6px;
  background: var(--cce-primary-tint);
  color: var(--cce-ink);
  font-size: 0.9rem;
  font-weight: 700;
}

/* A phone grid is two columns; a strip of thumbnails that narrow would be too small to read. */
@media (max-width: 399.98px) {
  .cce-rescard-strip {
    display: none;
  }
}

.cce-rescard-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  margin-top: auto;
  padding: 10px 12px 12px;
}

.cce-rescard-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--cce-radius-pill);
  background: var(--cce-muted);
  color: var(--cce-on-dark);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.cce-rescard-pill:empty {
  display: none;
}

/* The star and the average rating between the pill and the price (owner, 2026-11-19). */
.cce-rescard-rating {
  display: inline-flex;
  align-items: center;
  gap: 0;
  color: var(--cce-ink);
  font-size: 0.9rem;
  font-weight: 700;
}

.cce-rescard-rating i {
  color: var(--cce-star);
}

.cce-rescard-price {
  color: var(--cce-primary);
  font-size: 1.05rem;
  font-weight: 700;
}

.cce-rescard-price--unavailable {
  color: var(--cce-muted);
  font-size: 0.85rem;
  font-weight: 600;
}

/* The Preview button under a card (T09): the one action a card adds; it opens the Preview window. */
.cce-rescard-actions {
  padding: 0 10px 10px;
}

.cce-rescard-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--cce-primary);
  border-radius: var(--cce-radius-pill);
  background: var(--cce-surface);
  color: var(--cce-primary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.cce-rescard-preview:hover,
.cce-rescard-preview:focus-visible {
  background: var(--cce-primary-tint);
}

/* The Preview window (T09): the body the preview script fills with renderPreviewBody(). */
.cce-respreview-body {
  color: var(--cce-text);
}

.cce-respreview-title {
  margin-top: 1rem;
  color: var(--cce-ink);
}

.cce-respreview-title:focus {
  outline: none;
}

.cce-respreview-label {
  color: var(--cce-muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.cce-respreview-links a {
  color: var(--cce-primary);
}

.cce-respreview-price {
  color: var(--cce-ink);
  font-size: 1.25rem;
  font-weight: 700;
}

/*
 * The one pill button of the resource listings (T10): the row's "View resource" and the Preview window's link. A filled
 * --cce-primary pill with white text; any element that carries .cce-btn-pill gets it.
 */
.cce-btn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.4rem;
  border: 1px solid var(--cce-primary);
  border-radius: var(--cce-radius-pill);
  background: var(--cce-primary);
  color: var(--cce-on-dark);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.cce-btn-pill:hover,
.cce-btn-pill:focus-visible {
  color: var(--cce-on-dark);
  text-decoration: none;
  filter: brightness(0.92);
}

.cce-btn-pill:focus-visible {
  outline: 3px solid var(--cce-primary-tint);
  outline-offset: 2px;
}

/* The cards / rows switch (T10): two icon buttons, the layout in use pressed. */
.cce-view-switch {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--cce-line);
  border-radius: var(--cce-radius-pill);
  background: var(--cce-surface);
}

.cce-view-switch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.2rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--cce-muted);
  cursor: pointer;
}

.cce-view-switch-btn + .cce-view-switch-btn {
  border-left: 1px solid var(--cce-line);
}

.cce-view-switch-btn[aria-pressed="true"] {
  background: var(--cce-primary-tint);
  color: var(--cce-ink);
}

.cce-view-switch-btn:focus-visible {
  outline: 3px solid var(--cce-primary);
  outline-offset: -3px;
}

/*
 * The wide row (T10, design decision 24): picture, body and buy box in a row on a desktop; on a phone the buy box goes
 * under the body and the Details section is the collapsible one from sections.js.
 */
.cce-resrow {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 16px;
  padding: 16px;
  background: var(--cce-surface);
  border: 1px solid var(--cce-line);
  border-radius: var(--cce-radius-card);
  box-shadow: var(--cce-shadow-card);
}

.cce-resrow-media {
  flex: 0 0 220px;
  max-width: 100%;
  min-width: 0;
}

.cce-resrow-media .cce-rescard-frame {
  padding: 0;
}

.cce-resrow-media .cce-rescard-cover {
  height: 170px;
}

.cce-resrow-media .cce-rescard-strip {
  padding: 8px 0 0;
}

.cce-resrow-media .cce-rescard-actions {
  padding: 8px 0 0;
}

.cce-resrow-body {
  flex: 1 1 280px;
  min-width: 0;
  color: var(--cce-text);
}

.cce-resrow-body .cce-rescard-pill {
  margin-bottom: 0.4rem;
}

.cce-resrow-title {
  margin: 0 0 0.35rem;
  font-weight: 700;
}

.cce-resrow-title a {
  color: var(--cce-ink);
  text-decoration: none;
}

.cce-resrow-title a:hover,
.cce-resrow-title a:focus-visible {
  color: var(--cce-primary);
  text-decoration: underline;
}

.cce-resrow-desc {
  display: -webkit-box;
  margin: 0 0 0.5rem;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: var(--cce-text);
}

.cce-resrow-sold {
  margin: 0 0 0.5rem;
  color: var(--cce-text);
  font-size: 0.9rem;
}

.cce-resrow-sold a {
  color: var(--cce-primary);
}

.cce-resrow-details {
  margin-top: 0.5rem;
}

.cce-resrow-facts {
  color: var(--cce-text);
  font-size: 0.9rem;
}

.cce-resrow-fact-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0;
  margin: 0 0 0.4rem;
  padding: 0;
}

.cce-resrow-fact {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding-right: 0.75rem;
  margin-right: 0.75rem;
  border-right: 1px solid var(--cce-line);
}

.cce-resrow-fact:last-child {
  padding-right: 0;
  margin-right: 0;
  border-right: 0;
}

.cce-resrow-format {
  margin: 0 0 0.3rem;
  font-weight: 600;
}

.cce-resrow-buy {
  flex: 0 0 200px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.5rem;
  padding-left: 16px;
  border-left: 1px solid var(--cce-line);
}

.cce-resrow-price {
  margin: 0;
  color: var(--cce-primary);
  font-size: 1.5rem;
  font-weight: 700;
}

.cce-resrow-price--unavailable {
  color: var(--cce-muted);
  font-size: 0.95rem;
  font-weight: 600;
}

.cce-resrow-avail {
  margin: 0;
  color: var(--cce-muted);
  font-size: 0.9rem;
}

/* A phone: the picture is small, the buy box runs under the body, and the Details section is the one above. */
@media (max-width: 767.98px) {
  .cce-resrow {
    gap: 12px;
    padding: 12px;
  }

  .cce-resrow-media {
    flex: 0 0 120px;
  }

  .cce-resrow-media .cce-rescard-cover {
    height: 110px;
  }

  .cce-resrow-body {
    flex: 1 1 calc(100% - 140px);
  }

  .cce-resrow-buy {
    flex: 1 1 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0 0;
    border-left: 0;
    border-top: 1px solid var(--cce-line);
  }

  .cce-resrow-price {
    font-size: 1.25rem;
  }
}

/* Pixel-match pass (T16): the wide row's title is the mockup's bold navy. */
.cce-resrow-title,
.cce-resrow-title.h5 {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.2;
}
