* {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --page-bg: #f5f7fa;
  --panel-bg: #ffffff;
  --text: #1f2933;
  --muted: #5b6470;
  --line: #dbe2ea;
  --line-soft: #edf0f3;
  --heading-bg: #eaf0f7;
  --table-heading-bg: #dfe7f1;
  --stripe: #edf6ff;
  --link: #1f4f82;
  --link-hover: #12385f;
  --focus: rgba(31, 79, 130, 0.35);
  --shadow: 0 14px 36px rgba(15, 23, 42, 0.08);
}

html {
  background: var(--page-bg);
  scroll-behavior: smooth;
}

body {
  min-width: 280px;
  min-height: 100vh;
  margin: 0;
  padding: clamp(14px, 2.5vw, 32px);
  color: var(--text);
  background: var(--page-bg);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

.page {
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
}

.page-header {
  margin-bottom: clamp(24px, 4vw, 38px);
}

.eyebrow {
  margin: 26px 0 7px;
  color: var(--link);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

h1 {
  max-width: 850px;
  margin: 0 0 10px;
  color: #254b72;
  font-size: clamp(28px, 5vw, 43px);
  line-height: 1.12;
  letter-spacing: -0.025em;
}

.meta {
  max-width: 970px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

code {
  padding: 2px 6px;
  border-radius: 6px;
  background: #e9eef4;
  color: #25364a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.back-link {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 40px;
  padding: 8px 14px;
  color: var(--link);
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 2px 9px rgba(15, 23, 42, 0.05);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, color 160ms ease, transform 160ms ease;
}

.back-link:hover {
  color: var(--link-hover);
  border-color: #aab9c9;
  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.09);
  transform: translateY(-1px);
}

.back-link:focus-visible,
.prayer-link:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.month-block {
  margin: 0 0 clamp(24px, 4vw, 38px);
  overflow: hidden;
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.month-title {
  margin: 0;
  padding: 15px 18px;
  color: #243f5b;
  background: var(--heading-bg);
  border-bottom: 1px solid var(--line);
  font-size: 21px;
  line-height: 1.3;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.table-scroll:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: -3px;
}

table {
  width: 100%;
  min-width: 1140px;
  border-collapse: collapse;
  table-layout: fixed;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 11px 12px;
  color: #172231;
  background: var(--table-heading-bg);
  border-bottom: 1px solid #c6d2df;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.045em;
  text-align: left;
  text-transform: uppercase;
}

tbody tr:nth-child(even) {
  background: var(--stripe);
}

tbody tr {
  transition: background-color 140ms ease;
}

tbody tr:hover {
  background: #e3f0fb;
}

tbody td {
  padding: 11px 12px;
  vertical-align: top;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.col-date {
  width: 128px;
  white-space: nowrap;
}

td.col-date {
  font-weight: 700;
}

.col-saint {
  width: 248px;
}

td.col-saint {
  color: #263d55;
  font-weight: 700;
  line-height: 1.35;
}

.col-type {
  width: 168px;
}

.col-tags {
  width: 78px;
}

.col-prayers {
  width: 282px;
}

.col-bio {
  width: auto;
  text-align: left;
}

.cell-lines > div {
  margin-bottom: 5px;
}

.cell-lines > div:last-child {
  margin-bottom: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 30px;
  padding: 4px 9px;
  color: #2c4056;
  background: #eef2f7;
  border: 1px solid #bdcad8;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.25;
  text-align: center;
}

.prayer-link {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  max-width: 100%;
  padding: 4px 9px;
  color: var(--link);
  background: #f5f8fb;
  border: 1px solid #cbd8e4;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
  text-decoration: none;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.prayer-link:hover {
  color: var(--link-hover);
  background: #eaf2f8;
  border-color: #9eb4c8;
}

.empty {
  color: #8994a2;
  font-style: italic;
}

.footer {
  max-width: 980px;
  margin: 4px 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.back-link-footer {
  margin-bottom: 12px;
}

@media (max-width: 760px) {
  body {
    padding: 12px;
  }

  .eyebrow {
    margin-top: 22px;
  }

  .month-block {
    margin-bottom: 24px;
    border-radius: 13px;
  }

  .month-title {
    padding: 13px 14px;
    font-size: 19px;
  }

  .table-scroll {
    overflow: visible;
  }

  table,
  tbody {
    display: block;
    min-width: 0;
  }

  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  tbody {
    padding: 12px;
  }

  tbody tr,
  tbody tr:nth-child(even),
  tbody tr:hover {
    display: block;
    margin-bottom: 12px;
    overflow: hidden;
    background: var(--panel-bg);
    border: 1px solid var(--line);
    border-radius: 11px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  }

  tbody tr:last-child {
    margin-bottom: 0;
  }

  tbody td {
    display: grid;
    grid-template-columns: 105px minmax(0, 1fr);
    gap: 10px;
    width: auto;
    padding: 9px 11px;
    border-bottom: 1px solid var(--line-soft);
    font-size: 13px;
    white-space: normal;
  }

  tbody td::before {
    color: var(--muted);
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 0.055em;
    text-transform: uppercase;
  }

  tbody td:nth-child(1)::before { content: "Datum"; }
  tbody td:nth-child(2)::before { content: "Svetac / blagdan"; }
  tbody td:nth-child(3)::before { content: "Vrsta"; }
  tbody td:nth-child(4)::before { content: "Oznake"; }
  tbody td:nth-child(5)::before { content: "Molitve"; }
  tbody td:nth-child(6)::before { content: "Opis / životopis"; }

  .prayer-link {
    min-height: 34px;
  }

  .badge {
    min-height: 34px;
  }
}

@media (max-width: 420px) {
  tbody {
    padding: 9px;
  }

  tbody td {
    grid-template-columns: 88px minmax(0, 1fr);
    padding: 9px;
  }
}

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

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  html,
  body {
    background: #ffffff;
  }

  body {
    padding: 0;
  }

  .back-link,
  .eyebrow {
    display: none;
  }

  .month-block {
    break-inside: avoid;
    box-shadow: none;
  }

  .table-scroll {
    overflow: visible;
  }

  table {
    min-width: 0;
    font-size: 10px;
  }

  thead th,
  tbody td {
    padding: 5px 6px;
    font-size: 9px;
  }
}
