/*
 * zsamsludkovice.cz theme. Colours come from the municipal coat of arms (logo_ludkovice.svg);
 * text colours keep WCAG 2.1 AA contrast (>= 4.5:1) on their backgrounds.
 */

:root {
  --blue: #06448e;
  --blue-dark: #04336b;
  --blue-tint: #e8eef7;
  --yellow: #f4f141;
  --yellow-tint: #fdfbd8;
  --red: #b3222a;
  --ink: #1d2733;
  --ink-soft: #4a5563;
  --line: #dde3ea;
  --surface: #ffffff;
  --page: #f7f8fa;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 2px 8px rgb(16 24 40 / 6%);
  --shadow-hover: 0 4px 16px rgb(16 24 40 / 12%);
  --container: 72rem;
  --prose: 46rem;
  --gutter: clamp(1rem, 4vw, 2rem);
  --font: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 4.5rem;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--blue);
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--blue-dark);
}

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--blue);
  color: #fff;
  border-radius: var(--radius);
}

.skip-link:focus {
  top: 1rem;
}

.container {
  width: min(100% - 2 * var(--gutter), var(--container));
  margin-inline: auto;
}

/* ---------- Photo strip ---------- */

.photo-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 80%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  background: var(--blue-dark);
}

.photo-strip::-webkit-scrollbar {
  display: none;
}

.photo-strip__item {
  position: relative;
  margin: 0;
  scroll-snap-align: start;
  height: clamp(13rem, 24vw, 22rem);
  overflow: hidden;
}

.photo-strip__item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-strip__item a {
  display: block;
  height: 100%;
  color: #fff;
  text-decoration: none;
}

.photo-strip__item figcaption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 2rem 1rem 0.75rem;
  background: linear-gradient(transparent, rgb(0 0 0 / 70%));
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
}

.photo-strip__item a:hover img {
  transform: scale(1.03);
}

.photo-strip__item img {
  transition: transform 0.4s ease;
}

@media (min-width: 40em) {
  .photo-strip {
    grid-auto-columns: 50%;
  }
}

@media (min-width: 64em) {
  .photo-strip {
    grid-auto-columns: 25%;
    overflow: hidden;
  }
}

/* ---------- Menu bar ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--yellow);
  box-shadow: 0 1px 0 rgb(0 0 0 / 8%), 0 4px 12px rgb(0 0 0 / 6%);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 1rem;
  width: min(100% - 2 * var(--gutter), var(--container));
  min-height: 3.75rem;
  margin-inline: auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-right: auto;
  padding: 0.4rem 0;
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
}

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

.nav__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.nav__toggle-icon,
.nav__toggle-icon::before,
.nav__toggle-icon::after {
  display: block;
  width: 1.1rem;
  height: 2px;
  background: currentColor;
  transition: transform 0.2s ease;
}

.nav__toggle-icon {
  position: relative;
}

.nav__toggle-icon::before,
.nav__toggle-icon::after {
  content: "";
  position: absolute;
  left: 0;
}

.nav__toggle-icon::before {
  top: -6px;
}

.nav__toggle-icon::after {
  top: 6px;
}

.nav__toggle[aria-expanded="true"] .nav__toggle-icon {
  background: transparent;
}

.nav__toggle[aria-expanded="true"] .nav__toggle-icon::before {
  transform: translateY(6px) rotate(45deg);
}

.nav__toggle[aria-expanded="true"] .nav__toggle-icon::after {
  transform: translateY(-6px) rotate(-45deg);
}

.menu,
.submenu {
  margin: 0;
  padding: 0;
  list-style: none;
}

.menu__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

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

.menu__caret {
  width: 0.45rem;
  height: 0.45rem;
  margin-left: 0.5rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.2s ease;
}

.menu__link[aria-expanded="true"] .menu__caret {
  transform: translateY(2px) rotate(-135deg);
}

.submenu {
  display: none;
}

.submenu a {
  display: block;
  color: var(--ink);
  text-decoration: none;
}

.submenu a[aria-current="page"] {
  font-weight: 700;
}

html:not(.js) .submenu,
.submenu.is-open {
  display: block;
}

/* Phone and small tablet: the menu folds out under the bar as a list. */
@media (max-width: 49.99em) {
  .menu {
    display: none;
    flex-basis: 100%;
    padding: 0.25rem 0 0.75rem;
    border-top: 1px solid rgb(0 0 0 / 10%);
  }

  /* Without JavaScript the menu is always open. */
  html:not(.js) .menu,
  .menu.is-open {
    display: block;
  }

  html:not(.js) .nav__toggle {
    display: none;
  }

  .menu__item + .menu__item {
    border-top: 1px solid rgb(0 0 0 / 8%);
  }

  .menu__link {
    padding: 0.8rem 0.25rem 0.8rem 0.75rem;
  }

  .menu__item.is-active > .menu__link {
    box-shadow: inset 4px 0 0 var(--blue);
  }

  .submenu {
    margin: 0 0 0.6rem 0.75rem;
    padding-left: 0.5rem;
    border-left: 2px solid rgb(0 0 0 / 15%);
  }

  .submenu a {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
  }

  .submenu a:hover {
    background: rgb(0 0 0 / 6%);
  }

  .submenu a[aria-current="page"] {
    color: var(--blue-dark);
  }
}

/* Wider screens: one row; submenus hang from the bottom edge of the bar. */
@media (min-width: 50em) {
  .nav {
    flex-wrap: nowrap;
    align-items: stretch;
  }

  .brand {
    align-self: center;
  }

  .nav__toggle {
    display: none;
  }

  .menu {
    display: flex;
    align-items: stretch;
  }

  .menu__item {
    position: relative;
    display: flex;
  }

  .menu__link {
    width: auto;
    padding: 0 0.85rem;
    border-bottom: 4px solid transparent;
    border-top: 4px solid transparent;
  }

  .menu__link:hover,
  .menu__link[aria-expanded="true"] {
    background: rgb(0 0 0 / 6%);
  }

  .menu__item.is-active > .menu__link {
    border-bottom-color: var(--blue);
  }

  .submenu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 100%;
    padding: 0.4rem 0;
    background: var(--surface);
    border-top: 3px solid var(--blue);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 10px 24px rgb(16 24 40 / 16%);
  }

  /* Without JavaScript, hover and keyboard focus open the submenus. */
  html:not(.js) .submenu {
    display: none;
  }

  html:not(.js) .menu__item--parent:hover > .submenu,
  html:not(.js) .menu__item--parent:focus-within > .submenu {
    display: block;
  }

  .submenu a {
    padding: 0.55rem 1.1rem;
    white-space: nowrap;
  }

  .submenu a:hover {
    background: var(--blue-tint);
    color: var(--blue-dark);
  }

  .submenu a[aria-current="page"] {
    color: var(--blue-dark);
    box-shadow: inset 3px 0 0 var(--blue);
  }
}

/* ---------- Content ---------- */

.main {
  padding-block: clamp(2rem, 5vw, 3.5rem);
}

.main:focus {
  outline: none;
}

.prose {
  max-width: var(--prose);
}

/* Inside a full-width container the text column stays left-aligned with the sections below. */
.container.prose {
  max-width: var(--container);
}

.container.prose > * {
  max-width: var(--prose);
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  color: var(--blue);
  line-height: 1.25;
  font-weight: 700;
  margin: 1.8em 0 0.6em;
}

.prose h1 {
  margin-top: 0;
  font-size: clamp(1.75rem, 4vw, 2.4rem);
}

.prose h2 {
  font-size: clamp(1.4rem, 3vw, 1.8rem);
}

.prose h3 {
  font-size: 1.25rem;
}

.prose h4 {
  font-size: 1.1rem;
}

.prose > :first-child {
  margin-top: 0;
}

.prose p,
.prose ul,
.prose ol,
.prose table {
  margin: 0 0 1.1em;
}

.prose li + li {
  margin-top: 0.3em;
}

.prose img {
  border-radius: var(--radius);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
}

.prose th,
.prose td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: var(--blue-tint);
}

.prose a[href$=".pdf"] {
  font-weight: 600;
}

.prose a[href$=".pdf"]::before {
  content: "PDF";
  display: inline-block;
  margin-right: 0.4em;
  padding: 0.05em 0.4em;
  border-radius: 4px;
  background: var(--red);
  color: #fff;
  font-size: 0.7em;
  font-weight: 700;
  vertical-align: 0.15em;
  letter-spacing: 0.03em;
}

.meta {
  margin: 0 0 1.25rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.meta a {
  color: inherit;
}

.prose .meta + * {
  margin-top: 0;
}

.intro {
  margin-bottom: 2.5rem;
}

.intro h4 {
  color: var(--ink-soft);
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  font-weight: 400;
  line-height: 1.55;
}

.intro h2:first-child {
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  letter-spacing: 0.01em;
}

/* ---------- Cards ---------- */

.card-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
}

.card-grid--two {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover,
.card:focus-within {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.card__media {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  background: var(--yellow-tint);
}

.card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card__media .card__logo {
  width: 4rem;
  height: auto;
  opacity: 0.85;
}

.card__body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.9rem 1rem 1.1rem;
}

.card__title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.35;
}

.card__title a {
  color: var(--ink);
  text-decoration: none;
}

/* The title link covers the whole card, so the card has a single link. */
.card__title a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.card:hover .card__title a {
  color: var(--blue);
  text-decoration: underline;
}

.card__date {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.badge {
  align-self: flex-start;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* ---------- Homepage ---------- */

.home-sections {
  display: grid;
  gap: 2.5rem;
}

@media (min-width: 56em) {
  .home-sections {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem 3rem;
  }
}

.home-section {
  margin-bottom: 2.5rem;
}

.home-section h2 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1rem;
  color: var(--blue);
  font-size: 1.4rem;
}

.home-section h2::before {
  content: "";
  width: 0.4rem;
  height: 1.4rem;
  border-radius: 2px;
  background: var(--yellow);
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 10%);
}

.more {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 1rem 0 0;
  font-weight: 600;
}

.more a::after {
  content: " →";
}

/* ---------- Link tiles ---------- */

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

.link-tiles a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 100%;
  padding: 1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--yellow);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.link-tiles a::after {
  content: "→";
  color: var(--blue);
}

.link-tiles a:hover {
  border-left-color: var(--blue);
  color: var(--blue);
}

/* ---------- News list ---------- */

.news-list {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.news-item {
  position: relative;
  display: grid;
  grid-template-columns: 4.5rem 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.news-item:hover,
.news-item:focus-within {
  box-shadow: var(--shadow-hover);
}

.news-item__date {
  display: grid;
  place-items: center;
  padding: 0.4rem 0;
  border-radius: 8px;
  background: var(--yellow-tint);
  line-height: 1.2;
}

.news-item__day {
  font-weight: 700;
}

.news-item__year {
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.news-item__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
}

.news-item__title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.35;
}

.news-item__title a {
  color: var(--ink);
  text-decoration: none;
}

.news-item__title a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.news-item:hover .news-item__title a {
  color: var(--blue);
  text-decoration: underline;
}

.news-item__thumb {
  width: 5rem;
  height: 3.75rem;
  object-fit: cover;
  border-radius: 6px;
}

@media (max-width: 30em) {
  .news-item {
    grid-template-columns: 4rem 1fr;
  }

  .news-item__thumb {
    display: none;
  }
}

/* ---------- Gallery ---------- */

.gallery {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(auto-fill, minmax(min(45%, 10rem), 1fr));
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

.gallery a {
  display: block;
  overflow: hidden;
  border-radius: 8px;
  background: var(--line);
}

.gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.gallery a:hover img {
  transform: scale(1.04);
  opacity: 0.92;
}

.lightbox {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgb(10 14 20 / 96%);
  color: #fff;
}

.lightbox::backdrop {
  background: rgb(10 14 20 / 96%);
}

.lightbox__figure {
  display: grid;
  place-items: center;
  height: 100%;
  margin: 0;
  padding: 3.5rem 0.5rem 3rem;
}

.lightbox__img {
  max-width: 100%;
  max-height: calc(100dvh - 6.5rem);
  object-fit: contain;
  border-radius: 4px;
  touch-action: pan-y;
  user-select: none;
}

.lightbox__caption {
  position: absolute;
  inset: auto 0 0.9rem;
  text-align: center;
  font-size: 0.9rem;
  color: rgb(255 255 255 / 85%);
}

.lightbox__btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 12%);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox__btn:hover {
  background: rgb(255 255 255 / 24%);
}

.lightbox__btn:focus-visible {
  outline-color: var(--yellow);
}

.lightbox__close {
  top: 0.5rem;
  right: 0.5rem;
}

.lightbox__prev,
.lightbox__next {
  top: 50%;
  transform: translateY(-50%);
}

.lightbox__prev {
  left: 0.5rem;
}

.lightbox__next {
  right: 0.5rem;
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 2rem;
  background: var(--blue);
  color: #fff;
  border-top: 6px solid var(--yellow);
}

.site-footer a {
  color: #fff;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.site-footer :focus-visible {
  outline-color: var(--yellow);
}

.site-footer__inner {
  display: grid;
  gap: 2rem;
  width: min(100% - 2 * var(--gutter), var(--container));
  margin-inline: auto;
  padding-block: 2.5rem;
}

@media (min-width: 56em) {
  .site-footer__inner {
    grid-template-columns: 18rem 1fr;
  }
}

.site-footer__brand {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.site-footer__brand p {
  margin: 0;
  line-height: 1.45;
}

.site-footer__nav {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
}

.site-footer__group h2 {
  margin: 0 0 0.5rem;
  color: var(--yellow);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-footer__group ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer__group li + li {
  margin-top: 0.3rem;
}

.site-footer__bottom {
  padding: 1rem var(--gutter);
  background: var(--blue-dark);
  font-size: 0.9rem;
  text-align: center;
}

.site-footer__bottom p {
  margin: 0;
}

.site-footer__bottom a {
  text-decoration: underline;
}

/* ---------- Plugin output (markdown-notices) ---------- */

.notices {
  margin: 0 0 1.1em;
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  border-left: 4px solid var(--blue);
  background: var(--blue-tint);
}

.notices.red {
  border-left-color: var(--red);
  background: #fbeaea;
}

.notices.yellow {
  border-left-color: #b59a00;
  background: var(--yellow-tint);
}

.notices p:last-child {
  margin-bottom: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .photo-strip,
  .site-header,
  .site-footer__nav,
  .skip-link {
    display: none;
  }

  body {
    background: #fff;
  }
}
