/* =========================================================
   "Do Hymnu!" — brand stylesheet
   Palette: flag red, white, dark navy (spec section 12).
   Fonts: system stacks only (no webfonts — GDPR/local hosting).
   ========================================================= */

:root {
  --red: #D4213D;
  --red-deep: #A8172E;
  --navy: #10243E;
  --ink: #1A2433;
  --muted: #5A6472;
  --paper: #FFFFFF;
  --mist: #F5F6F8;
  --line: #E3E6EA;
  /* Boundary colour for interactive controls: 3.88:1 on white (WCAG 1.4.11
     requires 3:1 for UI component boundaries; --line is only 1.25:1). */
  --line-strong: #7A828E;
  --serif: Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html {
  scroll-behavior: smooth;
}

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

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

h1, h2, h3, .brand-title {
  font-family: var(--serif);
  color: var(--navy);
}

a {
  color: var(--red-deep);
}

a:hover {
  color: var(--navy);
}

/* Visible keyboard focus everywhere (WCAG 2.4.7) */
:focus-visible {
  outline: 3px solid var(--navy);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  z-index: 2000;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--navy);
  color: #fff;
}

/* --- Flag motif: the two-stripe mark used before section headings --- */
.flag-mark {
  display: inline-block;
  width: 1.5rem;
  height: 1rem;
  margin-right: 0.6rem;
  vertical-align: baseline;
  background: linear-gradient(to bottom, #fff 50%, var(--red) 50%);
  border: 1px solid var(--line);
  border-radius: 1px;
}

/* --- Header --- */
.site-header {
  border-top: 4px solid var(--red);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.brand-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.1;
  display: block;
}

.brand-date {
  display: block;
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red-deep);
}

.site-header .nav-link {
  color: var(--navy);
  font-weight: 500;
}

.site-header .nav-link:hover,
.site-header .nav-link:focus {
  color: var(--red-deep);
}

.site-header .nav-link.active {
  border-bottom: 3px solid var(--red);
}

/* --- Buttons --- */
.btn-brand {
  background: var(--red);
  border: 1px solid var(--red);
  color: #fff;
  font-weight: 600;
}

.btn-brand:hover,
.btn-brand:focus {
  background: var(--red-deep);
  border-color: var(--red-deep);
  color: #fff;
}

.btn-outline-brand {
  border: 2px solid var(--navy);
  color: var(--navy);
  font-weight: 600;
  background: transparent;
}

.btn-outline-brand:hover,
.btn-outline-brand:focus {
  background: var(--navy);
  color: #fff;
}

/* --- Sections --- */
.section-mist {
  background: var(--mist);
}

.section-heading {
  margin-bottom: 1.5rem;
}

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

/* --- Footer --- */
.site-footer {
  background: var(--navy);
  color: #fff;
}

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

.site-footer a:hover,
.site-footer a:focus {
  color: #F3B7C1;
}

.site-footer .footer-logo {
  display: inline-block;
}

.site-footer .footer-logo img {
  width: 100%;
  max-width: 220px;
  height: auto;
}

.site-footer .footer-logo:hover img,
.site-footer .footer-logo:focus-visible img {
  opacity: 0.85;
}

/* The global focus ring is navy — invisible on the navy footer. */
.site-footer :focus-visible {
  outline-color: #fff;
}

.site-footer .footer-note {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
}

/* --- Legal documents (regulamin) ---
   The numbering is part of the text: cross-references such as
   "§ 2 ust. 5 pkt a)" only resolve if the markers read 1. and a). Where
   ::marker content is unsupported the list degrades to a. / 1., never to
   an unnumbered bullet. */
.legal-doc ol {
  padding-left: 1.9rem;
}

.legal-doc li {
  margin-bottom: 0.5rem;
}

.legal-doc ol ol {
  margin-top: 0.5rem;
}

.legal-doc ol.legal-points {
  list-style-type: lower-alpha;
}

.legal-doc ol.legal-points > li::marker {
  content: counter(list-item, lower-alpha) ") ";
}

.legal-doc ol.legal-points-num > li::marker {
  content: counter(list-item, decimal) ") ";
}

/* --- Forms --- */
.required-mark {
  color: var(--red-deep);
  font-weight: 700;
}

.form-label {
  font-weight: 600;
  color: var(--navy);
}

/* Honeypot wrapper: visually removed but still fillable by naive bots.
   Not display:none on purpose. */
.hp-field {
  position: absolute !important;
  left: -9999px !important;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* --- Map --- */
#map {
  height: 540px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.form-map {
  height: 380px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

/* Brand map pin (L.divIcon with inline SVG) */
.brand-pin svg {
  display: block;
  filter: drop-shadow(0 1px 2px rgba(16, 36, 62, 0.4));
}

/* Marker cluster recolor to brand red.
   MarkerCluster.Default.css is loaded from {% block extra_css %}, i.e. *after*
   this file, so an unprefixed selector loses at equal specificity and the
   vendor's green/yellow/orange discs win. White bold numerals on those are
   1.46-1.93:1; on brand red they are 5.14:1. The .leaflet-container prefix
   raises specificity so the brand colour actually applies (WCAG 1.4.3). */
.leaflet-container .marker-cluster-small,
.leaflet-container .marker-cluster-medium,
.leaflet-container .marker-cluster-large {
  background-color: rgba(212, 33, 61, 0.25);
}

.leaflet-container .marker-cluster-small div,
.leaflet-container .marker-cluster-medium div,
.leaflet-container .marker-cluster-large div {
  background-color: var(--red);
  color: #fff;
  font-weight: 700;
}

/* --- Cards / lists --- */
.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.15rem;
}

.event-card {
  border: 1px solid var(--line);
  border-left: 4px solid var(--red);
  border-radius: 4px;
}

/* --- CTA band --- */
.cta-band {
  background: var(--red);
  color: #fff;
}

.cta-band h2 {
  color: #fff;
}

.cta-band .btn {
  background: #fff;
  color: var(--red-deep);
  font-weight: 700;
  border: none;
}

.cta-band .btn:hover,
.cta-band .btn:focus {
  background: var(--navy);
  color: #fff;
}

/* =========================================================
   Accessibility: reassert the focus ring over Bootstrap
   ---------------------------------------------------------
   The bare `:focus-visible` rule near the top of this file has specificity
   (0,1,0). Bootstrap declares `outline: 0` on its own components at (0,2,0)
   — `.btn:focus-visible`, `.form-control:focus`, `.form-select:focus`,
   `.form-check-input:focus`, `.nav-link:focus-visible`, `.page-link:focus` —
   so it wins and the navy ring never renders on any of them.

   Its replacement glow is `rgba(var(--bs-btn-focus-shadow-rgb), .5)`, and
   --bs-btn-focus-shadow-rgb is defined only inside Bootstrap's own .btn-*
   variants, never at :root. Our .btn-brand / .btn-outline-brand / .cta-band
   .btn do not define it, so that declaration is invalid at computed-value
   time and box-shadow resolves to `none` — leaving those buttons with no
   focus indicator at all.

   These selectors match Bootstrap's specificity and come later in the
   cascade, so the ring wins. Nothing renders until a control is focused.
   (WCAG 2.4.7 Focus Visible, 1.4.11 Non-text Contrast.)
   ========================================================= */
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible,
.nav-link:focus-visible,
.page-link:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--navy);
  outline-offset: 2px;
  box-shadow: none;
}

/* Bootstrap also tints the border blue on focus; keep the focused control on
   brand so the ring is not competing with a stray accent colour. */
.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible {
  border-color: var(--navy);
}

/* Control boundaries: Bootstrap's default #dee2e6 is 1.30:1 on white and the
   navbar toggler's rgba(0,0,0,.15) is 1.41:1 — both below the 3:1 that WCAG
   1.4.11 requires for the boundary of a user interface component. */
.form-control,
.form-select,
.form-check-input {
  border-color: var(--line-strong);
}

.navbar-toggler {
  --bs-navbar-toggler-border-color: var(--line-strong);
}

/* In-page skip link placed before the map. Leaflet injects one tab stop per
   marker, so keyboard users need a way past them to the event list
   (WCAG 2.4.1). Bootstrap's .visually-hidden-focusable reveals it on focus;
   this gives it the same look as the main skip link, but in normal flow. */
.skip-link-inline:focus,
.skip-link-inline:focus-visible {
  display: inline-block;
  margin-bottom: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--navy);
  color: #fff;
}
