/* ==========================================================================
   Dealer invite — the scroll-triggered trade-account panel
   --------------------------------------------------------------------------
   Apple's material model, on the web:
     · a big surface reads as THICK — stronger blur and a deeper shadow than
       the small chips elsewhere on the site
     · a bright top edge is light catching the material
     · the surface MATERIALIZES (blur + scale together), it does not just fade
     · a modal task dims and pushes the page back; the scrim carries its own
       lighter blur so the page behind reads as depth, not as wallpaper
   Never stack two light translucent surfaces — the fields inside sit on a
   tinted solid, not on more glass.

   z-index: 124/125 — above the quick view (110) and the image overlay (120),
   below the toast stack (140) so a confirmation still reads over the panel.
   ========================================================================== */

.di {
  --di-radius: 26px;
  --di-pad: clamp(1.4rem, 4vw, 2.1rem);
  position: fixed;
  inset: 0;
  z-index: 124;
  display: none;
}
.di[data-open] { display: block; }

/* ── scrim ───────────────────────────────────────────────────────────────── */
.di__scrim {
  position: absolute;
  inset: 0;
  background: rgba(8, 9, 13, 0.46);
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  opacity: 0;
  will-change: opacity;
}

/* ── the panel ───────────────────────────────────────────────────────────── */
.di__panel {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  width: min(460px, calc(100vw - 2.5rem));
  max-height: min(90dvh, 800px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--di-radius);
  /* The material. Heavier than the nav's glass because the surface is big. */
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  /* --di-blur is driven frame by frame on open, so the material forms
     rather than fades. It falls back to the settled value. */
  backdrop-filter: blur(var(--di-blur, 40px)) saturate(1.7);
  -webkit-backdrop-filter: blur(var(--di-blur, 40px)) saturate(1.7);
  border: 1px solid var(--line-soft);
  /* Light catching the top edge of a thick material. */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 40px 90px -20px rgba(8, 9, 13, 0.45),
    0 12px 30px -12px rgba(8, 9, 13, 0.3);
  will-change: transform, opacity;
  transform-origin: 50% 50%;
}
:root[data-theme="dark"] .di__panel {
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.11),
    0 40px 90px -20px rgba(0, 0, 0, 0.72),
    0 12px 30px -12px rgba(0, 0, 0, 0.5);
}

.di__scroll { overflow-y: auto; overscroll-behavior: contain; padding: var(--di-pad); }

/* ── close ───────────────────────────────────────────────────────────────── */
.di__close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 2;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--text-2);
  background: color-mix(in srgb, var(--surface-sunk) 70%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  transition: transform 120ms var(--ease), color 120ms var(--ease);
}
.di__close svg { width: 15px; height: 15px; }
.di__close:hover { color: var(--text); }
.di__close:active { transform: scale(0.9); }   /* feedback on press, not release */

/* ── type ────────────────────────────────────────────────────────────────── */
.di__eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.735rem;
  font-weight: 600;
  letter-spacing: 0.08em;   /* small text wants MORE tracking */
  text-transform: uppercase;
  color: var(--accent);
}
.di__title {
  margin: 0 0 0.55rem;
  font-size: clamp(1.45rem, 4.4vw, 1.78rem);
  line-height: 1.1;          /* tight leading on large text */
  letter-spacing: -0.032em;  /* negative tracking as it grows */
  color: var(--text);
}
.di__lede {
  margin: 0 0 1rem;
  font-size: 0.925rem;
  line-height: 1.5;
  color: var(--text-2);
}

/* ── the three-point list ────────────────────────────────────────────────── */
.di__points { margin: 0 0 1.05rem; padding: 0; list-style: none; display: grid; gap: 0.5rem; }
.di__points li {
  display: grid;
  grid-template-columns: 19px 1fr;
  gap: 0.6rem;
  align-items: start;
  font-size: 0.885rem;
  line-height: 1.45;
  color: var(--text-2);
}
.di__points svg { width: 19px; height: 19px; color: var(--accent); margin-top: 1px; }
.di__points strong { color: var(--text); font-weight: 600; }

/* ── form ────────────────────────────────────────────────────────────────── */
.di__form { display: grid; gap: 0.62rem; }
.di__row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.di__field { display: grid; gap: 0.3rem; }
.di__field label { font-size: 0.79rem; font-weight: 500; color: var(--text-2); }
.di__field input {
  width: 100%;
  padding: 0.66rem 0.8rem;
  font: inherit;
  font-size: 0.92rem;
  color: var(--text);
  /* A SOLID tinted surface — not more glass on glass. */
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}
.di__field input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.di__field input[aria-invalid="true"] { border-color: var(--danger, #D3352B); }
.di__hint { font-size: 0.75rem; color: var(--text-3); }
.di__err { font-size: 0.775rem; color: var(--danger, #D3352B); }
.di__err:empty { display: none; }

.di__submit {
  margin-top: 0.25rem;
  padding: 0.76rem 1rem;
  font: inherit;
  font-size: 0.945rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--btn-primary-ink);
  background: var(--btn-primary);
  border: 0;
  border-radius: var(--pill, 999px);
  cursor: pointer;
  transition: transform 110ms var(--ease), background 140ms var(--ease);
}
.di__submit:hover { background: var(--btn-primary-hi); }
.di__submit:active { transform: scale(0.975); }
.di__submit[disabled] { opacity: 0.6; cursor: progress; }

.di__foot { margin: 0.75rem 0 0; font-size: 0.8rem; line-height: 1.5; color: var(--text-3); text-align: center; }
.di__foot a { color: var(--text-2); text-decoration: underline; text-underline-offset: 2px; }
.di__later {
  display: block;
  width: 100%;
  margin-top: 0.55rem;
  padding: 0.5rem;
  font: inherit;
  font-size: 0.85rem;
  color: var(--text-3);
  background: none;
  border: 0;
  cursor: pointer;
}
.di__later:hover { color: var(--text-2); }

/* ── sent state ──────────────────────────────────────────────────────────── */
.di__sent { text-align: center; padding: 0.4rem 0 0.2rem; }
/* styles.css makes every svg a block, so text-align cannot centre it. */
.di__sent svg { display: block; width: 42px; height: 42px; margin: 0 auto 0.7rem; color: var(--accent); }
.di__sent p { margin: 0 0 0.35rem; font-size: 0.925rem; line-height: 1.5; color: var(--text-2); }
.di__sent strong { color: var(--text); }

/* Scoped: an unscoped [hidden] rule would reach every element on the site. */
.di [hidden] { display: none !important; }

.di__grab {
  display: none;
  flex: none;
  padding: 0.6rem 0 0.15rem;
  cursor: grab;
  touch-action: none;   /* we own the vertical gesture */
}
.di__grab:active { cursor: grabbing; }
.di__grab span {
  display: block;
  width: 38px;
  height: 5px;
  margin: 0 auto;
  border-radius: 3px;
  background: var(--text-3);
  opacity: 0.45;
}

/* ── phone: a real sheet you can throw ───────────────────────────────────── */
@media (max-width: 560px) {
  .di__panel {
    left: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    max-height: 92dvh;
    border-radius: 22px 22px 0 0;
    border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .di__scroll { padding-top: 0.5rem; }
  .di__grab { display: block; }
  .di__row { grid-template-columns: 1fr; }
}
/* ── accessibility preferences ───────────────────────────────────────────── */
@media (prefers-reduced-transparency: reduce) {
  .di__panel { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .di__scrim { background: rgba(8, 9, 13, 0.7); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .di__close { background: var(--surface-sunk); backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  .di__panel { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; border-color: var(--text); }
  .di__field input { border-color: var(--text-2); }
}
@media (prefers-reduced-motion: reduce) {
  .di__panel, .di__scrim { transition: opacity 200ms ease; }
  .di__close:active, .di__submit:active { transform: none; }
}
