/* InterWebMarket — modal (public_html/assets/modal.css)
   Uses color tokens from /assets/tokens.css
   - Dark mode aware
   - Mobile-friendly
   - Reduced-motion friendly
*/

/* ---------------- Base modal shell ---------------- */
.iwm-modal{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
           max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgba(0,0,0,.55);           /* backdrop */
  opacity: 0;                             /* for fade-in */
  transition: opacity .18s ease;
}

.iwm-modal[aria-hidden="false"]{
  display: flex;
  opacity: 1;
}

/* ---------------- Dialog panel ---------------- */
.iwm-modal__dialog{
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 10px 40px rgba(0,0,0,.18);
  font: 16px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;

  transform: translateY(8px) scale(.98);
  transition: transform .18s ease, opacity .18s ease;
  opacity: 0;
}

.iwm-modal[aria-hidden="false"] .iwm-modal__dialog{
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce){
  .iwm-modal{ transition: none; }
  .iwm-modal__dialog{ transition: none; transform: none; opacity: 1; }
}

/* ---------------- Close button (if present) ---------------- */
/* Keep off-screen but focusable using a SR-only pattern (better than margin-left:-9999px) */
.iwm-modal__close{
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* ---------------- Form elements ---------------- */
#iwmModalForm label{
  display: block;
  margin: .5rem 0 .25rem;
  color: var(--text);
  font-weight: 600;
}

#iwmModalForm input[type="email"]{
  width: 100%;
  padding: .65rem .75rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}

#iwmModalForm input[type="email"]::placeholder{
  color: var(--muted);
}

#iwmModalForm input[type="email"]:focus-visible{
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent), transparent 70%);
}

/* Submit */
#iwmSubmit{
  margin-top: .75rem;
  padding: .65rem 1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-gold));
  color: var(--accent-contrast);
  font-weight: 700;
  transition: filter .12s ease, transform .12s ease, box-shadow .12s ease;
}
#iwmSubmit:hover{ filter: brightness(1.05); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(0,0,0,.08); }
#iwmSubmit:active{ transform: translateY(0) scale(.98); }

/* Link-style action (e.g., Skip) */
.btn-link{
  margin-left: .5rem;
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  padding: .4rem .25rem;    /* give it a tap area */
  border-radius: .25rem;
}
.btn-link:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------------- Messages / states ---------------- */
.iwm-msg{
  min-height: 1.25rem;
  margin-top: .5rem;
  color: var(--text);
}

/* Optional helper classes if you set them via JS */
.iwm-msg--ok    { color: var(--success); }
.iwm-msg--warn  { color: var(--warning); }
.iwm-msg--error { color: var(--danger); }

/* ---------------- Honeypot (bot trap) ---------------- */
.iwm-hp{
  position: absolute !important;
  left: -9999px !important;
}

/* ---------------- Small screens ---------------- */
@media (max-width: 560px){
  .iwm-modal__dialog{
    max-width: 100%;
    margin: 0;
    border-radius: 10px;
    padding: 1rem;
  }
}

/* ---------------- Theming extras (optional) ---------------- */
/* Make backdrop slightly stronger in dark for contrast */
:root[data-theme="dark"] .iwm-modal{
  background: rgba(0,0,0,.65);
}

/* If you use images or icons inside the dialog, they’ll inherit filter here if needed
   (commented out by default)
   .iwm-modal__dialog img { filter: brightness(.95) contrast(1.05); }
*/
