/* HODHOD public reviews — Supabase-backed
 * Used on Home, Work, About, CV, Contact, and case studies
 */

.case-reviews,
.home-reviews,
.page-reviews {
  padding: clamp(28px, 3.5vw, 40px) 0 clamp(16px, 2vw, 24px);
  overflow-x: clip;
  overflow-y: visible;
}

.case-reviews > .container,
.home-reviews > .container,
.page-reviews > .container {
  /* Inherit site shell; never redefine global .container */
  width: var(--container-shell, min(1080px, calc(100% - (var(--page-pad, 24px) * 2))));
  max-width: var(--container-max, 1080px);
  margin-inline: auto;
}

.case-reviews-intro {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin-bottom: clamp(12px, 1.6vw, 16px);
  width: 100%;
}

.case-reviews-header {
  margin: 0;
  max-width: 52ch;
}

.case-reviews-header .case-section-eyebrow,
.home-reviews .home-about-kicker,
.home-reviews .case-section-eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
}

.case-reviews-header h2 {
  margin: 0 0 8px;
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  letter-spacing: -0.02em;
  color: rgba(255, 255, 255, 0.96);
}

.case-reviews-lead {
  margin: 0;
  font-size: clamp(15px, 1.35vw, 16.5px);
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.62);
}

.case-reviews-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  margin: 0;
  flex-shrink: 0;
  width: max-content;
  max-width: 100%;
}

@media (min-width: 768px) {
  .case-reviews-intro {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px 32px;
  }

  .case-reviews-header {
    flex: 1 1 auto;
    min-width: 0;
    max-width: min(52ch, calc(100% - 220px));
  }

  .case-reviews-toolbar {
    flex: 0 0 auto;
    align-self: flex-end;
    margin-left: auto;
  }
}

@media (max-width: 767px) {
  .case-reviews-header {
    max-width: none;
  }

  .case-reviews-toolbar {
    width: 100%;
    align-self: flex-start;
  }
}

.case-reviews-open {
  min-height: 46px;
  padding: 11px 18px;
  width: fit-content;
  max-width: 100%;
  white-space: nowrap;
  flex-shrink: 0;
}

@media (max-width: 420px) {
  .case-reviews-open.btn-primary {
    width: fit-content;
    max-width: 100%;
  }
}

.case-reviews-toast {
  margin: 0;
  font-size: 14px;
  color: rgba(243, 154, 98, 0.95);
}

.case-reviews-toast[hidden] {
  display: none;
}

.case-reviews-empty {
  margin: 0;
  max-width: 42ch;
  font-size: 14.5px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.48);
}

.case-reviews-empty[hidden] {
  display: none;
}

.case-reviews.is-empty .case-reviews-empty {
  margin-top: 4px;
}

.case-reviews-loading,
.case-reviews-error {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.48);
}

.case-reviews-loading[hidden],
.case-reviews-error[hidden] {
  display: none;
}

.case-reviews-error {
  color: rgba(240, 160, 144, 0.9);
}

.case-reviews.is-loading .case-reviews-empty,
.case-reviews.is-loading .case-reviews-static,
.case-reviews.is-loading .case-reviews-wall,
.case-reviews.is-error .case-reviews-empty,
.case-reviews.is-error .case-reviews-static,
.case-reviews.is-error .case-reviews-wall {
  display: none !important;
}

/* Site pages (Work / About / CV / Contact): keep breathing room before footer */
.page-reviews {
  padding-bottom: clamp(28px, 3.5vw, 40px);
}

#reviews {
  scroll-margin-top: 100px;
}

/* Marquee viewport lives inside .container (moved at runtime if needed) */
.case-reviews-static {
  display: none;
}

.case-reviews-static[hidden] {
  display: none;
}

.case-reviews-wall {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 40px,
    #000 calc(100% - 40px),
    transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 40px,
    #000 calc(100% - 40px),
    transparent 100%
  );
}

.case-reviews-wall[hidden] {
  display: none;
}

.case-reviews-row--right {
  display: none;
}

.case-reviews.is-marquee .case-reviews-row--right {
  display: block;
}

.case-reviews-row {
  overflow: hidden;
}

.case-reviews-track {
  display: flex;
  align-items: stretch;
  width: max-content;
  gap: 14px;
  will-change: transform;
}

.case-reviews.is-marquee .case-reviews-row--left .case-reviews-track {
  animation: review-marquee-left 46s linear infinite;
}

.case-reviews.is-marquee .case-reviews-row--right .case-reviews-track {
  animation: review-marquee-right 46s linear infinite;
}

.case-reviews.is-marquee .case-reviews-wall:hover .case-reviews-track,
.case-reviews.is-marquee .case-reviews-wall:focus-within .case-reviews-track,
.case-reviews.is-marquee .case-reviews-row:hover .case-reviews-track,
.case-reviews.is-marquee .case-reviews-row:focus-within .case-reviews-track {
  animation-play-state: paused;
}

@keyframes review-marquee-left {
  from { transform: translateX(0); }
  to { transform: translateX(calc(-100% / var(--marquee-copies, 2))); }
}

@keyframes review-marquee-right {
  from { transform: translateX(calc(-100% / var(--marquee-copies, 2))); }
  to { transform: translateX(0); }
}

.case-review-card {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  width: 272px;
  height: 252px;
  box-sizing: border-box;
  overflow: hidden;
  background: #1e2a38;
  border: 1px solid rgba(247, 239, 230, 0.1);
  border-radius: var(--radius-lg, 16px);
  padding: 14px 14px 12px;
  transition: transform 180ms ease, border-color 180ms ease;
}

.case-reviews.is-marquee .case-review-card:hover {
  transform: translateY(-2px);
  border-color: rgba(247, 239, 230, 0.18);
}

.case-review-stars {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 2px;
  margin: 0 0 6px;
  color: var(--accent-500, #ea6d1e);
  font-size: 14px;
  letter-spacing: 0;
  line-height: 1;
}

.case-review-stars .is-off {
  color: rgba(242, 233, 221, 0.18);
}

.case-review-body {
  flex: 0 1 auto;
  min-height: 0;
  margin: 0;
}

.case-review-content {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.case-review-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.94);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  line-clamp: 5;
  overflow: hidden;
}

.case-review-more {
  appearance: none;
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  margin: 2px 0 0;
  padding: 4px 0;
  min-width: 44px;
  min-height: 28px;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--teal-300, #1c4d58);
  color: color-mix(in srgb, var(--teal-300) 62%, var(--text-primary) 38%);
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  transform: none;
  transition: color 160ms ease;
}

.case-review-more[hidden] {
  display: none !important;
}

.case-review-more:hover,
.case-review-more:focus-visible {
  color: var(--accent-500, #ea6d1e);
  background: none;
  transform: none;
}

.case-review-more:focus-visible {
  outline: 2px solid rgba(234, 109, 30, 0.4);
  outline-offset: 2px;
  border-radius: 2px;
}

.case-review-footer {
  flex: 0 0 auto;
  margin-top: auto;
  padding-top: 6px;
}

.case-review-divider {
  display: block;
  width: 100%;
  height: 1px;
  padding: 0;
  border: 0;
  background: rgba(242, 233, 221, 0.08);
}

.case-review-footer .case-review-divider {
  margin: 0 0 6px;
}

.case-review-name,
.case-reviews-read-modal__name {
  color: var(--accent-500, #ea6d1e);
}

.case-review-name {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
}

.case-review-byline {
  margin: 2px 0 0;
  font-size: 11.5px;
  line-height: 1.4;
  color: rgba(242, 233, 221, 0.52);
  overflow-wrap: anywhere;
}

/* Full review read modal (marquee Read more) */
.case-reviews-read-modal {
  position: fixed;
  inset: 0;
  z-index: 10070;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: none;
}

.case-reviews-read-modal.is-open {
  display: flex;
}

.case-reviews-read-modal__backdrop {
  position: fixed;
  inset: 0;
  z-index: 10070;
  background: rgba(5, 10, 16, 0.62);
  backdrop-filter: blur(3px);
  cursor: pointer;
  pointer-events: auto;
}

.case-reviews-read-modal__dialog {
  position: relative;
  z-index: 10071;
  display: flex;
  flex-direction: column;
  width: min(460px, calc(100vw - 48px));
  max-height: min(680px, calc(100vh - 48px));
  max-height: min(680px, calc(100dvh - 48px));
  overflow: hidden;
  margin: 0;
  padding: 22px 22px 20px;
  border-radius: 20px;
  background: #1b2632;
  border: 1px solid rgba(242, 233, 221, 0.08);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  color: #f2e9dd;
  pointer-events: auto;
}

.case-reviews-read-modal__close {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: rgba(255, 255, 255, 0.48);
  font-family: inherit;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  transform: none;
  -webkit-tap-highlight-color: transparent;
  transition: color 160ms ease, opacity 160ms ease;
}

.case-reviews-read-modal__close:hover {
  color: var(--accent-500, #ea6d1e);
  background: transparent;
  border: 0;
  box-shadow: none;
  transform: none;
}

.case-reviews-read-modal__close:focus-visible {
  color: var(--accent-500, #ea6d1e);
  background: transparent;
  border: 0;
  box-shadow: none;
  transform: none;
  outline: 2px solid rgba(234, 109, 30, 0.42);
  outline-offset: 2px;
}

.case-reviews-read-modal__body {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 36px 0 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(130, 145, 160, 0.45) transparent;
}

.case-reviews-read-modal__body .case-review-stars {
  margin-bottom: 14px;
}

.case-reviews-read-modal__text {
  margin: 0 0 16px;
  max-width: 42ch;
  font-size: 15px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.92);
}

.case-reviews-read-modal__body .case-review-divider {
  margin: 0 0 16px;
}

.case-reviews-read-modal__name {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.case-reviews-read-modal__byline {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: rgba(242, 233, 221, 0.52);
  overflow-wrap: anywhere;
}

/* Submission modal */
.case-reviews-modal {
  position: fixed;
  inset: 0;
  z-index: 10060;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 3vw, 24px);
}

.case-reviews-modal.is-open {
  display: flex;
}

.case-reviews-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 10, 16, 0.62);
  backdrop-filter: blur(3px);
  cursor: pointer;
}

.case-reviews-modal__dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(100%, 460px);
  max-height: min(760px, calc(100vh - 64px));
  max-height: min(760px, calc(100dvh - 64px));
  overflow: hidden;
  padding: 18px 18px 0;
  border-radius: 20px;
  background: #1b2632;
  border: 1px solid rgba(242, 233, 221, 0.08);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  color: #f2e9dd;
}

.case-reviews-modal__close {
  position: absolute;
  top: 12px;
  right: 16px;
  z-index: 2;
}

.case-reviews-modal__title {
  margin: 0 0 6px;
  padding-right: 52px;
  flex: 0 0 auto;
  font-size: 1.15rem;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.case-reviews-modal__lead {
  margin: 0 0 14px;
  padding-right: 12px;
  flex: 0 0 auto;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(242, 233, 221, 0.68);
}

.case-reviews-form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 20px;
  min-height: 0;
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  /* Keep scrollbar clear of the close control */
  padding: 0 10px 0 0;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(130, 145, 160, 0.45) transparent;
}

.case-reviews-form::-webkit-scrollbar {
  width: 8px;
}

.case-reviews-form::-webkit-scrollbar-track {
  background: transparent;
}

.case-reviews-form::-webkit-scrollbar-thumb {
  background-color: rgba(120, 136, 152, 0.42);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.case-reviews-form::-webkit-scrollbar-thumb:hover {
  background-color: rgba(150, 164, 178, 0.58);
  border: 2px solid transparent;
  background-clip: padding-box;
}

.case-reviews-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.case-reviews-field label,
.case-reviews-field > [id$="review-rating-label"] {
  font-size: 13.5px;
  font-weight: 600;
  color: rgba(243, 154, 98, 0.92);
}

.case-reviews-optional {
  font-weight: 500;
  font-size: 0.9em;
  opacity: 0.55;
  color: rgba(242, 233, 221, 0.78);
}

.case-reviews-required {
  font-weight: 650;
  color: rgba(243, 154, 98, 0.95);
  margin-left: 2px;
}

.case-reviews-help {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: rgba(242, 233, 221, 0.5);
}

.case-reviews-field input,
.case-reviews-field textarea {
  width: 100%;
  min-height: 44px;
  box-sizing: border-box;
  background: rgba(14, 22, 32, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-md, 10px);
  color: var(--text-primary, #f2e9dd);
  padding: 11px 13px;
  font: inherit;
  font-size: 15px;
}

.case-reviews-field textarea {
  min-height: 92px;
  max-height: 180px;
  resize: vertical;
}

.case-reviews-field input::placeholder,
.case-reviews-field textarea::placeholder {
  color: rgba(242, 233, 221, 0.38);
}

.case-reviews-field input:focus,
.case-reviews-field textarea:focus {
  outline: none;
  border-color: rgba(228, 104, 31, 0.65);
  box-shadow: 0 0 0 3px rgba(228, 104, 31, 0.14);
}

.case-reviews-rating {
  display: inline-flex;
  gap: 6px;
  position: relative;
  margin-top: 2px;
}

.case-reviews-rating input {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  opacity: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  pointer-events: none;
}

.case-reviews-star {
  appearance: none;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(247, 239, 230, 0.14);
  border-radius: 10px;
  background: rgba(14, 22, 32, 0.55);
  color: rgba(242, 233, 221, 0.32);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}

.case-reviews-star:hover {
  color: rgba(234, 109, 30, 0.85);
  border-color: rgba(234, 109, 30, 0.28);
  background: rgba(234, 109, 30, 0.08);
}

.case-reviews-rating input:focus-visible + .case-reviews-star,
.case-reviews-star:focus-visible {
  outline: 2px solid rgba(234, 109, 30, 0.55);
  outline-offset: 2px;
}

.case-reviews-star.is-active,
.case-reviews-rating input:focus-visible + .case-reviews-star.is-active {
  color: var(--accent-500, #ea6d1e);
  border-color: rgba(234, 109, 30, 0.42);
  background: rgba(234, 109, 30, 0.12);
}

.case-reviews-status {
  margin: 0;
  flex: 0 0 auto;
  font-size: 13.5px;
  line-height: 1.45;
  color: rgba(242, 233, 221, 0.7);
}

.case-reviews-status.is-error {
  color: #f0a090;
}

.case-reviews-status.is-success {
  color: rgba(243, 154, 98, 0.95);
}

/* Stable action bar: sticky within the form scrollport (no viewport fixed) */
.case-reviews-actions {
  position: sticky;
  bottom: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  flex: 0 0 auto; /* never absorb leftover modal height */
  align-items: stretch;
  align-self: stretch;
  gap: 10px;
  margin-top: auto;
  margin-left: -18px;
  margin-right: -18px;
  margin-bottom: 0;
  padding: 14px 18px calc(16px + env(safe-area-inset-bottom, 0px));
  background: #1b2632;
  border-top: 1px solid rgba(242, 233, 221, 0.08);
  box-shadow: 0 -10px 16px -12px rgba(0, 0, 0, 0.35);
}

.case-reviews-actions .btn-primary,
.case-reviews-actions .btn-secondary {
  flex: 0 0 auto;
  width: 100%;
  min-height: 48px;
  max-height: 52px;
  height: 48px;
  padding: 12px 18px;
  box-sizing: border-box;
}

.case-reviews-actions .btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .case-reviews-modal {
    padding: 10px;
    align-items: flex-end;
  }

  .case-reviews-modal__dialog {
    width: 100%;
    max-height: min(760px, calc(100vh - 24px));
    max-height: min(760px, calc(100dvh - 24px));
    border-radius: 18px 18px 14px 14px;
    padding: 16px 14px 0;
  }

  .case-reviews-modal__close {
    top: 10px;
    right: 12px;
  }

  .case-reviews-modal__title {
    padding-right: 48px;
  }

  .case-reviews-form {
    padding-right: 8px;
  }

  .case-reviews-actions {
    margin-left: -14px;
    margin-right: -14px;
    padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px));
    gap: 8px;
  }

  .case-reviews-actions .btn-primary,
  .case-reviews-actions .btn-secondary {
    flex: 0 0 auto;
    width: 100%;
    min-height: 48px;
    max-height: 52px;
    height: 48px;
    padding: 12px 16px;
  }
}

@media (max-width: 768px) {
  .case-reviews-wall {
    -webkit-mask-image: linear-gradient(
      to right,
      transparent 0,
      #000 28px,
      #000 calc(100% - 28px),
      transparent 100%
    );
    mask-image: linear-gradient(
      to right,
      transparent 0,
      #000 28px,
      #000 calc(100% - 28px),
      transparent 100%
    );
  }

  .case-reviews.is-marquee .case-review-card {
    width: min(272px, 86vw);
    height: 252px;
  }

  .case-review-text {
    font-size: 14px;
    line-height: 1.6;
  }

  .case-review-stars {
    font-size: 14px;
    gap: 2px;
  }

  .case-reviews.is-marquee .case-reviews-row--left .case-reviews-track,
  .case-reviews.is-marquee .case-reviews-row--right .case-reviews-track {
    animation-duration: 52s;
  }
}

@media (max-width: 768px) {
  .case-reviews-read-modal {
    padding: 16px;
  }

  .case-reviews-read-modal__dialog {
    width: min(460px, calc(100vw - 32px));
  }
}

@media (max-width: 480px) {
  .case-reviews-wall {
    -webkit-mask-image: linear-gradient(
      to right,
      transparent 0,
      #000 24px,
      #000 calc(100% - 24px),
      transparent 100%
    );
    mask-image: linear-gradient(
      to right,
      transparent 0,
      #000 24px,
      #000 calc(100% - 24px),
      transparent 100%
    );
  }

  .case-review-card {
    padding: 14px 14px 12px;
    width: min(272px, 85vw);
    height: 252px;
  }

  .case-reviews-read-modal__dialog {
    border-radius: 18px;
    padding: 18px 16px 16px;
  }

  .case-reviews-read-modal__body {
    padding-top: 4px;
    padding-right: 36px;
  }

  .case-reviews-read-modal__close {
    top: 6px;
    right: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .case-review-card {
    transition: border-color 180ms ease;
  }

  .case-reviews.is-marquee .case-review-card:hover {
    transform: none;
  }

  .case-reviews.is-marquee .case-reviews-wall {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(130, 145, 160, 0.35) transparent;
    -webkit-mask-image: none;
    mask-image: none;
  }

  .case-reviews.is-marquee .case-reviews-row {
    overflow: visible;
  }

  .case-reviews.is-marquee .case-reviews-row--left .case-reviews-track,
  .case-reviews.is-marquee .case-reviews-row--right .case-reviews-track {
    animation: none !important;
    transform: none;
  }
}

/* Home visitor reviews — secondary closing band before contact */
.home-reviews {
  padding-top: clamp(24px, 3.5vw, 36px);
  padding-bottom: clamp(24px, 3vw, 32px);
}

.home-reviews .case-reviews-header h2 {
  font-size: clamp(1.4rem, 2.5vw, 1.85rem);
}
