/* Nº 9 — Waterford Events calendar + list
   Brand: primary #0082A4, secondary #3E8FBB, navy #003A57, light #EDF4F9,
   accent #C8DCE8, hover #006d8a. Self-contained, no external deps. */

.n9-wf {
  --wf-primary: #0082A4;
  --wf-secondary: #3E8FBB;
  --wf-navy: #003A57;
  --wf-light: #EDF4F9;
  --wf-accent: #C8DCE8;
  --wf-hover: #006d8a;
  --wf-ink: #1a2b36;
  color: var(--wf-ink);
}

/* ---------- Hero ---------- */
/* Waved panel treatment — matches the /speedtest container background. */
.n9-wf-hero {
  position: relative;
  background-color: #EDF4F9;
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='80' viewBox='0 0 240 80'%3E%3Cg fill='none' stroke='%23A8C5D8' stroke-linecap='round'%3E%3Cpath d='M0 22 Q 30 6, 60 22 T 120 22 T 180 22 T 240 22' stroke-width='1.2' opacity='0.45'/%3E%3Cpath d='M0 44 Q 30 28, 60 44 T 120 44 T 180 44 T 240 44' stroke-width='1' opacity='0.35'/%3E%3Cpath d='M0 66 Q 30 50, 60 66 T 120 66 T 180 66 T 240 66' stroke-width='0.9' opacity='0.25'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 240px 80px;
  padding: 72px 24px 96px;
  text-align: center;
  overflow: hidden;
}
.n9-wf-hero__inner { position: relative; z-index: 2; max-width: 760px; margin: 0 auto; }
.n9-wf-hero__title { color: var(--wf-primary); font-size: clamp(1.9rem, 4.4vw, 2.8rem); margin: 0 0 14px; line-height: 1.1; }
.n9-wf-hero__sub { color: #5b6770; font-size: clamp(0.97rem, 2vw, 1.12rem); line-height: 1.6; margin: 0 auto; }
.n9-wf-hero__wave { position: absolute; left: 0; right: 0; bottom: -1px; width: 100%; height: 70px; display: block; z-index: 1; }

/* ---------- Body ---------- */
.n9-wf-body { max-width: 1080px; margin: -52px auto 72px; padding: 0 18px; position: relative; z-index: 3; }

/* ---------- Calendar ---------- */
.n9-wf-cal {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 10px 40px rgba(0,58,87,.12);
  padding: 22px 22px 26px;
}
.n9-wf-cal__head { display: flex; align-items: center; justify-content: center; gap: 18px; margin-bottom: 18px; }
.n9-wf-cal__title { font-size: clamp(1.2rem, 2.6vw, 1.6rem); color: var(--wf-navy); margin: 0; min-width: 220px; text-align: center; font-weight: 700; }
.n9-wf-cal__nav {
  width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--wf-accent);
  background: #fff; color: var(--wf-primary); font-size: 1.2rem; cursor: pointer; line-height: 1;
  transition: all .15s ease; flex: 0 0 auto;
}
.n9-wf-cal__nav:hover { background: var(--wf-primary); color: #fff; border-color: var(--wf-primary); }

.n9-wf-cal__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.n9-wf-cal__dow { text-align: center; font-size: .76rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--wf-secondary); padding: 4px 0 8px; min-width: 0; }
.n9-wf-cal__cell {
  min-width: 0; min-height: 92px; border: 1px solid #eef2f5; border-radius: 10px; padding: 6px;
  display: flex; flex-direction: column; gap: 4px; background: #fcfdfe; transition: border-color .15s, box-shadow .15s;
  overflow: hidden; box-sizing: border-box;
}
.n9-wf-cal__cell--pad { background: transparent; border: none; min-height: 0; }
.n9-wf-cal__cell.has-events { cursor: pointer; border-color: var(--wf-accent); }
.n9-wf-cal__cell.has-events:hover { border-color: var(--wf-primary); box-shadow: 0 4px 14px rgba(0,130,164,.16); }
.n9-wf-cal__cell.is-today { background: var(--wf-light); border-color: var(--wf-primary); }
.n9-wf-cal__cell.is-today .n9-wf-cal__num { background: var(--wf-primary); color: #fff; }
.n9-wf-cal__cell.is-past { opacity: .55; }
.n9-wf-cal__num { font-size: .82rem; font-weight: 700; color: var(--wf-navy); width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.n9-wf-cal__chips { display: flex; flex-direction: column; gap: 3px; min-width: 0; max-width: 100%; }
.n9-wf-cal__chip {
  display: block; width: 100%; min-width: 0; box-sizing: border-box;
  font-size: .68rem; line-height: 1.15; text-align: left; border: none; cursor: pointer;
  background: var(--wf-primary); color: #fff; border-radius: 5px; padding: 3px 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.n9-wf-cal__chip:hover { background: var(--wf-hover); }
.n9-wf-cal__more { font-size: .66rem; color: var(--wf-secondary); font-weight: 600; padding-left: 2px; }
.n9-wf-cal__dots { display: none; } /* mobile-only event indicator (see media query) */

.n9-wf-cal__day { margin-top: 0; max-height: 0; overflow: hidden; transition: max-height .25s ease; }
.n9-wf-cal__day.is-open { max-height: 1400px; margin-top: 18px; }
.n9-wf-cal__dayhead { font-weight: 700; color: var(--wf-navy); font-size: 1.05rem; margin-bottom: 10px; padding-top: 14px; border-top: 1px solid #eef2f5; }
.n9-wf-cal__daylist { display: grid; gap: 10px; }
.n9-wf-cal__dayempty { color: #6a8290; font-size: .92rem; margin: 0; }

.n9-wf-mini { display: flex; gap: 12px; align-items: center; text-align: left; width: 100%; background: var(--wf-light); border: 1px solid #e2edf3; border-radius: 12px; padding: 8px; cursor: pointer; transition: box-shadow .15s; }
.n9-wf-mini:hover { box-shadow: 0 4px 14px rgba(0,58,87,.12); }
.n9-wf-mini__img { width: 64px; height: 64px; border-radius: 8px; background-size: cover; background-position: center; flex: 0 0 auto; }
.n9-wf-mini__img--ph { background: linear-gradient(135deg, var(--wf-secondary), var(--wf-primary)); }
.n9-wf-mini__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.n9-wf-mini__title { font-weight: 700; color: var(--wf-navy); font-size: .95rem; }
.n9-wf-mini__meta { font-size: .82rem; color: #5a7280; }

/* ---------- Ongoing rail ---------- */
.n9-wf-rail { margin: 44px 0 8px; }
.n9-wf-rail__title { color: var(--wf-navy); font-size: 1.4rem; margin: 0 0 4px; }
.n9-wf-rail__sub { color: #5a7280; margin: 0 0 16px; font-size: .96rem; }
.n9-wf-rail__track { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 16px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.n9-wf-rail__track::-webkit-scrollbar { height: 8px; }
.n9-wf-rail__track::-webkit-scrollbar-thumb { background: var(--wf-accent); border-radius: 8px; }
.n9-wf-railcard {
  display: flex; flex-direction: column; flex: 0 0 232px; scroll-snap-align: start;
  text-align: left; cursor: pointer; padding: 0; width: 232px;
  background: #fff; border: 1px solid #e8eef3; border-radius: 14px; overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,58,87,.07); transition: transform .15s, box-shadow .15s;
}
.n9-wf-railcard:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(0,58,87,.15); }
.n9-wf-railcard__img { display: block; width: 100%; flex: 0 0 130px; height: 130px; background-size: cover; background-position: center; background-repeat: no-repeat; }
.n9-wf-railcard__img--ph { background: linear-gradient(135deg, var(--wf-secondary), var(--wf-primary)); }
.n9-wf-railcard__pad { display: block; flex: 1 1 auto; padding: 12px 14px 14px; }
.n9-wf-railcard__title { display: block; font-weight: 700; color: var(--wf-navy); font-size: .98rem; line-height: 1.25; margin-bottom: 4px; }
.n9-wf-railcard__loc { display: block; font-size: .82rem; color: var(--wf-primary); font-weight: 600; }
.n9-wf-railcard__dates { display: block; font-size: .8rem; color: #6a8290; margin-top: 4px; }

/* ---------- List + filters ---------- */
.n9-wf-list-wrap { margin-top: 44px; }
.n9-wf-listhead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.n9-wf-listhead__title { color: var(--wf-navy); font-size: 1.5rem; margin: 0; }
.n9-wf-filters { display: flex; flex-wrap: wrap; gap: 10px; }
.n9-wf-filter { display: flex; flex-direction: column; gap: 3px; font-size: .72rem; font-weight: 700; color: var(--wf-secondary); text-transform: uppercase; letter-spacing: .03em; }
.n9-wf-filter select {
  font-size: .9rem; font-weight: 500; color: var(--wf-ink); text-transform: none; letter-spacing: 0;
  border: 1.5px solid var(--wf-accent); border-radius: 10px; padding: 8px 30px 8px 11px; background: #fff;
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%230082A4' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.n9-wf-filter select:focus { outline: none; border-color: var(--wf-primary); }

.n9-wf-list { display: grid; gap: 16px; }
.n9-wf-list__month { grid-column: 1 / -1; color: var(--wf-primary); font-size: 1.05rem; font-weight: 800; letter-spacing: .02em; margin: 14px 0 2px; padding-bottom: 6px; border-bottom: 2px solid var(--wf-light); }
.n9-wf-list__month:first-child { margin-top: 0; }

.n9-wf-card {
  display: grid; grid-template-columns: 200px 1fr; gap: 0; background: #fff;
  border: 1px solid #e8eef3; border-radius: 16px; overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,58,87,.06); transition: box-shadow .15s, transform .15s;
}
.n9-wf-card:hover { box-shadow: 0 12px 30px rgba(0,58,87,.13); transform: translateY(-2px); }
.n9-wf-card__img { background-size: cover; background-position: center; min-height: 160px; cursor: pointer; }
.n9-wf-card__img--ph { background: linear-gradient(135deg, var(--wf-secondary), var(--wf-primary)); }
.n9-wf-card__body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 7px; }
.n9-wf-card__when { font-size: .85rem; font-weight: 800; color: var(--wf-primary); letter-spacing: .01em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.n9-wf-card__tag { font-size: .68rem; font-weight: 700; background: var(--wf-light); color: var(--wf-secondary); padding: 2px 8px; border-radius: 20px; text-transform: uppercase; letter-spacing: .03em; }
.n9-wf-card__title { font-size: 1.18rem; color: var(--wf-navy); margin: 0; line-height: 1.2; }
.n9-wf-card__loc { display: flex; align-items: center; gap: 5px; font-size: .88rem; color: #5a7280; }
.n9-wf-card__loc svg { color: var(--wf-secondary); }
.n9-wf-card__cats { display: flex; flex-wrap: wrap; gap: 6px; }
.n9-wf-chip { font-size: .72rem; font-weight: 600; background: var(--wf-light); color: var(--wf-primary); padding: 3px 10px; border-radius: 20px; }
.n9-wf-card__excerpt { font-size: .92rem; color: #51626d; line-height: 1.55; margin: 2px 0 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.n9-wf-card__more { align-self: flex-start; margin-top: 6px; background: none; border: none; color: var(--wf-primary); font-weight: 700; font-size: .9rem; cursor: pointer; padding: 0; }
.n9-wf-card__more:hover { color: var(--wf-hover); text-decoration: underline; }

.n9-wf-empty { text-align: center; color: #6a8290; padding: 30px; font-size: 1rem; }
.n9-wf-loading { text-align: center; color: #6a8290; padding: 20px; }
.n9-wf-credit { text-align: center; color: #7a8e99; font-size: .84rem; margin: 32px 0 0; }
.n9-wf-credit a { color: var(--wf-primary); font-weight: 600; }

/* ---------- Modal ---------- */
body.n9-wf-modal-open { overflow: hidden; }
.n9-wf-modal { position: fixed; inset: 0; z-index: 99999; display: flex; align-items: center; justify-content: center; padding: 20px; }
.n9-wf-modal[hidden] { display: none; }
.n9-wf-modal__backdrop { position: absolute; inset: 0; background: rgba(0,30,46,.6); backdrop-filter: blur(2px); }
.n9-wf-modal__card { position: relative; z-index: 2; background: #fff; border-radius: 18px; max-width: 560px; width: 100%; max-height: 90vh; overflow: auto; box-shadow: 0 30px 80px rgba(0,30,46,.4); }
.n9-wf-modal__x { position: absolute; top: 12px; right: 12px; z-index: 3; width: 38px; height: 38px; border-radius: 50%; border: none; background: rgba(255,255,255,.92); color: var(--wf-navy); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.n9-wf-modal__x:hover { background: #fff; }
.n9-wf-modal__img { height: 230px; background-size: cover; background-position: center; background-color: var(--wf-light); }
.n9-wf-modal__pad { padding: 20px 24px 26px; }
.n9-wf-modal__when { font-size: .9rem; font-weight: 800; color: var(--wf-primary); margin-bottom: 6px; }
.n9-wf-modal__title { font-size: 1.5rem; color: var(--wf-navy); margin: 0 0 12px; line-height: 1.18; }
.n9-wf-modal__meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.n9-wf-modal__loc { font-size: .9rem; font-weight: 600; color: #5a7280; }
.n9-wf-modal__excerpt { font-size: .98rem; line-height: 1.65; color: #41535e; margin: 0 0 20px; }
.n9-wf-modal__btn { display: inline-block; background: var(--wf-primary); color: #fff; font-weight: 700; padding: 12px 22px; border-radius: 12px; text-decoration: none; transition: background .15s, transform .15s; }
.n9-wf-modal__btn:hover { background: var(--wf-hover); color: #fff; transform: translateY(-1px); }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .n9-wf-cal { padding: 16px 12px 18px; }
  .n9-wf-cal__grid { gap: 3px; }
  .n9-wf-cal__cell { min-height: 58px; padding: 4px; border-radius: 8px; }
  .n9-wf-cal__num { font-size: .74rem; width: 20px; height: 20px; }
  /* No per-event taps on phones: the whole cell opens that day's list below.
     Events are shown as simple non-interactive dots. */
  .n9-wf-cal__chips { display: none; }
  .n9-wf-cal__dots { display: flex; flex-wrap: wrap; gap: 3px; pointer-events: none; padding: 2px 1px 0; }
  .n9-wf-cal__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--wf-primary); }
  .n9-wf-cal__cell.has-events { background: var(--wf-light); }
  .n9-wf-cal__cell.has-events:active { background: #dcebf2; }
  .n9-wf-cal__cell.is-today.has-events .n9-wf-cal__dot { background: var(--wf-navy); }
  .n9-wf-cal__title { min-width: 0; }
  .n9-wf-card { grid-template-columns: 1fr; }
  .n9-wf-card__img { min-height: 170px; }
  .n9-wf-listhead { flex-direction: column; align-items: stretch; }
  .n9-wf-filters { display: grid; grid-template-columns: 1fr 1fr; }
}
