/* ==========================================================================
   Visionary Education — dialogs.

   The record-bound call-to-action dialogs (apply / book a consultation /
   enquire / fee quote) and the success-story dialog.

   SAFE TO LOAD ON ANY PAGE: every rule here is scoped to `.ve-modal`, so it
   cannot reach a band or a section elsewhere on the page.

   The CTA *button* family (`.ve-ctaset` / `.ve-cta`) used to live in this file
   and does not any more — it is in `cta-buttons.css`. `.ve-cta` is also the
   name of the homepage CTA *band* in sections.css: two different components,
   one class name. While this file was only ever loaded on record pages the
   clash was dormant, but the moment the homepage needed a dialog the band
   turned into an inline-flex button. Splitting the two is what makes the
   dialog reusable anywhere. Load `cta-buttons.css` only on pages that use the
   button family, and never on a page that has the CTA band.
   ========================================================================== */

/* ---- The dialog shell ---------------------------------------------------- */

/* `position` / `inset` / `margin` are stated rather than left to the browser's
   dialog defaults: setting a width without them dropped the panel into the
   top-left corner instead of the middle of the screen. */
.ve-modal {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(46rem, calc(100vw - 2rem));
  max-width: calc(100vw - 2rem);
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ve-text, #3c3663);
  overflow: visible;
}

.ve-modal:not([open]) { display: none; }
.ve-modal[open] { display: block; }
.ve-modal::backdrop { background: rgb(20 17 44 / .62); }

.ve-modal__panel {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 2rem);
  border-radius: var(--ve-radius-xl, 1.15rem);
  background: #fff;
  box-shadow: 0 32px 80px rgb(20 17 44 / .34);
  overflow: hidden;
}

/* ---- Head ---------------------------------------------------------------- */

.ve-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem clamp(1.1rem, 3vw, 1.9rem);
  background: linear-gradient(135deg, var(--ve-primary-dark, #17113f), var(--ve-primary, #4c1d95));
  color: #fff;
}

.ve-modal__eyebrow {
  display: block;
  font-size: var(--ve-text-xs);
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ve-gold-400, #f0c04a);
}

.ve-modal__title { margin: .3rem 0 0; font-size: var(--ve-text-xl); font-weight: 800; color: #fff; line-height: 1.25; }

.ve-modal__about {
  margin: .5rem 0 0;
  font-size: var(--ve-text-sm);
  line-height: 1.45;
  color: var(--ve-text-muted, #6b6490);
}
.ve-modal__about span { opacity: .8; }
.ve-modal__about strong { font-weight: 700; color: var(--ve-text-strong, #241d4a); }

.ve-modal__head .ve-modal__about { color: rgb(255 255 255 / .88); }
.ve-modal__head .ve-modal__about strong { color: #fff; }

.ve-modal__close {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  border: 1px solid rgb(255 255 255 / .32);
  background: rgb(255 255 255 / .14);
  color: #fff;
  cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease;
}
.ve-modal__close:hover { background: rgb(255 255 255 / .22); border-color: #fff; }
.ve-modal__close:focus-visible { outline: 3px solid var(--ve-accent, #e5b12e); outline-offset: 2px; }
.ve-modal__close svg { width: 1.05rem; height: 1.05rem; }

/* ---- Body ---------------------------------------------------------------- */

.ve-modal__body {
  padding: clamp(1.1rem, 3vw, 1.9rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.ve-modal__body--enquiry .ve-enquiry { display: block; }

.ve-modal__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .85rem;
  padding-top: .35rem;
}

.ve-modal__note { margin: 0; flex: 1 1 14rem; font-size: var(--ve-text-xs); color: var(--ve-text-muted, #6b6490); line-height: 1.5; }

.ve-modal__reference {
  margin: .6rem 0 0;
  font-size: var(--ve-text-lg);
  font-weight: 800;
  letter-spacing: .06em;
  color: var(--ve-primary, #4c1d95);
}

/* The scroll lock the dialog applies to the page behind it. */
body.ve-modal-open { overflow: hidden; }

/* ---- Forms inside a dialog ----------------------------------------------- */
/* The dialog head already names the record, so the form's own subject line
   would say it twice. */
.ve-modal .ve-enquiry__subject { display: none; }

.ve-modal .ve-form-grid { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; }
.ve-modal .ve-form-grid > * { flex: 1 1 14rem; min-width: 0; }
.ve-modal .ve-form-grid > .span-2,
.ve-modal .ve-form-grid > .ve-field--wide { flex-basis: 100%; }

@media (max-width: 40rem) {
  .ve-modal { width: calc(100vw - 1rem); }
  .ve-modal__actions { flex-direction: column; align-items: stretch; }
  .ve-modal__actions .ve-btn,
  .ve-modal__actions .ve-cta { width: 100%; }
  .ve-modal__note { order: 2; }
}

@media (prefers-reduced-motion: reduce) {
  .ve-modal__close { transition: none; }
}

/* ==========================================================================
   One success story, in full, in a dialog.
   Lives here rather than in pages-content.css because the homepage opens the
   same dialog, and pages-content.css redefines classes the homepage bands
   already use — loading it there flattened the CTA band.
   ========================================================================== */
.ve-story-modal__video { position: relative; aspect-ratio: 16 / 9; border-radius: var(--ve-radius-lg); overflow: hidden; background: var(--ve-ink-100); margin-bottom: 1.25rem; }
.ve-story-modal__video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.ve-story-modal__person { display: flex; align-items: center; gap: 1rem; }
.ve-story-modal__photo {
  width: 4.5rem; height: 4.5rem; border-radius: 50%; object-fit: cover; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(150deg, var(--ve-purple-050), var(--ve-indigo-100));
  color: var(--ve-primary); font-family: var(--ve-font-display);
  font-weight: 800; font-size: var(--ve-text-2xl);
}
.ve-story-modal__name { margin: 0; font-weight: 800; font-size: var(--ve-text-lg); color: var(--ve-text-strong); }
.ve-story-modal__meta { margin: .15rem 0 .35rem; font-size: var(--ve-text-sm); color: var(--ve-text-muted); }
.ve-story-modal__quote {
  margin: 1.25rem 0 0; padding: 1.25rem 1.4rem; border: 0;
  border-inline-start: 3px solid var(--ve-accent);
  border-radius: 0 var(--ve-radius-lg) var(--ve-radius-lg) 0;
  background: var(--ve-purple-050);
  font-size: var(--ve-text-lg); line-height: var(--ve-leading-relaxed); color: var(--ve-text-strong);
}
@media (max-width: 40rem) {
  .ve-story-modal__person { flex-direction: column; align-items: flex-start; }
  .ve-story-modal__quote { font-size: var(--ve-text-md); padding: 1rem 1.1rem; }
}
