/**
 * Calendar, event lists and cards
 * One of the stylesheets of the website, loaded in a fixed order by php/include/header.php
 * (list and order: AGENTS.md, "Stylesheets").
 */

/**
 * @section Calendar
 * Year of the events pages (modules/events/index.php): one table per month, weeks from Monday.
 * Event days are filled dark blue (past ones on "Termine": a ring), today is yellow (a yellow
 * circle, or a yellow ring inside the blue one).
 * Phones: the months stand in one row that scrolls sideways and snaps to each month, with two
 * arrows; the page scrolls the row to the current month on load.
 */

.calendar {
  width: 100%;
}
.calendar > header {
  align-items: center;
  display: flex;
  flex-wrap: nowrap;
  font-size: 1.5em;
  justify-content: space-between;
}
.calendar > header div {
  text-align: center;
  min-width: 22%;
}
.calendar > header div:first-child {
  text-align: left;
}
.calendar > header div:last-child {
  text-align: right;
}
.calendar > header h2 {
  margin: 0;
}
.calendar .months {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  margin-bottom: 1.5em;
  width: 100%;
}
.calendar .month {
  background-color: var(--color-white);
  border-collapse: separate;
  border-radius: var(--border-radius);
  flex-grow: 0.0833;
  line-height: 1.5;
  margin: 0.5em;
  min-width: 290px;
  overflow: hidden;
  width: auto;
}
.calendar .month thead th {
  color: var(--color-white);
  font-weight: bold;
  padding: 6px 0 4px;
  text-align: center;
}
/* the blue only behind the month's name: on the whole head it shows between the weekday cells
   as thin lines */
.calendar .month thead {
  background-color: transparent;
}
.calendar .month thead tr:first-child th {
  background-color: var(--color-darkblue);
}
.calendar .month thead tr.weekdays th {
  background-color: var(--color-darkblue-toned);
  color: var(--color-white);
  font-size: 0.75em;
  font-weight: normal;
  letter-spacing: 0.06em;
  padding: 6px 0 2px;
  text-transform: uppercase;
}
/* no stripes and no hover of the general tables */
.calendar .month tbody tr {
  background: none;
  color: inherit;
}
.calendar .month td.day {
  padding: 2px 0;
  text-align: center;
}
.calendar .month tbody tr:last-child td.day {
  padding-bottom: 6px;
}
.calendar .day.we {
  /* see-through, so the shadow of the weekday row stays visible above the weekend */
  background-color: var(--color-lightgray-transparent-light);
}
.calendar .day.oldMonth,
.calendar .day.newMonth {
  background: none;
}
.calendar .day > a,
.calendar .day > span {
  border-radius: 50%;
  color: var(--color-black);
  display: inline-grid;
  font-variant-numeric: tabular-nums;
  height: 2em;
  place-items: center;
  text-decoration: none;
  width: 2em;
}
.calendar .day.past > span {
  color: var(--color-gray-text);
}
.calendar .day.reserved > a {
  background-color: var(--color-darkblue);
  color: var(--color-white);
  font-weight: bold;
}
.calendar .day.reserved > a:hover,
.calendar .day.reserved > a:focus-visible {
  background-color: var(--color-darkblue-toned);
}
.calendar .day.reserved.past > a {
  background-color: transparent;
  box-shadow: inset 0 0 0 1.5px var(--color-darkblue);
  color: var(--color-darkblue);
}
.calendar .day.reserved.past > a:hover,
.calendar .day.reserved.past > a:focus-visible {
  background-color: var(--color-darkblue-transparent-light);
}
/* today is yellow: a yellow circle, or with an event a yellow ring inside the blue circle
   (yellow on white is too pale for a thin ring) */
/* (a link on the bus page, where every day opens its bookings) */
.calendar .day.today:not(.reserved) > * {
  background-color: var(--color-yellow);
  color: var(--color-black);
  font-weight: bold;
}
.calendar .day.today.reserved > a {
  /* blue edge, yellow ring, blue middle: the yellow has dark blue on both sides */
  box-shadow: inset 0 0 0 2px var(--color-darkblue), inset 0 0 0 5px var(--color-yellow);
}

/* phones: one row of months, each as wide as the page, snapping to the middle; two arrows over
   the heads of the months go to the month before or after, the first month has no left one and
   the last no right one (script in modules/events/index.php) */
.calendar .months-wrap {
  position: relative;
}
.calendar .months-step {
  display: none;
}
@media (max-width: 640px) {
  /* not wider than a month needs on large phones */
  .calendar .months-wrap {
    margin-inline: auto;
    max-width: 24rem;
  }
  .calendar .months {
    /* as wide as the page allows, not as wide as the twelve months in it */
    contain: inline-size;
    flex-wrap: nowrap;
    gap: 1rem;
    justify-content: flex-start;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    /* room for the shadow of the months, the negative margin keeps them in line with the text */
    margin-inline: -8px;
    padding: 0 8px 12px;
    scroll-padding-inline: 8px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }
  .calendar .month {
    flex: 0 0 100%;
    margin: 0.5rem 0 0;
    min-width: 0;
    scroll-snap-align: center;
  }
  .calendar .month thead tr:first-child th {
    height: 2.5rem;
    padding: 0;
  }
  .calendar .months-step {
    background: transparent;
    border: 0;
    color: var(--color-white);
    cursor: pointer;
    display: inline-grid;
    font: inherit;
    font-size: 1.15rem;
    height: 2.5rem;
    padding: 0;
    place-items: center;
    position: absolute;
    top: 0.5rem;
    width: 2.75rem;
    z-index: 1;
  }
  .calendar .months-step[data-step="-1"] {
    border-top-left-radius: var(--border-radius);
    left: 0;
  }
  .calendar .months-step[data-step="1"] {
    border-top-right-radius: var(--border-radius);
    right: 0;
  }
  .calendar .months-step:hover,
  .calendar .months-step:focus-visible {
    outline: none;
  }
  .calendar .months-step:focus-visible {
    box-shadow: inset 0 0 0 2px var(--color-white);
  }
}

/**
 * @section Events
 */
.events,
main.page .events {
  margin: 0;
  list-style: none;
}
.event,
main.page .event {
  clear: both;
  margin-bottom: 2em;
}
.event h3 {
  clear: none;
}
.event .place {
  font-variant: small-caps;
  margin-top: -0.2em;
}
.event > .description {
  min-height: 20px;
}
.event.canceled .title {
  text-decoration: line-through;
  text-decoration-color: var(--color-darkblue);
  text-decoration-style: double;
}

.attachments,
main.page .attachments,
.helpsList,
main.page .helpsList {
  margin-left: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
}

.helpOverview li {
  display: inline;
}
.helpOverview li:not(:last-child)::after {
  content: ",";
}

/* Link cards (php/include/cards.php): attachments of an event, content linked to a news entry,
   coming events, the calendar; they grow with a long title */
li.attachment {
  box-sizing: border-box;
  margin-bottom: 0.25em;
  border-radius: 5px;
  overflow: hidden;
  position: relative;
  margin-right: 1%;
  width: 49%;
}
/* Lucide icon of the card (--icon, set by cards.php), drawn in the theme colour */
li.attachment figure {
  background-color: var(--color-darkblue);
  mask: var(--icon, url(/img/icons/file.svg)) center / contain no-repeat;
  margin: 0;
  pointer-events: none;
  position: absolute;
  top: 5px;
  left: 5px;
  height: 37px;
  width: 64px;
}
/* preview picture instead of the icon (gallery, press article) */
li.attachment figure.thumb {
  mask: none;
  background: var(--color-ultralightgray) center / cover no-repeat;
  border-radius: 3px;
}
li.attachment > a {
  box-sizing: border-box;
  color: inherit;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 47px;
  padding: 4px 10px 4px 80px;
  position: relative;
  text-decoration: none;
  transition: background-color 0.25s linear;
}
li.attachment > a:hover,
li.attachment > a:focus,
li.attachment > a:active {
  background-color: var(--color-yellow-transparent-light);
}
li.attachment span.title {
  font-weight: bold;
}
li.attachment > a:hover span.title,
li.attachment > a:focus span.title,
li.attachment > a:active span.title {
  text-decoration: underline;
}
li.attachment span.subline {
  font-size: 0.8em;
  text-decoration: none !important;
}

li.helps {
  box-sizing: border-box;
  font-size: 0.9em;
  padding: 0 1em 0 0.5em;
  width: 49%;
  margin-right: 1%;
}
li.helps .title {
  width: 100%;
  display: block;
  font-size: 1.2em;
  font-weight: bold;
}
li.helps .progress {
  display: block;
  height: 23px;
  border-radius: 5px;
  margin-left: -0.5em;
  margin-right: -1em;
}
li.helps .amount {
  text-shadow: var(--color-white) 0px 0px 5px;
  font-size: 13px;
  margin: 3px 0.5em;
  float: right;
}
li.helps .description {
  padding: 1em 0;
  width: 100%;
}
li.helps .description :first-child {
  margin-top: 0;
}
li.helps .description :last-child {
  margin-bottom: 0;
}
li.helps .contact a {
  float: right;
}
li.helps .contact button {
  background: transparent;
  border: none;
  color: var(--color-darkblue);
  cursor: pointer;
  float: right;
}
li.helps .contact button:hover span,
li.helps .contact button:focus span,
li.helps .contact button:active span {
  text-decoration: underline;
}

/* phones and narrow windows (the sidebar moves below the content) */
@media (max-width: 990px) {
  li.attachment,
  li.helps {
    margin-right: 0;
    width: 100%;
  }
  .event.card .event {
    margin-left: -1em;
    margin-right: -1em;
  }
}
