/* Profesionales Fundadores + reseñas + portfolio — shared components.
   Loaded by the pages that show the live counter, the founder card, the
   founder status card, the review carousel, the star-rating input or the
   portfolio. The small .badge-founder pill lives in components.css. */

/* --------------------------------------------------------------------------
   Live counter of founder places. Driven only by the data-founder-* hooks
   that js/founders.js fills from GET /api/v1/campaigns/professional-founders.
   While loading (aria-busy) the figures and the bar shimmer as a skeleton;
   the "Consultando…" status stays for screen readers only.
   -------------------------------------------------------------------------- */
.founder-counter {
  display: grid;
  gap: var(--space-2);
}

.founder-counter__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-1) var(--space-4);
}

.founder-counter__big {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin: 0;
  font-weight: 700;
}

.founder-counter__big strong {
  min-width: 1.6ch;
  font-size: clamp(2.4rem, 5vw, 3.1rem);
  line-height: 1;
  letter-spacing: -0.05em;
  color: var(--color-accent-dark);
}

.founder-counter__small,
.founder-counter__inline {
  margin: 0;
  font-size: var(--font-body-sm);
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
}

.founder-counter__inline strong {
  font-size: 1.15rem;
}

.founder-counter__bar {
  position: relative;
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--color-neutral-soft);
  overflow: hidden;
}

.founder-counter__fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
  transition: width 600ms var(--ease-standard);
}

.founder-counter__status {
  margin: 0;
  font-size: var(--font-body-sm);
  font-weight: 700;
  color: var(--color-ink);
}

/* Open campaign: the big number already says it; the sentence is kept for
   assistive technology only. Full or error: the sentence is the message. */
.founder-counter[aria-busy="true"] .founder-counter__status,
.founder-counter[data-state="open"] .founder-counter__status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* Skeleton while the API answers: same silhouette, no fake figure. */
.founder-counter[aria-busy="true"] [data-founder-remaining],
.founder-counter[aria-busy="true"] [data-founder-claimed],
.founder-counter[aria-busy="true"] .founder-counter__bar {
  color: transparent;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, #eceae1 25%, #f6f4ed 37%, #eceae1 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
}

.founder-counter[aria-busy="true"] [data-founder-remaining],
.founder-counter[aria-busy="true"] [data-founder-claimed] {
  display: inline-block;
  min-width: 2.4ch;
}

.founder-counter[aria-busy="true"] .founder-counter__fill {
  visibility: hidden;
}

.founder-counter[data-state="error"] .founder-counter__bar {
  opacity: 0.5;
}

@media (prefers-reduced-motion: reduce) {
  .founder-counter__fill {
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   Founder card: the single place the offer is spelled out (landing hero,
   compact on the home page).
   -------------------------------------------------------------------------- */
.founder-card {
  position: relative;
  display: grid;
  gap: var(--space-4);
  padding: var(--space-6);
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: var(--shadow-raised);
  overflow: hidden;
  min-width: 0;
}

/* Gold → ember → green top edge: the only "decoration" the card carries. */
.founder-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
  background: linear-gradient(90deg, var(--color-star) 0%, var(--color-ember) 50%, var(--color-accent) 100%);
}

.founder-card__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.founder-card__scope {
  font-size: var(--font-caption);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.founder-card .founder-card__title {
  display: grid;
  gap: var(--space-1);
  margin: 0;
  font-size: inherit;
  letter-spacing: normal;
  line-height: normal;
}

.founder-card__kicker {
  font-size: var(--font-body-sm);
  font-weight: 700;
  color: var(--color-muted);
}

.founder-card__offer {
  font-size: clamp(1.45rem, 2.6vw, 1.9rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.founder-card__offer em {
  font-style: normal;
  color: var(--color-accent-dark);
}

.founder-card .founder-counter {
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--color-accent-softer);
}

.founder-card__terms {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: center;
  font-size: var(--font-body-sm);
  color: var(--color-muted);
}

.founder-card__terms li {
  display: grid;
  gap: 2px;
  padding: 0 var(--space-2);
}

.founder-card__terms li + li {
  border-left: 1px solid var(--color-line);
}

.founder-card__terms strong {
  font-size: 1.05rem;
  color: var(--color-ink);
}

.founder-card__cta {
  width: 100%;
  white-space: normal;
  text-align: center;
}

.founder-card__note {
  margin: 0;
  text-align: center;
  font-size: var(--font-caption);
  color: var(--color-muted);
}

.founder-card--compact {
  gap: var(--space-3);
  padding: var(--space-5);
}

.founder-card--compact .founder-counter {
  padding: var(--space-3) var(--space-4);
}

.founder-card--compact .founder-counter__big strong {
  font-size: 2.2rem;
}

.founder-card .badge-founder {
  white-space: normal;
}

@media (max-width: 480px) {
  .founder-card {
    padding: var(--space-5) var(--space-4);
    border-radius: var(--radius-lg);
  }

  /* 3 narrow columns wrap "Sin tarjeta"/"por contacto" mid-word; a stacked
     row per condition keeps every label on one line instead. */
  .founder-card__terms {
    grid-template-columns: 1fr;
    gap: var(--space-2);
    text-align: left;
  }

  .founder-card__terms li {
    grid-template-columns: auto 1fr;
    align-items: baseline;
    gap: 0 var(--space-2);
    padding: 0;
  }

  .founder-card__terms li + li {
    border-left: 0;
    padding-top: var(--space-2);
    border-top: 1px solid var(--color-line);
  }
}

/* --------------------------------------------------------------------------
   Founder status card (panel, onboarding)
   -------------------------------------------------------------------------- */
.founder-status {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  background: linear-gradient(140deg, var(--color-star-soft) 0%, var(--color-surface) 70%);
  border: 1px solid #efd9a6;
}

.founder-status h2,
.founder-status h3,
.founder-status p {
  margin: 0;
}

.founder-status__facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--space-3);
  margin: 0;
}

.founder-status__facts div {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  border: 1px solid var(--color-line);
}

.founder-status__facts dt {
  font-size: var(--font-caption);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
}

.founder-status__facts dd {
  margin: 2px 0 0;
  font-weight: 700;
}

.founder-status__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* --------------------------------------------------------------------------
   Star rating input (review form): five radios per criterion. Keyboard works
   like any radio group (arrow keys); the chosen value is also spelled out.
   -------------------------------------------------------------------------- */
.star-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-1) var(--space-4);
  margin: 0;
  padding: var(--space-2) 0;
  border: 0;
  border-bottom: 1px solid var(--color-line);
  min-width: 0;
}

.star-input legend {
  float: left;
  padding: 0;
  font-weight: 700;
  font-size: var(--font-body-sm);
}

.star-input__stars {
  display: inline-flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 2px;
}

.star-input__stars input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.star-input__stars label {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-line-strong);
}

.star-input__stars label svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

/* The row is reversed in CSS, so the stars that follow the checked one in
   the DOM are the ones shown before it: all of them light up. */
.star-input__stars input:checked ~ label,
.star-input__stars label:hover,
.star-input__stars label:hover ~ label {
  color: var(--color-star);
}

.star-input__stars input:focus-visible + label {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.star-input__value {
  grid-column: 1 / -1;
  margin: 0;
  font-size: var(--font-caption);
  color: var(--color-muted);
}

.review-form .review-scores {
  grid-template-columns: 1fr;
  gap: 0;
  margin-bottom: var(--space-3);
}

.review-form__intro {
  margin: 0 0 var(--space-2);
  color: var(--color-muted);
  font-size: var(--font-body-sm);
}

/* --------------------------------------------------------------------------
   Review carousel (home). Scroll-snap track, explicit previous/next buttons
   and dot indicators; no autoplay.
   -------------------------------------------------------------------------- */
.review-carousel {
  display: grid;
  gap: var(--space-4);
}

.review-carousel__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(260px, calc((100% - 2 * var(--space-4)) / 3));
  gap: var(--space-4);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: var(--space-1) var(--space-1) var(--space-3);
  /* Snap to the padded edge, so the first slide rests at scrollLeft 0
     instead of the browser nudging the track by the padding. */
  scroll-padding-inline: var(--space-1);
  margin: 0;
  list-style: none;
  scrollbar-width: thin;
}

.review-carousel__track:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 4px;
  border-radius: var(--radius-md);
}

.review-carousel__slide {
  scroll-snap-align: start;
  display: grid;
  align-content: start;
  gap: var(--space-3);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  box-shadow: var(--shadow-sm);
}

.review-carousel__quote {
  margin: 0;
  font-size: var(--font-body-md);
  line-height: 1.55;
}

.review-carousel__author {
  margin: 0;
  font-size: var(--font-body-sm);
  color: var(--color-muted);
}

.review-carousel__pro {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-line);
  color: inherit;
  text-decoration: none;
}

.review-carousel__pro:hover strong,
.review-carousel__pro:focus-visible strong {
  text-decoration: underline;
}

.review-carousel__pro > span:last-child {
  display: grid;
  font-size: var(--font-body-sm);
  color: var(--color-muted);
}

.review-carousel__pro strong {
  color: var(--color-ink);
}

.review-carousel__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
}

.review-carousel__btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-line-strong);
  background: var(--color-surface);
  color: var(--color-ink);
  cursor: pointer;
}

.review-carousel__btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.review-carousel__btn:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.review-carousel__btn svg {
  width: 20px;
  height: 20px;
}

.review-carousel__btn--prev svg {
  transform: rotate(180deg);
}

.review-carousel__dots {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* 24px hit area around a 12px dot. */
.review-carousel__dots button {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.review-carousel__dots button::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-accent-dark);
}

.review-carousel__dots button[aria-current="true"]::before {
  background: var(--color-accent-dark);
}

.review-carousel__dots button:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 0;
  border-radius: var(--radius-pill);
}

@media (prefers-reduced-motion: reduce) {
  .review-carousel__track {
    scroll-behavior: auto;
  }
}

@media (max-width: 700px) {
  .review-carousel__track {
    grid-auto-columns: 86%;
  }
}

/* Fallback when there are no real reviews yet: how reviews work, never a
   testimonial. */
.reviews-promise {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  max-width: 560px;
  margin: 0 auto;
  padding: var(--space-6);
  border-radius: var(--radius-xl);
  text-align: center;
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  box-shadow: var(--shadow-card);
}

.reviews-promise__eyebrow {
  margin: 0;
  font-size: var(--font-caption);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-ember);
}

.reviews-promise__title {
  margin: 0;
  font-size: var(--font-heading-sm);
  line-height: 1.25;
}

.reviews-promise__stars {
  margin: 0;
  display: inline-flex;
  gap: 2px;
  color: var(--color-star);
}

.reviews-promise__stars svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.reviews-promise blockquote {
  margin: 0;
  color: var(--color-muted);
}

.reviews-promise blockquote p {
  margin: 0;
}

/* --------------------------------------------------------------------------
   Portfolio (public profile + owner page)
   -------------------------------------------------------------------------- */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.portfolio-card {
  display: grid;
  align-content: start;
  gap: var(--space-2);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-line);
  background: var(--color-surface);
  overflow: hidden;
}

.portfolio-card__media {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 2px;
  aspect-ratio: 4 / 3;
  background: var(--color-neutral-soft);
}

.portfolio-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.portfolio-card__media--empty {
  place-items: center;
  color: var(--color-muted);
}

.portfolio-card__media--empty svg {
  width: 32px;
  height: 32px;
}

.portfolio-card__body {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4) var(--space-4);
}

.portfolio-card__body h3 {
  margin: 0;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
}

.portfolio-card__body p {
  margin: 0;
  font-size: var(--font-body-sm);
  color: var(--color-muted);
}

.portfolio-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.portfolio-card__meta .chip {
  font-size: var(--font-caption);
}

.portfolio-note {
  margin: 0 0 var(--space-4);
  font-size: var(--font-body-sm);
  color: var(--color-muted);
}

/* Owner page (mis-trabajos.html) */
.portfolio-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: var(--space-6);
  align-items: start;
}

.portfolio-form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.portfolio-owner-list {
  display: grid;
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.portfolio-owner-item {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-line);
  background: var(--color-surface);
}

.portfolio-owner-item p {
  margin: 0;
}

.portfolio-owner-item__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.portfolio-owner-item__head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.portfolio-owner-item__photos:empty {
  display: none;
}

.portfolio-owner-item__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.btn-danger-text {
  color: var(--color-danger);
}

.panel-founder {
  margin-bottom: var(--space-5);
}

@media (max-width: 900px) {
  .portfolio-layout {
    grid-template-columns: 1fr;
  }
}
