:root {
  color-scheme: light;
  --paper: #f4ead8;
  --cream: #fff8e9;
  --ink: #27382f;
  --muted: #526056;
  --spruce: #23483c;
  --berry: #923b3d;
  --gold: #f1d29e;
  --serif: Georgia, "Times New Roman", serif;
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper);
  scroll-behavior: smooth;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
body:has(dialog[open]) { overflow: hidden; }
[hidden] { display: none !important; }
a { color: inherit; }
button, summary { cursor: pointer; }
button { font: inherit; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }

.mail {
  max-width: 1160px;
  margin-inline: auto;
  padding: clamp(12px, 3.5vw, 36px);
}
.mail-toggle { list-style: none; text-align: center; }
.mail-toggle::-webkit-details-marker { display: none; }
.cover {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(26px, 6svh, 52px);
  min-height: calc(100svh - 2 * clamp(12px, 3.5vw, 36px));
  padding: 28px 0;
  background: radial-gradient(ellipse at 50% 48%, #fff8e9 0%, transparent 65%);
}
.cover-title {
  color: var(--spruce);
  font: clamp(2.6rem, 8.6vw, 5.5rem)/1.02 var(--serif);
  letter-spacing: -.075em;
}
.cover-title em { color: var(--berry); }
.envelope {
  position: relative;
  isolation: isolate;
  width: min(81vw, 478px);
  aspect-ratio: 1.65;
  border-radius: 6px;
  background: #376252;
  box-shadow: 0 24px 54px -21px #2c382d99, 0 3px 8px #2c382d38;
  transform: rotate(-4deg);
  transition: transform .24s ease;
}
@media (hover: hover) {
  .mail-toggle:hover .envelope { transform: rotate(-1deg) translateY(-4px); }
}
.envelope::before,
.envelope::after,
.envelope-fold {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
.envelope::before {
  background: linear-gradient(160deg, #31715b, #204334);
  clip-path: polygon(0 10%, 50% 54%, 100% 10%, 100% 100%, 0 100%);
}
.envelope::after {
  z-index: 1;
  background: linear-gradient(157deg, #5b8063, #385c4c 75%);
  clip-path: polygon(0 0, 100% 0, 100% 10%, 50% 62%, 0 10%);
}
.envelope-fold {
  background: linear-gradient(164deg, #436d59, #244a3c);
  clip-path: polygon(0 100%, 50% 51%, 100% 100%);
}
.envelope-greeting {
  position: absolute;
  z-index: 2;
  bottom: 10%;
  right: 9%;
  font: italic clamp(1.05rem, 3.2vw, 1.65rem)/1 var(--serif);
  color: #fff3d9;
}
.seal {
  position: absolute;
  z-index: 2;
  top: 57%;
  left: 50%;
  display: grid;
  place-items: center;
  width: clamp(46px, 11vw, 72px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%) rotate(9deg);
  border: 3px solid #ac5956;
  border-radius: 46% 52% 47% 54%;
  color: #f9d8bd;
  background: radial-gradient(circle at 35% 28%, #ba6158, #923b3d 75%);
  box-shadow: 0 3px 5px #1f382f85, inset 0 0 0 1px #793231;
  font-size: clamp(1rem, 4vw, 1.65rem);
}
.open-label, .album-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  min-height: 48px;
  padding: 10px 19px;
  border-radius: 100px;
  text-decoration: none;
  font-size: .94rem;
  font-weight: 720;
}
.open-label { background: var(--berry); color: var(--cream); }
.open-label span, .album-link span { font-size: 1.13em; }
.close-label { display: none; }
.mail[open] .cover { display: none; }
.mail[open] .mail-toggle { text-align: start; width: fit-content; margin-bottom: 5px; }
.mail[open] .close-label {
  display: flex;
  align-items: center;
  min-height: 44px;
  gap: 8px;
  font-size: .84rem;
  padding-inline: 5px;
  color: var(--muted);
}
.mail[open] .contents { animation: unfold .48s ease-out both; }
@keyframes unfold {
  from { opacity: .35; transform: translateY(9px); }
  to { opacity: 1; transform: none; }
}

.postcard {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 26px;
  min-height: min(630px, max(465px, 72svh));
  padding: clamp(26px, 7vw, 82px);
  border-radius: 14px;
  background: #122a22 url("assets/zimni-les.jpg") 64% center / cover no-repeat;
  color: var(--cream);
}
.postcard::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(90deg, #0d211dca, #0d211d63 55%, #0d211d21);
}
.postcard h1 {
  width: fit-content;
  font-size: clamp(4.05rem, 12vw, 9.5rem);
  line-height: .96;
  letter-spacing: -.09em;
  white-space: nowrap;
}
.postcard h1:focus-visible { outline-offset: 7px; }
.postcard h1 span { color: var(--gold); font-style: italic; padding-right: .07em; }
.postcard-greeting {
  margin-top: 12px;
  font: italic clamp(2.1rem, 5.3vw, 4rem)/1.05 var(--serif);
  letter-spacing: -.055em;
}
.postcard-message { max-width: 37ch; margin-top: 18px; font-size: 1rem; line-height: 1.58; }
.signature { margin-top: 19px; font: italic clamp(1.13rem, 2.7vw, 1.55rem)/1.25 var(--serif); color: var(--gold); }
.signature span { display: inline-block; padding-left: 4px; font-size: .75em; }
.album-link { background: var(--gold); color: #1d362c; }
.album-link:hover { background: #fff0cc; }

.album { padding-block: clamp(46px, 7vw, 90px) 25px; scroll-margin-top: 10px; }
.album-intro h2 {
  font-size: clamp(2.65rem, 7vw, 5.3rem);
  letter-spacing: -.075em;
  line-height: 1;
}
.album-intro em { color: var(--berry); }
.album-intro > p { color: var(--muted); line-height: 1.5; margin-top: 12px; }
.moments { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 25px; }
.moment {
  min-width: 0;
  padding: 9px;
  border: 1px solid #dbcfba;
  border-radius: 8px;
  background: var(--cream);
  box-shadow: 0 6px 16px #352d2010;
}
.photo-button, .video-frame {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1.03;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: var(--spruce);
}
.moment-picture, .moment-image, .photo-placeholder { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-placeholder { display: grid; place-items: center; color: var(--gold); font-size: 3rem; }
.expand {
  position: absolute;
  display: grid;
  place-items: center;
  right: 8px;
  bottom: 8px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--cream);
  color: var(--ink);
}
.eyebrow {
  color: var(--muted);
  font-size: .73rem;
  font-weight: 720;
  line-height: 1.35;
}
.moment-caption { padding: 13px 8px 10px; }
.moment-caption h3 { font-size: clamp(1.36rem, 3vw, 1.65rem); line-height: 1.13; margin-top: 5px; }
.moment-caption > p:not(.eyebrow) { color: var(--muted); font-size: .94rem; line-height: 1.5; margin-top: 6px; }
.video-play {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  width: 100%;
  height: 100%;
  border: 0;
  color: var(--cream);
  background: radial-gradient(ellipse at 75% 16%, #506a4d, transparent 70%), var(--spruce);
  font-size: .91rem;
  font-weight: 700;
}
.video-play.autumn { background: radial-gradient(ellipse at 75% 16%, #915b50, transparent 70%), #543232; }
.play-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  padding-left: 2px;
  border: 1px solid #fff9ebaa;
  border-radius: 50%;
}
.video-play:hover .play-icon, .video-play:focus-visible .play-icon { background: var(--gold); color: var(--spruce); }
.video-play:focus-visible { outline-offset: -5px; }
.video-frame iframe { width: 100%; height: 100%; border: 0; }
.video-link, .return-link { display: inline-flex; align-items: center; min-height: 44px; text-underline-offset: .25em; font-size: .87rem; }
.return-link { margin-top: 17px; }

.album-controls { display: none; }
.album-controls button, .gallery-bar button, .gallery-controls button {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid #9fa99a;
  border-radius: 50%;
  color: var(--ink);
  background: var(--cream);
  font-size: 1.28rem;
}
.album-controls button:disabled { opacity: .42; cursor: default; }
.album-controls button:not(:disabled):hover,
.gallery-bar button:hover,
.gallery-controls button:hover { background: #eadcc5; }
dialog {
  width: min(850px, calc(100% - 22px));
  max-height: calc(100dvh - 24px);
  overflow: auto;
  padding: 0;
  border: 1px solid #e8dfcb;
  border-radius: 12px;
  color: var(--ink);
  background: var(--cream);
}
dialog::backdrop { background: #081711df; }
.gallery-body { padding: 10px; }
.gallery-bar, .gallery-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gallery-bar { padding: 0 0 8px 5px; }
.gallery-photo {
  height: min(58dvh, 570px);
  background: var(--spruce);
  border-radius: 4px;
  overflow: hidden;
  touch-action: pan-y pinch-zoom;
}
.gallery-photo img { object-fit: contain; }
.gallery-bottom { padding: 12px 5px 4px; }
.gallery-caption h2 { font-size: clamp(1.45rem, 4vw, 2.2rem); margin-block: 3px 4px; }
.gallery-caption > p:not(.eyebrow) { line-height: 1.4; color: var(--muted); }
.gallery-controls { display: flex; gap: 6px; flex: none; }

@media (max-width: 680px) {
  .mail { --gutter: clamp(12px, 3.5vw, 24px); padding: var(--gutter); }
  .postcard {
    min-height: min(525px, max(415px, 68svh));
    padding: 24px clamp(17px, 5vw, 30px);
    background-image: url("assets/zimni-les-mobil.webp");
    background-position: 63% center;
  }
  .postcard::before { background: linear-gradient(90deg, #0d211de3, #0d211d95 68%, #0d211d5f); }
  .postcard h1 { font-size: clamp(3.55rem, 15vw, 5.6rem); }
  .postcard-message { max-width: 30ch; }
  .album-controls { display: flex; align-items: center; justify-content: flex-end; gap: 11px; margin-top: 13px; }
  .album-controls p { min-width: 44px; text-align: center; color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
  .moments {
    --slide: min(calc(91vw - 2 * var(--gutter)), 422px);
    position: relative;
    grid-auto-flow: column;
    grid-auto-columns: var(--slide);
    grid-template-columns: none;
    gap: 12px;
    margin: 11px calc(-1 * var(--gutter)) 0;
    padding: 5px max(var(--gutter), calc(100% + var(--gutter) - var(--slide))) 12px var(--gutter);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--gutter);
  }
  .moment { scroll-snap-align: start; }
  .photo-button, .video-frame { aspect-ratio: 1.06; }
  .moment-caption { padding: 12px 6px 9px; }
  .gallery-bottom { align-items: start; flex-wrap: wrap; }
  .gallery-controls { margin-inline-start: auto; }
}
@media (prefers-reduced-motion: reduce) {
  :root { scroll-behavior: auto; }
  .envelope { transition: none; }
  .mail[open] .contents { animation: none; }
}
