/*
 * BlackRail bridge for the original Standard Magic live design.
 * The visual system itself remains in assets/live; this file only accommodates
 * CMS editing chrome and keeps the About panel's viewport controls stable.
 */

/* Canvas previews intentionally omit the public animation scripts. Keep their
 * boot overlay from covering authored content and intercepting selection. */
body.br-page-editor-canvas #sm-loader {
  display: none !important;
}

/* Without the animation controller, idle panels sit outside the viewport and
 * reject pointer events. Lay them out as authored sections in the editor. */
body.br-page-editor-canvas.sm-live-home #hero,
body.br-page-editor-canvas.sm-live-home #about,
body.br-page-editor-canvas.sm-live-home #work {
  position: relative !important;
  top: auto !important;
  height: auto !important;
  min-height: 100vh;
  overflow: visible;
  pointer-events: auto;
  transform: none !important;
  animation: none !important;
  transition: none !important;
}

/* The public shell is viewport-locked. The canvas needs the full document
 * height and an opaque panel surface instead of the live WebGL backdrop. */
body.br-page-editor-canvas.sm-live-home {
  overflow: auto;
}

body.br-page-editor-canvas.sm-live-home #main-content {
  position: relative;
  height: auto;
  overflow: visible;
}

body.br-page-editor-canvas.sm-live-home #about {
  background: #080b14;
}

body.sm-live-home {
  background: #000;
}

body.sm-live-home > .blackrail-adminbar {
  z-index: 2147483647;
}

body.sm-live-home.sm-quick-edit #main-content {
  outline: 2px dashed rgba(180, 98, 62, 0.56);
  outline-offset: -2px;
}

body.sm-live-home.sm-quick-edit #about.active-screen {
  z-index: 20;
}

/*
 * BlackRail trigger. Matches the About/Labs orb buttons; the artwork is the
 * black rail as drawn on blackrail.org (spotted upperparts, rusty nape, red
 * eye, barred flank, orange legs) perched on a cattail. The link remains
 * authored in the homepage body so its URL and label are editable in both
 * BlackRail editors.
 */
body.sm-live-home .blackrail-bird {
  --brb-ink: #2c2a24;
  --brb-breast: #565c64;
  --brb-nape: #7a4023;
  --brb-spot: #efe9da;
  --brb-eye: #b23a1e;
  --brb-leg: #9a7038;
  --brb-cattail: #8a5f12;
  position: absolute;
  left: clamp(5.25rem, 5.4vw, 6.4rem);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.34rem;
  color: #eef6ff;
  font-family: Montserrat, "Helvetica Neue", Helvetica, sans-serif;
  font-size: 0.74rem;
  font-weight: 720;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

body.sm-live-home #hero > .blackrail-bird {
  top: var(--hero-top-row, clamp(1.4rem, 2.2vw, 2.5rem));
}

body.sm-live-home .blackrail-bird__label {
  order: 2;
  line-height: 1;
  text-shadow: 0 0 10px rgba(214, 240, 190, 0.35);
  transition: color 0.25s ease, text-shadow 0.25s ease, transform 0.25s ease;
}

body.sm-live-home .blackrail-bird__bubble {
  order: 1;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  position: relative;
  display: inline-block;
  overflow: hidden;
  border: 1px solid rgba(226, 236, 208, 0.72);
  background:
    radial-gradient(120% 120% at 30% 22%, rgba(251, 252, 243, 0.98) 0%, rgba(229, 234, 208, 0.95) 42%, rgba(189, 202, 161, 0.95) 72%, rgba(148, 165, 122, 0.96) 100%);
  box-shadow: 0 10px 24px rgba(0, 8, 4, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.55);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

body.sm-live-home .blackrail-bird__bubble::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(120% 120% at 32% 22%, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 58%);
  opacity: 0.55;
  mix-blend-mode: screen;
  pointer-events: none;
}

body.sm-live-home .blackrail-bird__svg {
  width: 100%;
  height: 100%;
  display: block;
}

body.sm-live-home .blackrail-bird__bird {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: blackrail-bird-breathe 4.8s ease-in-out infinite;
}

body.sm-live-home .blackrail-bird__body,
body.sm-live-home .blackrail-bird__head,
body.sm-live-home .blackrail-bird__tail,
body.sm-live-home .blackrail-bird__beak {
  fill: var(--brb-ink);
}

body.sm-live-home .blackrail-bird__breast {
  fill: var(--brb-breast);
}

body.sm-live-home .blackrail-bird__nape {
  fill: var(--brb-nape);
}

body.sm-live-home .blackrail-bird__spots {
  fill: var(--brb-spot);
}

body.sm-live-home .blackrail-bird__eye {
  fill: var(--brb-eye);
}

body.sm-live-home .blackrail-bird__cattail {
  fill: var(--brb-cattail);
  opacity: 0.85;
}

body.sm-live-home .blackrail-bird__legs,
body.sm-live-home .blackrail-bird__flank {
  fill: none;
  stroke-linecap: round;
}

body.sm-live-home .blackrail-bird__legs {
  stroke: var(--brb-leg);
  stroke-width: 1.5;
}

body.sm-live-home .blackrail-bird__flank {
  stroke: var(--brb-spot);
  stroke-width: 1;
}

body.sm-live-home .blackrail-bird__wing-feathers {
  fill: var(--brb-wing, #3b382e);
}

body.sm-live-home .blackrail-bird__wing-spot {
  fill: var(--brb-spot);
}

body.sm-live-home .blackrail-bird__wing {
  transform-box: fill-box;
  transform-origin: 88% 12%;
}

body.sm-live-home .blackrail-bird:hover .blackrail-bird__wing,
body.sm-live-home .blackrail-bird:focus-visible .blackrail-bird__wing {
  animation: blackrail-bird-flap 0.34s ease-in-out infinite;
}

body.sm-live-home .blackrail-bird:hover .blackrail-bird__label,
body.sm-live-home .blackrail-bird:focus-visible .blackrail-bird__label {
  color: #f7fbef;
  transform: translateY(-1px);
  text-shadow: 0 0 14px rgba(219, 243, 187, 0.65);
}

body.sm-live-home .blackrail-bird:hover .blackrail-bird__bubble,
body.sm-live-home .blackrail-bird:focus-visible .blackrail-bird__bubble {
  border-color: rgba(240, 248, 224, 0.9);
  box-shadow: 0 14px 28px rgba(0, 10, 4, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

body.sm-live-home .blackrail-bird:focus-visible {
  outline: 1px solid rgba(217, 225, 233, 0.78);
  outline-offset: 5px;
  border-radius: 10px;
}

body.sm-live-home .blackrail-bird.is-departing {
  pointer-events: none;
}

body.sm-live-home .blackrail-bird.is-departing .blackrail-bird__bird {
  animation: blackrail-bird-launch 0.76s cubic-bezier(0.24, 0.7, 0.22, 1) forwards;
}

body.sm-live-home .blackrail-bird.is-departing .blackrail-bird__wing {
  animation: blackrail-bird-flap 0.14s ease-in-out infinite;
}

@keyframes blackrail-bird-breathe {
  0%, 42%, 100% { transform: translateY(0) rotate(0); }
  46% { transform: translateY(-0.8px) rotate(-1deg); }
  50% { transform: translateY(0) rotate(0); }
}

@keyframes blackrail-bird-flap {
  0%, 100% { transform: rotate(0); }
  45% { transform: rotate(-34deg) scaleY(1.06); }
}

@keyframes blackrail-bird-launch {
  0% { opacity: 1; transform: translate(0, 0) rotate(0) scale(1); }
  16% { opacity: 1; transform: translate(-2px, 3px) rotate(-4deg) scale(0.98); }
  34% { opacity: 1; transform: translate(11px, -14px) rotate(9deg) scale(1.03); }
  64% { opacity: 0.94; transform: translate(28px, -30px) rotate(-5deg) scale(0.92); }
  100% { opacity: 0; transform: translate(52px, -52px) rotate(-12deg) scale(0.72); }
}

/*
 * Keep the intro scroll helper inside the *visible* panel viewport. Its source
 * markup sits after variable-length editorial copy, so normal flow can place
 * it below the fold. live-bridge.js measures the visual viewport and writes
 * --sm-about-scroll-cue-top whenever the panel, viewport, or content changes.
 */
body.sm-live-home #about.about-panel .about-panel__scroll-cue:not(.about-panel__scroll-cue--top) {
  position: fixed;
  top: var(--sm-about-scroll-cue-top, calc(100dvh - 7rem));
  left: var(--sm-about-scroll-cue-left, max(clamp(0.9rem, 3vw, 2rem), env(safe-area-inset-left)));
  right: auto;
  bottom: auto;
  margin-top: 0;
  padding-right: 0;
  z-index: 1150;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

body.sm-live-home #about.about-panel.active-screen .about-panel__scroll-cue.is-viewport-visible:not(.about-panel__scroll-cue--top) {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/*
 * Keep the scroll controls visually stable. The live source animates the
 * arrow sideways, scales the bubble, and nudges the panel on hover/focus.
 * Color, border, and glow still provide interaction feedback.
 */
body.sm-live-home #about.about-panel .about-panel__scroll-arrow,
body.sm-live-home #about.about-panel .about-panel__scroll-link:hover .about-panel__scroll-arrow,
body.sm-live-home #about.about-panel .about-panel__scroll-link:focus-visible .about-panel__scroll-arrow {
  animation: none;
  transform: none;
}

body.sm-live-home #about.about-panel .about-panel__scroll-link:hover .about-panel__scroll-bubble,
body.sm-live-home #about.about-panel .about-panel__scroll-link:focus-visible .about-panel__scroll-bubble {
  transform: rotate(var(--scroll-bubble-rotation));
}

body.sm-live-home #about.about-panel.about-panel--scroll-tease .about__content,
body.sm-live-home #about.about-panel.about-panel--scroll-tease .about-panel__scroll-cue:not(.about-panel__scroll-cue--top) {
  animation: none;
  transform: none;
}

/*
 * Services index: tags read as a plain word list (no pill capsules), and each
 * row carries a soft wash of its own accent so the section reads as a rainbow
 * of services. Accents come from --svc-accent set per row in the live CSS.
 */
body.sm-live-home .about__content__box--services .services-index__tags {
  gap: 0.3rem 1.1rem;
}

body.sm-live-home .about__content__box--services .services-index__tags li,
body.sm-live-home .about__content__box--services .services-index__row:hover .services-index__tags li,
body.sm-live-home .about__content__box--services .services-index__row:focus-within .services-index__tags li {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

body.sm-live-home .about__content__box--services .services-index__row {
  /*
   * Bleed each row's tint to the viewport edges: pull the margin box out to
   * the viewport, then pad the same distance (plus the row's original inset)
   * so the grid content stays in the centered column.
   */
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding-left: calc(50vw - 50% + clamp(0.6rem, 2vw, 1.4rem));
  padding-right: calc(50vw - 50% + clamp(0.6rem, 2vw, 1.4rem));
  background: linear-gradient(100deg,
    color-mix(in srgb, var(--svc-accent, #9cc6e8) 13%, transparent) 0%,
    color-mix(in srgb, var(--svc-accent, #9cc6e8) 6%, transparent) 55%,
    transparent 100%);
}

/* The full-bleed rows overhang their centered ancestors; keep the panel from
   growing a horizontal scrollbar over it. */
body.sm-live-home #about.about-panel .about__content {
  overflow-x: hidden;
}

/* content-visibility:auto implies paint containment, which would clip the
   full-bleed row tints at the section container's edges. */
body.sm-live-home #about.about-panel .about-panel__row--services {
  content-visibility: visible;
}

body.sm-live-home .about__content__box--services .services-index__row:hover,
body.sm-live-home .about__content__box--services .services-index__row:focus-within {
  background: linear-gradient(100deg,
    color-mix(in srgb, var(--svc-accent, #9cc6e8) 21%, transparent) 0%,
    color-mix(in srgb, var(--svc-accent, #9cc6e8) 9%, transparent) 60%,
    transparent 100%);
}

@media (max-width: 767px) {
  body.sm-live-home #hero .hero-about-trigger .hero-about-trigger__label,
  body.sm-live-home #hero .hero-lab-trigger .hero-lab-trigger__label {
    font-size: 0.5rem;
    letter-spacing: 0.05em;
  }

  body.sm-live-home #hero > .blackrail-bird .blackrail-bird__bubble {
    width: 2.85rem;
    height: 2.85rem;
  }

  body.sm-live-home #hero .hero__trigger-button.top.hero-lab-trigger .hero-lab-trigger__bubble {
    --orbit-w: 2.45rem !important;
    --orbit-h: 0.82rem !important;
    width: 2.85rem !important;
    height: 2.85rem !important;
  }

  /*
   * Copyright on one line. In Karla the line is about 20 em wide, so the size
   * follows the viewport (16px at most) and fits down to 320px screens.
   */
  body.sm-live-home #hero > .meta.social .hero-copyright {
    font-size: min(16px, calc((100vw - 48px) / 20.5));
  }

  body.sm-live-home #about.about-panel .about-panel__scroll-cue:not(.about-panel__scroll-cue--top) {
    left: var(--sm-about-scroll-cue-left, max(clamp(0.55rem, 2.4vw, 1.2rem), env(safe-area-inset-left)));
    right: auto;
    bottom: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.sm-live-home .blackrail-bird__bird,
  body.sm-live-home .blackrail-bird:hover .blackrail-bird__bird,
  body.sm-live-home .blackrail-bird:focus-visible .blackrail-bird__bird,
  body.sm-live-home .blackrail-bird.is-departing .blackrail-bird__bird,
  body.sm-live-home .blackrail-bird:hover .blackrail-bird__wing,
  body.sm-live-home .blackrail-bird:focus-visible .blackrail-bird__wing,
  body.sm-live-home .blackrail-bird.is-departing .blackrail-bird__wing {
    animation: none;
  }
}

#hero .sm-careers-link {
  position: absolute; z-index: 50; top: clamp(62%, calc(50% + 292px), 78%);
  display: grid; justify-items: center; gap: .18rem; min-width: 44px;
  color: inherit; font: 700 .72rem/1.3 Karla, sans-serif; text-decoration: none;
}
.sm-oracle { position: relative; display: grid; place-items: center; width: 3.2rem; height: 3.2rem; }
.sm-oracle i {
  position:relative; overflow:hidden; width:65%; aspect-ratio:1; border-radius:50%; border:1px solid #d4b5f5;
  background:radial-gradient(at 30% 20%,#f9ddff 0%,#b697eb 13%,#824ab5 39%,#382155 75%);
  box-shadow:inset -2px -3px 6px #271b48,0 0 8px #ac72c5;
}
.sm-oracle i::after {content:"";position:absolute;inset:0;border-radius:inherit;background:radial-gradient(ellipse at 28% 19%,#fff9 1%,transparent 19%),radial-gradient(ellipse at 58% 90%,#ffd5ff44,transparent 45%);box-shadow:inset 0 0 3px #f9dfff}
.sm-oracle b {position:absolute;inset:0;background:url("/blackrail-theme-assets/assets/images/oracle-hands.svg") center/contain no-repeat}
.sm-vision {position:absolute;inset:0;opacity:0;background-size:2400% 100%;background-repeat:no-repeat}
.sm-careers-link:is(:hover,:focus-visible) .sea {background-image:url("images/vision-0.webp")}
.sm-careers-link:is(:hover,:focus-visible) .embers {background-image:url("images/vision-1.webp")}
.sm-careers-link:is(:hover,:focus-visible) .crystal {background-image:url("images/vision-2.webp")}
.sm-careers-link:is(:hover,:focus-visible) .sea {opacity:1}
@media(prefers-reduced-motion:no-preference) {
  body:not(.sm-motion-paused) .sm-oracle b {animation:sm-palm-float 3.8s ease-in-out infinite}
  body:not(.sm-motion-paused) .sm-careers-link:is(:hover,:focus-visible) .sm-vision {animation:sm-portal-open 1.5s both,sm-portal-film 1.5s steps(23,end) both;animation-delay:var(--vision-delay,0s)}
  .sm-vision.embers {--vision-delay:1.35s}
  .sm-vision.crystal {--vision-delay:2.7s}
}
@keyframes sm-palm-float {0%,100% {transform:translateY(3px)} 50% {transform:translateY(-5px)}}
@keyframes sm-portal-open {0% {opacity:0;clip-path:circle(1% at 48% 52%)} 14% {opacity:1} 40%,100% {opacity:1;clip-path:circle(75% at 50% 50%)}}
@keyframes sm-portal-film {from {background-position:0% 50%} to {background-position:100% 50%}}
@media (max-width: 767px) {
  #hero .sm-careers-link {font-size:.65rem}
  .sm-oracle { width: 2.85rem; height: 2.85rem; }
}


#hero .sm-careers-link { color:#e7e8f4; text-shadow:0 1px 4px #111; text-transform:uppercase;letter-spacing:.1em; }
#hero .sm-careers-link > span:first-child { grid-row:2; }
body.sm-live-home .blackrail-bird__label img {display:block;width:3.25rem;height:.7rem;object-fit:contain;filter:brightness(0) invert(1)}
body.sm-live-home #hero .blackrail-bird__bubble {display:grid;place-items:center;background:linear-gradient(145deg,#fcfcf5,#dfded4);border-color:#908e8b}
body.sm-live-home .blackrail-bird__bubble img {width:78%;height:76%;object-fit:contain}
body.sm-live-home .blackrail-bird__bubble::after {display:none}
body.sm-live-home #about :is(.partner-models__placeholder,.services-index__scene) {border:0;box-shadow:none;border-radius:0;background:transparent}
body.sm-live-home #about :is(.partner-models__placeholder,.services-index__scene)::before,
body.sm-live-home #about :is(.partner-models__placeholder,.services-index__scene)::after {background:none;box-shadow:none;border:0}
body.sm-live-home #about .partner-models__row {border:0;box-shadow:none}
#about.active-screen .shape--e {--surface:url("images/planet-globe-0.webp")}
#about.active-screen .shape--f {--surface:url("images/planet-globe-1.webp")}
#about.active-screen .shape--g {--surface:url("images/planet-globe-2.webp")}
#about.active-screen .shape--h {--surface:url("images/planet-globe-3.webp")}
body.sm-live-home #about .partner-models__card .service-icon .world {background:var(--surface,none) center/contain no-repeat;box-shadow:none}
body.sm-live-home #about .partner-models__card .world::before {opacity:0}
body.sm-live-home #about .partner-models__card .service-icon::before,
body.sm-live-home #about .partner-models__card .service-icon::after {opacity:.22}
#hero .sm-horizon-control {position:absolute;z-index:64;left:50%;top:50%;translate:-50% -50%;width:clamp(75px,12vmin,125px);aspect-ratio:1;border:0;background:transparent;border-radius:50%;cursor:pointer}
#hero .sm-horizon-control[hidden] {display:none}
#hero .sm-horizon-control:focus-visible {outline:2px solid #dfc9ff;outline-offset:0}
#hero .sm-eject {position:fixed;z-index:65;display:grid;place-items:center;pointer-events:none;color:#fbecff;text-shadow:0 0 12px #9c6af9;font-size:1.5rem}
#hero .sm-eject img {width:1.8rem;height:1.8rem;filter:drop-shadow(0 0 4px #dbbdff)}
@media(prefers-reduced-motion:no-preference) {
  body:not(.sm-motion-paused) #about .shape:hover .bh {transition-delay:.15s}
  body:not(.sm-motion-paused) #about .shape:hover .burn {transition-delay:0s;animation-delay:0s}
  body:not(.sm-motion-paused) #about .shape:hover .service-icon-glyph {transition-delay:.1s;animation-delay:.1s}
  body:not(.sm-motion-paused) #about .suck-target.suck-active .suck-char {animation-duration:.55s}
}
@media(hover:none) and (prefers-reduced-motion:no-preference) {
  body:not(.sm-motion-paused) #hero:not([inert]) .sm-vision {animation:sm-portal-open 1.2s both,sm-portal-film 1.2s steps(23,end) both;animation-delay:calc(.6s + var(--vision-delay,0s))}
  #hero:not([inert]) .sm-vision.sea {background-image:url("images/vision-0.webp")}
  #hero:not([inert]) .sm-vision.embers {background-image:url("images/vision-1.webp")}
  #hero:not([inert]) .sm-vision.crystal {background-image:url("images/vision-2.webp")}
}
.sm-live-home [data-sm-drifting],.sm-live-home [data-sm-drifting] * {pointer-events:none !important}
body.sm-live-home #about.about-panel .about__content__box--partners .partner-models__placeholder,
body.sm-live-home #about.about-panel .about__content__box--services .services-index__scene {
  background:transparent;border:0;box-shadow:none;border-radius:0
}
@media(prefers-reduced-motion:no-preference) {
  body:not(.sm-motion-paused) .sm-careers-link:is(:hover,:focus-visible) .sm-oracle b {animation:sm-palm-spell 1.45s ease-in-out infinite alternate}
}
@keyframes sm-palm-spell {from {transform:translateY(2px)} to {transform:translateY(-2px)}}

/* Light gathers inside the glass as the palms lift. */
.sm-oracle::before {
  content:""; position:absolute; inset:8%; border-radius:50%; pointer-events:none;
  background:radial-gradient(ellipse at 52% 64%,#bb83ed75,transparent 67%);
}
@media(prefers-reduced-motion:no-preference) {
  body:not(.sm-motion-paused) #hero:not([inert]) .sm-oracle::before {
    animation:sm-oracle-glow 3.8s ease-in-out infinite;
  }
  body:not(.sm-motion-paused) #hero:not([inert]) .sm-oracle i::after {
    animation:sm-oracle-glint 3.8s ease-in-out infinite;
  }
}
@keyframes sm-oracle-glow {
  0%,100% {opacity:.35;transform:scale(.85)}
  50% {opacity:1;transform:scale(1.38)}
}
@keyframes sm-oracle-glint {
  0%,100% {transform:rotate(-20deg);opacity:.55}
  50% {transform:rotate(32deg);opacity:1}
}

#hero .hero__trigger-button.top.hero-about-trigger .hero-about-trigger__core {
  width:46%; height:46%; border:0; border-radius:0; box-shadow:none;
  background:transparent url("live/assets/logo-light.svg") center / contain no-repeat;
  filter:drop-shadow(0 1px 2px #24204f); animation:none;
  transform:translate(-50%,-50%);
}
#hero .hero__trigger-button.top.hero-about-trigger .hero-about-trigger__core::before,
#hero .hero__trigger-button.top.hero-about-trigger .hero-about-trigger__core::after {content:none}

/* Keep the superscript inside the same optical crop as the wordmark on narrow screens. */
body.sm-live-home :is(#hero,#about.about-panel) > .meta.name .smlogo-wrap .smlogo-svg {
  width:100%; height:100%; transform:none; color:inherit;
}
#hero .smlogo-wrap {color:#d9e1e9}

/* Stored Home bodies may still include the retired six-face loading overlay. */
#sm-loader { display: none !important; }
.sm-shard-outline {
    position: fixed;
    z-index: 2;
    left: 50vw;
    top: 50vh;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 1;
    transition: opacity 460ms ease-out;
}
.sm-shard-outline.is-revealed { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
    .sm-shard-outline { display: none; }
}
