@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/fonts/cormorant-garamond-normal.woff2') format('woff2');
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
}

@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/fonts/cormorant-garamond-italic.woff2') format('woff2');
  font-style: italic;
  font-weight: 300 700;
  font-display: swap;
}

@font-face {
  font-family: 'Oswald';
  src: url('/fonts/oswald.woff2') format('woff2');
  font-style: normal;
  font-weight: 200 700;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter.woff2') format('woff2');
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --navy: #345761;
  --navy-dark: #19333c;
  --olive: #718b5b;
  --olive-dark: #4f684e;
  --olive-bright: #d0d59c;
  --cream: #fff9e8;
  --paper: rgba(35, 61, 68, 0.96);
  --ink: #f0f1df;
  --line: rgba(255, 249, 232, 0.34);
}

* { box-sizing: border-box; }

.page-transition {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 48%, rgba(113, 139, 91, 0.18), transparent 44%),
    linear-gradient(145deg, #172c35, #274b52 52%, #182d35);
  opacity: 0;
  visibility: hidden;
  transition: opacity 420ms ease, visibility 420ms;
}

.page-transition.is-active {
  opacity: 1;
  visibility: visible;
}

.heart-equation {
  display: block;
  width: min(88vw, 520px);
  height: auto;
  aspect-ratio: 720 / 520;
}

.transition-label {
  color: #f4e6d6;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.35rem;
  font-style: italic;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .page-transition { transition-duration: 0ms; }
}

body {
  position: relative;
  isolation: isolate;
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(37, 60, 67, 0.48), rgba(37, 60, 67, 0.76)),
    url('/images.jpeg') center center / cover no-repeat fixed;
  background-color: var(--navy-dark);
  z-index: 1;
}

body::before,
body::after {
  display: none;
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: '';
}

body::before {
  z-index: 0;
  background:
    linear-gradient(145deg, transparent 0 42%, rgba(76, 92, 44, 0.34) 43% 57%, transparent 58%),
    radial-gradient(ellipse 34% 25% at 7% 78%, rgba(163, 181, 107, 0.2) 0 62%, transparent 64%),
    radial-gradient(ellipse 38% 30% at 31% 70%, rgba(76, 92, 44, 0.38) 0 61%, transparent 63%),
    radial-gradient(ellipse 42% 28% at 62% 73%, rgba(28, 43, 64, 0.55) 0 62%, transparent 64%),
    radial-gradient(ellipse 35% 24% at 91% 72%, rgba(163, 181, 107, 0.18) 0 60%, transparent 62%),
    radial-gradient(ellipse 18% 12% at 24% 61%, rgba(238, 234, 222, 0.2), transparent 70%);
  clip-path: polygon(0 76%, 17% 67%, 31% 73%, 47% 53%, 62% 70%, 79% 58%, 100% 74%, 100% 100%, 0 100%);
  filter: blur(8px);
  opacity: 0.86;
  transform: scale(1.03);
}

body::after {
  z-index: 0;
  background:
    radial-gradient(ellipse 40% 26% at 0% 91%, rgba(10, 18, 30, 0.82) 0 62%, transparent 64%),
    radial-gradient(ellipse 43% 31% at 28% 88%, rgba(28, 43, 64, 0.82) 0 61%, transparent 63%),
    radial-gradient(ellipse 46% 29% at 62% 91%, rgba(10, 18, 30, 0.9) 0 61%, transparent 63%),
    radial-gradient(ellipse 39% 27% at 98% 87%, rgba(28, 43, 64, 0.8) 0 60%, transparent 62%),
    radial-gradient(ellipse 25% 12% at 53% 76%, rgba(122, 140, 74, 0.2), transparent 70%);
  clip-path: polygon(0 86%, 12% 78%, 24% 84%, 38% 69%, 51% 82%, 64% 70%, 77% 84%, 89% 73%, 100% 82%, 100% 100%, 0 100%);
  filter: blur(8px);
  opacity: 0.9;
  transform: scale(1.03);
}

.board {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.board-header {
  text-align: center;
  margin-bottom: 48px;
}

.eyebrow {
  margin: 0 0 6px;
  font-family: 'Oswald', sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--olive-bright);
}

.board-header h1 {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: 3rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0;
  color: var(--cream);
}

.subtitle {
  margin: 8px 0 24px;
  font-size: 1rem;
  color: #e0e4cb;
  text-shadow: 0 1px 3px rgba(25, 51, 60, 0.9);
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.add-btn {
  background: var(--olive);
  color: var(--navy-dark);
  border: none;
  padding: 12px 28px;
  border-radius: 3px;
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, background 0.15s ease;
}

.add-btn:hover {
  transform: translateY(-2px);
  background: var(--olive-bright);
}

.sort-btn {
  background: rgba(25, 51, 60, 0.72);
  color: var(--olive-bright);
  border: 1px solid var(--line);
  padding: 11px 20px;
  border-radius: 3px;
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sort-btn:hover {
  background: var(--olive);
  color: var(--navy-dark);
  border-color: var(--olive);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 28px;
  justify-items: center;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  color: #e0e4cb;
  font-size: 1rem;
  margin-top: 40px;
}

.card {
  width: 100%;
  max-width: 230px;
}

.card-title,
.card-date {
  transition: filter 500ms ease, opacity 500ms ease;
}

.card-covered .card-title,
.card-covered .card-date {
  filter: blur(6px);
  opacity: 0.72;
  user-select: none;
}

@keyframes cardPopIn {
  0% { opacity: 0; transform: translateY(30px) scale(0.85) rotate(-3deg); }
  60% { opacity: 1; transform: translateY(-4px) scale(1.03) rotate(1deg); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); }
}

@keyframes newGlow {
  0% { box-shadow: 0 0 0 5px rgba(163, 181, 107, 0.55), 0 10px 22px rgba(0, 0, 0, 0.35); }
  100% { box-shadow: 0 0 0 0 rgba(163, 181, 107, 0), 0 10px 22px rgba(0, 0, 0, 0.35); }
}

.card.card-enter .polaroid {
  animation: cardPopIn 0.6s cubic-bezier(.22, 1, .36, 1) both,
             newGlow 1.3s ease-out 0.4s both;
}

.polaroid {
  background: var(--paper);
  padding: 0 0 14px;
  width: 230px;
  border-radius: 4px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--olive);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  cursor: pointer;
  overflow: hidden;
}

.polaroid:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.45);
  border-top-color: var(--olive-bright);
}

.photo-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #0f1b2b;
}

.photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scratch-canvas {
  position: absolute;
  inset: 0;
  touch-action: none;
  cursor: crosshair;
  opacity: 1;
  transition: opacity 480ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity;
}

.scratch-canvas.revealing {
  opacity: 0;
  pointer-events: none;
}

.scratch-canvas.hidden {
  display: none;
}

.scratch-hint {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  text-align: center;
  margin: 0;
  color: var(--cream);
  font-family: 'Oswald', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.caption {
  padding: 12px 14px 0;
  text-align: left;
}

.card-title {
  font-family: 'Oswald', sans-serif;
  font-weight: 500;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  margin: 0;
  color: var(--cream);
}

.card-date {
  margin: 4px 0 0;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--olive-bright);
}

.card-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 10px 14px 14px;
}

.icon-btn {
  background: rgba(25, 51, 60, 0.72);
  border: 1px solid var(--line);
  color: var(--olive-bright);
  font-family: 'Oswald', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
  background: var(--olive);
  color: var(--navy-dark);
  border-color: var(--olive);
}

.icon-btn.delete-btn:hover {
  background: #a4453f;
  color: var(--cream);
  border-color: #a4453f;
}

@keyframes cardExit {
  to { opacity: 0; transform: scale(0.82) translateY(12px); }
}

.card.card-exit .polaroid {
  animation: cardExit 0.35s ease both;
}

.card.card-updated .polaroid {
  animation: newGlow 1.3s ease-out both;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 18, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 3px solid var(--olive);
  padding: 28px 26px;
  border-radius: 6px;
  width: 90%;
  max-width: 380px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal h2 {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: 1.4rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 6px;
  color: var(--cream);
  text-align: center;
}

.field-hint {
  margin: -8px 0 0;
  font-size: 0.75rem;
  color: #d8dec2;
  display: none;
}

.field-hint.visible {
  display: block;
}

.modal label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--olive-bright);
}

.modal input,
.modal textarea {
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  padding: 8px 10px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--navy-dark);
  color: var(--ink);
  resize: vertical;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.btn-primary, .btn-secondary {
  border: none;
  padding: 10px 20px;
  border-radius: 3px;
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-primary {
  background: var(--olive);
  color: var(--navy-dark);
}

.btn-primary:hover {
  background: var(--olive-bright);
}

.btn-secondary {
  background: rgba(25, 51, 60, 0.72);
  color: #e0e4cb;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 18, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 20px;
}

.lightbox.hidden { display: none; }

@keyframes overlayFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes lightboxPop {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.lightbox.lightbox-animate {
  animation: overlayFade 0.32s ease-out both;
}

.lightbox.lightbox-animate img {
  animation: lightboxPop 0.48s cubic-bezier(.22, 1, .36, 1) both;
}

.lightbox.lightbox-animate .lightbox-caption {
  animation: captionReveal 0.42s ease-out 0.12s both;
}

.lightbox img {
  max-width: min(90vw, 600px);
  max-height: 65vh;
  border-radius: 4px;
  border: 1px solid var(--line);
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
}

.lightbox-caption {
  color: var(--cream);
  text-align: center;
  max-width: 500px;
  margin-top: 16px;
}

.lightbox-caption h3 {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 1.3rem;
  margin: 0 0 6px;
}

.lightbox-caption p {
  color: #b9c4a8;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 26px;
  background: none;
  border: none;
  color: var(--cream);
  font-size: 2.2rem;
  cursor: pointer;
}

.welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 32px 24px;
  background-color: rgba(8, 16, 25, 0.97);
  background-image: repeating-radial-gradient(circle at 50% 48%, transparent 0 58px, rgba(163, 181, 107, 0.055) 59px 60px, transparent 61px 98px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 600ms ease, visibility 0s linear 600ms;
}

.welcome-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.welcome-overlay:focus {
  outline: none;
}

.welcome-overlay.is-leaving {
  opacity: 0;
  visibility: hidden;
  transition-delay: 0s, 600ms;
}

.welcome-content {
  width: min(860px, 100%);
  display: grid;
  grid-template-columns: minmax(220px, 0.92fr) minmax(280px, 1fr);
  align-items: center;
  gap: 42px;
}

.welcome-bouquet {
  display: block;
  width: min(100%, 370px);
  justify-self: center;
  filter: saturate(0.78) contrast(0.92) brightness(1.04) drop-shadow(0 16px 24px rgba(37, 60, 67, 0.22));
  opacity: 0.94;
}

.welcome-copy {
  opacity: 0;
}

.welcome-overlay.is-visible .welcome-bouquet {
  animation: bouquet-arrive 950ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.welcome-overlay.is-visible .welcome-copy {
  animation: welcome-copy-arrive 650ms ease 280ms both;
}

.welcome-eyebrow {
  margin: 0 0 12px;
  color: #f1a19a;
  font-family: 'Oswald', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
}

.welcome-copy h2 {
  margin: 0;
  color: var(--cream);
  font-family: 'Oswald', sans-serif;
  font-size: 3.2rem;
  font-weight: 600;
  line-height: 1.04;
  text-transform: uppercase;
  white-space: nowrap;
}

.welcome-exclamation {
  position: relative;
  display: inline-block;
  margin-left: -0.02em;
  width: 0.48em;
  height: 1.1em;
  color: #f1a19a;
  vertical-align: -0.02em;
}

.welcome-exclamation::before {
  position: absolute;
  top: 0;
  left: 50%;
  width: 0.14em;
  height: 0.62em;
  border-radius: 999px;
  background: currentColor;
  content: '';
  transform: translateX(-50%);
}

.welcome-heart {
  position: absolute;
  bottom: 0;
  left: 50%;
  color: inherit;
  font-family: sans-serif;
  font-size: 0.34em;
  line-height: 1;
  transform: translateX(-50%);
}

.welcome-message {
  margin: 12px 0 0;
  color: #b9c4a8;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.5rem;
  font-style: italic;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.welcome-continue {
  margin-top: 34px;
  padding: 0 0 7px;
  border: 0;
  border-bottom: 1px solid rgba(163, 181, 107, 0.65);
  background: transparent;
  color: var(--cream);
  font: 600 0.86rem 'Inter', sans-serif;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease;
}

.welcome-continue:hover,
.welcome-continue:focus-visible {
  border-color: #f1a19a;
  color: #f1a19a;
}

@keyframes bouquet-arrive {
  from { opacity: 0; transform: translateY(32px) rotate(-5deg) scale(0.88); }
  to { opacity: 1; transform: translateY(0) rotate(0) scale(1); }
}

@keyframes welcome-copy-arrive {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 620px) {
  .welcome-content {
    width: min(420px, 100%);
    grid-template-columns: 1fr;
    gap: 0;
    text-align: center;
  }

  .welcome-bouquet {
    width: min(240px, 68vw);
    margin-bottom: -8px;
  }

  .welcome-copy h2 {
    font-size: 2.7rem;
  }

  .welcome-continue {
    margin-top: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .welcome-overlay,
  .welcome-bouquet,
  .welcome-copy {
    animation: none;
    transition-duration: 0.01ms;
  }
}

.board-header {
  max-width: 860px;
  margin-right: auto;
  margin-left: auto;
  padding: 28px 32px 26px;
  border: 1px solid rgba(255, 249, 232, 0.72);
  border-bottom: 4px solid var(--olive);
  background: rgba(248, 245, 233, 0.84);
  box-shadow: 0 16px 36px rgba(37, 60, 67, 0.2);
  backdrop-filter: blur(7px);
}

.board-header h1 {
  color: #29474e;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 3.7rem;
  letter-spacing: 0.01em;
  text-transform: none;
}

.subtitle {
  color: #4c6765;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.25rem;
  font-style: italic;
  text-shadow: none;
}

.add-btn {
  background: #607d59;
  color: var(--cream);
  box-shadow: 0 7px 16px rgba(37, 60, 67, 0.24);
}

.add-btn:hover {
  background: #4f6d55;
}

.sort-btn {
  background: rgba(255, 249, 232, 0.84);
  color: #345761;
  border-color: rgba(79, 104, 78, 0.42);
}

.sort-btn:hover {
  background: #718b5b;
  color: var(--cream);
  border-color: #718b5b;
}

.polaroid {
  background: rgba(250, 247, 237, 0.95);
  border-color: rgba(79, 104, 78, 0.38);
  border-top-color: #718b5b;
  box-shadow: 0 12px 26px rgba(37, 60, 67, 0.28);
}

.polaroid:hover {
  box-shadow: 0 18px 34px rgba(37, 60, 67, 0.34);
  border-top-color: #4f684e;
}

.card-title {
  color: #29474e;
}

.card-date {
  color: #607d59;
}

.icon-btn {
  background: rgba(255, 249, 232, 0.7);
  border-color: rgba(79, 104, 78, 0.42);
  color: #4f684e;
}

.icon-btn:hover {
  background: #718b5b;
  color: var(--cream);
  border-color: #718b5b;
}

.empty-state {
  color: #f4efe1;
  text-shadow: 0 1px 3px rgba(37, 60, 67, 0.8);
}

.modal-overlay {
  background: rgba(37, 60, 67, 0.48);
  backdrop-filter: blur(4px);
}

.modal {
  background: rgba(248, 245, 233, 0.97);
  border-color: rgba(79, 104, 78, 0.42);
  border-top-color: #718b5b;
  box-shadow: 0 20px 44px rgba(37, 60, 67, 0.3);
}

.modal h2,
.modal label {
  color: #29474e;
}

.modal input,
.modal textarea {
  background: rgba(255, 255, 250, 0.9);
  border-color: rgba(79, 104, 78, 0.42);
  color: #29474e;
}

.btn-secondary {
  background: rgba(255, 255, 250, 0.9);
  border: 1px solid rgba(79, 104, 78, 0.58);
  color: #29474e;
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  background: #e7ecd5;
  border-color: #4f684e;
  color: #29474e;
}

.lightbox {
  background: rgba(25, 51, 60, 0.88);
}

.welcome-overlay {
  background-color: rgba(248, 245, 233, 0.92);
  background-image:
    linear-gradient(145deg, rgba(248, 245, 233, 0.72), rgba(61, 91, 91, 0.72)),
    url('/images.jpeg');
  background-position: center;
  background-size: cover;
}

.welcome-copy h2 {
  color: #29474e;
}

.welcome-message {
  color: #4c6765;
}

.welcome-continue {
  border-color: rgba(79, 104, 78, 0.65);
  color: #29474e;
}

.welcome-continue:hover,
.welcome-continue:focus-visible {
  border-color: #718b5b;
  color: #4f684e;
}
