/* css/widgets.css — Ambient widgets throughout all sections */

/* ── Generic ambient widget ── */
.section { position: relative; overflow: visible; }
/* Only clip sections that need it */
#proyectos, #ideas, #calculadora, #nosotros, #contacto {
  overflow: visible;
}

/* Generic ambient widget */
.amb {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  color: rgba(192,24,42,0.35);
  pointer-events: none;
  z-index: 2;
  line-height: 1.7;
}
.amb--gold { color: rgba(255,215,0,0.25); }
.amb--tl { top: 1rem; left: 1rem; }
.amb--tr { top: 1rem; right: 1rem; text-align: right; }
.amb--bl { bottom: 1rem; left: 1rem; }
.amb--br { bottom: 1rem; right: 1rem; text-align: right; }

/* Corner brackets */
.corner-bracket {
  position: absolute;
  width: 18px; height: 18px;
  pointer-events: none; z-index: 2;
  opacity: 0.35;
}
.corner-bracket--tl { top: 0.8rem; left: 0.8rem; border-top: 1px solid var(--red); border-left: 1px solid var(--red); }
.corner-bracket--tr { top: 0.8rem; right: 0.8rem; border-top: 1px solid var(--gold); border-right: 1px solid var(--gold); }
.corner-bracket--bl { bottom: 0.8rem; left: 0.8rem; border-bottom: 1px solid var(--gold); border-left: 1px solid var(--gold); }
.corner-bracket--br { bottom: 0.8rem; right: 0.8rem; border-bottom: 1px solid var(--red); border-right: 1px solid var(--red); }

/* Scrolling ticker */
.section-ticker {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 20px; overflow: hidden;
  border-top: 1px solid rgba(192,24,42,0.1);
  background: rgba(0,0,0,0.2);
  pointer-events: none; z-index: 2;
}
.ticker-inner {
  display: flex; align-items: center;
  height: 100%;
  white-space: nowrap;
  animation: ticker-scroll 28s linear infinite;
  font-family: var(--font-mono); font-size: 0.5rem;
  color: rgba(192,24,42,0.4); letter-spacing: 0.12em;
}
.ticker-inner span { margin-right: 3rem; }
.ticker-inner .t-sep { color: rgba(255,215,0,0.3); margin-right: 3rem; }
@keyframes ticker-scroll { from{transform:translateX(0)} to{transform:translateX(-50%)} }

/* ══════════════════════════════════
   ABOUT KC SCAN — bidirectional
══════════════════════════════════ */
.about__scan {
  position: absolute; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--red), var(--gold), transparent);
  opacity: 0.6;
  animation: scan-updown 3s ease-in-out infinite;
}
@keyframes scan-updown {
  0%   { top: 0%;    opacity: 0.7; }
  48%  { top: 100%;  opacity: 0.5; }
  50%  { top: 100%;  opacity: 0.7; }
  98%  { top: 0%;    opacity: 0.5; }
  100% { top: 0%;    opacity: 0.7; }
}

/* ══════════════════════════════════
   MINI SPARKLINE (inline chart)
══════════════════════════════════ */
.sparkline-wrap {
  position: absolute;
  pointer-events: none; z-index: 2;
  opacity: 0.4;
}
.sparkline-wrap svg { display: block; }

/* ══════════════════════════════════
   SECTION SIDE INDICATORS
══════════════════════════════════ */
.side-indicator {
  position: absolute; top: 50%; left: 0.5rem;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 4px;
  pointer-events: none; z-index: 2;
}
.side-indicator__bar {
  width: 3px; border-radius: 2px;
  background: var(--red);
  animation: side-bar-pulse 2s ease-in-out infinite;
}
.side-indicator__bar:nth-child(1) { height: 8px;  animation-delay: 0s; }
.side-indicator__bar:nth-child(2) { height: 14px; animation-delay: 0.2s; background: var(--gold); }
.side-indicator__bar:nth-child(3) { height: 6px;  animation-delay: 0.4s; }
.side-indicator__bar:nth-child(4) { height: 10px; animation-delay: 0.6s; background: var(--gold); }
.side-indicator__bar:nth-child(5) { height: 4px;  animation-delay: 0.8s; }
@keyframes side-bar-pulse {
  0%,100% { opacity: 0.3; transform: scaleY(1); }
  50%      { opacity: 1;   transform: scaleY(1.3); }
}

/* ══════════════════════════════════
   FLOATING DATA CHIPS
   Small pill-shaped data readouts
══════════════════════════════════ */
.data-chip {
  position: absolute;
  font-family: var(--font-mono); font-size: 0.52rem;
  letter-spacing: 0.08em; text-transform: uppercase;
  background: rgba(6,6,10,0.85);
  border: 1px solid rgba(192,24,42,0.25);
  border-radius: 2px;
  padding: 0.2rem 0.5rem;
  color: var(--text-3);
  pointer-events: none; z-index: 2;
  backdrop-filter: blur(4px);
  animation: chip-float 4s ease-in-out infinite;
}
.data-chip .val { color: var(--gold); }
.data-chip--alt { border-color: rgba(255,215,0,0.2); }
.data-chip--alt .val { color: var(--green); }
@keyframes chip-float {
  0%,100% { transform: translateY(0); opacity: 0.7; }
  50%      { transform: translateY(-4px); opacity: 1; }
}

/* ══════════════════════════════════
   GLITCH TEXT EFFECT
══════════════════════════════════ */
.glitch {
  position: relative; display: inline-block;
}
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  clip-path: inset(0);
}
.glitch::before {
  color: var(--red); animation: glitch-1 3s infinite;
  text-shadow: none;
}
.glitch::after {
  color: var(--gold); animation: glitch-2 3s infinite;
  text-shadow: none;
}
@keyframes glitch-1 {
  0%,92%,100% { clip-path: inset(100% 0 0 0); transform: translate(0); }
  93% { clip-path: inset(10% 0 80% 0); transform: translate(-2px, 1px); }
  95% { clip-path: inset(60% 0 20% 0); transform: translate(2px, -1px); }
  97% { clip-path: inset(30% 0 50% 0); transform: translate(-1px, 2px); }
}
@keyframes glitch-2 {
  0%,94%,100% { clip-path: inset(100% 0 0 0); transform: translate(0); }
  95% { clip-path: inset(40% 0 40% 0); transform: translate(2px, -1px); }
  97% { clip-path: inset(70% 0 10% 0); transform: translate(-2px, 1px); }
  99% { clip-path: inset(20% 0 60% 0); transform: translate(1px, -2px); }
}

/* ══════════════════════════════════
   IDEA CARDS — widget accent
══════════════════════════════════ */
.idea-card {
  position: relative; overflow: hidden;
}
.idea-card__num {
  position: absolute; top: 0.6rem; right: 0.7rem;
  font-family: var(--font-mono); font-size: 0.5rem;
  color: rgba(192,24,42,0.3); letter-spacing: 0.08em;
}
.idea-card__bar {
  position: absolute; bottom: 0; left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--red), var(--gold));
  width: 0%; transition: width 0.6s ease;
}
.idea-card:hover .idea-card__bar { width: 100%; }

/* mini live dot on idea cards */
.idea-card__live {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-mono); font-size: 0.5rem;
  color: var(--green); margin-top: 0.5rem;
}
.idea-card__live-dot {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 5px var(--green);
  animation: live-blink 1.4s infinite;
}
@keyframes live-blink { 0%,100%{opacity:1}50%{opacity:0.2} }

/* ══════════════════════════════════
   SERVICE CARDS — number counter anim
══════════════════════════════════ */
.service-card__corner {
  position: absolute; bottom: 0.5rem; right: 0.5rem;
  width: 24px; height: 24px; pointer-events: none;
  border-right: 1px solid rgba(255,215,0,0.15);
  border-bottom: 1px solid rgba(255,215,0,0.15);
}

/* ══════════════════════════════════
   PROJECTS — pcard side glow pulse
══════════════════════════════════ */
.pcard {
  position: relative;
}
.pcard__side-glow {
  position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
  background: linear-gradient(to bottom, var(--red), var(--gold), var(--red));
  background-size: 100% 200%;
  animation: side-glow-move 3s linear infinite;
  opacity: 0.6;
}
@keyframes side-glow-move {
  0%   { background-position: 0% 0%; }
  100% { background-position: 0% 200%; }
}

/* ══════════════════════════════════
   CAROUSEL IMAGE FIX
══════════════════════════════════ */
.carousel__track-wrap {
  overflow: hidden;
  position: relative;
  background: #0a0a0f;
}
.carousel__slide img {
  width: 100%;
  height: 200px;
  object-fit: scale-down;
  object-position: center top;
  background: #0a0a0f;
  display: block;
  padding: 4px;
}

/* ══════════════════════════════════
   CONTACT SECTION WIDGETS
══════════════════════════════════ */
.contact-hud {
  display: flex; gap: var(--sp-3); margin-bottom: var(--sp-6);
  justify-content: center; flex-wrap: wrap;
}
.contact-hud-chip {
  font-family: var(--font-mono); font-size: 0.58rem;
  letter-spacing: 0.1em; text-transform: uppercase;
  background: rgba(192,24,42,0.06);
  border: 1px solid rgba(192,24,42,0.2);
  border-radius: 2px; padding: 0.3rem 0.7rem;
  color: var(--text-3); display: flex; align-items: center; gap: 0.4rem;
}
.contact-hud-chip .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 5px var(--green);
  animation: live-blink 1.4s infinite;
}

/* ══════════════════════════════════
   ANIMATED GRID LINES IN SECTIONS
══════════════════════════════════ */
.section-grid-line {
  position: absolute; pointer-events: none; z-index: 0;
  opacity: 0;
  animation: grid-line-fade 6s ease-in-out infinite;
}
.section-grid-line--h {
  left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(192,24,42,0.12), transparent);
}
.section-grid-line--v {
  top: 0; bottom: 0; width: 1px;
  background: linear-gradient(to bottom, transparent, rgba(255,215,0,0.08), transparent);
}
@keyframes grid-line-fade {
  0%,100% { opacity: 0; }
  40%,60% { opacity: 1; }
}

/* ══════════════════════════════════
   RESPONSIVE
══════════════════════════════════ */
@media (max-width: 768px) {
  .sparkline-wrap, .data-chip, .amb, .corner-bracket,
  .side-indicator, .section-grid-line { display: none; }
  .carousel__slide img { height: 180px; }
}

/* ══════════════════════════════════
   CONSTANT MOTION ON ALL ELEMENTS
══════════════════════════════════ */

/* Section titles breathe */
.section__title {
  animation: title-breathe 4s ease-in-out infinite alternate;
}
@keyframes title-breathe {
  from { letter-spacing: -0.01em; }
  to   { letter-spacing: 0.01em; }
}

/* Eyebrow slides right */
.eyebrow::before {
  display: inline-block;
  animation: eyebrow-slide 2s ease-in-out infinite alternate;
}
@keyframes eyebrow-slide {
  from { transform: translateX(0); opacity: 0.5; }
  to   { transform: translateX(4px); opacity: 1; }
}

/* Project tag shimmer */
.pcard__tag {
  animation: tag-shimmer 3s ease-in-out infinite;
}
@keyframes tag-shimmer {
  0%,100% { text-shadow: 0 0 6px var(--red-glow-sm); }
  50%      { text-shadow: 0 0 14px var(--red-glow), 0 0 28px rgba(192,24,42,0.2); }
}

/* Badge pulse */
.badge--done {
  animation: badge-pulse-green 2.5s ease-in-out infinite;
}
.badge--progress {
  animation: badge-pulse-amber 2s ease-in-out infinite;
}
@keyframes badge-pulse-green {
  0%,100% { box-shadow: 0 0 0 0 rgba(0,201,122,0); }
  50%      { box-shadow: 0 0 0 3px rgba(0,201,122,0.12); }
}
@keyframes badge-pulse-amber {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,165,0,0); }
  50%      { box-shadow: 0 0 0 3px rgba(255,165,0,0.12); }
}

/* Idea card title slide on hover — already has bar */
.idea-card__title {
  transition: transform 0.3s ease, color 0.3s;
}
.idea-card:hover .idea-card__title {
  transform: translateX(4px);
  color: var(--gold);
  text-shadow: 0 0 10px var(--gold-glow-sm);
}

/* Service card num counter bounce */
.service-card__num {
  animation: num-bounce 3s ease-in-out infinite;
}
@keyframes num-bounce {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-2px); }
}

/* Service card title hover */
.service-card__title {
  transition: color 0.2s, transform 0.2s;
}
.service-card:hover .service-card__title {
  color: var(--gold);
  transform: translateX(3px);
}

/* Benefit icons spin on hover */
.benefit__icon {
  display: inline-block;
  transition: transform 0.4s ease;
}
.benefit:hover .benefit__icon {
  transform: rotate(15deg) scale(1.2);
}

/* Benefit cards slide on hover */
.benefit {
  transition: transform 0.25s ease, border-color 0.25s, background 0.25s;
}
.benefit:hover {
  transform: translateX(4px);
}

/* Calc options animate in */
.calc__opt {
  transition: transform 0.2s ease, background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.calc__opt:hover { transform: translateY(-2px) scale(1.03); }
.calc__opt:active { transform: translateY(0) scale(0.98); }

/* Price counter glow when 0 */
.calc__result-price {
  animation: price-idle 3s ease-in-out infinite alternate;
}
@keyframes price-idle {
  from { text-shadow: 0 0 20px var(--gold-glow); }
  to   { text-shadow: 0 0 40px var(--gold-glow), 0 0 80px rgba(255,215,0,0.15); }
}

/* Nav logo flicker */
.nav__logo-k, .nav__logo-c {
  display: inline-block;
  animation: logo-flicker 8s ease-in-out infinite;
}
.nav__logo-c { animation-delay: 0.4s; }
@keyframes logo-flicker {
  0%,89%,91%,93%,100% { opacity: 1; }
  90% { opacity: 0.6; }
  92% { opacity: 1; }
}

/* Hero eyebrow dot pulse already exists, add glow to line */
.hero__eyebrow::before {
  content: '';
  display: inline-block; width: 28px; height: 1px;
  background: var(--red);
  box-shadow: 0 0 6px var(--red-glow);
  animation: line-pulse 2s ease-in-out infinite alternate;
}
@keyframes line-pulse {
  from { width: 20px; opacity: 0.5; }
  to   { width: 36px; opacity: 1; box-shadow: 0 0 12px var(--red-glow); }
}

/* Contact chips float */
.contact-hud-chip {
  animation: chip-hover 3s ease-in-out infinite;
}
.contact-hud-chip:nth-child(2) { animation-delay: 0.5s; }
.contact-hud-chip:nth-child(3) { animation-delay: 1s; }
@keyframes chip-hover {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); box-shadow: 0 4px 12px rgba(0,201,122,0.1); }
}

/* Ticker glow */
.section-ticker { animation: ticker-glow 4s ease-in-out infinite alternate; }
@keyframes ticker-glow {
  from { border-top-color: rgba(192,24,42,0.05); }
  to   { border-top-color: rgba(192,24,42,0.2); box-shadow: 0 -1px 8px rgba(192,24,42,0.08); }
}

/* Corner brackets breathe */
.corner-bracket {
  animation: bracket-pulse 3s ease-in-out infinite alternate;
}
.corner-bracket--tr { animation-delay: 0.5s; }
.corner-bracket--bl { animation-delay: 1s; }
.corner-bracket--br { animation-delay: 1.5s; }
@keyframes bracket-pulse {
  from { opacity: 0.25; }
  to   { opacity: 0.7; }
}

/* Data chips float up/down */
.data-chip {
  animation: chip-float 4s ease-in-out infinite;
}

/* Footer links hover glow */
.footer__link:hover {
  text-shadow: 0 0 10px var(--gold-glow);
}

/* Buttons shimmer effect */
.btn--primary::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.08) 50%, transparent 100%);
  background-size: 200%;
  animation: btn-shimmer 3s linear infinite;
  pointer-events: none;
}
.btn--primary { position: relative; overflow: hidden; }
@keyframes btn-shimmer {
  from { background-position: -200% center; }
  to   { background-position: 200% center; }
}

/* About monogram pulse */
.about__k {
  animation: about-k 4s ease-in-out infinite alternate;
}
.about__c {
  animation: about-c 4s ease-in-out infinite alternate 1s;
}

/* pcard title on hover */
.pcard:hover .pcard__title {
  transition: color 0.2s, transform 0.2s;
  transform: translateX(3px);
}

/* WA btn pulse ring */
.wa-btn::before {
  content: '';
  position: absolute; inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(37,211,102,0.3);
  animation: wa-ring 2s ease-out infinite;
  pointer-events: none;
}
@keyframes wa-ring {
  0%   { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.4); opacity: 0; }
}

/* ══════════════════════════════════
   FINAL CAROUSEL FIX — override everything
══════════════════════════════════ */
.carousel__slide img {
  width: 100% !important;
  height: 160px !important;
  max-height: 160px !important;
  object-fit: cover !important;
  object-position: top center !important;
  background: #0a0a0f !important;
  display: block !important;
  padding: 0 !important;
  transform: none !important;
}
.carousel__slide:hover img {
  transform: scale(1.02) !important;
}
@media (max-width: 640px) {
  .carousel__slide img { height: 120px !important; max-height: 120px !important; }
}
