/* SFPI — styl webu. Bez frameworků, kontrast dle WCAG 2.1 AA. */

:root {
  --navy:   #1a3e6e;   /* hlavní barva fondu */
  --navy-d: #122c50;   /* tmavší (hover, patička) */
  --accent: #b7893c;   /* zlatavý doplněk */
  --text:   #1c2430;
  --muted:  #5a6472;   /* na bílé 4,6:1 — AA ok */
  --bg:     #ffffff;
  --bg-alt: #f2f5f9;
  --line:   #d4dbe4;
  --ok:     #1c6b37;
  --err:    #a52333;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.6 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 1.25rem; }

h1 { font-size: 1.9rem; line-height: 1.25; margin: 1.2rem 0 .8rem; }
h2 { font-size: 1.35rem; margin: 1.6rem 0 .6rem; }
h3 { font-size: 1.05rem; margin: .8rem 0 .3rem; }

a { color: var(--navy); }
a:hover { color: var(--navy-d); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.lead  { font-size: 1.1rem; }
.muted { color: var(--muted); }
.more  { font-weight: 600; text-decoration: none; }
.more:hover { text-decoration: underline; }

/* --- přístupnost --- */
.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--navy); color: #fff; padding: .6rem 1rem; z-index: 10;
}
.skip-link:focus { left: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* --- hlavička --- */
.site-header { border-bottom: 4px solid var(--accent); }
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1rem 1.25rem; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .8rem; text-decoration: none; color: var(--text); }
.brand-mark {
  background: var(--navy); color: #fff; font-weight: 800;
  padding: .45rem .7rem; border-radius: 4px; letter-spacing: .05em;
}
.brand-name { font-weight: 600; max-width: 16rem; line-height: 1.25; }

.search-form { display: flex; gap: .4rem; }
.search-form input {
  padding: .5rem .7rem; border: 1px solid var(--line); border-radius: 4px;
  min-width: 14rem; font-size: 1rem;
}
.search-form button, .admin-form button {
  padding: .5rem 1rem; border: 0; border-radius: 4px; font-size: 1rem;
  background: var(--navy); color: #fff; cursor: pointer;
}
.search-form button:hover, .admin-form button:hover { background: var(--navy-d); }
.search-big { margin: 1rem 0 1.5rem; }
.search-big input { flex: 1; }

.site-nav { background: var(--navy); }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.site-nav a {
  display: block; padding: .7rem 1rem; color: #fff;
  text-decoration: none; font-weight: 500;
}
.site-nav a:hover, .site-nav a:focus-visible { background: var(--navy-d); color: #fff; }
.site-nav a[aria-current="page"] { background: var(--navy-d); box-shadow: inset 0 -3px 0 var(--accent); }

/* --- úvod --- */
.hero { padding: 1.5rem 0 .5rem; }
.hero h1 { margin-bottom: .4rem; }

.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem; margin: 1rem 0;
}
.card {
  display: block; padding: 1rem 1.1rem; border: 1px solid var(--line);
  border-radius: 8px; text-decoration: none; color: var(--text);
  background: var(--bg-alt);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.card:hover {
  border-color: var(--navy);
  box-shadow: 0 4px 14px rgba(26, 62, 110, .10);
  transform: translateY(-1px);
}
.card h3, .card-h { margin: 0 0 .35rem; color: var(--navy); font-size: 1.05rem; }
.card p { margin: 0; font-size: .92rem; }

.two-col { display: grid; grid-template-columns: 3fr 2fr; gap: 2.5rem; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }

/* --- dokumenty --- */
.doc-list { list-style: none; margin: .8rem 0; padding: 0; }
.doc-item { border-bottom: 1px solid var(--line); }
.doc-link {
  display: grid; grid-template-columns: auto 1fr; column-gap: .9rem;
  padding: .7rem .2rem; text-decoration: none; color: var(--text);
}
.doc-link:hover .doc-title { text-decoration: underline; color: var(--navy-d); }
.doc-ext {
  grid-row: span 2; align-self: center;
  background: var(--navy); color: #fff; font-size: .72rem; font-weight: 700;
  padding: .35rem .45rem; border-radius: 4px; min-width: 3.2em; text-align: center;
}
.doc-title { font-weight: 600; color: var(--navy); }
.doc-meta  { font-size: .85rem; color: var(--muted); }

.filter { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0; }
.filter a {
  padding: .35rem .8rem; border: 1px solid var(--line); border-radius: 999px;
  text-decoration: none; font-size: .92rem;
}
.filter a[aria-current="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }

/* --- aktuality, články --- */
.news-teaser { padding: .6rem 0; border-bottom: 1px solid var(--line); }
.news-teaser p { margin: .2rem 0; }
.article table { border-collapse: collapse; margin: 1rem 0; }
.article th, .article td { border: 1px solid var(--line); padding: .45rem .7rem; text-align: left; }
.article th { background: var(--bg-alt); }

/* --- hledání --- */
.hit-list { list-style: none; margin: 1rem 0; padding: 0; }
.hit { padding: .8rem 0; border-bottom: 1px solid var(--line); }
.hit-kind {
  display: inline-block; font-size: .75rem; font-weight: 700;
  color: var(--navy); background: var(--bg-alt);
  border: 1px solid var(--line); border-radius: 4px;
  padding: .05rem .45rem; margin-right: .5rem;
}
.hit-title { font-weight: 600; }
.hit .doc-meta { display: block; margin-top: .15rem; }
.hit-snippet { margin: .3rem 0 0; font-size: .9rem; color: var(--muted); }

/* --- admin --- */
.admin-form {
  background: var(--bg-alt); border: 1px solid var(--line);
  border-radius: 6px; padding: .3rem 1.1rem .6rem; margin: .8rem 0 1.5rem;
}
.admin-form label { font-weight: 600; }
.admin-form input[type=text], .admin-form input[type=password], .admin-form select {
  padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 4px; font-size: 1rem;
  max-width: 100%;
}
.admin-table { border-collapse: collapse; width: 100%; margin: .8rem 0; }
.admin-table th, .admin-table td {
  border-bottom: 1px solid var(--line); padding: .45rem .6rem; text-align: left;
  font-size: .93rem;
}
.admin-table th { background: var(--bg-alt); }

.msg { padding: .6rem .9rem; border-radius: 4px; font-weight: 600; }
.msg-ok  { background: #e7f3ea; color: var(--ok); }
.msg-err { background: #fbe9ec; color: var(--err); }

/* --- stránka dokumentu --- */
.crumb { font-size: .9rem; margin: 1rem 0 0; }
.crumb a { text-decoration: none; }
.crumb a:hover { text-decoration: underline; }
.crumb span { color: var(--muted); margin: 0 .35rem; }

.doc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.doc-head h1 { margin-bottom: .4rem; }

.doc-badges { margin: .2rem 0 .8rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.badge {
  display: inline-block; font-size: .78rem; font-weight: 700;
  color: var(--navy); background: var(--bg-alt);
  border: 1px solid var(--line); border-radius: 999px; padding: .15rem .6rem;
}
.badge-current { color: #fff; background: var(--ok); border-color: var(--ok); }

.doc-meta-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .8rem 1.2rem; margin: 1rem 0;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg-alt); padding: .9rem 1.1rem;
}
.doc-meta-grid dt { font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); }
.doc-meta-grid dd { margin: .1rem 0 0; font-weight: 600; }

.tag-row { display: flex; flex-wrap: wrap; gap: .4rem; margin: .8rem 0; }
.tag {
  display: inline-block; font-size: .82rem; text-decoration: none;
  color: var(--navy); background: var(--bg-alt);
  border: 1px solid var(--line); border-radius: 999px; padding: .18rem .65rem;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.tag:hover, .tag[aria-current="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.tag-sm { font-size: .72rem; padding: .05rem .5rem; margin-left: .25rem; }
.tag-inline { display: inline-flex; flex-wrap: wrap; }
.tag-clear { color: var(--err); }

.doc-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.2rem 0; }
.btn {
  display: inline-block; padding: .6rem 1.2rem; border-radius: 6px;
  background: var(--navy); color: #fff; font-weight: 600; text-decoration: none;
  transition: background .15s ease, box-shadow .15s ease;
}
.btn:hover { background: var(--navy-d); color: #fff; box-shadow: 0 3px 10px rgba(26, 62, 110, .25); }
.btn-ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--bg-alt); color: var(--navy-d); box-shadow: none; }

.fav-btn {
  font: inherit; font-weight: 600; cursor: pointer;
  color: var(--navy); background: var(--bg-alt);
  border: 1px solid var(--line); border-radius: 999px; padding: .4rem .9rem;
  transition: background .15s ease, border-color .15s ease;
  margin-top: 1.2rem; white-space: nowrap;
}
.fav-btn:hover { border-color: var(--accent); }
.fav-btn.fav-on { background: #fdf6e7; border-color: var(--accent); color: #7a5a22; }

.doc-preview {
  width: 100%; height: 34rem; border: 1px solid var(--line);
  border-radius: 8px; background: var(--bg-alt);
}

.history-table { border-collapse: collapse; width: 100%; margin: .8rem 0; }
.history-table th, .history-table td {
  border-bottom: 1px solid var(--line); padding: .5rem .6rem; text-align: left;
  font-size: .93rem;
}
.history-table th { background: var(--bg-alt); }

.related-list {
  list-style: none; margin: .8rem 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem;
}
.card-slim .card-h { display: block; }
.card-slim .doc-meta { display: block; margin-top: .2rem; }

/* --- dashboard (úvod) --- */
.dash-row { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
@media (max-width: 700px) { .dash-row { grid-template-columns: 1fr; gap: 0; } }
.quick-list { list-style: none; margin: .6rem 0; padding: 0; }
.quick-list li { margin: 0 0 .45rem; }
.quick-link {
  display: block; padding: .55rem .8rem; border: 1px solid var(--line);
  border-radius: 6px; text-decoration: none; font-weight: 600;
  background: var(--bg-alt);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.quick-link:hover { border-color: var(--navy); box-shadow: 0 2px 8px rgba(26, 62, 110, .10); }

/* --- klávesová zkratka a živý filtr --- */
.search-wrap { position: relative; display: inline-flex; align-items: center; }
.search-wrap input { padding-right: 4.4rem; }
.kbd, kbd {
  font: 700 .72rem/1 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--muted); background: var(--bg-alt);
  border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 4px; padding: .2rem .4rem;
}
.search-wrap .kbd {
  position: absolute; right: .5rem; cursor: pointer; display: none;
}
.js .search-wrap .kbd { display: inline-block; }

.doc-filter {
  width: 100%; max-width: 26rem; font-size: 1rem;
  padding: .55rem .8rem; border: 1px solid var(--line); border-radius: 6px;
}
.filter a { transition: background .15s ease, color .15s ease, border-color .15s ease; }
.filter-tags { margin-top: -.4rem; }

/* --- command palette --- */
.palette-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(18, 44, 80, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 10vh 1rem 0;
}
.palette {
  width: 100%; max-width: 34rem; background: var(--bg);
  border-radius: 10px; box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
  overflow: hidden; animation: palette-in .16s ease;
}
@keyframes palette-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: none; }
}
.palette-input {
  width: 100%; border: 0; border-bottom: 1px solid var(--line);
  font-size: 1.1rem; padding: .9rem 1.1rem; outline-offset: -3px;
}
.palette-list {
  list-style: none; margin: 0; padding: .35rem;
  max-height: 21rem; overflow-y: auto;
}
.palette-item {
  display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap;
  padding: .55rem .7rem; border-radius: 6px; cursor: pointer;
}
.palette-item[aria-selected="true"] { background: var(--bg-alt); box-shadow: inset 3px 0 0 var(--accent); }
.palette-title { font-weight: 600; color: var(--navy); }
.palette-item .doc-meta { flex-basis: 100%; }
.palette-note { padding: .8rem; }
.palette-help {
  margin: 0; padding: .5rem .9rem; border-top: 1px solid var(--line);
  font-size: .8rem; color: var(--muted); background: var(--bg-alt);
}

/* méně pohybu pro ty, kdo si to přejí */
@media (prefers-reduced-motion: reduce) {
  .card, .btn, .tag, .quick-link, .filter a, .fav-btn { transition: none; }
  .palette { animation: none; }
}

/* --- patička --- */
.site-footer {
  margin-top: 2.5rem; background: var(--navy-d); color: #fff;
}
.site-footer a { color: #cfe0f5; }
.footer-cols {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; padding: 1.6rem 1.25rem;
}
@media (max-width: 600px) { .footer-cols { grid-template-columns: 1fr; } }
.footer-h { font-size: 1rem; margin: 0 0 .5rem; color: #fff; }
.site-footer address { font-style: normal; }
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links li { margin: .25rem 0; }
.footer-note {
  border-top: 1px solid rgba(255,255,255,.2);
  padding: .8rem 1.25rem; font-size: .85rem; color: #c6d2e2;
}

/* === Editor obsahu v adminu (/admin/obsah) === */
.btn-new { display: inline-block; background: var(--navy); color: #fff; padding: .5rem 1rem; border-radius: 8px; font-weight: 600; }
.btn-new:hover { background: var(--navy-d); }
.ed-meta { display: flex; flex-wrap: wrap; gap: 0 1.25rem; align-items: end; }
.ed-meta .ed-title { flex: 2 1 260px; }
.ed-meta .ed-perex { flex: 1 1 100%; }
.ed-meta input[type=text] { width: 100%; }
.ed-toolbar { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .75rem 0 .4rem; }
.ed-toolbar button { padding: .3rem .7rem; border: 1px solid #ccc; background: #fff; color: #333; border-radius: 6px; cursor: pointer; font-size: .9rem; }
.ed-toolbar button:hover { background: #f0f0f0; }
.ed-hint { margin-left: auto; font-size: .85rem; }
.ed-panes { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: stretch; }
.ed-panes textarea { width: 100%; min-height: 420px; resize: vertical; font: 14px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace; padding: .9rem; border: 1px solid #ccc; border-radius: 8px; }
.ed-preview { border: 1px dashed #ccc; border-radius: 8px; padding: .9rem 1.1rem; overflow-y: auto; max-height: 620px; background: #fff; }
.ed-save { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; }
@media (max-width: 900px) { .ed-panes { grid-template-columns: 1fr; } }

/* === Správa menu webu v adminu === */
.nav-inline { display: inline; }
.nav-inline button { padding: .2rem .6rem; border: 1px solid #ccc; background: #fff; color: #333; border-radius: 6px; cursor: pointer; }
.nav-inline button:hover { background: #f0f0f0; }
.nav-order form { margin-right: .25rem; }
.nav-add input[type=text] { width: 14rem; max-width: 100%; }
.nav-add label { margin-left: .75rem; }
.nav-add label:first-child { margin-left: 0; }
.nav-reset { background: #fff; color: #333; border: 1px solid #ccc; }
.msg-tip { background: #fff8e6; border: 1px solid #e6cf8a; padding: .6rem 1rem; border-radius: 8px; }
.btn-armed { background: #b91c1c !important; color: #fff !important; border-color: #b91c1c !important; }

/* Dlaždice editoru na hlavní stránce adminu — ať nezapadne */
.admin-tile { background: linear-gradient(135deg, #fdf6ec, #fff); border: 2px solid var(--accent); border-radius: 12px; padding: 1.1rem 1.4rem 1.2rem; margin: 1.2rem 0 2rem; }
.admin-tile h2 { margin-top: 0; }
.admin-tile-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 0; }
.btn-secondary { background: #fff; color: var(--navy); border: 1px solid var(--navy); }
.btn-secondary:hover { background: var(--bg-alt, #f5f5f5); }
.admin-ver { font-size: .55em; font-weight: 400; color: #999; vertical-align: middle; }
