:root {
  --pink: #d57091;
  --pink-light: #f3aec5;
  --green: #697a2d;
  --cream: #fff8ee;
  --handwriting: "Segoe Print", "Bradley Hand", cursive;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--pink);
  color: var(--cream);
  font-family: Georgia, "Times New Roman", serif;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 3px solid var(--cream);
  outline-offset: 8px;
}

/* Opening screen */

.invitation {
  min-height: 100svh;
  padding: 70px 24px 90px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.invitation h1 {
  margin: 0;
  font-size: clamp(2.3rem, 6vw, 4.2rem);
  font-weight: 400;
  letter-spacing: 0.035em;
  text-shadow: 1px 2px 0 rgb(97 42 59 / 18%);
}

.subtitle {
  margin: 8px 0 56px;
  font-family: var(--handwriting);
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  font-style: italic;
}

.envelope-button {
  display: block;
  width: min(440px, 78vw);
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transform: rotate(-6deg);
  transition: transform 250ms ease;
}

.envelope-button:hover {
  transform: rotate(-3deg) translateY(-5px);
}

.envelope {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 14px 9px rgb(83 37 48 / 25%));
}

.tap-hint {
  margin: 32px 0 0;
  font-family: var(--handwriting);
  font-size: 1rem;
}

/* Letter and berry border */

.letter-section {
  position: relative;
  min-height: 100svh;
  background: var(--green);
}

/* The detailed berry illustration is added by script.js. */
.pink-border {
  position: relative;
  height: clamp(95px, 12vw, 160px);
}

.letter-content {
  max-width: 920px;
  margin: 0 auto;
  padding: 38px 32px 90px;
}

/* Penguin and heading */

.letter-heading {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 42px;
  margin-bottom: 38px;
  padding-bottom: 115px;
}

.penguin-scene {
  position: relative;
  width: 260px;
  flex-shrink: 0;
  text-align: center;
}

.penguin {
  display: block;
  width: 220px;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border: 6px solid var(--cream);
  border-radius: 48% 48% 44% 44%;
  transform: rotate(-5deg);
  box-shadow: 0 6px 0 rgb(40 49 16 / 15%);
}

.heart {
  position: absolute;
  z-index: 1;
  color: var(--pink-light);
  font-family: Georgia, serif;
  line-height: 1;
  text-shadow: 2px 3px 0 rgb(40 49 16 / 20%);
}

.heart-one {
  top: 5px;
  left: 0;
  font-size: 3rem;
  transform: rotate(-20deg);
}

.heart-two {
  top: 20px;
  right: 0;
  font-size: 2.3rem;
  transform: rotate(18deg);
}

.heart-three {
  bottom: 8px;
  right: 1px;
  font-size: 3.5rem;
  transform: rotate(12deg);
}

.letter-heading h2 {
  margin: 0;
  font-family: var(--handwriting);
  font-size: clamp(2rem, 4.8vw, 3.8rem);
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0.06em;
}

/* A small floral illustration.
   Embedded SVG means no extra image file is needed. */

.letter-heading::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 180px;
  height: 105px;
  transform: translateX(-50%);
  pointer-events: none;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 220 130'%3E%3Cg fill='none' stroke='%23b9c48b' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M111 118Q94 83 65 47'/%3E%3Cpath d='M111 118Q123 79 163 43'/%3E%3Cpath d='M111 118Q109 78 112 44'/%3E%3C/g%3E%3Cg fill='%239cab6b' stroke='%23bdc88f' stroke-width='.8'%3E%3Cpath d='M99 96Q65 94 57 66Q85 71 99 96Z'/%3E%3Cpath d='M122 93Q156 89 171 65Q140 68 122 93Z'/%3E%3Cpath d='M108 85Q90 67 93 51Q111 63 108 85Z'/%3E%3C/g%3E%3Cg stroke='%23c77894' stroke-width='1'%3E%3Cpath fill='%23ed9fba' d='M65 54Q40 47 43 24L54 32L61 17L70 30L81 23Q88 47 65 54Z'/%3E%3Cpath fill='%23f7c6d6' d='M65 54Q50 44 54 32Q66 33 70 30Q77 44 65 54Z'/%3E%3Cpath fill='%23e998b4' d='M160 53Q139 44 145 22L156 29L166 15L172 29L184 24Q185 47 160 53Z'/%3E%3Cpath fill='%23f8c8d8' d='M160 53Q152 41 156 29Q166 33 172 29Q174 44 160 53Z'/%3E%3C/g%3E%3Cg fill='%23ffe9ee' stroke='%23e7a0b7' stroke-width='.9' stroke-linejoin='round'%3E%3Cpath d='M112 45Q97 25 108 7Q120 23 112 45Z'/%3E%3Cpath d='M112 45Q117 22 137 17Q135 36 112 45Z'/%3E%3Cpath d='M112 45Q132 36 147 46Q131 56 112 45Z'/%3E%3Cpath d='M112 45Q128 52 127 69Q112 63 112 45Z'/%3E%3Cpath d='M112 45Q99 62 85 61Q90 46 112 45Z'/%3E%3Cpath d='M112 45Q90 44 83 28Q104 28 112 45Z'/%3E%3C/g%3E%3Cg fill='none' stroke='%23db8da8' stroke-width='1'%3E%3Cpath d='M112 45L109 20M112 45L128 27M112 45L136 46M112 45L121 59M112 45L94 56M112 45L92 34'/%3E%3C/g%3E%3Cg stroke='%23c4ad68' stroke-width='1.1' fill='%23e4cc83'%3E%3Cpath d='M112 45L105 34M112 45L117 32M112 45L123 38'/%3E%3Cellipse cx='105' cy='33' rx='2' ry='3'/%3E%3Cellipse cx='117' cy='31' rx='2' ry='3'/%3E%3Cellipse cx='124' cy='38' rx='3' ry='2'/%3E%3C/g%3E%3Cg fill='none' stroke='%23f2b2c7' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M110 107Q91 92 93 105Q97 112 110 107Q125 93 129 102Q129 111 110 107'/%3E%3Cpath d='M109 108L100 121M113 108L124 119'/%3E%3C/g%3E%3C/svg%3E");
}

/* Larger, comfortably spaced letter text */

.letter-body {
  font-family: var(--handwriting);
  font-size: clamp(1.2rem, 1.8vw, 1.4rem);
  line-height: 1.95;
  text-align: left;
  overflow-wrap: break-word;
}

.letter-body p {
  margin: 0 0 32px;
}

.letter-body .sign-off {
  margin-top: 48px;
  text-align: right;
}

.back-button {
  min-height: 44px;
  margin-top: 24px;
  padding: 10px 0;
  border: 0;
  background: transparent;
  color: var(--cream);
  font-family: var(--handwriting);
  font-size: 1rem;
  text-decoration: underline;
  text-underline-offset: 5px;
  cursor: pointer;
}

/* Phone layout */

@media (max-width: 600px) {
  .invitation {
    padding: 48px 20px 70px;
  }

  .subtitle {
    margin-bottom: 42px;
  }

  .letter-content {
    padding: 30px 24px 70px;
  }

  .letter-heading {
    flex-direction: column;
    gap: 30px;
    margin-bottom: 30px;
    padding-bottom: 105px;
    text-align: center;
  }

  .letter-heading::after {
    width: 160px;
    height: 95px;
  }

  .penguin-scene {
    width: 220px;
  }

  .penguin {
    width: 180px;
  }

  .letter-body {
    font-size: 1.2rem;
    line-height: 1.9;
  }
}

@media (prefers-reduced-motion: reduce) {
  .envelope-button {
    transition: none;
  }
}