/* Christmas folio: share the same palette across the board, invitation and stationery. */
body {
  --night: #492029;
  --frame: #c19452;
  --light: #fff0c6;
  --ink-accent: #852e39;
  --scene: url("/art/village.webp");
  --shelf: #572e32;
}
body[data-world="forest"] {
  --night: #103c39;
  --frame: #88a9a2;
  --light: #e2fff2;
  --ink-accent: #205a52;
  --scene: url("/art/forest.webp");
  --shelf: #194743;
}
body[data-world="candy"] {
  --night: #662e50;
  --frame: #e6b7aa;
  --light: #fff0df;
  --ink-accent: #903a64;
  --scene: url("/art/candy.webp");
  --shelf: #823f61;
}
body:has(#calendar-section) {
  background:
    radial-gradient(ellipse at 2% 8%, #efe0c5 0, transparent 38rem), #faf7ef;
}
.site-header {
  max-width: none;
  border-bottom: 1px solid #d9c8ad;
  background: #fffbf2;
  padding: 12px max(4vw, 18px);
}
.brand-mark {
  border: 1px solid #d8bd78;
  outline: 1px solid #285144;
  outline-offset: 2px;
}
.calendar-section {
  width: min(1320px, 100%);
  max-width: none;
  padding: 0 clamp(15px, 3.5vw, 56px);
  margin: 30px auto;
}
.calendar-section:not(.has-calendar) {
  display: grid;
  grid-template-columns: minmax(255px, 0.77fr) minmax(0, 1.5fr);
  column-gap: clamp(22px, 4vw, 68px);
  grid-template-areas: "hero world" "themes world" "setup world" "space world";
  grid-template-rows: auto auto auto 1fr;
}
.calendar-section:not(.has-calendar) .calendar-top {
  display: none;
}
.home-hero {
  grid-area: hero;
  text-align: left;
  padding: clamp(30px, 5vw, 88px) 0 0;
}
.home-hero h1 {
  color: #273f36;
  font-size: clamp(48px, 4.8vw, 75px);
  line-height: 0.99;
  letter-spacing: -0.053em;
  margin: 0 0 18px;
}
.home-hero h1 em {
  display: block;
  color: var(--ink-accent);
}
.hero-description {
  max-width: 29em;
  line-height: 1.5;
  color: #586356;
  font-size: 16px;
  margin: 0;
}
.theme-switcher {
  grid-area: themes;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 5px;
  margin: 26px 0 16px;
}
.theme-pill {
  border-radius: 5px;
  border: 1px solid #dacdb4;
  background: #fffcf5;
  padding: 8px 9px;
  min-height: 42px;
  color: #484b42;
  font-size: 11px;
}
.theme-pill.active {
  background: var(--night);
  color: #fff8e6;
  border-color: var(--night);
}
.create-panel {
  grid-area: setup;
  align-self: start;
  padding: 0;
  margin: 0;
  border: 0;
  box-shadow: none;
  background: none;
}
.create-controls {
  margin: 0;
  flex-wrap: wrap;
}
.create-controls input {
  flex: 1 1 130px;
  min-width: 0;
  border-color: #baac8f;
  background: #fffdf7;
}
.create-controls .primary {
  background: var(--ink-accent);
  padding-inline: 14px;
  min-height: 48px;
  font-weight: 700;
}
.form-detail {
  text-align: left;
  margin: 9px 0;
  color: #5d6459;
}
.form-detail #timezone-label:not(:empty) {
  display: block;
}
.calendar-world {
  grid-area: world;
  isolation: isolate;
  border: 4px double var(--frame);
  border-radius: 16px;
  padding: 4px;
  background-color: var(--night);
  background-image:
    linear-gradient(
      180deg,
      transparent 12%,
      color-mix(in srgb, var(--night) 32%, transparent) 40%,
      var(--night) 104%
    ),
    var(--scene);
  background-size: cover;
  background-position: 50% 50%;
  box-shadow:
    0 11px 32px #38271e32,
    inset 0 0 0 2px var(--night);
  color: var(--light);
}
.calendar-world::before {
  content: "";
  position: absolute;
  inset: 3px 4% auto;
  height: 15px;
  z-index: 1;
  pointer-events: none;
  border-top: 1px solid #d1aa697a;
  border-radius: 50%;
  background: radial-gradient(
      ellipse at 50% 40%,
      #fffbea 1px,
      #ffd87e 2px,
      #e4a34d70 3px,
      transparent 6px
    )
    0 0/27px 15px repeat-x;
}
.world-scene,
.theme-forest .world-scene,
.theme-candy .world-scene {
  height: clamp(100px, 10vw, 148px);
  background: transparent;
  display: grid;
  align-items: flex-end;
  overflow: visible;
}
.world-scene > img {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}
.scene-wash {
  background: linear-gradient(180deg, #08132340, transparent);
}
.world-scene .scene-label {
  inset: auto auto 9px 14px;
  display: block;
  text-align: left;
  background: var(--night);
  border: 1px solid var(--frame);
  border-radius: 3px;
  color: var(--light);
  text-shadow: none;
  padding: 5px 13px;
  box-shadow: 2px 3px 0 #261d252f;
}
.scene-label span:first-child {
  display: block;
  color: var(--light);
  font-size: 8px;
  letter-spacing: 0.19em;
  font-weight: 650;
}
.world-scene .scene-label span:last-child {
  font: clamp(18px, 2vw, 29px)/1.1 var(--serif);
  color: var(--light);
  margin: 2px 0;
}
.scene-star {
  display: none;
}
.calendar-grid,
.theme-candy .calendar-grid,
.theme-forest .calendar-grid {
  background: none;
  margin: 0;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 3px 4px;
  padding: 7px 11px 12px;
}
.calendar-grid .gift {
  position: relative;
  border: 0;
  border-radius: 4px;
  aspect-ratio: 1.11;
  min-height: 46px;
  box-shadow: none;
  background: linear-gradient(
    0deg,
    color-mix(in srgb, var(--shelf) 90%, transparent),
    #fff3 7%,
    #fff1 45%,
    transparent
  );
  border-bottom: 2px solid var(--frame);
  padding: 3px 3px 14px;
}
.calendar-grid .gift:hover {
  background-color: #fff3;
  z-index: 2;
}
.calendar-grid .gift .gift-image {
  width: 93%;
  height: 95%;
  transform: none;
  filter: drop-shadow(1px 5px 3px #27161d78);
}
.calendar-grid .gift:nth-child(7n) .gift-image {
  transform: rotate(-4deg) scale(0.93);
}
.calendar-grid .gift.wrap-silver .gift-image {
  filter: saturate(0.35) brightness(1.1) drop-shadow(1px 5px 3px #27161d78);
}
.calendar-grid .gift.opened .gift-image {
  opacity: 0.76;
}
.calendar-grid .gift .gift-number {
  bottom: 1px;
  min-width: 27px;
  height: 22px;
  border: 1px solid #ae854d;
  background: #fff2d3;
  color: #482a25;
  line-height: 20px;
  font: 700 14px/20px var(--sans);
  border-radius: 6px 6px 3px 3px;
  box-shadow: 0 1px 3px #27161d88;
  text-align: center;
}
.calendar-grid .gift.filled .gift-number {
  background: var(--night);
  color: white;
  border-color: #eee2bc;
}
.gift-status {
  z-index: 3;
  top: 0;
  right: 0;
  background: #fff5df;
  color: #50291f;
  font: bold 9px/17px var(--sans);
  box-shadow: 0 1px 2px #0004;
}
.gift[data-status="Unwrap"] .gift-status {
  background: #ffdc86;
  color: #452f12;
}
.gift[data-status="Opened"] .gift-status {
  background: #215441;
  color: white;
}
.calendar-grid .gift-sender {
  bottom: 0;
  text-shadow: 0 1px 2px #000;
  background: var(--night);
  color: white;
  z-index: 2;
  font-size: 9px;
  border-radius: 3px;
}
.calendar-grid .filled .gift-number {
  bottom: 14px;
}
.wrap-label {
  display: none;
}
.calendar-grid .gift-sticker {
  width: 22px;
  height: 22px;
  left: 2px;
  top: 1px;
}
.world-caption,
.theme-forest .world-caption,
.theme-candy .world-caption {
  padding: 6px 8px;
  color: var(--light);
  background: var(--night);
  font-size: 11px;
  letter-spacing: 0.01em;
}
.theme-candy {
  border-style: solid;
  border-image: none;
  outline: 2px dashed #bf6e85;
  outline-offset: -6px;
}
.theme-forest {
  border-radius: 26px 5px;
  border-color: #b8cfc2;
}
.calendar-section.has-calendar {
  max-width: 960px;
  margin-top: 18px;
}
.calendar-section.has-calendar .calendar-top {
  margin-bottom: 12px;
}
.calendar-top h2,
.calendar-top p {
  margin: 4px 0;
}
dialog:has(#note-form),
dialog:has(.read-note),
dialog:has(.sent-parcel) {
  background:
    linear-gradient(#fffaf0e8, #fcf1dfe8),
    var(--scene) center/cover;
  border: 1px solid #c7a376;
  border-top: 6px solid var(--ink-accent);
}
.letter-address {
  border-block: 1px solid #cbb390;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0;
  font: italic 23px var(--serif);
  color: var(--ink-accent);
}
.postmark {
  border: 2px double currentColor;
  border-radius: 50%;
  padding: 7px;
  color: var(--ink-accent);
  transform: rotate(-10deg);
  font: 700 8px/1.2 var(--sans);
  letter-spacing: 0.16em;
  text-align: center;
}
#note-body,
.read-note {
  background:
    repeating-linear-gradient(
      transparent 0 27px,
      #b8a28455 28px,
      transparent 29px
    ),
    #fffaf0;
  color: #3f392e;
  line-height: 29px;
}
#note-body {
  font: 17px/29px var(--serif);
  padding: 8px 12px;
}
.sent-parcel {
  text-align: center;
  padding: 9px;
}
.sent-parcel img {
  width: 115px;
  height: 115px;
  object-fit: contain;
}
.return-link {
  border: 1px solid #b49360;
  background: #fff3d9;
  padding: 9px 15px;
  border-radius: 4px;
}
dialog:has(.unwrapping-gift) {
  background: radial-gradient(ellipse at center, #fff8e5, #eee2c7);
  overflow: hidden;
}
.unwrapping-gift {
  margin-top: 35px;
}
.gift-lid-half {
  animation: lid-away 2.25s both;
}
.gift-bottom-half {
  animation: box-settle 2.25s both;
}
.ribbon-end {
  position: absolute;
  top: 37%;
  left: 47%;
  width: 36%;
  height: 9px;
  background: linear-gradient(#c1974f, #fff2ad, #ae8247);
  border-radius: 100%;
  transform-origin: left;
  animation: ribbon-slide 2.25s both;
}
.ribbon-left {
  --flip: -1;
}
.ribbon-right {
  --flip: 1;
}
.unwrap-glow {
  position: absolute;
  inset: -20%;
  background: radial-gradient(
    ellipse,
    #fff9d7 0,
    #ffcf6ba8 20%,
    transparent 66%
  );
  animation: glow-up 2.25s both;
}
.rising-letter {
  position: absolute;
  left: 20%;
  top: 40%;
  width: 60%;
  padding: 16px 4px;
  text-align: center;
  background:
    repeating-linear-gradient(transparent 0 13px, #c5ac8155 14px), #fff7dc;
  border: 1px solid #cfac72;
  font: italic 22px var(--serif);
  box-shadow: 1px 4px 7px #73442e44;
  animation: letter-rise 2.25s both;
}
.read-note {
  animation: paper-settle 0.35s ease-out both;
}
@keyframes box-settle {
  0%,
  12%,
  38% {
    transform: none;
  }
  7% {
    transform: scale(0.94) rotate(-3deg);
  }
  20% {
    transform: rotate(2deg);
  }
  75%,
  100% {
    transform: translateY(15px);
    opacity: 0.75;
  }
}
@keyframes lid-away {
  0%,
  12%,
  39% {
    transform: none;
  }
  7% {
    transform: scale(0.94) rotate(-3deg);
  }
  20% {
    transform: rotate(2deg);
  }
  68%,
  100% {
    transform: translate(-22px, -80px) rotate(-20deg);
    opacity: 0;
  }
}
@keyframes ribbon-slide {
  0%,
  13% {
    transform: scale(0);
    opacity: 0;
  }
  22% {
    transform: scaleX(var(--flip)) rotate(21deg);
    opacity: 1;
  }
  43%,
  100% {
    transform: scaleX(var(--flip)) translateX(64%) rotate(-22deg);
    opacity: 0;
  }
}
@keyframes glow-up {
  0%,
  43% {
    opacity: 0;
    transform: scale(0.45);
  }
  75%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes letter-rise {
  0%,
  60% {
    opacity: 0;
    transform: translateY(12px) scale(0.7);
  }
  82%,
  100% {
    opacity: 1;
    transform: translateY(-35px) rotate(-5deg);
  }
}
@keyframes paper-settle {
  from {
    transform: translateY(9px);
    opacity: 0.7;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@media (max-width: 780px) {
  .calendar-section:not(.has-calendar) {
    display: flex;
    flex-direction: column;
    gap: 0;
  }
  .calendar-section {
    margin: 14px auto;
    padding: 0 12px;
  }
  .home-hero {
    order: 0;
    padding: 0 3px;
    text-align: left;
  }
  .home-hero h1 {
    font-size: clamp(34px, 8.9vw, 49px);
    line-height: 0.99;
    max-width: 15em;
    margin: 0 0 6px;
  }
  .home-hero h1 em {
    display: inline;
  }
  .hero-description {
    font-size: 13px;
    line-height: 1.35;
    max-width: 36em;
    margin: 0;
  }
  .create-panel {
    order: 1;
    margin: 12px 0 0;
    padding: 0;
    align-self: stretch;
  }
  .create-controls {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 6px;
  }
  .create-controls input {
    width: 0;
    min-width: 0;
    flex: 1;
    font-size: 16px;
  }
  .create-controls .primary {
    min-height: 46px;
    width: auto;
    font-size: 12px;
    padding-inline: 12px;
  }
  .form-detail,
  .form-detail #timezone-label:not(:empty) {
    display: inline;
    font-size: 10px;
  }
  .form-detail {
    display: block;
    margin: 4px 0;
  }
  .inline-error:empty {
    display: none;
  }
  .theme-switcher {
    order: 2;
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 3px;
    margin: 5px 0 7px;
  }
  .theme-pill {
    min-height: 44px;
    padding: 4px 5px;
    flex: 1;
    justify-content: center;
    font-size: clamp(9px, 2.62vw, 12px);
    line-height: 1.1;
  }
  .calendar-world {
    order: 3;
  }
  .calendar-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2px 4px;
    padding: 3px 5px 10px;
  }
  .theme-forest .calendar-grid,
  .theme-candy .calendar-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2px 4px;
    padding: 3px 5px 10px;
  }
  .world-scene,
  .theme-forest .world-scene,
  .theme-candy .world-scene {
    height: 89px;
  }
  .world-scene .scene-label {
    left: 7px;
    bottom: 4px;
    padding: 3px 8px;
  }
  .calendar-grid .gift {
    min-height: 48px;
    aspect-ratio: 1.14;
  }
  .calendar-grid .gift-sticker {
    width: 17px;
    height: 17px;
  }
  .gift-status {
    font-size: 8px;
    line-height: 14px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .unwrapping-gift *,
  .read-note {
    animation: none !important;
  }
}
