/* =========================================================
   EVENTS.CSS — Tapahtumakalenteri-sivu
   Käyttö: <link rel="stylesheet" href="shared.css">
            <link rel="stylesheet" href="events.css">
   ========================================================= */

body.paja-page {
  background-image:
    linear-gradient(
      rgba(255,255,255,0.85),
      rgba(255,255,255,0.85)
    ),
    url("images/pajaPuidenTakaa.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

/* =========================================================
   KALENTERI — MOBIILIKORJAUKSET
   ========================================================= */

@media (max-width: 600px) {
  .events-calendar.card {
    padding: 0.5rem 0.25rem;
    border-radius: 12px;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
  }

  .cal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem 0.75rem;
    gap: 0.5rem;
  }

  .cal-month {
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
    flex: 1;
  }

  .cal-nav {
    font-size: 1.5rem;
    padding: 0.3rem 0.6rem;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 8px;
    border: none;
    background: transparent;
  }

  .cal-grid.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    width: 100%;
    box-sizing: border-box;
    padding: 0 2px;
  }

  .cal-wd {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 0;
    opacity: 0.6;
  }

  .cal-grid[data-cal-grid] {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    width: 100%;
    box-sizing: border-box;
    padding: 0 2px 2px;
  }

  .cal-day {
    aspect-ratio: 1 / 1;
    min-height: 0;
    border-radius: 8px;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
    position: relative;
    cursor: default;
    box-sizing: border-box;
  }

  .cal-day.is-event {
    cursor: pointer;
  }

  .cal-num {
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
    padding: 4px 3px 2px;
    align-self: flex-start;
    z-index: 1;
    position: relative;
  }

  .cal-thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }

  .cal-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.85;
    border-radius: 8px;
  }

  .cal-day.is-event .cal-num {
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.7);
    background: rgba(0,0,0,0.25);
    border-radius: 0 0 4px 0;
  }

  .cal-note {
    font-size: 0.72rem;
    padding: 0.5rem 0.75rem 0.25rem;
    line-height: 1.4;
  }
}

/* =========================================================
   DIAGONAALINEN JAKO — kaksi tapahtumaa samana päivänä
   ========================================================= */

.cal-day.is-split {
  cursor: default; /* klikkaus hallinnoitu puolikkaille */
}

/* Yhteinen pohja kummallekin puolelle */
.cal-half {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: pointer;
  transition: filter 0.15s;
}
.cal-half:hover {
  filter: brightness(1.12);
  z-index: 2;
}
.cal-half:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -3px;
  z-index: 3;
}
.cal-half img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Ylävasen kolmio: poster A */
.cal-half--top {
  clip-path: polygon(0 0, 100% 0, 0 100%);
}

/* Alaoikea kolmio: poster B */
.cal-half--bottom {
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

/* Ohut diagonaaliviiva erottelemaan puolikkaat */
.cal-split-line {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  background: linear-gradient(
    135deg,
    transparent calc(50% - 1px),
    rgba(255,255,255,0.7) calc(50% - 1px),
    rgba(255,255,255,0.7) calc(50% + 1px),
    transparent calc(50% + 1px)
  );
}

/* Päivänumero pysyy näkyvissä split-solussa */
.cal-day.is-split .cal-num {
  z-index: 5;
  position: relative;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  background: rgba(0,0,0,0.28);
  border-radius: 0 0 4px 0;
  align-self: flex-start;
}


/* Jos shared.css ei jo määritä .modal-perusstyylejä,
   lisätään ne tähän varmuuden vuoksi */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal.is-open {
  display: flex;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
}
.modal-panel {
  position: relative;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.22);
  overflow: hidden;
  z-index: 1;
}
.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 10;
  background: rgba(255,255,255,0.9);
  border: none;
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 6px rgba(0,0,0,0.18);
  transition: background 0.15s;
}
.modal-close:hover {
  background: #fff;
}

/* =========================================================
   TAPAHTUMA-MODAALI — LAYOUT
   Desktop: posteri vasemmalla, tiedot oikealla
   Mobiili:  posteri ylhäällä, tiedot alla
   ========================================================= */

.modal-panel.evt-panel {
  width: min(860px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
}

/* Kaksisarakkeinen layout */
.evt-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 400px;
}

/* --- Posterikolumni --- */
.evt-poster-col {
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
}
.evt-poster-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  max-height: 70vh;
}

/* --- Tietokolumni --- */
.evt-info-col {
  padding: 2.5rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
}

.evt-title {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.2;
  margin: 0;
  color: #111;
}

.evt-meta {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  color: #444;
}
.evt-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 0.1em;
}
.evt-when {
  font-size: 0.97rem;
  font-weight: 600;
  line-height: 1.4;
  /* Kirjain isolla alkukirjaimella */
  text-transform: capitalize;
}

.evt-desc {
  font-size: 1rem;
  color: #333;
  margin: 0;
  line-height: 1.5;
}

.evt-free {
  display: inline-block;
  font-size: 1rem;
  font-weight: 700;
  color: #2a9d5c;
  margin: 0;
  padding: 0.4rem 0.9rem;
  background: #e6f7ee;
  border-radius: 20px;
  align-self: flex-start;
}

/* Lipun ostonappi */
.evt-ticket-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  background: #111;
  color: #fff;
  transition: background 0.18s, transform 0.12s;
  align-self: flex-start;
  margin-top: 0.5rem;
}
.evt-ticket-btn::after {
  content: "→";
  font-size: 1.1em;
}
.evt-ticket-btn:hover {
  background: #333;
  transform: translateY(-1px);
}
.evt-ticket-btn:active {
  transform: translateY(0);
}

.evt-details {
  font-size: 0.9rem;
  margin: 0;
  word-break: break-all;
}

/* =========================================================
   TAPAHTUMA-MODAALI — TABLETTI (< 700px)
   ========================================================= */
@media (max-width: 700px) {
  .modal-panel.evt-panel {
    width: 98vw;
    max-height: 95vh;
    border-radius: 12px;
  }

  /* Pinottuna: posteri ylhäällä, tiedot alla */
  .evt-layout {
    grid-template-columns: 1fr;
  }

  .evt-poster-col {
    min-height: 200px;
    max-height: 45vw;
  }
  .evt-poster-img {
    max-height: 45vw;
    object-fit: contain;
  }

  .evt-info-col {
    padding: 1.5rem 1.25rem 1.5rem;
    gap: 0.75rem;
  }

  .evt-title {
    font-size: 1.2rem;
  }

  .evt-ticket-btn {
    width: 100%;
    justify-content: center;
    padding: 0.85rem 1rem;
  }
}

/* =========================================================
   TAPAHTUMA-MODAALI — PUHELIN (< 420px)
   ========================================================= */
@media (max-width: 420px) {
  .modal-panel.evt-panel {
    border-radius: 10px;
  }

  .evt-poster-col {
    min-height: 160px;
    max-height: 42vw;
  }
  .evt-poster-img {
    max-height: 42vw;
  }

  .evt-info-col {
    padding: 1.1rem 1rem 1.25rem;
    gap: 0.6rem;
  }

  .evt-title {
    font-size: 1.05rem;
  }

  .evt-when {
    font-size: 0.88rem;
  }

  .evt-desc {
    font-size: 0.9rem;
  }

  .evt-ticket-btn {
    font-size: 0.9rem;
    padding: 0.75rem 0.9rem;
  }
}