/**
 * esadventcalendar 2.0.2 - responsive layout
 * All doors are positioned in percent relative to the board, the board keeps a
 * fixed aspect ratio. The calendar therefore scales identically in a column,
 * full width, fullscreen or inside the popup.
 */
.es-advent-calendar {
  --es-font-color: #fffb04;
  --es-frame-color: #ffffff;
  --es-pulse-color: rgba(255, 255, 255, .9);
  --es-ratio: 1.77778;
  --es-max-width: 1400px;
  --es-min-width: 0px;
  max-width: var(--es-max-width);
  margin: 0 auto 2rem;
  box-sizing: border-box;
}
.es-advent-calendar[hidden] { display: none !important; }
.es-advent-calendar *,
.es-advent-calendar *::before,
.es-advent-calendar *::after { box-sizing: border-box; }

.es-advent-calendar__title { text-align: center; margin: 0 0 .75rem; }

/* On narrow screens the board scrolls horizontally instead of shrinking the doors too much */
.es-advent-calendar__scroller {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

/* The board always has the exact aspect ratio of the background image:
   the image is shown completely, never stretched and never cropped. */
.es-advent-calendar__board {
  position: relative;
  width: 100%;
  min-width: var(--es-min-width);
  aspect-ratio: var(--es-ratio);
  background-color: #000;
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 100% 100%;   /* identical ratio -> no distortion */
  container-type: inline-size;
}

.es-door {
  position: absolute;
  aspect-ratio: 1 / 1;
  min-width: 26px;
  min-height: 26px;
  z-index: 1;
  container-type: inline-size;
}
.es-door:hover { z-index: 5; }

.es-door__inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border: 2px solid var(--es-frame-color);
  background: rgba(0, 0, 0, .15);
  color: var(--es-font-color);
  font-size: 14px;
  font-size: clamp(11px, 42cqi, 30px);   /* relative to the door size */
  font-weight: 700;
  line-height: 1;
  text-decoration: none !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .85);
  overflow: hidden;
  transition: background-color .2s, transform .2s;
}
a.es-door__inner:hover,
a.es-door__inner:focus { color: var(--es-font-color); background: rgba(255, 255, 255, .85); }
a.es-door__inner:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.es-door__number { position: relative; z-index: 2; }

.es-door__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .2s;
  z-index: 1;
}
.es-door__inner:hover .es-door__image,
.es-door--past .es-door__image { opacity: 1; }

.es-door--today .es-door__inner {
  border-width: 3px;
  animation: es-door-pulse 2s infinite;
}
@keyframes es-door-pulse {
  0%   { box-shadow: 0 0 0 0 var(--es-pulse-color); }
  70%  { box-shadow: 0 0 0 20px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.es-door--future .es-door__inner { cursor: not-allowed; }
.es-door__inner.is-locked { cursor: default; }

/* Tooltip for past days */
.es-door__tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: 150px;
  padding: 6px 8px;
  background: #fff;
  color: #222;
  border-radius: 5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .5);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
  z-index: 20;
  pointer-events: none;
}
.es-door__tooltip img {
  position: absolute;
  top: -14px;
  left: 50%;
  width: 18px;
  height: 18px;
  margin-left: -9px;
}
.es-door--past:hover .es-door__tooltip { display: block; }
/* doors in the lower half: tooltip above the door */
.es-door--bottom .es-door__tooltip { top: auto; bottom: calc(100% + 10px); }
.es-door--bottom .es-door__tooltip img { top: auto; bottom: -14px; transform: rotate(180deg); }

/* ---------- Modal (popup mode, vouchers, messages) ---------- */
.es-advent-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2vmin;
  background: rgba(0, 0, 0, .75);
}
.es-advent-modal__dialog {
  position: relative;
  width: min(1400px, 96vw);
  max-height: 96vh;
  overflow: auto;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
}
/* Calendar inside the popup: limit width so the full board fits into the viewport height */
.es-advent-modal--calendar .es-advent-modal__dialog {
  width: min(var(--es-max-width, 1400px), 96vw, calc((96vh - 5rem) * var(--es-ratio, 1.77778)));
  padding: 1rem;
}
.es-advent-modal--message .es-advent-modal__dialog {
  width: min(800px, 92vw);
  padding: 2rem;
  text-align: center;
}
.es-advent-modal .es-advent-calendar { margin: 0; max-width: none; }
.es-advent-modal__close {
  position: absolute;
  top: 4px;
  right: 8px;
  z-index: 30;
  border: 0;
  background: transparent;
  font-size: 32px;
  line-height: 1;
  color: #333;
  cursor: pointer;
}
.es-voucher-image { max-width: 200px; margin-top: 1.5rem; }
.es-voucher-text { text-align: left; margin-top: 1rem; }
