/* EDN mission briefing — hero button and full-screen player for the Elementor build.
   Ported from the repo (app/edn.css, template/assets/js/edn.js). Uses the tokens from
   edn-graphics-v2.css; the button takes its type from the same Elementor global
   (accent) typography as the "Request beta access" button, so both share a size.
   The button lives in an HTML widget inside #edn-hero-cta, whose one-column grid
   already gives both calls to action the same width. */

/* --- hero button ------------------------------------------------------ */
#edn-hero-cta > .elementor-widget-html { min-width: 0; }
/* Desktop: the two calls to action sit side by side, same width, once the hero copy column
   (#edn-hero-copy, a size container) has room for both: 2 x 248px + the 24px gap. Narrower
   (phones, tablets) they stay stacked at full width. */
@container (min-width: 520px) {
  #edn-hero-cta { grid-template-columns: repeat(2, 248px); max-width: none; }
}
#edn-hero-cta .briefing-trigger {
  position: relative; overflow: hidden; isolation: isolate; display: flex; align-items: center; justify-content: center; gap: 16px;
  width: 100%; margin: 0; padding: 15px 23px; border: 1px solid var(--edn); border-radius: 0; /* 16px 24px less the border, as the primary has none */
  background: var(--card); color: var(--foreground); cursor: pointer; text-align: left;
  font-family: var(--e-global-typography-accent-font-family), var(--font-body); font-size: var(--e-global-typography-accent-font-size);
  font-weight: var(--e-global-typography-accent-font-weight); line-height: var(--e-global-typography-accent-line-height);
  letter-spacing: var(--e-global-typography-accent-letter-spacing); text-transform: uppercase;
  transition: border-color 220ms, transform 220ms;
}
#edn-hero-cta .briefing-trigger:hover, #edn-hero-cta .briefing-trigger:focus-visible {
  background: var(--card); color: var(--foreground); border-color: color-mix(in srgb, var(--edn), var(--eva) 70%); transform: translateY(-2px);
}
#edn-hero-cta .briefing-trigger:focus-visible { outline: 2px solid var(--eva); outline-offset: 3px; }
.briefing-wave {
  position: absolute; z-index: -1; top: 0; left: 0; width: 200%; max-width: none; height: 100%; pointer-events: none;
  fill: none; stroke: color-mix(in srgb, var(--eva) 20%, transparent); stroke-width: 1; transition: stroke 220ms;
  animation: briefing-wave 9s linear infinite;
}
.briefing-wave path { vector-effect: non-scaling-stroke; }
.briefing-trigger:hover .briefing-wave, .briefing-trigger:focus-visible .briefing-wave { stroke: color-mix(in srgb, var(--eva) 45%, transparent); }
/* Scan sweep */
#edn-hero-cta .briefing-trigger::after {
  content: ''; position: absolute; z-index: -1; inset: 0 auto 0 0; width: 30%; transform: translateX(-100%); pointer-events: none;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--eva) 16%, transparent), transparent);
  animation: briefing-scan 5s ease-in-out infinite;
}
.briefing-icon { display: block; flex-shrink: 0; width: 20px; height: 20px; color: var(--eva); fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.briefing-sound { animation: briefing-sound 1.6s ease-in-out infinite; }
.briefing-sound + .briefing-sound { animation-delay: 200ms; }
/* The label stacks the longest word (invisible, reserves the width), the static label, and the live one. */
.briefing-label { display: grid; white-space: pre; text-align: center; } /* every word centred, like the primary button */
.briefing-label > span { grid-area: 1 / 1; }
.briefing-sizer { visibility: hidden; }
.briefing-live { display: none; letter-spacing: 0; }
.briefing-live > span { display: inline-block; width: 1ch; margin-right: var(--e-global-typography-accent-letter-spacing, 1px); }
.briefing-live > [data-glyph] { color: var(--eva); }
.briefing-trigger[data-live] .briefing-live { display: block; }
.briefing-trigger[data-live] .briefing-static { visibility: hidden; }

/* --- player ----------------------------------------------------------- */
html[data-briefing], html[data-briefing] body { overflow: hidden; }
.briefing-dialog {
  position: fixed; inset: 0; z-index: 100000; width: 100%; max-width: none; height: 100vh; height: 100dvh; max-height: none;
  margin: 0; padding: 0; border: 0; background: var(--canvas-deep); color: var(--foreground); font-family: var(--font-body);
  overscroll-behavior: contain; animation: briefing-fade-in 400ms var(--ease-out) both;
}
.briefing-dialog[data-state=closing] { animation: briefing-fade-out 400ms var(--ease-out) both; pointer-events: none; }
.briefing-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* The briefing stays invisible (and inert) behind the loader until it reports that playback started. */
.briefing-frame { position: absolute; inset: 0; display: block; width: 100%; height: 100%; border: 0; opacity: 0; pointer-events: none; transition: opacity 400ms var(--ease-out); }
.briefing-dialog[data-stage=playing] .briefing-frame { opacity: 1; pointer-events: auto; }
.briefing-loader {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px;
  padding: 16px; background: var(--canvas-deep);
}
.briefing-loader[hidden] { display: none; }
.briefing-ring { position: relative; display: grid; place-items: center; width: 88px; height: 88px; }
.briefing-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke-width: 2; transform: rotate(-90deg); }
.briefing-ring-track { stroke: var(--hairline); }
.briefing-ring-bar { stroke: var(--eva); stroke-dasharray: 100; transition: stroke-dashoffset 200ms linear; }
.briefing-ring-spin { stroke: var(--edn); stroke-dasharray: 18 82; transform-box: fill-box; transform-origin: center; animation: briefing-spin 1.2s linear infinite; }
.briefing-percent { color: var(--foreground); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.briefing-loading { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.briefing-loading[hidden], .briefing-dialog .briefing-start[hidden] { display: none; }
.briefing-dialog .briefing-start {
  display: inline-flex; align-items: center; gap: 32px; min-height: 56px; margin: 0; padding: 16px 24px; border: 1px solid var(--eva); border-radius: 0;
  background: var(--eva); color: var(--on-primary); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.briefing-dialog .briefing-start:hover, .briefing-dialog .briefing-start:focus { background: #a3edbd; color: var(--on-primary); }
.briefing-dialog .briefing-close {
  position: absolute; z-index: 1; top: max(16px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right));
  display: grid; place-items: center; width: 48px; height: 48px; margin: 0; padding: 0; border: 1px solid var(--hairline); border-radius: 0;
  background: color-mix(in srgb, var(--canvas-deep) 72%, transparent); color: var(--foreground); font: inherit; font-size: 28px; line-height: 1;
  cursor: pointer; transition: border-color 120ms, color 120ms;
}
.briefing-dialog .briefing-close::before, .briefing-dialog .briefing-close::after { content: ''; position: absolute; width: 10px; height: 10px; pointer-events: none; }
.briefing-dialog .briefing-close::before { top: -1px; left: -1px; border-top: 2px solid var(--edn); border-left: 2px solid var(--edn); }
.briefing-dialog .briefing-close::after { bottom: -1px; right: -1px; border-bottom: 2px solid var(--edn); border-right: 2px solid var(--edn); }
.briefing-dialog .briefing-close:hover, .briefing-dialog .briefing-close:focus { background: color-mix(in srgb, var(--canvas-deep) 72%, transparent); color: var(--edn); border-color: var(--edn); }
.briefing-dialog button:focus-visible { outline: 2px solid var(--eva); outline-offset: 3px; }

/* --- motion ----------------------------------------------------------- */
@keyframes briefing-wave { to { transform: translateX(-50%); } }
@keyframes briefing-scan { 0%, 60% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }
@keyframes briefing-sound { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes briefing-spin { to { transform: rotate(360deg); } }
@keyframes briefing-fade-in { from { opacity: 0; } }
@keyframes briefing-fade-out { to { opacity: 0; } }
[data-motion=paused] .briefing-wave { animation-play-state: paused; }
[data-motion=paused] .briefing-sound, [data-motion=paused] #edn-hero-cta .briefing-trigger::after { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .briefing-wave, .briefing-sound, #edn-hero-cta .briefing-trigger::after, .briefing-ring-spin, .briefing-dialog, .briefing-dialog[data-state=closing] { animation: none; }
  #edn-hero-cta .briefing-trigger, .briefing-frame, .briefing-ring-bar { transition: none; }
  #edn-hero-cta .briefing-trigger:hover, #edn-hero-cta .briefing-trigger:focus-visible { transform: none; }
  .briefing-trigger[data-live] .briefing-live { display: none; }
  .briefing-trigger[data-live] .briefing-static { visibility: visible; }
}
