/* ==========================================================================
 * newsletter_signup.css — the sign-up form component (landing block + footer)
 * --------------------------------------------------------------------------
 * Rendered by includes/newsletter_signup_form.php. One stylesheet for every
 * capture point so a visual correction lands once.
 *
 * Contract:
 *   · Built on theme_a tokens, so the same markup renders correctly on the
 *     light-only landing page AND on the themed public pages in dark mode.
 *   · Logical properties only (margin-inline, inset-inline, text-align:start)
 *     — the Arabic layout is a mirror, never a special case.
 *   · Mobile-first. The two breakpoints (480 / 900) only ever ADD columns.
 * ========================================================================== */

.nlx {
  --nlx-accent: var(--primary-on-light, #b04600);
  --nlx-surface: var(--surface, #fff);
  --nlx-border: var(--border, rgba(11, 18, 32, 0.12));
  --nlx-text: var(--text, #0b1220);
  --nlx-muted: var(--muted, #526178);
  --nlx-radius: 16px;
  position: relative; /* containing block for the clipped honeypot + live region */
  color: var(--nlx-text);
  font-family: var(--font-sans, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif);
  text-align: start;
}

html[data-theme="dark"] .nlx {
  --nlx-accent: var(--accent-strong, #ffae66);
}

/* `hidden` must beat the component's own display rules — without this the
   success panel and the error variants would be permanently visible. */
.nlx [hidden] {
  display: none !important;
}

.nlx *,
.nlx *::before,
.nlx *::after {
  box-sizing: border-box;
}

/* ---- form skeleton ---------------------------------------------------- */
.nlx__form {
  display: grid;
  gap: 14px;
  margin: 0;
}

.nlx__row {
  display: grid;
  gap: 10px;
}

.nlx__field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.nlx__label {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--nlx-muted);
  line-height: 1.4;
}

.nlx__input {
  width: 100%;
  min-height: 52px;
  padding: 13px 16px;
  border: 1px solid var(--nlx-border);
  border-radius: 13px;
  background: var(--nlx-surface);
  color: var(--nlx-text);
  font: inherit;
  font-size: 16px; /* < 16px makes iOS Safari zoom on focus */
  line-height: 1.5;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.nlx__input::placeholder {
  color: var(--nlx-muted);
  opacity: .75;
}

.nlx__input:hover {
  border-color: rgba(var(--text-rgb, 11, 18, 32), 0.24);
}

.nlx__input:focus-visible,
.nlx__input:focus {
  outline: none;
  border-color: var(--primary, #ff7a18);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 255, 122, 24), 0.28);
}

.nlx__input[aria-invalid="true"] {
  border-color: var(--danger, #ef4444);
  box-shadow: 0 0 0 3px rgba(var(--danger-rgb, 239, 68, 68), 0.18);
}

/* ---- submit ----------------------------------------------------------- */
.nlx__btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 14px 24px;
  border: 0;
  border-radius: 13px;
  background: var(--primary-strong, #c14a00);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(var(--primary-strong-rgb, 193, 74, 0), .26);
  transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}

.nlx__btn:hover:not(:disabled) {
  background: #a63f00;
  transform: translateY(-1px);
}

.nlx__btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 255, 122, 24), .45);
}

.nlx__btn:disabled {
  cursor: progress;
  opacity: .82;
  transform: none;
}

.nlx__spinner {
  display: none;
  width: 17px;
  height: 17px;
  border: 2px solid rgba(255, 255, 255, .38);
  border-top-color: #fff;
  border-radius: 50%;
  animation: nlx-spin .7s linear infinite;
}

.nlx__btn[aria-busy="true"] .nlx__spinner {
  display: block;
}

@keyframes nlx-spin {
  to { transform: rotate(360deg); }
}

/* ---- error ------------------------------------------------------------ */
.nlx__error {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0;
  padding: 11px 14px;
  border: 1px solid rgba(var(--danger-rgb, 239, 68, 68), .35);
  border-radius: 12px;
  background: rgba(var(--danger-rgb, 239, 68, 68), .08);
  color: var(--danger, #ef4444);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.55;
}

.nlx__error-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  margin-block-start: 1px;
  border-radius: 50%;
  background: var(--danger, #ef4444);
  color: #fff;
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1;
}

/* ---- legal block (Art. 13 DSGVO — always visible AT the form) ---------- */
.nlx__legal {
  display: grid;
  gap: 7px;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--nlx-muted);
}

.nlx__legal-main,
.nlx__legal-sub,
.nlx__legal-badge {
  margin: 0;
}

.nlx__legal-link {
  color: var(--nlx-accent);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.nlx__legal-badge {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-weight: 700;
  color: var(--nlx-accent);
}

.nlx__legal-shield {
  flex: 0 0 auto;
  margin-block-start: 2px;
}

/* ---- honeypot: reachable for bots, invisible + inert for humans --------
   Clipped, NOT pushed off-canvas: an `inset-inline-start:-9999px` field is
   harmless in LTR but sticks 9999px out of the page in RTL, which is real
   horizontal overflow on every Arabic page. Clipping is direction-neutral. */
.nlx__trap {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  pointer-events: none;
}

/* ---- success ---------------------------------------------------------- */
.nlx__done {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 20px;
  border: 1px solid rgba(var(--success-rgb, 34, 197, 94), .32);
  border-radius: var(--nlx-radius);
  background: rgba(var(--success-rgb, 34, 197, 94), .09);
}

.nlx__done:focus-visible {
  outline: 2px solid var(--primary, #ff7a18);
  outline-offset: 3px;
}

.nlx__done-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--success, #22c55e);
  color: #fff;
}

.nlx__done-title {
  margin: 4px 0 0;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--nlx-text);
}

.nlx__done-body {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--nlx-text);
}

.nlx__done-hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--nlx-muted);
}

/* screen-reader-only live region */
.nlx__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ==========================================================================
 * Variant: landing section card
 * ========================================================================== */
.nlx--section {
  padding: clamp(20px, 4.4vw, 30px);
  border: 1px solid var(--nlx-border);
  border-radius: 22px;
  background: var(--nlx-surface);
  box-shadow: 0 26px 60px -34px rgba(15, 23, 42, .45);
}

.nlx--section .nlx__form {
  gap: 16px;
}

.nlx--section .nlx__btn {
  width: 100%;
  min-height: 56px;
  font-size: 16.5px;
}

.nlx--section .nlx__done {
  border: 0;
  padding: 8px 0 0;
  background: transparent;
}

/* ==========================================================================
 * Variant: site footer strip
 * ========================================================================== */
.nlx--footer {
  --nlx-muted: var(--muted-color, var(--muted, #526178));
}

.nlx--footer .nlx__legal {
  font-size: 12px;
}

.nlx--footer .nlx__done {
  padding: 16px;
}

@media (min-width: 34rem) {
  .nlx--footer .nlx__row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 12px;
  }
  .nlx--footer .nlx__btn {
    white-space: nowrap;
  }
}

/* ==========================================================================
 * Built-in heading (Batch 5) — used by the `card` and `inline` variants,
 * which sit on pages with no natural place for a hand-written heading.
 * ========================================================================== */
.nlx__intro {
  display: grid;
  gap: 6px;
  margin-block-end: 16px;
}

.nlx__intro-title {
  margin: 0;
  font-size: clamp(19px, 2.4vw, 23px);
  font-weight: 800;
  line-height: 1.3;
  color: var(--nlx-text);
}

.nlx__intro-sub {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--nlx-muted);
}

/* ==========================================================================
 * Variant: self-contained card (thank-you page, cancelled checkout,
 * onboarding, tenant panel)
 * ========================================================================== */
.nlx--card {
  padding: clamp(18px, 4vw, 26px);
  border: 1px solid var(--nlx-border);
  border-radius: 18px;
  background: var(--nlx-surface);
  box-shadow: 0 18px 44px -30px rgba(15, 23, 42, .42);
}

.nlx--card .nlx__btn {
  width: 100%;
}

.nlx--card .nlx__done {
  border: 0;
  padding: 4px 0 0;
  background: transparent;
}

@media (min-width: 34rem) {
  .nlx--card .nlx__row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }
  .nlx--card .nlx__btn {
    width: auto;
    white-space: nowrap;
  }
}

/* ==========================================================================
 * Variant: in-article band (/funktionen/*, guest page)
 * --------------------------------------------------------------------------
 * Reads as part of the article rather than as a boxed advert: a tinted band,
 * no shadow, heading and form side by side once there is room for it.
 * ========================================================================== */
.nlx--inline {
  margin-block: 34px 8px;
  padding: clamp(20px, 4vw, 30px);
  border: 1px solid var(--nlx-border);
  border-radius: 20px;
  background:
    linear-gradient(
      135deg,
      rgba(var(--primary-rgb, 255, 122, 24), .07),
      rgba(var(--primary-rgb, 255, 122, 24), .015)
    ),
    var(--nlx-surface);
}

.nlx--inline .nlx__intro {
  margin-block-end: 18px;
}

.nlx--inline .nlx__btn {
  width: 100%;
}

@media (min-width: 34rem) {
  .nlx--inline .nlx__row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }
  .nlx--inline .nlx__btn {
    width: auto;
    white-space: nowrap;
  }
}

@media (min-width: 56rem) {
  .nlx--inline {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    gap: clamp(20px, 3vw, 40px);
    align-items: center;
  }
  .nlx--inline .nlx__intro {
    margin-block-end: 0;
  }
  /* The success panel and the live region are siblings of the form, so they
     would each claim a grid cell. Both belong in the form's column. */
  .nlx--inline .nlx__done {
    grid-column: 2;
  }
  .nlx--inline .nlx__sr {
    grid-column: 2;
  }
}

/* ==========================================================================
 * EMBEDDED OPT-IN BOX (.nlo) — the checkbox that rides inside a host form.
 * Rendered by includes/newsletter_optin_embed.php.
 * ========================================================================== */
.nlo {
  --nlo-accent: var(--primary-on-light, #b04600);
  --nlo-border: var(--border, rgba(11, 18, 32, 0.14));
  --nlo-text: var(--text-color, var(--text, #0b1220));
  --nlo-muted: var(--muted-color, var(--muted, #526178));
  color: var(--nlo-text);
  text-align: start;
}

html[data-theme="dark"] .nlo {
  --nlo-accent: var(--accent-strong, #ffae66);
}

.nlo *,
.nlo *::before,
.nlo *::after {
  box-sizing: border-box;
}

.nlo__row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

/* 24px box inside a 44px hit area: the visual weight of a consent control
   should not dictate how hard it is to hit on a phone. */
.nlo__box {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  margin: 10px 0 0;
  accent-color: var(--nlo-accent);
  cursor: pointer;
}

.nlo__box:focus-visible {
  outline: 2px solid var(--primary, #ff7a18);
  outline-offset: 3px;
}

.nlo__text {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding-block: 6px;
}

.nlo__label {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
  cursor: pointer;
}

.nlo__hint,
.nlo__meta {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--nlo-muted);
}

.nlo__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.nlo__link {
  color: var(--nlo-accent);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Tone: a framed card, for hosts whose own rows carry no frame (chat gate). */
.nlo--card {
  padding: 14px 16px;
  border: 1px solid var(--nlo-border);
  border-radius: 14px;
  background: rgba(var(--primary-rgb, 255, 122, 24), .05);
}

html[lang="ar"] .nlo,
html[dir="rtl"] .nlo {
  letter-spacing: normal;
}

html[lang="ar"] .nlo__label,
html[lang="ar"] .nlo__hint,
html[lang="ar"] .nlo__meta {
  line-height: 1.9;
}

html[lang="ar"] .nlo__box {
  margin-block-start: 12px;
}

@media (forced-colors: active) {
  .nlo--card {
    border: 1px solid CanvasText;
  }
}

/* ==========================================================================
 * Arabic / RTL
 * --------------------------------------------------------------------------
 * Cairo needs room: no letter-spacing (it breaks the joined script) and a
 * slightly taller line box so descenders are not clipped.
 * ========================================================================== */
/* Cairo, explicitly.
   `.nlx` declares its own font-family, and a declaration on the element always
   beats an inherited one — so the component was quietly overriding the
   `body.cairo-font` rule that public-i18n.js switches on for Arabic pages, and
   Arabic sign-up copy rendered in the Latin system stack while the article
   around it was Cairo. Measured in the Batch-5 gate (the checkout box, which
   declares no font and therefore inherits correctly, showed Cairo; every .nlx
   surface showed ui-sans-serif). The @font-face lives in public.css, which every
   host page already loads. */
html[lang="ar"] .nlx,
html[dir="rtl"] .nlx,
.nlx[data-nlx-lang="ar"] {
  font-family: 'Cairo', 'Tahoma', 'Arial', sans-serif;
  letter-spacing: normal;
}

html[lang="ar"] .nlx__input,
html[dir="rtl"] .nlx__input,
html[lang="ar"] .nlx__btn,
html[dir="rtl"] .nlx__btn,
.nlx[data-nlx-lang="ar"] .nlx__input,
.nlx[data-nlx-lang="ar"] .nlx__btn {
  /* `font: inherit` on these two would resolve against the form, not the block,
     on hosts whose form element carries its own stack. Naming it is cheaper than
     reasoning about every host. */
  font-family: 'Cairo', 'Tahoma', 'Arial', sans-serif;
}

html[lang="ar"] .nlx__label,
html[lang="ar"] .nlx__legal,
html[lang="ar"] .nlx__done-body,
html[lang="ar"] .nlx__error,
html[lang="ar"] .nlx__intro-sub {
  line-height: 1.85;
}

html[lang="ar"] .nlx__intro-title {
  line-height: 1.55;
  padding-block-end: 2px;
}

html[lang="ar"] .nlx__input {
  padding-block: 12px 14px;
  line-height: 1.7;
}

html[lang="ar"] .nlx__btn {
  padding-block: 13px 15px;
  line-height: 1.5;
}

/* ==========================================================================
 * Motion / contrast preferences
 * ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .nlx__btn,
  .nlx__input {
    transition: none;
  }
  .nlx__spinner {
    animation-duration: 2.4s;
  }
}

@media (forced-colors: active) {
  .nlx__input,
  .nlx__btn,
  .nlx__error,
  .nlx__done {
    border: 1px solid CanvasText;
  }
}
