/* =====================================================================
   Eric & Kenzie · Engagement Invitation
   ===================================================================== */

:root {
  --paper:        #f1ebde;
  --paper-warm:   #f6f0e2;
  --paper-edge:   #e2d9c3;
  --ink:          #141414;
  --ink-soft:     #2a2a2a;
  --ink-muted:    #6b665f;
  --hairline:     #c9bcab;

  --env-light:    #1a1a1a;
  --env-mid:      #0e0e0e;
  --env-deep:     #000000;
  --env-shadow:   rgba(0, 0, 0, 0.45);
  --seal-color:   #cdbf9c;
  --seal-deep:    #a89572;

  --accent:       #141414;
  --error:        #a23a2a;

  --ease:         cubic-bezier(.2,.7,.2,1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--ink);
  font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 300;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100svh;
  overflow-x: hidden;

  background-color: var(--paper);
  background-image: url('background.jpeg');
  background-size: auto 75vh;
  background-position: top center;
  background-repeat: no-repeat;
  background-attachment: scroll;
}

body.locked { overflow: hidden; }

/* Subtle paper texture overlay across whole page */
.paper-grain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: multiply;
  opacity: 0.55;
}

/* =====================================================================
   ENVELOPE STAGE
   ===================================================================== */

.envelope-stage {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 24px;
  z-index: 50;
  transition: opacity 0.7s var(--ease), visibility 0.7s var(--ease);
  background-color: var(--paper);
  background-image: url('background.jpeg');
  background-size: auto 75vh;
  background-position: top center;
  background-repeat: no-repeat;
}

.envelope-stage.is-gone {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.envelope-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.42em;
  font-size: 10.5px;
  color: var(--ink);
  margin: 0;
  padding-left: 0.42em;
  animation: fadeIn 0.9s var(--ease) 0.25s both;
  text-shadow: 0 1px 8px rgba(241,235,222,0.6);
}

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

.envelope-wrap {
  perspective: 1600px;
  animation: fadeIn 1s var(--ease) 0.4s both;
}

.envelope {
  position: relative;
  width: min(82vw, 380px);
  aspect-ratio: 1.55 / 1;
  cursor: pointer;
  filter: drop-shadow(0 28px 38px var(--env-shadow));
  transition: transform 0.4s var(--ease);
}

.envelope:hover { transform: translateY(-3px) rotate(-0.4deg); }
.envelope:focus-visible { outline: none; }
.envelope:focus-visible::after {
  content: "";
  position: absolute;
  inset: -10px;
  border: 1px dashed var(--ink-muted);
  border-radius: 10px;
}

.env-back, .env-body, .env-flap, .env-card-peek {
  position: absolute;
  inset: 0;
}

.env-back {
  background:
    linear-gradient(135deg, var(--env-light) 0%, var(--env-mid) 100%);
  border-radius: 4px;
  box-shadow:
    inset 0 0 0 1px rgba(120, 95, 55, 0.18),
    inset 0 -20px 30px rgba(120, 95, 55, 0.10);
}

.env-body {
  background:
    linear-gradient(180deg, var(--env-mid) 0%, var(--env-deep) 100%);
  clip-path: polygon(0 50%, 50% 100%, 100% 50%, 100% 100%, 0 100%);
  border-radius: 0 0 4px 4px;
  z-index: 3;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}
.env-body::after {
  /* center triangle seam */
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, transparent 49.6%, rgba(0,0,0,0.05) 50%, transparent 50.4%),
    linear-gradient(45deg,  transparent 49.6%, rgba(0,0,0,0.05) 50%, transparent 50.4%);
}

/* The card peeking out from inside the envelope */
.env-card-peek {
  display: none;
}

.envelope.is-open .env-card-peek {
  transform: translateY(-128%) scale(0.97);
}

.peek-script {
  font-family: "Italianno", "Caveat", cursive;
  font-size: clamp(36px, 9vw, 50px);
  margin: 0;
  line-height: 1;
  color: var(--ink);
}

.peek-rule {
  display: block;
  width: 38px;
  height: 1px;
  background: var(--ink-muted);
  margin: 10px 0 8px;
  opacity: 0.55;
}

.peek-caps {
  font-family: "Cormorant Garamond", serif;
  text-transform: uppercase;
  letter-spacing: 0.36em;
  font-size: 10px;
  margin: 0;
  padding-left: 0.36em;
  color: var(--ink-soft);
}

.env-flap {
  background: linear-gradient(180deg, var(--env-deep) 0%, var(--env-mid) 100%);
  clip-path: polygon(0 0, 100% 0, 50% 62%);
  transform-origin: top center;
  transform: rotateX(0deg);
  transition: transform 1.1s cubic-bezier(.6,.05,.3,1);
  z-index: 4;
  border-radius: 4px 4px 0 0;
  box-shadow: inset 0 -1px 4px rgba(0,0,0,0.08);
}

.envelope.is-open .env-flap {
  transform: rotateX(-180deg);
  z-index: 1;
}

/* Wax seal */
.wax-seal {
  position: absolute;
  left: 50%;
  top: 32%;
  transform: translate(-50%, -50%);
  width: 56px; height: 56px;
  filter: drop-shadow(0 2px 4px rgba(60,20,10,0.35));
}
.seal-svg { width: 100%; height: 100%; }
.seal-bg {
  fill: var(--seal-color);
}
.seal-ring { fill: none; stroke: var(--seal-deep); stroke-width: 0.6; opacity: 0.8; }
.seal-text {
  font-family: "Italianno", "Caveat", cursive;
  font-size: 22px;
  fill: #2a2014;
  letter-spacing: -0.02em;
}

/* Open CTA */
.open-cta {
  background: transparent;
  border: 0;
  color: var(--ink);
  font-family: "Montserrat", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.4em;
  font-size: 10.5px;
  font-weight: 400;
  cursor: pointer;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  animation: bob 2.6s ease-in-out infinite;
  text-shadow: 0 1px 8px rgba(241,235,222,0.6);
}
.open-cta span:last-child { padding-left: 0.4em; }
.open-cta-arrow {
  width: 18px; height: 18px;
  color: var(--ink-soft);
  display: inline-flex;
}
@keyframes bob {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(5px); }
}

/* =====================================================================
   CARD STAGE
   ===================================================================== */

.card-stage {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 56px 18px 64px;
  min-height: 100svh;
  gap: 30px;
  opacity: 0;
  transition: opacity 0.7s var(--ease) 0.15s;
}
.card-stage.is-shown { opacity: 1; }

/* The invitation card itself */
.card {
  position: relative;
  width: 100%;
  max-width: 460px;
  color: var(--ink);
  isolation: isolate;
  border-radius: 6px;
  overflow: hidden;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.6) inset,
    0 30px 60px -20px rgba(60, 45, 20, 0.32),
    0 12px 24px -12px rgba(60, 45, 20, 0.22);
}

.card-image {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

/* Wavy border SVG */
.card-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  overflow: visible;
}
.frame-path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.6;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

/* Bow + hanging tails — sits on top of border at upper-left */
.card-bow {
  position: absolute;
  top: -32px;
  left: 16%;
  width: 78px;
  height: 240px;
  color: var(--ink);
  z-index: 3;
  pointer-events: none;
  overflow: visible;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,0.06));
}

/* Card interior content */
.card-inner {
  position: relative;
  z-index: 2;
  padding: 22% 13% 9%;
  text-align: center;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ----- Hero ----- */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.script-name {
  font-family: "Italianno", "Caveat", cursive;
  font-weight: 400;
  font-size: clamp(40px, 9vw, 56px);
  line-height: 1;
  margin: 0;
  color: var(--ink);
  letter-spacing: 0.005em;
}

.script-name.big {
  font-size: clamp(48px, 10vw, 64px);
}

.headline {
  font-family: "Cormorant Garamond", serif;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: clamp(26px, 6.2vw, 36px);
  margin: 18px 0 0;
  padding-left: 0.16em;
  color: var(--ink);
}

.subhead {
  font-family: "Montserrat", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-size: 10.5px;
  font-weight: 400;
  color: var(--ink-soft);
  margin: 18px 0 0;
  padding-left: 0.32em;
  line-height: 1.9;
}

/* ----- When / where ----- */
.when-where {
  margin: 26px 0 0;
}

.datetime {
  font-family: "Montserrat", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--ink);
  margin: 0;
  padding-left: 0.16em;
}
.datetime .ord {
  text-transform: lowercase;
  letter-spacing: 0;
  font-size: 9px;
  vertical-align: super;
}

.venue {
  font-family: "Montserrat", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.34em;
  font-size: 13.5px;
  font-weight: 500;
  margin: 6px 0 0;
  padding-left: 0.34em;
}

.address {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-weight: 400;
  font-size: 13px;
  color: var(--ink-muted);
  margin: 4px 0 0;
}

/* ----- Flutes illustration ----- */
.flutes {
  margin-top: auto;
  margin-bottom: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top: 1px;
  padding-bottom: 12px;
}
.flutes img {
  width: min(56%, 220px);
  height: auto;
  display: block;
  margin: 0 auto;
  /* The PNG's visual subject (the clinking glasses) sits left of center,
     so nudge the image right to optically center it within the card. */
  transform: translateX(8%);
  user-select: none;
  -webkit-user-drag: none;
}

/* ----- Actions ----- */
.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
  width: min(86%, 340px);
}

.action-btn {
  display: inline-block;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
  padding: 13px 18px;
  font-family: "Montserrat", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-size: 10.5px;
  font-weight: 400;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  border-radius: 0;
  padding-left: calc(18px + 0.32em);
  transition: background 0.2s ease, color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
}
.action-btn:hover {
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 6px 14px -6px rgba(0,0,0,0.35);
}
.action-btn:active { transform: translateY(1px); }

.action-btn.primary {
  background: var(--ink);
  color: var(--paper);
}
.action-btn.primary:hover { background: #000; }
.action-btn.full { width: 100%; }

/* ----- Parking note ----- */
.parking-note {
  width: min(86%, 380px);
  margin: 4px auto 0;
  padding: 16px 20px;
  border: 1px solid var(--hairline);
  background: rgba(255,255,255,0.35);
  text-align: center;
}
.parking-note p {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 13.5px;
  color: var(--ink-soft);
  margin: 0;
  line-height: 1.55;
}
.note-eyebrow {
  display: block;
  font-family: "Montserrat", sans-serif;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-size: 9.5px;
  color: var(--ink-muted);
  margin: 0 0 6px;
  padding-left: 0.32em;
}

.signed-off {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 14px;
  color: var(--ink-muted);
  margin: 0;
}
.signed-name {
  font-family: "Italianno", cursive;
  font-style: normal;
  font-size: 24px;
  color: var(--ink);
  margin-left: 4px;
  vertical-align: -2px;
}

/* =====================================================================
   FLOATING AMBIENT
   ===================================================================== */
.ambient {
  position: absolute;
  inset: 6% 6% 24% 6%;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}
.floaty {
  position: absolute;
  bottom: 0;
  left: var(--x, 50%);
  font-size: 14px;
  color: var(--ink);
  opacity: 0;
  animation: floatUp 10s linear infinite;
  animation-delay: var(--delay, 0s);
  font-family: serif;
}
.floaty.heart { font-size: 12px; }
.floaty.note  { font-size: 15px; }

@keyframes floatUp {
  0%   { opacity: 0; transform: translate(-50%, 0)    rotate(-6deg); }
  12%  { opacity: 0.45; }
  85%  { opacity: 0.35; }
  100% { opacity: 0; transform: translate(-50%, -220px) rotate(8deg); }
}

/* =====================================================================
   REVEAL ANIMATIONS
   ===================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  transition-delay: var(--rd, 0s);
}
.card-stage.is-shown .reveal {
  opacity: 1;
  transform: translateY(0);
}

/* =====================================================================
   MODAL
   ===================================================================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}
.modal.is-open { opacity: 1; }
.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 8, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-panel {
  position: relative;
  background: var(--paper-warm);
  width: 100%;
  max-width: 440px;
  max-height: 92svh;
  overflow-y: auto;
  padding: 38px 30px 30px;
  border-radius: 4px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.35);
  transform: translateY(10px) scale(0.98);
  transition: transform 0.35s var(--ease);
  text-align: center;
}
.modal.is-open .modal-panel { transform: translateY(0) scale(1); }

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: 0;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}
.modal-close:hover { color: var(--ink); }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.42em;
  font-size: 10px;
  color: var(--ink-muted);
  margin: 0 0 10px;
  padding-left: 0.42em;
}

.modal-title {
  font-family: "Cormorant Garamond", serif;
  font-weight: 400;
  font-style: italic;
  font-size: 30px;
  margin: 0 0 6px;
  color: var(--ink);
}

.modal-sub {
  font-family: "Montserrat", sans-serif;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--ink-muted);
  margin: 0 0 22px;
  padding-left: 0.22em;
}
.modal-sub strong { color: var(--ink); font-weight: 500; }

.field {
  display: block;
  margin: 14px 0;
  border: 0;
  padding: 0;
  text-align: left;
}

.label, fieldset.field legend.label {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.26em;
  font-size: 9.5px;
  color: var(--ink-muted);
  margin-bottom: 8px;
  padding: 0 0 0 0.26em;
}
.label em {
  font-style: normal;
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
  color: var(--hairline);
  margin-left: 4px;
}

input[type="text"], select, textarea {
  width: 100%;
  font-family: inherit;
  font-size: 16px;
  font-weight: 300;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: 0;
  padding: 12px 14px;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input[type="text"]:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(20,20,20,0.06);
}
textarea { resize: vertical; min-height: 70px; font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 15px; }

select {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-muted) 50%),
    linear-gradient(135deg, var(--ink-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) center, calc(100% - 13px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 36px;
}

.radio-row {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--hairline);
  background: #fff;
}
.radio {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--hairline);
  transition: background 0.15s ease;
}
.radio:last-child { border-bottom: 0; }
.radio:hover { background: rgba(20,20,20,0.03); }
.radio input { accent-color: var(--ink); width: 16px; height: 16px; }
.radio-text {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 16px;
  color: var(--ink-soft);
}

.form-error {
  color: var(--error);
  font-size: 13px;
  margin: 12px 0 0;
  text-align: center;
  font-style: italic;
}

#guest-count-field.is-hidden { display: none; }

.modal-confirm {
  padding: 16px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
}
.modal-confirm[hidden],
.modal-content[hidden] { display: none; }
.confirm-line {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 18px;
  color: var(--ink-soft);
  margin: 0;
  max-width: 320px;
  line-height: 1.5;
}

/* =====================================================================
   CONFETTI
   ===================================================================== */
#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
}

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 480px) {
  .card-inner { padding: 22% 11% 8%; }
  .card-bow   { width: 64px; height: 200px; top: -26px; left: 14%; }
  .modal-panel { padding: 32px 22px 24px; }
}

@supports (padding: env(safe-area-inset-bottom)) {
  .envelope-stage {
    padding-top: max(24px, env(safe-area-inset-top));
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }
  .card-stage {
    padding-top: max(56px, calc(56px + env(safe-area-inset-top)));
    padding-bottom: max(64px, calc(64px + env(safe-area-inset-bottom)));
  }
  .modal-panel {
    padding-bottom: max(30px, calc(30px + env(safe-area-inset-bottom)));
  }
}

@media (min-width: 700px) {
  .card { max-width: 480px; }
  .card-stage { padding-top: 72px; padding-bottom: 80px; }
}

@media (prefers-reduced-motion: reduce) {
  .floaty, .open-cta, .envelope { animation: none; }
  .reveal { transition: none; opacity: 1; transform: none; }
  .envelope:hover { transform: none; }
}
