/* Shared newsletter and gated-report interaction states.
   Loaded last so legacy page styles cannot reintroduce bright focus frames. */
html:not(#legacy-publication) {
  --subscriber-focus-line: rgba(17, 17, 17, 0.34);
  --subscriber-focus-halo: rgba(17, 17, 17, 0.07);
  --subscriber-success-bg: #eef8ee;
  --subscriber-success-line: rgba(22, 120, 52, 0.18);
  --subscriber-success-ink: #175b2d;
  --subscriber-error: #c92a2a;
}

html[data-theme='dark']:not(#legacy-publication) {
  --subscriber-focus-line: rgba(255, 255, 255, 0.46);
  --subscriber-focus-halo: rgba(255, 255, 255, 0.09);
  --subscriber-success-bg: rgba(75, 170, 91, 0.12);
  --subscriber-success-line: rgba(125, 215, 139, 0.22);
  --subscriber-success-ink: #a8e5b1;
  --subscriber-error: #ff8585;
}

html:not(#legacy-publication) body :is(
  .formcarry-form,
  [data-editorial-signup],
  .report-gate-form,
  .newsletter-cta-form
) input[type='email']:is(:focus, :focus-visible) {
  border-color: var(--subscriber-focus-line) !important;
  outline: 0 !important;
  box-shadow: none !important;
}

html:not(#legacy-publication) body :is(
  .signup-form,
  .editorial-signup,
  .editorial-capture-form,
  .report-gate-input-row,
  .newsletter-cta-form
):focus-within {
  border-color: var(--subscriber-focus-line) !important;
  outline: 0 !important;
  box-shadow: none !important;
}

html:not(#legacy-publication) body :is(
  .signup-form,
  .editorial-signup,
  .editorial-capture-form,
  .report-gate-input-row,
  .newsletter-cta-form,
  .latest-newsletter form
) {
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    opacity 220ms ease,
    transform 300ms cubic-bezier(.2, .8, .2, 1) !important;
}

html:not(#legacy-publication) body :is(
  .signup-form,
  .editorial-signup,
  .editorial-capture-form,
  .report-gate-form,
  .newsletter-cta-form
).has-error,
html:not(#legacy-publication) body :is(
  .signup-form,
  .editorial-signup,
  .editorial-capture-form,
  .report-gate-form,
  .newsletter-cta-form
).has-error:focus-within {
  border-color: var(--subscriber-error) !important;
  box-shadow:
    inset 0 0 0 1px var(--subscriber-error),
    0 0 0 3px color-mix(in srgb, var(--subscriber-error) 10%, transparent) !important;
}

html:not(#legacy-publication) body :is(
  [data-editorial-signup],
  .report-gate-form,
  .newsletter-cta-form
).is-loading button[type='submit'],
html:not(#legacy-publication) body :is(
  [data-editorial-signup],
  .report-gate-form,
  .newsletter-cta-form
) button[type='submit'][aria-busy='true'] {
  cursor: wait !important;
  opacity: .7 !important;
  transform: none !important;
}

html:not(#legacy-publication) body [data-editorial-signup].is-complete {
  opacity: 0;
  transform: translateY(-5px) scale(.992);
  pointer-events: none;
}

html:not(#legacy-publication) body .editorial-signup-status.is-success {
  display: block;
  width: fit-content;
  min-height: 0;
  margin-top: 12px;
  padding: 10px 13px;
  border-radius: 10px;
  background: var(--subscriber-success-bg);
  color: var(--subscriber-success-ink) !important;
  box-shadow: inset 0 0 0 1px var(--subscriber-success-line);
  font: 600 13px/1.45 'DM Sans', sans-serif !important;
  letter-spacing: -.01em;
  animation: subscriber-confirmation-in 360ms cubic-bezier(.2, .8, .2, 1) both;
}

html:not(#legacy-publication) body .editorial-signup-status.is-error {
  color: var(--subscriber-error) !important;
  font-weight: 600 !important;
}

html:not(#legacy-publication) body .newsletter-cta-form.is-complete {
  opacity: 0;
  transform: translateY(-5px) scale(.992);
  pointer-events: none;
}

html:not(#legacy-publication) body .newsletter-cta-note.is-success {
  width: fit-content;
  margin-top: 12px;
  padding: 10px 13px;
  border-radius: 10px;
  background: var(--subscriber-success-bg);
  color: var(--subscriber-success-ink) !important;
  box-shadow: inset 0 0 0 1px var(--subscriber-success-line);
  font: 600 13px/1.45 'DM Sans', sans-serif !important;
  letter-spacing: -.01em;
  animation: subscriber-confirmation-in 360ms cubic-bezier(.2, .8, .2, 1) both;
}

html:not(#legacy-publication) body .newsletter-cta-note.is-error {
  color: var(--subscriber-error) !important;
  font-weight: 600 !important;
}

html body #editorial-capture :is(input, button):focus-visible {
  outline: 0 !important;
}

html body #editorial-capture .editorial-capture-form:focus-within {
  border-color: var(--subscriber-focus-line) !important;
  box-shadow: none !important;
}

html body #editorial-capture .editorial-capture-success {
  display: grid;
  gap: 4px;
  padding: 16px 18px;
  border-radius: 12px;
  background: var(--subscriber-success-bg);
  color: var(--subscriber-success-ink) !important;
  box-shadow: inset 0 0 0 1px var(--subscriber-success-line);
  animation: subscriber-confirmation-in 360ms cubic-bezier(.2, .8, .2, 1) both;
}

html body #editorial-capture .editorial-capture-success strong {
  font: 700 16px/1.25 'Sora', sans-serif;
  letter-spacing: -.025em;
}

html body #editorial-capture .editorial-capture-success span {
  font: 500 13px/1.5 'DM Sans', sans-serif;
}

html:not(#legacy-publication) body.reports-page .report-gate-input-row:focus-within {
  border-color: var(--reports-muted) !important;
  box-shadow: none !important;
}

html:not(#legacy-publication) body.reports-page .report-gate-success {
  gap: 4px;
  padding: 15px 16px;
  border-radius: 12px;
  background: rgba(82, 177, 99, .1);
  box-shadow: inset 0 0 0 1px rgba(125, 215, 139, .2);
  animation: subscriber-confirmation-in 360ms cubic-bezier(.2, .8, .2, 1) both;
}

html:not(#legacy-publication) body.reports-page .report-gate-success-title {
  font-size: 17px;
}

html:not(#legacy-publication) body.reports-page .report-gate-success-copy {
  margin: 2px 0 12px;
}

html:not(#legacy-publication) body input[type='email']:-webkit-autofill,
html:not(#legacy-publication) body input[type='email']:-webkit-autofill:is(:hover, :focus) {
  -webkit-text-fill-color: currentColor;
  box-shadow: 0 0 0 1000px transparent inset !important;
  transition: background-color 9999s ease-out 0s;
}

@keyframes subscriber-confirmation-in {
  from { opacity: 0; transform: translateY(6px) scale(.985); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html:not(#legacy-publication) body :is(
    .signup-form,
    .editorial-signup,
    .editorial-capture-form,
    .report-gate-input-row,
    .newsletter-cta-form,
    .latest-newsletter form,
    .editorial-signup-status.is-success,
    .newsletter-cta-note.is-success,
    .report-gate-success
  ) {
    animation: none !important;
    transition: none !important;
  }
}
