:root {
  color-scheme: light;
  --wine: #941d39;
  --ink: #29191d;
  --muted: #715b61;
  --edge: #e8dadd;
  --paper: #fffafa;
  --serif: Georgia, 'Times New Roman', serif;
  font-family: Inter, system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid #dc8da1; outline-offset: 4px; }
.brand { font-size: .8rem; letter-spacing: .18em; font-weight: 400; white-space: nowrap; text-decoration: none; }
.brand b { font-weight: 750; }

.gift-body {
  --cream: #fff4eb;
  --gold: #f4c79a;
  --accent: #941d39;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  text-align: center;
  color: var(--cream);
  background: #210910;
  background: radial-gradient(ellipse at 68% 46%, color-mix(in srgb, var(--accent) 56%, #210910), #210910 58%, #15060c 100%);
}
.gift-header, .gift-footer {
  width: min(100% - 3rem, 79rem);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gift-header {
  min-height: 4.75rem;
  border-bottom: 1px solid #f2bcc32e;
  gap: .85rem;
}
.header-rule { height: 1.05rem; width: 1px; background: #d1a3a080; }
.brand-caption { font-size: .69rem; letter-spacing: .13em; color: #e8b3bd; white-space: nowrap; }
.gift-main {
  flex: 1;
  display: grid;
  place-items: center;
  min-width: 0;
  padding: clamp(1.25rem, 5vh, 4rem) 1.15rem;
}
.gift-stage {
  display: grid;
  grid-template-columns: minmax(0, .96fr) minmax(0, 1.04fr);
  align-items: center;
  width: min(100%, 70rem);
}
.gift-intro { position: relative; z-index: 1; text-align: start; }
.gift-ornament {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  color: var(--gold);
  font-size: 1.45rem;
}
.gift-ornament::after { content: ''; width: 2.15rem; height: 1px; background: #f4c79a8c; }
.gift-intro h1, .letter h1, .missing h1 {
  margin: .55rem 0 0;
  font: 400 clamp(3.55rem, 7.1vw, 7.4rem)/.96 var(--serif);
  letter-spacing: -.066em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.gift-intro p { color: #f2c2c4; font: italic clamp(1.1rem, 2vw, 1.45rem)/1.4 var(--serif); margin: 1rem 0 0; }
.gift-art {
  display: grid;
  place-items: center;
  position: relative;
  isolation: isolate;
  width: 100%;
  min-width: 0;
  aspect-ratio: 1.08;
}
.gift-art::before {
  position: absolute;
  z-index: -1;
  inset: -5% -4%;
  content: '';
  background: linear-gradient(#3d071d72, #3d071d72), url('/assets/envelope.webp') center 32% / cover;
  mask-image: radial-gradient(ellipse closest-side, #000 22%, #000c 60%, transparent 100%);
  opacity: .42;
}
.scene-spark { position: absolute; color: var(--gold); pointer-events: none; line-height: 1; }
.scene-spark-top { top: 15%; left: 19%; font-size: 1.7rem; }
.scene-spark-bottom { right: 11%; bottom: 20%; font-size: .8rem; opacity: .8; }
.scene-spark-side { right: 15%; top: 23%; font-size: 1.05rem; opacity: .75; }
.envelope {
  width: min(83%, 29rem);
  aspect-ratio: 1.52;
  background: none;
  padding: 0;
  border: 0;
  position: relative;
  perspective: 1100px;
  transform: rotate(-8deg);
  transition: transform .45s ease;
  touch-action: manipulation;
}
.envelope:hover, .envelope:focus-visible { transform: translateY(-.25rem) rotate(-5deg); }
.envelope-layers, .envelope-back, .envelope-pocket, .envelope-flap {
  position: absolute;
  inset: 0;
  display: block;
}
.envelope-back {
  border-radius: .34rem;
  background: #681125;
  border: 1px solid #bf6365;
  box-shadow: 0 30px 70px #10030abc, 0 5px 13px #240510a3;
}
.envelope-paper {
  display: grid;
  place-items: center;
  position: absolute;
  inset: 6% 7% 7%;
  z-index: 1;
  background: linear-gradient(130deg, #fff5df, #f5cdaf);
  border: 1px solid #ffd8b8;
  border-radius: .24rem;
  color: #a53450;
  font: 2.4rem var(--serif);
  box-shadow: 0 5px 18px #25050e75;
}
.envelope-pocket, .envelope-flap {
  background-size: auto, 4px 4px, auto;
  background-image: linear-gradient(113deg, #ffffff20, transparent 54%), repeating-linear-gradient(65deg, #fff1e012 0 1px, transparent 1px 3px), linear-gradient(152deg, #d2636f, #a02140 60%, #6f152b);
}
.envelope-pocket {
  z-index: 2;
  clip-path: polygon(0 0, 50% 56%, 100% 0, 100% 100%, 0 100%);
  border: 1px solid #e18a85;
  border-radius: .34rem;
  box-shadow: inset 0 -12px 30px #4f07193d;
}
.envelope-pocket::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(25deg, #5d0b243a, transparent 70%), linear-gradient(152deg, #f4958c7a, #90203b 77%);
  clip-path: polygon(0 100%, 50% 40%, 100% 100%);
}
.envelope-flap {
  z-index: 3;
  clip-path: polygon(0 0, 100% 0, 100% 1%, 53% 60%, 50% 62%, 47% 60%, 0 1%);
  border-top: 1px solid #e4a09a;
  border-radius: .34rem .34rem 0 0;
  transform-origin: 50% 0;
  background-color: #b94a59;
  background-image: linear-gradient(170deg, #f5a08a65, transparent 80%), repeating-linear-gradient(65deg, #fff1e012 0 1px, transparent 1px 3px), linear-gradient(152deg, #cb5d68, #94253e 63%, #632032);
}
.envelope-seal {
  position: absolute;
  display: grid;
  place-items: center;
  z-index: 4;
  left: 50%;
  top: 57%;
  width: 14.5%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  font: clamp(1.05rem, 3vw, 2.1rem)/1 var(--serif);
  color: #ffb7aa;
  border-radius: 48% 52% 48% 53%;
  border: 1px solid #ea938c;
  background: radial-gradient(circle at 39% 27%, #c74c5b, #a42143 44%, #71122e 80%);
  box-shadow: inset 0 0 0 3px #fb857a41, inset 0 0 0 6px #650e2b4a, 0 6px 9px #450915b8;
}
.open-letter {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: .65rem;
  position: relative;
  margin-top: 1.9rem;
  color: #55152a;
  border: 1px solid #ffe0b5;
  background: linear-gradient(130deg, #fff3dc, #f4cb9f);
  padding: .93rem 1.55rem;
  border-radius: .35rem;
  font-weight: 700;
  text-decoration: none;
  min-height: 3.2rem;
  box-shadow: 0 8px 28px #11040a70;
}
.open-letter:hover { background: #fff1df; }
.open-letter span { font-size: 1.25rem; line-height: 1; }
.is-opening .gift-art { animation: open-scene 1.12s ease-in-out both; }
.is-opening .envelope { transform: rotate(-3deg); }
.is-opening .envelope-seal { animation: unseal .29s ease-out both; }
.is-opening .envelope-flap { animation: open-flap .46s .17s ease-in-out both; }
.is-opening .envelope-paper { animation: raise-paper .63s .45s cubic-bezier(.15,.78,.32,1) both; }
.is-opening .scene-spark { animation: sparkle .64s .4s ease-out both; }
@keyframes open-scene { 0%, 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-.5rem) scale(1.03); } }
@keyframes unseal {
  0% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -85%) rotate(13deg) scale(1.28); }
}
@keyframes open-flap {
  from { transform: rotateX(0); z-index: 3; }
  48% { z-index: 3; }
  49%, to { z-index: 0; }
  to { transform: rotateX(172deg); }
}
@keyframes raise-paper { to { transform: translateY(-72%) rotate(2deg); } }
@keyframes sparkle { 45% { opacity: 1; transform: scale(1.6); } 100% { opacity: 0; transform: translateY(-1rem) scale(.7); } }
.gift-footer {
  min-height: 3.7rem;
  border-top: 1px solid #f2bcc326;
  gap: .6rem;
  color: #dfb6be;
  font-size: .67rem;
  letter-spacing: .2em;
}
.kitty { font-size: .95rem; line-height: 1; }
.letter {
  width: min(100%, 41rem);
  border-radius: .45rem;
  color: #4b182b;
  background: #fff2df;
  background-image: radial-gradient(ellipse at center top, #fffaed, #fff4e4 55%, #f8dcc3 100%);
  padding: clamp(.62rem, 1.8vw, .95rem);
  box-shadow: 0 25px 75px #10030b80;
  animation: reveal .52s both;
}
.letter-inner {
  border: 1px solid #bd887172;
  border-radius: .3rem;
  padding: clamp(1.5rem, 6vw, 3.35rem) clamp(1rem, 7vw, 4.3rem) clamp(1.2rem, 5vw, 2.3rem);
}
.letter h1 { margin-top: .35rem; font-size: clamp(2.05rem, 7vw, 4rem); }
.letter-heart { color: #a52848; font: 2.25rem/1 var(--serif); }
.letter-message { text-align: center; font: 1.18rem/1.65 var(--serif); white-space: pre-wrap; overflow-wrap: anywhere; margin-block: 1.55rem; }
.signature { font: italic 1.27rem var(--serif); text-align: end; overflow-wrap: anywhere; margin: 1.45rem 0 .75rem; }
.letter-photo { display: block; margin: 1.45rem auto; width: auto; max-width: 100%; max-height: 24rem; padding: .28rem; border: 1px solid #cca48c; border-radius: .3rem; }
.letter-end { color: #94506a; }
.letter .text-button { padding: .78rem .5rem .26rem; }
.missing { margin: auto; padding: 2rem; }
@keyframes reveal { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }

@media (max-width: 730px) {
  .gift-stage { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .gift-intro { display: contents; }
  .gift-intro h1 { font-size: clamp(2.75rem, 11vw, 5rem); letter-spacing: -.058em; text-align: center; }
  .gift-intro p { margin-top: .6rem; }
  .gift-ornament { justify-content: center; }
  .gift-ornament::before { content: ''; width: 2.15rem; height: 1px; background: #f4c79a8c; }
  .gift-art { grid-row: 4; width: min(100%, 29rem); aspect-ratio: 1.22; }
  .open-letter { margin-top: .2rem; }
  .gift-art::before { inset-inline: -1%; }
}

.admin-body { color: var(--ink); background: #fbf6f7; min-height: 100svh; }
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem max(1.25rem, calc((100% - 70rem) / 2));
  min-height: 4.3rem;
  border-bottom: 1px solid var(--edge);
  color: #fff3ee;
  background: #2b0c17;
}
.admin-main { width: min(100% - 2.5rem, 70rem); margin: 2.9rem auto 4rem; }
.admin-title, .editor-title { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.admin-title { margin-bottom: 1.65rem; }
.eyebrow { font-size: .75rem; letter-spacing: .18em; color: var(--wine); font-weight: 700; margin: 0 0 .4rem; }
.admin-title h1 { font: 400 clamp(2.15rem, 5vw, 3.8rem)/1.05 var(--serif); margin: 0; letter-spacing: -.04em; }
.workspace { display: grid; grid-template-columns: minmax(12.5rem, 17rem) minmax(0, 1fr); gap: 1.1rem; align-items: start; }
.gift-sidebar, .editor { background: var(--paper); border: 1px solid var(--edge); border-radius: .9rem; }
.gift-sidebar { padding: .8rem; }
.gift-sidebar h2 { margin: 1.25rem .62rem .5rem; font-size: .82rem; color: var(--muted); }
.gift-item {
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink);
  padding: .7rem;
  border-radius: .55rem;
  display: block;
  width: 100%;
  text-align: start;
  font-size: .93rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.gift-item:hover, .gift-item[aria-current="true"] { background: #f9e9ed; border-color: #ebcad3; color: #75162f; }
.gift-item span { display: block; font-weight: 400; font-size: .81rem; color: var(--muted); margin-top: .3rem; }
.empty { color: var(--muted); padding: 0 .65rem; font-size: .85rem; }
.editor { padding: clamp(1rem, 3vw, 2rem); }
.editor-title { margin: 0 0 1.2rem; }
.editor-title h2 { font: 400 1.75rem/1.2 var(--serif); margin: 0; overflow-wrap: anywhere; }
form { display: grid; gap: .9rem; }
label { display: grid; gap: .4rem; min-width: 0; font-size: .89rem; font-weight: 650; }
input:not([type="checkbox"]), textarea {
  width: 100%;
  border: 1px solid #e1cfd4;
  border-radius: .45rem;
  background: #fff;
  color: var(--ink);
  padding: .65rem .72rem;
  font-size: 1rem;
}
textarea { resize: vertical; min-height: 6rem; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.appearance { align-items: end; }
input[type="color"] { width: 100% !important; padding: .25rem !important; height: 2.55rem; cursor: pointer; }
.check { display: flex; align-items: center; gap: .5rem; min-height: 2.55rem; }
input[type="checkbox"] { width: 1.1rem; height: 1.1rem; accent-color: var(--wine); }
.primary, .secondary { border-radius: .5rem; min-height: 2.7rem; padding: .6rem .9rem; font-weight: 650; font-size: .9rem; }
.primary { background: #851d39; border: 1px solid #851d39; color: #fff; }
.primary:hover { background: #6e142d; }
.secondary { background: #fff; border: 1px solid #decbd1; color: #791b35; }
.secondary:hover { background: #f9ebee; }
.text-button { border: 0; background: none; color: #8b2140; text-decoration: underline; text-underline-offset: 4px; padding: .4rem 0; font-size: .92rem; }
.small-link { font-size: .9rem; text-underline-offset: 4px; }
.actions, .photo-row, .share-row { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; }
.photo-row img { max-width: 6rem; max-height: 5rem; object-fit: contain; border-radius: .35rem; }
.share-row { align-items: end; padding: .8rem; background: #faf0f2; border-radius: .45rem; }
.share-row label { flex: 1 1 10rem; }
#status { margin: 0; min-height: 1.3em; color: #6d2740; font-size: .91rem; }
@media (max-width: 650px) {
  .gift-header { min-height: 4rem; }
  .gift-main { padding-top: .85rem; }
  .gift-footer { min-height: 3.4rem; }
  .workspace { grid-template-columns: 1fr; }
  .admin-main { margin-top: 1.5rem; }
  .gift-sidebar { max-height: 12rem; overflow: auto; }
  .admin-title { align-items: end; }
}
@media (max-width: 380px) {
  .brand-caption { letter-spacing: .07em; }
  .form-row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
