@import url("https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,600;1,6..72,400&family=Assistant:wght@400;600;700&display=swap");

:root {
  --bg: #f6f2e9;
  --paper: #fffdf8;
  --ink: #1e1a16;
  --muted: #5f5650;
  --line: rgba(30, 26, 22, 0.12);
  --accent: #0b6b5d;
  --accent-soft: rgba(11, 107, 93, 0.1);
  --accent2: #b24a2b;
  --shadow: 0 14px 36px rgba(20, 14, 9, 0.1);
  --radius: 14px;
  --header-h: 0px; /* set from JS so month headings stick right under the header */
  --rail: 52px;    /* width of the date column on the timeline */
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: radial-gradient(1200px 800px at 20% 0%, rgba(11, 107, 93, 0.12), transparent 55%),
    radial-gradient(1000px 700px at 90% 10%, rgba(178, 74, 43, 0.1), transparent 50%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: "Assistant", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.wrap {
  width: min(1100px, calc(100% - 24px));
  margin: 0 auto;
}

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(246, 242, 233, 0.86);
  border-bottom: 1px solid var(--line);
}

.header__inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 0 10px;
}

.header__row {
  display: flex;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.headline {
  font-family: "Newsreader", ui-serif, Georgia, serif;
  font-weight: 600;
  font-size: 24px;
  line-height: 1.15;
  margin: 0;
}

.headline em {
  font-weight: 400;
  color: var(--accent);
}

.search {
  flex: 0 1 300px;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 15px;
  outline: none;
}

.search:focus {
  border-color: rgba(11, 107, 93, 0.55);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ── Segmented range control with a sliding highlight ── */
.seg {
  position: relative;
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: 4px;
  border-radius: 999px;
  background: rgba(30, 26, 22, 0.06);
  border: 1px solid var(--line);
}

.seg__thumb {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 6px 16px rgba(11, 107, 93, 0.35);
  transition: transform 0.28s cubic-bezier(0.3, 0.7, 0.2, 1), width 0.28s cubic-bezier(0.3, 0.7, 0.2, 1);
}

.seg button {
  position: relative;
  z-index: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s;
}

.seg button:hover {
  color: var(--ink);
}

.seg button[aria-selected="true"] {
  color: #fff;
}

.seg button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.summary {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
}

.summary strong {
  color: var(--ink);
  font-size: 17px;
}

.summary .summary__now {
  color: var(--accent);
  font-weight: 600;
}

/* reading progress through the list */
.progress {
  height: 3px;
  background: transparent;
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

/* ── Layout: timeline + month scrubber ── */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
}

main {
  padding: 8px 0 40px;
  min-width: 0;
}

/* ── Month block ── */
.month__head {
  position: sticky;
  top: var(--header-h);
  z-index: 5;
  margin: 0;
  padding: 10px 0 8px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: "Newsreader", ui-serif, Georgia, serif;
  font-size: 21px;
  font-weight: 600;
  background: linear-gradient(var(--bg) 75%, rgba(246, 242, 233, 0));
}

.month__count {
  font-family: "Assistant", sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
}

/* ── Timeline ── */
.tl {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  position: relative;
}

/* the vertical line */
.tl::before {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: calc(var(--rail) + 9px);
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(var(--accent), rgba(11, 107, 93, 0.15));
}

.tl__item {
  display: grid;
  grid-template-columns: var(--rail) 20px minmax(0, 1fr);
  align-items: start;
  padding: 6px 0;
}

.tl__date {
  text-align: right;
  padding-top: 14px;
  line-height: 1;
  color: var(--muted);
}

.tl__day {
  display: block;
  font-family: "Newsreader", ui-serif, Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
}

.tl__mon {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.tl__date--same .tl__day,
.tl__date--same .tl__mon {
  visibility: hidden; /* same day as the card above: one date label per day */
}

/* the dot on the line */
.tl__dot {
  justify-self: center;
  margin-top: 18px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--paper);
  border: 3px solid var(--accent);
  position: relative;
  z-index: 1;
}

.tl__date--same + .tl__dot {
  width: 8px;
  height: 8px;
  margin-top: 20px;
  border-width: 2px;
}

/* ── Cards ── */
.card {
  margin-left: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 12px;
  overflow: hidden;
  position: relative;
}

.card--lesnica {
  border-left: 4px solid #c78b20;
}

.card__top {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
}

.card__title {
  font-family: "Newsreader", ui-serif, Georgia, serif;
  font-size: 19px;
  line-height: 1.25;
  margin: 0;
}

.card__when {
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.card__lead {
  margin: 8px 0 0;
  font-size: 15px;
  line-height: 1.5;
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.chip {
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 13px;
  line-height: 1.35;
}

.chip--date {
  border: 1px solid rgba(11, 107, 93, 0.25);
  background: rgba(11, 107, 93, 0.07);
  color: #064d43;
}

.chip--money {
  border: 1px solid rgba(178, 74, 43, 0.25);
  background: rgba(178, 74, 43, 0.07);
  color: #7a2e14;
}

.card__actions {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.action {
  font-size: 14px;
  line-height: 1.4;
  padding-left: 16px;
  position: relative;
}

.action::before {
  content: "\2192";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.card__foot {
  margin-top: 12px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.card__who {
  font-size: 13px;
  color: var(--muted);
}

.card__link {
  font-size: 13px;
  color: var(--accent2);
  white-space: nowrap;
}

/* ── Month scrubber (wide windows only) ── */
.scrub {
  display: none;
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) 150px;
  }

  .scrub:not([hidden]) {
    display: block;
    position: sticky;
    top: calc(var(--header-h) + 16px);
    align-self: start;
    padding: 14px 0 0;
  }
}

.scrub__title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 8px 12px;
}

.scrub ol {
  list-style: none;
  margin: 0;
  padding: 0 0 0 12px;
  border-left: 2px solid var(--line);
}

.scrub a {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
  padding: 5px 8px;
  margin-left: -14px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}

.scrub a:hover {
  color: var(--ink);
}

.scrub__bar {
  grid-column: 1 / -1;
  height: 4px;
  border-radius: 4px;
  background: rgba(30, 26, 22, 0.1);
  overflow: hidden;
}

.scrub__bar span {
  display: block;
  height: 100%;
  background: rgba(11, 107, 93, 0.45);
}

.scrub a.is-active {
  color: var(--accent);
  font-weight: 700;
  border-left-color: var(--accent);
}

.scrub a.is-active .scrub__bar span {
  background: var(--accent);
}

.scrub__n {
  font-size: 12px;
}

/* ── States ── */
.empty {
  text-align: center;
  padding: 40px 0;
  color: var(--muted);
  font-size: 15px;
}

.note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

.errors {
  background: rgba(178, 74, 43, 0.09);
  border: 1px solid rgba(178, 74, 43, 0.25);
  border-radius: 12px;
  padding: 12px;
  color: #612317;
  margin-top: 16px;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 18px 0 28px;
  color: var(--muted);
  font-size: 13px;
}

/* ── Narrow windows (the map popup opens at ~336 px) ── */
@media (max-width: 560px) {
  :root {
    --rail: 38px;
  }

  .headline {
    font-size: 19px;
  }

  .search {
    flex: 1 1 100%;
    font-size: 14px;
    padding: 7px 12px;
  }

  .seg {
    width: 100%;
  }

  .seg button {
    font-size: 14px;
    padding: 7px 6px;
  }

  .summary {
    font-size: 14px;
  }

  .tl__day {
    font-size: 18px;
  }

  .tl__mon {
    font-size: 10px;
  }

  .card {
    margin-left: 2px;
    padding: 12px 12px 10px;
  }

  .card__title {
    font-size: 17px;
  }

  .card__top {
    flex-direction: column;
    gap: 2px;
  }
}

/* Small windows (the map popup): once scrolled, keep only the range switch and
   the summary pinned, so the header does not eat the view. */
@media (max-height: 700px), (max-width: 560px) {
  .site-header.is-compact .header__row:first-child {
    display: none;
  }

  .site-header.is-compact .header__inner {
    padding: 6px 0;
    gap: 4px;
  }

  .site-header.is-compact .summary {
    font-size: 13px;
  }

  .site-header.is-compact .summary strong {
    font-size: 14px;
  }

  /* the sticky month heading already says which month is on screen */
  .site-header.is-compact .summary__now {
    display: none;
  }
}

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

.month {
  scroll-margin-top: var(--header-h);
}
