:root {
  color-scheme: light;
  --paper: #f8f2e8;
  --ink: #233b31;
  --green: #173b32;
  --red: #8b3541;
  --gold: #b18c51;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; background: radial-gradient(ellipse at 50% 0%, #fffaf1 0%, transparent 62%); }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid #c28d32; outline-offset: 4px; }
[hidden] { display: none !important; }
.page { max-width: 1020px; margin: auto; padding: 0 28px; }
.hero { text-align: center; padding: 66px 0 44px; }
.eyebrow { font-size: .7rem; letter-spacing: .19em; font-weight: 700; color: #8b6040; }
.eyebrow span { padding: 0 .4em; }
h1, h2 { font-family: Georgia, 'Times New Roman', serif; font-weight: 400; }
h1 { margin: 18px 0 22px; font-size: clamp(4rem, 10vw, 7rem); line-height: .82; letter-spacing: -.055em; color: var(--green); }
h1 em { font-weight: 400; color: var(--red); }
.intro { font-size: 1rem; line-height: 1.8; color: #526158; }
.progress { max-width: 330px; margin: 30px auto 0; }
.progress-label { display: flex; justify-content: space-between; font-size: .75rem; color: #59665d; margin-bottom: 8px; }
progress { width: 100%; height: 6px; border: 0; border-radius: 6px; display: block; overflow: hidden; background: #e6ded0; accent-color: var(--red); }
progress::-webkit-progress-bar { background: #e6ded0; border-radius: 6px; }
progress::-webkit-progress-value { background: var(--red); border-radius: 6px; }
progress::-moz-progress-bar { background: var(--red); border-radius: 6px; }
.section-heading { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; justify-content: space-between; border-bottom: 1px solid #dfd4c4; margin-bottom: 18px; padding-bottom: 10px; }
.section-heading h2 { margin: 0; font-size: 1.35rem; }
.section-heading p { margin: 0; font-size: .72rem; color: #66675e; }
.calendar { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.door { --door-color: #234a3d; color: #fff6e7; position: relative; isolation: isolate; overflow: hidden; min-width: 0; aspect-ratio: 4 / 5; border: 1px solid #ffffff44; border-radius: 7px; background: var(--door-color); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px; cursor: pointer; transition: transform .2s, box-shadow .2s; }
.palette-1 { --door-color: #8b3541; }
.palette-2 { --door-color: #4b6253; }
.palette-3 { --door-color: #72513e; }
.palette-4 { --door-color: #345247; }
.palette-5 { --door-color: #69333a; }
.door::after { content: ''; position: absolute; inset: 7px; border: 1px solid #fff3d640; border-radius: 3px; z-index: -1; pointer-events: none; }
.door-cover { position: absolute; width: 100%; height: 100%; inset: 0; object-fit: cover; z-index: -2; }
.door.has-cover::before { content: ''; position: absolute; inset: 0; background: linear-gradient(0deg, #101a15aa, #101a1540 60%, #101a1577); z-index: -1; }
.door-symbol { font-size: .8rem; color: #f8dfad; position: absolute; top: 12px; right: 13px; }
.door-number { font: 400 clamp(2rem, 5vw, 3.6rem)/1 Georgia, serif; text-shadow: 0 2px 8px #0005; }
.door-status { font-size: .64rem; letter-spacing: .06em; text-transform: uppercase; text-shadow: 0 1px 5px #0009; }
.door:disabled { cursor: default; opacity: .85; }
.door.available { box-shadow: 0 0 0 2px var(--gold), 0 5px 15px #7d583133; }
.door.opened { border-color: #ba9c61; }
.door:not(:disabled):hover { transform: translateY(-3px); box-shadow: 0 6px 18px #1c30294d; }
footer { text-align: center; font-size: .82rem; color: #7f7366; padding: 42px 0 38px; }
footer span { color: var(--red); }
dialog { max-width: min(480px, calc(100% - 32px)); width: 480px; max-height: 90vh; max-height: 90dvh; overflow: auto; border: 0; padding: 0; border-radius: 15px; background: #fffaf1; color: var(--ink); box-shadow: 0 20px 70px #0004; }
dialog::backdrop { background: #132e25aa; backdrop-filter: blur(5px); }
.memory { position: relative; }
.close { position: absolute; z-index: 1; right: 12px; top: 12px; border: 0; background: #fffaf1; color: var(--green); width: 38px; height: 38px; border-radius: 50%; font-size: 1.6rem; line-height: 1; cursor: pointer; box-shadow: 0 2px 8px #0002; }
.memory-photo { display: block; width: 100%; max-height: 48vh; object-fit: contain; background: #e6ded0; }
.memory-body { padding: 38px 28px 30px; text-align: center; }
.memory-body h2 { font-size: 2rem; line-height: 1.15; color: var(--red); margin: 14px 0; }
.message { white-space: pre-wrap; line-height: 1.75; overflow-wrap: anywhere; }
.memory-link { display: block; margin: 20px auto; color: var(--red); }
.done { margin-top: 18px; border: 0; background: var(--green); color: #fffaf1; border-radius: 5px; padding: 13px 20px; cursor: pointer; }
@media (max-width: 720px) { .calendar { grid-template-columns: repeat(4,minmax(0,1fr)); } .hero { padding-top: 48px; } }
@media (max-width: 480px) { .page { padding: 0 16px; } .calendar { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; } .door-number { font-size: 2.5rem; } .door-status { font-size: .6rem; } .section-heading { display: block; } .section-heading p { margin-top: 6px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Photo board: its exact portrait ratio keeps door positions aligned on all screens. */
.page { max-width: 850px; }
.hero { padding: 42px 0 28px; }
h1 { font-size: clamp(3.5rem, 9vw, 5.5rem); }
.calendar {
  position: relative; display: block; width: 100%; aspect-ratio: 1086 / 1448;
  background: #233b31 url("images/christmas.jpg") center / 100% 100% no-repeat;
  border-radius: 13px; box-shadow: 0 12px 36px #36271d30;
  isolation: isolate; container-type: inline-size;
}
.door {
  position: absolute; left: var(--x); top: var(--y); width: 13.5%; height: 9%;
  aspect-ratio: auto; padding: 0; gap: 0; min-width: 0;
  transform: translate(-50%, -50%) rotate(var(--tilt));
  background: #15382dba; border: 1px dashed #fff2cbdc; border-radius: 5px;
  box-shadow: 0 2px 7px #0005; backdrop-filter: blur(2px);
}
.door::after { inset: 3px; border-color: #ffe8b445; }
.door-number { font-size: clamp(1.15rem, 5.6cqw, 2.8rem); line-height: .95; }
.door-status { font-size: clamp(.46rem, 1.6cqw, .72rem); letter-spacing: .09em; line-height: 1.1; margin-top: 2px; }
.door-symbol { top: 3px; right: 4px; font-size: clamp(.46rem, 1.65cqw, .8rem); }
.door:disabled { opacity: 1; cursor: default; }
.door.pending { background: #674b35bd; }
.door.available { background: #a12235ed; border: 2px solid #ffe3a0; box-shadow: 0 0 13px #ffe09ab0; }
.door.opened { background: #173b3270; border: 1px solid #fff2cb; }
.door.anniversary { background: #8b3541d9; border-style: solid; border-color: #ffe3a0; }
.door.anniversary.available { background: #9b2336; }
.door.anniversary.opened { background: #8b35417a; }
.door:not(:disabled):hover { transform: translate(-50%, -50%) rotate(0) scale(1.08); z-index: 2; }
.board-hint { text-align: center; font-size: .78rem; color: #7f7366; }
@media (max-width: 480px) { .page { padding: 0 10px; } .calendar { border-radius: 8px; } .hero { padding-top: 30px; } .door-symbol { right: 3px; top: 2px; } }

.memory-gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 20px 20px 0;
}
.memory-photo {
  display: block;
  width: 100%;
  max-height: 46vh;
  object-fit: contain;
  background: #e6ded0;
  border-radius: 10px;
}
.letter {
  margin-top: 22px;
  text-align: left;
  white-space: pre-wrap;
  line-height: 1.85;
  background: #fff6ea;
  border: 1px solid #eadbc4;
  border-radius: 12px;
  padding: 18px 16px;
  box-shadow: inset 0 1px 0 #fff;
}
@media (min-width: 700px) {
  .memory-gallery:has(img:nth-child(2)) {
    grid-template-columns: 1fr 1fr;
  }
}


/* Full-screen calendar: the board and photo share exactly the same bounds. */
html, body { width: 100%; height: 100%; margin: 0; }
body { min-width: 0; overflow: hidden; background: #173b32; }
.page {
  position: relative; isolation: isolate; display: grid; place-items: center;
  width: 100%; max-width: none; height: 100vh; height: 100dvh;
  padding: 0; margin: 0; overflow: hidden;
}
.page::before {
  content: ''; position: absolute; inset: -30px; z-index: -1;
  background: url("images/christmas.jpg") center / cover no-repeat;
  filter: blur(24px) brightness(.6); pointer-events: none;
}
/* Photo dimensions are 1086 x 1448 (3:4). Fit the complete board into the viewport. */
.calendar {
  width: min(100vw, 75vh);
  width: min(100vw, 75dvh);
  height: auto; aspect-ratio: 3 / 4;
  border-radius: 0; box-shadow: none;
  background: #173b32 url("images/christmas.jpg") center / 100% 100% no-repeat;
}
/* All dimensions are relative to the photo board, not the window. */
.door { width: 13.5%; height: 9%; }
.door-number { font-size: 5.6cqw; }
.door-status { font-size: 1.65cqw; margin-top: .35cqw; }
.door-symbol { font-size: 1.65cqw; top: .55cqw; right: .7cqw; }
.door::after { inset: .65cqw; }

/* Tall WhatsApp screenshots: preserve the complete image and let the popup scroll. */
#memory-dialog:has(#memory-gallery img[src*="30-texts"]) {
  width: min(900px, calc(100% - 32px));
  max-width: calc(100% - 32px);
  max-height: 92vh;
  max-height: 92dvh;
  overscroll-behavior: contain;
}
#memory-gallery:has(img[src*="30-texts"]) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 16px;
  padding: 58px 20px 0;
}
#memory-gallery img[src*="30-texts"] {
  width: 100%;
  max-width: 440px;
  height: auto;
  max-height: none;
  object-fit: contain;
  justify-self: center;
  background: transparent;
  border: 1px solid #e6ded0;
  border-radius: 9px;
}
#memory-dialog:has(#memory-gallery img[src*="30-texts"]) .memory-body {
  max-width: 680px;
  margin-inline: auto;
}
@media (max-width: 650px) {
  #memory-dialog:has(#memory-gallery img[src*="30-texts"]) {
    width: calc(100% - 16px);
    max-width: calc(100% - 16px);
  }
  #memory-gallery:has(img[src*="30-texts"]) {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 56px 8px 0;
  }
  #memory-dialog:has(#memory-gallery img[src*="30-texts"]) .memory-body {
    padding: 24px 16px;
  }
}
