:root {
  --color-text: #222;
  --color-bg-main: #f8fafc;
  --color-bg-secondary: #e0e7ef;
  --color-bg-white: #fff;
  --color-accent: #e63946;
  --color-accent-dark: #457b9d;
  --color-accent-darker: #1d3557;
  --color-accent-light: #f1faee;
  --color-accent-shadow: rgba(230, 57, 70, 0.04);
  --color-accent-shadow-strong: rgba(69, 123, 157, 0.07);
  --color-accent-shadow-modal: rgba(30,41,59,0.18);
  --color-accent-shadow-nav: rgba(30,41,59,0.08);
  --color-accent-shadow-btn: rgba(69, 123, 157, 0.13);
  --color-accent-shadow-grid: rgba(30,41,59,0.06);
  --color-accent-shadow-grid-active: rgba(69, 123, 157, 0.18);
  --color-border: #ccc;
  --color-border-light: #eee;
  --color-border-blue: #457b9d;
  --color-border-red: #e63946;
  --color-border-day: #457b9d;
  --color-border-day-light: #e5e7eb;
  --color-bg-selection: #b3d4fc;
  --color-bg-btn: #f1f5f9;
  --color-bg-btn-disabled: #e5e7eb;
  --color-link: #457b9d;
  --color-link-visited: #457b9d;
  --color-modal-bg: rgba(30,41,59,0.18);
  --color-print-bg: #fff;
  --color-print-text: #000;
}

html {
  color: var(--color-text);
  font-size: 1em;
  line-height: 1.4;
}

/*
 * Remove text-shadow in selection highlight:
 * https://twitter.com/miketaylr/status/12228805301
 *
 * Customize the background color to match your design.
 */

::-moz-selection {
  background: var(--color-bg-selection);
  text-shadow: none;
}

::selection {
  background: var(--color-bg-selection);
  text-shadow: none;
}

/*
 * A better looking default horizontal rule
 */

hr {
  display: block;
  height: 1px;
  border: 0;
  border-top: 1px solid var(--color-border);
  margin: 1em 0;
  padding: 0;
}

/*
 * Remove the gap between audio, canvas, iframes,
 * images, videos and the bottom of their containers:
 * https://github.com/h5bp/html5-boilerplate/issues/440
 */

audio,
canvas,
iframe,
img,
svg,
video {
  vertical-align: middle;
}

/*
 * Remove default fieldset styles.
 */

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

/*
 * Allow only vertical resizing of textareas.
 */

textarea {
  resize: vertical;
}

/* ==========================================================================
   Author's custom styles
   ========================================================================== */

/* Festive Google Font */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&display=swap');

body {
  background: linear-gradient(135deg, var(--color-bg-main) 0%, var(--color-bg-secondary) 100%);
  font-family: 'Montserrat', Arial, sans-serif;
  min-height: 100vh;
  margin: 0 auto;
  color: var(--color-text);
  max-width: 720px;
  box-sizing: border-box;
  padding: 0 12px;
  width: 100%;
  overflow-x: hidden;
}

#calendar-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-bottom: 80px; /* space for nav */
  width: 100%;
  max-width: 720px;
  box-sizing: border-box;
}

.topbar {
  text-align: center;
  margin: 1.5rem 0 0.5rem 0;
}

#calendar-toggle {
  display: block;
  background: var(--color-accent);
  color: var(--color-bg-white);
  font-size: 1.1rem;
  font-weight: 700;
  border: none;
  border-radius: 0 0 12px 12px;
  padding: 0.8rem 1rem;
  margin: 0 auto 0.5rem auto;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s;
}
#calendar-toggle:active, #calendar-toggle:focus {
  background: var(--color-accent-dark);
}

#days-list {
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  gap: 0.5rem;
  list-style: none;
  padding: 0.5rem 0.5rem 0.5rem 0.5rem;
  margin: 0 0 1rem 0;
  background: var(--color-bg-white);
  border-bottom: 1px solid var(--color-border-light);
  box-shadow: 0 2px 8px var(--color-accent-shadow);
  scrollbar-width: thin;
  max-width: 100%;
  box-sizing: border-box;
}

.calendar-day {
  min-width: 60px;
  background: var(--color-accent);
  color: var(--color-bg-white);
  font-weight: 700;
  font-size: 1rem;
  border-radius: 10px;
  padding: 0.7rem 0.2rem;
  text-align: center;
  cursor: pointer;
  border: 2px solid transparent;
  user-select: none;
  transition: background 0.2s, color 0.2s, border 0.2s;
}
.calendar-day.active {
  background: var(--color-accent-dark);
  color: var(--color-bg-white);
  border-color: var(--color-accent-darker);
}
.calendar-day:hover, .calendar-day:focus {
  background: var(--color-accent-light);
  color: var(--color-accent);
  border-color: var(--color-accent);
}

#day-details {
  background: var(--color-bg-white);
  border-radius: 2rem;
  box-sizing: border-box;
  box-shadow: 0 6px 32px rgba(30, 41, 59, 0.10), 0 1.5px 6px var(--color-accent-shadow);
  padding: 2.5rem 1.2rem 2.5rem 1.2rem;
  margin: 0rem 1rem 1rem 1rem;
  max-width: 720px;
  width: 100%;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: box-shadow 0.2s;
}

.day-details h2:not(.domenica-avvento-title) {
  color: var(--color-accent);
  font-size: 2.3rem;
  margin-bottom: 0.2em;
  text-align: center;
  letter-spacing: 0.01em;
}
.day-details h3 {
  color: var(--color-accent-dark);
  font-size: 1.15rem;
  margin-top: 0;
  margin-bottom: 1.2em;
  text-align: center;
  font-weight: 600;
}

.day-details h2.domenica-avvento-title {
  text-align: center;
  margin-top: 0;
}
.day-details .message {
  display: block;
  background: #f6f6f6;
  border-left: 5px solid var(--color-border-blue);
  border-right: 5px solid var(--color-border-blue);
  margin: 1.5em auto 1.5em auto;
  padding: 1em 2em;
  font-style: italic;
  color: var(--color-text);
  font-size: 1.25rem;
  max-width: 600px;
  box-shadow: 0 2px 8px var(--color-accent-shadow-strong);
  border-radius: 0.5em;
  text-align: center;
}

.day-details {
  text-align: justify;
}


/* Bottom Navigation Bar */
#bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255,255,255,0.95);
  box-shadow: 0 -2px 16px var(--color-accent-shadow-nav);
  padding: 0.5rem 1.2rem 0.5rem 1.2rem;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}
#bottom-nav button {
  background: var(--color-bg-btn);
  color: var(--color-text);
  border: none;
  border-radius: 1.2rem;
  font-size: 1.08rem;
  font-weight: 600;
  padding: 0.7rem 1.2rem;
  margin: 0 0.2rem;
  box-shadow: 0 1px 4px var(--color-accent-shadow-grid);
  cursor: pointer;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
  outline: none;
  display: flex;
  align-items: center;
  gap: 0.5em;
}
#bottom-nav button:active, #bottom-nav button:focus {
  background: var(--color-accent);
  color: var(--color-bg-white);
}
#bottom-nav button:disabled {
  background: var(--color-bg-btn-disabled);
  color: #aaa;
  cursor: not-allowed;
  visibility: hidden;
}
#open-calendar {
  background: var(--color-accent-dark);
  color: var(--color-bg-white);
  font-size: 1.13rem;
  box-shadow: 0 2px 12px var(--color-accent-shadow-btn);
  border-radius: 50px;
  padding: 0.7rem 1.5rem;
  z-index: 101;
}
#open-calendar:active, #open-calendar:focus {
  background: var(--color-accent);
  color: var(--color-bg-white);
}
.calendar-icon {
  font-size: 1.3em;
  margin-right: 0.2em;
}

/* Calendar Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 200;
  left: 0; top: 0; width: 100%; height: 100vh;
  background: var(--color-modal-bg);
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.modal.open {
  display: flex;
}
.modal-content {
  background: var(--color-bg-white);
  border-radius: 2rem;
  box-shadow: 0 8px 32px var(--color-accent-shadow-modal);
  padding: 2.2rem 1.2rem 2rem 1.2rem;
  max-width: 720px;
  width: 90%;
  position: relative;
  animation: modalIn 0.22s cubic-bezier(.4,1.4,.6,1) both;
  box-sizing: border-box;
}
@keyframes modalIn {
  from { transform: translateY(40px) scale(0.98); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.close-modal {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--color-accent);
  cursor: pointer;
  z-index: 10;
  padding: 0;
  line-height: 1;
}
.modal-content h2 {
  text-align: center;
  font-size: 1.3rem;
  color: var(--color-accent-dark);
  margin-bottom: 1.2rem;
  font-weight: 700;
}
.modal-days-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  list-style: none;
  padding: 0;
  margin: 0;
}
.modal-days-list .calendar-day {
  background: var(--color-bg-btn);
  color: var(--color-text);
  border-radius: 1rem;
  padding: 0.7rem 0.7rem;
  font-size: 1.05rem;
  font-weight: 600;
  min-width: 70px;
  text-align: center;
  margin: 0.1rem;
  border: 2px solid transparent;
  transition: background 0.18s, color 0.18s, border 0.18s;
  cursor: pointer;
}
.modal-days-list .calendar-day.active {
  background: var(--color-accent-dark);
  color: var(--color-bg-white);
  border-color: var(--color-border-red);
}
.modal-days-list .calendar-day:hover, .modal-days-list .calendar-day:focus {
  background: var(--color-accent);
  color: var(--color-bg-white);
  border-color: var(--color-accent-dark);
}
.modal-footer {
  text-align: center;
  margin-top: 1.5rem;
}
.modal-footer a {
  color: var(--color-link);
  text-decoration: none;
  font-weight: 600;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.7rem;
  justify-items: center;
  align-items: center;
  margin: 1.2rem 0 0 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.calendar-grid-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.7rem;
  justify-items: center;
  align-items: center;
  margin-bottom: 0.5rem;
  font-weight: 700;
  color: var(--color-accent-dark);
  font-size: 1.05rem;
  text-align: center;
}

.calendar-grid-day {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 3.2rem;
  background: var(--color-bg-btn);
  color: var(--color-text);
  border: none;
  border-radius: 50%;
  font-size: 1.25rem;
  font-weight: 700;
  box-shadow: 0 1px 4px var(--color-accent-shadow-grid);
  cursor: pointer;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
}
.calendar-grid-day.active {
  background: var(--color-accent-dark);
  color: var(--color-bg-white);
  box-shadow: 0 2px 8px var(--color-accent-shadow-grid-active);
}
.calendar-grid-day:hover, .calendar-grid-day:focus {
  background: var(--color-accent);
  color: var(--color-bg-white);
}
.calendar-grid-day.disabled {
  background: var(--color-bg-btn-disabled, #e5e7eb);
  color: #aaa;
  cursor: not-allowed;
  opacity: 0.7;
  border: 1px solid #ddd;
}

body.modal-open {
  overflow: hidden;
}

.day-label {
  min-width: 3.2em; /* enough for '24 Dic' */
  display: inline-block;
  text-align: center;
  font-size: 1em;
  vertical-align: middle;
  transition: opacity 0.15s;
}

/* ==========================================================================
   Helper classes
   ========================================================================== */

/*
 * Hide visually and from screen readers
 */

.hidden,
[hidden] {
  display: none !important;
}

/*
 * Hide only visually, but have it available for screen readers:
 * https://snook.ca/archives/html_and_css/hiding-content-for-accessibility
 *
 * 1. For long content, line feeds are not interpreted as spaces and small width
 *    causes content to wrap 1 word per line:
 *    https://medium.com/@jessebeach/beware-smushed-off-screen-accessible-text-5952a4c2cbfe
 */

.visually-hidden {
  border: 0;
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
  /* 1 */
}

/*
 * Extends the .visually-hidden class to allow the element
 * to be focusable when navigated to via the keyboard:
 * https://www.drupal.org/node/897638
 */

.visually-hidden.focusable:active,
.visually-hidden.focusable:focus {
  clip: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  position: static;
  white-space: inherit;
  width: auto;
}

/*
 * Hide visually and from screen readers, but maintain layout
 */

.invisible {
  visibility: hidden;
}

/*
 * Clearfix: contain floats
 *
 * The use of `table` rather than `block` is only necessary if using
 * `::before` to contain the top-margins of child elements.
 */

.clearfix::before,
.clearfix::after {
  content: "";
  display: table;
}

.clearfix::after {
  clear: both;
}

/* ==========================================================================
   EXAMPLE Media Queries for Responsive Design.
   These examples override the primary ('mobile first') styles.
   Modify as content requires.
   ========================================================================== */

@media only screen and (min-width: 35em) {
  /* Style adjustments for viewports that meet the condition */
}

@media print,
  (-webkit-min-device-pixel-ratio: 1.25),
  (min-resolution: 1.25dppx),
  (min-resolution: 120dpi) {
  /* Style adjustments for high resolution devices */
}

/* ==========================================================================
   Print styles.
   Inlined to avoid the additional HTTP request:
   https://www.phpied.com/delay-loading-your-print-css/
   ========================================================================== */

@media print {
  *,
  *::before,
  *::after {
    background: var(--color-print-bg) !important;
    color: var(--color-print-text) !important;
    /* Black prints faster */
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
  }

  abbr[title]::after {
    content: " (" attr(title) ")";
  }

  /*
   * Don't show links that are fragment identifiers,
   * or use the `javascript:` pseudo protocol
   */
  a[href^="#"]::after,
  a[href^="javascript:"]::after {
    content: "";
  }

  pre {
    white-space: pre-wrap !important;
  }

  pre,
  blockquote {
    border: 1px solid #999;
    page-break-inside: avoid;
  }

  tr,
  img {
    page-break-inside: avoid;
  }

  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }

  h2,
  h3 {
    page-break-after: avoid;
  }

  .topbar, #bottom-nav {
    display: none;
  }
  .comment img {
    width: auto!important;
    height: 230px;
    border-radius: 0!important;
    margin: auto!important;
    display: block;
  }
}
