/* Your Family Archive — Plant the Cedar (archives) + Seal Whisper (people) */

@property --yfa-progress {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}

/* ── Shared tokens ── */
.yfa {
  --yfa-navy: #0f2a44;
  --yfa-amber: #D97706;
  --yfa-amber-deep: #B45309;
  --yfa-cedar: #8b4513;
  --yfa-clay: #453227;
  --yfa-parchment: #fffaf3;
  --yfa-parchment-2: #f8f1e6;
  --yfa-ink-soft: rgba(15, 42, 68, 0.72);
  --yfa-ink-mute: rgba(15, 42, 68, 0.55);
  --yfa-progress: 0;
}

/* ═══════════════════════════════════════════
   ARCHIVES — Lineage Thread (home base)
   ═══════════════════════════════════════════ */
.yfa-thread {
  --thread: var(--c-primary, #D97706);
  --thread-soft: rgba(217, 119, 6, 0.16);
  --thread-ink: var(--c-text, #453227);
  --thread-mist: #fff8f1;
  --thread-cedar: #8B4513;
  position: relative;
  overflow: hidden;
  border: none;
  border-radius: 28px;
  padding: 28px 30px 26px;
  background:
    radial-gradient(ellipse 90% 120% at 100% 0%, rgba(217, 119, 6, 0.1), transparent 52%),
    radial-gradient(ellipse 70% 90% at 0% 100%, rgba(139, 69, 19, 0.06), transparent 48%),
    linear-gradient(160deg, #fffdf9 0%, #ffffff 48%, var(--thread-mist) 100%);
  box-shadow: 0 18px 40px rgba(69, 50, 39, 0.07);
  animation: yfa-rise 0.85s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.yfa-thread-veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.yfa-thread-beam {
  position: absolute;
  bottom: -20%;
  width: 42%;
  height: 120%;
  border-radius: 50%;
  filter: blur(28px);
  opacity: 0.35;
  transform-origin: 50% 100%;
  animation: yfa-thread-beam 8s ease-in-out infinite;
}

.yfa-thread-beam--1 {
  inset-inline-start: -8%;
  background: rgba(217, 119, 6, 0.28);
  animation-delay: 0s;
}

.yfa-thread-beam--2 {
  inset-inline-start: 30%;
  width: 36%;
  background: rgba(180, 83, 9, 0.18);
  animation-delay: 1.4s;
  animation-duration: 9.5s;
}

.yfa-thread-beam--3 {
  inset-inline-end: -6%;
  inset-inline-start: auto;
  width: 40%;
  background: rgba(139, 69, 19, 0.14);
  animation-delay: 2.2s;
  animation-duration: 8.8s;
}

.yfa-thread-mote {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 244, 230, 0.95);
  box-shadow: 0 0 10px rgba(217, 119, 6, 0.32);
  animation: yfa-thread-mote 9s ease-in-out infinite;
}

.yfa-thread-mote--1 { inset-inline-start: 18%; bottom: 18%; animation-delay: 0.2s; }
.yfa-thread-mote--2 { inset-inline-start: 42%; bottom: 28%; width: 4px; height: 4px; animation-delay: 1.8s; animation-duration: 10.5s; }
.yfa-thread-mote--3 { inset-inline-start: 68%; bottom: 22%; width: 5px; height: 5px; animation-delay: 3.2s; }
.yfa-thread-mote--4 { inset-inline-start: 86%; bottom: 34%; width: 3px; height: 3px; animation-delay: 4.4s; animation-duration: 11s; }

.yfa-thread-canvas {
  position: absolute;
  inset: auto 0 0 0;
  width: 100%;
  height: 120px;
  pointer-events: none;
  opacity: 1;
}

.yfa-thread-wave {
  opacity: 0;
  animation: yfa-thread-wave-in 1.1s ease forwards;
}

.yfa-thread-wave--back { animation-delay: 0.15s; }
.yfa-thread-wave--mid { animation-delay: 0.3s; }
.yfa-thread-wave--front { animation-delay: 0.45s; }

.yfa-thread-inner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  min-height: 120px;
}

.yfa-thread-copy {
  min-width: 0;
  max-width: 40rem;
  padding-bottom: 4px;
}

.yfa-thread-kicker {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--yfa-amber-deep, #B45309);
  animation: yfa-fade-up 0.75s ease both 0.1s;
}

.yfa-thread-title {
  margin: 0 0 8px;
  font-family: var(--serif, var(--font-serif, 'Merriweather', serif));
  font-weight: 700;
  font-size: clamp(1.35rem, 2.6vw, 1.75rem);
  line-height: 1.2;
  color: var(--thread-ink);
  animation: yfa-fade-up 0.8s ease both 0.18s;
}

.yfa-thread-lead {
  margin: 0 0 12px;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--c-text-muted, #7C6658);
  max-width: 34rem;
  animation: yfa-fade-up 0.8s ease both 0.28s;
}

.yfa-thread-meta {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--c-text-muted, #7C6658);
  animation: yfa-fade-up 0.8s ease both 0.36s;
}

.yfa-thread-status {
  color: var(--yfa-amber-deep, #B45309);
}

.yfa-thread-nudge {
  margin: 10px 0 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--yfa-amber-deep, #B45309);
  animation: yfa-fade-up 0.8s ease both 0.42s, yfa-thread-nudge 5s ease-in-out 1s infinite;
}

.yfa-thread-nudge-mark {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: linear-gradient(135deg, #D97706, #8B4513);
  flex-shrink: 0;
  animation: yfa-thread-nudge-mark 2.8s ease-in-out infinite;
}

.yfa-thread-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  flex-shrink: 0;
  animation: yfa-fade-up 0.8s ease both 0.3s;
}

.yfa-thread-cta {
  position: relative;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #D97706, #B45309);
  color: #fffaf3;
  font-family: var(--serif, var(--font-serif, 'Merriweather', serif));
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(180, 83, 9, 0.22);
  transition: transform 0.4s ease, background 0.4s ease, box-shadow 0.4s ease, filter 0.4s ease;
  animation: yfa-thread-cta-glow 4.5s ease-in-out 1.2s infinite;
}

.yfa-thread-cta::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.18) 50%, transparent 65%);
  transform: translateX(-130%);
  animation: yfa-thread-cta-shine 5.5s ease-in-out 2s infinite;
  pointer-events: none;
}

.yfa-thread-cta:hover {
  transform: translateY(-2px);
  filter: brightness(1.04);
  box-shadow: 0 16px 32px rgba(180, 83, 9, 0.28);
}

.yfa-thread-cta:active {
  transform: translateY(0);
}

.yfa-thread-cta:focus-visible {
  outline: 2px solid var(--c-primary, #D97706);
  outline-offset: 3px;
}

.yfa-thread-cta > .bi {
  font-size: 1rem;
  transition: transform 0.4s ease;
}

.yfa-thread-cta:hover > .bi {
  transform: translateX(3px);
}

[dir="rtl"] .yfa-thread-cta:hover > .bi {
  transform: translateX(-3px);
}

[dir="rtl"] .yfa-thread-cta .bi-arrow-right::before {
  content: "\f12f";
}

.yfa-thread-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--thread-cedar, #8B4513);
  text-decoration: none;
  transition: color 0.3s ease;
}

.yfa-thread-link:hover {
  color: var(--c-primary, #D97706);
  text-decoration: underline;
}

/* Keep micro progress for people whisper chip */
.yfa-progress {
  --size: 22px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background:
    conic-gradient(var(--yfa-amber) calc(var(--yfa-progress) * 1%), rgba(139, 69, 19, 0.15) 0);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  animation: yfa-progress-fill 0.9s cubic-bezier(0.22, 1, 0.36, 1) both 0.35s;
}

.yfa-progress::after {
  content: "";
  width: calc(var(--size) - 6px);
  height: calc(var(--size) - 6px);
  border-radius: 50%;
  background: var(--yfa-parchment);
}

.yfa-progress--micro {
  --size: 28px;
  position: absolute;
  inset: 0;
  opacity: 0.4;
  border-radius: 50%;
  animation: yfa-mark-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.yfa-progress--micro::after {
  width: calc(var(--size) - 5px);
  height: calc(var(--size) - 5px);
  background: #6b4226;
}

.yfa-seal {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 6px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
  animation: yfa-stamp 0.45s cubic-bezier(0.34, 1.3, 0.64, 1) both 0.4s;
}

.yfa-seal::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}

.yfa-seal--chip {
  padding: 2px 7px 2px 5px;
  font-size: 0.62rem;
  letter-spacing: 0.03em;
  flex-shrink: 0;
  animation: yfa-stamp 0.4s cubic-bezier(0.34, 1.3, 0.64, 1) both;
}

.yfa-seal--chip::before {
  width: 5px;
  height: 5px;
}

.yfa-seal--draft {
  color: #5c5346;
  background: rgba(92, 83, 70, 0.08);
  border-color: rgba(92, 83, 70, 0.2);
}

.yfa-seal--pending {
  color: #9a3412;
  background: rgba(217, 119, 6, 0.12);
  border-color: rgba(217, 119, 6, 0.28);
}

.yfa-seal--active {
  color: #3f6212;
  background: rgba(101, 132, 58, 0.12);
  border-color: rgba(101, 132, 58, 0.28);
}

.yfa-seal--rejected {
  color: #9f1239;
  background: rgba(159, 18, 57, 0.08);
  border-color: rgba(159, 18, 57, 0.22);
}

.yfa-seal--archived {
  color: #57534e;
  background: rgba(87, 83, 78, 0.08);
  border-color: rgba(87, 83, 78, 0.2);
}

.yfa-my-link {
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--yfa-cedar);
  text-decoration: none;
  padding: 0 4px;
}

.yfa-my-link:hover {
  text-decoration: underline;
  color: var(--yfa-amber);
}

/* ═══════════════════════════════════════════
   PEOPLE — Seal Whisper (toolbar chip)
   ═══════════════════════════════════════════ */
.yfa-whisper {
  position: relative;
  display: inline-flex;
  align-items: center;
  z-index: 20;
  animation: yfa-rise 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.yfa-whisper-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(15, 42, 68, 0.12);
}

.yfa-whisper-chip {
  position: relative;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  max-width: min(280px, 72vw);
  padding: 0 12px 0 6px;
  border: 1px solid rgba(139, 69, 19, 0.18);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 250, 243, 0.96), rgba(255, 255, 255, 0.9));
  color: inherit;
  cursor: pointer;
  text-align: start;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 1px 3px rgba(15, 42, 68, 0.04);
}

.yfa-whisper-chip:hover {
  border-color: rgba(217, 119, 6, 0.38);
  background: linear-gradient(180deg, #fffaf3, #fff);
  box-shadow: 0 2px 8px rgba(15, 42, 68, 0.06);
}

.yfa-whisper-chip:focus-visible {
  outline: 2px solid var(--yfa-amber);
  outline-offset: 2px;
}

.yfa-whisper-chip[aria-expanded="true"] {
  border-color: rgba(217, 119, 6, 0.42);
  box-shadow: 0 0 0 1px rgba(217, 119, 6, 0.12);
}

.yfa-whisper-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(155deg, #5c3a21, #8b4513 60%, #a05a1f);
  color: #fff8ec;
  flex-shrink: 0;
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
  animation: yfa-mark-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.yfa-whisper-mark-icon {
  width: 15px;
  height: 15px;
  position: relative;
  z-index: 1;
}

.yfa-whisper-line {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--yfa-navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  line-height: 1.2;
}

.yfa-whisper-popover {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-start: 0;
  z-index: 50;
  width: min(320px, calc(100vw - 24px));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top left;
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.22s;
}

[dir="rtl"] .yfa-whisper-popover {
  transform-origin: top right;
}

.yfa-whisper-popover.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.yfa-whisper-popover-inner {
  padding: 14px 14px 16px;
  border: 1px solid rgba(139, 69, 19, 0.18);
  border-radius: 12px;
  background:
    radial-gradient(ellipse 80% 60% at 0% 0%, rgba(246, 215, 167, 0.35), transparent 55%),
    linear-gradient(180deg, #fffaf3 0%, #fff 100%);
  box-shadow: 0 12px 28px rgba(15, 42, 68, 0.12);
}

.yfa-whisper-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.yfa-whisper-kicker {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--yfa-amber-deep);
}

.yfa-whisper-close {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--yfa-ink-mute);
  cursor: pointer;
  flex-shrink: 0;
}

.yfa-whisper-close:hover {
  background: rgba(139, 69, 19, 0.08);
  color: var(--yfa-clay);
}

.yfa-whisper-close:focus-visible {
  outline: 2px solid var(--yfa-amber);
  outline-offset: 1px;
}

.yfa-whisper-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-bottom: 8px;
}

.yfa-whisper-tree-title {
  font-weight: 700;
  color: var(--yfa-clay);
  font-size: 0.92rem;
}

.yfa-whisper-meta {
  color: #7C6658;
  font-size: 0.8rem;
}

.yfa-whisper-insight {
  margin: 0 0 12px;
  font-size: 0.84rem;
  color: var(--yfa-ink-soft);
  line-height: 1.4;
}

.yfa-whisper-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.yfa-whisper-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid rgba(217, 119, 6, 0.35);
  border-radius: 10px;
  background: rgba(217, 119, 6, 0.08);
  color: var(--yfa-clay);
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.yfa-whisper-cta:hover {
  background: rgba(217, 119, 6, 0.14);
  border-color: rgba(217, 119, 6, 0.55);
}

.yfa-whisper-cta:focus-visible {
  outline: 2px solid var(--yfa-amber);
  outline-offset: 2px;
}

[dir="rtl"] .yfa-whisper-cta .bi-arrow-right::before {
  content: "\f12f";
}

.yfa-whisper-hero-cue {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px dashed rgba(217, 119, 6, 0.35);
  background: rgba(255, 250, 243, 0.75);
  font-size: 0.84rem;
  font-weight: 600;
  color: #8B6B4F;
}

.yfa-whisper-hero-cue i {
  color: var(--yfa-amber);
  font-size: 1rem;
}

.yfa-whisper-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--yfa-cedar);
  text-decoration: none;
}

.yfa-whisper-link:hover {
  color: var(--yfa-amber);
  text-decoration: underline;
}

/* ── Motion ── */
@keyframes yfa-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes yfa-fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes yfa-mark-in {
  from { opacity: 0; transform: scale(0.88); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes yfa-cedar-grow {
  from { opacity: 0; transform: scaleY(0.72); }
  to { opacity: 1; transform: scaleY(1); }
}

@keyframes yfa-draw {
  to { stroke-dashoffset: 0; }
}

@keyframes yfa-seed-pop {
  from { opacity: 0; transform: scale(0.55); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes yfa-stamp {
  from { opacity: 0; transform: scale(1.12) rotate(-5deg); }
  to { opacity: 1; transform: scale(1) rotate(0deg); }
}

@keyframes yfa-progress-fill {
  from { --yfa-progress: 0; }
}

@keyframes yfa-thread-wave-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes yfa-thread-beam {
  0%, 100% { opacity: 0.22; transform: scaleY(0.92) translateY(0); }
  50% { opacity: 0.48; transform: scaleY(1.08) translateY(-4%); }
}

@keyframes yfa-thread-mote {
  0% { opacity: 0; transform: translateY(8px) scale(0.7); }
  20% { opacity: 0.9; }
  70% { opacity: 0.65; }
  100% { opacity: 0; transform: translateY(-46px) scale(1.1); }
}

@keyframes yfa-thread-nudge {
  0%, 100% { opacity: 0.78; }
  50% { opacity: 1; }
}

@keyframes yfa-thread-nudge-mark {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.35); }
  50% { transform: scale(1.15); box-shadow: 0 0 0 6px rgba(217, 119, 6, 0); }
}

@keyframes yfa-thread-cta-glow {
  0%, 100% { box-shadow: 0 12px 28px rgba(180, 83, 9, 0.2); }
  50% { box-shadow: 0 14px 32px rgba(217, 119, 6, 0.28); }
}

@keyframes yfa-thread-cta-shine {
  0%, 60%, 100% { transform: translateX(-130%); }
  75% { transform: translateX(130%); }
}

@media (prefers-reduced-motion: reduce) {
  .yfa-thread,
  .yfa-whisper,
  .yfa-thread-wave,
  .yfa-thread-beam,
  .yfa-thread-mote,
  .yfa-thread-nudge,
  .yfa-thread-nudge-mark,
  .yfa-thread-cta,
  .yfa-thread-cta::after,
  .yfa-thread-kicker,
  .yfa-thread-title,
  .yfa-thread-lead,
  .yfa-thread-meta,
  .yfa-thread-actions,
  .yfa-seal,
  .yfa-progress,
  .yfa-whisper-mark {
    animation: none !important;
  }

  .yfa-thread-wave {
    opacity: 1;
  }

  .yfa-thread-wave animate {
    display: none;
  }

  .yfa-thread-mote {
    opacity: 0 !important;
  }

  .yfa-thread-cta:hover,
  .yfa-thread-cta:hover > .bi {
    transform: none;
  }

  .yfa-whisper-popover,
  .yfa-whisper-chip {
    transition: none;
  }
}

/* ── Responsive ── */
@media (max-width: 820px) {
  .yfa-thread {
    padding: 24px 22px 22px;
  }

  .yfa-thread-inner {
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
  }

  .yfa-thread-actions {
    align-items: stretch;
  }

  .yfa-thread-cta {
    justify-content: center;
  }

  .yfa-thread-link {
    text-align: center;
  }

  .yfa-thread-canvas {
    height: 96px;
    opacity: 0.85;
  }

  .yfa-thread-beam {
    filter: blur(22px);
  }
}

@media (max-width: 768px) {
  .yfa-whisper-chip {
    max-width: min(240px, 68vw);
    height: 36px;
  }

  .yfa-whisper-backdrop {
    background: rgba(15, 42, 68, 0.28);
  }

  .yfa-whisper-popover {
    position: fixed;
    top: auto;
    bottom: 0;
    inset-inline: 0;
    width: 100%;
    max-width: none;
    transform: translateY(12px);
    transform-origin: bottom center;
    z-index: 60;
  }

  .yfa-whisper-popover.is-open {
    transform: translateY(0);
  }

  .yfa-whisper-popover-inner {
    border-radius: 16px 16px 0 0;
    border-bottom: none;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -8px 28px rgba(15, 42, 68, 0.14);
  }

  .yfa-whisper-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .yfa-whisper-cta,
  .yfa-whisper-hero-cue {
    width: 100%;
    justify-content: center;
  }
}
