/* Crop excess sky while keeping the original cover couple visible. */
.opening-screen {
  isolation: isolate;
  padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
  background-color: #FCE205;
  background-image: url('paper-grain.svg');
}
.opening-layout {
  position: relative;
  z-index: 1;
  min-height: calc(100svh - 48px);
  flex-shrink: 0;
  gap: 20px;
}
.opening-layout > * { flex-shrink: 0; }
.opening-polaroid,
.opening-player {
  width: 100%;
  min-width: 0;
}
.opening-polaroid p { overflow-wrap: anywhere; }
.opening-polaroid > span { text-align: right; }
.opening-polaroid { background: #fffde4; }
.opening-polaroid > span { margin-top: 12px; }
.opening-photo { position: relative; aspect-ratio: 1600 / 2001; overflow: hidden; }
.opening-polaroid .opening-photo img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: auto;
  transform: translateY(-16.66%);
}
.opening-decoration { display: none; }

/* Keep the play button centered and every control inside even a narrow card. */
.opening-controls {
  grid-template-columns: 28px repeat(3, minmax(0, 1fr)) 28px;
  margin: 0;
  gap: clamp(2px, 1vw, 8px);
}
.opening-controls::before { content: ''; }
.opening-controls button { min-width: 0; gap: 0; }
.opening-controls button svg { display: block; max-width: 100%; }
.opening-output {
  position: static;
  width: 28px;
  height: 28px;
  justify-self: end;
}
.opening-output svg { display: block; }

@media (min-width: 700px) {
  .opening-layout {
    /* Fit the complete portrait and player on tall desktop screens. */
    width: min(500px, max(220px, calc((100svh - 410px) * 1600 / 2401 + 40px)));
  }
  .opening-polaroid { padding: 18px 20px; }
  .opening-polaroid h2 { font-size: 32px; }
  .opening-polaroid p { font-size: 29px; margin-top: 12px; }
  .opening-polaroid > span { font-size: 25px; }
  .opening-player { padding: 18px 22px; }
  .opening-track h3 { font-size: 18px; }
}

/* Fine botanical lines, ribbon bows and a double stationery border. */
@media (min-width: 960px) {
  .opening-decoration {
    display: block;
    position: fixed;
    inset: 24px;
    border: 1px solid #7d916650;
    outline: 1px solid #7d916628;
    outline-offset: -8px;
    border-radius: 120px 120px 8px 8px;
    pointer-events: none;
  }
  .opening-decoration::before,
  .opening-decoration::after {
    content: '';
    position: absolute;
    inset-block: 36px;
    left: clamp(12px, 3vw, 60px);
    width: clamp(160px, 19vw, 280px);
    background: url('opening-botanical.svg') center / contain no-repeat;
    opacity: .65;
  }
  .opening-decoration::after {
    left: auto;
    right: clamp(12px, 3vw, 60px);
    transform: scaleX(-1);
  }
}

@media (max-width: 699px) {
  .opening-screen {
    padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  }
  .opening-layout {
    min-height: calc(100svh - 40px);
    justify-content: flex-start;
    gap: 12px;
  }
  .opening-polaroid {
    /* Reserve space for the date and the complete player in mobile browsers. */
    width: min(100%, max(180px, calc((100svh - 330px) * 1600 / 2001 + 32px)));
    align-self: center;
    padding: 12px 16px;
  }
  .opening-polaroid h2 { font-size: 28px; margin-bottom: 10px; }
  .opening-polaroid > span { font-size: 24px; margin-top: 8px; }
  .opening-player { padding: 14px 20px; }
}

@media (min-width: 700px) and (max-height: 820px) {
  .opening-layout { gap: 14px; }
  .opening-polaroid { padding-block: 14px; }
  .opening-polaroid h2 { font-size: 28px; }
  .opening-polaroid > span { font-size: 22px; margin-top: 8px; }
  .opening-player { padding-block: 14px; }
  .opening-track h3 { font-size: 16px; }
}
