/* ============================================================
   QS Tech — Iter 1 Effects
   Paint-themed micro-interactions: brush underline, paint drip,
   swatch orbit, stat counter, sticky color rail.
   ============================================================ */

/* ============ BRUSH UNDERLINE under .accent ============ */
/* background-image thay vi ::after tuyet doi: bam dung tung dong khi chu wrap nhieu dong */
.accent {
  display: inline;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 12' preserveAspectRatio='none'><path d='M 2 6 Q 50 1, 100 5 T 198 7' fill='none' stroke='%23ea8c2b' stroke-width='4' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: 0 1.18em;
  background-size: 0% 0.18em;
  transition: background-size 1.2s var(--ease) 0.3s;
}
.reveal.is-visible .accent,
section.is-visible .accent {
  background-size: 100% 0.18em;
}
/* Always show on landing first-paint */
.hero h1 .accent,
.page-hero h1 .accent {
  animation: brushDraw 1.4s var(--ease) 0.8s forwards;
  background-size: 0% 0.18em;
}
@keyframes brushDraw {
  to { background-size: 100% 0.18em; }
}

@media (prefers-reduced-motion: reduce) {
  .accent, .hero h1 .accent, .page-hero h1 .accent {
    background-size: 100% 0.18em; animation: none;
  }
}

/* ============ HERO PAINT DRIPS (decorative SVG) ============ */
.hero {
  isolation: isolate;
}
.hero-drip {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 80px;
  pointer-events: none;
  z-index: 1;
  overflow: visible;
}
.hero-drip path {
  fill: var(--c-accent);
  opacity: 0.85;
}
.hero-drip .drip-2 { fill: var(--c-brand); opacity: 0.7; }
.hero-drip .drip-3 { fill: oklch(72% 0.10 145); opacity: 0.6; }

/* ============ SWATCH ORBIT (floating chips on hero image) ============ */
.swatch-orbit {
  position: absolute;
  z-index: 3;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  box-shadow: 0 8px 24px oklch(20% 0 0 / 0.25);
  display: grid;
  place-items: center;
  font-family: var(--f-mono, monospace);
  font-size: 0.65rem;
  font-weight: 700;
  color: oklch(15% 0 0 / 0.6);
  letter-spacing: 0.05em;
  white-space: nowrap;
  border: 3px solid oklch(98% 0 0);
  animation: orbitFloat 6s ease-in-out infinite;
}
.swatch-orbit.dark { color: oklch(98% 0 0 / 0.75); border-color: oklch(15% 0 0); }
.swatch-orbit-1 {
  top: 12%;
  right: 8%;
  background: oklch(78% 0.06 35);
  animation-delay: 0s;
}
.swatch-orbit-2 {
  top: 38%;
  right: 4%;
  background: oklch(45% 0.08 240);
  color: oklch(98% 0 0 / 0.85);
  border-color: oklch(15% 0 0 / 0.15);
  animation-delay: -2s;
  width: 52px; height: 52px;
  font-size: 0.58rem;
  letter-spacing: 0.01em;
}
.swatch-orbit-3 {
  bottom: 32%;
  right: 12%;
  background: oklch(60% 0.14 70);
  animation-delay: -4s;
  width: 56px; height: 56px;
}
@keyframes orbitFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-14px) rotate(8deg); }
}

/* ============ STAT COUNTER ============ */
.hero-trust .n,
.nano-stats .stat .num {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}
.is-counting {
  /* placeholder while JS sets the number; CSS just keeps tabular alignment */
}

/* ============ SECTION DIVIDER (paint drip) ============ */
.section-drip {
  position: relative;
  width: 100%;
  height: 32px;
  margin-top: -1px;
  margin-bottom: -1px;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
.section-drip svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ============ BUTTON SPLATTER hover ============ */
.btn-primary,
.btn-dark {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.btn-primary::before,
.btn-dark::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: oklch(95% 0.15 60);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.5s var(--ease), opacity 0.5s var(--ease);
  z-index: -1;
}
.btn-primary:hover::before {
  transform: translate(-50%, -50%) scale(1);
  opacity: 0.3;
}
.btn-dark::before {
  background: var(--c-accent);
}
.btn-dark:hover::before {
  transform: translate(-50%, -50%) scale(1);
  opacity: 0.4;
}

/* ============ ROOM SVG IMPROVEMENTS ============ */
/* Add lamp glow + window light + softer floor */
.room-svg .lamp-glow {
  fill: oklch(85% 0.12 70);
  opacity: 0.4;
  filter: blur(6px);
  animation: lampPulse 4s ease-in-out infinite;
}
@keyframes lampPulse {
  0%, 100% { opacity: 0.35; }
  50%      { opacity: 0.55; }
}
.room-svg .window-light {
  fill: oklch(98% 0.04 240);
  opacity: 0.6;
}

/* ============ ROOM TAB SWITCHER ============ */
.room-tabs {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 1rem;
  padding: 4px;
  background: var(--c-paper);
  border-radius: 100px;
  border: 1px solid var(--c-line);
}
.room-tabs button {
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--c-ink-soft);
  border-radius: 100px;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: background var(--d-normal) var(--ease), color var(--d-normal) var(--ease);
}
.room-tabs button:hover { color: var(--c-ink); }
.room-tabs button.is-active {
  background: var(--c-brand-deep);
  color: var(--c-bg);
}

/* Hide non-active room layers */
.room-layer { display: none; }
.room-layer.is-active { display: block; }

/* ============ HERO H1 — make accent word slightly larger and italic */
.hero h1 .accent {
  font-style: italic;
  letter-spacing: -0.03em;
}
.page-hero h1 .accent {
  font-style: italic;
}

/* ============ REDUCED MOTION — kill all infinite loops ============ */
@media (prefers-reduced-motion: reduce) {
  .swatch-orbit,
  .promo-track,
  .float-btn::after,
  .room-svg .lamp-glow,
  .hero h1 .accent::after,
  .page-hero h1 .accent::after {
    animation: none !important;
  }
}
