:root {
  --bg: #f7f3ec;
  --surface: #fffdf9;
  --surface-2: #f1eadf;
  --text: #2f2a24;
  --muted: #6f6558;
  --primary: #8f6b3d;
  --primary-dark: #6d502c;
  --accent: #d4b483;
  --border: rgba(111, 101, 88, 0.18);
  --shadow: 0 18px 40px rgba(41, 31, 20, 0.12);
  --radius: 24px;
  --radius-sm: 16px;
  --max: 1200px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: auto;
  font-size: clamp(0.9rem, 0.85em, 1rem);
}

body {
  margin: 0;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(212, 180, 131, 0.25), transparent 30%),
    linear-gradient(180deg, #f8f5ef 0%, #f5efe5 45%, #f7f3ec 100%);
  line-height: 1.65;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: min(calc(100% - 2rem), var(--max));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 120;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  background: rgba(255, 253, 249, 0.92);
  border-bottom: 1px solid var(--border);
  will-change: transform;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.brand-mark {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: none;
  flex-shrink: 0;
  background: transparent;
  border: 0;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand h1 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
  font-weight: 800;
}

.brand p {
  margin: 0.1rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--primary);
  font-size: 1.8rem;
  padding: 0;
  transition: color 0.25s ease;
}

.menu-toggle:hover,
.menu-toggle:focus-visible {
  color: var(--primary-dark);
  outline: 2px solid rgba(159, 125, 83, 0.4);
  outline-offset: 2px;
  border-radius: 8px;
}

.menu {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.menu a {
  padding: 0.7rem 1rem;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  transition: 0.25s ease;
}

.menu a:hover,
.menu a:focus-visible {
  background: var(--surface-2);
  color: var(--primary-dark);
  outline: none;
}

.hero {
  padding: 1.2rem 0 3rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 760px) {
  .hero-grid {
    align-items: center;
  }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(143, 107, 61, 0.09);
  color: var(--primary-dark);
  border: 1px solid rgba(143, 107, 61, 0.15);
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 1.1rem;
}

.hero h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.03rem, 3.06vw, 1.99rem);
  line-height: 1.05;
  margin: 0 0 1rem;
  letter-spacing: -0.02em;
}

.hero p {
  font-size: 1.07rem;
  max-width: 60ch;
  margin: 0 0 1.5rem;
}

.hero-churches {
  max-width: 60ch;
  margin: 0 0 1.25rem;
}

.hero-churches strong {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--primary-dark);
  font-size: 0.98rem;
}

.hero-churches ul {
  margin: 0;
  padding-left: 1.05rem;
}

.hero-churches li {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.hero-actions {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin-top: 1.4rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.95rem 1.3rem;
  border-radius: 999px;
  font-weight: 700;
  border: 1px solid transparent;
  transition: 0.25s ease;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #ffffff;
  box-shadow: var(--shadow);
}

.btn-primary:hover {
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.7);
  border-color: var(--border);
  color: var(--text);
}

.hero-card {
  position: relative;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 32px;
  overflow: hidden;
  box-shadow: var(--shadow);
  height: 600px;
}

.hero-gallery-trigger {
  position: relative;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.hero-card img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 100%;
  object-fit: cover;
  object-position: center;
  -webkit-transition: opacity 0.25s ease, -webkit-transform 0.35s ease, transform 0.35s ease;
  transition: opacity 0.25s ease, transform 0.35s ease;
  will-change: transform, opacity;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.hero-gallery-overlay {
  position: absolute;
  left: 50%;
  bottom: 1.1rem;
  -webkit-transform: translate(-50%, 12px);
  transform: translate(-50%, 12px);
  background: rgba(32, 23, 13, 0.76);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  -webkit-transition: opacity 0.25s ease, -webkit-transform 0.25s ease, transform 0.25s ease;
  transition: opacity 0.25s ease, transform 0.25s ease;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.hero-gallery-trigger:hover img,
.hero-gallery-trigger:focus-visible img {
  opacity: 0.76;
  transform: scale(1.02);
}

.hero-gallery-trigger:hover .hero-gallery-overlay,
.hero-gallery-trigger:focus-visible .hero-gallery-overlay {
  opacity: 1;
  transform: translate(-50%, 0);
}

.hero-gallery-trigger:focus-visible {
  outline: 2px solid rgba(159, 125, 83, 0.85);
  outline-offset: -2px;
}

section {
  padding: 1.2rem 0 4.5rem;
  scroll-margin-top: 90px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.section-head > div {
  flex: 1 1 100%;
}

.section-head h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.4rem, 2.7vw, 2rem);
  line-height: 1.15;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.9rem;
}

.form-row label {
  font-weight: 600;
}

.form-row input {
  border: 1px solid rgba(111, 101, 88, 0.25);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  font-size: 1rem;
  width: 100%;
}

.btn-sm {
  font-size: 0.78rem;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
}

.admin-tabs .tab-btn.active,
.tab-btn.active {
  background: var(--primary-dark);
  color: #fff;
}

.tab-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 0.5rem 1rem;
  cursor: pointer;
}

.tab-panel {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  padding: 1rem;
}

.section-head p {
  margin: 0.45rem 0 0;
  color: var(--muted);
  max-width: none;
  width: 100%;
}

.grid-3,
.grid-2 {
  display: grid;
  gap: 1.25rem;
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.card {
  background: rgba(255, 253, 249, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: 0 10px 30px rgba(44, 31, 17, 0.06);
}

.card h4 {
  margin: 0 0 0.7rem;
  font-size: 1.1rem;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.95rem;
}

.schedule-card ul,
.contact-list,
.archive-list,
.sacrament-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.schedule-card li,
.contact-list li,
.archive-list li,
.sacrament-list li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 1rem;
  line-height: 1.35;
}

.schedule-card li:last-child,
.contact-list li:last-child,
.archive-list li:last-child,
.sacrament-list li:last-child {
  border-bottom: 0;
}

.contact-list a {
  transition: 0.25s ease;
}

.contact-list a:hover,
.contact-list a:focus-visible {
  color: var(--primary-dark);
  text-decoration: underline;
  outline: none;
}

.split {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.4rem;
  align-items: start;
}

.staff-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.staff-card li {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid rgba(111, 101, 88, 0.14);
  padding: 0.55rem 0;
  font-size: 0.93rem;
  line-height: 1.3;
}

.staff-card li:last-child {
  border-bottom: 0;
}

.staff-card .role {
  font-weight: 600;
  color: var(--text);
}

.staff-card .name {
  color: var(--muted);
  margin-left: 0.8rem;
  white-space: nowrap;
}

.history {
  columns: 1;
}

.history p {
  margin-top: 0;
  color: var(--muted);
}

.history-gallery {
  width: 100%;
  max-width: 100%;
  display: grid;
  gap: 1rem;
  margin-top: 1.1rem;
}

.history-gallery > aside {
  width: 100%;
  padding: 0.8rem 0.5rem;
  background: transparent;
}

.history-gallery > aside .history-image {
  margin-top: 0.4rem;
  margin-bottom: 0.4rem;
}

.history-gallery-trigger {
  position: relative;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 18px;
  overflow: hidden;
}

.history-image {
  display: block;
  border-radius: 18px;
  width: calc(100% - 1rem);
  max-width: calc(100% - 1rem);
  height: auto;
  max-height: 42rem;
  margin: 0 auto;
  -webkit-transition: opacity 0.25s ease, -webkit-transform 0.35s ease, transform 0.35s ease;
  transition: opacity 0.25s ease, transform 0.35s ease;
  will-change: transform, opacity;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.history-image-full {
  width: 100%;
  height: auto;
  object-fit: contain;
  background: #ffffff;
}

.history-gallery-overlay {
  position: absolute;
  left: 50%;
  bottom: 1.1rem;
  -webkit-transform: translate(-50%, 12px);
  transform: translate(-50%, 12px);
  background: rgba(32, 23, 13, 0.76);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  -webkit-transition: opacity 0.25s ease, -webkit-transform 0.25s ease, transform 0.25s ease;
  transition: opacity 0.25s ease, transform 0.25s ease;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.history-gallery-trigger:hover .history-image,
.history-gallery-trigger:focus-visible .history-image {
  opacity: 0.76;
  transform: scale(1.02);
}

.history-gallery-trigger:hover .history-gallery-overlay,
.history-gallery-trigger:focus-visible .history-gallery-overlay {
  opacity: 1;
  transform: translate(-50%, 0);
}

.history-gallery-trigger:focus-visible {
  outline: 2px solid rgba(159, 125, 83, 0.85);
  outline-offset: -2px;
}

.split,
.split > * {
  align-items: start;
  align-self: start;
}

.history-notes {
  margin-top: 1.25rem;
}

.timeline {
  position: relative;
  margin-top: 1rem;
  padding-left: 1rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 92px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), rgba(143, 107, 61, 0.18));
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 1.25rem;
  padding: 0 0 1.3rem 0;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 86px;
  top: 0.3rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid #fffaf2;
  box-shadow: 0 0 0 1px rgba(143, 107, 61, 0.15);
}

.timeline-year {
  font-weight: 800;
  color: var(--primary-dark);
  font-size: 0.95rem;
  padding-top: 0.05rem;
}

.timeline-content {
  background: #fffaf4;
  border: 1px solid rgba(143, 107, 61, 0.12);
  border-radius: 18px;
  padding: 0.95rem 1rem;
}

.timeline-content h5 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.timeline-content p.detailed {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.5s ease, opacity 0.5s ease;
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.timeline-item:hover .timeline-content p.detailed,
.timeline-item.expanded .timeline-content p.detailed {
  max-height: 1000px;
  opacity: 1;
}

.notice-feature {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: start;
}

#kontakt .notice-feature {
  margin-top: 1.5rem;
}

#oznamy .notice-feature .card {
  width: 100%;
}

.pdf-frame {
  width: 100%;
  min-height: 520px;
  border: 0;
  border-radius: 18px;
  background: #efe7db;
}

.pdf-viewer-wrapper {
  position: relative;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  background: transparent;
}

.pdf-canvas-container {
  width: 100%;
  min-height: 520px;
  padding: 0.65rem;
  background: transparent;
  display: grid;
  gap: 0.65rem;
}

.pdf-page {
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(41, 31, 20, 0.08);
}

.pdf-page-canvas {
  display: block;
  width: 100%;
  height: auto;
}

.pdf-download-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  border: 1px solid rgba(109, 80, 44, 0.26);
  background: rgba(255, 255, 255, 0.86);
  color: rgba(71, 50, 24, 0.88);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.pdf-viewer-wrapper:hover .pdf-download-btn,
.pdf-viewer-wrapper:focus-within .pdf-download-btn {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

@media (min-width: 761px) {
  #oznamy .pdf-viewer-wrapper {
    width: 70%;
    margin-left: auto;
    margin-right: auto;
  }
}

.pdf-download-btn.is-disabled {
  opacity: 0;
  pointer-events: none;
}

.pdf-empty-msg,
.pdf-loading-msg {
  min-height: 520px;
  margin: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 1.5rem;
  color: var(--muted);
  background: var(--surface);
  border-radius: 12px;
}

.upload-box {
  border: 2px dashed rgba(143, 107, 61, 0.25);
  border-radius: 20px;
  padding: 1rem;
  background: #fffaf2;
}

.upload-box input,
.upload-box button {
  width: 100%;
  margin-top: 0.7rem;
}

input[type="file"] {
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
}

button {
  appearance: none;
  border: 0;
}

#userTable {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

#userTable thead {
  background: rgba(143, 107, 61, 0.08);
}

#userTable th {
  padding: 0.9rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--primary-dark);
  border-bottom: 1px solid var(--border);
}

#userTable td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

#userTable tbody tr:hover {
  background: rgba(143, 107, 61, 0.05);
}

#userTable tbody tr:last-child td {
  border-bottom: none;
}

.archive-wrap {
  margin-top: 1.2rem;
}

.board-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.1rem;
  margin-top: 0.9rem;
}

.board-item {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 253, 249, 0.92);
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(44, 31, 17, 0.06);
}

.board-open {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1.4142;
  padding: 0;
  border: 0;
  background: #f8f1e6;
  cursor: pointer;
}

.board-thumb {
  width: 100%;
  height: 100%;
  object-fit: contain;
  -webkit-transition: -webkit-transform 0.25s ease, transform 0.25s ease;
  transition: transform 0.25s ease;
  will-change: transform;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.board-open:hover .board-thumb,
.board-open:focus-visible .board-thumb {
  transform: scale(1.03);
}

.board-empty {
  padding: 1rem;
  border: 1px dashed rgba(143, 107, 61, 0.35);
  border-radius: 14px;
  background: #fffaf2;
  color: var(--muted);
}

.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  z-index: 2147483647 !important;
  background: rgba(16, 10, 4, 0.88);
  display: none;
  align-items: stretch;
  justify-content: center;
  padding: 0;
  overflow: hidden;
}

.lightbox.open {
  display: flex;
}

.lightbox-dialog {
  position: relative;
  width: 100%;
  max-width: 1380px;
  height: 100%;
  max-height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: row;
  gap: 0;
  overflow: hidden;
}

.lightbox-content {
  min-width: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: calc(0.15rem + env(safe-area-inset-top, 0px)) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  box-sizing: border-box;
  overflow: hidden;
}

.lightbox-media-wrap {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem;
  overflow: hidden;
}

.lightbox-media {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  margin: 0 auto;
  display: block;
  object-fit: contain;
  border-radius: 14px;
  background: #fff;
}

.lightbox-thumbs {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: 0.4rem;
  overflow-x: auto;
  overflow-y: hidden;
  height: fit-content;
  max-height: 91px;
  line-height: 0;
  padding-top: 0;
  padding-bottom: calc(0.15rem + env(safe-area-inset-bottom, 0px));
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.lightbox-thumbs::-webkit-scrollbar {
  display: none;
}

.lightbox-thumb {
  border: 2px solid transparent;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
  display: block;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  flex: 0 0 116px !important;
  width: 116px !important;
  max-width: 116px !important;
  height: 91px !important;
  min-height: 91px !important;
  -webkit-transition: border-color 0.2s ease, -webkit-transform 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
  transition: border-color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
  will-change: transform, border-color, opacity;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

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

.lightbox-thumb:hover,
.lightbox-thumb:focus-visible {
  border-color: rgba(255, 255, 255, 0.78);
  transform: translateY(-1px);
}

.lightbox-thumb.active {
  border-color: rgba(236, 202, 154, 0.95);
  box-shadow: 0 0 0 1px rgba(236, 202, 154, 0.45);
}

.lightbox-btn,
.lightbox-close {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.lightbox-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2147483646;
}

.lightbox-btn.prev {
  left: 0.8rem;
}

.lightbox-btn.next {
  right: 0.8rem;
}

.lightbox-btn:hover,
.lightbox-btn:focus-visible,
.lightbox-close:hover,
.lightbox-close:focus-visible {
  background: rgba(255, 255, 255, 0.28);
  outline: 2px solid rgba(255, 255, 255, 0.35);
  outline-offset: 2px;
}

.lightbox-close {
  position: absolute;
  top: calc(0.55rem + env(safe-area-inset-top, 0px));
  right: calc(0.55rem + env(safe-area-inset-right, 0px));
  z-index: 2147483647;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: #1f1408;
  background: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
}

.lightbox-caption {
  position: absolute;
  left: 50%;
  bottom: 0.55rem;
  transform: translateX(-50%);
  margin-top: 0;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(16, 10, 4, 0.58);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.88rem;
  text-align: center;
  white-space: nowrap;
}

.footer {
  padding: 0 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.reveal {
  opacity: 0;
  -webkit-transform: translateY(24px);
  transform: translateY(24px);
  -webkit-transition: opacity 0.6s ease, -webkit-transform 0.6s ease, transform 0.6s ease;
  transition: opacity 0.6s ease, transform 0.6s ease;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-perspective: 1000;
  perspective: 1000;
}

.reveal.visible {
  opacity: 1;
  -webkit-transform: translateY(0);
  transform: translateY(0);
}

@media (max-width: 1080px) {
  .hero-grid,
  .split,
  .notice-feature {
    grid-template-columns: 1fr;
  }

  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .board-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@supports (-webkit-touch-callout: none) {
  html {
    scroll-behavior: auto !important;
  }
  .topbar {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: rgba(255, 253, 249, 0.96) !important;
  }
  .menu {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: rgba(255, 253, 249, 0.96);
  }
}

@media (max-width: 760px) {
  html {
    font-size: 16px;
  }

  .nav {
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.7rem 0;
  }

  .brand {
    gap: 0.5rem;
    flex-shrink: 0;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .brand h1 {
    font-size: 1rem;
    line-height: 1.15;
  }

  .brand p {
    font-size: 0.85rem;
    margin: 0;
  }

  .menu-toggle {
    display: flex;
  }

  .menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    display: none;
    flex-direction: column;
    background: rgba(255, 253, 249, 0.96);
    border-bottom: 1px solid var(--border);
    gap: 0;
    grid-template-columns: 1fr;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    max-height: 0;
    overflow: hidden;
    -webkit-transition: max-height 0.3s ease, opacity 0.3s ease;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    z-index: 110;
    will-change: max-height, opacity;
  }

  .menu.open {
    display: flex;
    max-height: 400px;
    opacity: 1;
  }

  .menu a {
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    color: var(--text);
    transition: background 0.2s ease, color 0.2s ease;
  }

  .menu a:last-child {
    border-bottom: none;
  }

  .menu a:hover {
    background: rgba(143, 107, 61, 0.08);
    color: var(--primary);
  }

  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 1.2rem;
    padding: 1rem 0 1.5rem;
  }

  .hero-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .hero-card {
    order: -1;
    height: auto;
  }

  .hero-card img {
    height: auto;
    width: 100%;
    min-height: unset;
    object-fit: unset;
  }

  .section-head {
    align-items: start;
    flex-direction: column;
  }

  .timeline {
    padding-left: 0;
  }

  .timeline::before {
    left: 18px;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    padding-left: 2.6rem;
  }

  .timeline-item::before {
    left: 12px;
    top: 0.35rem;
  }

  .timeline-year {
    padding-top: 0;
  }

  .board-gallery {
    grid-template-columns: 1fr;
  }

  .lightbox {
    padding: 0;
  }

  .lightbox-dialog {
    gap: 0;
  }

  .lightbox-content {
    width: 100%;
    height: 100%;
    gap: 0.15rem;
    padding: calc(0.15rem + env(safe-area-inset-top, 0px)) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  }

  .lightbox-thumbs {
    gap: 0.35rem;
    max-height: 82px;
    padding-bottom: calc(0.15rem + env(safe-area-inset-bottom, 0px));
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }

  .lightbox-thumb {
    flex-basis: 103px !important;
    width: 103px !important;
    max-width: 103px !important;
    height: 82px !important;
    min-height: 82px !important;
  }

  .lightbox-btn,
  .lightbox-close {
    width: 48px;
    height: 48px;
    min-width: 44px;
    min-height: 44px;
  }

  .lightbox-btn.prev {
    left: calc(0.45rem + env(safe-area-inset-left, 0px));
  }

  .lightbox-btn.next {
    right: calc(0.45rem + env(safe-area-inset-right, 0px));
  }

  .lightbox-close {
    top: calc(0.4rem + env(safe-area-inset-top, 0px));
    right: calc(0.4rem + env(safe-area-inset-right, 0px));
  }

  #oznamy .pdf-download-btn {
    top: 0.525rem;
    right: 0.525rem;
    padding: 0.315rem 0.49rem;
    font-size: 0.63rem;
    border-radius: 6px;
  }

  .hero-gallery-trigger:hover img,
  .hero-gallery-trigger:focus-visible img {
    opacity: 1;
    -webkit-transform: scale(1);
    transform: scale(1);
  }

  .hero-gallery-trigger:hover .hero-gallery-overlay,
  .hero-gallery-trigger:focus-visible .hero-gallery-overlay {
    opacity: 0;
    -webkit-transform: translate(-50%, 12px);
    transform: translate(-50%, 12px);
  }

  .history-gallery-trigger:hover .history-image,
  .history-gallery-trigger:focus-visible .history-image {
    opacity: 1;
    -webkit-transform: scale(1);
    transform: scale(1);
  }

  .history-gallery-trigger:hover .history-gallery-overlay,
  .history-gallery-trigger:focus-visible .history-gallery-overlay {
    opacity: 0;
    -webkit-transform: translate(-50%, 12px);
    transform: translate(-50%, 12px);
  }

  .board-open:hover .board-thumb,
  .board-open:focus-visible .board-thumb {
    -webkit-transform: scale(1);
    transform: scale(1);
  }

  .lightbox-thumb:hover,
  .lightbox-thumb:focus-visible {
    -webkit-transform: translateY(0);
    transform: translateY(0);
  }

  .timeline-item:not(.expanded):hover .timeline-content p.detailed {
    max-height: 0;
    opacity: 0;
  }

  .timeline-item.expanded .timeline-content p.detailed {
    max-height: 1000px;
    opacity: 1;
  }
}