/* VP Events
 * Colours are CSS variables – override them in your theme to match the site, e.g.
 *   .vpe { --vpe-accent: #0057A8; }
 * Typography is inherited from the theme on purpose.
 */

.vpe,
.vpe-single {
  --vpe-ink: #0F2B45;      /* deep pool */
  --vpe-muted: #5A6E80;
  --vpe-line: #D6E1EA;
  --vpe-tint: #EEF4F8;     /* pool tile */
  --vpe-surface: #FFFFFF;
  --vpe-accent: #1F6FB2;   /* lane blue */
  --vpe-radius-media: 14px;
  --vpe-radius-panel: 20px;
  color: var(--vpe-ink);
}

.vpe { margin: 2rem 0; }
.vpe *, .vpe *::before, .vpe *::after { box-sizing: border-box; }

/* Neutralise theme button styles inside the widget. */
.vpe button {
  appearance: none;
  background: none;
  border: 0;
  margin: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  letter-spacing: normal;
  text-transform: none;
  box-shadow: none;
  cursor: pointer;
}
.vpe :focus-visible,
.vpe-single :focus-visible {
  outline: 3px solid var(--vpe-accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.vpe-icon { display: inline-flex; width: 1.05em; height: 1.05em; flex: none; }
.vpe-icon svg { width: 100%; height: 100%; }

/* ---------- toolbar ---------- */

.vpe-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
}

.vpe-pills { display: flex; flex-wrap: wrap; gap: .5rem; min-width: 0; }

.vpe .vpe-pill {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .45rem 1rem;
  border: 1.5px solid var(--vpe-line);
  border-radius: 999px;
  background: var(--vpe-surface);
  font-size: .9rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.vpe .vpe-pill:hover { border-color: var(--vpe-pill, var(--vpe-ink)); }
.vpe .vpe-pill[aria-pressed="true"] {
  background: var(--vpe-pill, var(--vpe-ink));
  border-color: var(--vpe-pill, var(--vpe-ink));
  color: #fff;
}
.vpe-dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--vpe-pill); }
.vpe-pill[aria-pressed="true"] .vpe-dot { background: #fff; }

.vpe-tools { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; min-width: 0; }

.vpe-select {
  font: inherit;
  font-size: .9rem;
  color: var(--vpe-ink);
  padding: .45rem 2rem .45rem .9rem;
  border: 1.5px solid var(--vpe-line);
  border-radius: 999px;
  background: var(--vpe-surface);
}

.vpe-segment {
  display: inline-flex;
  padding: 3px;
  border: 1.5px solid var(--vpe-line);
  border-radius: 999px;
  background: var(--vpe-surface);
}
.vpe .vpe-seg {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .4rem .95rem;
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 600;
  color: var(--vpe-muted);
}
.vpe .vpe-seg[aria-pressed="true"] { background: var(--vpe-ink); color: #fff; }

.vpe-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: var(--vpe-accent);
  font-weight: 600;
  font-size: .9rem;
  text-decoration: none;
}
.vpe-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* "Se kampprogram" menu */
.vpe-menu { position: relative; }
.vpe .vpe-menu-toggle { gap: .4rem; color: var(--vpe-accent); font-size: .9rem; font-weight: 600; }
.vpe-caret {
  width: .45rem;
  height: .45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .15s;
}
.vpe-menu-toggle[aria-expanded="true"] .vpe-caret { transform: translateY(1px) rotate(-135deg); }
.vpe-menu-list {
  position: absolute;
  top: calc(100% + .5rem);
  left: 0;
  z-index: 20;
  min-width: 13rem;
  padding: .5rem;
  border: 1px solid var(--vpe-line);
  border-radius: var(--vpe-radius-media);
  background: var(--vpe-surface);
  box-shadow: 0 12px 32px rgba(15, 43, 69, .16);
}
.vpe-menu-list[hidden] { display: none; }
.vpe-menu-title { margin: .25rem .6rem .4rem; font-size: .8rem; font-weight: 600; color: var(--vpe-muted); }
.vpe .vpe-menu-item {
  display: block;
  padding: .55rem .6rem;
  border-radius: 8px;
  color: var(--vpe-ink);
  font-weight: 600;
  font-size: .92rem;
  text-decoration: none;
}
.vpe .vpe-menu-item:hover,
.vpe .vpe-menu-item:focus-visible { background: var(--vpe-tint); color: var(--vpe-accent); outline-offset: 0; }

/* ---------- buttons ---------- */

.vpe .vpe-btn,
.vpe-single .vpe-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .6rem 1.15rem;
  border: 1.5px solid var(--vpe-line);
  border-radius: 999px;
  background: var(--vpe-surface);
  color: var(--vpe-ink);
  font-size: .92rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
}
.vpe .vpe-btn:hover, .vpe-single .vpe-btn:hover { border-color: var(--vpe-ink); }
.vpe .vpe-btn-primary, .vpe-single .vpe-btn-primary {
  background: var(--vpe-accent);
  border-color: var(--vpe-accent);
  color: #fff;
}
.vpe .vpe-btn-primary:hover, .vpe-single .vpe-btn-primary:hover { filter: brightness(.92); border-color: var(--vpe-accent); }
.vpe .vpe-btn-quiet { border-color: transparent; color: var(--vpe-muted); }
.vpe .vpe-new { padding: .5rem 1rem; }

/* ---------- cards view ---------- */

.vpe-tabs { display: flex; gap: 1.5rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--vpe-line); }
.vpe .vpe-tab {
  padding: .35rem 0 .65rem;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  font-weight: 600;
  color: var(--vpe-muted);
}
.vpe .vpe-tab[aria-pressed="true"] { color: var(--vpe-ink); border-bottom-color: var(--vpe-ink); }

.vpe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: 2.25rem 1.75rem;
}

.vpe-card { position: relative; display: flex; flex-direction: column; }

.vpe-media {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: var(--vpe-radius-media);
  overflow: hidden;
  background: var(--vpe-tint);
}
.vpe-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .35s ease;
}
.vpe-card:hover .vpe-media img { transform: scale(1.03); }

/* No image: the category colour with two lane ropes across it. */
.vpe-media-empty {
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.6) 0 16px, rgba(255,255,255,.18) 16px 32px) 0 36% / 100% 7px no-repeat,
    repeating-linear-gradient(90deg, rgba(255,255,255,.18) 0 16px, rgba(255,255,255,.6) 16px 32px) 0 68% / 100% 7px no-repeat,
    linear-gradient(165deg, color-mix(in srgb, var(--vpe-cat) 78%, #fff) 0%, var(--vpe-cat) 100%);
  background-color: var(--vpe-cat);
}

.vpe-datechip {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 3.2rem;
  padding: .45rem .55rem .4rem;
  border-radius: 10px;
  background: var(--vpe-surface);
  color: var(--vpe-ink);
  line-height: 1;
}
.vpe-datechip-day { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; }
.vpe-datechip-mon { font-size: .78rem; font-weight: 600; color: var(--vpe-muted); margin-top: .2rem; }

.vpe-price {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: .35rem .8rem;
  border-radius: 999px;
  background: var(--vpe-surface);
  font-size: .85rem;
  font-weight: 700;
}

.vpe-edit {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--vpe-surface);
  color: var(--vpe-ink);
}
.vpe-edit:hover { background: var(--vpe-ink); color: #fff; }

.vpe .vpe-title { margin: 1rem 0 .55rem; font-size: 1.2rem; line-height: 1.3; font-weight: 700; }
.vpe .vpe-open { text-align: left; }
.vpe .vpe-open::after { content: ""; position: absolute; inset: 0; z-index: 1; } /* whole card is clickable */
.vpe-card:hover .vpe-open { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; }

.vpe-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem 1rem; font-size: .88rem; color: var(--vpe-muted); }
.vpe-meta-item { display: inline-flex; align-items: center; gap: .35rem; }
.vpe-cat {
  display: inline-block;
  padding: .25rem .75rem;
  border-radius: 999px;
  background: var(--vpe-cat);
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
}

.vpe-excerpt {
  margin: .8rem 0 0;
  color: var(--vpe-muted);
  font-size: .93rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.vpe-card.is-past .vpe-media img { filter: grayscale(.7); opacity: .85; }
.vpe-card.is-past .vpe-datechip { background: var(--vpe-tint); }

.vpe-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 1rem;
  padding: 2rem;
  border-radius: var(--vpe-radius-panel);
  background: var(--vpe-tint);
}
.vpe-empty p { margin: 0; flex: 1 1 100%; font-weight: 600; }

.vpe-more { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; margin-top: 2rem; }
.vpe-footer { margin: 2rem 0 0; }
.vpe-loading { color: var(--vpe-muted); padding: 2rem 0; }

/* ---------- calendar view (FullCalendar) ---------- */

.vpe .fc {
  --fc-border-color: var(--vpe-line);
  --fc-page-bg-color: var(--vpe-surface);
  --fc-neutral-bg-color: var(--vpe-tint);
  --fc-today-bg-color: color-mix(in srgb, var(--vpe-accent) 9%, transparent);
  --fc-now-indicator-color: var(--vpe-accent);
  --fc-list-event-hover-bg-color: var(--vpe-tint);
  --fc-button-bg-color: var(--vpe-surface);
  --fc-button-border-color: var(--vpe-line);
  --fc-button-text-color: var(--vpe-ink);
  --fc-button-hover-bg-color: var(--vpe-tint);
  --fc-button-hover-border-color: var(--vpe-line);
  --fc-button-active-bg-color: var(--vpe-ink);
  --fc-button-active-border-color: var(--vpe-ink);
  font-size: .92rem;
}
.vpe .fc .fc-toolbar { flex-wrap: wrap; gap: .75rem; }
.vpe .fc .fc-toolbar-title { font-size: 1.3rem; font-weight: 700; text-transform: capitalize; }
.vpe .fc .fc-button {
  border-width: 1.5px;
  border-radius: 999px;
  padding: .4rem .9rem;
  font-weight: 600;
  text-transform: none;
  box-shadow: none;
}
.vpe .fc .fc-button-group > .fc-button { border-radius: 0; }
.vpe .fc .fc-button-group > .fc-button:first-child { border-radius: 999px 0 0 999px; }
.vpe .fc .fc-button-group > .fc-button:last-child { border-radius: 0 999px 999px 0; }
.vpe .fc .fc-button-primary:not(:disabled).fc-button-active,
.vpe .fc .fc-button-primary:not(:disabled):active { color: #fff; }
.vpe .fc .fc-button:focus { box-shadow: none; }
.vpe .fc .fc-button:focus-visible { outline: 3px solid var(--vpe-accent); outline-offset: 2px; }

.vpe .fc-theme-standard .fc-scrollgrid { border-radius: var(--vpe-radius-media); overflow: hidden; }
.vpe .fc .fc-col-header-cell-cushion { padding: .55rem 0; font-weight: 600; color: var(--vpe-muted); text-transform: capitalize; }
.vpe .fc .fc-daygrid-day-number { color: var(--vpe-ink); text-decoration: none; font-weight: 600; padding: .4rem .5rem; }
.vpe .fc .fc-daygrid-day.fc-day-today .fc-daygrid-day-number { color: var(--vpe-accent); }
.vpe .fc .fc-daygrid-week-number,
.vpe .fc .fc-timegrid-axis-cushion { font-size: .75rem; color: var(--vpe-muted); background: none; }
.vpe .fc .fc-event { border-radius: 6px; padding: 1px 4px; font-weight: 600; cursor: pointer; }
.vpe .fc .fc-event-title, .vpe .fc .fc-event-time { color: #fff; }
.vpe .fc .fc-daygrid-more-link { color: var(--vpe-accent); font-weight: 600; }
.vpe .fc .fc-list-day-cushion { background: var(--vpe-tint); text-transform: capitalize; }
.vpe .fc .fc-list-event-title, .vpe .fc .fc-list-event-time { color: var(--vpe-ink); }
.vpe .fc .fc-list-event-title a { color: inherit; text-decoration: none; font-weight: 600; }
.vpe .fc a { color: inherit; }

/* ---------- event dialog ---------- */

.vpe-dialog {
  width: min(640px, calc(100vw - 2rem));
  max-height: min(90vh, 900px);
  padding: 0;
  border: 0;
  border-radius: var(--vpe-radius-panel);
  background: var(--vpe-surface);
  color: var(--vpe-ink);
  overflow: auto;
}
.vpe-dialog::backdrop { background: rgba(15, 43, 69, .55); }
.vpe-dialog[open] { animation: vpe-in .18s ease-out; }
@keyframes vpe-in { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }

.vpe .vpe-close {
  position: sticky;
  top: 12px;
  float: right;
  margin: 12px 12px -48px 0;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--vpe-surface);
  color: var(--vpe-ink);
  font-size: 1.1rem;
}
.vpe-dialog-media { aspect-ratio: 16 / 8; background-color: var(--vpe-tint); }
.vpe-dialog-media.vpe-media-empty { aspect-ratio: 16 / 5; background-color: var(--vpe-cat); }
.vpe-dialog-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vpe-dialog-content { padding: 1.5rem 1.75rem 1.75rem; }
.vpe .vpe-dialog-title { margin: .75rem 0 1rem; font-size: 1.6rem; line-height: 1.2; font-weight: 800; }
.vpe-past-note { margin: -.5rem 0 1rem; color: var(--vpe-muted); font-weight: 600; }

.vpe-facts { display: grid; gap: .6rem; margin: 0 0 1.25rem; padding: 1rem 1.1rem; border-radius: var(--vpe-radius-media); background: var(--vpe-tint); }
.vpe-facts > div { display: grid; grid-template-columns: 7rem 1fr; gap: .75rem; }
.vpe-facts dt { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; color: var(--vpe-muted); }
.vpe-facts dd { margin: 0; font-weight: 600; }
.vpe-facts a { color: var(--vpe-accent); }

.vpe-desc { line-height: 1.6; max-width: 65ch; }
.vpe-desc > :first-child { margin-top: 0; }
.vpe-desc img { max-width: 100%; height: auto; }

.vpe-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.5rem 0 1rem; }
.vpe-permalink { font-size: .85rem; }

/* ---------- single event page ---------- */

.vpe-single { margin: 0 0 2rem; }
.vpe-single dl { display: grid; gap: .5rem; margin: 0 0 1rem; padding: 1rem 1.25rem; border-radius: 14px; background: var(--vpe-tint); }
.vpe-single dl > div { display: grid; grid-template-columns: 7rem 1fr; gap: .75rem; }
.vpe-single dt { font-weight: 600; color: var(--vpe-muted); }
.vpe-single dd { margin: 0; font-weight: 600; }
.vpe-single-actions { display: flex; flex-wrap: wrap; gap: .6rem; }

/* ---------- small screens ---------- */

@media (max-width: 640px) {
  .vpe-toolbar { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
  .vpe-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 0 -1rem;
    padding: 2px 1rem;
    scrollbar-width: none;
  }
  .vpe-pills::-webkit-scrollbar { display: none; }
  .vpe-tools { gap: .6rem; }
  .vpe-segment { order: -1; flex: 1 1 100%; }
  .vpe .vpe-seg { flex: 1 1 0; justify-content: center; }
  .vpe-select { flex: 1 1 100%; }
  .vpe .vpe-new { margin-left: auto; }
  .vpe .fc .fc-toolbar { flex-direction: column; align-items: stretch; }
  .vpe .fc .fc-toolbar-chunk { display: flex; justify-content: center; }
  .vpe-facts > div, .vpe-single dl > div { grid-template-columns: 1fr; gap: .1rem; }
  .vpe-dialog-content { padding: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  .vpe *, .vpe-dialog[open] { animation: none !important; transition: none !important; }
}
