/* ============================================================
   Frontend — www.sraga.cz (skills: design, menu-layout)
   ============================================================ */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 1.0625rem;
  line-height: 1.7;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 640px) { .container { padding: 0 16px; } }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--accent); color: #fff; padding: 10px 18px; border-radius: var(--radius-sm);
}
.skip-link:focus { left: 8px; top: 8px; }

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

/* ============ Hlavička ============ */
header.site {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
header.site .container { display: flex; align-items: center; gap: 32px; height: 64px; }
.logo { font-size: 1.25rem; font-weight: 700; color: var(--text); white-space: nowrap; }
.logo:hover { text-decoration: none; color: var(--accent); }

nav.main { flex: 1; }
nav.main ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
nav.main > ul > li { position: relative; }
nav.main a {
  display: flex; align-items: center; gap: 5px; padding: 10px 14px;
  color: var(--text); font-weight: 500; border-radius: var(--radius-sm);
}
nav.main a:hover { background: var(--bg-alt); text-decoration: none; }
nav.main > ul > li > a.active {
  color: var(--accent);
  box-shadow: inset 0 -2px 0 var(--accent);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.caret { font-size: .65em; transition: transform .15s; }
nav.main li:hover > a .caret, nav.main li:focus-within > a .caret { transform: rotate(180deg); }

nav.main .dropdown {
  position: absolute; top: 100%; left: 0; min-width: 230px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 8px; display: none; flex-direction: column; list-style: none;
}
nav.main li:hover > .dropdown, nav.main li:focus-within > .dropdown { display: flex; }
nav.main .dropdown li { position: relative; }
nav.main .dropdown a { padding: 9px 12px; font-weight: 400; }
nav.main .dropdown .dropdown { top: -8px; left: 100%; }
nav.main .dropdown .sub > a { padding-left: 24px; font-size: .95em; color: var(--text-muted); }

.header-actions { display: flex; gap: 6px; align-items: center; }
.iconbtn {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: none; border: none; border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text);
}
.iconbtn:hover { background: var(--bg-alt); }
.iconbtn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Vyhledávání v hlavičce */
.search-form { display: flex; align-items: center; }
.search-form input {
  width: 0; opacity: 0; padding: 0; border: 1px solid var(--border);
  border-radius: var(--radius-sm); height: 38px; background: var(--bg);
  color: var(--text); font: inherit; font-size: .95rem;
  transition: width .2s, opacity .2s, padding .2s;
}
.search-form.open input { width: 200px; opacity: 1; padding: 0 12px; }

.hamburger { display: none; }

/* ============ Mobilní menu ============ */
@media (max-width: 959px) {
  nav.main { display: none; }
  .hamburger { display: grid; }
}
.mobile-menu {
  position: fixed; inset: 0 0 0 auto; width: min(360px, 100%);
  background: var(--bg); z-index: 150; padding: 16px;
  transform: translateX(100%); transition: transform .2s;
  overflow-y: auto; border-left: 1px solid var(--border);
}
.mobile-menu.open { transform: translateX(0); }
.mobile-overlay {
  position: fixed; inset: 0; background: rgb(0 0 0 / .4); z-index: 140;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.mobile-overlay.show { opacity: 1; pointer-events: auto; }
.mobile-menu .close-row { display: flex; justify-content: flex-end; }
.mobile-menu form { margin: 8px 0 16px; }
.mobile-menu form input {
  width: 100%; height: 44px; padding: 0 14px; font: inherit;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text);
}
.mobile-menu ul { list-style: none; margin: 0; padding: 0; }
.mobile-menu li { border-bottom: 1px solid var(--border); }
.mobile-menu a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 6px; color: var(--text); font-weight: 500; min-height: 44px;
}
.mobile-menu .acc-toggle {
  background: none; border: none; color: var(--text); font-size: 1.3rem;
  width: 44px; height: 44px; cursor: pointer; flex: none;
}
.mobile-menu li > .row { display: flex; align-items: center; }
.mobile-menu li > .row > a { flex: 1; }
.mobile-menu ul ul { display: none; padding-left: 16px; }
.mobile-menu ul ul.open { display: block; }
.mobile-menu ul ul a { font-weight: 400; }
body.menu-open { overflow: hidden; }

/* ============ Obsah / výpisy ============ */
main { padding: 40px 0 64px; background: var(--bg-alt); }
.page-title {
  font-size: 1.05rem; font-weight: 600; color: var(--text-muted);
  margin: 0 0 24px; text-transform: uppercase; letter-spacing: .06em;
}
.page-title strong { color: var(--text); }

.badge {
  display: inline-block; background: var(--accent-soft); color: var(--accent);
  border-radius: var(--radius-sm); padding: 2px 10px; font-size: .8rem; font-weight: 600;
}
a.badge:hover { text-decoration: none; background: var(--accent); color: #fff; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }

/* Karta článku */
.card {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.thumb { aspect-ratio: 16/9; background: var(--accent-soft); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.ph { display: grid; place-items: center; color: var(--accent); font-size: 2.2rem; font-weight: 700; }
.card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card h2, .card h3 { margin: 0; font-size: 1.15rem; line-height: 1.35; font-weight: 650; }
.card h2 a, .card h3 a { color: var(--text); }
.card h2 a:hover, .card h3 a:hover { color: var(--accent); text-decoration: none; }
.excerpt {
  margin: 0; color: var(--text-muted); font-size: .95rem;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.meta { margin-top: auto; font-size: .875rem; color: var(--text-muted); }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
@media (max-width: 959px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } }

/* Hero — nejnovější článek */
.hero {
  display: grid; grid-template-columns: 1.2fr 1fr;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 32px;
}
.hero:hover { transform: none; }
.hero .thumb { aspect-ratio: auto; min-height: 300px; }
.hero-body { padding: 32px; display: flex; flex-direction: column; gap: 14px; justify-content: center; }
.hero-body h2 { margin: 0; font-size: clamp(1.4rem, 2.6vw, 1.9rem); line-height: 1.25; font-weight: 700; }
.hero-body h2 a { color: var(--text); }
.hero-body h2 a:hover { color: var(--accent); text-decoration: none; }
.hero-body .excerpt { -webkit-line-clamp: 4; font-size: 1rem; }
@media (max-width: 959px) {
  .hero { grid-template-columns: 1fr; }
  .hero .thumb { min-height: 200px; aspect-ratio: 16/9; }
}

/* Stránkování */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 40px; flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 40px; height: 40px; display: grid; place-items: center; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-elevated); color: var(--text); font-weight: 500;
}
.pagination .current { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination a:hover { border-color: var(--accent); text-decoration: none; }

mark { background: var(--accent-soft); color: var(--accent); padding: 0 2px; border-radius: 3px; }

/* ============ Detail článku ============ */
.article-wrap { max-width: 760px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 640px) { .article-wrap { padding: 0 16px; } }
main.single { background: var(--bg); padding: 32px 0 64px; }

.breadcrumbs { font-size: .875rem; color: var(--text-muted); margin-bottom: 20px; }
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs span { color: var(--text-muted); }

article h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); line-height: 1.2; margin: 14px 0; font-weight: 700; }

.article-meta {
  display: flex; gap: 14px; align-items: center; color: var(--text-muted);
  font-size: .875rem; margin-bottom: 28px; flex-wrap: wrap;
}
.article-meta strong { color: var(--text); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--accent);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none;
}

/* Jazykový přepínač článku */
.langs { display: flex; gap: 4px; margin-left: auto; }
.langs a {
  padding: 3px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: .8rem; font-weight: 600; color: var(--text-muted);
}
.langs a.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.langs a:hover { text-decoration: none; border-color: var(--accent); }

/* Náhledový obrázek — VŽDY přirozená velikost souboru, žádný upscale/crop */
.featured { margin: 0 0 32px; text-align: center; }
.featured img {
  display: inline-block; max-width: 100%; height: auto;
  border-radius: var(--radius); border: 1px solid var(--border);
}

/* Obsah (TOC) */
.toc {
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 22px; margin: 0 0 32px; font-size: .95rem;
}
.toc strong { display: block; margin-bottom: 8px; }
.toc ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 5px; }
.toc .toc-sub { margin-left: 16px; }

/* Tělo článku */
.article-content { max-width: 72ch; }
.article-content h2 { font-size: 1.5rem; font-weight: 650; margin: 2.5rem 0 1rem; }
.article-content h3 { font-size: 1.2rem; font-weight: 600; margin: 2rem 0 .75rem; }
.article-content h4, .article-content h5, .article-content h6 { margin: 1.6rem 0 .6rem; }
.article-content p { margin: 0 0 1.1em; }
.article-content ul, .article-content ol { margin: 0 0 1.1em; padding-left: 26px; }
.article-content code {
  font-family: var(--font-mono); font-size: .9em;
  background: var(--bg-alt); padding: 2px 6px; border-radius: 4px;
}
.article-content table { border-collapse: collapse; margin: 1.4em 0; width: 100%; font-size: .95rem; }
.article-content th, .article-content td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.article-content th { background: var(--bg-alt); }

/* Obrázky v textu — přirozená velikost, žádný upscale, na střed */
.article-content figure { margin: 1.4em 0; text-align: center; }
.article-content figure img, .article-content p > img {
  display: inline-block; max-width: 100%; height: auto;
  border-radius: var(--radius); border: 1px solid var(--border);
}
.article-content figcaption { font-size: .875rem; color: var(--text-muted); margin-top: 8px; }
.article-content .gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin: 1.4em 0; }
@media (max-width: 640px) { .article-content .gallery { grid-template-columns: 1fr; } }
.article-content .gallery figure { margin: 0; }

/* Bloky kódu — vždy tmavé (oba režimy) */
.codeblock { position: relative; margin: 1.4em 0; }
.codeblock pre {
  background: var(--code-bg); color: var(--code-text);
  border-radius: var(--radius); padding: 18px 20px; overflow-x: auto; margin: 0;
  font-family: var(--font-mono); font-size: .875rem; line-height: 1.6;
}
.codeblock pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.copybtn {
  position: absolute; top: 10px; right: 10px;
  background: rgb(255 255 255 / .1); color: var(--code-text);
  border: none; border-radius: var(--radius-sm); padding: 5px 12px;
  font-size: .8rem; cursor: pointer; font-family: var(--font-sans);
}
.copybtn:hover { background: rgb(255 255 255 / .2); }

.article-content blockquote {
  border-left: 3px solid var(--accent); margin: 1.4em 0;
  padding: 4px 0 4px 20px; color: var(--text-muted); font-style: italic;
}
.article-content blockquote cite { display: block; margin-top: 6px; font-size: .875rem; font-style: normal; }

/* Upozornění (migrované Elementor alerty) */
.note {
  background: var(--accent-soft); border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 18px; margin: 1.4em 0; font-size: .95rem;
}
.note-warning { border-left-color: var(--warning); }
.note-danger { border-left-color: var(--error); }
.note-success { border-left-color: var(--success); }
.note p { margin: 0 0 .5em; }
.note p:last-child { margin: 0; }

/* YouTube embed */
.video-embed {
  aspect-ratio: 16/9; margin: 1.4em 0; border-radius: var(--radius);
  overflow: hidden; background: var(--code-bg);
}
.video-embed iframe { width: 100%; height: 100%; border: 0; display: block; }

.html-embed { max-width: 100%; overflow-x: auto; margin: 1.4em 0; }

/* Sloupce vedle sebe (migrované Elementor kontejnery) */
.cols { display: grid; gap: 24px; margin: 1.4em 0; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 640px) { .cols-2, .cols-3 { grid-template-columns: 1fr; } }

.icon-list { list-style: none; padding-left: 0 !important; }
.icon-list li { padding: 4px 0 4px 26px; position: relative; }
.icon-list li::before {
  content: ""; position: absolute; left: 4px; top: 13px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
}

/* Štítky pod článkem, autor, navigace */
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 40px 0 0; padding-top: 24px; border-top: 1px solid var(--border); }
.author-box {
  display: flex; gap: 18px; background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; margin-top: 32px; align-items: center;
}
.author-box .avatar { width: 56px; height: 56px; font-size: 1.2rem; }
.author-box p { margin: 4px 0 0; font-size: .92rem; color: var(--text-muted); }
.author-box strong { font-size: 1.05rem; }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 32px; }
@media (max-width: 640px) { .post-nav { grid-template-columns: 1fr; } }
.post-nav a {
  display: block; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px; color: var(--text); font-size: .92rem;
}
.post-nav a:hover { border-color: var(--accent); text-decoration: none; }
.post-nav small { display: block; color: var(--text-muted); margin-bottom: 4px; }
.post-nav .next { text-align: right; }

/* Související články */
.related h2 { font-size: 1.35rem; margin: 48px 0 18px; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 640px) { .related-grid { grid-template-columns: 1fr; } }
.related-card {
  display: flex; flex-direction: column; gap: 8px;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; color: var(--text); background: var(--bg-elevated);
  font-size: .95rem; line-height: 1.4;
}
.related-card:hover { border-color: var(--accent); text-decoration: none; }
.related-card small { color: var(--text-muted); margin-top: auto; }
.related-card .badge { align-self: flex-start; }

/* ============ Stránky (O mně, Kontakt) ============ */
.page-content h2 { font-size: 1.5rem; font-weight: 650; margin: 2.2rem 0 1rem; }

/* Kontaktní formulář */
.contact-form { max-width: 560px; margin: 1.5em 0; display: flex; flex-direction: column; gap: 16px; }
.contact-form label { font-weight: 600; font-size: .9rem; display: block; margin-bottom: 6px; }
.contact-form input, .contact-form textarea {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font: inherit; padding: 9px 12px;
}
.contact-form input { height: 40px; padding: 0 12px; }
.contact-form input:focus, .contact-form textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none;
}
.contact-form .hp { position: absolute; left: -9999px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 40px; padding: 0 20px; border-radius: var(--radius-sm);
  font: inherit; font-weight: 600; cursor: pointer; border: none;
  background: var(--accent); color: #fff;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }

.flash {
  padding: 12px 18px; border-radius: var(--radius-sm); margin: 0 0 20px;
  background: var(--accent-soft); color: var(--text); font-size: .95rem;
}
.flash.success { border-left: 3px solid var(--success); }
.flash.error { border-left: 3px solid var(--error); }

/* ============ Patička ============ */
footer.site { background: var(--bg-alt); border-top: 1px solid var(--border); padding: 48px 0 0; }
main + footer.site { background: var(--bg); }
.foot-grid { display: grid; grid-template-columns: 1.3fr 1fr 1.4fr 1.1fr; gap: 40px; padding-bottom: 40px; }
@media (max-width: 959px) { .foot-grid { grid-template-columns: 1fr; gap: 28px; } }
footer.site h4 { margin: 0 0 14px; font-size: 1rem; }
footer.site ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: .92rem; }
footer.site p { margin: 0; color: var(--text-muted); font-size: .92rem; }
.tagcloud { display: flex; flex-wrap: wrap; gap: 6px; }
.copy { border-top: 1px solid var(--border); padding: 18px 0; text-align: center; font-size: .875rem; color: var(--text-muted); }

/* 404 */
.error-page { text-align: center; padding: 60px 0; }
.error-page h1 { font-size: 3rem; margin: 0 0 10px; }
