.advent-intro > p { margin-block: .65rem; color: var(--muted); }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem 1rem; margin-top: 2rem; }
.controls select { width: auto; max-width: 100%; min-height: 44px; }
#status { margin: 0 0 0 auto; color: var(--muted); }
#doors { list-style: none; padding: 0; }
#doors .open { border-color: var(--rose); }
#doors .card-body p { margin: 0; }
#doors .locked .door-status { color: var(--muted); }
@media (max-width: 520px) {
  #status { flex-basis: 100%; margin-left: 0; }
}

#doors .player {
  --door-accent: #b9a6ca;
  background: #100c17;
  color: #f4f2f6;
}
#doors .player:nth-child(6n + 2) { --door-accent: #c7a1eb; }
#doors .player:nth-child(6n + 4) { --door-accent: #8ad4df; }
#doors .player:nth-child(6n) { --door-accent: #e3a1bb; }
.doorway {
  position: relative;
  isolation: isolate;
  perspective: 750px;
  width: min(66%, 13rem);
  aspect-ratio: 3 / 4;
  margin: 1.5rem auto .25rem;
  border: 3px double var(--door-accent);
  border-radius: 50% 50% 6px 6px / 28% 28% 6px 6px;
  background: radial-gradient(ellipse at 50% 70%, #745099, #1a1029 75%);
  box-shadow: 0 0 22px #8b62b43d;
}
.door-leaf, .door-interior {
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
.door-leaf {
  display: grid;
  place-items: center;
  width: 100%;
  padding: 0;
  border: 1px solid var(--door-accent);
  color: #f6eafa;
  background: repeating-linear-gradient(90deg, #ffffff09 0 1px, transparent 1px 18%), linear-gradient(140deg, #463253, #191220 75%);
  box-shadow: inset 0 0 0 7px #0e091480, inset 0 0 20px #0009;
  transform-origin: left center;
  transition: transform .8s cubic-bezier(.22,.7,.2,1);
  z-index: 1;
}
button.door-leaf { cursor: pointer; }
button.door-leaf:hover, button.door-leaf:focus-visible {
  box-shadow: inset 0 0 0 7px #0e091480, 0 0 20px var(--door-accent);
  outline: 2px solid var(--door-accent);
  outline-offset: 3px;
}
.door-number { font: clamp(2.6rem, 7vw, 4rem)/1 "Instrument Serif", Georgia, serif; }
.door-handle {
  position: absolute;
  right: 10%;
  top: 60%;
  width: .55rem;
  height: .55rem;
  border-radius: 50%;
  background: var(--door-accent);
  box-shadow: 0 0 8px var(--door-accent);
}
.locked .doorway { filter: saturate(.55); }
.revealed .door-leaf { transform: rotateY(-106deg); }
.door-interior:not([hidden]) {
  display:grid;
  grid-template-rows:1.75rem minmax(0,1fr);
  gap:.3rem;
  padding:1.1rem .45rem .6rem;
  text-align:center;
  overflow:hidden;
  background:radial-gradient(ellipse at center,#77569c 0%,#271738 70%);
}
.door-sparkle {
  display:grid;
  place-items:center;
  overflow:hidden;
  min-height:0;
  color:var(--door-accent);
  pointer-events:none;
}
.door-sparkle > span {
  display:block;
  font:1rem/1 "DM Sans",sans-serif;
  white-space:pre;
  text-shadow:0 0 8px currentColor;
  animation:door-particles .9s ease-out both;
}
.door-reward-content {
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-start;
  gap:.45rem;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  scrollbar-width:thin;
  scrollbar-color:#b9a6ca88 transparent;
}
.door-glow {
  color: #fff2ff;
  font-size: 2.5rem;
  text-shadow: 0 0 20px var(--door-accent);
  animation: door-light .85s ease-out both;
}
#doors .door-interior a { margin: 0; padding: .4rem; }
@keyframes door-light {
  from { opacity: 0; transform: scale(.5); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes door-particles {
  from { opacity: 0; transform: translateY(.7rem) scale(.5); }
  to { opacity: .9; transform: translateY(-.1rem) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .door-leaf { transition: none; }
  .door-sparkle > span, .door-glow { animation: none; }
}

#doors { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#doors .doorway { width: min(68%, 10rem); margin-top: 1rem; }
#doors .card-body { padding: 1rem; gap: .35rem; }
@media (max-width: 850px) {
  #doors { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  #doors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 360px) {
  #doors { grid-template-columns: minmax(0, 1fr); }
}

.advent-night { color: #f4edf8; }
.site-content:has(.advent-night) {
  background-color: #0b0913;
  background-image:
    radial-gradient(circle at 19px 23px, #e7d4ff70 0 1px, transparent 1.5px),
    radial-gradient(circle at 63px 92px, #fbf2ff55 0 1px, transparent 1.5px),
    radial-gradient(ellipse at 50% 14rem, #39224f, transparent 40rem);
  background-size: 127px 151px, 193px 211px, auto;
}
.advent-night .advent-intro {
  display: grid;
  justify-items: center;
  text-align: center;
  padding: clamp(2rem, 6vw, 5rem) 1rem clamp(1.5rem, 4vw, 3rem);
}
.advent-night .advent-intro h1 {
  color: #fbf2ff;
  text-shadow: 0 0 38px #bb8ee291;
  margin: .7rem 0 0;
}
.advent-night .advent-intro p,
.advent-night #status { color: #dfcfe8; }
.advent-night .controls {
  border-block: 1px solid #bc98d550;
  padding: .75rem 0;
}
.advent-night .controls select {
  background: #181122;
  color: #f4edf8;
  border-color: #bc98d580;
}
.advent-night #doors .player {
  background: linear-gradient(155deg, #23162f, #100c17 75%);
  border-color: #9376a661;
}
.advent-night #doors .player.open { border-color: var(--door-accent); }
.advent-night #doors .door-status { color: #ddcae5; }
.advent-night #doors .revealed .doorway { box-shadow: 0 0 30px #bf80f283; }

/* Reward names belong behind the door, never below the closed door. */
#doors .door-interior:has(.door-reward-title) {
  padding:1.1rem .45rem .6rem;
  overflow:hidden;
}
#doors .door-reward-title {
  margin: 0;
  color: #fff2ff;
  font: 600 clamp(.75rem, 1.1vw, .95rem)/1.25 "DM Sans", sans-serif;
  overflow-wrap: anywhere;
}
#doors .door-interior:has(.door-reward-title) :is(.patreon-button,.somnus-gift-button) {
  font-size: .75rem;
  line-height: 1.25;
  flex-shrink: 0;
}

.advent-gift-dialog { width:min(44rem,calc(100% - 32px)); max-height:85dvh; box-sizing:border-box; overflow:auto; padding:clamp(20px,5vw,40px); border:1px solid #9376a6; border-radius:14px; background:#15101e; color:#f4edf8; box-shadow:0 20px 80px #0009; }
.advent-gift-dialog::backdrop { background:#08050cbb; }
.advent-gift-dialog .player { padding:0; border:0; background:transparent; color:inherit; }
.advent-gift-dialog h2 { font:clamp(2.2rem,6vw,3.5rem)/1.1 "Instrument Serif",Georgia,serif; margin:1rem 0 1.5rem; }
.advent-gift-dialog p { font:1rem/1.7 "DM Sans",sans-serif; }
.gift-close { display:block; margin-left:auto; min-height:44px; padding:.5rem 1rem; background:#e9e4ed; color:#15101e; border:0; border-radius:6px; font:inherit; cursor:pointer; }
.advent-gift-dialog .audio-cover { object-fit:contain; background:#08060b; }
.advent-gift-dialog .cookie-player-note,.advent-gift-dialog .library-actions { color:#e9e4ed; }
.advent-gift-dialog a { color:inherit; }
@media(prefers-reduced-motion:reduce) { .door-leaf { transition:none; } }
.advent-gift-dialog .player p { color:#dfcfe8; }
/* Once opened, keep the narrow door leaf clear of the gift controls. */
#doors .revealed .door-leaf { transform:rotateY(-110deg); }

/* Written gifts keep their own reading rhythm; earlier gifts retain their styles. */
.written-gift-toolbar { position:sticky; top:0; z-index:2; padding-bottom:.75rem; background:#15101e; box-shadow:0 -20px 0 20px #15101e; }
.advent-gift-dialog .written-gift { max-width:62ch; }
.advent-gift-dialog .written-gift > p { line-height:1.85; margin:0 0 1.25rem; }
.advent-gift-dialog .written-gift .gift-metadata { font-size:.875rem; color:#c7afd9; }
.winter-affirmations { list-style:none; padding:0; margin:2rem 0 .5rem; }
.winter-affirmations li { padding:1.5rem 0; border-top:1px solid #9376a64d; font:1.125rem/1.85 "DM Sans",sans-serif; color:#f4edf8; }
.winter-affirmations li + li { margin-top:1rem; }
.dreaming-steps { padding-left:1.65rem; margin:1.75rem 0 0; }
.dreaming-steps > li { padding-left:.35rem; margin:0 0 1.6rem; }
.dreaming-steps > li::marker { color:#dbc0ed; }
.advent-gift-dialog .dreaming-steps h3 { margin:0 0 .5rem; font:600 1.05rem/1.5 "DM Sans",sans-serif; color:#f4edf8; }
.advent-gift-dialog .dreaming-steps p { margin:0; line-height:1.85; }

/* The calendar crescent identifies native Somnus gifts. Patreon retains its own mark. */
.catalog-grid .somnus-gift-button::before {
  content:"";
  display:block;
  width:16px;
  height:16px;
  flex:none;
  background:none;
  border-radius:50%;
  box-shadow:inset -3.25px -1.5px 0 currentColor;
  filter:drop-shadow(0 0 3px #d69ef188);
  transform:rotate(-23deg);
}
#doors .door-reward-content > :is(.patreon-button,.somnus-gift-button) { margin:0; max-width:100%; gap:.35rem; }
#doors .door-reward-content > :is(.patreon-button,.somnus-gift-button) { padding:.4rem; }
@media(max-width:620px) {
  #doors .doorway { min-height:11rem; }
}
