/* Family Wealth Cards (/tools/family-wealth-cards/ and its Spanish page).
   Cards are drawn by public/js/tools/family-wealth-cards.js from
   data/wealth-cards.js. Every card measure is in container units (cqw), so
   one design scales from the hero fan to a 2.5 x 3.5 inch printed card
   (standard poker size). Cards keep their own light palette in dark mode,
   like real cards on a dark table. */

.wc-card {
  --suit: #0d7a5f;
  --paper-card: #fffdf8;
  --ink-card: #1c1917;
  --ink-card-soft: #4a433e;
  position: relative;
  box-sizing: border-box;
  width: 100%;
  aspect-ratio: 5 / 7;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 10cqw 11cqw 13cqw;
  border-radius: 5cqw;
  border: 1px solid #e3dbcf;
  background:
    radial-gradient(120% 60% at 50% 0%, color-mix(in srgb, var(--suit) 14%, var(--paper-card)) 0 45%, transparent 46%),
    var(--paper-card);
  color: var(--ink-card);
  box-shadow: 0 1px 2px rgba(28, 25, 23, 0.08), 0 8px 22px rgba(28, 25, 23, 0.10);
  overflow: hidden;
  font-family: var(--sans);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.wc { container-type: inline-size; width: 100%; }
.wc-card::before {
  content: "";
  position: absolute;
  inset: 3.6cqw;
  border: 0.7cqw solid color-mix(in srgb, var(--suit) 32%, var(--paper-card));
  border-radius: 3.2cqw;
  pointer-events: none;
}
.wc-card * { box-sizing: border-box; }
.wc-card > * { flex-shrink: 0; }

.wc-suit--financial  { --suit: #16803c; }
.wc-suit--retirement { --suit: #0d7a5f; }
.wc-suit--security   { --suit: #0369a1; }
.wc-suit--medical    { --suit: #c2372f; }
.wc-suit--physical   { --suit: #2563eb; }
.wc-suit--mental     { --suit: #6d4fc4; }
.wc-suit--social     { --suit: #b45309; }
.wc-suit--time       { --suit: #be123c; }
.wc-card--needwant   { --suit: #0369a1; }
.wc-card--rules      { --suit: #57534e; }

/* Corner index: points over the suit icon, mirrored bottom right. */
.wc .wc-corner {
  position: absolute;
  top: 6.4cqw;
  left: 6.6cqw;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1cqw;
  color: var(--suit);
  z-index: 1;
}
.wc .wc-corner--br { top: auto; left: auto; bottom: 6.4cqw; right: 6.6cqw; transform: rotate(180deg); }
.wc-corner__pts { font-family: var(--serif); font-weight: 700; font-size: 11cqw; line-height: 0.9; }
.wc-corner__icon { width: 6.4cqw; height: 6.4cqw; }

.wc .wc-band {
  margin-top: 1cqw;
  font-size: 5cqw;
  font-weight: 800;
  letter-spacing: 0.9cqw;
  text-transform: uppercase;
  color: var(--suit);
}
.wc .wc-band--plain { color: var(--ink-card-soft); }

.wc .wc-emblem {
  display: grid;
  place-items: center;
  width: 31cqw;
  height: 31cqw;
  margin: 6cqw auto 6cqw;
  border-radius: 50%;
  background: var(--suit);
  color: #fff;
  box-shadow: 0 0 0 2.2cqw color-mix(in srgb, var(--suit) 16%, var(--paper-card)), 0 0 0 2.8cqw color-mix(in srgb, var(--suit) 30%, var(--paper-card));
}
.wc .wc-emblem .wc-icon { width: 16cqw; height: 16cqw; }
.wc-card--wild .wc-emblem {
  background: conic-gradient(#16803c 0 12.5%, #0d7a5f 0 25%, #0369a1 0 37.5%, #c2372f 0 50%, #2563eb 0 62.5%, #6d4fc4 0 75%, #b45309 0 87.5%, #be123c 0);
}
.wc-card--wild .wc-emblem .wc-icon { width: 21cqw; height: 21cqw; }
.wc .wc-emblem--ask { width: 24cqw; height: 24cqw; margin: 5cqw auto 7cqw; }
.wc .wc-emblem--ask .wc-icon { width: 13cqw; height: 13cqw; }

.wc .wc-title {
  margin: 0 0 3cqw;
  font-family: var(--serif);
  font-size: 8.8cqw;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.1cqw;
  color: var(--ink-card);
}
.wc .wc-title--big { font-size: 10.5cqw; }
.wc .wc-text {
  margin: 0;
  font-size: 5.3cqw;
  line-height: 1.34;
  color: var(--ink-card-soft);
}

/* Points as dots, so non-readers can see how big a card is. */
.wc .wc-dots { display: flex; gap: 1.8cqw; margin-top: auto; padding-top: 3cqw; }
.wc .wc-dots span {
  width: 3.2cqw;
  height: 3.2cqw;
  border-radius: 50%;
  border: 0.6cqw solid var(--suit);
}
.wc .wc-dots span.on { background: var(--suit); }

.wc .wc-foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4.6cqw;
  display: flex;
  justify-content: center;
  gap: 2.4cqw;
  font-size: 3.3cqw;
  letter-spacing: 0.15cqw;
  color: #8a817a;
}
.wc-foot__url { font-weight: 700; color: color-mix(in srgb, var(--suit) 70%, #57534e); }

/* Title card */
.wc-card--title { --suit: #0d7a5f; padding-top: 10cqw; }
.wc-card--title .wc-title--big { font-size: 9.6cqw; margin-bottom: 2.4cqw; }
.wc .wc-title-mark {
  width: 24cqw;
  height: 24cqw;
  padding: 2.4cqw;
  border-radius: 6cqw;
  background: #0d7a5f;
  color: #faf7f2;
  margin-bottom: 4cqw;
}
.wc .wc-kicker { margin: 0 0 1.5cqw; font-size: 4.2cqw; color: #0d7a5f; }
.wc-card--title .wc-text { font-size: 4.3cqw; line-height: 1.3; }
.wc .wc-suit-list {
  list-style: none;
  margin: auto 0 0;
  padding: 3cqw 0 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.6cqw 1cqw;
  width: 100%;
}
.wc .wc-suit-list li { display: flex; flex-direction: column; align-items: center; gap: 0.5cqw; font-size: 3.3cqw; font-weight: 700; color: var(--suit); }
.wc-suit-list__icon { width: 5.4cqw; height: 5.4cqw; }

/* Rules cards */
.wc-card--rules .wc-title { margin-top: 5cqw; margin-bottom: 4cqw; }
.wc .wc-rules {
  margin: 0;
  padding: 0 0 0 7cqw;
  text-align: left;
  font-size: 5.2cqw;
  line-height: 1.38;
  color: var(--ink-card-soft);
}
.wc .wc-rules li { margin-bottom: 2.6cqw; padding-left: 1cqw; }
.wc .wc-rules li::marker { color: var(--suit); font-weight: 800; }

/* Needs or Wants: the answer prints upside down at the foot. */
.wc-card--needwant .wc-title { margin-bottom: auto; }
.wc .wc-answer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1cqw;
  width: 100%;
  padding-top: 3cqw;
  border-top: 0.5cqw dashed color-mix(in srgb, var(--suit) 35%, var(--paper-card));
  font-size: 4.1cqw;
  line-height: 1.3;
  color: var(--ink-card-soft);
  transform: rotate(180deg);
}
.wc .wc-answer strong { font-size: 5.4cqw; letter-spacing: 0.4cqw; text-transform: uppercase; }
.wc .wc-answer--need strong, .wc-answer--need .wc-answer__icon { color: #16803c; }
.wc .wc-answer--want strong, .wc-answer--want .wc-answer__icon { color: #b45309; }
.wc-answer__icon { width: 6cqw; height: 6cqw; }
.wc-card--hide-answer .wc-answer { visibility: hidden; }

/* Card back: the radar mark ringed by the eight suits. */
.wc-back {
  --suit: #0d7a5f;
  padding: 0;
  border-color: #0b6a52;
  background:
    repeating-linear-gradient(45deg, rgba(250, 247, 242, 0.05) 0 2cqw, transparent 2cqw 4cqw),
    repeating-linear-gradient(-45deg, rgba(250, 247, 242, 0.05) 0 2cqw, transparent 2cqw 4cqw),
    radial-gradient(90% 70% at 50% 42%, #12906f, #0b6a52);
  color: #faf7f2;
}
.wc-back::before { border-color: rgba(250, 247, 242, 0.55); }
.wc-back__frame { position: absolute; inset: 0; }
.wc-back__suit {
  position: absolute;
  left: 50%;
  top: 42%;
  display: grid;
  place-items: center;
  width: 11cqw;
  height: 11cqw;
  border-radius: 50%;
  background: rgba(250, 247, 242, 0.14);
  transform: translate(-50%, -50%) rotate(calc(var(--i) * 45deg)) translateY(-29cqw) rotate(calc(var(--i) * -45deg));
}
.wc-back__icon { width: 6.4cqw; height: 6.4cqw; }
.wc-back__mark {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 34cqw;
  height: 34cqw;
  transform: translate(-50%, -50%);
}
.wc .wc-back__name {
  position: absolute;
  left: 8cqw;
  right: 8cqw;
  top: 97cqw;
  margin: 0;
  color: #faf7f2;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: 7.4cqw;
  line-height: 1.1;
  text-align: center;
}
.wc .wc-back__url {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 9cqw;
  margin: 0;
  color: #faf7f2;
  font-size: 4cqw;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.3cqw;
  text-align: center;
  opacity: 0.85;
}

/* ---------- Page layout ---------- */

.wc-hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.wc-fan {
  position: relative;
  height: 262px;
  margin: 0 0 18px;
}
.wc-fan > .wc {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 168px;
  transform-origin: 50% 120%;
  transform: translateX(-50%) rotate(calc((var(--n) - 2) * 11deg));
  transition: transform 0.25s ease;
}
.wc-fan > .wc:nth-child(1) { --n: 0; }
.wc-fan > .wc:nth-child(2) { --n: 1; }
.wc-fan > .wc:nth-child(3) { --n: 2; }
.wc-fan > .wc:nth-child(4) { --n: 3; }
.wc-fan > .wc:nth-child(5) { --n: 4; }
.wc-fan:hover > .wc { transform: translateX(-50%) rotate(calc((var(--n) - 2) * 15deg)); }
@media (max-width: 560px) {
  .wc-fan { height: 220px; }
  .wc-fan > .wc { width: 124px; }
}

.wc-cta-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.wc-cta-row .btn { margin: 0; }

.wc-hand {
  list-style: none;
  margin: 18px 0 6px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 18px;
}
.wc-slot { display: flex; flex-direction: column; gap: 10px; }
.wc-slot .wc-card { transition: transform 0.2s ease, opacity 0.2s ease, filter 0.2s ease; }
.wc-slot.is-done .wc-card { opacity: 0.85; }
.wc-slot.is-done .wc-card::after {
  content: "\2713";
  position: absolute;
  top: 7cqw;
  right: 7cqw;
  display: grid;
  place-items: center;
  width: 20cqw;
  height: 20cqw;
  border-radius: 50%;
  transform: rotate(-12deg);
  background: var(--suit);
  border: 1.2cqw solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  color: #fff;
  font-size: 11cqw;
  font-weight: 800;
}
.wc-done {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--card);
  font-weight: 600;
  cursor: pointer;
}
.wc-done input { width: 20px; height: 20px; accent-color: var(--m-accent); margin: 0; }
.wc-slot.is-done .wc-done { border-color: var(--ok-line); background: var(--ok-soft); color: var(--ok); }
.wc-slot--deal { animation: wc-deal 0.45s cubic-bezier(.2, .8, .3, 1.1) both; animation-delay: calc(var(--i) * 90ms); }
@keyframes wc-deal {
  from { opacity: 0; transform: translateY(-36px) rotate(-10deg) scale(0.9); }
  to { opacity: 1; transform: none; }
}

.wc-score { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin: 14px 0; }
.wc-score div { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg); }
.wc-score dt { font-size: 13px; color: var(--text-muted); }
.wc-score dd { margin: 4px 0 0; font-family: var(--serif); font-size: 28px; font-weight: 700; color: var(--tone, var(--ink)); }

/* Needs or Wants game */
.wc-nw { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 24px; align-items: center; }
.wc-nw__card .wc { max-width: 220px; margin: 0 auto; }
.wc-nw .wc-answer { transform: none; }
.wc-nw__meta { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--text-muted); margin-bottom: 12px; }
.wc-nw__choices { display: flex; gap: 12px; flex-wrap: wrap; }
.wc-nw__choices .btn { flex: 1 1 120px; margin: 0; min-height: 52px; font-size: 17px; }
.wc-nw__feedback { min-height: 3em; margin: 14px 0; font-size: 16px; line-height: 1.5; }
.wc-nw__feedback.is-right { color: var(--ok); }
.wc-nw__feedback.is-wrong { color: var(--warn); }
@media (max-width: 560px) {
  .wc-nw { grid-template-columns: minmax(0, 1fr); }
  .wc-nw__card .wc { max-width: 190px; }
}

/* Browse */
.wc-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 16px; }
.wc-chip {
  --suit: var(--m-accent);
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.wc-chip[aria-pressed="true"] { background: var(--suit); border-color: var(--suit); color: #fff; }
.wc-gallery {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 16px;
}
@media (max-width: 480px) {
  .wc-gallery, .wc-hand { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}

/* Print options */
.wc-print-options { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.wc-print-options legend { font-weight: 700; margin-bottom: 8px; }
.wc-print-options label { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.wc-print-steps { margin: 12px 0 0; padding-left: 20px; color: var(--text-muted); }

@media (prefers-reduced-motion: reduce) {
  .wc-slot--deal { animation: none; }
  .wc-fan > .wc, .wc-slot .wc-card { transition: none; }
}

/* ---------- Print: the deck itself ----------
   Printing this page prints the chosen cards, nine to a sheet at poker
   size (2.5 x 3.5 in), with each sheet of backs mirrored for a long-edge
   double-sided print. Fits US Letter and A4. */
.wc-print { display: none; }
@media print {
  @page { margin: 0.2in; }
  .site-layout, .print-brand, .site-footer { display: none !important; }
  .wc-print { display: block !important; }
  .wc-sheet {
    display: grid;
    grid-template-columns: repeat(3, 2.5in);
    grid-auto-rows: 3.5in;
    justify-content: center;
    align-content: start;
    break-after: page;
    page-break-after: always;
  }
  .wc-sheet:last-child { break-after: auto; page-break-after: auto; }
  .wc-cell { outline: 0.4pt solid #c9c1b6; outline-offset: -0.2pt; overflow: hidden; }
  .wc-cell--empty { outline: 0; }
  .wc-print .wc { height: 100%; }
  .wc-print .wc-card { height: 100%; aspect-ratio: auto; border: 0; border-radius: 0; box-shadow: none; }
  .wc-print, .wc-print * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
