/* The pop-up enquiry form (tools/contact-modal.mjs, contact-modal.js).
   Same look as the Security Controls Finder's modal: a frosted deep-violet overlay with soft glows,
   a large light panel that warps in, a dark brand column beside the form. Every rule is scoped to
   .tscm and resets what the theme styles globally (buttons, inputs), so the page cannot leak in. */
.tscm {
  --tscm-violet: #9137FF; --tscm-purple: #4F1398; --tscm-cyan: #00F1FF; --tscm-ink: #1A1530;
  --tscm-muted: #4E4A5A; --tscm-line: #8B7AAE; --tscm-field: rgba(255, 255, 255, .82);
  --tscm-error: #B42318; --tscm-ok: #0F7A4A; --tscm-focus: #4F1398;
  --tscm-warp: cubic-bezier(.59, 0, .35, 1); --tscm-ease: cubic-bezier(.2, .8, .2, 1);
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: transparent; color: var(--tscm-ink);
  overflow: hidden; overflow: clip; color-scheme: only light; overscroll-behavior: contain;
  font-family: "Neo Sans Regular", "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 1.5;
}
.tscm[open] { display: grid; place-items: center; }
.tscm::backdrop { background: transparent; }
.tscm *, .tscm *::before, .tscm *::after { box-sizing: border-box; }
html.tscm-lock { overflow: hidden; scrollbar-gutter: stable; background: #07031A; }

/* the overlay: the page frosted and darkened to deep violet, two slow glows (violet, cyan) */
.tscm-overlay {
  position: absolute; inset: 0; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 120%, rgba(79, 19, 152, .55), rgba(79, 19, 152, 0) 70%), rgba(7, 3, 26, .74);
  -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%);
}
.tscm-blob { position: absolute; display: block; border-radius: 50%; pointer-events: none; }
.tscm-blob-a { left: -22vmax; top: -26vmax; width: 78vmax; height: 78vmax; background: radial-gradient(closest-side, rgba(145, 55, 255, .55), rgba(145, 55, 255, .2) 50%, rgba(145, 55, 255, 0)); }
.tscm-blob-b { right: -26vmax; top: 18vh; width: 72vmax; height: 72vmax; background: radial-gradient(closest-side, rgba(0, 241, 255, .34), rgba(0, 241, 255, .12) 50%, rgba(0, 241, 255, 0)); }

/* the panel: brand column + form, up to 1040 x 760, never more than 94% x 92% of the window */
.tscm-panel {
  position: relative; z-index: 1; display: grid; grid-template-columns: 320px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr);
  width: min(1040px, 94vw); max-height: min(760px, 92vh); max-height: min(760px, 92dvh);
  border-radius: 28px; overflow: hidden; transform-origin: 50% 0;
  background:
    radial-gradient(closest-side, rgba(145, 55, 255, .32), rgba(145, 55, 255, 0)) right -160px top -160px / 620px 560px no-repeat,
    radial-gradient(closest-side, rgba(0, 241, 255, .3), rgba(0, 241, 255, 0)) right -200px bottom -220px / 640px 600px no-repeat,
    #F9F6FF;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .5), 0 40px 120px rgba(4, 2, 20, .55), 0 0 90px rgba(145, 55, 255, .28);
}

@keyframes tscm-in-warp { from { opacity: 0; transform: perspective(1000px) scaleX(.4) scaleY(2) rotateX(-5deg) skewY(-1.5deg); } to { opacity: 1; transform: none; } }
@keyframes tscm-in-rise { from { translate: 0 100px; } to { translate: 0 0; } }
@keyframes tscm-out-warp { from { opacity: 1; transform: none; } to { opacity: 0; transform: perspective(1000px) scaleX(.4) scaleY(2) rotateX(-5deg) skewY(-1.5deg); translate: 0 100px; } }
@keyframes tscm-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes tscm-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes tscm-breathe { 0%, 100% { scale: 1; } 50% { scale: .7; } }
.tscm[open] .tscm-panel { animation: tscm-in-warp .35s var(--tscm-warp) backwards, tscm-in-rise .7s cubic-bezier(.22, 1.12, .36, 1) backwards; }
.tscm[open] .tscm-overlay { animation: tscm-fade-in .35s ease-out both; }
.tscm[open] .tscm-blob-a { animation: tscm-fade-in .8s ease-out both, tscm-breathe 15s ease-in-out .8s infinite; }
.tscm[open] .tscm-blob-b { animation: tscm-fade-in .8s ease-out .1s both, tscm-breathe 15s ease-in-out -7.5s infinite; }
.tscm.is-closing .tscm-panel { animation: tscm-out-warp .3s var(--tscm-warp) both; }
.tscm.is-closing .tscm-overlay { animation: tscm-fade-out .3s ease-in .04s both; }

/* the brand column: dark violet, the eyebrow, the heading, and what we will send about the visit */
.tscm-side {
  display: flex; flex-direction: column; gap: 18px; min-height: 0; overflow-y: auto; padding: 36px 30px 30px;
  color: #ffffff;
  background:
    radial-gradient(130% 55% at 0% 100%, rgba(145, 55, 255, .5), rgba(145, 55, 255, 0) 70%),
    radial-gradient(90% 35% at 100% 0%, rgba(0, 241, 255, .14), rgba(0, 241, 255, 0) 70%),
    linear-gradient(180deg, #0E0628 0%, #170742 100%);
}
.tscm-eyebrow { margin: 0; font-family: "Neo Sans Bold", "Segoe UI", sans-serif; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: #68F5FD; }
.tscm .tscm-title { margin: 0; font-family: "Neo Sans Bold", "Segoe UI", sans-serif; font-weight: 400; font-size: 30px; line-height: 1.15; color: #ffffff; }
.tscm-lede { margin: 0; font-size: 16px; color: rgba(255, 255, 255, .82); }
.tscm-about { margin: 6px 0 0; padding: 16px 18px; border-radius: 16px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); }
.tscm-about[hidden] { display: none; }
.tscm-about-label { margin: 0 0 4px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: rgba(255, 255, 255, .66); }
.tscm-about-page { margin: 0; font-family: "Neo Sans Bold", "Segoe UI", sans-serif; font-size: 16px; color: #ffffff; overflow-wrap: anywhere; }
.tscm-chip { display: inline-block; margin-top: 10px; padding: 4px 12px; border-radius: 999px; background: rgba(145, 55, 255, .35); border: 1px solid rgba(185, 138, 255, .6); font-size: 14px; color: #ffffff; }
.tscm-chip[hidden] { display: none; }

/* the form column */
.tscm-main { position: relative; min-height: 0; overflow-y: auto; padding: 40px 44px 32px; }
.tscm .tscm-form-title { margin: 0 0 6px; padding-right: 52px; font-family: "Neo Sans Bold", "Segoe UI", sans-serif; font-weight: 400; font-size: 22px; color: var(--tscm-purple); }
.tscm-form-lede { margin: 0 0 22px; color: var(--tscm-muted); font-size: 15px; }
.tscm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.tscm-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tscm-field-wide { grid-column: 1 / -1; }
.tscm .tscm-label { margin: 0; padding: 0; line-height: 1.35; font-family: "Neo Sans Bold", "Segoe UI", sans-serif; font-weight: 400; font-size: 14px; color: var(--tscm-ink); }
.tscm-req { color: var(--tscm-purple); }
.tscm-opt { color: var(--tscm-muted); font-family: "Neo Sans Regular", "Segoe UI", sans-serif; }
.tscm .tscm-input, .tscm .tscm-input:focus, .tscm .tscm-input:hover {
  width: 100%; min-height: 48px; margin: 0; padding: 11px 14px; border: 1px solid var(--tscm-line); border-radius: 12px;
  background: var(--tscm-field); color: var(--tscm-ink); font: inherit; font-size: 16px; line-height: 1.4; box-shadow: none;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.tscm select.tscm-input { appearance: auto; padding-right: 10px; }
.tscm textarea.tscm-input { min-height: 112px; resize: vertical; }
.tscm .tscm-input:hover { border-color: #6B5A92; background: #ffffff; }
.tscm .tscm-input:focus { outline: 2px solid transparent; outline-offset: 1px; border-color: var(--tscm-purple); background: #ffffff; box-shadow: 0 0 0 3px rgba(145, 55, 255, .28); }
.tscm .tscm-input[aria-invalid="true"] { border-color: var(--tscm-error); box-shadow: 0 0 0 3px rgba(180, 35, 24, .14); }
.tscm .tscm-input[aria-invalid="true"]:focus { border-color: var(--tscm-error); box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px var(--tscm-error); }
.tscm-err { margin: 0; font-size: 14px; color: var(--tscm-error); }
.tscm-err:empty { display: none; }
.tscm-note { margin: 18px 0 0; font-size: 14px; color: var(--tscm-muted); }
.tscm .tscm-note a { color: var(--tscm-purple); text-decoration: underline; }
.tscm-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; margin-top: 22px; }
.tscm .tscm-send, .tscm .tscm-send:hover, .tscm .tscm-send:focus {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; margin: 0; padding: 12px 30px;
  border: 0; border-radius: 999px; background: var(--tscm-violet); color: #ffffff; cursor: pointer;
  font-family: "Neo Sans Bold", "Segoe UI", sans-serif; font-size: 17px; line-height: 1.2; text-transform: none;
  box-shadow: 0 10px 26px rgba(145, 55, 255, .35); transition: background-color .15s, transform .2s var(--tscm-ease);
}
.tscm .tscm-send:hover { background: var(--tscm-purple); transform: translateY(-1px); }
.tscm .tscm-send:focus-visible { outline: 3px solid var(--tscm-purple); outline-offset: 3px; }
.tscm .tscm-note a:focus-visible, .tscm .tscm-status a:focus-visible { outline: 3px solid var(--tscm-purple); outline-offset: 2px; }
.tscm .tscm-send[disabled] { cursor: progress; opacity: .7; transform: none; }
.tscm-status { margin: 0; font-size: 15px; color: var(--tscm-error); }
.tscm-status:empty { display: none; }
.tscm .tscm-status a { color: var(--tscm-purple); text-decoration: underline; }

/* sent */
.tscm-done { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; padding-top: 30px; }
.tscm-done[hidden] { display: none; }
.tscm-done-mark { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: rgba(31, 183, 115, .14); color: var(--tscm-ok); }
.tscm-done-mark svg { width: 32px; height: 32px; }
.tscm .tscm-done-title { margin: 0; font-family: "Neo Sans Bold", "Segoe UI", sans-serif; font-weight: 400; font-size: 26px; color: var(--tscm-purple); }
.tscm .tscm-done-title:focus { outline: none; }
.tscm-done p { margin: 0; color: var(--tscm-muted); max-width: 46ch; }

/* close, top right of the panel */
.tscm .tscm-close, .tscm .tscm-close:hover, .tscm .tscm-close:focus {
  position: absolute; z-index: 3; top: 18px; right: 18px; display: grid; place-items: center;
  width: 44px; height: 44px; padding: 0; margin: 0; border: 1px solid rgba(79, 19, 152, .14); border-radius: 50%;
  background: rgba(255, 255, 255, .78); color: var(--tscm-purple); cursor: pointer;
  box-shadow: 0 4px 14px rgba(79, 19, 152, .12); transition: background-color .15s;
}
.tscm .tscm-close:hover { background: #ffffff; }
.tscm .tscm-close:focus-visible { outline: 3px solid var(--tscm-focus); outline-offset: 2px; }
.tscm-close svg { width: 20px; height: 20px; }
.tscm-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* tablets: a narrower brand column */
@media (max-width: 960px) {
  .tscm-panel { grid-template-columns: 260px minmax(0, 1fr); }
  .tscm-side { padding: 30px 22px 24px; }
  .tscm .tscm-title { font-size: 26px; }
  .tscm-main { padding: 34px 28px 28px; }
}
/* phones: a full-screen sheet; the brand column becomes a short header, the whole sheet scrolls */
@media (max-width: 720px) {
  .tscm[open] { display: block; }
  .tscm-panel {
    display: block; width: 100%; height: 100%; max-height: none; border-radius: 0; overflow-y: auto; overscroll-behavior: contain;
  }
  .tscm-side { gap: 10px; overflow: visible; padding: 22px 70px 22px 18px; }
  .tscm .tscm-title { font-size: 23px; }
  .tscm-lede { font-size: 15px; }
  .tscm-about { margin-top: 2px; padding: 12px 14px; }
  .tscm-main { overflow: visible; padding: 22px 18px 28px; }
  .tscm .tscm-form-title { padding-right: 0; font-size: 20px; }
  .tscm-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .tscm .tscm-send { width: 100%; }
  .tscm .tscm-close, .tscm .tscm-close:hover, .tscm .tscm-close:focus { position: fixed; top: 14px; right: 14px; background: rgba(255, 255, 255, .9); }
}
@media (prefers-reduced-motion: reduce) {
  .tscm[open] .tscm-panel, .tscm[open] .tscm-overlay, .tscm.is-closing .tscm-panel, .tscm.is-closing .tscm-overlay { animation-duration: .01s; animation-delay: 0s; }
  .tscm[open] .tscm-blob-a, .tscm[open] .tscm-blob-b { animation: none; }
}
