:root {
  --color-background: #f5ede0;
  --color-primary: #0f2a57;
  --color-accent-light: #80aee4;
  --color-accent: #4c80bb;
  --color-accent-dark: #294680;
  --color-text-dark: #1b2540;
  --color-text-light: #f5ede0;
  --color-wax-seal: #b33a3a;
  --letter-width: 90vw;
  --letter-height: calc(var(--letter-width) * 9/16);
  --half-letter-width: calc(var(--letter-width) / 2);
  --half-letter-height: calc(var(--letter-height) / 2);
  --tree-quarter-letter-height: calc(var(--letter-width) / 2.5);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-size: 75%;
}

body {
  background-color: var(--color-background);
  color: var(--color-text-dark);
  font-family: 'Alice', serif, 'Times New Roman', Times, serif;
  font-weight: 400; 
  font-style: normal;
  line-height: 1.5;
  padding: 0;
  margin: 0;
}

h1, h2, h3 {
  font-family: 'Bodoni Moda', serif, 'Times New Roman', Times, serif;
  font-optical-sizing: auto;
  font-style: normal;
}

.noise{
  background-image: url("data:image/svg+xml,%3C!-- svg: first layer --%3E%3Csvg viewBox='0 0 250 250' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='8' numOctaves='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' opacity='0.1' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

.language-switcher {
  position: fixed;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.5rem;
  z-index: 20;
}

.language-switcher button {
  font-family: 'Alice', serif, 'Times New Roman', Times, serif;
  font-size: small;
  min-width: 2.5rem;
  padding: 0.6rem 0.75rem;
  background-color: var(--color-accent-dark);
  color: var(--color-text-light);
  border-radius: 999px;
}

.language-switcher button[aria-pressed="true"] {
  background-color: var(--color-accent);
}

.envelope-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin-top: 5rem;
}

.lid {
  position: absolute;
  height: 100%;
  width: 100%;
  top: 0;
  left: 0;
  border-right: var(--half-letter-width) solid transparent;
  border-bottom: var(--half-letter-height) solid transparent;
  border-left: var(--half-letter-width) solid transparent;
  transform-origin: top;
  transition: transform 0.25s linear;
}

/* Lid when closed */
.lid.one {
  border-top: var(--half-letter-height) solid var(--color-accent-dark);
  transform: rotateX(0deg);
  z-index: 3;
  transition-delay: 0.75s;
}

/* Lid when opened */
.lid.two {
  border-top: var(--half-letter-height) solid var(--color-primary);
  transform: rotateX(90deg);
  z-index: 0;
  transition-delay: 0.5s;
}

.letter-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: transparent;
  border-radius: 15px;
  transition: 0.5s;
  display: flex;
  justify-content: center;
}

.letter-container > * {
  position: absolute;
  width: 90%;
  height: 100%;
  padding: 1rem;
  background-color: var(--color-background);
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  transition: transform 0.5s ease, opacity 0.5s ease;
  transform: translateY(0) rotate(0deg);
  z-index: 2;
  overflow: hidden;
}

.envelope {
  position: relative;
  width: var(--letter-width);
  aspect-ratio: 16 / 9;
  background-color: var(--color-primary);
  display: flex;
  justify-content: center;
  z-index: 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.envelope > h1 {
  position: absolute;
  bottom: 1rem;  
  color: var(--color-text-dark);
  font-family: 'Alice', serif, 'Times New Roman', Times, serif;
  z-index: 3;
}

.envelope-front {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  border-top: var(--half-letter-height) solid transparent;
  border-bottom: var(--half-letter-height) solid var(--color-accent-light);
  border-right: var(--half-letter-width) solid var(--color-accent-light);
  border-left: var(--half-letter-width) solid var(--color-accent);
  z-index: 3;
}

.envelope.open .lid.one {
  transform: rotateX(90deg);
  transition-delay: 0s;
}

.envelope.open .lid.two {
  transform: rotateX(180deg);
  transition-delay: 0.25s;
}

.envelope.open .letter-container .picture-card {
  transform: translate(0, calc(-1 * var(--tree-quarter-letter-height))) rotate(0deg);
  transition-delay: 0.6s;
}

body.no-scroll {
  overflow: hidden;
}

.scroll-hint {
  position: absolute;
  display: flex;
  justify-content: center;
  align-items: center;
  border: none;
  width: 3rem;
  height: 3rem;
  background: var(--color-wax-seal);
  color: var(--color-text-light);
  border-radius: 100%;
  font-size: min(2rem, 10vw);
  box-shadow: 0 12px 24px rgba(15, 42, 87, 0.14);
  animation: hint-bounce 1.5s ease-in-out infinite;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
  opacity: 1;
  visibility: visible;
  cursor: pointer;
}

.scroll-hint.hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(-10px);
  pointer-events: none;
}

@keyframes hint-bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

.timer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timer-container > h1 {
  font-size: 2rem;
  margin: 0rem;
}

.timer-container > p {
  font-size: 1.5rem;
  margin: 0.5rem;
}

.timer-container > table {
  text-align: center;
  border-collapse: collapse;
}

.timer-container > table tr:first-child td {
  font-size: 1.5rem;
}

.timer-container>th,td {
  padding: 0 1rem;
}


button {
  background-color: var(--color-primary);
  color: var(--color-text-light);
  border: none;
  padding: 0.75rem 1.5rem;
  font-family: 'Alice', serif, 'Times New Roman', Times, serif;
  font-size: 1rem;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.25s ease;
  box-shadow: 1px 1px 6px 0px rgba(0, 0, 0, 0.20);
}

img,
video,
iframe {
  max-width: 100%;
  height: auto;
}


@media (min-width: 768px) {
  html,
  body {
    font-size: 100%;
  }

  :root {
    --letter-width: 690px;
    --tree-quarter-letter-height: calc(var(--letter-height) / 2);
  }

  .envelope-container {
    margin-top: 1rem;
  }
}

/* If media landscape */
@media (orientation: landscape) and (max-width: 768px) {
  :root {
    --letter-width: 60vw;
  }
  .envelope-container {
    margin-top: 5rem;
  }
}


@media (hover: none) and (pointer: coarse) {
  .scroll-hint {
    animation: none;
  }
}
