/* ============================================================================
   FESTIVALS + EVENTS on the inner layer (Docs/plan-inner-pages.md, Phase 5)
   /festivals, /events, /events/calendar

   Approved mockup: Docs/mockups/inner-pages/festivals.html. A year you can read down, in place
   of a grid of identical squares. The dated row is the campaign page's programme row, reused.
   Loads after css/public/inner.css.

   1. next up      2. the year      3. dated row      4. month grid (/events/calendar)
   ============================================================================ */

/* ---------- 1. NEXT UP — the one festival or event that is closest ---------- */
.next { display: grid; gap: var(--s6); padding: 0 var(--gutter) clamp(48px, 8vh, 88px); }
.next .ph { aspect-ratio: 16 / 10; }
.next-txt { align-self: center; min-width: 0; }
.next .label { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--red-ink); }
.next .label i { width: 9px; height: 9px; border-radius: 50%; background: var(--red); }
.next h2 { font-size: var(--fs-l); margin-top: var(--s4); overflow-wrap: anywhere; }
.next .facts { margin: var(--s6) 0 0; }
.next .btn { margin-top: var(--s6); }
@media (min-width: 900px) {
  .next { grid-template-columns: 1.25fr 1fr; gap: 5vw; }
  .next .ph { aspect-ratio: auto; min-height: 56vh; }
}

/* ---------- 2. THE YEAR — month index on the left, the months down the right ---------- */
.year { display: grid; gap: var(--s7); padding: clamp(48px, 9vh, 96px) var(--gutter); background: var(--paper-2); }
.year .menu { margin-top: var(--s5); }
.months { display: flex; flex-wrap: wrap; gap: 6px; margin: var(--s5) 0 0; padding: 0; list-style: none; }
.months a, .months span { display: grid; place-items: center; min-width: 46px; height: 44px; padding: 0 8px; font-size: .7rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; text-decoration: none; box-shadow: inset 0 0 0 1px rgba(23, 20, 15, .3); }
.months span { color: var(--ink-3); box-shadow: inset 0 0 0 1px rgba(23, 20, 15, .1); }
.months a:hover { background: var(--ink); color: var(--paper); }
.month { scroll-margin-top: calc(var(--hdr) + 16px); }
.month + .month { margin-top: var(--s7); }
.month > h3 { display: flex; align-items: baseline; gap: 14px; margin: 0; padding-bottom: 14px; border-bottom: 2px solid var(--ink); font-family: var(--f-display); font-weight: 800; font-size: clamp(1.6rem, 2.6vw, 2.3rem); line-height: 1; letter-spacing: -.02em; text-transform: uppercase; font-variation-settings: "SOFT" 100, "opsz" 144; }
.month > h3 small { font-family: var(--f-sans); font-weight: 600; font-size: .7rem; letter-spacing: .16em; color: var(--ink-3); }
.year .empty { padding: var(--s7) 0; text-align: left; }
.year .pager { padding: var(--s7) 0 0; justify-content: flex-start; }
/* the events list: the same rows with no month index beside them, and a featured block that follows a toolbar */
.year--list { display: block; }
.year--list .more-row { padding: var(--s7) 0 0; justify-items: start; }
.next--top { padding-top: clamp(32px, 6vh, 64px); }
@media (min-width: 900px) {
  .year:not(.year--list) { grid-template-columns: .8fr 2fr; gap: 0 5vw; align-items: start; }
  .year > .sec-head { position: sticky; top: calc(var(--hdr) + 6vh); }
  /* the town menu sits at the foot of a pinned column: it opens upward, or its list would fall
     below the window with no way to scroll to it */
  .year .menu-list { top: auto; bottom: calc(100% + 6px); max-height: min(50vh, 22rem); }
}


/* ---------- 3. DATED ROW — the day large, the name, where; a photograph at the end ---------- */
.frow a { display: grid; grid-template-columns: 4.4rem minmax(0, 1fr) 84px; gap: 6px 16px; align-items: center; padding: 18px 0; text-decoration: none; }
.frow--plain a { grid-template-columns: 4.4rem minmax(0, 1fr); }
.frow .t { font-family: var(--f-display); font-weight: 300; font-size: 2.3rem; line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; font-variation-settings: "SOFT" 50, "opsz" 144; }
.frow .t small { display: block; margin-top: 6px; font-family: var(--f-sans); font-weight: 600; font-size: .64rem; letter-spacing: .16em; color: var(--ink-3); }
.frow h2, .frow h3, .frow h4 { margin: 0; font-family: var(--f-display); font-weight: 600; font-size: clamp(1.25rem, 2vw, 1.7rem); line-height: 1.08; letter-spacing: -.015em; font-variation-settings: "SOFT" 100; transition: translate var(--d-ui) var(--e-out), color var(--d-micro); }
.frow .where { display: flex; max-width: none; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 6px 0 0; font-size: .86rem; color: var(--ink-3); }
.frow .badge { padding: 4px 9px 3px; border-radius: var(--r-pill); background: var(--teal); color: #fff; font-size: .6rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.frow .ph { width: 84px; aspect-ratio: 1; }
.frow a:hover h2, .frow a:hover h3, .frow a:hover h4 { color: var(--red-ink); translate: 8px 0; }
@media (min-width: 900px) {
  .frow a { grid-template-columns: 5.6rem minmax(0, 1fr) 132px; gap: 6px 24px; }
  .frow--plain a { grid-template-columns: 5.6rem minmax(0, 1fr); }
  .frow .ph { width: 132px; aspect-ratio: 4 / 3; }
}
@media (prefers-reduced-motion: reduce) { .frow h2, .frow h3, .frow h4 { transition: none; } .frow a:hover h2, .frow a:hover h3, .frow a:hover h4 { translate: none; } }

/* ---------- 4. MONTH GRID — /events/calendar: seven columns of days, each a list of that day's events ---------- */
.cal-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding: 0 var(--gutter) var(--s6); }
.cal-nav h2 { margin: 0 auto 0 0; font-family: var(--f-display); font-weight: 800; font-size: clamp(1.6rem, 2.6vw, 2.3rem); line-height: 1; letter-spacing: -.02em; text-transform: uppercase; font-variation-settings: "SOFT" 100, "opsz" 144; }
.cal-nav a { display: inline-flex; align-items: center; min-height: 44px; font-size: .85rem; font-weight: 600; text-underline-offset: 4px; }
.cal { margin: 0 var(--gutter) var(--s9); border-top: 2px solid var(--ink); }
.cal-days, .cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-days span { padding: 10px 6px; font-size: .64rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.cal-week { border-top: 1px solid var(--rule); }
.cal-day { min-height: 6.5rem; padding: 8px 6px 10px; border-left: 1px solid var(--rule); min-width: 0; }
.cal-day:first-child { border-left: 0; }
.cal-day.is-out { background: rgba(23, 20, 15, .035); }
.cal-day .n { display: block; font-family: var(--f-display); font-weight: 300; font-size: 1.3rem; line-height: 1; font-variant-numeric: tabular-nums; }
.cal-day.is-out .n { color: var(--ink-3); }
.cal-day.is-today .n { font-weight: 800; color: var(--red-ink); }
.cal-day ul { margin: 8px 0 0; padding: 0; list-style: none; }
.cal-day li + li { margin-top: 4px; }
.cal-day li a { display: block; padding: 3px 6px; background: var(--ink); color: var(--paper); font-size: .72rem; line-height: 1.25; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-day li a:hover { background: var(--red-ink); }
.cal-day .more { display: inline-block; margin-top: 4px; font: 600 .72rem/1.3 var(--f-sans); color: var(--ink-2); text-underline-offset: 3px; }
.cal-list .frow { scroll-margin-top: calc(var(--hdr) + 16px); }
.cal-list .frow:target h3 { color: var(--red-ink); }
/* on a phone the grid is too narrow for names: each day shows a count, and the month's events follow as dated rows */
@media (max-width: 699px) {
  .cal-day { min-height: 3.4rem; padding: 6px 4px; }
  .cal-day ul, .cal-day .more { display: none; }
  .cal-day .dot { display: block; width: 6px; height: 6px; margin-top: 6px; border-radius: 50%; background: var(--red); }
}
@media (min-width: 700px) { .cal-day .dot { display: none; } }
