@import url('https://fonts.googleapis.com/css2?family=Jost:wght@300;400;500;600;700&family=DM+Sans:wght@400;500;600;700&family=EB+Garamond:ital,wght@0,400;0,500;1,400&family=Caveat:wght@500;600;700&display=swap');

:root {
  --color-crimson:      #9b243e;
  --color-crimson-dark: #7a1c30;
  --color-crimson-light:#c2425a;
  --color-teal:         #006580;
  --color-teal-dark:    #004f64;
  --color-amber:        #ffa300;
  --color-amber-dark:   #cc8200;
  --color-gray:         #575a5d;
  --color-gray-dark:    #3a3c3e;
  --color-white:        #ffffff;
  --color-off-white:    #f5f3f0;
  --color-border:       #e8e5e1;
  --color-text:         #1a1a1a;

  --font-display: 'Jost', 'Futura BT', sans-serif;
  --font-ui:      'DM Sans', Arial, sans-serif;
  --font-body:    'EB Garamond', Georgia, serif;
  --font-sign:    'Caveat', cursive;

  --shadow-note: 0 6px 16px rgba(26,26,26,0.13);
  --shadow-lift: 0 12px 34px rgba(26,26,26,0.22);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  font-family: var(--font-ui);
  color: var(--color-text);
  background: #2a2123;
  overflow: hidden;
}

/* ── Stage: centers a phone-width column, dark surround on desktop ── */
#root { height: 100%; }

.stage {
  position: relative;
  width: 100%;
  max-width: 460px;
  height: 100%;
  margin: 0 auto;
  background: var(--color-off-white);
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0,0,0,0.4);
}

/* ════════════════════════ COVER ════════════════════════ */
.cover {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: var(--color-crimson);
  color: var(--color-white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: clamp(24px, 5.5vh, 46px) 30px clamp(28px, 5vh, 40px);
  transform-origin: top center;
  transition: transform 820ms cubic-bezier(.62,.01,.2,1), box-shadow 820ms ease;
  backface-visibility: hidden;
  overflow: hidden;
}
.cover.open {
  transform: perspective(1400px) rotateX(-108deg);
  box-shadow: 0 40px 60px rgba(0,0,0,0.4);
  pointer-events: none;
}

/* giant faint house-mark watermark */
.cover-mark {
  position: absolute;
  right: -22%;
  bottom: -14%;
  width: 92%;
  opacity: 0.10;
  filter: brightness(0) invert(1);
  pointer-events: none;
  z-index: 0;
}

/* festive confetti — falls continuously across the whole cover, behind the copy */
.cover-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.cfp {
  position: absolute;
  top: 0;
  border-radius: 2px;
  animation: confettiFall var(--dur, 7s) linear var(--delay, 0s) infinite;
  will-change: transform, opacity;
}
.cfp-circle { border-radius: 50%; }
.cfp-squiggle { border-radius: 0; }
.cfp svg { display: block; }
@keyframes confettiFall {
  0%   { transform: translate3d(0, -12vh, 0) rotate(0deg); opacity: 0; }
  7%   { opacity: 0.9; }
  88%  { opacity: 0.9; }
  100% { transform: translate3d(var(--drift, 0px), 114vh, 0) rotate(var(--spin, 360deg)); opacity: 0; }
}

.cover-logo {
  width: clamp(262px, 72vw, 322px);
  position: relative;
  z-index: 2;
  margin-bottom: clamp(46px, 9vh, 74px);
}

.cover-hero {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.cover-greet {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(50px, 15vw, 72px);
  line-height: 0.92;
  letter-spacing: -0.015em;
  text-align: center;
  color: var(--color-white);
}

.cover-num {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(46px, 13vw, 64px);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--color-amber);
  position: relative;
  margin: 4px 0 6px;
}
.cover-num .ord {
  font-size: 0.34em;
  vertical-align: super;
  font-weight: 500;
  letter-spacing: 0;
}

.cover-org {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(21px, 5.6vw, 26px);
  line-height: 1.14;
  letter-spacing: 0.005em;
  text-align: center;
  white-space: nowrap;
  margin-top: 12px;
}
.cover-org b { font-weight: 500; }

.cover-sub {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
  text-align: center;
  max-width: 340px;
  margin: 16px auto 0;
  opacity: 0.95;
}

.cover-cta {
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.btn-open {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.01em;
  color: var(--color-crimson-dark);
  background: var(--color-amber);
  border: none;
  border-radius: 999px;
  padding: 17px 38px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.28);
  transition: transform 160ms ease, background 160ms ease;
  animation: bob 2.6s ease-in-out infinite;
}
.btn-open:hover { background: var(--color-amber-dark); color: #fff; }
.btn-open:active { transform: scale(0.97); }
.btn-open svg { transition: transform 220ms ease; }
.btn-open:hover svg { transform: translateY(2px); }
@keyframes bob { 0%,100%{ transform: translateY(0);} 50%{ transform: translateY(-5px);} }

.cover-count {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-ui); font-size: 13.5px; opacity: 0.92;
}
.dots { display: flex; }
.dots span {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--color-crimson);
  margin-left: -8px; display: grid; place-items: center;
  font-family: var(--font-sign); font-size: 13px; font-weight: 700; color: #fff;
}
.dots span:first-child { margin-left: 0; }

/* ════════════════════════ INTERIOR ════════════════════════ */
.interior {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  background: var(--color-off-white);
}

.in-head {
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  padding: 16px 22px 18px;
  position: relative;
  flex-shrink: 0;
}
.in-head .topline {
  display: flex; align-items: center; justify-content: space-between;
}
.in-logo { height: 34px; }
.head-actions { display: flex; gap: 9px; }
.in-share {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--color-border); background: #fff;
  display: grid; place-items: center; cursor: pointer; color: var(--color-teal);
  transition: background 150ms ease, color 150ms ease;
}
.in-share:hover { background: var(--color-teal); color: #fff; }

.in-title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 30px;
  line-height: 1.06;
  letter-spacing: -0.01em;
  color: var(--color-crimson);
  margin: 14px 0 6px;
}
.in-title b { font-weight: 600; }
.in-mission {
  font-family: var(--font-body);
  font-size: 16px; line-height: 1.45; color: var(--color-gray);
}
.in-meta {
  margin-top: 12px;
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-ui); font-size: 12.5px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--color-teal);
  background: #e1f0f3; border-radius: 999px; padding: 7px 14px;
}
.in-meta .pulse {
  width: 8px; height: 8px; border-radius: 50%; background: var(--color-teal);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{ opacity:1; transform:scale(1);} 50%{ opacity:.4; transform:scale(.7);} }

/* ── Notes wall ── */
.wall {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 16px 120px;
  column-count: 2;
  column-gap: 13px;
}
@media (min-width: 430px) { .wall { padding-left: 18px; padding-right: 18px; } }

.wall-empty {
  column-span: all;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--color-gray);
  padding: 56px 24px;
  min-height: 50vh;
}
.wall-empty svg { color: var(--color-crimson); opacity: 0.5; margin-bottom: 16px; }
.wall-empty p { font-family: var(--font-body); font-size: 18px; line-height: 1.5; }
.wall-empty b { color: var(--color-crimson); font-weight: 600; }

.note {
  break-inside: avoid;
  margin-bottom: 13px;
  border-radius: 4px;
  padding: 15px 15px 14px;
  box-shadow: var(--shadow-note);
  position: relative;
  animation: noteIn 480ms cubic-bezier(.2,.8,.25,1) both;
  transform-origin: center top;
}
.note::before { /* tape */
  content: "";
  position: absolute;
  top: -9px; left: 50%; transform: translateX(-50%) rotate(var(--tape, -3deg));
  width: 52px; height: 17px;
  background: rgba(255,255,255,0.5);
  border: 1px solid rgba(255,255,255,0.6);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.note-msg {
  font-family: var(--font-body);
  font-size: 16px; line-height: 1.38;
  color: var(--color-gray-dark);
  word-break: break-word;
}
.note-sign {
  margin-top: 11px;
  font-family: var(--font-sign);
  font-weight: 700;
  font-size: 25px;
  line-height: 1;
}
.note-from {
  font-family: var(--font-ui);
  font-size: 11.5px; font-weight: 500; letter-spacing: 0.03em;
  text-transform: uppercase;
  opacity: 0.6; margin-top: 3px;
}
@keyframes noteIn {
  0%   { opacity: 0; transform: translateY(26px) scale(.9) rotate(0deg); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(var(--rot, 0deg)); }
}
.note.fresh { animation: noteDrop 720ms cubic-bezier(.2,.85,.3,1) both; }
@keyframes noteDrop {
  0%   { opacity: 0; transform: translateY(-70px) scale(1.12) rotate(0deg); }
  60%  { opacity: 1; transform: translateY(6px) scale(.98) rotate(var(--rot,0deg)); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(var(--rot,0deg)); }
}

/* note color variants */
.c-crimson { background: #f6dbe1; }
.c-crimson .note-sign { color: var(--color-crimson); }
.c-teal    { background: #d3e8ec; }
.c-teal .note-sign { color: var(--color-teal-dark); }
.c-amber   { background: #ffe6b3; }
.c-amber .note-sign { color: var(--color-amber-dark); }
.c-cream   { background: #efe7da; }
.c-cream .note-sign { color: var(--color-gray-dark); }

/* ── Bottom action bar ── */
.actionbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  padding: 14px 18px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--color-off-white) 62%, rgba(245,243,240,0));
  display: flex; gap: 10px;
}
.btn-sign {
  flex: 1;
  font-family: var(--font-ui); font-weight: 700; font-size: 16.5px;
  color: #fff; background: var(--color-crimson);
  border: none; border-radius: 999px; padding: 16px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 8px 22px rgba(155,36,62,0.35);
  transition: background 160ms ease, transform 140ms ease;
}
.btn-sign:hover { background: var(--color-crimson-dark); }
.btn-sign:active { transform: scale(0.98); }

/* ════════════════════════ SHEET ════════════════════════ */
.scrim {
  position: absolute; inset: 0; z-index: 50;
  background: rgba(26,18,20,0.5);
  opacity: 0; pointer-events: none;
  transition: opacity 300ms ease;
}
.scrim.show { opacity: 1; pointer-events: auto; }

.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 60;
  background: #fff;
  border-radius: 22px 22px 0 0;
  padding: 10px 22px calc(24px + env(safe-area-inset-bottom));
  transform: translateY(102%);
  transition: transform 380ms cubic-bezier(.3,.9,.3,1);
  max-height: 92%;
  overflow-y: auto;
  box-shadow: 0 -12px 40px rgba(0,0,0,0.2);
}
.sheet.show { transform: translateY(0); }
.grab { width: 40px; height: 4px; border-radius: 99px; background: var(--color-border); margin: 0 auto 14px; }

.sheet h2 {
  font-family: var(--font-display); font-weight: 500; font-size: 23px;
  color: var(--color-text); margin-bottom: 3px;
}
.sheet .sub { font-family: var(--font-body); font-size: 15.5px; color: var(--color-gray); margin-bottom: 18px; }

.field { margin-bottom: 15px; }
.field label {
  display: block; font-family: var(--font-ui); font-size: 12px; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase; color: var(--color-gray);
  margin-bottom: 7px;
}
.field input, .field textarea {
  width: 100%; font-family: var(--font-body); font-size: 17px; color: var(--color-text);
  background: var(--color-off-white);
  border: 1.5px solid var(--color-border); border-radius: 10px;
  padding: 12px 14px; resize: none;
  transition: border-color 150ms ease, background 150ms ease;
}
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--color-teal); background: #fff;
}
.field .count { float: right; font-family: var(--font-ui); font-size: 11.5px; color: #a9a6a1; font-weight: 500; }

.swatches { display: flex; gap: 12px; }
.swatch {
  flex: 1; height: 46px; border-radius: 9px; cursor: pointer;
  border: 3px solid transparent; position: relative;
  transition: transform 140ms ease;
}
.swatch:active { transform: scale(0.94); }
.swatch.sel { border-color: var(--color-text); }
.swatch.sel::after {
  content: "✓"; position: absolute; inset: 0; display: grid; place-items: center;
  color: rgba(26,26,26,0.55); font-weight: 700; font-size: 18px;
}

.preview-wrap { margin: 6px 0 4px; }
.preview-wrap .plabel { font-family: var(--font-ui); font-size: 11px; font-weight:600; letter-spacing:0.06em; text-transform:uppercase; color:#b3b0ab; margin-bottom:8px; }
.preview-note {
  border-radius: 4px; padding: 15px; box-shadow: var(--shadow-note);
  transform: rotate(-1.4deg); transition: background 200ms ease;
}

.btn-add {
  width: 100%; margin-top: 16px;
  font-family: var(--font-ui); font-weight: 700; font-size: 17px; color: #fff;
  background: var(--color-crimson); border: none; border-radius: 999px; padding: 16px;
  cursor: pointer; transition: background 160ms ease, opacity 160ms ease, transform 140ms ease;
  display: inline-flex; align-items:center; justify-content:center; gap:9px;
}
.btn-add:hover { background: var(--color-crimson-dark); }
.btn-add:active { transform: scale(0.985); }
.btn-add:disabled { opacity: 0.4; cursor: not-allowed; }

/* share popover content reuses sheet */
.share-row { display:flex; gap:10px; align-items:center; background:var(--color-off-white); border:1.5px solid var(--color-border); border-radius:10px; padding:12px 14px; margin-bottom:12px; }
.share-row .lnk { flex:1; font-family:var(--font-mono,monospace); font-size:13.5px; color:var(--color-gray-dark); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.share-copy { font-family:var(--font-ui); font-weight:700; font-size:13px; color:#fff; background:var(--color-teal); border:none; border-radius:7px; padding:9px 14px; cursor:pointer; }
.share-copy:hover { background: var(--color-teal-dark); }
.share-note { font-family:var(--font-body); font-size:15px; line-height:1.45; color:var(--color-gray); }

/* confetti canvas */
#confetti { position:absolute; inset:0; z-index:70; pointer-events:none; }

/* thank-you toast */
.toast {
  position:absolute; left:50%; top:18px; transform:translate(-50%,-130%);
  z-index:65; background:var(--color-teal); color:#fff;
  font-family:var(--font-ui); font-weight:600; font-size:14px;
  padding:11px 20px; border-radius:999px; box-shadow:0 8px 24px rgba(0,0,0,0.25);
  transition: transform 360ms cubic-bezier(.2,.9,.3,1); white-space:nowrap;
  display:flex; align-items:center; gap:8px;
}
.toast.show { transform: translate(-50%, 0); }
