/* Apadrinhar um Sorriso: the gift tags and the 50-cell meter, shared by index.html and apadrinhar.html.
   Built on the kit's tokens (system.css): one ink, one accent (the logo's red), the page radius. */

/* ---------------------------------------------------------------- the meter: one cell per child */
.meter { display: grid; gap: var(--s-4); }
.meter__nums { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s-2) var(--s-6); }
.meter__big { font: var(--display-weight) var(--t-h3)/1.1 var(--font-display); letter-spacing: var(--display-tracking); }
.meter__big b { font-weight: inherit; color: var(--action); font-variant-numeric: tabular-nums; }
.meter__side { color: var(--muted); font-size: var(--t-small); font-variant-numeric: tabular-nums; }
.meter__cells { display: grid; grid-template-columns: repeat(50, minmax(0, 1fr)); gap: 3px; height: 28px; margin: 0; padding: 0; list-style: none; }
.meter__cells > li { position: relative; border-radius: 2px; background: color-mix(in oklab, var(--ink) 12%, transparent); overflow: hidden; }
.meter__cells > li::after { content: ""; position: absolute; inset: 0; background: var(--action); transform: scaleY(var(--fill, 0)); transform-origin: bottom; transition: transform 700ms cubic-bezier(.22,1,.36,1) calc(var(--i, 0) * 12ms); }
.meter__cells > li[data-estado="metade"] { --fill: .5; }
.meter__cells > li[data-estado="completa"] { --fill: 1; }
.meter__cells > li > a, .meter__cells > li > button { position: absolute; inset: -6px 0; z-index: 1; display: block; border: 0; padding: 0; background: none; cursor: pointer; }
.meter__legend { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); color: var(--muted); font-size: var(--t-small); margin: 0; padding: 0; list-style: none; }
.meter__legend li { display: inline-flex; align-items: center; gap: var(--s-2); }
.meter__legend i { width: 12px; height: 12px; border-radius: 2px; background: color-mix(in oklab, var(--ink) 12%, transparent); }
.meter__legend i.is-half { background: linear-gradient(to top, var(--action) 50%, color-mix(in oklab, var(--ink) 12%, transparent) 50%); }
.meter__legend i.is-full { background: var(--action); }
@media (max-width: 639px) { .meter__cells { grid-template-columns: repeat(25, minmax(0, 1fr)); height: 44px; row-gap: 4px; } }

/* ---------------------------------------------------------------- the gift tag */
.tags { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--card-gap, 24px); margin: 0; padding: 0; list-style: none; }
.tags > li { display: grid; }
/* a Christmas gift tag: paper, a gold-ringed hole with its string, and a red ribbon threaded through the hole
   that fills down the tag with the gift: none, half (10 € paid) or whole (the gift is guaranteed) */
.tag.card { position: relative; display: grid; grid-template-rows: auto auto 1fr auto; gap: var(--s-1); padding: var(--s-6) calc(var(--s-5) + 28px) var(--s-5) var(--s-5); color: var(--ink); text-decoration: none; background: var(--card); min-height: 0; overflow: visible; }
.tag.card::before { content: ""; position: absolute; top: 0; bottom: 0; right: 22px; width: 10px; background: var(--action); transform-origin: top; transform: scaleY(var(--rib, 0)); transition: transform 800ms cubic-bezier(.22,1,.36,1); border-radius: 0 0 2px 2px; }
.tag[data-estado="metade"] { --rib: .5; }
.tag[data-estado="completa"] { --rib: 1; }
.tag__hole { position: absolute; top: var(--s-4); right: 18px; z-index: 1; width: 18px; height: 18px; border-radius: 50%; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line-strong), 0 0 0 3px var(--gold, #e8d060); display: grid; place-items: center; transition: background 300ms var(--ease); }
.tag__hole::before { content: ""; position: absolute; bottom: 100%; left: 50%; width: 2px; height: calc(var(--s-4) + 14px); margin-left: -1px; background: var(--gold, #e8d060); border-radius: 1px; }
.tag__hole svg { width: 12px; height: 12px; opacity: 0; color: var(--action-ink); transition: opacity 300ms var(--ease); }
.tag[data-estado="completa"] .tag__hole { background: var(--action); }
.tag[data-estado="completa"] .tag__hole svg { opacity: 1; }
.tag.card { grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto auto auto 1fr; column-gap: var(--s-3); grid-template-areas: "num num" "name name" "age age" "icon wish" "foot foot"; }
.tag__num { grid-area: num; } .tag__name { grid-area: name; } .tag__age { grid-area: age; } .tag__wish { grid-area: wish; } .tag__foot { grid-area: foot; }
.tag__icon { grid-area: icon; align-self: end; width: 28px; height: 28px; margin-bottom: 2px; color: var(--action); }
/* on the fir-green band the tags stay paper: the light palette inside them */
.ground-inverse .tag.card { --ink: var(--p-ink); --muted: var(--p-muted); --bg: var(--p-bg); --card: var(--p-bg); --action: var(--p-action); --action-ink: var(--p-action-ink); --line: color-mix(in oklab, var(--p-ink) 11%, transparent); --line-strong: color-mix(in oklab, var(--p-ink) 20%, transparent); border-color: transparent; }
.ground-inverse .meter { --action: var(--gold, #e8d060); }
.ground-inverse .meter__cells > li, .ground-inverse .meter__legend i:not(.is-half, .is-full) { background: color-mix(in oklab, var(--p-inv-ink) 18%, transparent); }
.tag__name { font: var(--display-weight) var(--t-h3)/1.15 var(--font-display); letter-spacing: var(--display-tracking); padding-right: var(--s-6); }
.tag__age { color: var(--muted); font-size: var(--t-small); }
.tag__wish { margin-top: var(--s-4); font-size: var(--t-body); line-height: 1.4; }
.tag__wish .t-label { display: block; color: var(--muted); margin-bottom: 2px; }
.tag__foot { display: grid; gap: var(--s-2); margin-top: var(--s-4); align-self: end; }
.tag__bar { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; height: 6px; }
.tag__bar > i { border-radius: 2px; background: color-mix(in oklab, var(--ink) 12%, transparent); position: relative; overflow: hidden; }
.tag__bar > i::after { content: ""; position: absolute; inset: 0; background: var(--action); transform: scaleX(0); transform-origin: left; transition: transform 600ms cubic-bezier(.22,1,.36,1); }
.tag[data-estado="metade"] .tag__bar > i:first-child::after,
.tag[data-estado="completa"] .tag__bar > i::after { transform: scaleX(1); }
.tag[data-estado="completa"] .tag__bar > i:last-child::after { transition-delay: 150ms; }
.tag__state { font-size: var(--t-small); font-weight: 500; }
.tag[data-estado="livre"] .tag__state { color: var(--muted); font-weight: 400; }
.tag[data-estado="metade"] .tag__state, .tag[data-estado="completa"] .tag__state { color: var(--action); }
@media (max-width: 1023px) { .tags { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 639px) {
  .tags { gap: 12px; }
  .tag.card { padding: var(--s-5) var(--s-4) var(--s-4); }
  .tag__name { font-size: 22px; }
  .tag__wish { margin-top: var(--s-3); }
  .tag__foot { margin-top: var(--s-3); }
}
@media (prefers-reduced-motion: reduce) { .meter__cells > li::after, .tag__bar > i::after, .tag__hole, .tag__hole svg, .tag.card::before { transition: none; } }
.tag__wish { hyphens: auto; overflow-wrap: break-word; }
@media (max-width: 639px) {
  .tag.card::before { right: 14px; width: 8px; }
  .tag__hole { right: 9px; top: 12px; }
  .tag.card { grid-template-areas: "num num" "name name" "icon age" "wish wish" "foot foot"; column-gap: var(--s-2); }
  .tag__icon { width: 18px; height: 18px; align-self: center; margin: 0; }
  .tag__name { font-size: 20px; }
}
.meter__big .meter__side { font: 400 var(--t-small)/1 var(--font-text); letter-spacing: 0; white-space: nowrap; }

/* ---------------------------------------------------------------- Menta details on the tags */
.tag__num { justify-self: start; margin-bottom: var(--s-1); padding: 2px 8px; border-radius: 999px; background: var(--menta-soft, #d8f5e6); color: var(--pinho, #0b3d2a); font: 600 11px/1.5 var(--font-text); letter-spacing: .03em; font-variant-numeric: tabular-nums; }
.tag__size { display: inline-block; padding: 1px 9px; white-space: nowrap; border-radius: 999px; background: var(--menta-soft, #d8f5e6); color: var(--pinho, #0b3d2a); font-weight: 500; }
/* a guaranteed gift: a light mint wash and an upright round sticker */
.tag[data-estado="completa"].card { background: linear-gradient(180deg, #ffffff 0%, color-mix(in oklab, var(--menta, #7fe3b7) 16%, #ffffff) 100%); }
.tag[data-estado="completa"] .tag__state::before { content: "★"; display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 6px; border-radius: 50%; background: var(--menta, #7fe3b7); color: var(--pinho, #0b3d2a); font-size: 10px; vertical-align: 1px; }
/* not yet confirmed: a slowly pulsing amber dot */
.tag.is-confirmar .tag__state::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 6px; border-radius: 50%; background: #f2a516; vertical-align: 1px; animation: confirmar 2s ease-out infinite; }
@keyframes confirmar { 0% { box-shadow: 0 0 0 0 rgb(242 165 22 / .55); } 70%, 100% { box-shadow: 0 0 0 7px rgb(242 165 22 / 0); } }
/* a tag that just became guaranteed: a light sweeps across it and its check pops */
.tag.card.is-new .tag__foot::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: linear-gradient(105deg, transparent 35%, rgb(255 255 255 / .85) 50%, transparent 65%); background-size: 260% 100%; animation: brilho-tag 1100ms ease 200ms both; }
.tag.is-new .tag__hole { animation: furo-pop 700ms cubic-bezier(.22,1,.36,1) 300ms; }
@keyframes brilho-tag { from { background-position: 130% 0; } to { background-position: -30% 0; } }
@keyframes furo-pop { 40% { transform: scale(1.5); } }
/* the bar fills with a little overshoot */
.tag__bar > i::after { transition-timing-function: cubic-bezier(.34,1.56,.64,1); }
@media (hover: hover) and (pointer: fine) {
  /* a gift tag swings from its hole when the pointer arrives (movement only, it rests straight) */
  .tag.card { transform-origin: calc(100% - 27px) 25px; }
  .tag.card:hover { animation: etiqueta-balanca 900ms cubic-bezier(.22,1,.36,1); }
  @media (max-width: 639px) { .tag.card { transform-origin: calc(100% - 18px) 21px; } }
}
@keyframes etiqueta-balanca { 18% { transform: rotate(2.4deg); } 42% { transform: rotate(-1.5deg); } 66% { transform: rotate(.6deg); } 100% { transform: rotate(0); } }
/* the grid cascades in, column by column (js adds is-cascata / is-visto) */
.tags.is-cascata > li { transition: opacity 520ms ease, transform 640ms cubic-bezier(.22,1,.36,1); transition-delay: calc(var(--k, 0) * 70ms); }
.tags.is-cascata > li:not(.is-visto) { opacity: 0; transform: translateY(22px); }
/* filtering: tags glide to their new places (View Transitions) */
::view-transition-group(*) { animation-duration: 380ms; animation-timing-function: cubic-bezier(.22,1,.36,1); }
@media (prefers-reduced-motion: reduce) {
  .tag.card:hover, .tag.is-confirmar .tag__state::after, .tag.card.is-new .tag__foot::after, .tag.is-new .tag__hole { animation: none; }
  .tags.is-cascata > li, .tags.is-cascata > li:not(.is-visto) { opacity: 1; transform: none; transition: none; }
}
