@font-face {
    font-family: "Roboto Condensed";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/roboto-condensed-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Roboto Condensed";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/roboto-condensed-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --red: #ec1117;
    --red-dark: #c80d13;
    /* Barva značky: Debbex červená, DISTYK (body.theme-distyk) žlutá. */
    --accent: var(--red);
    --accent-dark: var(--red-dark);
    --on-accent: #fff;
    --accent-text: var(--red);
    --ink: #1c1d20;
    --muted: #6a6f76;
    --line: #e3e5e9;
    --bg: #f3f4f6;
    --card: #fff;
    --radius: 8px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    --font-title: "Roboto Condensed", "Arial Narrow", var(--font);
    --lh-title: 1.2;
    --lh-text: 1.75;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 var(--font); color: var(--ink); background: var(--bg); }
a { color: inherit; }
h1, h2, h3, h4, .tile__title, .vmodal__head, .vdrop__head { font-family: var(--font-title); line-height: var(--lh-title); }
h1 { font-size: 36px; }
h2 { font-size: 27px; }
h3, h4 { font-size: 18px; }
p { font-size: 16px; line-height: var(--lh-text); }
img { max-width: 100%; }
button, input { font: inherit; color: inherit; }
button, .btn-red { font-family: var(--font-title); }
.ico { flex: none; display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.wrap { max-width: 1320px; margin: 0 auto; padding: 0 18px; }

/* ------------------------------------------------------------ hlavička a patička */

.site-head { background: var(--red); color: #fff; position: sticky; top: 0; z-index: 10; }
.site-head__in { display: flex; align-items: center; gap: 18px; min-height: 64px; max-width: none; }
.site-logo { display: flex; align-items: center; }
.site-logo img { height: 40px; width: auto; display: block; }
.site-search { margin-left: auto; display: flex; width: min(420px, 100%); background: #fff; border-radius: 8px; overflow: hidden; }
.site-search input { flex: 1; min-width: 0; border: 0; padding: 9px 18px; color: var(--ink); background: transparent; outline: none; }
.site-search button { border: 0; background: transparent; color: var(--muted); padding: 0 18px; cursor: pointer; }
.site-search button:hover { color: var(--accent-text); }

.site-foot { margin-top: 54px; background: #fff; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.site-foot__in { display: flex; flex-wrap: wrap; gap: 18px 36px; justify-content: space-between; align-items: center; padding-top: 18px; padding-bottom: 18px; }
.site-foot strong { color: var(--ink); }
.site-foot__addr { display: flex; align-items: center; gap: 6px; }
.site-foot__links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 9px 36px; }
.site-foot__links a { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; }
.site-foot__links a:hover { color: var(--accent-text); }

/* ------------------------------------------------------------ přehled */

body.home { min-height: 100vh; display: flex; flex-direction: column; }
.home-main { flex: 1; width: 100%; padding-top: 36px; }
.home-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.home-top h1 { margin: 0; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.tab { display: flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 6px 18px; border-radius: 4px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 14px; }
.tab span { min-width: 18px; padding: 0 6px; border-radius: 4px; background: var(--bg); color: var(--ink-2); font-family: var(--font); font-size: 12px; font-weight: 600; line-height: 18px; text-align: center; }
.tab.is-active span { background: rgba(255, 255, 255, .22); color: var(--on-accent); }
.tab:hover { color: var(--ink); }
.tab.is-active { background: var(--accent); color: var(--on-accent); }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 1000px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile { display: flex; flex-direction: column; text-decoration: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; transition: box-shadow .18s, transform .18s, border-color .18s; }
.tile { position: relative; }
.tile__pin { position: absolute; top: 9px; right: 9px; z-index: 1; display: flex; padding: 6px; border-radius: 4px; background: var(--accent); color: var(--on-accent); box-shadow: 0 2px 6px rgba(0, 0, 0, .18); }
.tile:hover { box-shadow: 0 10px 26px rgba(20, 22, 26, .12); transform: translateY(-3px); border-color: #d2d5da; }
.tile__cover { position: relative; aspect-ratio: 3 / 4; }
.tile__cover img { position: absolute; inset: 0; margin: auto; max-width: 100%; max-height: 100%; display: block; border-radius: 4px; box-shadow: 0 2px 8px rgba(0, 0, 0, .14); }
.tile__title { margin: 18px -18px 0; padding: 18px 18px 0; border-top: 1px solid var(--line); font-weight: 650; font-size: 18px; line-height: var(--lh-title); }
.tile__meta { margin-top: auto; padding-top: 9px; color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); margin: 0; padding: 54px 18px; text-align: center; background: #fff; border: 2px dashed #c5c9d0; border-radius: 8px; }

.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 14px; }
.back-link:hover { color: var(--accent-text); }
.searched { color: var(--muted); margin: -9px 0 18px; }
.sr-group { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px; margin-bottom: 18px; }
.sr-group h2 { margin: 0 0 18px; display: flex; align-items: center; gap: 9px; }
.sr-group h2 a { text-decoration: none; }
.sr-group h2 a:hover { color: var(--accent-text); }
.count { background: var(--bg); color: var(--muted); border-radius: 4px; padding: 3px 9px; font-size: 13px; font-weight: 600; }
.sr-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px; }
.sr-page { text-decoration: none; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.sr-page img { width: 100%; border: 1px solid var(--line); border-radius: 4px; display: block; transition: border-color .15s; }
.sr-page:hover img { border-color: var(--accent); }
.sr-page__no { font-weight: 650; margin-top: 3px; }
.sr-page__text { color: var(--muted); line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.sr-more { color: var(--muted); font-size: 14px; margin: 18px 0 0; }
mark { background: #ffe3a3; color: inherit; border-radius: 4px; padding: 0 3px; }

.notfound { text-align: center; padding-top: 72px; }
.notfound p { color: var(--muted); margin-bottom: 36px; }
.btn-red { display: inline-block; background: var(--accent); color: var(--on-accent); padding: 9px 18px; border-radius: 8px; text-decoration: none; font-weight: 600; font-size: 18px; }
.btn-red:hover { background: var(--accent-dark); }

@media (max-width: 640px) {
    .site-head__in { flex-wrap: wrap; padding-top: 9px; padding-bottom: 9px; gap: 9px; }
    .site-logo img { height: 32px; }
    .site-search { width: 100%; }
    h1 { font-size: 27px; }
    .tiles { grid-template-columns: repeat(2, 1fr); gap: 9px; }
    .tile { padding: 9px; }
    .tile__title { margin: 9px -9px 0; padding: 9px 9px 0; }
}

/* ------------------------------------------------------------ prohlížeč */

body.viewer { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: #e9ebee; overscroll-behavior: none; }
.preview-bar { background: #1c1d20; color: #fff; font-size: 13px; text-align: center; padding: 6px 9px; }

.vbar { flex: none; display: flex; align-items: center; gap: 18px; height: 70px; padding: 0 18px; background: var(--red); color: #fff; position: relative; z-index: 20; }
.vbar__logo { display: flex; flex: none; }
.vbar__logo img { height: 45px; width: auto; display: block; }
.vbar__title { flex: 1; min-width: 0; margin: 0; font-size: 18px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vtools { display: flex; align-items: center; gap: 3px; }
.vbtn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border: 0; border-radius: 8px; background: transparent; color: #fff; cursor: pointer; text-decoration: none; }
.vbtn:hover, .vdrop.is-open > .vbtn { background: rgba(255, 255, 255, .18); }
.vbtn:disabled { opacity: .4; cursor: default; background: transparent; }
.vbtn--mob { display: none; }
.vbar :focus-visible { outline-color: #fff; }

.vsearch { display: flex; flex: none; width: 240px; background: #fff; border-radius: 8px; overflow: hidden; }
.vsearch input { flex: 1; min-width: 0; border: 0; outline: none; padding: 9px 9px; font-size: 14px; background: transparent; color: var(--ink); }
.vsearch button { border: 0; background: transparent; color: var(--muted); padding: 0 9px; cursor: pointer; }
.vsearch button:hover { color: var(--accent-text); }

body.theme-distyk { --accent: #ffd500; --accent-dark: #f0c800; --on-accent: var(--ink); --accent-text: var(--accent); }
.header--pl { background: #fff; color: var(--ink); border-bottom: 1px solid var(--line); }
.header--pl .vbtn { color: var(--ink); }
.header--pl .vbtn:hover, .header--pl .vdrop.is-open > .vbtn { background: rgba(0, 0, 0, .08); }
.header--pl .vbtn:disabled { background: transparent; }
.header--pl :focus-visible { outline-color: var(--ink); }
.header--pl .site-search, .header--pl .vsearch { box-shadow: inset 0 0 0 1px var(--line); }

.vdrop { position: relative; }
.vdrop__menu { display: none; position: absolute; top: calc(100% + 8px); right: 0; min-width: 250px; max-height: min(70vh, 520px); overflow: auto; background: #fff; color: var(--ink); border-radius: 8px; box-shadow: 0 12px 34px rgba(0, 0, 0, .22); padding: 6px; z-index: 30; }
.vdrop.is-open .vdrop__menu { display: block; }
.vdrop__menu a, .vdrop__menu > button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 9px; border: 0; background: transparent; text-align: left; text-decoration: none; border-radius: 4px; cursor: pointer; font-size: 14px; }
.vdrop__menu a:hover, .vdrop__menu > button:hover { background: var(--bg); }
.vdrop__menu > button span { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.vdrop__head { padding: 9px 9px 9px; font-weight: 650; font-size: 18px; border-bottom: 1px solid var(--line); margin-bottom: 3px; }
.vdrop__link { border-top: 1px solid var(--line); margin-top: 3px; padding: 9px 9px 9px; }
.vdrop__link label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.vdrop__copy { display: flex; gap: 6px; }
.vdrop__copy input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 4px; padding: 6px 9px; font-size: 13px; }
.vdrop__copy button { border: 1px solid var(--line); background: #fff; border-radius: 4px; padding: 0 9px; cursor: pointer; }
.vdrop__copy button:hover { border-color: var(--ink); }
.vdrop__copy button.is-done { background: #1f8f4e; border-color: #1f8f4e; color: #fff; }

.vstage { flex: 1; position: relative; overflow: hidden; min-height: 0; touch-action: none; user-select: none; -webkit-user-select: none; }
.vtrack { position: absolute; inset: 0; will-change: transform; }
.panel { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.sheet { display: flex; flex: none; transform-origin: center center; will-change: transform; box-shadow: 0 6px 30px rgba(20, 22, 26, .2); }
.pg { position: relative; flex: none; background: #fff center / 100% 100% no-repeat; overflow: hidden; }
.pg--blank { background: transparent; }
body.is-spread .sheet { box-shadow: none; }
body.is-spread .pg:not(.pg--blank) { box-shadow: 0 6px 30px rgba(20, 22, 26, .2); }
/* Dvoustrana: vnější stín se u hřbetu ořízne, aby nepadal na sousední stránku; stránky dělí jen tenká linka. */
body.is-spread .pg:not(.pg--blank):has(+ .pg:not(.pg--blank)) { clip-path: inset(-60px 0 -60px -60px); }
body.is-spread .pg:not(.pg--blank) + .pg:not(.pg--blank) { clip-path: inset(-60px -60px -60px 0); }
body.is-spread .pg:not(.pg--blank):has(+ .pg:not(.pg--blank))::after { content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 1px; background: rgba(0, 0, 0, .12); pointer-events: none; }
.pg img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity .2s; pointer-events: none; -webkit-user-drag: none; }
.pg img.is-loaded { opacity: 1; }
.pg a.hs { position: absolute; display: block; cursor: pointer; background: transparent; -webkit-tap-highlight-color: transparent; outline-offset: -2px; transition: background-color .15s ease, box-shadow .15s ease; }
@media (hover: hover) {
    .pg a.hs:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent); }
}
.pg a.hs:focus-visible { outline: none; background: color-mix(in srgb, var(--accent) 9%, transparent); box-shadow: inset 0 0 0 2px var(--accent); }
.pg a.hs:active, .pg a.hs.is-activated { background: color-mix(in srgb, var(--accent) 14%, transparent); box-shadow: inset 0 0 0 2px var(--accent); }
@media (prefers-reduced-motion: reduce) {
    .pg a.hs { transition: none; }
}
.vstage.is-zoomed { cursor: grab; }
.vstage.is-dragging { cursor: grabbing; }
.vstage.is-dragging a.hs { cursor: grabbing; }

.vnav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 76px; display: flex; align-items: center; justify-content: center; border: 0; background: #fff; color: var(--ink); cursor: pointer; box-shadow: 0 2px 12px rgba(0, 0, 0, .14); z-index: 5; transition: color .15s, opacity .15s; }
.vnav--prev { left: 0; border-radius: 0 8px 8px 0; }
.vnav--next { right: 0; border-radius: 8px 0 0 8px; }
.vnav:hover { background: var(--accent); color: var(--on-accent); }
.vnav:disabled { opacity: 0; pointer-events: none; }

.vfoot { flex: none; display: flex; align-items: center; gap: 18px; height: 46px; padding: 0 18px; padding-bottom: env(safe-area-inset-bottom); background: #fff; border-top: 1px solid var(--line); z-index: 6; }
.vfoot input[type=range] { flex: 1; min-width: 0; height: 24px; margin: 0; -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer; }
.vfoot input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--accent) var(--fill, 0%), #d5d8dd var(--fill, 0%)); }
.vfoot input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; margin-top: -9px; border: 0; border-radius: 50%; background: var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.vfoot input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: #d5d8dd; }
.vfoot input[type=range]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
.vfoot input[type=range]::-moz-range-thumb { width: 24px; height: 24px; border: 0; border-radius: 50%; background: var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.vtip { position: fixed; z-index: 30; transform: translate(-50%, calc(-100% - 9px)); padding: 3px 9px; border-radius: 4px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; pointer-events: none; }
.vtip[hidden] { display: none; }
.vpager { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.vpager input { width: 86px; text-align: center; border: 1px solid var(--line); border-radius: 4px; padding: 6px 3px; color: var(--ink); }
.vpager input:focus { border-color: var(--accent); outline: none; }

.vmodal { position: fixed; inset: 0; z-index: 50; background: rgba(20, 22, 26, .55); display: flex; align-items: flex-start; justify-content: center; padding: 36px 18px; }
.vmodal__box { background: #fff; border-radius: 8px; width: min(760px, 100%); max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.vmodal__box--wide { width: min(1100px, 100%); }
.vmodal__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px; border-bottom: 1px solid var(--line); font-size: 18px; }
.vmodal__close { border: 0; background: transparent; cursor: pointer; padding: 3px; border-radius: 4px; color: var(--muted); }
.vmodal__close:hover { color: var(--ink); background: var(--bg); }
.vmodal__body { padding: 18px; overflow: auto; -webkit-overflow-scrolling: touch; }
.vmodal__search { display: flex; }
.vmodal__search input { flex: 1; min-width: 0; border: 1px solid var(--line); border-right: 0; border-radius: 8px 0 0 8px; padding: 9px 18px; outline: none; }
.vmodal__search input:focus { border-color: var(--accent); }
.vmodal__search button { border: 0; background: var(--accent); color: var(--on-accent); font-weight: 600; padding: 0 18px; border-radius: 0 8px 8px 0; cursor: pointer; }
.vmodal__search button:hover { background: var(--accent-dark); }
.vmodal__info { color: var(--muted); margin: 18px 0 9px; min-height: 1em; }
.vmodal__empty { color: var(--muted); grid-column: 1 / -1; }
.vthumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 18px; }
.vthumbs--results { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.vthumb { border: 0; background: transparent; padding: 0; cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.vthumb img { width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: 4px; background: var(--bg); transition: border-color .15s; }
.vthumb:hover img, .vthumb.is-current img { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.vthumb__no { font-weight: 650; color: var(--ink); }
.vthumb__no:empty::before { content: "\00a0"; }
.vthumb__text { color: var(--muted); line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }

#print-area { display: none; }
.noscript { padding: 18px; text-align: center; }

@media (max-width: 860px) {
    .vsearch { display: none; }
    .vbtn--mob { display: inline-flex; }
}

/* Mobil: nástroje se přesunou dolů na dosah palce. */
@media (max-width: 700px) {
    .vbar { height: 48px; gap: 9px; }
    .vbar__logo img { height: 26px; }
    .vtools { position: fixed; left: 0; right: 0; bottom: 0; height: calc(54px + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom); background: #fff; border-top: 1px solid var(--line); justify-content: space-around; z-index: 20; }
    .vtools .vbtn { color: var(--ink); width: 44px; height: 44px; }
    .vtools .vbtn:hover, .vdrop.is-open > .vbtn { background: var(--bg); }
    .vbtn--desk { display: none; }
    .vdrop { position: static; }
    .vdrop__menu { position: fixed; top: auto; bottom: calc(60px + env(safe-area-inset-bottom)); left: 8px; right: 8px; min-width: 0; }
    .vfoot { margin-bottom: calc(54px + env(safe-area-inset-bottom)); padding-bottom: 0; height: 40px; }
    .vnav { display: none; }
    .vmodal { padding: 0; }
    .vmodal__box { border-radius: 0; max-height: none; height: 100%; width: 100%; }
    .vthumbs { grid-template-columns: repeat(3, 1fr); }
    .vthumbs--results { grid-template-columns: repeat(2, 1fr); }
}

@media print {
    @page { margin: 8mm; }
    body.viewer { display: block; height: auto; overflow: visible; background: #fff; }
    body.viewer > *:not(#print-area) { display: none !important; }
    #print-area { display: block; }
    #print-area img { display: block; width: 100%; max-height: 270mm; object-fit: contain; page-break-after: always; break-after: page; }
    #print-area img:last-child { page-break-after: auto; break-after: auto; }
}
