/* ============================================================
   "Why agents add it" card on the residential 3D tour page:
   a buyer walks a floor plan while the four reasons light up.
   ============================================================ */

.tour-story {
  --ts-gold: #f3c66d;
  --ts-gold-deep: #c48d26;
  --ts-cream: #f5f1e8;
  --ts-ink: #10210d;
  display: grid;
  gap: clamp(18px, 2.2vw, 26px);
}

.tour-story__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px 32px;
  align-items: end;
}

.tour-story__title {
  max-width: 25ch;
  margin: 14px 0 0;
  color: var(--white-on-dark);
  font-family: var(--font-heading);
  font-size: clamp(1.45rem, 2.4vw, 2rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.tour-story__fit {
  display: grid;
  justify-items: end;
  gap: 10px;
  max-width: 470px;
}

.tour-story__fit-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tour-story__fit-list li {
  padding: 7px 13px;
  border: 1px solid rgba(243, 198, 109, 0.26);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.06);
  color: rgba(245, 241, 232, 0.9);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.2;
}

.tour-story__body {
  display: grid;
  grid-template-columns: minmax(0, 1.24fr) minmax(280px, 0.76fr);
  gap: clamp(18px, 2.4vw, 30px);
  align-items: center;
}

/* ---------- Stage ---------- */

.tour-story__stage {
  position: relative;
  aspect-ratio: 640 / 440;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 253, 248, 0.1);
  border-radius: 22px;
  background:
    linear-gradient(rgba(255, 253, 248, 0.032) 1px, transparent 1px) 0 0 / 26px 26px,
    linear-gradient(90deg, rgba(255, 253, 248, 0.032) 1px, transparent 1px) 0 0 / 26px 26px,
    radial-gradient(120% 90% at 30% 18%, rgba(255, 253, 248, 0.07), transparent 62%),
    rgba(3, 10, 4, 0.34);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 -40px 80px rgba(0, 0, 0, 0.18);
}

.tour-story__plan {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.ts-room {
  fill: rgba(243, 198, 109, 0);
  transition: fill 700ms ease;
}

.ts-room.is-visited {
  fill: rgba(243, 198, 109, 0.09);
}

.ts-furniture > * {
  fill: rgba(245, 241, 232, 0.035);
  stroke: rgba(245, 241, 232, 0.26);
  stroke-width: 1.2;
  stroke-linejoin: round;
}

.ts-furniture > .ts-rug {
  fill: none;
  stroke-dasharray: 3 4;
  stroke: rgba(245, 241, 232, 0.16);
}

.ts-stairs > * {
  fill: none;
  stroke: rgba(245, 241, 232, 0.4);
  stroke-width: 1.2;
}

.ts-stairs > .ts-stairs__arrow {
  stroke: rgba(245, 241, 232, 0.55);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ts-openings path {
  fill: none;
  stroke: rgba(245, 241, 232, 0.55);
  stroke-width: 1.2;
}

.ts-openings .ts-door {
  stroke: rgba(245, 241, 232, 0.38);
  stroke-dasharray: 3 3;
}

.ts-wall {
  fill: none;
  stroke: rgba(245, 241, 232, 0.86);
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.ts-wall--outer {
  stroke-width: 7;
}

.ts-wall--inner {
  stroke-width: 4.5;
}

.ts-labels text {
  fill: rgba(245, 241, 232, 0.5);
  font-family: var(--font-body);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-anchor: middle;
}

.ts-labels .ts-labels__small {
  font-size: 8px;
  letter-spacing: 0.12em;
}

.ts-motion {
  fill: none;
  stroke: none;
}

.ts-trail {
  fill: none;
  stroke: var(--ts-gold);
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1 2;
  stroke-dashoffset: 0;
}

.ts-trail--glow {
  stroke: rgba(243, 198, 109, 0.2);
  stroke-width: 11;
}

.ts-walker__cone {
  fill: rgba(243, 198, 109, 0.22);
}

.ts-walker__halo {
  fill: rgba(243, 198, 109, 0.32);
}

.ts-walker__core {
  fill: var(--ts-gold);
  stroke: #fffaf0;
  stroke-width: 2.6;
}

.ts-walker--partner .ts-walker__halo {
  fill: rgba(245, 241, 232, 0.24);
}

.ts-walker--partner .ts-walker__core {
  fill: #fffaf0;
  stroke: var(--ts-gold-deep);
}

/* Walls draw in the first time the card scrolls into view. */
.tour-story.is-armed .ts-wall {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.tour-story.is-armed :is(.ts-furniture, .ts-stairs, .ts-openings, .ts-labels) {
  opacity: 0;
}

.tour-story.is-live .ts-wall {
  animation: tsDrawWall 1.5s cubic-bezier(0.3, 0.7, 0.2, 1) forwards;
}

.tour-story.is-live .ts-wall--inner {
  animation-delay: 0.35s;
}

.tour-story.is-live :is(.ts-furniture, .ts-stairs, .ts-openings, .ts-labels) {
  opacity: 1;
  transition: opacity 900ms ease 0.9s;
}

@keyframes tsDrawWall {
  to {
    stroke-dashoffset: 0;
  }
}

/* ---------- Overlays on the stage ---------- */

.ts-tag,
.ts-dim,
.ts-chip,
.ts-toast {
  position: absolute;
  z-index: 2;
  pointer-events: none;
}

.ts-tag {
  left: 50%;
  top: 100%;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--ts-gold);
  color: var(--ts-ink);
  font-family: var(--font-heading);
  font-size: 0.66rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
  opacity: 0;
  transform: translate(-50%, calc(-100% - 15px));
  transition: opacity 260ms ease;
}

.ts-tag--partner {
  background: #fffaf0;
}

.ts-tag.is-on {
  opacity: 1;
}

.ts-dim {
  padding: 3px 8px;
  border: 1px solid rgba(243, 198, 109, 0.5);
  border-radius: 6px;
  background: rgba(16, 33, 13, 0.92);
  color: var(--ts-gold);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.86);
  transition: opacity 280ms ease, transform 380ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ts-dim.is-on {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.ts-chip {
  left: 3.4%;
  top: 6.4%;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px 7px 9px;
  border: 1px solid rgba(255, 253, 248, 0.22);
  border-radius: 999px;
  background: #fffaf0;
  color: var(--ts-ink);
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 320ms ease, transform 420ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ts-chip svg {
  width: 16px;
  height: 16px;
  fill: var(--ts-gold-deep);
}

.ts-chip.is-on {
  opacity: 1;
  transform: translateY(0);
}

.ts-toast {
  right: 3.4%;
  bottom: 5.4%;
  display: flex;
  align-items: center;
  gap: 11px;
  max-width: min(78%, 300px);
  padding: 10px 14px 10px 10px;
  border: 1px solid rgba(255, 253, 248, 0.6);
  border-radius: 16px;
  background: #fffaf0;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.36);
  opacity: 0;
  transform: translateY(14px) scale(0.96);
  transition: opacity 340ms ease, transform 460ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ts-toast.is-on {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.ts-toast__icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(145deg, #3b5923, #183412);
}

.ts-toast__icon svg {
  width: 20px;
  height: 20px;
  fill: var(--ts-gold);
}

.ts-toast__copy {
  display: grid;
  gap: 2px;
  text-align: left;
}

.ts-toast__copy strong {
  color: var(--ts-ink);
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.15;
}

.ts-toast__copy small {
  color: rgba(16, 33, 13, 0.72);
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.3;
}

.ts-pause {
  position: absolute;
  left: 2.6%;
  bottom: 4.2%;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(255, 253, 248, 0.2);
  border-radius: 50%;
  background: rgba(7, 14, 9, 0.6);
  color: rgba(245, 241, 232, 0.86);
  cursor: pointer;
  transition: background 200ms ease, border-color 200ms ease;
}

.ts-pause:hover,
.ts-pause:focus-visible {
  border-color: rgba(243, 198, 109, 0.6);
  background: rgba(7, 14, 9, 0.85);
}

.ts-pause:focus-visible {
  outline: 2px solid var(--ts-gold);
  outline-offset: 2px;
}

.ts-pause__icon {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.ts-pause__icon--play,
.tour-story.is-paused .ts-pause__icon--pause {
  display: none;
}

.tour-story.is-paused .ts-pause__icon--play {
  display: block;
}

/* ---------- Steps ---------- */

.tour-story__steps {
  position: relative;
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tour-story__steps::before,
.tour-story__steps::after {
  content: "";
  position: absolute;
  top: 34px;
  bottom: 34px;
  left: 31px;
  width: 2px;
  border-radius: 2px;
  pointer-events: none;
}

.tour-story__steps::before {
  background: rgba(243, 198, 109, 0.16);
}

.tour-story__steps::after {
  background: var(--ts-gold);
  transform: scaleY(var(--ts-progress, 0));
  transform-origin: top;
}

.tour-story__step-btn {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  column-gap: 14px;
  row-gap: 3px;
  align-items: start;
  width: 100%;
  margin: 0;
  padding: 13px 16px 16px 13px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 320ms ease, border-color 320ms ease;
}

.tour-story__step-btn:hover {
  background: rgba(255, 253, 248, 0.04);
}

.tour-story__step-btn:focus-visible {
  outline: 2px solid var(--ts-gold);
  outline-offset: 2px;
}

.tour-story__step-node {
  display: grid;
  grid-row: 1 / span 2;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1.5px solid rgba(243, 198, 109, 0.42);
  border-radius: 50%;
  background: #183412;
  color: var(--ts-gold);
  font-family: var(--font-heading);
  font-size: 0.86rem;
  font-weight: 800;
  transition: background 320ms ease, color 320ms ease, border-color 320ms ease, box-shadow 320ms ease;
}

.tour-story__step-title {
  color: rgba(245, 241, 232, 0.74);
  font-family: var(--font-heading);
  font-size: 1.02rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.01em;
  transition: color 320ms ease;
}

.tour-story__step-text {
  color: rgba(245, 241, 232, 0.62);
  font-size: 0.92rem;
  line-height: 1.5;
  transition: color 320ms ease;
}

.tour-story__step-bar {
  position: absolute;
  right: 16px;
  bottom: 8px;
  left: 63px;
  height: 2px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(255, 253, 248, 0.1);
  opacity: 0;
  transition: opacity 240ms ease;
}

.tour-story__step-bar > span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--ts-gold);
  transform: scaleX(var(--ts-step-progress, 0));
  transform-origin: left;
}

.tour-story__step.is-done .tour-story__step-node {
  border-color: rgba(243, 198, 109, 0.7);
  background: #2d4a1b;
}

.tour-story__step.is-active .tour-story__step-btn {
  border-color: rgba(243, 198, 109, 0.3);
  background: rgba(255, 253, 248, 0.07);
}

.tour-story__step.is-active .tour-story__step-node {
  border-color: var(--ts-gold);
  background: var(--ts-gold);
  color: var(--ts-ink);
  box-shadow: 0 0 0 6px rgba(243, 198, 109, 0.14);
}

.tour-story__step.is-active .tour-story__step-title {
  color: #fffaf0;
}

.tour-story__step.is-active .tour-story__step-text {
  color: rgba(245, 241, 232, 0.88);
}

.tour-story__step.is-active .tour-story__step-bar {
  opacity: 1;
}

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
  .tour-story__head,
  .tour-story__body {
    grid-template-columns: 1fr;
  }

  .tour-story__fit {
    justify-items: start;
    max-width: none;
  }

  .tour-story__fit-list {
    justify-content: flex-start;
  }
}

@media (max-width: 600px) {
  .tour-story__title {
    font-size: 1.4rem;
  }

  .tour-story__stage {
    border-radius: 16px;
  }

  .ts-labels text {
    font-size: 15px;
    letter-spacing: 0.1em;
  }

  .ts-labels .ts-labels__small {
    display: none;
  }

  .ts-tag {
    font-size: 0.6rem;
    padding: 3px 7px;
  }

  .ts-dim {
    font-size: 0.6rem;
    padding: 2px 5px;
  }

  .ts-chip {
    padding: 5px 9px 5px 7px;
    font-size: 0.62rem;
  }

  .ts-chip svg {
    width: 13px;
    height: 13px;
  }

  .ts-toast {
    gap: 8px;
    max-width: 72%;
    padding: 7px 10px 7px 7px;
    border-radius: 12px;
  }

  .ts-toast__icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
  }

  .ts-toast__icon svg {
    width: 16px;
    height: 16px;
  }

  .ts-toast__copy strong {
    font-size: 0.7rem;
  }

  .ts-toast__copy small {
    font-size: 0.62rem;
  }

  .ts-pause {
    width: 28px;
    height: 28px;
  }

  .tour-story__step-btn {
    padding: 11px 12px 14px 10px;
    column-gap: 12px;
  }

  .tour-story__steps::before,
  .tour-story__steps::after {
    left: 27px;
  }

  .tour-story__step-bar {
    left: 56px;
    right: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tour-story *,
  .tour-story *::before,
  .tour-story *::after {
    animation: none !important;
    transition: none !important;
  }

  .ts-pause {
    display: none;
  }
}
