/* Text effects keep the original line boxes and selection intact. */
.word-lens {
  position: relative;
  display: inline-block;
  max-width: 100%;
  vertical-align: top;
  isolation: isolate;
}
.lens-source {
  display: block;
}
.lens-disc {
  display: none;
  position: absolute;
  inset: 0 auto auto 0;
  z-index: 2;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  overflow: hidden;
  background: #20384b;
  color: #f7ebd2;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}
.lens-copy {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  transform-origin: 0 0;
}
.letter-glyph {
  pointer-events: none;
  transform-origin: 50% 85%;
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .lens-disc {
    display: block;
    transition: opacity 120ms ease-out;
  }
  .word-lens[data-lens-active] .lens-disc {
    opacity: 1;
    visibility: visible;
  }
  .letter-hit[data-hop-active] .letter-glyph {
    animation: letter-hop 480ms cubic-bezier(0.22, 0.68, 0.35, 1) both;
  }
}
@keyframes letter-hop {
  0%,
  100% {
    transform: translateY(0) rotate(0);
    color: inherit;
  }
  36% {
    transform: translateY(-0.22em) rotate(-4deg);
    color: var(--blue);
  }
  68% {
    transform: translateY(0.025em) rotate(1deg);
    color: var(--blue);
  }
}

.word-scene {
  display: inline-block;
  position: relative;
  max-width: 100%;
  vertical-align: baseline;
  cursor: text;
  isolation: isolate;
}
.word-text {
  position: relative;
  z-index: 1;
}
.word-ink {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  opacity: 0;
  color: var(--blue);
  stroke-width: 1.8;
}
.ink-letter {
  display: inline-block;
}
.hero-word .word-ink {
  stroke-width: 1.5;
}
.ink-gold {
  stroke: #bd924e;
}
.ink-dot {
  fill: currentColor;
  stroke: none;
  transform-box: fill-box;
  transform-origin: center;
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .word-ink {
    transition: opacity 0.25s;
  }
  .word-scene[data-ink-active] > .word-ink {
    opacity: 1;
  }
  .hero-word .ink-letter {
    transition:
      transform 0.65s cubic-bezier(0.2, 1.5, 0.4, 1),
      color 0.4s,
      text-shadow 0.4s;
  }
  .hero-word[data-ink-active] .ink-letter {
    color: var(--blue);
    text-shadow: 0 5px 18px #1971c21a;
    transition-delay: var(--letter-delay);
  }
  [data-scene="unite"][data-ink-active] .ink-letter {
    transform: translate(var(--letter-join), -3px);
  }
  [data-scene="rise"][data-ink-active] .ink-letter {
    transform: translateY(var(--letter-rise)) rotate(-2deg);
  }
  .hero-word .ink-line {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
  }
  .hero-word[data-ink-active] .ink-line {
    animation: thought-draw 1.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  }
  [data-scene="unite"] .ink-dot {
    opacity: 0;
    transform: scale(0.3);
  }
  [data-scene="unite"][data-ink-active] .ink-dot {
    animation: thought-meet 0.7s 0.7s both;
  }
  [data-scene="rise"] .ink-traveler {
    stroke-dasharray: 2 98;
    stroke-dashoffset: 100;
    stroke-width: 4;
    opacity: 0;
  }
  [data-scene="rise"][data-ink-active] .ink-traveler {
    animation: thought-climb 1.5s 0.15s both;
  }
  .hero-word .marked::after {
    transition: opacity 0.3s;
  }
  .hero-word[data-ink-active] .marked::after {
    opacity: 0;
  }
  .text-link {
    position: relative;
    transition: color 0.25s;
  }
  .text-link::after {
    content: "";
    position: absolute;
    left: 0;
    right: 26px;
    bottom: 6px;
    height: 7px;
    border-bottom: 1.5px solid #5b9bd1;
    border-radius: 0 0 45% 35%;
    transform: scaleX(0) rotate(-2deg);
    transform-origin: left;
    transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.3, 1);
    pointer-events: none;
  }
  .text-link:is(:hover, :focus-visible)::after {
    transform: scaleX(1) rotate(-2deg);
  }
  .text-link:is(:hover, :focus-visible) span {
    transform: translate(5px, -2px) rotate(-8deg);
  }
}
@keyframes thought-draw {
  to { stroke-dashoffset: 0; }
}
@keyframes thought-meet {
  0% { opacity: 0; transform: scale(0.3); }
  55% { opacity: 1; transform: scale(1.65); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes thought-climb {
  0% { stroke-dashoffset: 100; opacity: 0; }
  15% { opacity: 0.8; }
  85% { opacity: 0.8; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}
@media (hover: none), (pointer: coarse), (prefers-reduced-motion: reduce) {
  .word-ink { display: none; }
}

/* Feature headings: layout stays still; the words carry each scene. */
.feature-card h3 .word-scene {
  position: relative;
  display: inline-block;
  max-width: 100%;
  vertical-align: top;
  isolation: isolate;
}
.feature-card h3 .word-text {
  position: relative;
  z-index: 1;
  display: block;
}
.feature-card h3 .word-text span {
  display: inline-block;
}
.feature-card h3 .word-ink {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}
.feature-card h3 .word-ink :is(path, circle, ellipse) {
  vector-effect: non-scaling-stroke;
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .feature-card h3 .word-ink {
    transition: opacity 180ms ease-out;
  }
  .feature-card h3 .word-scene[data-ink-active] .word-ink {
    opacity: 1;
  }

  /* A hand-drawn turn carries a learned method into the next attempt. */
  .word-scene[data-scene="knowledge-and-action"] .word-ink {
    color: #287cb9;
  }
  .word-scene[data-scene="knowledge-and-action"] .ink-action-arrow,
  .word-scene[data-scene="knowledge-and-action"] .ink-action-head {
    stroke-width: 2;
    opacity: 0.74;
  }
  .word-scene[data-scene="knowledge-and-action"] .ink-action-stroke {
    opacity: 0.34;
  }
  .word-scene[data-scene="knowledge-and-action"] .ink-action-spark {
    opacity: 0.55;
  }
  .word-scene[data-scene="knowledge-and-action"][data-ink-active] .word-method {
    animation: word-method-lift 1050ms ease-in-out both;
  }
  .word-scene[data-scene="knowledge-and-action"][data-ink-active] .word-practice {
    animation: word-practice-step 1200ms 100ms cubic-bezier(0.2, 0.8, 0.25, 1) both;
  }
  .word-scene[data-scene="knowledge-and-action"][data-ink-active] .ink-action-arrow,
  .word-scene[data-scene="knowledge-and-action"][data-ink-active] .ink-action-stroke {
    stroke-dasharray: 100;
    animation: ink-action-draw 1150ms ease-out both;
  }
  .word-scene[data-scene="knowledge-and-action"][data-ink-active] .ink-action-head {
    stroke-dasharray: 100;
    animation: ink-action-draw 750ms 280ms ease-out both;
  }
  .word-scene[data-scene="knowledge-and-action"][data-ink-active] .ink-action-spark {
    animation: ink-action-spark 1200ms ease-out both;
  }

  /* The tight knot unwinds before the route appears. */
  .word-scene[data-scene="real-problems"] .word-ink {
    color: #43896d;
  }
  .word-scene[data-scene="real-problems"] .ink-knot {
    opacity: 0;
    stroke-width: 1.65;
  }
  .word-scene[data-scene="real-problems"] .ink-open-route,
  .word-scene[data-scene="real-problems"] .ink-route-head {
    opacity: 0.72;
    stroke-width: 1.75;
  }
  .word-scene[data-scene="real-problems"] .ink-route-origin {
    fill: #43896d;
    stroke: none;
  }
  .word-scene[data-scene="real-problems"][data-ink-active] .word-knot {
    animation: word-problem-unwind 1200ms ease-in-out both;
  }
  .word-scene[data-scene="real-problems"][data-ink-active] .word-path {
    animation: word-problem-path 1000ms 200ms ease-out both;
  }
  .word-scene[data-scene="real-problems"][data-ink-active] .ink-knot {
    stroke-dasharray: 100;
    animation: ink-problem-unwind 1200ms ease-in-out both;
  }
  .word-scene[data-scene="real-problems"][data-ink-active] .ink-open-route,
  .word-scene[data-scene="real-problems"][data-ink-active] .ink-route-head {
    stroke-dasharray: 100;
    animation: ink-problem-route 1100ms 250ms ease-out both;
  }
  .word-scene[data-scene="real-problems"][data-ink-active] .ink-route-origin {
    animation: ink-problem-origin 1100ms ease-out both;
  }

  /* Two characters and two dots find the same pace. */
  .word-scene[data-scene="companionship"] .word-ink {
    color: #607cba;
  }
  .word-scene[data-scene="companionship"] .ink-companion-trail,
  .word-scene[data-scene="companionship"] .ink-companion-arc {
    opacity: 0.47;
  }
  .word-scene[data-scene="companionship"] .ink-companion-a {
    fill: #527ab6;
    stroke: none;
  }
  .word-scene[data-scene="companionship"] .ink-companion-b {
    fill: #8e96c5;
    stroke: none;
  }
  .word-scene[data-scene="companionship"][data-ink-active] .word-self {
    animation: word-companion-self 1200ms ease-in-out both;
  }
  .word-scene[data-scene="companionship"][data-ink-active] .word-partner-a {
    animation: word-companion-left 1200ms ease-in-out both;
  }
  .word-scene[data-scene="companionship"][data-ink-active] .word-partner-b {
    animation: word-companion-right 1200ms 90ms ease-in-out both;
  }
  .word-scene[data-scene="companionship"][data-ink-active] .ink-companion-a {
    animation: ink-companion-left 1250ms ease-in-out both;
  }
  .word-scene[data-scene="companionship"][data-ink-active] .ink-companion-b {
    animation: ink-companion-right 1250ms 90ms ease-in-out both;
  }
  .word-scene[data-scene="companionship"][data-ink-active] .ink-companion-trail,
  .word-scene[data-scene="companionship"][data-ink-active] .ink-companion-arc {
    stroke-dasharray: 100;
    animation: ink-companion-link 1300ms ease-out both;
  }

  /* Growth settles; the words for living breathe in daylight. */
  .word-scene[data-scene="living"] .word-ink {
    color: #bb9551;
  }
  .word-scene[data-scene="living"] .ink-breath-halo {
    fill: #e9c985;
    fill-opacity: 0.22;
    stroke: #cda755;
    stroke-opacity: 0.2;
    transform-box: fill-box;
    transform-origin: center;
  }
  .word-scene[data-scene="living"] .ink-sun {
    opacity: 0.8;
    transform-box: fill-box;
    transform-origin: center;
  }
  .word-scene[data-scene="living"] .ink-sun-core {
    fill: #e8c87c;
    fill-opacity: 0.3;
    stroke-width: 1.5;
  }
  .word-scene[data-scene="living"][data-ink-active] .word-grow {
    animation: word-living-settle 1200ms ease-in-out both;
  }
  .word-scene[data-scene="living"][data-ink-active] .word-life {
    transform-origin: center;
    animation: word-living-breathe 2800ms ease-in-out infinite;
  }
  .word-scene[data-scene="living"][data-ink-active] .ink-breath-halo {
    animation: ink-living-breathe 2800ms ease-in-out infinite;
  }
  .word-scene[data-scene="living"][data-ink-active] .ink-sun {
    animation: ink-living-sunrise 1400ms ease-out both;
  }
  .word-scene[data-scene="living"][data-ink-active] .ink-sun-rays {
    stroke-dasharray: 100;
    animation: ink-living-rays 1400ms ease-out both;
  }

  @keyframes word-method-lift {
    0%, 100% { transform: rotate(0) translateY(0); }
    32% { transform: rotate(-3deg) translateY(-0.06em); color: #1971c2; }
    65% { transform: rotate(1deg) translateY(0); color: #1971c2; }
  }
  @keyframes word-practice-step {
    0%, 100% { transform: translate(0, 0); }
    34% { transform: translate(0.12em, -0.035em); color: #1971c2; }
    66% { transform: translate(0.075em, 0); color: #1971c2; }
  }
  @keyframes ink-action-draw {
    from { stroke-dashoffset: 100; }
    76%, to { stroke-dashoffset: 0; }
  }
  @keyframes ink-action-spark {
    0%, 25% { opacity: 0; }
    56% { opacity: 0.8; }
    100% { opacity: 0.3; }
  }
  @keyframes word-problem-unwind {
    0%, 100% { transform: rotate(0); text-shadow: 0 0 transparent; }
    18% { transform: rotate(-4deg); text-shadow: 0.055em 0 #43896d27; }
    36% { transform: rotate(3deg); text-shadow: -0.035em 0 #43896d27; }
    63% { transform: rotate(0); color: #367a5f; text-shadow: 0 0 transparent; }
  }
  @keyframes word-problem-path {
    0%, 100% { transform: translateX(0); }
    45%, 68% { transform: translateX(0.1em); color: #367a5f; }
  }
  @keyframes ink-problem-unwind {
    0% { opacity: 0; stroke-dashoffset: 0; }
    20%, 36% { opacity: 0.7; stroke-dashoffset: 0; }
    74%, 100% { opacity: 0; stroke-dashoffset: -100; }
  }
  @keyframes ink-problem-route {
    0%, 20% { stroke-dashoffset: 100; }
    90%, 100% { stroke-dashoffset: 0; }
  }
  @keyframes ink-problem-origin {
    0%, 30% { opacity: 0; }
    70%, 100% { opacity: 0.7; }
  }
  @keyframes word-companion-self {
    0%, 100% { transform: translateY(0); }
    38%, 62% { transform: translateY(-0.035em); color: #607cba; }
  }
  @keyframes word-companion-left {
    0%, 100% { transform: translate(0, 0); }
    20% { transform: translate(-0.1em, 0); }
    52% { transform: translate(-0.025em, -0.07em); color: #527ab6; }
    76% { transform: translate(0, 0); color: #527ab6; }
  }
  @keyframes word-companion-right {
    0%, 100% { transform: translate(0, 0); }
    20% { transform: translate(0.1em, 0); }
    52% { transform: translate(0.025em, -0.07em); color: #7d85b5; }
    76% { transform: translate(0, 0); color: #7d85b5; }
  }
  @keyframes ink-companion-left {
    0% { opacity: 0; transform: translateX(-32px); }
    30% { opacity: 0.9; }
    68% { transform: translate(0, -3px); }
    100% { opacity: 0.85; transform: translate(0, 0); }
  }
  @keyframes ink-companion-right {
    0% { opacity: 0; transform: translateX(32px); }
    30% { opacity: 0.9; }
    68% { transform: translate(0, -3px); }
    100% { opacity: 0.85; transform: translate(0, 0); }
  }
  @keyframes ink-companion-link {
    from { stroke-dashoffset: 100; }
    80%, to { stroke-dashoffset: 0; }
  }
  @keyframes word-living-settle {
    0%, 100% { transform: translateY(0); }
    45% { transform: translateY(0.035em); color: #8c7c58; }
  }
  @keyframes word-living-breathe {
    0%, 100% { transform: scale(1); color: inherit; }
    50% { transform: scale(1.035); color: #9a793f; }
  }
  @keyframes ink-living-breathe {
    0%, 100% { transform: scale(0.84); opacity: 0.5; }
    50% { transform: scale(1); opacity: 1; }
  }
  @keyframes ink-living-sunrise {
    from { transform: translateY(7px) rotate(-25deg); opacity: 0; }
    to { transform: translateY(0) rotate(0); opacity: 0.8; }
  }
  @keyframes ink-living-rays {
    from { stroke-dashoffset: 100; }
    85%, to { stroke-dashoffset: 0; }
  }
}

@media (hover: none), (pointer: coarse), (prefers-reduced-motion: reduce) {
  .feature-card h3 .word-ink {
    display: none;
  }
}
