:root {
  color-scheme: dark;
  --navy-900: oklch(15% 0.065 267);
  --navy-800: oklch(20% 0.082 263);
  --navy-700: oklch(27% 0.11 258);
  --blue-600: oklch(48% 0.145 244);
  --cyan-500: oklch(66% 0.135 219);
  --aqua-300: oklch(83% 0.083 199);
  --aqua-100: oklch(94% 0.033 190);
  --button-blue: oklch(46% 0.17 248);
  --button-blue-light: oklch(74% 0.12 206);
  --paper: oklch(96% 0.013 204);
  --paper-shadow: oklch(79% 0.02 214);
  --ink: oklch(22% 0.055 258);
  --ink-soft: oklch(35% 0.058 252);
  --line: oklch(70% 0.035 215 / 0.62);
  --focus: oklch(77% 0.132 198);
  --font-display: "Chakra Petch", "Arial Narrow", sans-serif;
  --font-body: "Manrope", system-ui, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --open-left: 72vw;
  --open-top: 78vh;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background:
    linear-gradient(130deg, var(--navy-800), var(--navy-900) 48%, oklch(13% 0.07 272));
  color: var(--paper);
  font-family: var(--font-body);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

::selection {
  background: var(--cyan-500);
  color: var(--navy-900);
}

.invitation {
  position: fixed;
  inset: 0;
  isolation: isolate;
  overflow: hidden;
  background: var(--navy-900);
}

.book-video {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--navy-900);
}

.stage-atmosphere {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0.56;
}

.grid-field {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, oklch(72% 0.08 205 / 0.08) 1px, transparent 1px),
    linear-gradient(0deg, oklch(72% 0.08 205 / 0.06) 1px, transparent 1px);
  background-size: 84px 84px;
  mask-image: linear-gradient(180deg, transparent 0 14%, oklch(0% 0 0) 42%, transparent 86%);
  transform: perspective(900px) rotateX(62deg) translateY(35%);
  transform-origin: 50% 100%;
}

.scan-field {
  position: absolute;
  inset: -10% 0;
  background:
    repeating-linear-gradient(
      180deg,
      oklch(88% 0.07 200 / 0.08) 0,
      oklch(88% 0.07 200 / 0.08) 1px,
      transparent 1px,
      transparent 7px
    );
  opacity: 0.25;
  animation: scan 8s linear infinite;
}

.open-book,
.submit-rsvp {
  position: relative;
  z-index: 0;
  border: 0;
  border-radius: 0;
  color: var(--paper);
  background: transparent;
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  transition: filter 180ms var(--ease-out);
}

.open-book::before,
.open-book::after,
.submit-rsvp::before,
.submit-rsvp::after {
  content: "";
  position: absolute;
  border: 3px solid var(--navy-900);
  border-radius: 4px;
}

.open-book::before,
.submit-rsvp::before {
  top: -10px;
  right: -10px;
  z-index: -1;
  width: 86px;
  height: 28px;
  background: var(--button-blue-light);
}

.open-book::after,
.submit-rsvp::after {
  inset: 0;
  z-index: 1;
  background: var(--button-blue);
  box-shadow:
    0 13px 0 var(--navy-900),
    0 25px 34px oklch(7% 0.05 266 / 0.32);
}

.open-book > span,
.submit-rsvp > span {
  position: relative;
  z-index: 2;
}

.open-book:hover,
.submit-rsvp:hover {
  filter: brightness(1.04) saturate(1.06);
}

.open-book {
  position: absolute;
  left: var(--open-left);
  top: var(--open-top);
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 176px;
  min-height: 62px;
  padding: 13px 25px;
  font-size: clamp(1.06rem, 1.74vw, 1.49rem);
  opacity: 0;
  transform: translate(-50%, -44%) scale(0.94);
  animation: open-button-appear 900ms var(--ease-out) 520ms forwards;
}

.open-book:focus-visible,
.submit-rsvp:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.invitation[data-state="opening"] .open-book,
.invitation[data-state="open"] .open-book {
  animation: none;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -46%) scale(0.96);
}

.book-content {
  position: absolute;
  left: var(--content-left);
  top: var(--content-top);
  z-index: 3;
  width: var(--content-width);
  height: var(--content-height);
  color: var(--ink);
  pointer-events: none;
  opacity: 0;
  filter: blur(7px);
  transform: translateY(26px) scale(0.982);
  transition:
    opacity 1300ms var(--ease-out),
    filter 1500ms var(--ease-out),
    transform 1500ms var(--ease-out);
}

.invitation[data-state="open"] .book-content {
  pointer-events: auto;
  opacity: 1;
  filter: blur(0);
  transform: translateY(0) scale(1);
}

.sheet {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(18px, 2.15vw, 30px);
  width: 100%;
  height: 100%;
  padding: clamp(18px, 2.65vw, 38px);
  overflow: auto;
  scrollbar-width: none;
}

.sheet::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.invite-copy {
  display: grid;
  align-content: start;
  text-align: justify;
  gap: 0;
  min-width: 0;
  padding: clamp(9px, 1.05vw, 15px) clamp(5px, 0.8vw, 10px) clamp(5px, 0.8vw, 10px);
}

.invite-copy > .eyebrow,
.invite-copy > h1,
.subtitle,
.invite-body,
.event-details,
.closing,
.attendance-form {
  opacity: 0;
  filter: blur(5px);
  transform: translateY(15px);
  transition:
    opacity 720ms var(--ease-out),
    filter 920ms var(--ease-out),
    transform 920ms var(--ease-out);
}

.invitation[data-state="open"] .invite-copy > .eyebrow,
.invitation[data-state="open"] .invite-copy > h1,
.invitation[data-state="open"] .subtitle,
.invitation[data-state="open"] .invite-body,
.invitation[data-state="open"] .event-details,
.invitation[data-state="open"] .closing,
.invitation[data-state="open"] .attendance-form {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0);
}

.invitation[data-state="open"] .invite-copy > .eyebrow {
  transition-delay: 90ms;
}

.invitation[data-state="open"] .invite-copy > h1 {
  transition-delay: 180ms;
}

.invitation[data-state="open"] .subtitle {
  transition-delay: 290ms;
}

.invitation[data-state="open"] .invite-body--intro {
  transition-delay: 430ms;
}

.invitation[data-state="open"] .invite-body--funding {
  transition-delay: 550ms;
}

.invitation[data-state="open"] .event-details {
  transition-delay: 690ms;
}

.invitation[data-state="open"] .closing {
  transition-delay: 820ms;
}

.invitation[data-state="open"] .attendance-form {
  transition-delay: 960ms;
}

.eyebrow {
  margin: 0;
  color: var(--blue-600);
  font-family: var(--font-display);
  font-size: clamp(0.9rem, 1.02vw, 1rem);
  font-weight: 800;
  line-height: 1.1;
}

h1,
h2,
p,
dl {
  margin: 0;
}

h1 {
  color: var(--navy-800);
  font-family: var(--font-display);
  font-size: clamp(2.9rem, 4.9vw, 5rem);
  font-weight: 700;
  line-height: 0.84;
  margin-top: clamp(3px, 0.35vw, 6px);
}

.subtitle {
  justify-self: start;
  margin-top: clamp(5px, 0.55vw, 8px);
  margin-bottom: clamp(13px, 1.45vw, 20px);
  color: var(--cyan-500);
  border: 3px solid var(--navy-900);
  border-radius: 4px;
  padding: 5px 10px 6px;
  background: var(--aqua-300);
  box-shadow: 5px 5px 0 var(--navy-900);
  font-family: var(--font-display);
  font-size: clamp(0.92rem, 1.25vw, 1.25rem);
  font-weight: 800;
  line-height: 1;
  color: var(--navy-900);
}

.invite-copy p:not(.eyebrow):not(.subtitle):not(.closing) {
  color: var(--ink-soft);
  font-size: clamp(1rem, 1.14vw, 1.12rem);
  font-weight: 800;
  line-height: 1.42;
}

.invite-body + .invite-body {
  margin-top: clamp(9px, 1vw, 14px);
}

.event-details {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 13px 16px;
  margin-top: clamp(15px, 1.7vw, 24px);
  padding-top: 0;
  border-top: 0;
}

.event-details div:last-child {
  grid-column: 1 / -1;
}

.event-details div {
  position: relative;
  border: 3px solid var(--navy-900);
  border-radius: 4px;
  padding: 15px 14px 12px;
  background: oklch(97% 0.018 198);
  box-shadow: 7px 7px 0 var(--aqua-300);
}

dt {
  position: absolute;
  top: -13px;
  left: 10px;
  color: var(--blue-600);
  border: 3px solid var(--navy-900);
  border-radius: 3px;
  padding: 2px 7px 3px;
  background: var(--aqua-300);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1;
}

dd {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(1.06rem, 1.32vw, 1.32rem);
  font-weight: 800;
  line-height: 1.08;
}

.closing {
  margin-top: clamp(16px, 1.85vw, 26px);
  color: var(--navy-800);
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 1.55vw, 1.55rem);
  font-weight: 800;
  line-height: 1.15;
}

.attendance-form {
  display: grid;
  align-content: start;
  gap: clamp(11px, 1.16vw, 15px);
  min-width: 0;
  margin: clamp(16px, 1.8vw, 24px) clamp(5px, 0.8vw, 10px) 0;
  padding-top: clamp(13px, 1.45vw, 18px);
  border-top: 3px solid var(--navy-900);
}

.form-heading {
  display: grid;
  gap: 3px;
  margin-bottom: 1px;
}

h2 {
  color: var(--navy-800);
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.1vw, 2.12rem);
  font-weight: 800;
  line-height: 0.98;
}

label {
  display: grid;
  gap: 7px;
  color: var(--blue-600);
  font-family: var(--font-display);
  font-size: clamp(1rem, 1.08vw, 1.06rem);
  font-weight: 800;
  line-height: 1.1;
}

input,
select,
textarea {
  width: 100%;
  border: 3px solid var(--navy-900);
  border-radius: 4px;
  font-size: 1rem;
  padding: 11px 12px;
  color: var(--ink);
  background: oklch(98% 0.015 198);
  box-shadow: 6px 6px 0 oklch(76% 0.08 205 / 0.55);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--blue-600);
  box-shadow:
    6px 6px 0 oklch(76% 0.08 205 / 0.55),
    0 0 0 4px oklch(74% 0.12 206 / 0.24);
}

textarea {
  resize: vertical;
  min-height: 76px;
}

.submit-rsvp {
  min-height: 48px;
  padding: 11px 14px;
  font-size: clamp(0.94rem, 1.28vw, 1.18rem);
}

.attendance-form.is-submitting .submit-rsvp:disabled {
  cursor: wait;
  filter: saturate(0.82) brightness(0.94);
}

.attendance-form.is-submitted .submit-rsvp:disabled {
  cursor: default;
}

.attendance-form.is-submitting .submit-rsvp::after {
  background:
    linear-gradient(
      110deg,
      var(--button-blue) 0 38%,
      oklch(58% 0.16 232) 45% 55%,
      var(--button-blue) 62% 100%
    );
  background-size: 220% 100%;
  animation: loading-sweep 900ms linear infinite;
}

.form-status {
  min-height: 1.3em;
  color: var(--blue-600);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.35;
}

@keyframes scan {
  to {
    transform: translateY(7px);
  }
}

@keyframes open-button-appear {
  0% {
    opacity: 0;
    filter: blur(5px);
    transform: translate(-50%, -40%) scale(0.92);
  }

  100% {
    opacity: 1;
    filter: blur(0);
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes loading-sweep {
  to {
    background-position: -220% 0;
  }
}

@media (max-width: 760px) {
  .stage-atmosphere {
    opacity: 0.38;
  }

  .open-book {
    min-width: 132px;
    min-height: 54px;
    padding: 10px 17px;
    font-size: 0.875rem;
  }

  .book-content {
    transform: translateY(20px) scale(0.988);
  }

  .sheet {
    grid-template-columns: 1fr;
    gap: 13px;
    padding: clamp(15px, 4.5vw, 24px);
  }

  .invite-copy {
    padding: 5px 0 0;
  }

  .eyebrow {
    font-size: 0.875rem;
  }

  h1 {
    font-size: clamp(2.1rem, 10.5vw, 3.05rem);
    margin-top: 3px;
  }

  .subtitle {
    font-size: 0.875rem;
    margin-top: 4px;
    margin-bottom: 10px;
  }

  .invite-copy p:not(.eyebrow):not(.subtitle):not(.closing) {
    font-size: 0.875rem;
    line-height: 1.36;
  }

  .event-details {
    gap: 12px 9px;
    margin-top: 14px;
  }

  .event-details div {
    padding: 13px 10px 10px;
    box-shadow: 5px 5px 0 var(--aqua-300);
  }

  dt {
    top: -11px;
    left: 8px;
    padding: 2px 6px;
    font-size: 0.75rem;
  }

  label {
    font-size: 0.875rem;
  }

  dd,
  .closing,
  .form-status {
    font-size: 0.875rem;
  }

  dd {
    line-height: 1.08;
  }

  .closing {
    margin-top: 14px;
  }

  .attendance-form {
    gap: 11px;
    margin: 14px 0 0;
    padding-top: 12px;
  }

  h2 {
    font-size: clamp(1.18rem, 6vw, 1.68rem);
  }

  input,
  select,
  textarea {
    font-size: 1rem;
    padding: 9px 10px;
  }

  .submit-rsvp {
    min-height: 42px;
    padding: 9px 12px;
    font-size: 0.875rem;
  }
}

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