/* ==========================================================================
   TapNexa Homepage v8 — Component 1: Interactive Phone Demonstration
   Section: "What should your stand ask for?"
   ========================================================================== */

.tnx-goal {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--tnx-font-body);
  padding: 40px 16px;
  box-sizing: border-box;
}

.tnx-goal *,
.tnx-goal *::before,
.tnx-goal *::after {
  box-sizing: border-box;
}

.tnx-goal__inner {
  max-width: 1120px;
  margin: 0 auto;
}

.tnx-goal__header {
  margin-bottom: 20px;
  max-width: 620px;
}

.tnx-goal__title {
  margin: 0 0 8px;
  font-family: var(--tnx-font-head);
  font-size: clamp(1.5rem, 5.2vw, 2.15rem);
  line-height: 1.2;
  color: var(--ink);
  letter-spacing: -0.015em;
}

.tnx-goal__subtitle {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink-2);
}

/* Quiet one-time entrance on viewport visibility */
.tnx-goal[data-ready="true"] .tnx-goal__layout {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity var(--tnx-dur-enter) var(--tnx-ease-settle),
    transform var(--tnx-dur-enter) var(--tnx-ease-settle);
}

.tnx-goal[data-ready="true"].is-visible .tnx-goal__layout {
  opacity: 1;
  transform: translateY(0);
}

.tnx-goal__layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

/* 2x2 controls on 360px+ mobile */
.tnx-goal__controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.tnx-goal__tab {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  width: 100%;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition:
    background-color var(--tnx-dur-ui) var(--ease),
    border-color var(--tnx-dur-ui) var(--ease),
    color var(--tnx-dur-ui) var(--ease),
    transform 180ms var(--ease);
}

.tnx-goal__tab:hover {
  border-color: var(--line-2);
}

.tnx-goal__tab:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.tnx-goal__tab.is-active {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--paper);
}

.tnx-goal__tab-head {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
}

.tnx-goal__tab-dot {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--line-2);
  transition:
    background-color var(--tnx-dur-ui) var(--ease),
    transform var(--tnx-dur-ui) var(--ease);
}

.tnx-goal__tab.is-active .tnx-goal__tab-dot {
  background: var(--amber);
  transform: scale(1.15);
}

.tnx-goal__tab-title {
  font-family: var(--tnx-font-head);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: break-word;
}

.tnx-goal__tab-desc {
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--ink-2);
}

.tnx-goal__tab.is-active .tnx-goal__tab-desc {
  color: rgba(255, 249, 241, 0.82);
}

/* Stage Container */
.tnx-goal__stage {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px 14px 14px;
}

.tnx-goal__stage-top {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: center;
}

/* Illustrative Phone */
.tnx-goal__phone {
  position: relative;
  width: min(210px, 100%);
  min-height: 290px;
  margin: 0 auto;
  padding: 20px 12px 14px;
  border-radius: 28px;
  background: var(--navy);
  border: 3px solid var(--nav);
  box-shadow: 0 12px 26px rgba(16, 27, 33, 0.14);
  display: flex;
  flex-direction: column;
}

.tnx-goal__phone-notch {
  width: 54px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 249, 241, 0.22);
  margin: 0 auto 12px;
}

/* Stacked phone screens — prevents height jumps across English/Hindi strings */
.tnx-goal__screens {
  display: grid;
  flex: 1;
}

.tnx-goal__screen {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  opacity: 0;
  transform: translateY(8px) scale(0.985);
  pointer-events: none;
  transition:
    opacity var(--tnx-dur-ui) var(--tnx-ease-glide),
    transform var(--tnx-dur-ui) var(--tnx-ease-settle);
}

.tnx-goal__screen.is-active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.tnx-goal__signal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(242, 168, 21, 0.14);
  color: var(--amber-soft);
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
}

.tnx-goal__signal--qr {
  background: rgba(247, 243, 233, 0.12);
  color: var(--cream);
}

.tnx-goal__ui-card {
  background: var(--paper);
  color: var(--ink);
  border-radius: 16px;
  padding: 14px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tnx-goal__ui-kicker {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--amber-ink);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tnx-goal__ui-heading {
  font-family: var(--tnx-font-head);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.25;
}

.tnx-goal__stars {
  display: flex;
  justify-content: center;
  gap: 5px;
  padding: 2px 0;
}

.tnx-star {
  width: 16px;
  height: 16px;
  background: var(--amber);
  clip-path: polygon(50% 0%, 63% 35%, 100% 38%, 72% 61%, 80% 96%, 50% 76%, 20% 96%, 28% 61%, 0% 38%, 37% 35%);
  opacity: 0.85;
}

.tnx-goal__qr-box {
  width: 64px;
  height: 64px;
  margin: 0 auto;
  border-radius: 10px;
  border: 1px dashed var(--line-2);
  background: var(--cream);
  color: var(--ink);
  display: grid;
  place-items: center;
}

.tnx-goal__ui-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tnx-pill {
  display: block;
  padding: 7px 8px;
  border-radius: 9px;
  background: var(--sand);
  border: 1px solid var(--line);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink);
}

.tnx-goal__ui-btn {
  padding: 7px 10px;
  border-radius: 9px;
  background: var(--amber);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
}

/* Subtle ambient cue on active screen only when visible & not paused */
.tnx-goal.is-inview:not(.is-paused) .tnx-goal__screen.is-active .tnx-wave--1 {
  animation: tnxWavePulse 2.8s var(--tnx-ease-glide) infinite;
}

.tnx-goal.is-inview:not(.is-paused) .tnx-goal__screen.is-active .tnx-wave--2 {
  animation: tnxWavePulse 2.8s var(--tnx-ease-glide) 0.25s infinite;
}

.tnx-goal.is-inview:not(.is-paused) .tnx-goal__screen.is-active .tnx-scan-line {
  animation: tnxScanSweep 2.8s var(--tnx-ease-glide) infinite;
}

@keyframes tnxWavePulse {
  0%, 100% { opacity: 0.45; }
  45% { opacity: 1; }
}

@keyframes tnxScanSweep {
  0%, 100% { transform: translateY(-4px); opacity: 0.55; }
  50% { transform: translateY(4px); opacity: 1; }
}

/* Stacked Tab Panels (zero layout shift) */
.tnx-goal__panels {
  display: grid;
}

.tnx-goal__panel {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  visibility: hidden;
  transition:
    opacity var(--tnx-dur-ui) var(--tnx-ease-glide),
    transform var(--tnx-dur-ui) var(--tnx-ease-settle),
    visibility 0s linear var(--tnx-dur-ui);
}

.tnx-goal__panel.is-active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
  transition:
    opacity var(--tnx-dur-ui) var(--tnx-ease-glide),
    transform var(--tnx-dur-ui) var(--tnx-ease-settle),
    visibility 0s linear 0s;
}

.tnx-goal__badge {
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--sand);
  border: 1px solid var(--line);
  color: var(--amber-ink);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
}

.tnx-goal__badge--qr {
  background: var(--cream);
  color: var(--ink);
}

.tnx-goal__panel-title {
  margin: 0;
  font-family: var(--tnx-font-head);
  font-size: 1.2rem;
  line-height: 1.25;
  color: var(--ink);
}

.tnx-goal__points {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ink-2);
}

.tnx-goal__points li {
  position: relative;
  padding-left: 18px;
}

.tnx-goal__points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--amber);
}

/* Associated WooCommerce Product Strip */
.tnx-goal__product {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: var(--cream);
  border: 1px solid var(--line);
}

.tnx-goal__thumb {
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  padding: 4px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.tnx-goal__thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.tnx-goal__product-meta {
  min-width: 0;
  flex: 1;
}

.tnx-goal__product-name {
  font-family: var(--tnx-font-head);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
}

.tnx-goal__product-note {
  margin-top: 2px;
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--ink-2);
}

.tnx-goal__product-price:not(:empty) {
  margin-top: 4px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
}

.tnx-goal__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--amber);
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 180ms var(--ease), transform 180ms var(--ease);
}

.tnx-goal__cta:hover {
  background: var(--amber-soft);
}

.tnx-goal__cta:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}

/* Stage Footer */
.tnx-goal__stage-foot {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tnx-goal__disclaimer {
  font-size: 0.74rem;
  color: var(--ink-2);
}

/* Tablet & Desktop */
@media (min-width: 700px) {
  .tnx-goal {
    padding: 56px 24px;
  }

  .tnx-goal__stage {
    padding: 24px;
  }

  .tnx-goal__stage-top {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 24px;
  }
}

@media (min-width: 960px) {
  .tnx-goal__layout {
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    gap: 22px;
  }

  .tnx-goal__controls {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .tnx-goal__tab {
    padding: 15px 16px;
  }
}

/* Complete static presentation for reduced motion */
@media (prefers-reduced-motion: reduce) {
  .tnx-goal[data-ready="true"] .tnx-goal__layout,
  .tnx-goal__tab,
  .tnx-goal__screen,
  .tnx-goal__panel {
    transition: none !important;
    transform: none !important;
  }

  .tnx-goal[data-ready="true"] .tnx-goal__layout {
    opacity: 1 !important;
  }

  .tnx-wave--1,
  .tnx-wave--2,
  .tnx-scan-line {
    animation: none !important;
  }

  .tnx-goal__stage-foot .tnx-motion-toggle {
    display: none;
  }
}
