:root {
  --wine: #631a20;
  --wine-deep: #4a0a10;
  --wine-ink: #6e1822;
  --oxblood: #520008;
  --gold: #f2d29b;
  --gold-ink: #a8834a;
  --paper: #efedea;
  --paper-edge: #f8f7f5;
  --text: #4a2a2c;
  --script: 'Pinyon Script', 'Snell Roundhand', cursive;
  --serif: 'EB Garamond', Garamond, Georgia, serif;
  --display: 'Poppins', system-ui, sans-serif;
  --caps: 'Open Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--wine);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.2rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

/* Bilingual content: only the active language is visible */
html[data-current-lang='en'] [data-lang='es'],
html[data-current-lang='es'] [data-lang='en'] { display: none !important; }

/* Envelope (hero) */
.envelope {
  position: relative; overflow: hidden; text-align: center; color: #fff;
  padding: 1.75rem 1.25rem 5.5rem;
  border-top: 10px solid var(--oxblood);
  background: radial-gradient(ellipse at 50% 20%, #702028 0%, var(--wine) 55%, #58151b 100%);
}
/* Lower pockets of the envelope, folded up towards the seal */
.pockets {
  position: absolute; inset: 0; pointer-events: none;
  filter: drop-shadow(0 -14px 22px rgba(30, 0, 4, 0.5));
}
.pockets::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, #661b22 0%, #5c161c 100%);
  clip-path: polygon(0 34%, 50% 64%, 100% 34%, 100% 100%, 0 100%);
}
/* Top flap: closed on load, then lifts open */
.flap {
  position: absolute; left: 0; right: 0; top: 0; height: 62%; z-index: 3; pointer-events: none;
  background: linear-gradient(180deg, #57121a, #6a1c24);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  animation: flap-open 1s cubic-bezier(.55, .1, .35, 1) 0.15s forwards;
}
.envelope { perspective: 1400px; }
.envelope-inner {
  position: relative; z-index: 1; max-width: 34rem; margin: 0 auto;
  animation: rise 0.9s ease-out 0.45s both;
}

.lang {
  position: relative; z-index: 4; display: inline-flex; margin-bottom: 2.25rem;
  border-radius: 999px; background: #7a1a26; box-shadow: inset 0 1px 3px rgba(0,0,0,0.25);
}
.lang button {
  all: unset; cursor: pointer; padding: 0.5rem 1.4rem; border-radius: 999px;
  font-family: var(--display); font-size: 0.95rem; color: #fff; transition: background 0.25s, color 0.25s;
}
.lang button[aria-pressed='true'] { background: var(--gold); color: var(--wine-ink); }
.lang button:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.eyebrow {
  margin: 0; font-family: var(--caps); font-weight: 700; color: var(--gold);
  font-size: clamp(0.78rem, 2.8vw, 1.05rem); letter-spacing: 0.16em; text-transform: uppercase;
}
h1 {
  margin: 0.25rem 0 0; font-family: var(--script); font-weight: 400;
  font-size: clamp(4.25rem, 17vw, 7.5rem); line-height: 1.1;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}
.artist {
  margin: 0; font-family: var(--display); font-weight: 400;
  font-size: clamp(1.1rem, 3.4vw, 1.45rem); letter-spacing: 0.14em;
}

.seal {
  display: block; width: clamp(96px, 26vw, 128px); height: auto; margin: 2.25rem auto 0;
  filter: drop-shadow(0 10px 14px rgba(20, 0, 3, 0.55)) drop-shadow(0 2px 2px rgba(20, 0, 3, 0.4));
}
.category { margin: 0.9rem 0 0; display: flex; flex-direction: column; align-items: center; }
.category-label { font-family: var(--script); font-size: 1.9rem; line-height: 1.15; color: var(--gold); }
.category-name {
  font-family: var(--display); font-size: clamp(1.15rem, 3.6vw, 1.45rem); letter-spacing: 0.12em;
}

.player {
  display: block; width: 100%; max-width: 26rem; margin: 2rem auto 0;
  border: 0; border-radius: 12px; box-shadow: 0 14px 30px rgba(20, 0, 3, 0.4);
}
.platforms { display: flex; justify-content: center; gap: 0.75rem; margin: 1.1rem 0 0; }
.platforms a {
  padding: 0.45rem 1.25rem; border: 1px solid rgba(242, 210, 155, 0.6); border-radius: 999px;
  font-family: var(--display); font-size: 0.85rem; letter-spacing: 0.1em; text-decoration: none; color: var(--gold);
  transition: background 0.25s, color 0.25s;
}
.platforms a:hover, .platforms a:focus-visible { background: var(--gold); color: var(--wine-ink); outline: none; }

/* Letter paper */
.letter {
  position: relative; padding: 4.5rem 1rem 3.5rem;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    var(--paper);
}
/* Deckled, torn top edge */
.letter::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 60px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 70' preserveAspectRatio='none'%3E%3Cpath fill='%23ffffff' fill-opacity='0.75' d='M0 0H1200V38c-22 4-40-6-62 2s-34 14-58 6-30-12-52-4-38 18-64 10-26-16-50-12-40 16-66 12-30-10-54-6-32 16-60 14-34-14-58-10-40 18-62 12-28-12-50-8-34 20-60 14-30-18-56-14-36 14-62 10-28-14-52-10-38 18-64 14-30-12-56-8-34 16-58 12-32-14-58-10-40 16-62 12-28-10-52-6-36 14-60 10-30-14-56-10-36 16-58 10-30-10-48-6V0z'/%3E%3Cpath fill='%23ffffff' fill-opacity='0.55' d='M0 0H1200V24c-26 6-44-4-68 4s-38 10-60 4-34-10-58-2-36 12-60 6-30-12-54-8-44 14-66 8-28-8-56-4-36 12-58 10-32-10-60-6-38 14-64 8-28-10-52-6-38 16-62 10-32-14-58-8-34 10-60 6-30-10-56-6-36 12-60 8-28-8-54-4-38 14-60 8-30-8-56-4-34 10-58 6-30-12-54-8-36 12-56 6-30-6-48-2V0z'/%3E%3C/svg%3E") top / 100% 100% no-repeat,
    linear-gradient(180deg, var(--paper-edge), rgba(239, 237, 234, 0));
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.06));
  pointer-events: none;
}

/* Letterhead: thin double gold rule inside the paper */
.sheet {
  position: relative; max-width: 46rem; margin: 0 auto; padding: 3rem clamp(1.25rem, 5vw, 3.5rem) 3rem;
  border: 1px solid rgba(168, 131, 74, 0.55); text-align: center;
}
.sheet::after {
  content: ''; position: absolute; inset: 6px; border: 1px solid rgba(168, 131, 74, 0.3); pointer-events: none;
}

.song h2 {
  margin: 0; font-family: 'Great Vibes', var(--script); font-weight: 400;
  font-size: clamp(3.25rem, 12vw, 4.25rem); line-height: 1.15; color: var(--wine-ink);
}
.song-artist {
  margin: 0.4rem 0 0; font-family: var(--display); font-size: 0.85rem;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold-ink);
}
.story { max-width: 32rem; margin: 2rem auto 0; }
.story h3 {
  margin: 0 0 1.25rem; font-family: 'Great Vibes', var(--script); font-weight: 400;
  font-size: 2rem; line-height: 1.2; color: var(--wine-ink);
}
.story::before {
  content: ''; display: block; width: 3.5rem; height: 1px; margin: 0 auto 2rem; background: var(--gold-ink);
}
.story p { margin: 0 0 1.1rem; }

/* Songwriter credit */
.written {
  margin: 2.25rem auto 0; font-family: var(--display); font-size: 0.85rem;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold-ink);
}

/* Lyrics */
.lyrics { margin: 2.75rem auto 0; }
.lyrics summary {
  display: inline-block; list-style: none; cursor: pointer;
  padding: 0.85rem 2.4rem; border-radius: 999px; background: #7f1825; color: #fff;
  font-family: var(--display); font-size: 1rem; letter-spacing: 0.04em;
  box-shadow: 0 8px 20px rgba(82, 0, 8, 0.2);
  transition: background 0.25s, transform 0.25s;
}
.lyrics summary::-webkit-details-marker { display: none; }
.lyrics summary::after { content: ' ▾'; font-size: 0.8em; }
.lyrics[open] summary::after { content: ' ▴'; }
.lyrics summary:hover, .lyrics summary:focus-visible { background: var(--oxblood); transform: translateY(-1px); outline: none; }
.lyrics-head {
  display: none; margin: 2.25rem 0 1rem; font-family: var(--display); font-weight: 500;
  font-size: 0.78rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--gold-ink);
}
.lyrics-head em { font-style: normal; opacity: 0.7; }
.lyrics-body { margin-top: 2rem; text-align: left; }
.lyrics-body p { margin: 0 0 0.5rem; line-height: 1.55; }
.lyrics-body p[lang='es'] { color: var(--text); }
.lyrics-body p[lang='en'] { margin-bottom: 1.6rem; font-style: italic; font-size: 1.02rem; color: #765450; }
.lyrics-note { margin: 0.5rem 0 0; font-size: 0.9rem; font-style: italic; color: #765450; }

@media (min-width: 640px) {
  .lyrics-head { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; text-align: left; }
  .lyrics-body { display: grid; grid-template-columns: 1fr 1fr; column-gap: 2.5rem; margin-top: 1rem; }
  .lyrics-body p, .lyrics-body p[lang='en'] { margin: 0 0 1.5rem; font-size: 1.1rem; line-height: 1.6; }
}

.portrait { margin: 3.25rem auto 0; max-width: 420px; }
.portrait img {
  display: block; width: 100%; height: auto;
  border: 8px solid #fff; box-shadow: 0 18px 45px rgba(40, 0, 6, 0.22);
}

/* Closing note */
.closing {
  text-align: center; color: #fff; padding: 3rem 1.5rem 2.25rem;
  background: var(--wine); font-size: 1.15rem;
}
.closing p { margin: 0 auto 1.1rem; max-width: 34rem; }
.closing .thanks { font-style: italic; font-size: clamp(1.3rem, 4.2vw, 1.6rem); line-height: 1.5; }
.signature { font-family: var(--script); font-size: 2.1rem; color: var(--gold); }

/* Email and social links */
.connect {
  margin: 2.25rem auto 0; padding-top: 2rem; max-width: 26rem;
  border-top: 1px solid rgba(242, 210, 155, 0.25);
}
.email {
  font-size: 1.1rem; letter-spacing: 0.04em; color: var(--gold);
  text-decoration: none; overflow-wrap: anywhere; border-bottom: 1px solid rgba(242, 210, 155, 0.4);
  transition: border-color 0.25s;
}
.email:hover, .email:focus-visible { border-color: var(--gold); outline: none; }
.social { display: flex; justify-content: center; gap: 0.9rem; margin: 1.5rem 0 0; padding: 0; list-style: none; }
.social a {
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem;
  border: 1px solid rgba(242, 210, 155, 0.55); border-radius: 50%; color: var(--gold);
  transition: background 0.25s, color 0.25s, transform 0.25s;
}
.social a:hover, .social a:focus-visible { background: var(--gold); color: var(--wine-ink); transform: translateY(-2px); outline: none; }
.social svg { width: 1.2rem; height: 1.2rem; }

/* Motion */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity 1s ease, transform 1s ease; }
.js .reveal.visible { opacity: 1; transform: none; }
@keyframes rise { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
@keyframes flap-open {
  0% { transform: rotateX(0); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: rotateX(-180deg); opacity: 0; visibility: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .flap { display: none; }
  .js .reveal { opacity: 1; transform: none; }
}

@media (max-width: 480px) {
  body { font-size: 1.15rem; }
  .pockets::before { clip-path: polygon(0 30%, 50% 52%, 100% 30%, 100% 100%, 0 100%); }
  .flap { height: 48%; }
  .lang button { padding: 0.45rem 1.15rem; font-size: 0.88rem; }
  .sheet { padding-top: 2.25rem; }
}
