/* ══════════════════════════════════════
   ANIMATIONS — Cria24-inspired effects
   Border-draw · Word-reveal · Fragments
══════════════════════════════════════ */

/* ── Word-split: each word wraps an inner span ── */
.word-split .word {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  margin-right: .16em;
}
.word-split .word-inner {
  display: inline-block;
  transform: translateY(110%);
  opacity: 0;
}

/* ── Border-draw on scroll ── */
.draw-border { position: relative; }
.draw-border::after {
  content: '';
  position: absolute; inset: -1px;
  border-radius: inherit;
  border: 1.5px solid var(--blue);
  clip-path: inset(0 100% 0 0);
  pointer-events: none;
  transition: clip-path .95s cubic-bezier(.22, 1, .36, 1);
  z-index: 4;
}
.draw-border.is-drawn::after { clip-path: inset(0 0% 0 0); }
.draw-border--white::after   { border-color: rgba(255,255,255,.25); }
.draw-border--blue::after    { border-color: var(--blue); }

/* ── Decorative line-draw ── */
.line-draw {
  height: 1.5px;
  background: linear-gradient(90deg, var(--blue), #60a5fa);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1s cubic-bezier(.22, 1, .36, 1);
  border-radius: 2px;
}
.line-draw.is-drawn { transform: scaleX(1); }

/* ══════════════════════════════════════
   APP SHOWCASE — Floating fragment layout
══════════════════════════════════════ */
.app-showcase {
  position: relative;
  max-width: 1000px;
  margin: 0 auto;
  padding: 60px 0 80px;
}

/* Central screen */
.app-screen-wrap {
  position: relative;
  max-width: 660px;
  margin: 0 auto;
  z-index: 5;
}

.app-screen {
  background: linear-gradient(160deg, #161b22 0%, #0d1117 55%, #161b22 100%);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(255,255,255,.05),
    0 40px 120px rgba(0,0,0,.55),
    0 16px 48px rgba(59,130,246,.18),
    inset 0 1px 0 rgba(255,255,255,.08);
  opacity: 0;
  transform: translateY(40px) scale(.97);
  transition: opacity .9s cubic-bezier(.22,1,.36,1), transform .9s cubic-bezier(.22,1,.36,1);
}
.app-screen.is-visible { opacity: 1; transform: translateY(0) scale(1); }

/* Title bar */
.app-titlebar {
  display: flex; align-items: center;
  padding: 13px 18px;
  background: rgba(255,255,255,.04);
  border-bottom: 1px solid rgba(255,255,255,.08);
  gap: 8px; position: relative;
}
.app-dots { display: flex; gap: 6px; }
.app-dot  { width: 11px; height: 11px; border-radius: 50%; }
.app-dot.r { background:#ff5f57; box-shadow:0 0 5px rgba(255,95,87,.5); }
.app-dot.y { background:#febc2e; box-shadow:0 0 5px rgba(254,188,46,.5); }
.app-dot.g { background:#28c840; box-shadow:0 0 5px rgba(40,200,64,.5); }
.app-url {
  position: absolute; left: 0; right: 0;
  text-align: center;
  font-family: var(--ffm); font-size: .62rem;
  color: rgba(255,255,255,.25); letter-spacing: .06em;
  pointer-events: none;
}
.app-tabs { display: flex; gap: 2px; margin-left: auto; z-index: 1; }
.app-tab  {
  font-family: var(--ffm); font-size: .58rem;
  color: rgba(255,255,255,.3); padding: 3px 10px;
  border-radius: 5px 5px 0 0;
}
.app-tab.active {
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.8);
  border: 1px solid rgba(255,255,255,.1); border-bottom: none;
}

/* Body */
.app-body { display: flex; min-height: 0; }
.app-sidebar {
  width: 175px; flex-shrink: 0;
  background: rgba(255,255,255,.025);
  border-right: 1px solid rgba(255,255,255,.07);
  padding: 14px 0;
}
.app-nav-section {
  font-family: var(--ffm); font-size: .5rem;
  color: rgba(255,255,255,.2); letter-spacing: .12em;
  text-transform: uppercase; padding: 12px 14px 5px;
}
.app-nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 14px;
  font-family: var(--ffm); font-size: .62rem;
  color: rgba(255,255,255,.38);
  position: relative;
}
.app-nav-item.active { background: rgba(59,130,246,.15); color: rgba(255,255,255,.9); }
.app-nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 2px; background: var(--blueb); border-radius: 0 2px 2px 0;
}
.app-nav-item i { font-size: .82rem; width: 15px; text-align: center; flex-shrink: 0; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-toolbar {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 14px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  background: rgba(255,255,255,.02);
  flex-wrap: wrap;
}
.app-pill {
  font-family: var(--ffm); font-size: .56rem;
  color: rgba(255,255,255,.3);
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 50px; padding: 3px 9px;
}
.app-pill.blue {
  color: #93c5fd; background: rgba(59,130,246,.12);
  border-color: rgba(59,130,246,.25);
}
.app-live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #4ade80; margin-left: auto; flex-shrink: 0;
  animation: ldot 2s infinite;
}

/* Dashboard grid */
.app-dashboard {
  padding: 14px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 9px;
  background: linear-gradient(180deg, rgba(255,255,255,.02), transparent);
}
.app-dash-card {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 10px; padding: 12px;
}
.app-dash-label {
  font-family: var(--ffm); font-size: .5rem;
  color: rgba(255,255,255,.3); letter-spacing: .1em; margin-bottom: 5px;
}
.app-dash-val {
  font-family: var(--ffh); font-weight: 800;
  font-size: 1.35rem; line-height: 1;
  background: linear-gradient(135deg, #f0f4ff, #93c5fd);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.app-dash-sub { font-family: var(--ffm); font-size: .5rem; color: rgba(255,255,255,.22); margin-top: 3px; }
.app-progress-wrap { margin-top: 7px; }
.app-progress-track {
  height: 4px; background: rgba(255,255,255,.08);
  border-radius: 4px; overflow: hidden;
}
.app-progress-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, #2563eb, #3b82f6, #60a5fa);
  transition: width 1.5s cubic-bezier(.22,1,.36,1);
}
.app-statusbar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px;
  border-top: 1px solid rgba(255,255,255,.07);
  background: rgba(0,0,0,.2);
}
.app-status-item {
  display: flex; align-items: center; gap: 5px;
  font-family: var(--ffm); font-size: .53rem;
  color: rgba(255,255,255,.28);
}
.app-status-item.green { color: #4ade80; }
.app-status-item.blue  { color: #93c5fd; }

/* ── Floating fragment cards ── */
.app-frag {
  position: absolute;
  opacity: 0;
  will-change: transform, opacity;
  z-index: 10;
}
.app-frag--tl { top:  6%;  left: -8%; }
.app-frag--tr { top:  4%;  right: -8%; }
.app-frag--bl { bottom: 10%; left: -6%; }
.app-frag--br { bottom:  8%; right: -6%; }

.frag-card {
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(59,130,246,.15);
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: 0 12px 48px rgba(0,0,0,.18), 0 0 0 1px rgba(59,130,246,.06);
  min-width: 155px;
  position: relative; overflow: hidden;
  animation: fragFloat 5s ease-in-out infinite;
}
.frag-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, #2563eb, #60a5fa, #2563eb);
  background-size: 200% 100%;
  animation: gradloop 3s linear infinite;
}
.app-frag--tl .frag-card { animation-delay:   0s; }
.app-frag--tr .frag-card { animation-delay: -1.5s; }
.app-frag--bl .frag-card { animation-delay:  -3s; }
.app-frag--br .frag-card { animation-delay: -0.8s; }

@keyframes fragFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  33%       { transform: translateY(-8px) rotate(.5deg); }
  66%       { transform: translateY(5px) rotate(-.3deg); }
}

/* Dark-zone flips fragment cards dark */
.dark-zone .frag-card {
  background: rgba(10, 22, 40, .92);
  border-color: rgba(59, 130, 246, .25);
  box-shadow: 0 12px 48px rgba(0,0,0,.4), 0 0 0 1px rgba(59,130,246,.12);
}

.frag-icon {
  width: 32px; height: 32px; border-radius: 10px;
  background: rgba(59,130,246,.1);
  border: 1px solid rgba(59,130,246,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; margin-bottom: 10px;
}
.frag-label {
  font-family: var(--ffm); font-size: .55rem;
  color: var(--muted); letter-spacing: .1em;
  text-transform: uppercase; margin-bottom: 4px;
}
.dark-zone .frag-label { color: var(--dark-muted); }

.frag-val {
  font-family: var(--ffh); font-weight: 800;
  font-size: 1.35rem; line-height: 1;
  color: var(--text); letter-spacing: -.03em;
}
.dark-zone .frag-val { color: var(--dark-text); }

.frag-sub {
  font-family: var(--ffm); font-size: .57rem;
  color: var(--subtle); margin-top: 3px;
}
.dark-zone .frag-sub { color: var(--dark-subtle); }

.frag-bar-track {
  height: 5px; background: rgba(59,130,246,.12);
  border-radius: 4px; overflow: hidden; margin-top: 10px;
}
.frag-bar-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
  width: 0%;
  transition: width 1.8s .6s cubic-bezier(.22,1,.36,1);
}
.app-frag.is-visible .frag-bar-fill { width: var(--bar-pct, 67%); }

.frag-streak { display: flex; align-items: center; gap: 7px; margin-top: 8px; }
.frag-streak-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green); flex-shrink: 0;
  animation: ldot 2s infinite;
}

/* Responsive: stack fragments below screen */
@media (max-width: 980px) {
  .app-showcase { padding: 40px 0 20px; }
  .app-frag { position: static; opacity: 1 !important; transform: none !important; }
  .app-showcase { display: flex; flex-direction: column; gap: 0; }
  .app-screen-wrap { order: 1; }
  .app-frag--tl,.app-frag--tr { order: 0; }
  .app-frag--bl,.app-frag--br { order: 2; }
  .frag-card { animation: none; }
  /* grid the 4 frags */
  .app-frag--tl,.app-frag--tr,.app-frag--bl,.app-frag--br {
    display: inline-flex;
  }
  /* wrap frags in a grid row */
  .app-frags-top, .app-frags-bot {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
    margin: 0 0 16px;
  }
  .app-frags-bot { margin: 16px 0 0; }
}
@media (max-width: 560px) {
  .app-sidebar { display: none; }
  .app-tabs { display: none; }
}
