/* The "How XP works" page: visual blocks instead of tables. Elements with data-reveal get .in when scrolled into view. */
:root { --gold: #d9a21b; --gold-soft: #fff4d6; }

.xp-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin: 18px 0; }
.xp-tile {
  background: var(--bg-element); border-radius: 18px; padding: 18px;
  display: flex; flex-direction: column; gap: 6px;
}
.xp-tile .ico { font-size: 28px; line-height: 1; }
.xp-tile b { font-size: 17px; }
.xp-tile span { color: var(--text-secondary); font-size: 14.5px; }

.xp-badge {
  display: inline-flex; align-items: center; gap: 4px; align-self: flex-start;
  background: var(--gold-soft); color: #8a6100; font-weight: 700; font-size: 13px;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}

/* Meals: five plates light up, the sixth is crossed out. */
.plates { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 6px; }
.plate {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  font-size: 19px; background: var(--bg-element); position: relative;
  opacity: 0.35; transform: scale(0.8); transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.plate small { position: absolute; bottom: -18px; font-size: 11px; font-weight: 700; color: var(--accent); }
.plates.in .plate { opacity: 1; transform: none; }
.plates.in .plate.capped { opacity: 0.4; }
.plate.capped::after { content: ""; position: absolute; width: 70%; height: 3px; background: var(--protein); border-radius: 2px; transform: rotate(-45deg); }
.plate.capped small { color: var(--text-secondary); }
.plates-note { margin-top: 26px; }

/* Quests: the check ticks in when the card appears. */
.quests { display: grid; gap: 12px; margin: 18px 0; }
.quest {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  background: var(--bg-element); border-radius: 18px; padding: 14px 16px;
}
.quest h3 { margin: 0; font-size: 16px; }
.quest p { margin: 2px 0 0; font-size: 14px !important; color: var(--text-secondary) !important; }
.tick { width: 30px; height: 30px; }
@media (max-width: 520px) {
  .quest { grid-template-columns: auto 1fr; }
  .quest .xp-badge { grid-column: 2; justify-self: start; margin-top: -6px; }
}
.tick circle { fill: none; stroke: var(--border); stroke-width: 2.5; }
.tick path { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 20; stroke-dashoffset: 20; }
.tick .bg { fill: var(--accent); transform: scale(0); transform-origin: center; transition: transform 0.4s cubic-bezier(0.3, 1.6, 0.5, 1); }
.quest.in .tick .bg { transform: scale(1); }
.quest.in .tick path { transition: stroke-dashoffset 0.35s ease 0.3s; stroke-dashoffset: 0; }

/* Streak: bars grow to 2 XP a day and level off at 30. */
.streak-chart {
  display: flex; align-items: flex-end; gap: 4px; height: 170px; margin: 22px 0 8px;
  padding: 0 2px; border-bottom: 2px solid var(--border); position: relative;
}
.streak-chart .cap {
  position: absolute; left: 0; right: 0; bottom: calc(var(--max) * 1%); border-top: 2px dashed var(--gold);
  font-size: 11px; font-weight: 700; color: #8a6100; text-align: right; padding-top: 2px;
}
.bar {
  flex: 1; min-width: 0; height: calc(var(--h) * 1%); border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #f6a04d, #f28c28);
  transform: scaleY(0); transform-origin: bottom; transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  transition-delay: calc(var(--i) * 45ms);
}
.bar.max { background: linear-gradient(180deg, #f3c54f, var(--gold)); }
.streak-chart.in .bar { transform: none; }
.streak-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); }

/* Example day: lines slide in, the total counts up, and a bar shows where the XP came from. */
.receipt { background: var(--bg-element); border-radius: 20px; padding: 18px 18px 14px; margin: 18px 0; }
.receipt .line {
  display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 15.5px;
  border-bottom: 1px dashed var(--border);
  opacity: 0; transform: translateX(-12px); transition: opacity 0.4s ease, transform 0.4s ease;
  transition-delay: calc(var(--i) * 140ms);
}
.receipt .line b { color: var(--accent); white-space: nowrap; }
.receipt.in .line { opacity: 1; transform: none; }
.receipt .total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 12px; }
.receipt .total span { font-weight: 700; }
.receipt .total strong { font-size: 34px; letter-spacing: -0.02em; color: var(--gold); font-variant-numeric: tabular-nums; }
.mix { display: flex; height: 12px; border-radius: 999px; overflow: hidden; margin-top: 12px; background: var(--border); }
.mix i { width: 0; transition: width 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 0.6s; }
.receipt.in .mix i { width: calc(var(--w) * 1%); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 13px; color: var(--text-secondary); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; background: var(--c); }

/* Ranks: a ladder whose line fills as it scrolls into view. */
.ladder { list-style: none; padding: 0 !important; margin: 22px 0; position: relative; }
.ladder::before, .ladder::after {
  content: ""; position: absolute; left: 21px; top: 22px; bottom: 22px; width: 4px; border-radius: 2px; background: var(--border);
}
.ladder::after { background: linear-gradient(180deg, var(--accent), var(--gold)); transform: scaleY(0); transform-origin: top; transition: transform 1.6s cubic-bezier(0.4, 0, 0.2, 1); }
.ladder.in::after { transform: none; }
.rung { display: grid; grid-template-columns: 46px 1fr auto; gap: 14px; align-items: center; margin: 0 0 14px !important; position: relative; z-index: 1; }
.rung .node {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 15px;
  background: var(--bg); border: 3px solid var(--border); color: var(--text-secondary);
  transition: border-color 0.3s ease, background 0.3s ease, color 0.3s ease; transition-delay: calc(var(--i) * 220ms);
}
.ladder.in .node { border-color: var(--accent); color: var(--accent); }
.rung b { display: block; font-size: 17px; }
.rung small { color: var(--text-secondary); font-size: 13.5px; }
.rung .xp-badge { justify-self: end; }
.rung.top .node { background: var(--gold); color: #fff; border-color: var(--gold) !important; }
.rung.top .node { animation: glow 2.4s ease-in-out infinite; }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(217, 162, 27, 0.45); } 50% { box-shadow: 0 0 0 10px rgba(217, 162, 27, 0); } }

.faq details { background: var(--bg-element); border-radius: 16px; padding: 14px 18px; margin: 10px 0; }
.faq summary { font-weight: 700; cursor: pointer; }
.faq details p { margin: 8px 0 0; }

@media (prefers-reduced-motion: reduce) {
  .plate, .tick .bg, .tick path, .bar, .receipt .line, .mix i, .ladder::after, .rung .node { transition: none !important; }
  .rung.top .node { animation: none; }
}
