/* Brena AI stage: looping prompt -> screenshot -> result motion graphic used in
   the "AI-Powered Core Capabilities" section of each edition page. Same visual
   language as "Brena in action" on /artificial-intelligence, tuned for the
   dark section background. Markup: templates/pages/<edition>.html (#ai). */

.bas {
  --bas-orange: #ed7532;
  position: relative;
  height: 470px;
  border-radius: 22px;
  overflow: hidden;
  background: #14161b;
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 30px 60px rgba(0,0,0,.35);
  font-family: "Poppins", Arial, Helvetica, sans-serif;
  text-align: left;
}
.bas *, .bas *::before, .bas *::after { box-sizing: border-box; }
.bas::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,.09) 1px, transparent 1px);
  background-size: 18px 18px;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 85%);
  mask-image: linear-gradient(180deg, #000, transparent 85%);
}

/* Edition accents */
.bas-scene[data-ed="planner"]  { --accent: #1ea8ff; }
.bas-scene[data-ed="controls"] { --accent: #00c99c; }
.bas-scene[data-ed="field"]    { --accent: #b4bd2c; }
.bas-scene[data-ed="safety"]   { --accent: #e0a81c; }
.bas-scene[data-ed="brena"]    { --accent: #ed7532; }

/* Scenes stack and crossfade */
.bas-scene {
  position: absolute; inset: 0; z-index: 1;
  display: grid; place-items: center;
  padding: 96px 32px 60px;
  background: radial-gradient(110% 90% at 85% 5%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 65%);
  opacity: 0; visibility: hidden;
  transition: opacity .7s ease, visibility 0s linear .7s;
}
.bas-scene.on { opacity: 1; visibility: visible; transition: opacity .7s ease; }

/* Screenshot card */
.bas-shot {
  position: relative; z-index: 1; width: 100%;
  border-radius: 12px; background: #fff; overflow: hidden;
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 22px 50px rgba(0,0,0,.45);
  opacity: 0; transform: translateY(22px);
  transition: opacity .7s ease .15s, transform .8s cubic-bezier(.2,.8,.2,1) .15s;
}
.bas-scene.on .bas-shot { opacity: 1; transform: none; }
.bas-shot img { display: block; width: 100%; height: auto; -webkit-user-drag: none; user-select: none; }
.bas-shot.tall { width: 300px; height: 330px; }
.bas-shot.tall img { transform: translateY(0); }
.bas-scene.pan .bas-shot.tall img { animation: bas-pan 9s ease-in-out 1.6s forwards; }
@keyframes bas-pan { to { transform: translateY(calc(-100% + 330px)); } }

/* Edition label (ONE page) */
.bas-ed {
  position: absolute; z-index: 3; left: 20px; bottom: 20px;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px 5px 8px; border-radius: 999px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
  color: #fff; font-size: 11.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
}
.bas-ed img { width: 16px; height: 16px; }

/* Prompt bubble */
.bas-ask {
  position: absolute; z-index: 3; top: 22px; left: 22px; max-width: 80%;
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 14px; border-radius: 14px 14px 14px 4px;
  background: #fff; border: 1px solid #ececec; box-shadow: 0 10px 28px rgba(0,0,0,.3);
  font-size: 13.5px; line-height: 1.45; color: #222;
  opacity: 0; transform: translateY(-8px);
  transition: opacity .5s ease .3s, transform .5s ease .3s;
}
.bas-scene.on .bas-ask { opacity: 1; transform: none; }
.bas-ask img { width: 22px; height: 22px; border-radius: 50%; flex: none; }
.bas-ask .t { min-height: 1.45em; }
.bas-ask .t::after { content: ""; display: inline-block; width: 2px; height: 1em; margin-left: 2px; vertical-align: -2px; background: var(--bas-orange); animation: bas-blink 1s steps(1) infinite; }
.bas-ask.done .t::after { display: none; }
.bas-ask .tr { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px dashed #e3e3e3; font-size: 12px; color: #6b6b6b; opacity: 0; transition: opacity .4s ease; }
.bas-ask .tr b { color: var(--bas-orange); font-weight: 600; }
.bas-ask.done .tr { opacity: 1; }
@keyframes bas-blink { 50% { opacity: 0; } }

/* Result chips */
.bas-pops { position: absolute; z-index: 3; right: 20px; bottom: 20px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.bas-pop {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 10px;
  background: #1c1c1c; border: 1px solid rgba(255,255,255,.14); color: #fff;
  font-size: 12.5px; font-weight: 500; box-shadow: 0 10px 24px rgba(0,0,0,.35);
  opacity: 0; transform: translateY(10px) scale(.96);
  transition: opacity .4s ease, transform .45s cubic-bezier(.2,.8,.2,1);
}
.bas-pop.on { opacity: 1; transform: none; }
.bas-pop .ok { width: 16px; height: 16px; border-radius: 50%; background: #1fae6a; display: grid; place-items: center; flex: none; }
.bas-pop .ok::after { content: ""; width: 6px; height: 3px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px,-1px); }
.bas-pop code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 11.5px; color: #ffcfb3; background: none; padding: 0; }

/* Scene progress dots (multi-scene stages) */
.bas-dots { position: absolute; z-index: 4; top: 26px; right: 22px; display: flex; gap: 6px; }
.bas-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.25); transition: background .3s ease, width .3s ease; }
.bas-dots i.on { width: 18px; border-radius: 4px; background: #fff; }

/* Brena mark (left column): icon with pulsing orange rings + wordmark below */
.brena-mark {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 34px; min-height: 470px;
}
.brena-mark-icon { position: relative; width: 210px; height: 210px; display: grid; place-items: center; }
.brena-mark-icon img {
  position: relative; z-index: 2; width: 100%; height: auto;
  filter: drop-shadow(0 0 28px rgba(237,117,50,.55));
  animation: brena-breathe 2.8s ease-in-out infinite;
}
.brena-mark-icon::before { /* soft glow halo */
  content: ""; position: absolute; inset: -30%; z-index: 0; border-radius: 50%;
  background: radial-gradient(circle, rgba(237,117,50,.35) 0%, rgba(237,117,50,0) 62%);
  animation: brena-glow 2.8s ease-in-out infinite;
}
.brena-mark-icon .ring {
  position: absolute; inset: 0; z-index: 1; border-radius: 50%;
  border: 2px solid #ed7532; opacity: 0;
  animation: brena-ring 3.6s cubic-bezier(.2,.6,.3,1) infinite;
}
.brena-mark-icon .ring:nth-child(2) { animation-delay: 1.2s; }
.brena-mark-icon .ring:nth-child(3) { animation-delay: 2.4s; }
.brena-mark-word { width: 190px; height: auto; }
@keyframes brena-ring {
  0%   { transform: scale(.95); opacity: .85; }
  100% { transform: scale(1.9);  opacity: 0; }
}
@keyframes brena-breathe { 50% { transform: scale(1.04); } }
@keyframes brena-glow { 50% { opacity: .55; transform: scale(1.08); } }

@media (max-width: 767px) {
  .brena-mark { min-height: 0; padding: 50px 0 40px; gap: 26px; }
  .brena-mark-icon { width: 150px; height: 150px; }
  .brena-mark-word { width: 150px; }
  .bas { height: 440px; margin-top: 8px; max-width: calc(100vw - 32px); }
  .bas-scene { padding: 104px 16px 64px; }
  .bas-shot.tall { width: 100%; max-width: 280px; height: 290px; }
  @keyframes bas-pan { to { transform: translateY(calc(-100% + 290px)); } }
  .bas-ask { left: 12px; right: 12px; top: 14px; max-width: none; font-size: 12.5px; }
  .bas-dots { top: auto; bottom: 26px; right: auto; left: 50%; transform: translateX(-50%); }
  .bas-pops { right: 12px; bottom: 12px; }
  .bas-ed { left: 12px; bottom: 12px; }
  .bas-scene:has(.bas-ed) .bas-pops { bottom: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  .bas *, .bas *::before, .bas *::after { animation: none !important; transition: none !important; }
  .brena-mark *, .brena-mark *::before { animation: none !important; }
  .brena-mark-icon .ring:first-child { opacity: .35; transform: scale(1.2); }
  .bas-shot, .bas-ask, .bas-pop, .bas-ask .tr { opacity: 1 !important; transform: none !important; }
}
