/* Story gate, reader reviews and the feedback/unsubscribe pages. */

.story-content.is-gated .story-locked {
  position: relative;
  max-height: 11rem;
  overflow: hidden;
}

.story-content.is-gated .story-locked::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, #fff 90%);
  pointer-events: none;
}

.story-locked.is-revealing {
  overflow: hidden;
  transition: max-height .9s ease;
}

.story-gate {
  margin: 0 0 2.5rem;
  padding: 1.75rem 1.5rem;
  background: var(--color-primary-10);
  color: var(--color-neutral-80);
  border-radius: var(--br-main);
  transition: opacity .4s ease;
}

.story-gate.is-leaving { opacity: 0; }

.story-gate-title {
  font-size: 1.5rem;
  margin-bottom: .75rem;
  color: var(--color-primary-darker);
}

.story-gate-text { margin-bottom: 1.25rem; }

.story-gate .mad-form-item { display: block; width: 100%; margin-bottom: 1rem; }
.story-gate .mad-form-item input[type=text],
.story-gate .mad-form-item input[type=email] { width: 100%; max-width: none; }

.story-gate-fields { display: grid; gap: 0 1rem; }

@media (min-width: 576px) {
  .story-gate-fields { grid-template-columns: 1fr 1fr; }
}

/* The theme hides native checkboxes and draws one on label::before. Keep that
   look, but leave the real input focusable so the form works from the keyboard. */
.story-gate-consent,
.reader-page-checkbox { position: relative; }

.story-gate-consent input[type=checkbox],
.reader-page-checkbox input[type=checkbox],
.rating-input-stars input[type=radio] {
  display: block !important;
  position: absolute;
  top: 0;
  left: 0;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  opacity: 0;
}

.story-gate-consent input[type=checkbox] + label[for],
.reader-page-checkbox input[type=checkbox] + label[for] {
  font-size: .9375rem;
  letter-spacing: normal;
  cursor: pointer;
}

.story-gate-consent input:focus-visible + label[for]::before,
.reader-page-checkbox input:focus-visible + label[for]::before {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

.story-gate .has-error input[type=checkbox] + label[for]::before { border-color: #c0392b; }

.story-gate .mad-error-message { display: block; margin-top: .35rem; }
.story-gate [hidden] { display: none !important; }
.story-gate .has-error input { border-color: #c0392b; }

.story-gate input:focus-visible,
.story-gate button:focus-visible,
.story-gate a:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

.story-gate button[disabled] { opacity: .6; cursor: progress; }

/* Reviews under the story */
.story-reviews { margin-top: 3rem; padding-top: 2.5rem; border-top: 1px solid var(--color-primary-25); }
.story-reviews-title { font-size: 1.5rem; margin-bottom: 1.5rem; }
.story-reviews-list { list-style: none; padding: 0; margin: 0; }
.story-review { background: var(--color-primary-5); border-radius: var(--br-main); padding: 1.25rem 1.5rem; }
.story-review + .story-review { margin-top: 1rem; }
.story-review-meta { display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: baseline; margin-bottom: .5rem; }
.story-review-date { font-size: .875rem; opacity: .7; }
.story-review p { margin: 0 0 .5rem; white-space: pre-line; overflow-wrap: anywhere; }
.story-review p:last-child { margin-bottom: 0; }

.story-review-stars span { color: var(--color-neutral-20); font-size: 1.125rem; }
.story-review-stars span.is-on { color: #E8A317; }

/* Feedback page */
.reader-page { max-width: 42rem; margin: 0 auto; }
.reader-page .mad-form-item { display: block; width: 100%; margin-bottom: 1.25rem; }
.reader-page textarea { width: 100%; max-width: none; }

.rating-input { border: 0; padding: 0; margin: 0 0 1.5rem; }
.rating-input legend { font-weight: 700; margin-bottom: .5rem; font-size: 1.25rem; }
.rating-input-stars { display: inline-flex; flex-direction: row-reverse; gap: .25rem; }
.rating-input-stars { position: relative; }
.rating-input-stars input[type=radio] + label[for] { padding-left: 0; letter-spacing: normal; font-size: 2.5rem; line-height: 1; margin: 0; }
.rating-input-stars input[type=radio] + label[for]::before,
.rating-input-stars input[type=radio] + label[for]::after { content: none !important; display: none !important; }
.rating-input-stars label { font-size: 2.5rem; line-height: 1; color: var(--color-neutral-20); cursor: pointer; padding: 0 .1rem; }
.rating-input-stars label:hover,
.rating-input-stars label:hover ~ label,
.rating-input-stars input:checked ~ label { color: #E8A317; }
.rating-input-stars input:focus-visible + label { outline: 3px solid var(--color-primary); outline-offset: 2px; border-radius: 4px; }


.reader-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
