/* ==========================================================================
   Mach — Newsletter signup section
   Scoped: every rule lives under .mach-nl so nothing leaks into other sections.
   Tokens mirror the live mach.io theme (:root --bg, --mach, --text, --mono …)
   with hard-coded fallbacks so the section renders identically if the theme
   variables are ever renamed.
   ========================================================================== */

.mach-nl {
  --nl-bg: var(--bg, #04070d);
  --nl-surface: var(--surface-2, #111826);
  --nl-field: var(--bg-2, #070b14);
  --nl-text: var(--text, #eef2ff);
  --nl-text-2: var(--text-2, #8594b4);
  --nl-accent: var(--mach, #1fb6f0);
  --nl-accent-bright: var(--mach-bright, #3fc5f8);
  --nl-accent-dim: var(--mach-dim, rgba(31, 182, 240, .08));
  --nl-hair: var(--hairline, rgba(255, 255, 255, .07));
  --nl-hair-2: var(--hairline-2, rgba(255, 255, 255, .13));
  --nl-hair-3: var(--hairline-strong, rgba(255, 255, 255, .2));
  --nl-warn: var(--warn, #ff5b5b);
  --nl-ok: var(--green, #22c55e);
  --nl-display: var(--display, 'Bebas Neue', Impact, sans-serif);
  --nl-sans: var(--sans, 'Poppins', system-ui, sans-serif);
  --nl-mono: var(--mono, 'JetBrains Mono', 'Fira Code', monospace);
  --nl-ease: var(--ease, cubic-bezier(.4, 0, .2, 1));
  --nl-gutter: var(--gutter, clamp(20px, 4vw, 48px));
  --nl-maxw: var(--maxw, 1320px);

  position: relative;
  background: var(--nl-bg);
  color: var(--nl-text);
  font-family: var(--nl-sans);
  padding: clamp(56px, 7vw, 96px) 0;
  border-top: 1px solid var(--nl-hair);
  overflow: hidden;
  box-sizing: border-box;
}
.mach-nl *, .mach-nl *::before, .mach-nl *::after { box-sizing: border-box; }

/* faint technical grid, like the hero */
.mach-nl::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--nl-hair) 1px, transparent 1px),
    linear-gradient(90deg, var(--nl-hair) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 70% 90% at 80% 50%, #000 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 70% 90% at 80% 50%, #000 0%, transparent 70%);
  opacity: .5;
  pointer-events: none;
}

.mach-nl__wrap {
  position: relative;
  max-width: var(--nl-maxw);
  margin: 0 auto;
  padding: 0 var(--nl-gutter);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: center;
}

/* ---------- copy ---------- */
.mach-nl__eyebrow {
  display: block;
  font-family: var(--nl-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--nl-accent);
  margin: 0 0 18px;
}
.mach-nl__title {
  font-family: var(--nl-display);
  font-weight: 400;
  font-size: clamp(40px, 5.2vw, 68px);
  line-height: .95;
  letter-spacing: .005em;
  text-transform: uppercase;
  color: #fff;
  margin: 0 0 18px;
}
.mach-nl__title .mach-nl__accent { color: var(--nl-accent); }
.mach-nl__desc {
  font-size: 17px;
  line-height: 1.75;
  color: rgba(255, 255, 255, .84);
  max-width: 46ch;
  margin: 0;
}
.mach-nl__meta {
  display: flex; flex-wrap: wrap; gap: 8px 22px;
  margin: 26px 0 0; padding: 0; list-style: none;
  font-family: var(--nl-mono);
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--nl-text-2);
}
.mach-nl__meta li::before {
  content: "//"; color: var(--nl-accent); margin-right: 8px; opacity: .8;
}

/* ---------- form panel ---------- */
.mach-nl__panel {
  position: relative;
  background: var(--nl-surface);
  border: 1px solid var(--nl-hair-2);
  border-radius: var(--radius, 10px);
  padding: clamp(24px, 3vw, 40px);
}
.mach-nl__panel::after {           /* accent corner tick */
  content: ""; position: absolute; top: -1px; right: -1px;
  width: 36px; height: 36px;
  border-top: 2px solid var(--nl-accent);
  border-right: 2px solid var(--nl-accent);
  border-radius: 0 var(--radius, 10px) 0 0;
  pointer-events: none;
}

.mach-nl__form { margin: 0; }
.mach-nl__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.mach-nl__field--full { grid-column: 1 / -1; }

.mach-nl__field { display: flex; flex-direction: column; min-width: 0; }
.mach-nl__label {
  font-family: var(--nl-mono);
  font-size: 12px; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase;
  color: #fff; margin: 0 0 8px;
}
.mach-nl__label .mach-nl__opt {
  font-weight: 400; letter-spacing: .08em; text-transform: none;
  color: var(--nl-text-2); margin-left: 6px;
}
.mach-nl__label .mach-nl__req { color: var(--nl-accent); margin-left: 3px; }

.mach-nl__input {
  appearance: none; -webkit-appearance: none;
  width: 100%;
  font-family: var(--nl-sans);
  font-size: 15px; line-height: 1.5;
  color: var(--nl-text);
  background: var(--nl-field);
  border: 1px solid var(--nl-hair-2);
  border-radius: 6px;
  padding: 12px 14px;
  outline: none;
  transition: border-color .18s var(--nl-ease), box-shadow .18s var(--nl-ease);
}
.mach-nl__input::placeholder { color: var(--nl-text-3, #4a5878); }
.mach-nl__input:hover { border-color: var(--nl-hair-3); }
.mach-nl__input:focus-visible {
  border-color: var(--nl-accent);
  box-shadow: 0 0 0 3px var(--nl-accent-dim);
}
.mach-nl__input[aria-invalid="true"] {
  border-color: var(--nl-warn);
  box-shadow: 0 0 0 3px var(--warn-dim, rgba(255, 91, 91, .08));
}
.mach-nl__error {
  font-size: 12.5px; line-height: 1.4; color: var(--nl-warn);
  margin: 6px 0 0; min-height: 0;
}
.mach-nl__error:empty { display: none; }

/* consent */
.mach-nl__consent {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: 20px 1fr; gap: 12px;
  align-items: start; margin-top: 4px;
}
.mach-nl__consent input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 20px; height: 20px; margin: 2px 0 0;
  border: 1px solid var(--nl-hair-3);
  border-radius: 4px;
  background: var(--nl-field);
  display: grid; place-content: center;
  cursor: pointer;
  transition: border-color .18s var(--nl-ease), background .18s var(--nl-ease);
}
.mach-nl__consent input[type="checkbox"]::before {
  content: ""; width: 10px; height: 10px;
  transform: scale(0);
  background: #021019;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  transition: transform .14s var(--nl-ease);
}
.mach-nl__consent input[type="checkbox"]:checked {
  background: var(--nl-accent); border-color: var(--nl-accent);
}
.mach-nl__consent input[type="checkbox"]:checked::before { transform: scale(1); }
.mach-nl__consent input[type="checkbox"]:focus-visible {
  outline: none; box-shadow: 0 0 0 3px var(--nl-accent-dim); border-color: var(--nl-accent);
}
.mach-nl__consent input[type="checkbox"][aria-invalid="true"] { border-color: var(--nl-warn); }
.mach-nl__consent label {
  font-size: 13.5px; line-height: 1.6; color: rgba(255, 255, 255, .76);
  cursor: pointer; margin: 0;
}
.mach-nl__consent a {
  color: var(--nl-accent); text-decoration: underline; text-underline-offset: 3px;
}
.mach-nl__consent a:hover { color: var(--nl-accent-bright); }
.mach-nl__consent .mach-nl__error { grid-column: 1 / -1; margin-top: 0; }

/* honeypot — off-screen, never display:none (bots check that) */
.mach-nl__hp {
  position: absolute !important; left: -9999px !important; top: auto !important;
  width: 1px !important; height: 1px !important; overflow: hidden !important;
}

/* actions row */
.mach-nl__actions {
  grid-column: 1 / -1;
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px;
  margin-top: 6px;
}

/* button — mirrors the theme's .btn.btn-primary exactly (pill, Poppins 500, #1FB6F0) */
.mach-nl__btn {
  appearance: none; -webkit-appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--nl-sans);
  font-size: 14px; font-weight: 500; line-height: 1.5; letter-spacing: .01em;
  color: #021019;
  background: var(--nl-accent);
  border: 1px solid var(--nl-accent);
  border-radius: 999px;
  padding: 14px 26px;
  min-width: 160px;
  cursor: pointer;
  text-decoration: none;
  transition: background .18s var(--nl-ease), transform .18s var(--nl-ease), box-shadow .18s var(--nl-ease);
}
.mach-nl__btn:hover { background: var(--nl-accent-bright); border-color: var(--nl-accent-bright); transform: translateY(-1px); box-shadow: 0 10px 30px -12px var(--mach-glow, rgba(31,182,240,.4)); }
.mach-nl__btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--nl-bg), 0 0 0 5px var(--nl-accent); }
.mach-nl__btn:disabled, .mach-nl__btn[aria-busy="true"] { opacity: .7; cursor: progress; transform: none; box-shadow: none; }
.mach-nl__btn .mach-nl__arrow { transition: transform .18s var(--nl-ease); }
.mach-nl__btn:hover .mach-nl__arrow { transform: translateX(3px); }
.mach-nl__btn .mach-nl__spinner {
  display: none; width: 16px; height: 16px;
  border: 2px solid rgba(2, 16, 25, .3); border-top-color: #021019;
  border-radius: 50%; animation: mach-nl-spin .7s linear infinite;
}
.mach-nl__btn[aria-busy="true"] .mach-nl__spinner { display: inline-block; }
.mach-nl__btn[aria-busy="true"] .mach-nl__arrow { display: none; }
@keyframes mach-nl-spin { to { transform: rotate(360deg); } }

.mach-nl__fine {
  font-family: var(--nl-mono);
  font-size: 11px; letter-spacing: .08em; line-height: 1.5;
  color: var(--nl-text-2); margin: 0;
}
.mach-nl__fine a { color: var(--nl-text-2); text-decoration: underline; text-underline-offset: 2px; }
.mach-nl__fine a:hover { color: var(--nl-text); }

/* status (aria-live) */
.mach-nl__status {
  grid-column: 1 / -1;
  margin: 0; padding: 0;
  font-size: 14px; line-height: 1.55;
}
.mach-nl__status:empty { display: none; }
.mach-nl__status--error {
  color: #ffb4b4;
  padding: 12px 14px;
  border: 1px solid rgba(255, 91, 91, .35);
  background: var(--warn-dim, rgba(255, 91, 91, .08));
  border-radius: 6px;
}

/* success state replaces the form */
.mach-nl__success {
  display: none;
  text-align: left;
  padding: 8px 0 4px;
}
.mach-nl--done .mach-nl__form { display: none; }
.mach-nl--done .mach-nl__success { display: block; }
.mach-nl__success-icon {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-content: center;
  background: var(--nl-accent-dim); border: 1px solid var(--nl-accent);
  color: var(--nl-accent); margin-bottom: 18px;
}
.mach-nl__success-title {
  font-family: var(--nl-display); font-weight: 400;
  font-size: clamp(30px, 3.4vw, 42px); line-height: 1; letter-spacing: .01em;
  text-transform: uppercase; color: #fff; margin: 0 0 10px;
}
.mach-nl__success-text { font-size: 15.5px; line-height: 1.7; color: rgba(255, 255, 255, .84); margin: 0; }

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  .mach-nl *, .mach-nl *::before, .mach-nl *::after { transition: none !important; animation: none !important; }
}

/* ---------- responsive ---------- */
@media (max-width: 991.98px) {
  .mach-nl__wrap { grid-template-columns: 1fr; gap: 36px; }
  .mach-nl__desc { max-width: 60ch; }
}
@media (max-width: 575.98px) {
  .mach-nl { padding: 56px 0 64px; }
  .mach-nl__grid { grid-template-columns: 1fr; gap: 14px; }
  .mach-nl__field--full { grid-column: auto; }
  .mach-nl__input { font-size: 16px; }       /* prevents iOS zoom-on-focus */
  .mach-nl__btn { width: 100%; }
  .mach-nl__actions { flex-direction: column; align-items: stretch; }
  .mach-nl__fine { text-align: center; }
}
