/* =============================================================================
   Claue V2 — Downloadable Product Detail Page (P11)

   A downloadable product is is_virtual = 1 (price + Add-to-Cart, nothing ships),
   so the shared 3-column TOP section applies unchanged and this handle adds no
   <move> surgery. Because the demo product uses links_purchased_separately = 1
   it is OPTIONS-bearing, so Magento renders its buy form (the "Downloads" link
   selector + Add-to-Cart) full-width BELOW the top section (like P9 grouped),
   not in the 260px right column — the wide link titles benefit from the space.
   This file only adds the downloadable-specific Claue accents, scoped to the
   `cl-page-downloadable` body class set by
   catalog_product_view_type_downloadable.xml:

     1. a "Downloadable" eyebrow badge above the title,
     2. a light coral accent on the swapped (no-shipping) trust row icons, and
     3. Claue styling for Magento's native "Downloads" links selector
        (block product.info.downloadable) so the link checkboxes read as a
        clean coral-accented card rather than raw browser controls.

   Registered AFTER product-clean.css in default.xml, so equal-specificity rules
   win the cascade. Palette mirrors product-clean.css: coral CTA #cf9683
   (var(--cl-cta)) / #bd7e63 (var(--cl-cta-dark)).
   ========================================================================== */

/* ── "Downloadable" eyebrow badge ──────────────────────────────────────────
   Rendered by downloadable-badge.phtml as the first child of the left info
   column (cl.pdp.left), so it sits just above the product title.

   Note: this badge block is intentionally a near-duplicate of .cl-virtual-badge
   in product-virtual.css. The two are kept as separate, body-class-scoped rules
   (one CSS file per product type) to match the established P8/P9/P10 per-type
   convention — each file stays self-contained and independently removable. The
   duplication is ~16 static properties; a shared base rule was judged not worth
   the cross-file coupling for two product types. */
.cl-page-downloadable .cl-downloadable-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 12px;
  padding: 5px 12px;
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cl-cta-dark, #bd7e63);
  background: rgba(207, 150, 131, 0.12);   /* #cf9683 @ 12% */
  border: 1px solid rgba(207, 150, 131, 0.35);
  border-radius: 100px;
  line-height: 1;
}

.cl-page-downloadable .cl-downloadable-badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cl-cta, #cf9683);
}

/* ── No-shipping trust row: tint the icons coral to reinforce the digital,
   instant-download framing (distinct from the neutral physical-product row). */
.cl-page-downloadable .cl-trust-row--downloadable .cl-trust-row__icon {
  background: rgba(207, 150, 131, 0.12);
  color: var(--cl-cta-dark, #bd7e63);
}

/* ── Native "Downloads" links selector ─────────────────────────────────────
   When links are purchased separately, Magento_Downloadable renders a
   `.field.downloads` block inside the add-to-cart form options, with the
   links_title as a sibling `<legend class="legend links-title">` and each
   selectable link as a `.field.choice` row (checkbox + label + price) under a
   `.control` / `#downloadable-links-list` wrapper. Present it as a soft card
   with a labelled heading and coral-accented checkboxes so it matches the Claue
   purchase box rather than raw form controls.

   Selectors verified against Magento 2.4 core links.phtml. Scoped only by the
   `.cl-page-downloadable` body class (not `.product-add-form`) so styling does
   not depend on the form wrapper class, which the theme's form.phtml may differ
   on. Descendant (not child) combinators absorb minor markup-nesting changes. */
.cl-page-downloadable .field.downloads {
  margin: 0 0 18px;
  padding: 16px 18px;
  background: #fafafa;
  border: 1px solid var(--cl-border, #e7e7e7);
  border-radius: 4px;
}

/* "Downloads" heading (links_title). Core emits `<legend class="legend
   links-title">`; it may render just before or inside the `.field.downloads`
   block, so target the verified class directly and via descendant. */
.cl-page-downloadable .legend.links-title,
.cl-page-downloadable .field.downloads .legend {
  display: block;
  margin: 0 0 12px;
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #222;
}

/* Each selectable link row. */
.cl-page-downloadable .field.downloads .field.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 9px 0;
  border-top: 1px solid var(--cl-border, #e7e7e7);
  font-size: 14px;
  color: #333;
}

/* No divider above the first row (covers Magento's optional "select all" row,
   which is itself the first `.field.choice` when multiple links exist). */
.cl-page-downloadable .field.downloads .field.choice:first-child {
  border-top: 0;
}

/* Coral-tinted checkbox/radio (modern browsers honour accent-color). */
.cl-page-downloadable .field.downloads .field.choice input[type="checkbox"],
.cl-page-downloadable .field.downloads .field.choice input[type="radio"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--cl-cta, #cf9683);
  cursor: pointer;
}

.cl-page-downloadable .field.downloads .field.choice label {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  cursor: pointer;
}

/* Per-link price (when separately priced) — coral to match the CTA palette. */
.cl-page-downloadable .field.downloads .field.choice .price-container .price,
.cl-page-downloadable .field.downloads .field.choice .price {
  font-weight: 600;
  color: var(--cl-cta-dark, #bd7e63);
}

/* ── Native "Samples" download list (if the product defines sample files). ──
   Core samples.phtml renders `<dl class="items samples">` with the heading as
   `<dt class="item-title samples-item-title">` and each sample as `<dd>` links.
   The seeded demo product defines no samples, so this is defensive styling for
   products that do. */
.cl-page-downloadable .items.samples {
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.cl-page-downloadable .items.samples .samples-item-title,
.cl-page-downloadable .items.samples .item-title {
  display: block;
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #888;
}

.cl-page-downloadable .items.samples a {
  color: var(--cl-cta-dark, #bd7e63);
  text-decoration: underline;
}

.cl-page-downloadable .items.samples a:hover {
  color: var(--cl-cta, #cf9683);
}

/* ── Mobile: keep the badge comfortably sized on small viewports ── */
@media (max-width: 575px) {
  .cl-page-downloadable .cl-downloadable-badge {
    font-size: 10px;
    padding: 4px 10px;
  }

  .cl-page-downloadable .field.downloads {
    padding: 14px;
  }
}
