/* ==========================================================================
   Kind words: Interactive 3D Tarot-Flip Testimonial Altar & Feedback Dialog.
   The cards feature full 3D perspective flips, authentic tarot back patterning,
   and instant on-page reflection drawer/modal submission.
   ========================================================================== */

.kind-words { padding-block: 50px 140px; }
.kind-head { max-width: 760px; margin-bottom: 50px; }
.kind-head .eyebrow { margin-bottom: 20px; }
.kind-subtitle { margin-top: 14px; color: var(--muted); font-size: 16px; font-style: italic; }

/* ---------- Tarot Altar Grid ---------- */
.tarot-altar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 32px;
  align-items: stretch;
  perspective: 1200px;
}

/* Base Card structure */
.t-flip-card {
  position: relative;
  min-height: 480px;
  background: none;
  border: 0;
  border-radius: 18px;
  cursor: pointer;
  perspective: 1000px;
  outline: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

.t-flip-card:hover {
  transform: translateY(-8px);
}

.t-flip-card:focus-visible {
  outline: 2px solid var(--rose);
  outline-offset: 6px;
}

.t-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.75s cubic-bezier(0.34, 1.35, 0.64, 1);
  border-radius: 18px;
  box-shadow: 0 16px 40px -15px rgb(33 20 24 / 22%);
}

.t-flip-card.is-flipped .t-flip-inner {
  transform: rotateY(180deg);
}

/* Card Faces */
.t-card-back,
.t-card-front {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
}

/* ---------- Card Back (Tarot Deck Styling) ---------- */
.t-card-back {
  background: var(--wine);
  border: 2px solid var(--wine-dark);
  color: var(--ivory);
  padding: 24px;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: inset 0 0 0 6px var(--wine), inset 0 0 0 7.5px rgb(246 242 235 / 45%), inset 0 0 0 12px var(--wine);
  overflow: hidden;
}

.t-card-pattern {
  position: absolute;
  inset: 12px;
  border-radius: 10px;
  background: radial-gradient(circle at 50% 50%, rgb(199 164 167 / 28%) 0 1px, transparent 1.6px) 0 0 / 12px 12px;
  pointer-events: none;
  opacity: 0.85;
}

.t-card-glow {
  position: absolute;
  top: -40%;
  left: -40%;
  width: 180%;
  height: 180%;
  background: radial-gradient(circle, rgb(246 242 235 / 15%) 0%, transparent 60%);
  pointer-events: none;
}

.t-card-back-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.t-seal-emblem {
  display: block;
  width: 54px;
  height: 58px;
  background: var(--rose);
  -webkit-mask: url('assets/heart-priestess-emblem.png') center / contain no-repeat;
  mask: url('assets/heart-priestess-emblem.png') center / contain no-repeat;
  filter: drop-shadow(0 2px 6px rgb(0 0 0 / 30%));
}

.t-card-prompt {
  font-family: var(--serif);
  font-size: 17px;
  font-style: italic;
  letter-spacing: 0.04em;
  color: var(--ivory);
  opacity: 0.9;
  border-bottom: 1px dashed rgb(246 242 235 / 40%);
  padding-bottom: 4px;
}

/* ---------- Card Front (Reflection Unveiled) ---------- */
.t-card-front {
  background: #fdfbf7;
  color: var(--ink);
  transform: rotateY(180deg);
  border: 1px solid var(--line);
  box-shadow: inset 0 0 0 5px #fdfbf7, inset 0 0 0 6.5px var(--sand);
  padding: 26px 24px;
  justify-content: space-between;
}

.t-front-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.t-num {
  font-family: var(--serif);
  font-size: 20px;
  color: var(--ruby);
  font-weight: 500;
}

.t-arcana {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.t-front-body {
  margin-block: auto;
  padding-block: 16px;
}

.t-quote {
  font-family: var(--serif);
  font-size: clamp(21px, 2vw, 24px);
  line-height: 1.18;
  color: var(--wine);
  margin-bottom: 12px;
}

.t-text {
  font-size: 14px;
  line-height: 1.62;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 7;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.t-front-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.t-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--wine);
  color: var(--ivory);
  font-family: var(--serif);
  font-size: 18px;
  font-style: italic;
  flex-shrink: 0;
}

.t-author strong {
  display: block;
  font-size: 13.5px;
  color: var(--wine);
  font-weight: 500;
}

.t-author span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

/* ---------- Card 5: Portal / Draw Card ---------- */
.t-portal-card {
  min-height: 480px;
  background: var(--oxblood);
  border-radius: 18px;
  border: 1px dashed var(--rose);
  box-shadow: 0 16px 40px -15px rgb(33 20 24 / 30%);
}

.t-portal-inner {
  height: 100%;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--ivory);
  box-shadow: inset 0 0 0 6px var(--oxblood), inset 0 0 0 7px rgb(199 164 167 / 35%);
  border-radius: 18px;
}

.t-portal-emblem {
  display: block;
  width: 44px;
  height: 48px;
  background: var(--rose);
  -webkit-mask: url('assets/heart-priestess-emblem.png') center / contain no-repeat;
  mask: url('assets/heart-priestess-emblem.png') center / contain no-repeat;
  margin-bottom: 12px;
}

.t-portal-num {
  font-size: 18px;
  color: var(--rose);
  margin-bottom: 8px;
}

.t-portal-title {
  font-family: var(--serif);
  font-size: clamp(24px, 2.4vw, 28px);
  line-height: 1.15;
  color: var(--ivory);
  margin-bottom: 12px;
}

.t-portal-sub {
  font-size: 14px;
  color: #d9c6c5;
  margin-bottom: 26px;
  max-width: 220px;
}

.t-portal-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  background: var(--wine);
  color: var(--ivory);
  border: 1px solid var(--rose);
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 0.04em;
  transition: background 0.3s, transform 0.3s;
}

.t-portal-card:hover .t-portal-btn {
  background: var(--ruby);
  transform: scale(1.04);
}

/* ---------- Share block & Original Folder ---------- */
.kind-share { display: grid; grid-template-columns: auto 1fr; align-items: end; gap: clamp(40px, 7vw, 110px); margin-top: 90px; padding-top: 30px; border-top: 1px solid var(--line); }
.kind-share-copy { max-width: 470px; padding-bottom: 8px; }
.kind-share-title { margin-bottom: 18px; color: var(--wine); font-family: var(--serif); font-size: clamp(30px, 3vw, 44px); line-height: 1.06; letter-spacing: -.02em; }
.kind-share-copy > p:not(.kind-share-title) { margin: 0 0 30px; color: var(--muted); font-size: 16px; }

/* Folder */
.folder { --spring: cubic-bezier(.34, 1.45, .64, 1); position: relative; display: block; width: 320px; height: 208px; margin-top: 90px; padding: 0; background: none; border: 0; border-radius: 24px; perspective: 900px; -webkit-tap-highlight-color: transparent; }
.folder:focus-visible { outline: 2px solid var(--wine); outline-offset: 10px; }
.folder-back { position: absolute; inset: 0 6.25%; display: block; background: var(--sand); border: 1px solid var(--line); border-radius: 14px; }
.folder-page { position: absolute; top: 8px; left: 50%; display: flex; flex-direction: column; gap: 8px; width: 128px; margin-left: -64px; padding: 16px; background: linear-gradient(#fffdf9, #f4eee4); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 22px -12px rgb(33 20 24 / 35%); transition: translate .7s var(--spring), rotate .7s var(--spring); }
.folder-page i { display: block; height: 5px; background: #ece4d8; border-radius: 9px; }
.folder-page i:nth-child(3n) { width: 70%; }
.folder-page b { color: var(--wine); font-family: var(--serif); font-size: 13px; font-style: italic; font-weight: 400; line-height: 1; white-space: nowrap; }
.folder-page--l { z-index: 1; translate: -38px 2px; rotate: -3deg; transition-delay: .03s; }
.folder-page--c { z-index: 2; translate: 0 0; rotate: 0deg; }
.folder-page--r { z-index: 1; translate: 42px 1px; rotate: 3.5deg; transition-delay: .06s; }
.folder-front { position: absolute; z-index: 3; left: 0; right: 0; bottom: -1px; display: block; height: 176px; transform-origin: 50% 100%; transition: transform .6s var(--spring); }
.folder-front svg { display: block; width: 100%; height: 100%; overflow: visible; }
.folder-front path { fill: var(--wine); stroke: var(--wine-dark); stroke-width: 1.5; transition: fill .4s; }
.folder-label { position: absolute; inset: 34% 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--ivory); font-family: var(--serif); font-size: 22px; pointer-events: none; }
.folder-heart { display: block; width: 26px; height: 28px; background: var(--rose); -webkit-mask: url('assets/heart-priestess-emblem.png') center / contain no-repeat; mask: url('assets/heart-priestess-emblem.png') center / contain no-repeat; }

@media (hover: hover) {
  .folder:not([aria-expanded="true"]):hover .folder-page { translate: var(--peek-x, 0) -12px; }
  .folder:not([aria-expanded="true"]):hover .folder-page--l { --peek-x: -40px; }
  .folder:not([aria-expanded="true"]):hover .folder-page--r { --peek-x: 44px; }
  .folder:hover .folder-front path { fill: var(--wine-dark); }
}

.folder[aria-expanded="true"] .folder-page--l { translate: -70px -75px; rotate: -8deg; }
.folder[aria-expanded="true"] .folder-page--c { translate: 2px -95px; rotate: 1deg; }
.folder[aria-expanded="true"] .folder-page--r { translate: 75px -80px; rotate: 9deg; }
.folder[aria-expanded="true"] .folder-front { transform: rotateX(-35deg); }
.folder.is-received .folder-page--c b::after { content: ' ♡'; color: var(--ruby); }

/* ---------- Reflection Dialog ---------- */
.feedback-dialog { width: min(640px, calc(100% - 24px)); max-height: min(92vh, 900px); margin: auto; padding: 0; overflow: auto; color: var(--ivory); background: var(--oxblood); border: 0; border-radius: 26px; box-shadow: 0 40px 90px -30px rgb(0 0 0 / 60%); overscroll-behavior: contain; }
.feedback-dialog::backdrop { background: rgb(33 20 24 / 55%); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.feedback-dialog[open] { animation: fb-in .6s var(--ease-out) both; }
.feedback-dialog[open]::backdrop { animation: fb-fade .4s ease both; }
@keyframes fb-in { from { opacity: 0; translate: 0 28px; scale: .97; } }
@keyframes fb-fade { from { opacity: 0; } }
body.feedback-open { overflow: hidden; }

.feedback-form { padding: clamp(26px, 5vw, 48px); }
.feedback-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.feedback-top .eyebrow { color: var(--rose); }
.feedback-close { display: grid; place-items: center; width: 44px; height: 44px; margin-right: -10px; color: var(--ivory); background: none; border: 1px solid rgb(246 242 235 / 20%); border-radius: 50%; font-size: 24px; line-height: 1; transition: background .3s, border-color .3s; }
.feedback-close:hover { background: rgb(246 242 235 / 8%); border-color: rgb(246 242 235 / 45%); }
.feedback-form h2 { color: var(--ivory); font-size: clamp(40px, 6vw, 60px); }

.feedback-progress { display: flex; gap: 10px; margin: 26px 0 34px; padding: 0; list-style: none; }
.feedback-progress li { flex: 1; padding-top: 10px; color: rgb(246 242 235 / 45%); border-top: 2px solid rgb(246 242 235 / 18%); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; transition: color .4s, border-color .4s; }
.feedback-progress li.is-done, .feedback-progress li.is-current { color: var(--ivory); border-top-color: var(--rose); }

.feedback-step { min-width: 0; margin: 0; padding: 0; border: 0; }
.feedback-step:not([hidden]) { animation: fb-step .5s var(--ease-out) both; }
@keyframes fb-step { from { opacity: 0; translate: 16px 0; } }
.feedback-q { display: block; margin-bottom: 16px; padding: 0; color: var(--ivory); font-family: var(--serif); font-size: 24px; line-height: 1.2; }

.feel-chips, .consent-pick { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 30px; }
.consent-pick { flex-direction: column; align-items: stretch; }
.feel-chips label, .consent-pick label { position: relative; cursor: pointer; }
.feel-chips input, .consent-pick input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.feel-chips span, .consent-pick span { display: inline-flex; align-items: center; min-height: 44px; padding: 10px 18px; color: #d9c6c5; border: 1px solid rgb(246 242 235 / 25%); border-radius: 999px; font-size: 14px; transition: color .3s, background .3s, border-color .3s; }
.consent-pick span { display: flex; width: 100%; padding-inline: 22px; }
.consent-pick span::before { content: ''; flex: 0 0 14px; width: 14px; height: 14px; margin-right: 14px; border: 1px solid currentColor; border-radius: 50%; transition: box-shadow .3s, background .3s; }
.feel-chips label:hover span, .consent-pick label:hover span { color: var(--ivory); border-color: rgb(246 242 235 / 55%); }
.feel-chips input:checked + span { color: var(--wine); background: var(--ivory); border-color: var(--ivory); }
.consent-pick input:checked + span { color: var(--ivory); border-color: var(--rose); background: rgb(199 164 167 / 12%); }
.consent-pick input:checked + span::before { background: var(--rose); box-shadow: inset 0 0 0 3px var(--oxblood); }
.feel-chips input:focus-visible + span, .consent-pick input:focus-visible + span { outline: 2px solid var(--ivory); outline-offset: 3px; }
.consent-pick[aria-invalid="true"] span { border-color: #e8a0a8; }

.feedback-nav { display: flex; justify-content: flex-end; align-items: center; gap: 22px; margin-top: 8px; }
.feedback-back { margin-right: auto; min-height: 44px; padding: 0; color: #d9c6c5; background: none; border: 0; font-size: 13px; letter-spacing: .03em; text-decoration: underline; text-underline-offset: 5px; }
.feedback-back:hover { color: var(--ivory); }
.feedback-dialog .button-light:hover { border-color: var(--ivory); }
.feedback-dialog [hidden] { display: none !important; }

.feedback-thanks { padding: 30px 0 10px; text-align: center; }
.feedback-thanks .folder-heart { width: 44px; height: 48px; margin: 0 auto 22px; }
.feedback-thanks p { color: #d9c6c5; }
.feedback-thanks p:first-of-type { color: var(--ivory); font-family: var(--serif); font-size: 30px; line-height: 1.15; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .kind-words { padding-block: 30px 100px; }
  .kind-head { margin-bottom: 36px; }
  .tarot-altar-grid { grid-template-columns: 1fr; gap: 22px; }
  .t-flip-card { min-height: 440px; }
  .kind-share { grid-template-columns: 1fr; justify-items: center; gap: 36px; margin-top: 60px; text-align: center; }
  .kind-share-copy { margin-inline: auto; }
}

@media (max-width: 480px) {
  .t-flip-card { min-height: 460px; }
  .t-card-front { padding: 20px 18px; }
  .folder { width: 280px; height: 182px; margin-top: 70px; }
  .folder-front { height: 154px; }
  .folder-page { width: 112px; margin-left: -56px; padding: 13px; }
  .folder[aria-expanded="true"] .folder-page--l { translate: -58px -70px; }
  .folder[aria-expanded="true"] .folder-page--r { translate: 62px -74px; }
  .feedback-nav { flex-wrap: wrap; }
  .feedback-nav .button { flex: 1; }
  .feedback-dialog .form-pair { grid-template-columns: 1fr; gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .t-flip-card, .t-flip-inner, .folder-page, .folder-front { transition-duration: .01s; }
  .feedback-dialog[open], .feedback-dialog[open]::backdrop, .feedback-step:not([hidden]) { animation: none; }
}
