/* === vir.group translation visual feedback === */
/* Stored in Mastodon Setting key `custom_css` (DB row, served at /custom.css). */

/* ------------------------------------------------------------------
 * 1. While the translation request is in flight.
 *
 * Mastodon doesn't toggle a class on the button during the fetch, so we
 * piggyback on `:focus`, which sticks from click until the user clicks
 * elsewhere or the button is replaced by the translated content. We run
 * a long-duration pulse (≈30 s of iterations) so it covers any realistic
 * AI translation latency. When translation lands the button is unmounted
 * and the animation simply stops.
 * ------------------------------------------------------------------ */
/* Give the button breathing room so the pulse + expanding ring don't get
   clipped by neighbouring layout. */
.status__content__translate-button {
  margin: 6px 8px 6px 0;
  overflow: visible;
}

.status__content,
.status__content__text,
.detailed-status__action-bar,
.status__action-bar {
  overflow: visible;
}

.status__content__translate-button:focus,
.status__content__translate-button:active {
  position: relative;
  outline: none;
  color: #6364ff !important;
  animation: virgPulseBtn 1.2s ease-in-out 25;
}

.status__content__translate-button:focus::after,
.status__content__translate-button:active::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 6px;
  pointer-events: none;
  border: 2px solid #6364ff;
  animation: virgRingExpand 1.4s ease-out 22;
  opacity: 0;
}

@keyframes virgPulseBtn {
  0%   { box-shadow: 0 0 0 0 rgba(99, 100, 255, 0.55); }
  70%  { box-shadow: 0 0 0 10px rgba(99, 100, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(99, 100, 255, 0); }
}

@keyframes virgRingExpand {
  0%   { transform: scale(1);    opacity: 0.7; }
  100% { transform: scale(1.15); opacity: 0;   }
}

/* ------------------------------------------------------------------
 * 2. When the translation arrives.
 *
 * The `.translate-button` wrapper appears in place of the click button.
 * Fade + soft blur reveal makes the swap feel intentional rather than
 * a sudden DOM change.
 * ------------------------------------------------------------------ */
.translate-button {
  animation: virgReveal 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes virgReveal {
  0%   { opacity: 0; transform: translateY(-3px); filter: blur(2px); }
  100% { opacity: 1; transform: translateY(0);    filter: blur(0);   }
}

/* ------------------------------------------------------------------
 * 3. The "Translated using vir.group" attribution.
 *
 * Subtle accent so the user always sees that the translation is fresh
 * and which provider produced it.
 * ------------------------------------------------------------------ */
/* Wrapper around the attribution — let the shimmer gradient breathe. */
.translate-button {
  margin: 5px;
  overflow: visible;
}

.translate-button__meta {
  position: relative;
  display: inline-block;
  padding: 5px 10px 5px 26px;
  margin: 5px;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    rgba(99, 100, 255, 0.12) 0%,
    rgba(99, 100, 255, 0.03) 60%,
    transparent 100%
  );
  background-size: 220% 100%;
  border-left: 3px solid #6364ff;
  font-size: 0.82em;
  font-weight: 500;
  line-height: 1.35;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.12s;
  animation: virgShimmer 3s linear infinite;
}

.translate-button__meta:hover {
  background-color: rgba(99, 100, 255, 0.18);
  transform: translateY(-1px);
}

.translate-button__meta:focus-visible {
  outline: 2px solid #6364ff;
  outline-offset: 2px;
}

.translate-button__meta::before {
  content: "✨";
  position: absolute;
  left: 7px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9em;
  animation: virgSpark 2.2s ease-in-out infinite;
}

@keyframes virgShimmer {
  0%   { background-position: -180% 0; }
  100% { background-position:  180% 0; }
}

@keyframes virgSpark {
  0%, 100% { opacity: 0.55; transform: translateY(-50%) rotate(0deg);   }
  50%      { opacity: 1;    transform: translateY(-50%) rotate(180deg); }
}
/* ==================================================================
 * VIR Group — Mastodon launcher + branding overrides
 * Appended to Setting.custom_css (served at /custom.css on every page).
 * ================================================================== */

/* --- 1. Apps launcher (9-cubes) widget ---------------------------- */
.vir-launcher {
  position: relative;
  display: inline-block;
  margin: 6px 0 12px;
  font-family: inherit;
}

.vir-launcher--floating {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 9999;
}

.vir-launcher__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(99, 100, 255, 0.15);
  color: #6364ff;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.12s, color 0.15s;
}
.vir-launcher__btn svg {
  width: 26px;
  height: 26px;
}
.vir-launcher__btn:hover {
  background-color: rgba(99, 100, 255, 0.28);
  color: #8b8cff;
  transform: scale(1.05);
}
.vir-launcher__btn:focus-visible {
  outline: 2px solid #6364ff;
  outline-offset: 2px;
}
.vir-launcher.is-open .vir-launcher__btn {
  background-color: rgba(99, 100, 255, 0.35);
  color: #fff;
}

.vir-launcher__panel {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  width: 312px;
  padding: 14px;
  background: #313543;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
  z-index: 10000;
  opacity: 0;
  transform: translateY(8px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.vir-launcher.is-open .vir-launcher__panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.vir-launcher__header {
  font-size: 0.7em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.6);
  margin: 0 0 10px;
  padding: 0 4px;
}

.vir-launcher__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.vir-launcher__tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 10px 6px;
  border-radius: 10px;
  text-decoration: none;
  color: #d9e1e8 !important;
  transition: background-color 0.12s, transform 0.12s;
}
.vir-launcher__tile:hover {
  background-color: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
  text-decoration: none !important;
}
.vir-launcher__tile:focus-visible {
  outline: 2px solid #6364ff;
  outline-offset: 1px;
}

/* Tile artwork wrap. Each tile gets a unique --accent gradient via
 * [data-app="…"] selectors below — colours are chosen so neighbouring
 * tiles are easily distinguishable at a glance, and so brand marks
 * (Google Play green, Apple graphite, VIR indigo) stay recognisable. */
.vir-launcher__icon-wrap {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background-image: var(--accent, linear-gradient(135deg, #6f3ff5 0%, #06b6d4 100%));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 2px 6px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 52px;
}

/* PNG/JPG brand marks (vir.ico, newsgroup.jpg) fill the tile edge-to-edge
 * and sit above the accent so the bitmap reads clearly. */
.vir-launcher__icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  display: block;
}

/* Inline-SVG glyphs (search/code/about/play/apple) centre as a 32 px mark
 * over the accent. Currentcolor inherits from .vir-launcher__icon--svg. */
.vir-launcher__icon--svg {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: transparent;
}
.vir-launcher__icon--svg svg {
  width: 32px;
  height: 32px;
  display: block;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
}

.vir-launcher__label {
  display: block;
  margin-top: 6px;
  font-size: 0.7em;
  line-height: 1.2;
  text-align: center;
  max-width: 90px;
  word-break: break-word;
  color: #d9e1e8;
}

/* Per-app accent gradient. Pick distinct hue families so the tiles read
 * as a colour-coded set; brand-locked tiles (Google Play / App Store)
 * use their canonical colours. */
.vir-launcher__tile[data-app='vir-group']   .vir-launcher__icon-wrap { --accent: linear-gradient(135deg, #4f46e5 0%, #6366f1 35%, #8b5cf6 65%, #06b6d4 100%); }
.vir-launcher__tile[data-app='newsgroup']   .vir-launcher__icon-wrap { --accent: linear-gradient(135deg, #10b981 0%, #14b8a6 100%); }
.vir-launcher__tile[data-app='search']      .vir-launcher__icon-wrap { --accent: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.vir-launcher__tile[data-app='developers']  .vir-launcher__icon-wrap { --accent: linear-gradient(135deg, #f43f5e 0%, #be123c 100%); }
.vir-launcher__tile[data-app='mail']        .vir-launcher__icon-wrap { --accent: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%); }
.vir-launcher__tile[data-app='social']      .vir-launcher__icon-wrap { --accent: linear-gradient(135deg, #d946ef 0%, #8b5cf6 100%); }
.vir-launcher__tile[data-app='google-play'] .vir-launcher__icon-wrap { --accent: linear-gradient(135deg, #1f2937 0%, #111827 100%); }
.vir-launcher__tile[data-app='app-store']   .vir-launcher__icon-wrap { --accent: linear-gradient(135deg, #4b5563 0%, #1f2937 50%, #000 100%); }

/* Mobile: open as fixed bottom sheet, full width.  Also lift the launcher
 * button itself above Mastodon's bottom auth bar ("Створити обліковий
 * запис / Увійти") which otherwise covers the in-footer launcher. */
/* On phones: dock launcher in the top-right corner so it doesn't overlap
 * compose input or the bottom auth bar; smaller button so it's a marker,
 * not a blocker. Panel drops down anchored to the right edge. */
@media (max-width: 600px) {
  .vir-launcher,
  .vir-launcher--floating {
    position: fixed !important;
    top: 8px !important;
    right: 8px !important;
    bottom: auto !important;
    left: auto !important;
    z-index: 9997 !important;
    margin: 0 !important;
  }
  .vir-launcher__btn {
    width: 40px;
    height: 40px;
    background: rgba(20, 22, 30, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  }
  .vir-launcher__btn svg { width: 22px; height: 22px; }
  .vir-launcher__panel {
    position: fixed;
    top: 56px;
    right: 8px;
    left: auto;
    bottom: auto;
    width: min(312px, calc(100vw - 16px));
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    transform-origin: top right;
  }
}

/* --- 2. Logo replacement (CSS fallback if JS hasn't run yet) ------- */
/* JS in vir-enhance.js does the real swap; this fallback just hides the
 * upstream Mastodon SVG so there's no flash of foreign logo on first paint. */
svg.logo:not([data-vir-replaced]) {
  visibility: hidden;
}

/* --- Hide Mastodon link-footer ----------------------------------- */
/* The <footer data-context="default|multi-column|about"> renders an
 * advert-style link panel ("About this server / Status / Profiles
 * directory / About Mastodon / Get the app / View source / vN.N.N").
 * We don't promote upstream Mastodon or third-party destinations on
 * social.vir.group — hide it everywhere. The launcher always floats
 * (see attachLauncher in vir-enhance.js), so we don't lose it. */
footer[data-context] {
  display: none !important;
}

/* --- VIR SOCIAL gradient wordmark (replaces Mastodon logo) ------- */
/* Mastodon's column header normally hosts a 28 px svg.logo. We need room
 * for a ~160 px-tall text logo, so let the wrapper grow. */
.column-link--logo,
.navigation-panel__logo,
.navigation-bar__logo {
  height: auto !important;
  min-height: 80px !important;
  padding: 10px 12px !important;
  overflow: visible !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.vir-text-logo {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  height: 70px;
  padding: 0 4px;
  text-decoration: none !important;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.15s ease;
  box-sizing: border-box;
}
.vir-text-logo:hover { filter: brightness(1.18); transform: translateY(-1px); }
.vir-text-logo:focus-visible { outline: 2px solid #6f3ff5; outline-offset: 4px; border-radius: 6px; }

.vir-text-logo__inner {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif;
  font-weight: 900;
  /* Two-line stacked wordmark — scales with the sidebar width so it always
   * fits.  At 257 px sidebar (default desktop) ~60 px, capped at 60 px so
   * "SOCIAL" stays comfortably inside the sidebar (was clipping at 70). */
  font-size: clamp(18px, 3.4vw, 36px);
  line-height: 0.95;
  letter-spacing: -0.02em;
  white-space: nowrap;
  background-image: linear-gradient(135deg, #4f46e5 0%, #6366f1 35%, #8b5cf6 65%, #06b6d4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.vir-text-logo__line {
  display: block;
  line-height: 0.95;
}

/* Hidden by default — the floating mobile logo only shows on phones. */
.vir-mobile-logo { display: none !important; }

/* On phones Mastodon hides the right sidebar, so the in-sidebar logo
 * goes off-screen.  Reveal the dedicated floating clone instead. */
@media (max-width: 600px) {
  /* Main sidebar logo doesn't apply (sidebar is off-screen on mobile) — no
   * adjustments needed there. */
  .vir-mobile-logo {
    display: flex !important;
    position: fixed !important;
    top: 6px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 9998 !important;
    height: auto !important;
    padding: 4px 10px !important;
    background: rgba(20, 22, 30, 0.85) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 12px !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    pointer-events: auto !important;
  }
  .vir-mobile-logo .vir-text-logo__inner {
    flex-direction: row !important;       /* compact single-line on phones */
    gap: 8px;
    font-size: clamp(20px, 6vw, 28px);
    line-height: 1;
  }
  /* Make room under the floating logo so it doesn't cover instance content */
  body { padding-top: 56px; }
}

/* --- "S.V." monogram inside the Social tile ---------------------- */
/* The accent background comes from .vir-launcher__icon-wrap (data-app
 * accent). This element just centres the white letters on top. */
.vir-launcher__icon--text {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.04em;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
  background: transparent;
}


