:root {
  color-scheme: light;
  --ink: #221c26;
  --muted: #6c5961;
  --paper: #fff7ed;
  --paper-strong: #fffdf8;
  --rose: #b44863;
  --wine: #762d45;
  --navy: #17223d;
  --gold: #d8a348;
  --green: #637a54;
  --sky: #9cc8d5;
  --shadow: 0 18px 45px rgba(29, 21, 34, 0.28);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--navy);
}

body {
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  background: var(--navy);
}

button {
  font: inherit;
}

.background {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(23, 34, 61, 0.28), rgba(34, 28, 38, 0.34)),
    url("assets/paris-collage.png") center top / cover no-repeat;
  transform: translateZ(0);
}

.background::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(90deg, rgba(23, 34, 61, 0.36), rgba(255, 247, 237, 0.08), rgba(23, 34, 61, 0.32)),
    linear-gradient(180deg, rgba(23, 34, 61, 0.08), rgba(23, 34, 61, 0.46) 82%);
}

.app {
  position: relative;
  z-index: 1;
  width: min(100%, 540px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
}

.masthead {
  padding: 8px 8px 9px;
  color: var(--paper-strong);
  text-shadow: 0 2px 14px rgba(23, 34, 61, 0.72);
}

.eyebrow {
  margin: 0 0 4px;
  color: #f2d38c;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  max-width: 100%;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.85rem, 9.6vw, 3rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.trip-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  font-size: 0.68rem;
  font-weight: 700;
}

.trip-meta span {
  border: 1px solid rgba(255, 247, 237, 0.42);
  border-radius: 7px;
  padding: 5px 7px;
  background: rgba(23, 34, 61, 0.42);
  backdrop-filter: blur(12px);
}

.calendar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-height: calc(100svh - 145px);
  align-content: space-evenly;
  justify-items: center;
  column-gap: clamp(9px, 3vw, 18px);
  row-gap: clamp(8px, 2.8svh, 22px);
  padding: 2px 0 0;
}

.door {
  position: relative;
  width: min(100%, 72px);
  height: clamp(70px, 11.6svh, 96px);
  min-height: 0;
  border: 0;
  border-radius: 38px 38px 8px 8px;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
  text-align: left;
  backdrop-filter: none;
  transform-style: preserve-3d;
  --door-a: #94516a;
  --door-b: #6d2b43;
  --door-trim: rgba(255, 235, 196, 0.48);
  --door-shadow: rgba(55, 20, 35, 0.42);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.door:focus-visible {
  outline: 3px solid #f4ca6c;
  outline-offset: 3px;
}

.door:not(:disabled):active {
  transform: translateY(2px) scale(0.99);
}

.door.is-locked {
  color: rgba(34, 28, 38, 0.62);
}

.door.is-locked::after {
  position: absolute;
  inset: 0;
  content: "";
  border-radius: inherit;
  background: rgba(23, 34, 61, 0.12);
}

.door.is-open {
  background: transparent;
}

.door-panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px 7px 7px;
  background:
    radial-gradient(circle at 76% 63%, rgba(246, 200, 112, 0.9) 0 3px, transparent 4px),
    linear-gradient(90deg, transparent calc(50% - 1px), rgba(255, 244, 219, 0.28) 50%, transparent calc(50% + 1px)),
    linear-gradient(115deg, rgba(255, 255, 255, 0.18), transparent 31%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 18px),
    linear-gradient(145deg, var(--door-a), var(--door-b));
  border: 2px solid rgba(54, 31, 34, 0.28);
  border-radius: 34px 34px 7px 7px;
  box-shadow:
    0 10px 18px rgba(15, 13, 20, 0.28),
    inset 0 0 0 2px rgba(255, 253, 248, 0.18),
    inset 0 17px 34px rgba(255, 252, 236, 0.12),
    inset 0 -20px 32px var(--door-shadow);
  color: var(--paper-strong);
  transform-origin: left center;
  transition:
    transform 680ms cubic-bezier(0.18, 0.78, 0.19, 1),
    opacity 480ms ease;
  z-index: 2;
}

.door:nth-child(3n + 2) .door-panel {
  --door-a: #283a5d;
  --door-b: #15213b;
  --door-shadow: rgba(9, 15, 31, 0.48);
}

.door:nth-child(4n) .door-panel {
  --door-a: #667b5c;
  --door-b: #31534c;
  --door-shadow: rgba(22, 52, 41, 0.44);
}

.door:nth-child(5n) .door-panel {
  --door-a: #c99c55;
  --door-b: #8a5530;
  --door-shadow: rgba(87, 46, 25, 0.44);
}

.door.is-open .door-panel {
  opacity: 0;
  pointer-events: none;
  transform: perspective(620px) rotateY(-86deg);
}

.door-panel::before,
.door-panel::after {
  position: absolute;
  content: "";
}

.door-panel::before {
  inset: 25px 8px 22px;
  border: 1px solid var(--door-trim);
  border-radius: 27px 27px 6px 6px;
  background:
    linear-gradient(90deg, transparent calc(50% - 1px), var(--door-trim) 50%, transparent calc(50% + 1px)),
    linear-gradient(180deg, transparent 48%, var(--door-trim) 49% 50%, transparent 51%);
  box-shadow:
    inset 0 0 0 5px rgba(34, 24, 29, 0.08),
    0 1px 0 rgba(255, 253, 248, 0.18);
}

.door-panel::after {
  right: 15px;
  bottom: 35%;
  width: 7px;
  height: 7px;
  border: 1px solid rgba(90, 55, 16, 0.42);
  border-radius: 999px;
  background: radial-gradient(circle at 32% 30%, #fff1a8, #d4a040 46%, #876026 100%);
  box-shadow: 0 0 0 2px rgba(46, 26, 18, 0.18);
}

.door-date {
  position: relative;
  z-index: 1;
  max-width: 100%;
  align-self: flex-start;
  border-radius: 6px;
  padding: 3px 4px;
  background: rgba(22, 20, 23, 0.18);
  font-size: clamp(0.47rem, 2vw, 0.58rem);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
}

.door-status {
  position: relative;
  z-index: 1;
  align-self: flex-start;
  border-radius: 6px;
  padding: 4px 5px;
  border: 1px solid rgba(255, 253, 248, 0.28);
  background: rgba(22, 20, 23, 0.2);
  font-size: clamp(0.48rem, 2.1vw, 0.6rem);
  font-weight: 900;
  line-height: 1;
}

.message-preview {
  display: flex;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
  border: 1px solid rgba(255, 253, 248, 0.72);
  border-radius: 34px 34px 7px 7px;
  padding: 8px 7px 7px;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.88), rgba(255, 247, 237, 0.75)),
    radial-gradient(circle at top right, rgba(156, 200, 213, 0.42), transparent 46%);
  box-shadow: 0 10px 18px rgba(15, 13, 20, 0.22);
}

.message-preview p {
  margin: 0;
}

.preview-kicker {
  color: var(--wine);
  font-size: clamp(0.48rem, 2.1vw, 0.6rem);
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.preview-title {
  display: -webkit-box;
  margin-top: 2px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(0.58rem, 2.6vw, 0.78rem);
  font-weight: 700;
  line-height: 0.96;
}

.preview-line {
  display: none;
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.35;
}

.locked-note {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100%;
  min-height: 0;
  align-items: end;
  border-radius: 34px 34px 7px 7px;
  padding: 8px 7px 7px;
  color: rgba(255, 253, 248, 0.94);
  background: linear-gradient(180deg, rgba(23, 34, 61, 0.16), rgba(23, 34, 61, 0.68));
  font-size: 0.56rem;
  font-weight: 800;
  line-height: 1.3;
  text-shadow: 0 1px 8px rgba(23, 34, 61, 0.82);
}

.message-modal {
  --modal-start-x: 0px;
  --modal-start-y: 0px;
  --modal-start-scale-x: 0.45;
  --modal-start-scale-y: 0.45;
  width: min(calc(100% - 28px), 470px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  position: relative;
  overflow: hidden;
  color: var(--ink);
  background: var(--paper-strong);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.44);
  opacity: 0;
  filter: saturate(0.92) blur(1px);
  transform-style: preserve-3d;
  transform-origin: center center;
  transform: translate(var(--modal-start-x), var(--modal-start-y))
    scale(var(--modal-start-scale-x), var(--modal-start-scale-y)) rotateY(-18deg) rotateX(4deg);
  will-change: opacity, transform;
}

.message-modal::before {
  position: absolute;
  inset: 0;
  z-index: 3;
  content: "";
  background: linear-gradient(
    115deg,
    transparent 0 38%,
    rgba(255, 238, 190, 0.46) 45%,
    rgba(255, 255, 255, 0.72) 50%,
    rgba(255, 238, 190, 0.34) 55%,
    transparent 62% 100%
  );
  opacity: 0;
  pointer-events: none;
  transform: translateX(-120%);
}

.message-modal::backdrop {
  background: rgba(23, 34, 61, 0);
  backdrop-filter: blur(0);
}

.message-modal.is-opening {
  animation: modal-zoom-in 1180ms cubic-bezier(0.14, 0.88, 0.18, 1) both;
}

.message-modal.is-opening::before {
  animation: modal-light-sweep 1180ms cubic-bezier(0.2, 0.82, 0.2, 1) both;
}

.message-modal.is-opening::backdrop {
  animation: backdrop-fade-in 1180ms ease both;
}

.message-modal.is-closing {
  animation: modal-zoom-out 780ms cubic-bezier(0.5, 0, 0.2, 1) both;
}

.message-modal.is-closing::backdrop {
  animation: backdrop-fade-out 780ms ease both;
}

.modal-art {
  height: 128px;
  background:
    linear-gradient(180deg, rgba(23, 34, 61, 0), rgba(255, 253, 248, 0.88)),
    url("assets/paris-collage.png") center 24% / cover no-repeat;
}

.message-modal .modal-art,
.message-modal .modal-date,
.message-modal h2,
.message-modal .modal-message,
.message-modal .modal-close {
  position: relative;
  z-index: 2;
}

.message-modal.is-opening .modal-art {
  animation: content-rise 720ms 360ms cubic-bezier(0.18, 0.86, 0.2, 1) both;
}

.message-modal.is-opening .modal-date {
  animation: content-rise 680ms 500ms cubic-bezier(0.18, 0.86, 0.2, 1) both;
}

.message-modal.is-opening h2 {
  animation: content-rise 700ms 600ms cubic-bezier(0.18, 0.86, 0.2, 1) both;
}

.message-modal.is-opening .modal-message {
  animation: content-rise 700ms 700ms cubic-bezier(0.18, 0.86, 0.2, 1) both;
}

.message-modal.is-opening .modal-close {
  animation: content-rise 620ms 820ms cubic-bezier(0.18, 0.86, 0.2, 1) both;
}

.message-modal.is-closing .modal-art,
.message-modal.is-closing .modal-date,
.message-modal.is-closing h2,
.message-modal.is-closing .modal-message,
.message-modal.is-closing .modal-close {
  animation: content-fade-out 300ms ease both;
}

@keyframes modal-zoom-in {
  from {
    opacity: 0;
    filter: saturate(0.75) blur(2.5px);
    transform: translate(var(--modal-start-x), var(--modal-start-y))
      scale(var(--modal-start-scale-x), var(--modal-start-scale-y)) rotateY(-24deg) rotateX(6deg)
      rotate(-1deg);
    border-radius: 34px 34px 7px 7px;
    box-shadow: 0 10px 18px rgba(15, 13, 20, 0.22);
  }

  38% {
    opacity: 0.86;
    filter: saturate(0.9) blur(0.8px);
    transform: translate(calc(var(--modal-start-x) * 0.34), calc(var(--modal-start-y) * 0.34))
      scale(0.82, 0.82) rotateY(-9deg) rotateX(2deg) rotate(-0.4deg);
    border-radius: 24px 24px 8px 8px;
  }

  78% {
    opacity: 1;
    filter: saturate(1.03) blur(0);
    transform: translate(0, 0) scale(1.024, 1.024) rotateY(1.4deg) rotateX(0) rotate(0);
    border-radius: 8px;
  }

  to {
    opacity: 1;
    filter: saturate(1) blur(0);
    transform: translate(0, 0) scale(1, 1);
    border-radius: 8px;
    box-shadow: 0 26px 80px rgba(0, 0, 0, 0.44);
  }
}

@keyframes modal-zoom-out {
  from {
    opacity: 1;
    filter: saturate(1) blur(0);
    transform: translate(0, 0) scale(1, 1);
  }

  28% {
    opacity: 0.92;
    transform: translate(0, 0) scale(0.985, 0.985) rotateY(-2deg);
  }

  to {
    opacity: 0;
    filter: saturate(0.78) blur(2px);
    transform: translate(var(--modal-start-x), var(--modal-start-y))
      scale(var(--modal-start-scale-x), var(--modal-start-scale-y)) rotateY(18deg) rotateX(4deg)
      rotate(-0.8deg);
    border-radius: 34px 34px 7px 7px;
  }
}

@keyframes modal-light-sweep {
  0%,
  30% {
    opacity: 0;
    transform: translateX(-120%);
  }

  48% {
    opacity: 1;
  }

  78% {
    opacity: 0.26;
    transform: translateX(120%);
  }

  100% {
    opacity: 0;
    transform: translateX(120%);
  }
}

@keyframes content-rise {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes content-fade-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes backdrop-fade-in {
  from {
    background: rgba(23, 34, 61, 0);
    backdrop-filter: blur(0);
  }

  to {
    background: rgba(23, 34, 61, 0.68);
    backdrop-filter: blur(5px);
  }
}

@keyframes backdrop-fade-out {
  from {
    background: rgba(23, 34, 61, 0.68);
    backdrop-filter: blur(5px);
  }

  to {
    background: rgba(23, 34, 61, 0);
    backdrop-filter: blur(0);
  }
}

.modal-date,
.message-modal h2,
.modal-message {
  margin-right: 18px;
  margin-left: 18px;
}

.modal-date {
  margin-top: 0;
  margin-bottom: 8px;
  color: var(--rose);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.message-modal h2 {
  margin-top: 0;
  margin-bottom: 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.75rem;
  line-height: 1;
}

.modal-message {
  margin-top: 0;
  color: #3e3238;
  font-size: 1rem;
  line-height: 1.55;
}

.modal-close {
  position: relative;
  z-index: 4;
  width: calc(100% - 36px);
  margin: 8px 18px 18px;
  border: 0;
  border-radius: 8px;
  padding: 13px 16px;
  color: var(--paper-strong);
  background: var(--navy);
  font-weight: 900;
}

.fireworks-canvas {
  position: fixed;
  inset: 0;
  z-index: 5;
  width: 100vw;
  height: 100vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.fireworks-canvas.is-active {
  opacity: 1;
  background: rgba(9, 13, 31, 0.18);
}

@media (min-width: 460px) {
  .app {
    padding-right: 12px;
    padding-left: 12px;
  }

  .calendar {
    gap: 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
