/* ===================================================
   Chamilla & Torstein — Wedding Gift Registry
   =================================================== */

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Palette — moody fjord tones + warm gold accent */
  --bg:          #0d1b1e;
  --bg-soft:     #132629;
  --surface:     rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.08);
  --border:      rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  --text:        #e8e4df;
  --text-muted:  #8a9a97;
  --accent:      #c9a96e;
  --accent-soft: rgba(201, 169, 110, 0.15);
  --accent-hover:#dbbf88;
  --reserved:    #4a7c6f;
  --reserved-soft: rgba(74, 124, 111, 0.15);
  --danger:      #c97070;
  --danger-soft:  rgba(201, 112, 112, 0.12);

  /* Type */
  --font-display: 'Cormorant Garamond', 'Georgia', serif;
  --font-body:    'Inter', 'Segoe UI', system-ui, sans-serif;

  /* Misc */
  --radius:  12px;
  --radius-sm: 8px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

/* --- Hero Section --- */
.hero {
  position: relative;
  height: 100vh;
  min-height: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: url('/photo.webp') center/cover no-repeat;
  transform: scale(1.05);
  animation: heroZoom 20s ease-in-out infinite alternate;
}

@keyframes heroZoom {
  from { transform: scale(1.05); }
  to   { transform: scale(1.12); }
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom,
      rgba(13, 27, 30, 0.3) 0%,
      rgba(13, 27, 30, 0.15) 40%,
      rgba(13, 27, 30, 0.5) 70%,
      rgba(13, 27, 30, 0.92) 100%
    );
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 0 24px;
  animation: fadeUp 1.2s ease-out both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-pre {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.hero-names {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 8vw, 5.5rem);
  font-weight: 300;
  line-height: 1.15;
  color: var(--text);
  letter-spacing: 0.01em;
}

.hero-names .amp {
  display: block;
  font-style: italic;
  font-size: 0.5em;
  color: var(--accent);
  margin: 4px 0;
}

.hero-ornament {
  font-size: 0.7rem;
  letter-spacing: 0.6em;
  color: var(--accent);
  margin: 20px 0;
  opacity: 0.7;
}

.hero-sub {
  font-family: var(--font-display);
  font-size: clamp(1rem, 2.5vw, 1.35rem);
  font-weight: 300;
  font-style: italic;
  color: var(--text-muted);
}

/* Scroll cue */
.scroll-cue {
  position: absolute;
  bottom: 32px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  animation: fadeUp 1.2s ease-out 0.6s both;
  transition: color var(--transition);
}

.scroll-cue:hover {
  color: var(--accent);
}

.scroll-cue svg {
  animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(6px); }
}

/* --- Gifts Section --- */
.gifts {
  max-width: 1100px;
  margin: 0 auto;
  padding: 80px 24px 60px;
}

.gifts-header {
  text-align: center;
  margin-bottom: 56px;
  animation: fadeUp 0.8s ease-out both;
}

.gifts-header h2 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 400;
  color: var(--text);
  margin-bottom: 16px;
}

.gifts-header p {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.7;
}

/* Grid */
.gifts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

/* --- Gift Card --- */
.gift-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px 24px;
  display: flex;
  flex-direction: column;
  transition:
    background var(--transition),
    border-color var(--transition),
    transform var(--transition),
    box-shadow var(--transition);
  opacity: 0;
  animation: cardIn 0.5s ease-out forwards;
}

.gift-card:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

/* Staggered entrance — set by JS via --i custom property */
.gift-card {
  animation-delay: calc(var(--i, 0) * 0.07s);
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Card top row */
.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-emoji {
  font-size: 1.8rem;
  line-height: 1;
}

.card-badge {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.card-badge.reserved {
  background: var(--reserved-soft);
  color: var(--reserved);
}

.card-badge.mine {
  background: var(--accent-soft);
  color: var(--accent);
}

.card-badge.partial {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Quantity selector */
.qty-select-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.qty-select {
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 32px 6px 12px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'><path d='M1 1L5 5L9 1' stroke='%238a9a97' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color var(--transition);
}

.qty-select:hover {
  border-color: var(--border-hover);
}

.qty-select:focus {
  border-color: var(--accent);
}

/* Card body */
.card-name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

.card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  flex: 1;
}

/* Card actions */
.card-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition:
    background var(--transition),
    color var(--transition),
    transform 0.15s ease,
    box-shadow var(--transition);
  text-decoration: none;
}

.btn:active {
  transform: scale(0.97);
}

/* Reserve button */
.btn-reserve {
  background: var(--accent);
  color: var(--bg);
}

.btn-reserve:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 20px rgba(201, 169, 110, 0.3);
}

/* Unreserve button */
.btn-unreserve {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(201, 112, 112, 0.2);
}

.btn-unreserve:hover {
  background: rgba(201, 112, 112, 0.2);
}

/* Disabled / reserved by someone else */
.btn-disabled {
  background: var(--reserved-soft);
  color: var(--reserved);
  cursor: default;
  pointer-events: none;
  opacity: 0.7;
}

/* Link button */
.btn-link {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-size: 0.8rem;
}

.btn-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Loading spinner on buttons */
.btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.btn.loading::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Bottom note --- */
.gifts-note {
  text-align: center;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.gifts-note p {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

/* --- Contributions Section --- */
.contrib-header {
  text-align: center;
  margin-top: 64px;
  margin-bottom: 40px;
  padding-top: 48px;
  border-top: 1px solid var(--border);
}

.contrib-header h2 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 400;
  color: var(--text);
  margin-bottom: 12px;
}

.contrib-header p {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.7;
}

.contrib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* Contribution card overrides */
.contrib-card {
  border-left: 3px solid var(--accent);
  text-align: center;
  align-items: center;
}

.contrib-card .card-emoji {
  font-size: 2.2rem;
  margin-bottom: 4px;
}

.contrib-card .card-desc {
  margin-bottom: 0;
}

/* --- Footer --- */
.footer {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* --- Toast notification --- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  font-size: 0.85rem;
  z-index: 1000;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  border-color: rgba(201, 112, 112, 0.3);
  color: var(--danger);
}

/* --- Responsive --- */
@media (max-width: 680px) {
  .hero {
    min-height: 500px;
  }

  .gifts {
    padding: 60px 16px 40px;
  }

  .gifts-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .gift-card {
    padding: 22px 20px 20px;
  }
}
