/*
 * The events page (M1-EVENTS, design 04.3 Arhiva evenimentelor): the head, the warm band with the next-event block and
 * the three counters, the year and month bar, the filter bar and its chips, the tabs and the event cards.
 * Values come from tokens.css; this file holds no colour and no font size of its own.
 */

/* ---------- Head: eyebrow, H1, lead, segmented control, centred ---------- */

.events-head {
  padding-block: var(--spacing-24) var(--spacing-48);
}

.events-head h1 {
  max-width: 24ch;
  margin-bottom: var(--spacing-16);
}

.events-head .lead {
  max-width: var(--size-44rem);
}

/* ---------- The band: the next-event block and the counters ---------- */

.events-band {
  padding-block: var(--spacing-48);
}

.counters {
  display: grid;
  gap: var(--spacing-16);
  grid-template-columns: minmax(0, 1fr);
  margin: var(--spacing-24) 0 0;
  padding: 0;
  list-style: none;
}

.counter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-4);
  padding: var(--spacing-20) var(--spacing-16);
  border: var(--border-width-1) solid var(--color-border);
  border-radius: var(--border-radius-16);
  background: var(--color-surface);
  text-align: center;
}

.counter-head {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-12);
  color: var(--color-action);
}

.counter-value {
  color: var(--color-action);
  font-size: var(--font-size-40);
  line-height: var(--line-height-48);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-h2);
}

.counter-label {
  color: var(--color-text);
  font-size: var(--font-size-16);
  line-height: var(--line-height-24);
}

@media (min-width: 768px) {
  .counters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--spacing-24);
  }
}

/* ---------- Body ---------- */

.events-body {
  padding-block: var(--spacing-48) var(--spacing-64);
}

/* ---------- States legend: a closed disclosure under the period bar; the one addition to design 04.3 ---------- */

.events-legend {
  margin-bottom: var(--spacing-16);
}

.events-legend__body {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-12);
}

.events-legend__body > p {
  margin: 0;
}

/* ---------- Year and month bar: previous year, the months with their counts, next year ---------- */

.period-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    "prev next"
    "months months";
  gap: var(--spacing-8);
  margin-bottom: var(--spacing-16);
  padding: var(--spacing-8);
  border: var(--border-width-1) solid var(--color-border-band);
  border-radius: var(--border-radius-16);
  background: var(--color-background-band);
}

.period-bar > a:first-child {
  grid-area: prev;
  justify-self: start;
}

.period-bar > a:last-child {
  grid-area: next;
  justify-self: end;
}

.period-year {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-8);
  min-height: var(--size-2-75rem);
  padding: var(--spacing-8) var(--spacing-12);
  border-radius: var(--border-radius-8);
  color: var(--color-text);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
}

.period-year:hover {
  background: var(--color-surface);
  color: var(--color-action);
}

.period-months {
  grid-area: months;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--size-3-5rem), 1fr));
  gap: var(--spacing-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.period-month {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: var(--size-3-5rem);
  padding: var(--spacing-4) var(--spacing-4);
  border: var(--border-width-2) solid transparent;
  border-radius: var(--border-radius-8);
  color: var(--color-text-secondary);
  font-size: var(--font-size-14);
  line-height: var(--line-height-20);
  text-decoration: none;
}

.period-month:hover {
  background: var(--color-surface);
  color: var(--color-action);
}

.period-count {
  font-size: var(--font-size-14);
  line-height: var(--line-height-20);
}

/* The selected month is filled and bold: not told by colour alone (a border as well) */
.period-month.is-selected {
  border-color: var(--color-action);
  background: var(--color-action);
  color: var(--color-action-text);
  font-weight: var(--font-weight-semibold);
}

@media (min-width: 1024px) {
  .period-bar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "prev months next";
    align-items: center;
    gap: var(--spacing-16);
    padding-inline: var(--spacing-16);
  }
}

/* The filter bar is the shared one (components.css, M4-FILTERBAR); the checkbox of its 'Mai multe filtre' is centred on the row's line */
.upcoming-check {
  align-self: center;
}

/* ---------- Chips of the active filters ---------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-8);
  margin: var(--spacing-16) 0 0;
  padding: 0;
  list-style: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-8);
  min-height: var(--target-size);
  padding: var(--spacing-4) var(--spacing-12);
  border: var(--border-width-1) solid var(--color-action);
  border-radius: var(--border-radius-full);
  background: var(--color-background-action-hover);
  color: var(--color-action);
  font-size: var(--font-size-14);
  line-height: var(--line-height-20);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
}

.chip:hover {
  background: var(--color-background-action-active);
  color: var(--color-action-hover);
  text-decoration: underline;
}

/* ---------- Tabs and the 'Propune un eveniment' button ---------- */

.events-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--spacing-8) var(--spacing-16);
  margin-top: var(--spacing-48);
  border-bottom: var(--border-width-1) solid var(--color-border);
}

/* On the wide layouts the toolbar's own border is the baseline under the tabs and the button; the tabs sit on it */
.events-toolbar .tabs {
  flex: 1 1 auto;
  min-width: 0;
  box-shadow: none;
}

.events-toolbar .tabs a {
  margin-bottom: 0;
}

.events-toolbar .button {
  flex: none;
  margin-bottom: var(--spacing-4);
}

/* Below 768 px the tab row is one scrolling row with its own baseline, and the button sits below it, 16 px away (CC-5) */
@media (max-width: 767.98px) {
  .events-toolbar {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: var(--spacing-16);
    border-bottom: 0;
  }

  .events-toolbar .tabs {
    flex: none;
    align-self: stretch;
  }

  .events-toolbar .button {
    margin-bottom: 0;
  }
}

/* ---------- Results ---------- */

.results-heading {
  margin: var(--spacing-32) 0 0;
  color: var(--color-text-secondary);
  font-size: var(--font-size-16);
  line-height: var(--line-height-24);
  font-weight: var(--font-weight-medium);
  letter-spacing: 0;
}

/* A region that script focuses after a filter, not a control: no ring, no outline but the transparent one forced-colours
   mode keeps. Its top stays 24 px below the viewport's top when the browser scrolls to it. */
.results-heading {
  scroll-margin-top: var(--spacing-24);
}

h2.results-heading:is(:focus, :focus-visible) {
  outline: var(--border-width-2) solid transparent;
  box-shadow: none;
}

.events-month {
  margin-top: var(--spacing-32);
}

.events-month-heading {
  margin: 0 0 var(--spacing-24);
  font-size: var(--font-size-32);
  line-height: var(--line-height-40);
  letter-spacing: var(--letter-spacing-h2);
}

.event-list {
  display: grid;
  gap: var(--spacing-24);
  margin: 0;
  padding: 0;
  list-style: none;
}

.events-empty {
  margin-top: var(--spacing-24);
}

/* ---------- Event card: the image beside the text from 768 px ---------- */

.event-card-figure {
  position: relative;
  flex: none;
  min-width: 0;
}

.event-card-figure .card-media {
  display: block;
  width: 100%;
}

.event-card-caption {
  position: absolute;
  left: var(--spacing-8);
  bottom: var(--spacing-8);
  margin: 0;
  padding: var(--spacing-2) var(--spacing-8);
  border-radius: var(--border-radius-4);
  background: var(--color-surface);
}

.event-card .card-body {
  gap: var(--spacing-12);
  justify-content: center;
}

.event-card .card-meta {
  color: var(--color-action);
}

.event-card .card-text {
  color: var(--color-text-secondary);
}

.card-more {
  margin: 0;
  color: var(--color-action);
  font-size: var(--font-size-14);
  line-height: var(--line-height-20);
  text-decoration: underline;
  text-underline-offset: var(--underline-offset);
}

@media (min-width: 768px) {
  .card.horizontal.event-card .event-card-figure {
    width: 32%;
  }

  .card.horizontal.event-card .event-card-figure .card-media {
    width: 100%;
    height: 100%;
    min-height: var(--size-13-5rem);
    aspect-ratio: auto;
  }
}

/* ---------- Calendar view (UI-12, UI-37): the month grid from 600 px, the agenda under it ---------- */

.calendar-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: "title title" "prev next";
  align-items: stretch;
  gap: var(--spacing-12);
  margin-block: var(--spacing-16) var(--spacing-12);
}

.calendar-toolbar .calendar-month {
  grid-area: title;
}

.calendar-toolbar .button {
  min-width: 0;
  text-align: center;
  overflow-wrap: normal;
  word-break: normal;
}

.calendar-toolbar .button[rel="prev"] {
  grid-area: prev;
}

.calendar-toolbar .button[rel="next"] {
  grid-area: next;
}

@media (min-width: 768px) {
  .calendar-toolbar {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-areas: "prev title next";
    align-items: center;
  }

  .calendar-toolbar .button[rel="prev"] {
    justify-self: start;
  }

  .calendar-toolbar .button[rel="next"] {
    justify-self: end;
  }
}

.calendar-month {
  margin: 0;
  font-size: var(--font-size-20);
  line-height: var(--line-height-28);
  text-align: center;
}

.calendar-note,
.countries-note {
  margin: 0 0 var(--spacing-16);
  color: var(--color-text-secondary);
  font-size: var(--font-size-14);
  line-height: var(--line-height-20);
}

.calendar-scroll {
  display: none;
  margin-bottom: var(--spacing-32);
  overflow-x: auto;
}

.calendar-grid {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.calendar-grid th,
.calendar-grid td {
  border: var(--border-width-1) solid var(--color-border);
  vertical-align: top;
}

.calendar-grid th {
  padding: var(--spacing-8);
  background: var(--color-surface-muted);
  font-size: var(--font-size-14);
  font-weight: 600;
  text-align: start;
}

.calendar-grid td {
  padding: var(--spacing-4);
  overflow-wrap: anywhere;
}

.calendar-cell {
  min-height: var(--size-7rem);
}

.calendar-grid td.calendar-other {
  background: var(--color-surface-muted);
}

.calendar-day {
  display: inline-block;
  min-width: var(--size-1-75rem);
  margin-bottom: var(--spacing-4);
  padding: var(--spacing-2) var(--spacing-4);
  font-size: var(--font-size-14);
  font-weight: 600;
  line-height: var(--line-height-20);
}

.calendar-today .calendar-day {
  border-radius: var(--border-radius-full);
  background: var(--color-action);
  color: var(--color-action-text);
  text-align: center;
}

.calendar-event {
  display: block;
  margin-bottom: var(--spacing-4);
  padding: var(--spacing-4) var(--spacing-6);
  border-inline-start: var(--border-width-3) solid var(--color-info-text);
  border-radius: var(--border-radius-4);
  background: var(--color-info-surface);
  color: var(--color-info-text);
  font-size: var(--font-size-12);
  line-height: var(--line-height-16);
  hyphens: auto;
  text-decoration: none;
}

a.calendar-event:hover .calendar-event-title {
  text-decoration: underline;
}

.calendar-event small {
  display: block;
  color: var(--color-text-secondary);
  font-size: var(--font-size-12);
}

.calendar-event-cont {
  border-inline-start-style: dotted;
}

.calendar-agenda {
  display: grid;
  gap: var(--spacing-24);
}

.agenda-heading {
  margin: 0 0 var(--spacing-12);
  font-size: var(--font-size-20);
  line-height: var(--line-height-28);
}

.calendar-undated {
  margin-top: var(--spacing-32);
}

@media (min-width: 600px) {
  .calendar-scroll {
    display: block;
  }

  .calendar-agenda {
    display: none;
  }
}

@media (min-width: 1024px) {
  .calendar-grid td {
    padding: var(--spacing-8);
  }

  .calendar-cell {
    min-height: var(--size-8-5rem);
  }

  .calendar-event {
    font-size: var(--font-size-14);
  }
}

/* ---------- Countries view: a list with the counts ---------- */

.country-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(var(--size-16rem), 100%), 1fr));
  gap: var(--spacing-16);
  margin: 0;
  padding: 0;
  list-style: none;
}

.country-link {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-4);
  height: 100%;
  padding: var(--spacing-16) var(--spacing-20);
  border: var(--border-width-1) solid var(--color-border);
  border-radius: var(--border-radius-16);
  background: var(--color-surface);
  color: var(--color-text);
  text-decoration: none;
}

a.country-link:hover {
  border-color: var(--color-action);
  background: var(--color-background-action-hover);
}

.country-name {
  font-size: var(--font-size-20);
  font-weight: 600;
  line-height: var(--line-height-28);
}

a.country-link .country-name {
  color: var(--color-action);
  text-decoration: underline;
  text-underline-offset: var(--underline-offset);
}

.country-count {
  color: var(--color-text-secondary);
  font-size: var(--font-size-16);
}
