/*
 * Advent Calendar Styles
 *
 * This stylesheet defines the look and feel of the digital Advent calendar.
 * It provides responsive grid layouts for the calendar, custom theming via
 * CSS variables, styling for the modal dialog, lock icons and tooltips for
 * future doors, and typography rules including a festive script font for
 * headings. The design aims to be clean, modern and easily customisable.
 */

/* Google Fonts import: Dancing Script for headings and Roboto for body text */
@import url('https://fonts.googleapis.com/css2?family=Dancing+Script:wght@700&family=Roboto:wght@400;700&display=swap');

/* Root variables for colours, shadows and radii */
:root {
  --primary: #0b6aa9;
  --muted: #708090;
  --ink: #0f1f2a;
  --snow: #f2f7fb;
  --shadow: 0 10px 20px rgba(0,0,0,.08), 0 6px 6px rgba(0,0,0,.06);
  --ring: 0 0 0 3px rgba(11,106,169,.2), 0 0 0 6px rgba(11,106,169,.12);
  --radius: 18px;
}
.aam-advent body { … }
.aam-advent .calendar { … }
.aam-advent .door { … }


/* Global reset and base styles */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, var(--snow), #ffffff);
  color: var(--ink);
  font-family: 'Roboto', sans-serif;
}

/* Header styling */
.aam-header {
  max-width: 1100px;
  margin: 24px auto 8px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.brand-text h1 {
  margin: 0;
  font-weight: 800;
  font-size: clamp(22px, 2.6vw, 36px);
}

.brand-text .sub {
  margin: 4px 0 0;
  color: var(--muted);
}

.admin-badge {
  margin: 6px 0 0;
  background: #eef6ff;
  color: #17416b;
  padding: 6px 10px;
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
}

/* Button styles */
.btn {
  appearance: none;
  border: 1px solid transparent;
  background: var(--primary);
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 999px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.btn:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn.subtle {
  background: #eef2f6;
  color: #263238;
  border-color: #dde5ee;
}

.btn.ghost {
  appearance: none;
  border: 1px solid #dbe5ef;
  background: #ffffff;
  color: #0b2640;
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(0,0,0,.05);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.btn.ghost:hover {
  filter: brightness(1.02);
  transform: translateY(-1px);
}

.btn.ghost:active {
  transform: translateY(0);
}

/* Calendar grid container */
.calendar-wrap {
  max-width: 1100px;
  margin: 12px auto 40px;
  padding: 0 16px;
}

.calendar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
}

@media (max-width: 1000px) {
  .calendar { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 640px) {
  .calendar { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 420px) {
  .calendar { grid-template-columns: repeat(2, 1fr); }
}

/* Door styling */
.door {
  display: block;
  position: relative;
  border-radius: var(--radius);
  overflow: visible; /* allow tooltip to be visible outside the door */
  box-shadow: var(--shadow);
  background: #cfe7f7;
}

.door .tile {
  aspect-ratio: 1/1;
  display: grid;
  place-items: center;
  overflow: hidden; /* clip the image inside the tile */
  pointer-events: none; /* disable click on the tile itself */
}

.door .tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.door .number {
  position: absolute;
  bottom: 8px;
  right: 12px;
  color: #ffffff;
  font-weight: 800;
  text-shadow: 0 1px 0 rgba(0,0,0,.2), 0 2px 10px rgba(0,0,0,.25);
}

.door.is-today {
  box-shadow: var(--ring), var(--shadow);
}

/* When doors are disabled, only reduce opacity – do not block pointer events entirely. */
.door[aria-disabled] {
  opacity: 0.75;
  pointer-events: auto !important; /* keep pointer events on the door so the lock can be interacted with */
}

/* Lock icon for future doors */
.door .lock {
  position: absolute;
  z-index: 3;
  left: 10px;
  top: 10px;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: #ffffffc9;
  box-shadow: 0 6px 14px rgba(0,0,0,.12), 0 1px 3px rgba(0,0,0,.08);
  display: inline-block;
  cursor: help;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%230b2640'%3E%3Cpath d='M17 8h-1V6a4 4 0 10-8 0v2H7a2 2 0 00-2 2v8a2 2 0 002 2h10a2 2 0 002-2v-8a2 2 0 00-2-2zm-7-2a2 2 0 114 0v2H10V6zm8 12H6v-8h12v8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px 16px;
}

/* Tooltip-Blase zentriert und breiter */
.door .lock[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  top: 50%;               /* vertikal in die Mitte */
  left: 50%;              /* horizontal in die Mitte */
  transform: translate(-50%, -50%);
  min-width: 220px;       /* Mindestbreite */
  max-width: 400px;       /* maximale Breite */
  width: auto;            /* passt sich dem Inhalt an */
  background: #004b7b;    /* Hintergrundfarbe bleibt */
  color: #fff;
  font-size: 12px;
  line-height: 1.35;
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: 0 10px 20px rgba(0,0,0,.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
  z-index: 5;             /* sorgt dafür, dass der Tooltip über der Kachel liegt */
}


/* Pfeil unter dem Tooltip */
.door .lock[data-tip]::before {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(100% + 6px);
  border: 6px solid transparent;
  border-top-color: #004b7b;  /* Farbe des Pfeils (wie Hintergrund) */
  opacity: 0;
  transition: opacity .15s ease;
}
/* Sichtbarkeitssteuerung (Hover/Fokus oder per JS) */
.door .lock:hover::after,
.door .lock:focus::after,
.door .lock:hover::before,
.door .lock:focus::before,
.door .lock.tip-visible::after,
.door .lock.tip-visible::before {
  opacity: 1;
}


/* When tooltip is visible, slide bubble upward */
.door:hover .lock[data-tip]::after,
.door .lock:hover::after,
.door .lock:focus::after,
.door .lock.tip-visible::after {
  transform: translateX(-50%) translateY(0);
}

/* Modal dialog styling */
.aam-dialog {
  border: 0;
  padding: 0;
  max-width: 860px;
  width: calc(100% - 28px);
  border-radius: 20px;
  box-shadow: 0 40px 80px rgba(0,0,0,.28);
  transform: translateY(8px) scale(.98);
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
}

.aam-dialog::backdrop {
  background: rgba(9,14,20,.55);
  backdrop-filter: blur(2px);
}

.aam-dialog.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.aam-dialog.closing {
  opacity: 0;
  transform: translateY(8px) scale(.98);
}

.dialog-shell {
  background:
    linear-gradient(180deg, rgba(255,255,255,.85), rgba(255,255,255,.92)),
    radial-gradient(1200px 400px at 100% -20%, rgba(11,106,169,.10), transparent 50%);
  backdrop-filter: blur(6px);
  border-radius: 20px;
  overflow: hidden;
}

.dialog-header {
  position: relative;
  padding: 22px 22px 14px;
  background:
    linear-gradient(180deg, #f7fbff 0%, #ffffff 60%),
    radial-gradient(1200px 400px at -20% -30%, rgba(11,106,169,.10), transparent 50%);
  border-bottom: 1px solid #ecf1f6;
}

/* Heading styling: festive script font */
.dialog-title,
h2.dialog-title {
  margin: 6px 0 8px;
  font-family: 'Dancing Script', cursive;
  font-weight: 700;
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.2;
  color: #0f1f2a;
}

.tag {
  display: inline-block;
  background: #eef6ff;
  color: #17416b;
  font-weight: 700;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
}

.headline-wrap {
  display: flex;
  gap: 14px;
  align-items: center;
}

.thumb {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 8px 18px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.06);
  background: #f3f6fb;
}

@media (min-width: 720px) {
  .thumb {
    width: 64px;
    height: 64px;
    border-radius: 16px;
  }
}

.code-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.code-pill {
  display: inline-block;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: .3px;
  padding: 8px 12px;
  border-radius: 12px;
  background: #f3f6fb;
  border: 1px dashed #d7e2ee;
  color: #0b2640;
}

.dialog-body {
  padding: 18px 22px 8px;
}

.teaser.rich p {
  margin: 0 0 10px;
}

.teaser.rich a {
  color: var(--primary);
  text-decoration: underline;
}

.teaser.rich ul,
.teaser.rich ol {
  margin: 0 0 10px 20px;
}

.dialog-footer {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  padding: 14px 22px 18px;
  border-top: 1px solid #ecf1f6;
}

.dialog-close-form {
  position: absolute;
  right: 10px;
  top: 10px;
}

.modal-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: #f4f6f8;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

.note {
  color: var(--muted);
  font-size: 14px;
  margin-top: 6px;
}

.aam-footer {
  text-align: center;
  color: var(--muted);
  padding: 18px;
}
