/**
 * Gift Registry Core — pixel-matched to Lovable prototype components.
 * Uses theme tokens from gift-of-giving/assets/css/theme.css
 */

/* —— Grids —— */
.grc-charities {
  display: grid;
  gap: 2.5rem;
  grid-template-columns: 1fr;
  margin: 0 auto;
  max-width: var(--gr-max-6xl, 72rem);
  padding: 0 1.5rem 3.5rem;
}

.grc-gifts {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
  margin: 0 auto;
  max-width: var(--gr-max-6xl, 72rem);
  padding: 0 1.5rem 7rem;
}

@media (min-width: 768px) {
  .grc-gifts {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .grc-charities {
    grid-template-columns: repeat(3, 1fr);
  }

  .grc-gifts {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* —— Cards —— */
.grc-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--gr-border);
  border-radius: var(--radius);
  background: var(--gr-card);
  color: var(--gr-card-foreground);
}

/* Charity card */
.grc-charity__head {
  border-bottom: 1px solid var(--gr-border);
  padding: 1.5rem;
  text-align: center;
}

.grc-charity__head h2 {
  margin: 0;
  font-size: 1.875rem;
  line-height: 1.2;
}

.grc-charity__video {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  overflow: hidden;
  background: var(--gr-muted);
}

.grc-charity__video .plyr,
.grc-charity__video .plyr__video-embed {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.grc-charity__video .plyr {
  --plyr-color-main: var(--gr-primary);
  --plyr-video-background: var(--gr-muted);
  --plyr-menu-background: var(--gr-card);
  --plyr-menu-color: var(--gr-foreground);
}

.grc-charity__video iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.grc-charity__logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 1.25rem 1.5rem;
  background: #ffffff;
}

.grc-charity__logo img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 100%;
  height: auto;
  object-fit: contain;
}

.grc-charity__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.75rem 1.5rem;
  text-align: center;
}

.grc-charity__desc {
  margin: 0;
  font-size: 1rem;
  line-height: 1.625;
  color: var(--gr-muted-foreground);
}

/* Gift card */
.grc-gift__media {
  position: relative;
  aspect-ratio: 4 / 3;
  width: 100%;
  overflow: hidden;
  background: var(--gr-muted);
}

.grc-gift__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.grc-gift.is-sold .grc-gift__media img {
  opacity: 0.35;
}

.grc-badge {
  position: absolute;
  top: 1rem;
  left: 1rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--gr-primary);
  color: var(--gr-primary-foreground);
  font-family: var(--gr-font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.grc-gift__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.5rem;
}

.grc-gift__title {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.2;
  text-align: left;
}

.grc-gift__desc {
  margin: 0.5rem 0 0;
  font-size: 1rem;
  line-height: 1.625;
  color: var(--gr-muted-foreground);
  text-align: left;
}

.grc-gift__desc p {
  margin: 0;
}

.grc-progress__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.grc-price {
  font-family: var(--gr-font-display);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.5px;
}

.grc-remaining {
  color: var(--gr-muted-foreground);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.grc-progress__track {
  height: 4px;
  margin-top: 0.75rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--gr-muted);
}

.grc-progress__fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--gr-primary);
  transition: width 0.3s ease;
}

.grc-gift__actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: auto;
}

.grc-gift__actions .grc-btn {
  margin: 0;
  width: 100%;
}

.grc-donate-row {
  display: flex;
  gap: 0.5rem;
}

.grc-donate-row input {
  flex: 1;
  min-width: 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--gr-input);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--gr-foreground);
  font-family: var(--gr-font-body);
  font-size: 1rem;
  font-weight: 500;
}

.grc-donate-row input::placeholder {
  color: var(--gr-muted-foreground);
}

.grc-donate-row input:focus {
  outline: none;
  box-shadow: 0 0 0 1px var(--gr-ring);
}

.grc-donate-row .grc-btn--give {
  flex-shrink: 0;
  width: auto;
  margin: 0;
  padding-inline: 1rem;
}

.grc-sold-msg {
  margin: auto 0 0;
  font-size: 1rem;
  color: var(--gr-muted-foreground);
}

/* —— Buttons (prototype: eyebrow + rounded-sm) —— */
.grc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--gr-font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.grc-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.grc-btn--primary {
  background: var(--gr-primary);
  color: var(--gr-primary-foreground);
}

.grc-btn--primary:hover:not(:disabled) {
  opacity: 0.85;
}

.grc-charity__body .grc-btn--primary {
  width: 100%;
  padding: 1rem 1.5rem;
}

.grc-btn--outline {
  background: transparent;
  border-color: var(--gr-primary);
  color: var(--gr-primary);
}

.grc-btn--outline:hover:not(:disabled) {
  background: var(--gr-accent);
}

.grc-btn--ghost {
  background: transparent;
  border-color: var(--gr-border);
  color: rgb(247 243 234 / 0.82);
}

.grc-btn--ghost:hover:not(:disabled) {
  background: var(--gr-accent);
  color: var(--gr-accent-foreground);
}

/* —— Payment modal —— */
.grc-modal[hidden] {
  display: none !important;
}

.grc-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.grc-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.grc-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 28rem);
  max-height: 90vh;
  overflow: auto;
  padding: 1.75rem;
  border: 1px solid var(--gr-border);
  border-radius: var(--radius);
  background: var(--gr-card);
  color: var(--gr-foreground);
}

.grc-modal__dialog h2 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
}

.grc-modal__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  border: 0;
  background: transparent;
  color: var(--gr-foreground);
  font-size: 1.5rem;
  cursor: pointer;
}

.grc-pay-form {
  --grc-field-fill: #173b3c;
  --grc-field-fill: color-mix(in srgb, var(--gr-card) 82%, black);
}

.grc-field {
  margin: 0 0 1rem;
}

.grc-field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gr-foreground);
}

.grc-field input {
  box-sizing: border-box;
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--gr-input);
  border-radius: var(--radius-sm);
  background: var(--grc-field-fill);
  color: var(--gr-foreground);
  font-family: var(--gr-font-body);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.4;
}

.grc-field input:focus {
  outline: none;
  box-shadow: 0 0 0 1px var(--gr-ring);
}

.grc-field input::placeholder {
  color: var(--gr-muted-foreground);
}

.grc-field textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--gr-input);
  border-radius: var(--radius-sm);
  background: var(--grc-field-fill, transparent);
  color: var(--gr-foreground);
  font-family: var(--gr-font-body);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.4;
  resize: vertical;
}

.grc-field textarea:focus {
  outline: none;
  box-shadow: 0 0 0 1px var(--gr-ring);
}

.grc-modal__eyebrow {
  margin: 0 0 0.75rem;
}

.grc-modal__lead {
  margin: 0 0 1.25rem;
  color: var(--gr-muted-foreground);
}

.grc-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.grc-pay-error {
  color: #ffb4b4;
}

#grc-payment-element {
  margin: 0 0 1rem;
}

/* —— Registry sections (Living Things / Guests / Peanut) —— */
.grc-gifts-wrap {
  margin: 0 auto;
  max-width: var(--gr-max-6xl, 72rem);
  padding: 0 1.5rem 5rem;
}

.grc-gift-section {
  margin: 0 0 4rem;
}

.grc-gift-section__title {
  margin: 0 0 1.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--gr-border);
  font-family: var(--gr-font-display);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  text-align: center;
  color: var(--gr-foreground);
}

.grc-gift-section .grc-gifts {
  padding: 0;
  margin: 0;
  max-width: none;
}

/* Clean gift tiles — product-first, no floating white card */
.grc-gift {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--gr-foreground);
  box-shadow: none;
}

.grc-gift__media {
  aspect-ratio: 1 / 1;
  background: color-mix(in srgb, var(--gr-background) 82%, black);
}

.grc-gift__media img {
  object-fit: contain;
  object-position: center;
  background: transparent;
}

.grc-gift__body {
  padding: 1.25rem 0 0;
}

.grc-btn--ghost {
  background: transparent;
  border: 1px solid var(--gr-border);
  color: rgb(247 243 234 / 0.88);
  white-space: normal;
  line-height: 1.35;
  letter-spacing: 0.12em;
  padding: 0.9rem 1rem;
}

.grc-btn--ghost:hover:not(:disabled) {
  background: var(--gr-accent);
  color: var(--gr-accent-foreground);
}
