/* ── Embed mode (?mode=embed) ──────────────────────────────────────
   Activated by blog-embed-detect.js when a blog post is loaded inside
   the Android app's WebView. Strips navbar/footer/breadcrumb/CTA/related
   chrome and re-skins the article to match the native app's own dark
   theme, so it reads as in-app content rather than a website. */

html.gt-embed {
  --green: #4CAF50;
  --bg-card: #131313;
  --border: rgba(76, 175, 80, 0.25);
  --text: #ffffff;
  --text-dim: rgba(255, 255, 255, 0.65);
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-head: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html.gt-embed body {
  background: #0A0A0A !important;
  color: #ffffff !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  padding: 0 !important;
  font-size: 16px !important;
}

html.gt-embed .navbar,
html.gt-embed .footer,
html.gt-embed .breadcrumb,
html.gt-embed .post-nav,
html.gt-embed .article-cta,
html.gt-embed .suggestions,
html.gt-embed .suggestions-inline,
html.gt-embed .read-progress {
  display: none !important;
}

html.gt-embed .article-hero {
  background: none !important;
  padding: 20px 20px 0 !important;
  margin: 0 !important;
  min-height: 0 !important;
}

html.gt-embed .article-wrap,
html.gt-embed .article-content {
  max-width: 640px !important;
  margin: 0 auto !important;
  padding: 0 !important;
}

html.gt-embed .article-body {
  padding: 0 20px 40px !important;
  background: none !important;
}

html.gt-embed .article-cat {
  color: #4CAF50 !important;
}

html.gt-embed .article-meta {
  color: rgba(255, 255, 255, 0.6) !important;
  font-size: 14px !important;
  padding-bottom: 20px !important;
  margin-bottom: 20px !important;
  border-bottom: 1px solid rgba(76, 175, 80, 0.2) !important;
}

html.gt-embed h1 {
  color: #4CAF50 !important;
  font-size: 28px !important;
  line-height: 1.25 !important;
}

html.gt-embed h2 {
  color: #4CAF50 !important;
  font-size: 22px !important;
  border-bottom: 1px solid rgba(76, 175, 80, 0.3) !important;
  padding-bottom: 8px !important;
  margin-top: 24px !important;
  margin-bottom: 12px !important;
}

html.gt-embed h3 {
  margin-top: 24px !important;
  margin-bottom: 12px !important;
}

html.gt-embed p {
  margin-bottom: 16px !important;
  color: inherit !important;
}

html.gt-embed a {
  color: #4CAF50 !important;
  text-decoration: none !important;
  border-bottom: 1px solid rgba(76, 175, 80, 0.5) !important;
}

html.gt-embed img {
  max-width: 100% !important;
  height: auto !important;
  margin: 20px 0 !important;
  border-radius: 8px !important;
}

html.gt-embed blockquote {
  border-left: 4px solid #4CAF50 !important;
  padding-left: 16px !important;
  margin: 16px 0 !important;
  color: rgba(255, 255, 255, 0.8) !important;
  font-style: italic !important;
}

html.gt-embed ul,
html.gt-embed ol {
  margin-left: 20px !important;
  margin-bottom: 16px !important;
}

html.gt-embed li {
  margin-bottom: 8px !important;
}

/* Interactive widgets (gt-stats, gt-keys, ai-report, site-card, gt-faq, etc.)
   inherit the recolored CSS variables above, so no per-component overrides
   are needed here beyond the variable redefinitions on html.gt-embed. */


/* ── Floating "download the app" invite (open web only) ────────────────
   Built by blog-embed-detect.js on blog-post pages. Phones: slim bar
   pinned to the bottom. Desktop: compact card in the bottom-right corner.
   Uses the marketing palette from styles.css. Hidden inside the app
   (html.gt-embed) — those readers already have it. */

.gt-appfloat {
  position: fixed;
  z-index: 940;
  left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px calc(11px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(160deg, #0b1c0f, #060f08);
  border-top: 1px solid var(--border);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.45);
  color: var(--text);
  font-family: 'Rajdhani', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  transform: translateY(115%);
  opacity: 0;
  transition: transform 0.55s cubic-bezier(0.16, 0.84, 0.44, 1), opacity 0.5s ease;
}
.gt-appfloat.gt-af-show { transform: none; opacity: 1; }

.gt-af-icon {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  color: var(--green);
  filter: drop-shadow(0 0 7px var(--green-glow));
}
.gt-af-icon svg { width: 100%; height: 100%; display: block; }

.gt-af-body { flex: 1 1 auto; min-width: 0; }
.gt-af-kicker {
  margin: 0 0 1px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 9.5px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--green-dim);
}
.gt-af-title {
  margin: 0;
  font-family: 'Orbitron', sans-serif; font-weight: 700;
  font-size: 13.5px; line-height: 1.15;
  color: var(--text);
}
.gt-af-desc {
  display: none; /* phones: keep the bar slim; shown on desktop card */
  margin: 4px 0 0;
  font-size: 13.5px; line-height: 1.32;
  color: var(--text-dim);
}

.gt-af-cta {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px;
  border-radius: 9px;
  background: var(--green); color: #04140b;
  font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 14px;
  text-decoration: none; white-space: nowrap;
  box-shadow: 0 4px 16px var(--green-glow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.gt-af-cta:hover { background: #46ffa5; transform: translateY(-1px); box-shadow: 0 6px 22px var(--green-glow); }
.gt-af-cta:active { transform: translateY(0); }
.gt-af-cta svg { width: 12px; height: 12px; fill: currentColor; }

.gt-af-close {
  position: absolute; top: 5px; right: 7px;
  width: 26px; height: 26px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: 6px;
  color: var(--text-dim); font-size: 18px; line-height: 1; cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.gt-af-close:hover { color: var(--green); background: rgba(0, 255, 136, 0.08); }

/* App preview peeking out from behind the card, for depth. Desktop only:
   on phones the invite is a slim full-width bar with no room behind it.
   Injected by blog-embed-detect.js only when the card is actually revealed. */
.gt-af-media { display: none; }

@media (min-width: 640px) {
  .gt-af-media {
    display: block;
    position: absolute;
    z-index: -1;                 /* detrás del texto de la tarjeta */
    right: 16px;
    bottom: calc(100% - 22px);   /* asoma por encima, tapada abajo por la tarjeta */
    width: 118px;
    pointer-events: none;
    border-radius: 15px 15px 0 0;
    overflow: hidden;
    border: 1px solid rgba(0, 255, 136, 0.22);
    border-bottom: 0;
    box-shadow: 0 -14px 34px rgba(0, 0, 0, 0.55), 0 0 22px rgba(0, 255, 136, 0.07);
    opacity: 0;
    transform: translateY(16px) rotate(-2.5deg);
    transform-origin: bottom right;
    transition: opacity 0.55s ease 0.18s,
                transform 0.65s cubic-bezier(0.16, 0.84, 0.44, 1) 0.18s;
    /* El borde inferior se disuelve en la tarjeta en vez de cortarse en seco,
       así el solape se lee como profundidad y no como un recorte. */
    -webkit-mask-image: linear-gradient(180deg, #000 74%, transparent 100%);
            mask-image: linear-gradient(180deg, #000 74%, transparent 100%);
  }
  .gt-af-media video { width: 100%; height: auto; display: block; }
  .gt-appfloat.gt-af-show .gt-af-media { opacity: 1; transform: translateY(0) rotate(-2.5deg); }
}

/* Desktop: corner card with a full-width button underneath the text */
@media (min-width: 640px) {
  .gt-appfloat {
    left: auto; right: 22px; bottom: 22px;
    width: 336px;
    flex-wrap: wrap; align-items: flex-start;
    padding: 16px 18px 16px 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.55), 0 0 24px rgba(0, 255, 136, 0.06);
    transform: translateY(26px);
  }
  .gt-appfloat.gt-af-show { transform: none; }
  .gt-af-body { flex: 1 1 0; }
  .gt-af-desc { display: block; }
  .gt-af-cta { flex: 1 1 100%; margin-top: 13px; padding: 10px 15px; }
  .gt-af-close { top: 8px; right: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .gt-appfloat { transition: opacity 0.3s ease; transform: none; }
  .gt-appfloat.gt-af-show { transform: none; }
  .gt-af-media { transition: opacity 0.3s ease; transform: rotate(-2.5deg); }
  .gt-appfloat.gt-af-show .gt-af-media { transform: rotate(-2.5deg); }
}

/* Belt-and-suspenders: never render inside the app's WebView. */
html.gt-embed .gt-appfloat { display: none !important; }
