/* Renginiai Kėdainiuose: one small stylesheet, no images, no fonts to download. */

:root {
  --ink: #17231f;
  --soft: #55645e;
  --green: #1e5a47;
  --green-deep: #174536;
  --mist: #f2f5f3;
  --card: #ffffff;
  --line: #dce5e0;
  --tint: #e3efe9;
  --on-green: #ffffff;
  --radius: 14px;
  --bar-h: 3.75rem;
  --gap: 1rem;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8efec;
    --soft: #a3b3ac;
    --green: #2f8566;
    --green-deep: #14372d;
    --mist: #0f1714;
    --card: #17211d;
    --line: #26332e;
    --tint: #1f3a31;
    --on-green: #ffffff;
  }
}

/* ---------- category colours ---------- */
/* --c: strong colour (labels, links, dots, edges)  --t: pale tint  --on: text on --c */

:root, [data-cat="all"] { --c: var(--green); --t: var(--tint); --on: var(--on-green); }

[data-cat="knygos"]              { --c: #2f55b0; --t: #e6ecfa; --on: #ffffff; }
[data-cat="parodos"]             { --c: #7a3fa0; --t: #f0e8f6; --on: #ffffff; }
[data-cat="muzika"]              { --c: #be3b2c; --t: #fbe9e6; --on: #ffffff; }
[data-cat="teatras-kinas"]       { --c: #b0307a; --t: #f9e6f0; --on: #ffffff; }
[data-cat="dirbtuves-paskaitos"] { --c: #946010; --t: #f8eedb; --on: #ffffff; }
[data-cat="sportas"]             { --c: #3a7d1f; --t: #e8f2e1; --on: #ffffff; }
[data-cat="svente"]              { --c: #0b7479; --t: #dff1f1; --on: #ffffff; }

@media (prefers-color-scheme: dark) {
  [data-cat="knygos"]              { --c: #8fa8f0; --t: #1e2a4a; --on: #0f1714; }
  [data-cat="parodos"]             { --c: #c79be6; --t: #33203f; --on: #0f1714; }
  [data-cat="muzika"]              { --c: #f08a7c; --t: #422320; --on: #0f1714; }
  [data-cat="teatras-kinas"]       { --c: #e58ac0; --t: #3f2033; --on: #0f1714; }
  [data-cat="dirbtuves-paskaitos"] { --c: #e0b15a; --t: #3a2e15; --on: #0f1714; }
  [data-cat="sportas"]             { --c: #8ccb6b; --t: #233619; --on: #0f1714; }
  [data-cat="svente"]              { --c: #5cc6cb; --t: #153638; --on: #0f1714; }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--mist);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
}

.wrap {
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  padding-inline: 1rem;
}

a { color: var(--green); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- banner ---------- */

.banner {
  background: var(--green-deep);
  color: var(--on-green);
  padding-block: 2rem 2.25rem;
}

.banner h1 {
  margin: 0;
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.lead {
  margin: 0.6rem 0 0;
  max-width: 34rem;
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.82);
}

/* ---------- category filter bar (stays at the top while scrolling) ---------- */

.filters {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--mist);
  border-bottom: 1px solid var(--line);
}

.filters .wrap {
  display: flex;
  align-items: center;
  min-height: var(--bar-h);
  position: relative;
}

.pills {
  display: none;
  flex-wrap: nowrap;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.filters a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.5rem;
  padding: 0.25rem 0.65rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.filters a::before {
  content: "";
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--c);
}

.filters a:hover { border-color: var(--c); }

.filters a.current {
  background: var(--c);
  border-color: var(--c);
  color: var(--on);
}

.filters a.current::before { background: var(--on); }

.count {
  font-size: 0.85rem;
  color: var(--soft);
}

.filters a.current .count { color: var(--on); opacity: 0.85; }

/* narrow screens: one compact line that opens a list of categories */

.menu { width: 100%; }

.menu summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 2.75rem;
  padding: 0.25rem 0.9rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
}

.menu summary::-webkit-details-marker { display: none; }

.menu summary::after {
  content: "";
  flex: none;
  width: 0.55rem;
  height: 0.55rem;
  margin-left: auto;
  border-right: 2px solid var(--soft);
  border-bottom: 2px solid var(--soft);
  transform: translateY(-2px) rotate(45deg);
}

.menu[open] summary::after { transform: translateY(2px) rotate(-135deg); }

.menu-label { font-size: 0.85rem; font-weight: 500; color: var(--soft); }

.menu-current {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
}

.menu-list {
  position: absolute;
  top: calc(100% - 0.35rem);
  left: 1rem;
  right: 1rem;
  z-index: 40;
  display: grid;
  gap: 0.35rem;
  max-height: calc(100vh - var(--bar-h) - 1.5rem);
  margin: 0;
  padding: 0.6rem;
  overflow-y: auto;
  list-style: none;
  background: var(--mist);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

.menu-list a { width: 100%; justify-content: flex-start; }
.menu-list .count { margin-left: auto; }

/* wide screens: all categories as buttons in one line */
@media (min-width: 70rem) {
  .pills { display: flex; }
  .menu { display: none; }
}

/* ---------- sections ---------- */

.block { padding-block: 1.75rem 0.5rem; scroll-margin-top: var(--bar-h); }

#renginiai { scroll-margin-top: var(--bar-h); }

.block-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.9rem;
  margin-bottom: 1rem;
}

.block-head h2 {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.2;
}

.sub {
  margin: 0;
  color: var(--soft);
}

.empty {
  margin: 0;
  padding: 1.1rem 1.25rem;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--soft);
}

/* ---------- event card ---------- */

.card {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0.25rem 1rem;
  align-content: start;
  padding: 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--c);
  border-radius: var(--radius);
}

.side {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-self: start;
}

.thumb {
  display: block;
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 10px;
  object-fit: cover;
  background: var(--t);
}

.date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.25rem;
  background: var(--t);
  border-radius: 10px;
  line-height: 1.1;
  text-align: center;
}

.day { font-size: 1.75rem; font-weight: 700; color: var(--c); }
.month { font-size: 0.9rem; font-weight: 600; }
.weekday { margin-top: 0.15rem; font-size: 0.8rem; color: var(--soft); }

/* Every tile is the same height: the text block has a fixed minimum height and
   long titles/venues are cut after a set number of lines. Line heights are in
   rem so the arithmetic stays exact. */

.body { min-height: 10.3rem; min-width: 0; }

.tag {
  margin: 0 0 0.2rem;
  font-size: 0.8rem;
  line-height: 1.2rem;
  font-weight: 600;
  color: var(--c);
}

.title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  line-height: 1.4rem;
  overflow-wrap: anywhere;
}

.tag, .title, .venue {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tag { -webkit-line-clamp: 1; line-clamp: 1; }
.title { -webkit-line-clamp: 3; line-clamp: 3; }
.venue { -webkit-line-clamp: 2; line-clamp: 2; }

.body p { margin: 0; }
.time { font-weight: 600; line-height: 1.5rem; }
.venue { color: var(--soft); line-height: 1.4rem; }

/* the title is the link to the event's own page (opens in a new tab) */
.title a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--c);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.title a::after { content: " \2197"; font-weight: 400; color: var(--c); }

.title a:focus-visible { outline-offset: 2px; }

/* today's events: filled date block */
.rail .date { background: var(--c); color: var(--on); }
.rail .day { color: var(--on); }
.rail .weekday { color: var(--on); opacity: 0.85; }

/* ---------- today's events: rows of cards that stack while scrolling ----------
   Three cards per row on desktop, two on tablets. While scrolling, each row
   sticks just below the category bar and the next row slides over it, so the
   earlier rows pile up with their coloured top edges showing; when Today ends,
   its pile scrolls away. Phones: one card per row (see the phone section). */

.rail {
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 38.01rem) {
  .rail {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
    gap: var(--gap);
  }

  .rail > .card {
    position: sticky;
    top: calc(var(--bar-h) + 3.3rem);           /* the 5th row and later */
    box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.10);
  }

  .rail > .card:nth-child(-n+3)                 { top: calc(var(--bar-h) + 0.5rem); }
  .rail > .card:nth-child(n+4):nth-child(-n+6)  { top: calc(var(--bar-h) + 1.2rem); }
  .rail > .card:nth-child(n+7):nth-child(-n+9)  { top: calc(var(--bar-h) + 1.9rem); }
  .rail > .card:nth-child(n+10):nth-child(-n+12) { top: calc(var(--bar-h) + 2.6rem); }
}

@media (min-width: 38.01rem) and (max-width: 56rem) {
  .rail { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .rail > .card:nth-child(-n+2)                 { top: calc(var(--bar-h) + 0.5rem); }
  .rail > .card:nth-child(n+3):nth-child(-n+4)  { top: calc(var(--bar-h) + 1.2rem); }
  .rail > .card:nth-child(n+5):nth-child(-n+6)  { top: calc(var(--bar-h) + 1.9rem); }
  .rail > .card:nth-child(n+7):nth-child(-n+8)  { top: calc(var(--bar-h) + 2.6rem); }
  .rail > .card:nth-child(n+9):nth-child(-n+10) { top: calc(var(--bar-h) + 3.3rem); }
  .rail > .card:nth-child(n+11):nth-child(-n+999) { top: calc(var(--bar-h) + 3.3rem); }
}

/* One day's cards (all later events). Outside phones the group takes no
   space of its own: its cards sit in the grid directly. */
.day-group,
.day-cards { display: contents; }

/* ---------- calendar ---------- */

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.cal-section {
  --cal-row: 3.6rem;
  --cal-gap: 0.3rem;
  --cal-head: 2rem;
  --cal-month: 2.25rem;
  --cal-pitch: calc(var(--cal-row) + var(--cal-gap));
  /* Calendar height, used to keep the calendar in view after a tap on a day:
     stacked months (phones) ... */
  --cal-h: calc(var(--months) * (var(--cal-month) + var(--cal-head))
                + var(--rows) * var(--cal-pitch) + 4rem + var(--bar-h));
}

/* ... and months side by side (wide screens). The numbers come from the page. */
@media (min-width: 56rem) {
  .cal-section {
    --cal-h: calc(var(--cal-month) + var(--cal-head)
                  + var(--maxrows) * var(--cal-pitch) + 4rem + var(--bar-h));
  }
}

.months-1 { --months: 1; } .months-2 { --months: 2; } .months-3 { --months: 3; } .months-4 { --months: 4; }
.rows-1 { --rows: 1; } .rows-2 { --rows: 2; } .rows-3 { --rows: 3; } .rows-4 { --rows: 4; }
.rows-5 { --rows: 5; } .rows-6 { --rows: 6; } .rows-7 { --rows: 7; } .rows-8 { --rows: 8; }
.rows-9 { --rows: 9; } .rows-10 { --rows: 10; } .rows-11 { --rows: 11; } .rows-12 { --rows: 12; }
.rows-13 { --rows: 13; } .rows-14 { --rows: 14; } .rows-15 { --rows: 15; } .rows-16 { --rows: 16; }
.maxrows-1 { --maxrows: 1; } .maxrows-2 { --maxrows: 2; } .maxrows-3 { --maxrows: 3; }
.maxrows-4 { --maxrows: 4; } .maxrows-5 { --maxrows: 5; } .maxrows-6 { --maxrows: 6; }
.maxrows-7 { --maxrows: 7; } .maxrows-8 { --maxrows: 8; }

.cal-months {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem 2rem;
  align-items: start;
}

@media (min-width: 56rem) {
  .cal-months { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.cal-month-title {
  margin: 0;
  padding-bottom: 0.35rem;
  height: var(--cal-month);
  border-bottom: 2px solid var(--line);
  font-size: 1.15rem;
  line-height: 1.7rem;
}

.cal {
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: var(--cal-gap);
  margin: 0 calc(-1 * var(--cal-gap));
  width: calc(100% + 2 * var(--cal-gap));
}

.cal th {
  height: var(--cal-head);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--soft);
  text-align: center;
}

.cal td {
  height: var(--cal-row);
  padding: 0;
  vertical-align: top;
}

.cal td > a,
.cal td > .plain {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  padding: 0.3rem 0.4rem 0.4rem;
  border-radius: 10px;
  border: 1px solid transparent;
  color: var(--soft);
  text-decoration: none;
}

.cal td.has > a {
  background: var(--card);
  border-color: var(--line);
  color: var(--ink);
}

.cal td.has > a:hover { border-color: var(--green); }

.cal td.past > .plain { opacity: 0.45; }
.cal td.past.has > a { opacity: 0.6; }

.num {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
}

.cal td.has .num { font-weight: 700; }

.cal td.today > a,
.cal td.today > .plain {
  border-color: var(--green);
  box-shadow: inset 0 0 0 1px var(--green);
}

.dots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
}

.dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--c);
}

/* the events of the chosen day (shown only while its link is the target) */

.day-panel {
  display: none;
  margin-top: 1.25rem;
  scroll-margin-top: var(--cal-h);
}

.day-panel:target { display: block; }

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}

.panel-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
}

.close {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0.25rem 0.9rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
}

.close:hover { border-color: var(--green); }

/* ---------- upcoming events: grid, 3 tiles wide ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: var(--gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---------- footer ---------- */

.foot {
  margin-top: 2.5rem;
  padding-block: 1.5rem 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--soft);
  font-size: 0.9rem;
}

.foot p { margin: 0; max-width: 40rem; }

/* ---------- smaller screens ---------- */

@media (max-width: 56rem) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 38rem) {
  .cal-section { --cal-row: 3.4rem; --cal-gap: 0.2rem; }
  .cal td > a, .cal td > .plain { padding: 0.25rem 0.3rem 0.3rem; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .banner { padding-block: 1.5rem 1.75rem; }
  .block { padding-top: 1.5rem; }
}

/* ---------- phones: every list of event cards as a sliding deck ----------
   Today, the events of a day picked in the calendar, and all later events
   (.rail and .grid). The cards stand in one column. While scrolling, each
   card sticks just below the category bar and the next one slides over it,
   so the earlier cards pile up with their coloured top edges showing. Piles
   are one day each (all later events are split into .day-cards groups): when
   a day ends, its pile scrolls away and the next day starts a new one. That
   keeps the number of cards stuck at once small; dozens of stuck cards make
   phone browsers run out of drawing memory (half-drawn or blank cards).
   Desktop and tablet: Today stacks by rows (above); the grids stay as they are. */

@media (max-width: 38rem) {
  .rail {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--gap);
  }

  /* one day's cards: its own column, and the box its pile sticks inside */
  .day-group { display: block; }
  .day-cards {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--gap);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .rail > .card,
  .grid > .card,
  .day-cards > .card {
    flex: none;
    position: sticky;
    top: calc(var(--bar-h) + 5.4rem);           /* the 8th card and later */
    box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.10);
  }

  .rail > .card:nth-child(1), .grid > .card:nth-child(1), .day-cards > .card:nth-child(1) { top: calc(var(--bar-h) + 0.5rem); }
  .rail > .card:nth-child(2), .grid > .card:nth-child(2), .day-cards > .card:nth-child(2) { top: calc(var(--bar-h) + 1.2rem); }
  .rail > .card:nth-child(3), .grid > .card:nth-child(3), .day-cards > .card:nth-child(3) { top: calc(var(--bar-h) + 1.9rem); }
  .rail > .card:nth-child(4), .grid > .card:nth-child(4), .day-cards > .card:nth-child(4) { top: calc(var(--bar-h) + 2.6rem); }
  .rail > .card:nth-child(5), .grid > .card:nth-child(5), .day-cards > .card:nth-child(5) { top: calc(var(--bar-h) + 3.3rem); }
  .rail > .card:nth-child(6), .grid > .card:nth-child(6), .day-cards > .card:nth-child(6) { top: calc(var(--bar-h) + 4.0rem); }
  .rail > .card:nth-child(7), .grid > .card:nth-child(7), .day-cards > .card:nth-child(7) { top: calc(var(--bar-h) + 4.7rem); }

  .rail .body,
  .grid .body { min-height: 0; }

  /* A day picked in the calendar scrolls to its own heading and first event
     (on desktop the calendar and the day's events fit on one screen). */
  .day-panel { scroll-margin-top: calc(var(--bar-h) + 0.5rem); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}