/* ============ THINK — "Thinking of you" signal ============
   A dark radar disc with a slow sweep and a drawn pulse line, breathing
   sonar rings around it, a cooldown ring that drains like a clock, a wave
   of hearts across the viewport and a floating glass "moment" card. */

.think {
  position: relative;
  padding: 5rem 1.2rem 7rem;
  text-align: center;
  overflow: hidden;
  --tk-size: clamp(150px, 44vw, 184px);
}
.think .section-head { margin-bottom: 2.6rem; }
html.is-soso .tk-for-lulu { display: none; }
html:not(.is-soso) .tk-for-soso { display: none; }

.tk-shell { max-width: 560px; margin: 0 auto; }

/* ---- Stage: rings + cooldown + disc share one cell ---- */
.tk-stage {
  position: relative;
  display: grid;
  grid-template-columns: var(--tk-size);
  grid-template-rows: var(--tk-size);
  place-items: center;
  width: var(--tk-size);
  height: var(--tk-size);
  margin: 1.2rem auto 0;
}
.tk-stage > * { grid-area: 1 / 1; }
.tk-halo {
  width: calc(var(--tk-size) * 1.9);
  height: calc(var(--tk-size) * 1.9);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217, 108, 138, 0.26) 0%, rgba(242, 196, 179, 0.18) 38%, transparent 68%);
  pointer-events: none;
}
.tk-ring {
  width: var(--tk-size);
  height: var(--tk-size);
  border-radius: 50%;
  border: 1.5px solid rgba(217, 108, 138, 0.55);
  opacity: 0;
  pointer-events: none;
}
.tk-shock {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(217, 108, 138, 0.85);
  box-shadow: 0 0 40px rgba(217, 108, 138, 0.45);
  pointer-events: none;
  z-index: 1;
}
.tk-cool {
  width: calc(var(--tk-size) + 26px);
  height: calc(var(--tk-size) + 26px);
  transform: rotate(90deg) scaleX(-1); /* starts at 12 o'clock, drains clockwise */
  fill: none;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}
.tk-cool.is-on { opacity: 1; }
.tk-cool-track { stroke: rgba(217, 108, 138, 0.16); stroke-width: 1.5; }
.tk-cool-bar {
  stroke: var(--rose);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-dasharray: 301.6;
  stroke-dashoffset: 0;
}

/* ---- The disc ---- */
.tk-btn {
  position: relative;
  z-index: 2;
  width: var(--tk-size);
  height: var(--tk-size);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(120% 120% at 32% 22%, #8F3D52 0%, var(--maroon) 46%, var(--maroon-deep) 100%);
  color: var(--cream);
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow:
    0 34px 64px -24px rgba(82, 26, 40, 0.65),
    0 12px 28px -14px rgba(110, 36, 54, 0.45),
    inset 0 1px 1px rgba(255, 255, 255, 0.16),
    inset 0 -12px 26px rgba(40, 10, 18, 0.35);
  transition: transform 0.5s var(--ease-fluid), box-shadow 0.5s var(--ease-fluid);
}
.tk-btn:active { transform: scale(0.93); transition-duration: 0.12s; }
@media (hover: hover) and (pointer: fine) {
  .tk-btn:hover { transform: scale(1.04); box-shadow: 0 40px 72px -24px rgba(82, 26, 40, 0.7), 0 14px 30px -14px rgba(110, 36, 54, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.16), inset 0 -12px 26px rgba(40, 10, 18, 0.35); }
}
.tk-face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
  pointer-events: none;
}
.tk-face > * { position: absolute; }
.tk-sweep {
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    rgba(232, 160, 176, 0) 0deg,
    rgba(232, 160, 176, 0) 226deg,
    rgba(232, 160, 176, 0.07) 290deg,
    rgba(232, 160, 176, 0.32) 352deg,
    rgba(255, 244, 240, 0.6) 360deg
  );
  animation: tk-rot 5.8s linear infinite;
  animation-play-state: paused;
  transition: opacity 0.6s ease;
  will-change: transform;
}
.tk-scope {
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: rgba(255, 255, 255, 0.11);
  stroke-width: 0.8;
}
.tk-scope circle {
  transform-origin: 50% 50%;
  transform: scale(0.6);
  opacity: 0;
}
.tk-vignette {
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 52%, rgba(60, 14, 26, 0.55) 0%, rgba(60, 14, 26, 0.28) 30%, transparent 64%);
}
.tk-gloss {
  top: 5%;
  left: 17%;
  width: 66%;
  height: 34%;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.17), rgba(255, 255, 255, 0));
}
.tk-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  height: 100%;
  padding: 0 1rem;
}
.tk-ico {
  position: relative;
  width: 64px;
  height: 22px;
  display: grid;
  place-items: center;
}
.tk-ico > svg {
  position: absolute;
  inset: 0;
  margin: auto;
  fill: none;
  stroke: var(--rose-soft);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tk-pulse {
  width: 64px;
  height: 20px;
  stroke-dasharray: 92;
  stroke-dashoffset: 92;
  transition: opacity 0.25s ease;
}
.tk-check {
  width: 22px;
  height: 22px;
  stroke: #fff;
  stroke-width: 2.2;
  stroke-dasharray: 22;
  stroke-dashoffset: 22;
  opacity: 0;
}
.tk-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: clamp(0.92rem, 4vw, 1.04rem);
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -0.005em;
  color: var(--cream);
  transition: opacity 0.3s ease;
}
.tk-label .ar { font-weight: 900; }
.tk-l2 { font-size: 1.22em; line-height: 1.35; }
.tk-l3 {
  margin-top: 0.3rem;
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--rose-soft);
  font-variant-numeric: tabular-nums;
}

/* states */
.tk-stage.is-busy .tk-label { opacity: 0.55; }
.tk-stage.is-busy .tk-sweep { animation-duration: 0.9s; }
.tk-stage[data-state="sent"] .tk-sweep,
.tk-stage[data-state="cooling"] .tk-sweep { opacity: 0.22; }
.tk-stage[data-state="sent"] .tk-pulse,
.tk-stage[data-state="cooling"] .tk-pulse { opacity: 0; }
.tk-stage[data-state="sent"] .tk-check,
.tk-stage[data-state="cooling"] .tk-check {
  opacity: 1;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.55s var(--ease-out-strong) 0.25s, opacity 0.2s ease 0.2s;
}
.tk-stage[data-state="cooling"] .tk-check { stroke: var(--rose-soft); }

/* entrance: the disc lands, the hairlines settle, the pulse draws itself */
.tk-anim .tk-stage { transform: scale(0.84); }
.tk-anim.is-in .tk-stage {
  transform: none;
  transition: transform 1.2s var(--ease-out-strong) 0.1s;
}
.think.is-in .tk-scope circle {
  transform: none;
  opacity: 1;
  transition: transform 1.3s var(--ease-out-strong), opacity 0.8s ease;
}
.think.is-in .tk-scope circle:nth-child(1) { transition-delay: 0.35s; }
.think.is-in .tk-scope circle:nth-child(2) { transition-delay: 0.5s; }
.think.is-in .tk-scope circle:nth-child(3) { transition-delay: 0.65s; }
.think.is-in .tk-pulse {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1.4s var(--ease-out-strong) 0.6s, opacity 0.25s ease;
}

/* loops: only while the section is on screen and the tab visible */
.think.is-live .tk-sweep { animation-play-state: running; }
.think.is-live .tk-halo { animation: tk-breathe 5.6s ease-in-out infinite alternate; }
.think.is-live .tk-ring { animation: tk-sonar 4.6s var(--ease-out-strong) calc(var(--n) * 2.3s) infinite; }
.think.is-live .tk-stage[data-state="sent"] .tk-ring,
.think.is-live .tk-stage[data-state="cooling"] .tk-ring { animation-duration: 7s; opacity: 0; }
@keyframes tk-rot { to { transform: rotate(360deg); } }
@keyframes tk-breathe {
  from { transform: scale(0.94); opacity: 0.7; }
  to { transform: scale(1.08); opacity: 1; }
}
@keyframes tk-sonar {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(2.05); opacity: 0; }
}

/* ---- Under the disc ---- */
.tk-status {
  max-width: 400px;
  margin: 1.9rem auto 0;
  min-height: 1.6em;
  font-size: 0.94rem;
  font-weight: 500;
  line-height: 1.55;
  color: var(--ink-soft);
  text-wrap: balance;
  transition: color 0.3s ease;
}
.tk-status strong { font-weight: 700; color: var(--rose); font-variant-numeric: tabular-nums; }
.tk-status.is-good { color: var(--ink); }
.tk-status.is-warn { color: #B04A63; }
.tk-stats {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.tk-stats strong { font-weight: 700; color: var(--rose); }
.tk-stats .ar { font-weight: 700; color: var(--ink); letter-spacing: 0; }

.tk-note-wrap { max-width: 380px; margin: 1.7rem auto 0; }
.tk-note {
  width: 100%;
  height: 3.1rem;
  padding: 0 1.2rem;
  border-radius: 999px;
  border: 1px solid rgba(217, 108, 138, 0.28);
  background: #fff;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  text-align: center;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: var(--shadow-ambient);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.tk-note::placeholder { color: rgba(122, 97, 105, 0.6); }
.tk-note:focus { border-color: var(--rose); box-shadow: 0 0 0 4px rgba(217, 108, 138, 0.12), var(--shadow-ambient); }

/* loading shimmer */
.tk-skel {
  display: inline-block;
  height: 0.9em;
  border-radius: 999px;
  vertical-align: middle;
  background: linear-gradient(90deg, rgba(217, 108, 138, 0.1) 25%, rgba(217, 108, 138, 0.22) 50%, rgba(217, 108, 138, 0.1) 75%);
  background-size: 200% 100%;
  animation: tk-shimmer 1.4s linear infinite;
}
@keyframes tk-shimmer { to { background-position: -200% 0; } }

/* ---- "Last from سوسو" card ---- */
.tk-last {
  position: relative;
  max-width: 440px;
  margin: 2.4rem auto 0;
  padding: 1.05rem 1.15rem 1.1rem;
  border-radius: 1.4rem;
  background: linear-gradient(180deg, #FFFFFF, #FFF8F5);
  border: 1px solid rgba(217, 108, 138, 0.16);
  box-shadow: var(--shadow-ambient), inset 0 1px 1px rgba(255, 255, 255, 0.95);
  text-align: left;
}
.tk-last-head { display: flex; align-items: center; gap: 0.85rem; }
.tk-last-ico {
  position: relative;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--maroon), var(--maroon-deep));
  color: var(--rose-soft);
  box-shadow: 0 10px 22px -10px rgba(82, 26, 40, 0.75), inset 0 1px 1px rgba(255, 255, 255, 0.14);
}
.tk-last-ico svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tk-last-ico::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 1.5px solid rgba(217, 108, 138, 0.65);
  opacity: 0;
}
.think.is-live .tk-last.is-fresh .tk-last-ico::after { animation: tk-sonar 2.8s var(--ease-out-strong) infinite; }
.tk-last.is-empty .tk-last-ico { background: rgba(217, 108, 138, 0.1); color: var(--rose); box-shadow: none; }
.tk-last-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tk-last-top { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.tk-last-kicker {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--rose);
  white-space: nowrap;
}
.tk-last-kicker .ar { font-size: 1.08em; letter-spacing: 0; }
.tk-last-time {
  margin-top: 0.15rem;
  font-size: 0.96rem;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.tk-last.is-empty .tk-last-time { color: var(--ink-soft); }
.tk-last-count {
  flex-shrink: 0;
  padding: 0.22rem 0.62rem;
  border-radius: 999px;
  background: rgba(217, 108, 138, 0.08);
  border: 1px solid rgba(217, 108, 138, 0.16);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  white-space: nowrap;
}
.tk-last-count strong { font-weight: 700; color: var(--rose); }
.tk-last-count[hidden], .tk-last-note[hidden] { display: none; }
.tk-last-note {
  margin: 0.9rem 0 0;
  padding-top: 0.9rem;
  border-top: 1px dashed rgba(217, 108, 138, 0.24);
  font-size: 1.04rem;
  font-weight: 500;
  line-height: 1.7;
  color: var(--ink);
  text-wrap: pretty;
}
.tk-last-note.ar {
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.9;
  text-align: right;
}
.tk-last-note.tk-last-empty {
  font-size: 0.92rem;
  font-weight: 400;
  color: var(--ink-soft);
  line-height: 1.65;
}

/* ---- The wave of hearts (whole viewport, pointer-through) ---- */
.tk-wave {
  position: fixed;
  inset: 0;
  z-index: 95;
  pointer-events: none;
  overflow: hidden;
}
.tk-wave-heart {
  position: absolute;
  will-change: transform, opacity;
}
.tk-wave-heart svg { display: block; width: 100%; height: 100%; fill: currentColor; stroke: none; }
.tk-tide {
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: -18%;
  height: 58%;
  background: radial-gradient(60% 72% at 50% 100%, rgba(232, 160, 176, 0.55), rgba(246, 220, 227, 0.26) 50%, transparent 76%);
  opacity: 0;
  will-change: transform, opacity;
}

/* ---- The moment: floating glass card near the top ---- */
.tk-moment {
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top, 0px) + 5.6rem);
  z-index: 96;
  width: min(92vw, 420px);
  transform: translate3d(-50%, -160%, 0);
  opacity: 0;
  transition: transform 0.8s var(--ease-out-strong), opacity 0.35s ease;
  pointer-events: none;
}
/* on a special day the anniversary ribbon sits under the nav — drop below it */
html.has-special .tk-moment { top: calc(env(safe-area-inset-top, 0px) + 8.4rem); }
.tk-moment.is-on {
  transform: translate3d(-50%, 0, 0);
  opacity: 1;
  pointer-events: auto;
}
.tk-moment.is-gone {
  transform: translate3d(-50%, -28%, 0) scale(0.96);
  opacity: 0;
  transition-duration: 0.35s;
}
.tk-moment-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  width: 100%;
  padding: 1rem 2.7rem 1.05rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.75);
  outline: 1px solid rgba(217, 108, 138, 0.2);
  border-radius: 1.5rem;
  background: rgba(255, 252, 250, 0.8);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  backdrop-filter: blur(22px) saturate(1.4);
  box-shadow: 0 32px 70px -24px rgba(110, 36, 54, 0.45), 0 10px 30px -18px rgba(61, 44, 51, 0.28);
  color: var(--ink);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.tk-moment-card:active { transform: scale(0.985); transition: transform 0.12s ease; }
.tk-moment-ico {
  position: relative;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--maroon), var(--maroon-deep));
  color: var(--rose-soft);
  box-shadow: 0 12px 24px -10px rgba(82, 26, 40, 0.75), inset 0 1px 1px rgba(255, 255, 255, 0.14);
}
.tk-moment-ico svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tk-moment-ping {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(217, 108, 138, 0.75);
  opacity: 0;
}
.tk-moment.is-on .tk-moment-ping { animation: tk-sonar 2.2s var(--ease-out-strong) 0.4s 3; }
.tk-moment-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tk-moment-title {
  font-size: 1.04rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
}
.tk-moment-title .ar { font-weight: 900; }
.tk-moment-meta {
  margin-top: 0.2rem;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.tk-moment-n { color: var(--rose); font-weight: 500; }
.tk-moment-note {
  display: block;
  margin-top: 0.6rem;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.6;
  color: var(--ink);
  text-wrap: pretty;
}
.tk-moment-note.ar {
  font-size: 1.14rem;
  font-weight: 700;
  line-height: 1.8;
  text-align: right;
}
.tk-moment-x {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: rgba(217, 108, 138, 0.1);
  color: var(--ink-soft);
}
.tk-moment-x svg { width: 0.8rem; height: 0.8rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.tk-moment-timer {
  position: absolute;
  left: 1.1rem;
  right: 1.1rem;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--rose), var(--rose-soft));
  transform-origin: 0 50%;
  transform: scaleX(1);
}
.tk-moment.is-on .tk-moment-timer {
  transform: scaleX(0);
  transition: transform var(--tk-hold, 7s) linear 0.5s;
}
/* masked words in the moment title */
.tk-w {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding: 0.08em 0.03em 0.14em;
  margin: -0.08em -0.03em -0.14em;
}
.tk-wi {
  display: inline-block;
  transform: translate3d(0, 110%, 0);
  transition: transform 0.75s var(--ease-out-strong) calc(0.25s + var(--i, 0) * 60ms);
}
.tk-moment.is-on .tk-wi { transform: none; }

/* ---- Desktop ---- */
@media (min-width: 768px) {
  .think { padding: 8rem 1.2rem 10rem; }
  .think .section-head { margin-bottom: 3.2rem; }
  .tk-status { font-size: 0.98rem; }
  .tk-last { max-width: 460px; margin-top: 2.8rem; }
  .tk-moment { top: calc(env(safe-area-inset-top, 0px) + 6.2rem); }
}

/* ---- Reduced motion: no loops, instant states, everything still works ---- */
@media (prefers-reduced-motion: reduce) {
  .tk-halo, .tk-ring, .tk-sweep, .tk-moment-ping, .tk-last-ico::after, .tk-skel { animation: none !important; }
  .tk-sweep { opacity: 0.35; }
  .tk-stage { transform: none !important; }
  .tk-scope circle { transform: none; opacity: 1; transition: none; }
  .tk-pulse { stroke-dashoffset: 0; transition: none; }
  .tk-check { transition: none; }
  .tk-wi { transform: none; transition: none; }
  .tk-moment, .tk-moment-timer { transition: none; }
}
