/*
 * Veřejný web obce – styly (moderní vzhled: světlé pozadí, bílé karty, dlaždicové menu).
 * Barvy --primary a --accent se načítají z /theme.css (Nastavení → Vzhled),
 * úvodní fotografie se nahrává v Nastavení → Vzhled → Úvodní fotografie.
 * Pravidla přístupnosti: kontrast min. 4,5:1, viditelný focus, nic nespoléhá jen na barvu,
 * velikosti v rem (zvětšení textu v prohlížeči), responzivní do 320 px.
 */
@font-face { font-family: "Inter"; src: url("../fonts/inter-regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-semibold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
    --primary: #1d4f91;
    --primary-dark: #163b6d;
    --accent: #b3261e;
    --text: #1d2327;
    --muted: #555f66;
    --bg: #f3f4f2;
    --surface: #ffffff;
    --bg-soft: #f0f3f1;
    --border: #d5dad7;
    --focus: #ffbf47;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(16, 24, 20, 0.06), 0 4px 16px rgba(16, 24, 20, 0.06);
    --shadow-lg: 0 6px 24px rgba(16, 24, 20, 0.14);
    --max: 76rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
body {
    margin: 0; color: var(--text); background: var(--bg);
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 1.0625rem; line-height: 1.6;
}
img { max-width: 100%; height: auto; }
a { color: var(--primary-dark); text-underline-offset: 0.15em; }
a:hover { color: var(--primary); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 5px var(--text); border-radius: 2px; }
h1, h2, h3 { line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 2rem; margin: 0.25rem 0 1rem; }
h2 { font-size: 1.45rem; margin: 1.75rem 0 0.75rem; }
h3 { font-size: 1.15rem; margin: 1.25rem 0 0.5rem; }

.icon { width: 1.25em; height: 1.25em; flex-shrink: 0; vertical-align: -0.2em; }
.container { max-width: var(--max); margin: 0 auto; padding: 0 1rem; }
.visually-hidden, .visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: -999px; top: 0; background: #fff; color: #000; padding: 0.75rem 1rem; z-index: 100; font-weight: 700; }
.skip-link:focus { left: 1rem; top: 1rem; }

.btn, .filter-form button {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.55rem 1.1rem; border: 2px solid var(--primary-dark); border-radius: 999px;
    background: var(--surface); color: var(--primary-dark); font: inherit; font-weight: 600; font-size: 1rem;
    text-decoration: none; cursor: pointer; line-height: 1.3;
}
.btn:hover { background: var(--bg-soft); color: var(--primary-dark); }
.btn-primary, .filter-form button { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover, .filter-form button:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }

/* Hlavička */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: relative; z-index: 3; }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; padding-top: 0.75rem; padding-bottom: 0.75rem; }
.brand { display: flex; align-items: center; gap: 0.75rem; color: var(--text); text-decoration: none; margin-right: auto; }
.brand:hover { color: var(--text); }
.brand-arms { width: 48px; height: 48px; object-fit: contain; }
.brand-name { display: block; font-size: 1.45rem; font-weight: 700; line-height: 1.2; color: var(--primary-dark); }
.brand-slogan { display: block; font-size: 0.9rem; color: var(--muted); }
.search-form { position: relative; display: flex; align-items: center; }
.search-form .search-icon { position: absolute; left: 0.85rem; color: var(--muted); pointer-events: none; }
.search-form input {
    font: inherit; font-size: 1rem; padding: 0.55rem 1rem 0.55rem 2.6rem; min-width: 16rem;
    border: 1px solid #8a948f; border-radius: 999px; background: var(--bg-soft); color: var(--text);
}
.search-form input::placeholder { color: var(--muted); opacity: 1; }
.search-form button { margin-left: 0.25rem; }

/* Úvodní fotografie (bez fotky barevný přechod) */
.hero { position: relative; height: 15rem; background: linear-gradient(120deg, var(--primary-dark), var(--primary) 60%, var(--accent)); overflow: hidden; }
.is-sub .hero { height: 7rem; }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero.has-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 55%, rgba(0,0,0,0.25)); }

/* Dlaždicové hlavní menu – přesahuje přes úvodní fotografii */
.main-nav { position: relative; z-index: 2; margin-top: -3.25rem; }
.tiles-nav { list-style: none; margin: 0; padding: 0.5rem; display: flex; flex-wrap: wrap; gap: 0.25rem;
    background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.tiles-nav li { flex: 1 1 6.5rem; }
.tiles-nav a {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 0.4rem; height: 100%;
    padding: 0.85rem 0.5rem; border-radius: var(--radius-sm); text-align: center; text-decoration: none;
    color: var(--text); font-weight: 600; font-size: 0.95rem; line-height: 1.25;
}
.tile-icon { display: inline-flex; align-items: center; justify-content: center; width: 2.75rem; height: 2.75rem; border-radius: 50%; background: var(--bg-soft); color: var(--primary-dark); }
.tile-icon .icon { width: 1.5rem; height: 1.5rem; }
.tiles-nav a:hover { background: var(--bg-soft); color: var(--primary-dark); }
.tiles-nav a:hover .tile-label { text-decoration: underline; }
.tiles-nav a[aria-current="page"] { background: var(--primary); color: #fff; }
.tiles-nav a[aria-current="page"] .tile-icon { background: rgba(255,255,255,0.18); color: #fff; }
.nav-toggle { display: none; }

/* Rozvržení: obsah + boční panel */
.page-grid { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 2rem; align-items: start; padding-top: 2rem; padding-bottom: 3rem; }
.main { min-height: 50vh; min-width: 0; }
.main:focus { outline: none; }
.is-sub .main { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem 2rem 2rem; }
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem 1.5rem; }
.breadcrumbs ol { list-style: none; padding: 0; margin: 0 0 0.75rem; display: flex; flex-wrap: wrap; font-size: 0.9rem; color: var(--muted); }
.breadcrumbs li + li::before { content: "›"; margin: 0 0.5rem; }
.breadcrumbs a { color: var(--muted); }

.sidebar { display: grid; gap: 1.25rem; }
.side-box { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem 1.25rem 1rem; margin: 0; }
.side-box h2 { font-size: 1.15rem; margin: 0 0 0.75rem; }
.side-box h2 a { color: var(--text); text-decoration: none; }
.side-box h2 a:hover { color: var(--primary-dark); text-decoration: underline; }
.office { border-top: 4px solid var(--primary); }
.side-row { display: flex; gap: 0.6rem; align-items: flex-start; margin: 0 0 0.5rem; }
.side-row .icon { color: var(--primary-dark); margin-top: 0.2em; }
.side-sub { display: flex; gap: 0.5rem; align-items: center; font-size: 1rem; margin: 1rem 0 0.25rem; color: var(--primary-dark); }
.hours { margin: 0; font-size: 0.95rem; }
.side-links { list-style: none; padding: 0; margin: 0; }
.side-links li + li { border-top: 1px solid var(--border); }
.side-links a { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.6rem 0; text-decoration: none; font-weight: 600; }
.side-links a:hover { text-decoration: underline; }
.icon.arrow { width: 1rem; height: 1rem; }
.social a { font-weight: 600; }

/* Úvodní stránka */
.intro { margin-bottom: 1.5rem; }
.intro-text > :first-child { margin-top: 0; }
.intro-text > :last-child { margin-bottom: 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem 1rem; }
.section-head h2 { display: flex; align-items: center; gap: 0.5rem; margin-top: 0; }
.section-head h2 .icon { color: var(--primary-dark); }
.home-section { margin-bottom: 2rem; }
.more { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 600; }
.news-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 1.25rem; }
.news-card { position: relative; display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; transition: box-shadow .15s, transform .15s; }
.news-card:hover, .news-card:focus-within { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.news-img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.news-img-empty { display: flex; align-items: center; justify-content: center; background: var(--bg-soft); color: var(--primary-dark); }
.news-img-empty .icon { width: 2.5rem; height: 2.5rem; opacity: 0.6; }
.news-body { padding: 1rem 1.15rem 1.15rem; }
.news-body .meta { margin: 0; font-size: 0.85rem; }
.news-body h3 { margin: 0.25rem 0 0.5rem; font-size: 1.1rem; }
.news-body h3 a { color: var(--text); text-decoration: none; }
.news-body h3 a::after { content: ""; position: absolute; inset: 0; } /* celá karta je klikací */
.news-body h3 a:hover { text-decoration: underline; }
.news-body p:last-child { margin: 0; font-size: 0.95rem; color: var(--muted); }
.home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.event-mini li { display: flex; gap: 0.85rem; align-items: center; }
.date-badge { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 3.25rem; height: 3.25rem; flex-shrink: 0;
    border-radius: var(--radius-sm); background: var(--primary); color: #fff; line-height: 1.05; }
.date-badge .d { font-size: 1.25rem; font-weight: 700; }
.date-badge .m { font-size: 0.75rem; text-transform: uppercase; font-weight: 600; }
.event-text { min-width: 0; }
.event-date { display: block; font-weight: 700; }

@media (max-width: 1000px) {
    .page-grid { grid-template-columns: minmax(0, 1fr); }
    .sidebar { grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); align-items: start; }
}
@media (max-width: 760px) {
    h1 { font-size: 1.6rem; }
    .search-form { width: 100%; }
    .search-form input { flex: 1; min-width: 0; }
    .header-cta { width: 100%; justify-content: center; }
    .hero, .is-sub .hero { height: 7rem; }
    .main-nav { margin-top: -2rem; }
    /* Menu se skrývá jen když běží JavaScript (třída .js), bez JS je vždy vidět. */
    .js .nav-toggle {
        display: flex; align-items: center; gap: 0.5rem; width: 100%; justify-content: center;
        padding: 0.75rem 1rem; border: 0; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-lg);
        font: inherit; font-weight: 700; color: var(--text); cursor: pointer;
    }
    .js .nav-toggle[aria-expanded="true"] { border-radius: var(--radius) var(--radius) 0 0; }
    .tiles-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .js .tiles-nav { display: none; border-radius: 0 0 var(--radius) var(--radius); }
    .js .tiles-nav.open { display: grid; }
    .home-grid { grid-template-columns: minmax(0, 1fr); }
    .is-sub .main { padding: 1.25rem 1rem 1.5rem; }
    .page-grid { padding-top: 1.25rem; }
}

/* Obsah – společné prvky */
.meta { color: var(--muted); font-size: 0.95rem; }
.lead { font-size: 1.2rem; }
.notice { background: #fff8e1; border-left: 5px solid #b7791f; padding: 0.75rem 1rem; }
.content table { border-collapse: collapse; width: 100%; }
.content th, .content td { border: 1px solid var(--border); padding: 0.4rem 0.6rem; text-align: left; }
.content blockquote { border-left: 4px solid var(--primary); margin-left: 0; padding-left: 1rem; }

    display: block; padding: 0.75rem 1rem; background: var(--accent); color: #fff; border-radius: var(--radius);
    font-weight: 700; text-decoration: none;
}

.card-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.card { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; background: #fff; }
.card h2, .card h3 { margin-top: 0; }
.card-row { display: flex; gap: 1rem; }
.card-img { width: 200px; height: 140px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
@media (max-width: 600px) { .card-row { flex-direction: column; } .card-img { width: 100%; height: auto; } }
.board-mini, .event-mini, .doc-list, .search-results { list-style: none; padding: 0; margin: 0; }
.board-mini li, .event-mini li, .doc-list li, .search-results li { padding: 0.6rem 0; border-bottom: 1px solid var(--border); }
.board-mini .meta, .event-mini .meta, .doc-list .meta, .search-results .meta { display: block; }
.event-date-big { font-weight: 700; color: var(--primary-dark); margin: 0; }
.more { font-weight: 600; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1rem; background: var(--bg-soft); padding: 1rem; border-radius: var(--radius); }
.facts dt { font-weight: 700; }
.facts dd { margin: 0; }
@media (max-width: 500px) { .facts { grid-template-columns: 1fr; } .facts dd { margin-bottom: 0.5rem; } }

.attachments ul { padding-left: 1.25rem; }
.file-meta { color: var(--muted); }
.detail-img img { border-radius: var(--radius); }

.filter-form, .search-inline { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 1rem 0; }
.filter-form select, .filter-form input { padding: 0.45rem; font-size: 1rem; border: 2px solid var(--border); border-radius: var(--radius); }
.filter-form button { background: var(--primary); color: #fff; border-color: var(--primary); }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { text-align: left; padding: 0.6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table thead th { background: var(--bg-soft); border-bottom: 2px solid var(--primary); }
.data-table tbody th { font-weight: 600; }

.inline-links { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 1rem; }

.gallery-grid, .photo-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.gallery-grid a { display: block; text-decoration: none; }
.gallery-grid img, .photo-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); display: block; }
.gallery-title { display: block; font-weight: 700; margin-top: 0.25rem; }

.contact-top { display: grid; grid-template-columns: 2fr 1fr; gap: 2rem; }
@media (max-width: 760px) { .contact-top { grid-template-columns: 1fr; } }
.contact-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.contact-list p { margin: 0.25rem 0; }

.pagination ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem; }
.pagination a, .pagination span[aria-current] { display: inline-block; padding: 0.4rem 0.8rem; border: 1px solid var(--border); border-radius: var(--radius); }
.pagination span[aria-current] { background: var(--primary); color: #fff; border-color: var(--primary); }

.mandatory h2 { border-bottom: 2px solid var(--primary); padding-bottom: 0.25rem; }
.sitemap ul ul { margin-top: 0.25rem; }
.error-page { text-align: center; padding: 3rem 0; }

/* Patička */
.site-footer { background: var(--primary-dark); color: #fff; padding-top: 2.5rem; }
.site-footer a, .site-footer .link-button { color: #fff; }
.site-footer h2 { font-size: 1.15rem; margin-top: 0; }
.footer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer address { font-style: normal; }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin: 0.3rem 0; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.3); margin-top: 1.5rem; padding-top: 1rem; padding-bottom: 1rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
.footer-legal { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.link-button { background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; cursor: pointer; }

/* Cookie lišta – obě volby stejně výrazné (požadavek ÚOOÚ) */
.cookie-bar { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; color: var(--text); border-top: 4px solid var(--primary); padding: 1rem 0; z-index: 50; box-shadow: 0 -4px 16px rgba(0,0,0,0.15); }
.cookie-bar .container { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.cookie-bar p { margin: 0; flex: 1 1 30rem; }
.cookie-actions { display: flex; gap: 0.5rem; }
.cookie-actions .btn { background: var(--primary); color: #fff; border-color: var(--primary); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
@media print {
    body { background: #fff; } .page-grid { display: block; } .is-sub .main { box-shadow: none; padding: 0; }
    .main-nav, .hero, .sidebar, .search-form, .header-cta, .site-footer, .cookie-bar, .skip-link, .breadcrumbs { display: none !important; }
    a { color: #000; }
}
